2023-05-13 18:22:06

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 9/9] staging: rtl8192e: Remove undefined function LedControlHandler

Remove function LedControlHandler as it is not defined. Remove resulting
unused local variables bLedBlinking, type, fc and LedAction.

Signed-off-by: Philipp Hortmann <[email protected]>
---
.../staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 26 -------------------
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 4 ---
drivers/staging/rtl8192e/rtllib.h | 2 --
drivers/staging/rtl8192e/rtllib_softmac.c | 10 -------
5 files changed, 46 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index c612e31d1a84..d9d056d18fa3 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -46,7 +46,6 @@ static void _rtl92e_update_msr(struct net_device *dev)
{
struct r8192_priv *priv = rtllib_priv(dev);
u8 msr;
- enum led_ctl_mode LedAction = LED_CTL_NO_LINK;

msr = rtl92e_readb(dev, MSR);
msr &= ~MSR_LINK_MASK;
@@ -55,7 +54,6 @@ static void _rtl92e_update_msr(struct net_device *dev)
case IW_MODE_INFRA:
if (priv->rtllib->state == RTLLIB_LINKED)
msr |= MSR_LINK_MANAGED;
- LedAction = LED_CTL_LINK;
break;
case IW_MODE_ADHOC:
if (priv->rtllib->state == RTLLIB_LINKED)
@@ -70,8 +68,6 @@ static void _rtl92e_update_msr(struct net_device *dev)
}

rtl92e_writeb(dev, MSR, msr);
- if (priv->rtllib->LedControlHandler)
- priv->rtllib->LedControlHandler(dev, LedAction);
}

void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val)
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 5fdee7b54f24..17b70dde7eeb 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -737,8 +737,6 @@ static void _rtl92e_init_priv_handler(struct net_device *dev)
priv->rtllib->InitialGainHandler = rtl92e_init_gain;
priv->rtllib->rtllib_ips_leave_wq = rtl92e_rtllib_ips_leave_wq;
priv->rtllib->rtllib_ips_leave = rtl92e_rtllib_ips_leave;
-
- priv->rtllib->LedControlHandler = NULL;
priv->rtllib->ScanOperationBackupHandler = rtl92e_scan_op_backup;
}

@@ -1272,10 +1270,6 @@ static void _rtl92e_watchdog_wq_cb(void *data)
ieee->is_roaming = true;
ieee->is_set_key = false;
ieee->link_change(dev);
- if (ieee->LedControlHandler)
- ieee->LedControlHandler(ieee->dev,
- LED_CTL_START_TO_LINK);
-
notify_wx_assoc_event(ieee);

if (!(ieee->rtllib_ap_sec_type(ieee) &
@@ -1506,7 +1500,6 @@ static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb)
MAX_DEV_ADDR_SIZE);
struct tx_desc *pdesc = NULL;
struct rtllib_hdr_1addr *header = NULL;
- u16 fc = 0, type = 0;
u8 *pda_addr = NULL;
int idx;
u32 fwinfo_size = 0;
@@ -1522,8 +1515,6 @@ static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb)
fwinfo_size = sizeof(struct tx_fwinfo_8190pci);

header = (struct rtllib_hdr_1addr *)(((u8 *)skb->data) + fwinfo_size);
- fc = le16_to_cpu(header->frame_ctl);
- type = WLAN_FC_GET_TYPE(fc);
pda_addr = header->addr1;

