2023-08-13 07:24:56

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 0/4] Remove unsupported mode IW_MODE_MASTER

Remove unsupported modes IW_MODE_MASTER, IW_MODE_REPEAT, IW_MODE_MESH.

Tested with rtl8192e (WLL6130-D99) in Mode n (12.5 MB/s)
Transferred this patch over wlan connection of rtl8192e.

Philipp Hortmann (4):
staging: rtl8192e: Remove unsupported mode IW_MODE_MASTER
staging: rtl8192e: Remove unused function rtllib_start_master_bss()
staging: rtl8192e: Remove unsupported mode IW_MODE_REPEAT
staging: rtl8192e: Remove unsupported mode IW_MODE_MESH

.../staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 -
drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 6 +-
drivers/staging/rtl8192e/rtl819x_HTProc.c | 3 +-
drivers/staging/rtl8192e/rtl819x_TSProc.c | 14 +-
drivers/staging/rtl8192e/rtllib.h | 4 -
drivers/staging/rtl8192e/rtllib_rx.c | 26 +--
drivers/staging/rtl8192e/rtllib_softmac.c | 189 ------------------
drivers/staging/rtl8192e/rtllib_softmac_wx.c | 9 +-
drivers/staging/rtl8192e/rtllib_tx.c | 2 -
9 files changed, 16 insertions(+), 241 deletions(-)

--
2.41.0



2023-08-13 08:30:46

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 3/4] staging: rtl8192e: Remove unsupported mode IW_MODE_REPEAT

Tasklet irq_rx_tasklet is scheduled when hw is receiving frames. Function
_rtl92e_irq_rx_tasklet() is then called which calls then
_rtl92e_rx_normal(). In _rtl92e_rx_normal() all frames are processed by
rtllib_rx(). When ieee->iw_mode is IW_MODE_REPEAT the function returns
0. The calling function then calls: dev_kfree_skb_any() which clears
the skb. So the driver clears all packets received in this mode. Remove
dead code in mode IW_MODE_REPEAT.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/rtllib_rx.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index b3f5ab33603e..322e603237d4 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -1496,8 +1496,6 @@ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
case IW_MODE_INFRA:
ret = rtllib_rx_InfraAdhoc(ieee, skb, rx_stats);
break;
- case IW_MODE_REPEAT:
- break;
case IW_MODE_MONITOR:
ret = rtllib_rx_Monitor(ieee, skb, rx_stats);
break;
--
2.41.0


2023-08-13 09:08:51

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 4/4] staging: rtl8192e: Remove unsupported mode IW_MODE_MESH

Tasklet irq_rx_tasklet is scheduled when hw is receiving frames. Function
_rtl92e_irq_rx_tasklet() is then called which calls then
_rtl92e_rx_normal(). In _rtl92e_rx_normal() all frames are processed by
rtllib_rx(). When ieee->iw_mode is IW_MODE_MESH the function returns
0. The calling function then calls: dev_kfree_skb_any() which clears
the skb. So the driver clears all packets received in this mode. Remove
dead code in mode IW_MODE_MESH.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/rtllib.h | 4 ----
drivers/staging/rtl8192e/rtllib_rx.c | 20 ++++++++------------
2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 0c812eb02ba6..afde4812a221 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -89,10 +89,6 @@ static inline void *netdev_priv_rsl(struct net_device *dev)
#define HIGH_QUEUE 7
#define BEACON_QUEUE 8

-#ifndef IW_MODE_MESH
-#define IW_MODE_MESH 7
-#endif
-
#define IE_CISCO_FLAG_POSITION 0x08
#define SUPPORT_CKIP_MIC 0x08
#define SUPPORT_CKIP_PK 0x10
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 322e603237d4..40e7bbb17c0d 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -1013,17 +1013,15 @@ static int rtllib_rx_data_filter(struct rtllib_device *ieee, u16 fc,
}
}