if (!is_broadcast_ether_addr(pda_addr) && !is_multicast_ether_addr(pda_addr))
@@ -1545,11 +1536,6 @@ static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb)
spin_unlock_irqrestore(&priv->irq_th_lock, flags);
return skb->len;
}
-
- if (type == RTLLIB_FTYPE_DATA) {
- if (priv->rtllib->LedControlHandler)
- priv->rtllib->LedControlHandler(dev, LED_CTL_TX);
- }
rtl92e_fill_tx_desc(dev, pdesc, tcb_desc, skb);
__skb_queue_tail(&ring->queue, skb);
pdesc->OWN = 1;
@@ -1776,8 +1762,6 @@ static void _rtl92e_rx_normal(struct net_device *dev)
struct r8192_priv *priv = rtllib_priv(dev);
struct rtllib_hdr_1addr *rtllib_hdr = NULL;
bool unicast_packet = false;
- bool bLedBlinking = true;
- u16 fc = 0, type = 0;
u32 skb_len = 0;
int rx_queue_idx = RX_MPDU_QUEUE;

@@ -1821,16 +1805,6 @@ static void _rtl92e_rx_normal(struct net_device *dev)
/* unicast packet */
unicast_packet = true;
}
- fc = le16_to_cpu(rtllib_hdr->frame_ctl);
- type = WLAN_FC_GET_TYPE(fc);
- if (type == RTLLIB_FTYPE_MGMT)
- bLedBlinking = false;
-
- if (bLedBlinking)
- if (priv->rtllib->LedControlHandler)
- priv->rtllib->LedControlHandler(dev,
- LED_CTL_RX);
-
skb_len = skb->len;

if (!rtllib_rx(priv->rtllib, skb, &stats)) {
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index 0bb657fda06c..8b656980ee25 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -421,10 +421,6 @@ static int _rtl92e_wx_set_scan(struct net_device *dev,
mutex_unlock(&priv->rtllib->ips_mutex);
}
rtllib_stop_scan(priv->rtllib);
- if (priv->rtllib->LedControlHandler)
- priv->rtllib->LedControlHandler(dev,
- LED_CTL_SITE_SURVEY);
-
if (priv->rtllib->rf_power_state != rf_off) {
priv->rtllib->actscanning = true;

diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 8bafee31e50c..4aa5ce9f7792 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -1716,8 +1716,6 @@ struct rtllib_device {
void (*InitialGainHandler)(struct net_device *dev, u8 Operation);
void (*ScanOperationBackupHandler)(struct net_device *dev,
u8 Operation);
- void (*LedControlHandler)(struct net_device *dev,
- enum led_ctl_mode LedAction);
void (*SetHwRegHandler)(struct net_device *dev, u8 variable, u8 *val);

void (*AllowAllDestAddrHandler)(struct net_device *dev,
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 1fe0675033cb..18885cda60f6 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -1680,9 +1680,6 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee,
false;

ieee->state = RTLLIB_ASSOCIATING;
- if (ieee->LedControlHandler != NULL)
- ieee->LedControlHandler(ieee->dev,
- LED_CTL_START_TO_LINK);
schedule_delayed_work(
&ieee->associate_procedure_wq, 0);
} else {
@@ -2343,10 +2340,6 @@ rtllib_rx_deauth(struct rtllib_device *ieee, struct sk_buff *skb)
ieee->link_detect_info.bBusyTraffic = false;
rtllib_disassociate(ieee);
RemovePeerTS(ieee, header->addr2);
- if (ieee->LedControlHandler != NULL)
- ieee->LedControlHandler(ieee->dev,
- LED_CTL_START_TO_LINK);
-
if (!(ieee->rtllib_ap_sec_type(ieee) &
(SEC_ALG_CCMP|SEC_ALG_TKIP)))
schedule_delayed_work(
@@ -2641,9 +2634,6 @@ static void rtllib_start_ibss_wq(void *data)
ieee->link_change(ieee->dev);

HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
- if (ieee->LedControlHandler != NULL)
- ieee->LedControlHandler(ieee->dev, LED_CTL_LINK);
-
rtllib_start_send_beacons(ieee);

notify_wx_assoc_event(ieee);
--
2.40.1



2023-05-28 07:29:19

by Philipp Hortmann

[permalink] [raw]
Subject: staging: rtl8192e: Replace drivers rtllib_crypt_ccmp_... with lib80211_crypt_...

Hi,

it is possible to remove three modules from the staging area by replacing:
rtllib_crypt_ccmp with lib80211_crypt_ccmp
rtllib_crypt_tkip with lib80211_crypt_tkip
rtllib_crypt_wep with lib80211_crypt_wep

The following issues arise:
- rtl8192e needs to be switched to software encryption or
lib80211_crypt_... needs to be extended with hardware encryption.
- Performance is dropping on my computer from 12,5MB/s to 1,5MB/s when
switching to software encryption.(it does not really change if I use
rtllib_crypt_ccmp or lib80211_crypt_ccmp)
- Fix: rtllib_rx_decrypt: decrypt frame error that occure sometimes on
lib80211_crypt_ccmp

Below the changes on the driver that made use of lib80211_crypt_...
possible.

So the questions are:
Is it worth the effort or is this going in the wrong direction?
Does it help the kernel community or is it just creating more effort?
Why does LIB80211 not support hardware encryption? Or does it?

Thanks for your support.

Bye Philipp

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 17b70dde7eeb..ef0fa05ff510 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -22,7 +22,7 @@

#include "rtl_pm.h"

-int hwwep = 1;
+int hwwep = 0;
static char *ifname = "wlan%d";

static struct pci_device_id rtl8192_pci_id_tbl[] = {
diff --git a/drivers/staging/rtl8192e/rtllib_wx.c
b/drivers/staging/rtl8192e/rtllib_wx.c
index 82b537da8b21..0db6e32b5494 100644
--- a/drivers/staging/rtl8192e/rtllib_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_wx.c
@@ -522,16 +522,16 @@ int rtllib_wx_set_encode_ext(struct rtllib_device
*ieee,
sec.enabled = 1;
switch (ext->alg) {
case IW_ENCODE_ALG_WEP:
- alg = "R-WEP";
- module = "rtllib_crypt_wep";
+ alg = "WEP";
+ module = "lib80211_crypt_wep";
break;
case IW_ENCODE_ALG_TKIP:
- alg = "R-TKIP";
- module = "rtllib_crypt_tkip";
+ alg = "TKIP";
+ module = "lib80211_crypt_tkip";
break;
case IW_ENCODE_ALG_CCMP:
- alg = "R-CCMP";
- module = "rtllib_crypt_ccmp";
+ alg = "CCMP";
+ module = "lib80211_crypt_ccmp";
break;
default:
netdev_dbg(ieee->dev, "Unknown crypto alg %d\n", ext->alg);


2023-05-28 18:42:11

by Larry Finger

[permalink] [raw]
Subject: Re: staging: rtl8192e: Replace drivers rtllib_crypt_ccmp_... with lib80211_crypt_...

On 5/28/23 01:38, Philipp Hortmann wrote:
> Hi,
>
> it is possible to remove three modules from the staging area by replacing:
> rtllib_crypt_ccmp with lib80211_crypt_ccmp
> rtllib_crypt_tkip with lib80211_crypt_tkip
> rtllib_crypt_wep with lib80211_crypt_wep
>
> The following issues arise:
> - rtl8192e needs to be switched to software encryption or
>   lib80211_crypt_... needs to be extended with hardware encryption.
> - Performance is dropping on my computer from 12,5MB/s to 1,5MB/s when
>   switching to software encryption.(it does not really change if I use
>   rtllib_crypt_ccmp or lib80211_crypt_ccmp)
> - Fix: rtllib_rx_decrypt: decrypt frame error that occure sometimes on
>   lib80211_crypt_ccmp
>
> Below the changes on the driver that made use of lib80211_crypt_... possible.
>
> So the questions are:
> Is it worth the effort or is this going in the wrong direction?
> Does it help the kernel community or is it just creating more effort?
> Why does LIB80211 not support hardware encryption? Or does it?

I do not know why LIB80211 does not support hardware encryption, but the
performance hit you report is not acceptable!

Larry