- if (ieee->iw_mode != IW_MODE_MESH) {
- /* packets from our adapter are dropped (echo) */
- if (!memcmp(src, ieee->dev->dev_addr, ETH_ALEN))
- return -1;
+ /* packets from our adapter are dropped (echo) */
+ if (!memcmp(src, ieee->dev->dev_addr, ETH_ALEN))
+ return -1;

- /* {broad,multi}cast packets to our BSS go through */
- if (is_multicast_ether_addr(dst)) {
- if (memcmp(bssid, ieee->current_network.bssid,
- ETH_ALEN))
- return -1;
- }
+ /* {broad,multi}cast packets to our BSS go through */
+ if (is_multicast_ether_addr(dst)) {
+ if (memcmp(bssid, ieee->current_network.bssid,
+ ETH_ALEN))
+ return -1;
}
return 0;
}
@@ -1499,8 +1497,6 @@ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
case IW_MODE_MONITOR:
ret = rtllib_rx_Monitor(ieee, skb, rx_stats);
break;
- case IW_MODE_MESH:
- break;
default:
netdev_info(ieee->dev, "%s: ERR iw mode!!!\n", __func__);
break;
--
2.41.0


2023-08-13 09:52:12

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 2/4] staging: rtl8192e: Remove unused function rtllib_start_master_bss()

Remove unused functions rtllib_start_master_bss(), rtllib_rx_assoc_rq()
and rtllib_rx_auth_rq() and resulting unused functions.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/rtllib_softmac.c | 180 ----------------------
1 file changed, 180 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 6fa1d6a9da28..de1702491191 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -909,85 +909,6 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee,
return skb;
}

-static struct sk_buff *rtllib_assoc_resp(struct rtllib_device *ieee, u8 *dest)
-{
- struct sk_buff *skb;
- u8 *tag;
-
- struct lib80211_crypt_data *crypt;
- struct rtllib_assoc_response_frame *assoc;
- short encrypt;
-
- unsigned int rate_len = rtllib_MFIE_rate_len(ieee);
- int len = sizeof(struct rtllib_assoc_response_frame) + rate_len +
- ieee->tx_headroom;
-
- skb = dev_alloc_skb(len);
-
- if (!skb)
- return NULL;
-
- skb_reserve(skb, ieee->tx_headroom);
-
- assoc = skb_put(skb, sizeof(struct rtllib_assoc_response_frame));
-
- assoc->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_ASSOC_RESP);
- ether_addr_copy(assoc->header.addr1, dest);
- ether_addr_copy(assoc->header.addr3, ieee->dev->dev_addr);
- ether_addr_copy(assoc->header.addr2, ieee->dev->dev_addr);
- assoc->capability = cpu_to_le16(WLAN_CAPABILITY_IBSS);
-
- assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME);
-
- crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
-
- encrypt = (crypt && crypt->ops);
-
- if (encrypt)
- assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
- assoc->status = 0;
- assoc->aid = cpu_to_le16(ieee->assoc_id);
- if (ieee->assoc_id == 0x2007)
- ieee->assoc_id = 0;
- else
- ieee->assoc_id++;
-
- tag = skb_put(skb, rate_len);
- rtllib_MFIE_Brate(ieee, &tag);
- rtllib_MFIE_Grate(ieee, &tag);
-
- return skb;
-}
-
-static struct sk_buff *rtllib_auth_resp(struct rtllib_device *ieee, int status,
- u8 *dest)
-{
- struct sk_buff *skb = NULL;
- struct rtllib_authentication *auth;
- int len = ieee->tx_headroom + sizeof(struct rtllib_authentication) + 1;
-
- skb = dev_alloc_skb(len);
- if (!skb)
- return NULL;
-
- skb->len = sizeof(struct rtllib_authentication);
-
- skb_reserve(skb, ieee->tx_headroom);
-
- auth = skb_put(skb, sizeof(struct rtllib_authentication));
-
- auth->status = cpu_to_le16(status);
- auth->transaction = cpu_to_le16(2);
- auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-
- ether_addr_copy(auth->header.addr3, ieee->dev->dev_addr);
- ether_addr_copy(auth->header.addr2, ieee->dev->dev_addr);
- ether_addr_copy(auth->header.addr1, dest);
- auth->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_AUTH);
- return skb;
-}
-
static struct sk_buff *rtllib_null_func(struct rtllib_device *ieee, short pwr)
{
struct sk_buff *skb;
@@ -1035,22 +956,6 @@ static struct sk_buff *rtllib_pspoll_func(struct rtllib_device *ieee)
return skb;
}

-static void rtllib_resp_to_assoc_rq(struct rtllib_device *ieee, u8 *dest)
-{
- struct sk_buff *buf = rtllib_assoc_resp(ieee, dest);
-
- if (buf)
- softmac_mgmt_xmit(buf, ieee);
-}
-
-static void rtllib_resp_to_auth(struct rtllib_device *ieee, int s, u8 *dest)
-{
- struct sk_buff *buf = rtllib_auth_resp(ieee, s, dest);
-
- if (buf)
- softmac_mgmt_xmit(buf, ieee);
-}
-
static void rtllib_resp_to_probe(struct rtllib_device *ieee, u8 *dest)
{
struct sk_buff *buf = rtllib_probe_resp(ieee, dest);
@@ -1708,25 +1613,6 @@ static inline int auth_parse(struct net_device *dev, struct sk_buff *skb,
return 0;
}

-static int auth_rq_parse(struct net_device *dev, struct sk_buff *skb, u8 *dest)
-{
- struct rtllib_authentication *a;
-
- if (skb->len < (sizeof(struct rtllib_authentication) -
- sizeof(struct rtllib_info_element))) {
- netdev_dbg(dev, "invalid len in auth request: %d\n", skb->len);
- return -1;
- }
- a = (struct rtllib_authentication *)skb->data;
-
- ether_addr_copy(dest, a->header.addr2);
-
- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
- return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-
- return WLAN_STATUS_SUCCESS;
-}
-
static short probe_rq_parse(struct rtllib_device *ieee, struct sk_buff *skb,
u8 *src)
{
@@ -1773,23 +1659,6 @@ static short probe_rq_parse(struct rtllib_device *ieee, struct sk_buff *skb,
return !strncmp(ssid, ieee->current_network.ssid, ssidlen);
}

-static int assoc_rq_parse(struct net_device *dev, struct sk_buff *skb, u8 *dest)
-{
- struct rtllib_assoc_request_frame *a;
-
- if (skb->len < (sizeof(struct rtllib_assoc_request_frame) -
- sizeof(struct rtllib_info_element))) {
- netdev_dbg(dev, "invalid len in auth request:%d\n", skb->len);
- return -1;
- }
-
- a = (struct rtllib_assoc_request_frame *)skb->data;
-
- ether_addr_copy(dest, a->header.addr2);
-
- return 0;
-}
-
static inline u16 assoc_parse(struct rtllib_device *ieee, struct sk_buff *skb,
int *aid)
{
@@ -1830,31 +1699,6 @@ void rtllib_rx_probe_rq(struct rtllib_device *ieee, struct sk_buff *skb)
}
}

-static inline void rtllib_rx_auth_rq(struct rtllib_device *ieee,
- struct sk_buff *skb)
-{
- u8 dest[ETH_ALEN];
- int status;
-
- ieee->softmac_stats.rx_auth_rq++;
-
- status = auth_rq_parse(ieee->dev, skb, dest);
- if (status != -1)
- rtllib_resp_to_auth(ieee, status, dest);
-}
-
-static inline void rtllib_rx_assoc_rq(struct rtllib_device *ieee,
- struct sk_buff *skb)
-{
- u8 dest[ETH_ALEN];
-
- ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(ieee->dev, skb, dest) != -1)
- rtllib_resp_to_assoc_rq(ieee, dest);
-
- netdev_info(ieee->dev, "New client associated: %pM\n", dest);
-}
-
void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, short pwr)
{
struct sk_buff *buf = rtllib_null_func(ieee, pwr);
@@ -2419,30 +2263,6 @@ void rtllib_wake_all_queues(struct rtllib_device *ieee)
netif_tx_wake_all_queues(ieee->dev);
}

-/* called in user context only */
-static void rtllib_start_master_bss(struct rtllib_device *ieee)
-{
- ieee->assoc_id = 1;
-
- if (ieee->current_network.ssid_len == 0) {
- strncpy(ieee->current_network.ssid,
- RTLLIB_DEFAULT_TX_ESSID,
- IW_ESSID_MAX_SIZE);
-
- ieee->current_network.ssid_len =
- strlen(RTLLIB_DEFAULT_TX_ESSID);
- ieee->ssid_set = 1;
- }
-
- ether_addr_copy(ieee->current_network.bssid, ieee->dev->dev_addr);
-
- ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee->link_state = MAC80211_LINKED;
- ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
- netif_carrier_on(ieee->dev);
-}
-
static void rtllib_start_monitor_mode(struct rtllib_device *ieee)
{
/* reset hardware status */
--
2.41.0