2023-10-03 19:33:24

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 00/11] staging: rtl8192e: Remove functions rawtx and promisc

The Linux kernel authors consider "wireless tools" package deprecated. The
"wireless extension" is also deprecated. Start to remove private functions
of "wireless extensions" that can only be accessed by "wireless tools"
from driver.

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

Philipp Hortmann (11):
staging: rtl8192e: Remove function _rtl92e_wx_set_rawtx()
staging: rtl8192e: Remove equation in function rtllib_xmit_inter()
staging: rtl8192e: Remove function rtllib_start_monitor_mode()
staging: rtl8192e: Remove unused variable raw_tx
staging: rtl8192e: Remove unused parameter mesh_flag
staging: rtl8192e: Remove function _rtl92e_wx_set_promisc_mode()
staging: rtl8192e: Remove function _rtl92e_wx_get_promisc_mode()
staging: rtl8192e: Remove constant variable fltr_src_sta_frame
staging: rtl8192e: Remove constant variable promiscuous_on
staging: rtl8192e: Remove constant variable net_promiscuous_md
staging: rtl8192e: Remove constant variable bToOtherSTA

.../staging/rtl8192e/rtl8192e/r8192E_dev.c | 5 +-
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 13 +-
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 107 +---
drivers/staging/rtl8192e/rtllib.h | 18 +-
drivers/staging/rtl8192e/rtllib_module.c | 1 -
drivers/staging/rtl8192e/rtllib_rx.c | 72 +--
drivers/staging/rtl8192e/rtllib_softmac.c | 55 +-
drivers/staging/rtl8192e/rtllib_softmac_wx.c | 32 --
drivers/staging/rtl8192e/rtllib_tx.c | 476 +++++++++---------
9 files changed, 262 insertions(+), 517 deletions(-)

--
2.42.0


2023-10-03 19:33:27

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 02/11] staging: rtl8192e: Remove equation in function rtllib_xmit_inter()

Remove equation with raw_tx in function rtllib_xmit_inter() as it is
always true.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/rtllib_tx.c | 476 +++++++++++++--------------
1 file changed, 229 insertions(+), 247 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c
index 53ad5e3fb174..8d8ce22c5f09 100644
--- a/drivers/staging/rtl8192e/rtllib_tx.c
+++ b/drivers/staging/rtl8192e/rtllib_tx.c
@@ -576,289 +576,271 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
goto success;
}

- if (likely(ieee->raw_tx == 0)) {
- if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) {
- netdev_warn(ieee->dev, "skb too small (%d).\n",
- skb->len);
- goto success;
- }
- /* Save source and destination addresses */
- ether_addr_copy(dest, skb->data);
- ether_addr_copy(src, skb->data + ETH_ALEN);
-
- memset(skb->cb, 0, sizeof(skb->cb));
- ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
-
- if (ieee->iw_mode == IW_MODE_MONITOR) {
- txb = rtllib_alloc_txb(1, skb->len, GFP_ATOMIC);
- if (unlikely(!txb)) {
- netdev_warn(ieee->dev,
- "Could not allocate TXB\n");
- goto failed;
- }
+ if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) {
+ netdev_warn(ieee->dev, "skb too small (%d).\n",
+ skb->len);
+ goto success;
+ }
+ /* Save source and destination addresses */
+ ether_addr_copy(dest, skb->data);
+ ether_addr_copy(src, skb->data + ETH_ALEN);

- txb->encrypted = 0;
- txb->payload_size = cpu_to_le16(skb->len);
- skb_put_data(txb->fragments[0], skb->data, skb->len);
+ memset(skb->cb, 0, sizeof(skb->cb));
+ ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);

- goto success;
+ if (ieee->iw_mode == IW_MODE_MONITOR) {
+ txb = rtllib_alloc_txb(1, skb->len, GFP_ATOMIC);
+ if (unlikely(!txb)) {
+ netdev_warn(ieee->dev,
+ "Could not allocate TXB\n");
+ goto failed;
}

- if (skb->len > 282) {
- if (ether_type == ETH_P_IP) {
- const struct iphdr *ip = (struct iphdr *)
- ((u8 *)skb->data + 14);
- if (ip->protocol == IPPROTO_UDP) {
- struct udphdr *udp;
-
- udp = (struct udphdr *)((u8 *)ip +
- (ip->ihl << 2));
- if (((((u8 *)udp)[1] == 68) &&
- (((u8 *)udp)[3] == 67)) ||
- ((((u8 *)udp)[1] == 67) &&
- (((u8 *)udp)[3] == 68))) {
- bdhcp = true;
- ieee->LPSDelayCnt = 200;
- }
+ txb->encrypted = 0;
+ txb->payload_size = cpu_to_le16(skb->len);
+ skb_put_data(txb->fragments[0], skb->data, skb->len);
+
+ goto success;
+ }
+
+ if (skb->len > 282) {
+ if (ether_type == ETH_P_IP) {
+ const struct iphdr *ip = (struct iphdr *)
+ ((u8 *)skb->data + 14);
+ if (ip->protocol == IPPROTO_UDP) {
+ struct udphdr *udp;
+
+ udp = (struct udphdr *)((u8 *)ip +
+ (ip->ihl << 2));
+ if (((((u8 *)udp)[1] == 68) &&
+ (((u8 *)udp)[3] == 67)) ||
+ ((((u8 *)udp)[1] == 67) &&
+ (((u8 *)udp)[3] == 68))) {
+ bdhcp = true;
+ ieee->LPSDelayCnt = 200;
}
- } else if (ether_type == ETH_P_ARP) {
- netdev_info(ieee->dev,
- "=================>DHCP Protocol start tx ARP pkt!!\n");
- bdhcp = true;
- ieee->LPSDelayCnt =
- ieee->current_network.tim.tim_count;
}
+ } else if (ether_type == ETH_P_ARP) {
+ netdev_info(ieee->dev,
+ "=================>DHCP Protocol start tx ARP pkt!!\n");
+ bdhcp = true;
+ ieee->LPSDelayCnt =
+ ieee->current_network.tim.tim_count;
}
+ }

- skb->priority = rtllib_classify(skb, IsAmsdu);
- crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
- encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && crypt && crypt->ops;
- if (!encrypt && ieee->ieee802_1x &&
- ieee->drop_unencrypted && ether_type != ETH_P_PAE) {
- stats->tx_dropped++;
- goto success;
- }
- if (crypt && !encrypt && ether_type == ETH_P_PAE) {
- struct eapol *eap = (struct eapol *)(skb->data +
- sizeof(struct ethhdr) - SNAP_SIZE -
- sizeof(u16));
- netdev_dbg(ieee->dev,
- "TX: IEEE 802.11 EAPOL frame: %s\n",
- eap_get_type(eap->type));
- }
+ skb->priority = rtllib_classify(skb, IsAmsdu);
+ crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx];
+ encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && crypt && crypt->ops;
+ if (!encrypt && ieee->ieee802_1x &&
+ ieee->drop_unencrypted && ether_type != ETH_P_PAE) {
+ stats->tx_dropped++;
+ goto success;
+ }
+ if (crypt && !encrypt && ether_type == ETH_P_PAE) {
+ struct eapol *eap = (struct eapol *)(skb->data +
+ sizeof(struct ethhdr) - SNAP_SIZE -
+ sizeof(u16));
+ netdev_dbg(ieee->dev,
+ "TX: IEEE 802.11 EAPOL frame: %s\n",
+ eap_get_type(eap->type));
+ }

- /* Advance the SKB to the start of the payload */
- skb_pull(skb, sizeof(struct ethhdr));
+ /* Advance the SKB to the start of the payload */
+ skb_pull(skb, sizeof(struct ethhdr));

- /* Determine total amount of storage required for TXB packets */
- bytes = skb->len + SNAP_SIZE + sizeof(u16);
+ /* Determine total amount of storage required for TXB packets */
+ bytes = skb->len + SNAP_SIZE + sizeof(u16);

- if (encrypt)
- fc = RTLLIB_FTYPE_DATA | IEEE80211_FCTL_PROTECTED;
- else
- fc = RTLLIB_FTYPE_DATA;
+ if (encrypt)
+ fc = RTLLIB_FTYPE_DATA | IEEE80211_FCTL_PROTECTED;
+ else
+ fc = RTLLIB_FTYPE_DATA;

- if (qos_activated)
- fc |= IEEE80211_STYPE_QOS_DATA;
- else
- fc |= IEEE80211_STYPE_DATA;
+ if (qos_activated)
+ fc |= IEEE80211_STYPE_QOS_DATA;
+ else
+ fc |= IEEE80211_STYPE_DATA;

- if (ieee->iw_mode == IW_MODE_INFRA) {
- fc |= IEEE80211_FCTL_TODS;
- /* To DS: Addr1 = BSSID, Addr2 = SA,
- * Addr3 = DA
- */
- ether_addr_copy(header.addr1,
+ if (ieee->iw_mode == IW_MODE_INFRA) {
+ fc |= IEEE80211_FCTL_TODS;
+ /* To DS: Addr1 = BSSID, Addr2 = SA,
+ * Addr3 = DA
+ */
+ ether_addr_copy(header.addr1,
+ ieee->current_network.bssid);
+ ether_addr_copy(header.addr2, src);
+ if (IsAmsdu)
+ ether_addr_copy(header.addr3,
ieee->current_network.bssid);
- ether_addr_copy(header.addr2, src);
- if (IsAmsdu)
- ether_addr_copy(header.addr3,
- ieee->current_network.bssid);
- else
- ether_addr_copy(header.addr3, dest);
- }
+ else
+ ether_addr_copy(header.addr3, dest);
+ }

- bIsMulticast = is_multicast_ether_addr(header.addr1);
+ bIsMulticast = is_multicast_ether_addr(header.addr1);

- header.frame_control = cpu_to_le16(fc);
+ header.frame_control = cpu_to_le16(fc);

- /* Determine fragmentation size based on destination (multicast
- * and broadcast are not fragmented)
- */
- if (bIsMulticast) {
- frag_size = MAX_FRAG_THRESHOLD;
- qos_ctl |= QOS_CTL_NOTCONTAIN_ACK;
- } else {
- frag_size = ieee->fts;
- qos_ctl = 0;
+ /* Determine fragmentation size based on destination (multicast
+ * and broadcast are not fragmented)
+ */
+ if (bIsMulticast) {
+ frag_size = MAX_FRAG_THRESHOLD;
+ qos_ctl |= QOS_CTL_NOTCONTAIN_ACK;
+ } else {
+ frag_size = ieee->fts;
+ qos_ctl = 0;
+ }
+
+ if (qos_activated) {
+ hdr_len = RTLLIB_3ADDR_LEN + 2;
+
+ /* in case we are a client verify acm is not set for this ac */
+ while (unlikely(ieee->wmm_acm & (0x01 << skb->priority))) {
+ netdev_info(ieee->dev, "skb->priority = %x\n",
+ skb->priority);
+ if (wme_downgrade_ac(skb))
+ break;
+ netdev_info(ieee->dev, "converted skb->priority = %x\n",
+ skb->priority);
}

- if (qos_activated) {
- hdr_len = RTLLIB_3ADDR_LEN + 2;
-
- /* in case we are a client verify acm is not set for this ac */
- while (unlikely(ieee->wmm_acm & (0x01 << skb->priority))) {
- netdev_info(ieee->dev, "skb->priority = %x\n",
- skb->priority);
- if (wme_downgrade_ac(skb))
- break;
- netdev_info(ieee->dev, "converted skb->priority = %x\n",
- skb->priority);
- }
+ qos_ctl |= skb->priority;
+ header.qos_ctrl = cpu_to_le16(qos_ctl & RTLLIB_QOS_TID);

- qos_ctl |= skb->priority;
- header.qos_ctrl = cpu_to_le16(qos_ctl & RTLLIB_QOS_TID);
+ } else {
+ hdr_len = RTLLIB_3ADDR_LEN;
+ }
+ /* Determine amount of payload per fragment. Regardless of if
+ * this stack is providing the full 802.11 header, one will
+ * eventually be affixed to this fragment -- so we must account
+ * for it when determining the amount of payload space.
+ */
+ bytes_per_frag = frag_size - hdr_len;
+ if (ieee->config &
+ (CFG_RTLLIB_COMPUTE_FCS | CFG_RTLLIB_RESERVE_FCS))
+ bytes_per_frag -= RTLLIB_FCS_LEN;

+ /* Each fragment may need to have room for encrypting
+ * pre/postfix
+ */
+ if (encrypt) {
+ bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len +
+ crypt->ops->extra_mpdu_postfix_len +
+ crypt->ops->extra_msdu_prefix_len +
+ crypt->ops->extra_msdu_postfix_len;
+ }
+ /* Number of fragments is the total bytes_per_frag /
+ * payload_per_fragment
+ */
+ nr_frags = bytes / bytes_per_frag;
+ bytes_last_frag = bytes % bytes_per_frag;
+ if (bytes_last_frag)
+ nr_frags++;
+ else
+ bytes_last_frag = bytes_per_frag;
+
+ /* When we allocate the TXB we allocate enough space for the
+ * reserve and full fragment bytes (bytes_per_frag doesn't
+ * include prefix, postfix, header, FCS, etc.)
+ */
+ txb = rtllib_alloc_txb(nr_frags, frag_size +
+ ieee->tx_headroom, GFP_ATOMIC);
+ if (unlikely(!txb)) {
+ netdev_warn(ieee->dev, "Could not allocate TXB\n");
+ goto failed;
+ }
+ txb->encrypted = encrypt;
+ txb->payload_size = cpu_to_le16(bytes);
+
+ if (qos_activated)
+ txb->queue_index = UP2AC(skb->priority);
+ else
+ txb->queue_index = WME_AC_BE;
+
+ for (i = 0; i < nr_frags; i++) {
+ skb_frag = txb->fragments[i];
+ tcb_desc = (struct cb_desc *)(skb_frag->cb +
+ MAX_DEV_ADDR_SIZE);
+ if (qos_activated) {
+ skb_frag->priority = skb->priority;
+ tcb_desc->queue_index = UP2AC(skb->priority);
} else {
- hdr_len = RTLLIB_3ADDR_LEN;
+ skb_frag->priority = WME_AC_BE;
+ tcb_desc->queue_index = WME_AC_BE;
}
- /* Determine amount of payload per fragment. Regardless of if
- * this stack is providing the full 802.11 header, one will
- * eventually be affixed to this fragment -- so we must account
- * for it when determining the amount of payload space.
- */
- bytes_per_frag = frag_size - hdr_len;
- if (ieee->config &
- (CFG_RTLLIB_COMPUTE_FCS | CFG_RTLLIB_RESERVE_FCS))
- bytes_per_frag -= RTLLIB_FCS_LEN;
+ skb_reserve(skb_frag, ieee->tx_headroom);

- /* Each fragment may need to have room for encrypting
- * pre/postfix
- */
if (encrypt) {
- bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len +
- crypt->ops->extra_mpdu_postfix_len +
- crypt->ops->extra_msdu_prefix_len +
- crypt->ops->extra_msdu_postfix_len;
+ if (ieee->hwsec_active)
+ tcb_desc->bHwSec = 1;
+ else
+ tcb_desc->bHwSec = 0;
+ skb_reserve(skb_frag,
+ crypt->ops->extra_mpdu_prefix_len +
+ crypt->ops->extra_msdu_prefix_len);
+ } else {
+ tcb_desc->bHwSec = 0;
}
- /* Number of fragments is the total bytes_per_frag /
- * payload_per_fragment
- */
- nr_frags = bytes / bytes_per_frag;
- bytes_last_frag = bytes % bytes_per_frag;
- if (bytes_last_frag)
- nr_frags++;
- else
- bytes_last_frag = bytes_per_frag;
+ frag_hdr = skb_put_data(skb_frag, &header, hdr_len);

- /* When we allocate the TXB we allocate enough space for the
- * reserve and full fragment bytes (bytes_per_frag doesn't
- * include prefix, postfix, header, FCS, etc.)
+ /* If this is not the last fragment, then add the
+ * MOREFRAGS bit to the frame control
*/
- txb = rtllib_alloc_txb(nr_frags, frag_size +
- ieee->tx_headroom, GFP_ATOMIC);
- if (unlikely(!txb)) {
- netdev_warn(ieee->dev, "Could not allocate TXB\n");
- goto failed;
- }
- txb->encrypted = encrypt;
- txb->payload_size = cpu_to_le16(bytes);
-
- if (qos_activated)
- txb->queue_index = UP2AC(skb->priority);
- else
- txb->queue_index = WME_AC_BE;
-
- for (i = 0; i < nr_frags; i++) {
- skb_frag = txb->fragments[i];
- tcb_desc = (struct cb_desc *)(skb_frag->cb +
- MAX_DEV_ADDR_SIZE);
- if (qos_activated) {
- skb_frag->priority = skb->priority;
- tcb_desc->queue_index = UP2AC(skb->priority);
- } else {
- skb_frag->priority = WME_AC_BE;
- tcb_desc->queue_index = WME_AC_BE;
- }
- skb_reserve(skb_frag, ieee->tx_headroom);
-
- if (encrypt) {
- if (ieee->hwsec_active)
- tcb_desc->bHwSec = 1;
- else
- tcb_desc->bHwSec = 0;
- skb_reserve(skb_frag,
- crypt->ops->extra_mpdu_prefix_len +
- crypt->ops->extra_msdu_prefix_len);
- } else {
- tcb_desc->bHwSec = 0;
- }
- frag_hdr = skb_put_data(skb_frag, &header, hdr_len);
-
- /* If this is not the last fragment, then add the
- * MOREFRAGS bit to the frame control
- */
- if (i != nr_frags - 1) {
- frag_hdr->frame_control = cpu_to_le16(fc |
- IEEE80211_FCTL_MOREFRAGS);
- bytes = bytes_per_frag;
-
- } else {
- /* The last fragment has the remaining length */
- bytes = bytes_last_frag;
- }
- if ((qos_activated) && (!bIsMulticast)) {
- frag_hdr->seq_ctrl =
- cpu_to_le16(rtllib_query_seqnum(ieee, skb_frag,
- header.addr1));
- frag_hdr->seq_ctrl =
- cpu_to_le16(le16_to_cpu(frag_hdr->seq_ctrl) << 4 | i);
- } else {
- frag_hdr->seq_ctrl =
- cpu_to_le16(ieee->seq_ctrl[0] << 4 | i);
- }
- /* Put a SNAP header on the first fragment */
- if (i == 0) {
- rtllib_put_snap(skb_put(skb_frag,
- SNAP_SIZE +
- sizeof(u16)), ether_type);
- bytes -= SNAP_SIZE + sizeof(u16);
- }
+ if (i != nr_frags - 1) {
+ frag_hdr->frame_control = cpu_to_le16(fc |
+ IEEE80211_FCTL_MOREFRAGS);
+ bytes = bytes_per_frag;

- skb_put_data(skb_frag, skb->data, bytes);
-
- /* Advance the SKB... */
- skb_pull(skb, bytes);
-
- /* Encryption routine will move the header forward in
- * order to insert the IV between the header and the
- * payload
- */
- if (encrypt)
- rtllib_encrypt_fragment(ieee, skb_frag,
- hdr_len);
- if (ieee->config &
- (CFG_RTLLIB_COMPUTE_FCS | CFG_RTLLIB_RESERVE_FCS))
- skb_put(skb_frag, 4);
+ } else {
+ /* The last fragment has the remaining length */
+ bytes = bytes_last_frag;
}
-
if ((qos_activated) && (!bIsMulticast)) {
- if (ieee->seq_ctrl[UP2AC(skb->priority) + 1] == 0xFFF)
- ieee->seq_ctrl[UP2AC(skb->priority) + 1] = 0;
- else
- ieee->seq_ctrl[UP2AC(skb->priority) + 1]++;
+ frag_hdr->seq_ctrl =
+ cpu_to_le16(rtllib_query_seqnum(ieee, skb_frag,
+ header.addr1));
+ frag_hdr->seq_ctrl =
+ cpu_to_le16(le16_to_cpu(frag_hdr->seq_ctrl) << 4 | i);
} else {
- if (ieee->seq_ctrl[0] == 0xFFF)
- ieee->seq_ctrl[0] = 0;
- else
- ieee->seq_ctrl[0]++;
+ frag_hdr->seq_ctrl =
+ cpu_to_le16(ieee->seq_ctrl[0] << 4 | i);
}
- } else {
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
- netdev_warn(ieee->dev, "skb too small (%d).\n",
- skb->len);
- goto success;
+ /* Put a SNAP header on the first fragment */
+ if (i == 0) {
+ rtllib_put_snap(skb_put(skb_frag,
+ SNAP_SIZE +
+ sizeof(u16)), ether_type);
+ bytes -= SNAP_SIZE + sizeof(u16);
}

- txb = rtllib_alloc_txb(1, skb->len, GFP_ATOMIC);
- if (!txb) {
- netdev_warn(ieee->dev, "Could not allocate TXB\n");
- goto failed;
- }
+ skb_put_data(skb_frag, skb->data, bytes);

- txb->encrypted = 0;
- txb->payload_size = cpu_to_le16(skb->len);
- skb_put_data(txb->fragments[0], skb->data, skb->len);
+ /* Advance the SKB... */
+ skb_pull(skb, bytes);
+
+ /* Encryption routine will move the header forward in
+ * order to insert the IV between the header and the
+ * payload
+ */
+ if (encrypt)
+ rtllib_encrypt_fragment(ieee, skb_frag,
+ hdr_len);
+ if (ieee->config &
+ (CFG_RTLLIB_COMPUTE_FCS | CFG_RTLLIB_RESERVE_FCS))
+ skb_put(skb_frag, 4);
+ }
+
+ if ((qos_activated) && (!bIsMulticast)) {
+ if (ieee->seq_ctrl[UP2AC(skb->priority) + 1] == 0xFFF)
+ ieee->seq_ctrl[UP2AC(skb->priority) + 1] = 0;
+ else
+ ieee->seq_ctrl[UP2AC(skb->priority) + 1]++;
+ } else {
+ if (ieee->seq_ctrl[0] == 0xFFF)
+ ieee->seq_ctrl[0] = 0;
+ else
+ ieee->seq_ctrl[0]++;
}

success:
--
2.42.0

2023-10-03 19:33:31

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 01/11] staging: rtl8192e: Remove function _rtl92e_wx_set_rawtx()

Remove function _rtl92e_wx_set_rawtx() as this functionality is not
commonly used and the tool to access it is deprecated.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 24 +--------------
drivers/staging/rtl8192e/rtllib.h | 4 ---
drivers/staging/rtl8192e/rtllib_softmac_wx.c | 32 --------------------
3 files changed, 1 insertion(+), 59 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index e7be89833b59..f28e70a0da4f 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -122,25 +122,6 @@ static int _rtl92e_wx_get_power(struct net_device *dev,
return rtllib_wx_get_power(priv->rtllib, info, wrqu, extra);
}

-static int _rtl92e_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
-{
- struct r8192_priv *priv = rtllib_priv(dev);
- int ret;
-
- if (priv->hw_radio_off)
- return 0;
-
- mutex_lock(&priv->wx_mutex);
-
- ret = rtllib_wx_set_rawtx(priv->rtllib, info, wrqu, extra);
-
- mutex_unlock(&priv->wx_mutex);
-
- return ret;
-}
-
static int _rtl92e_wx_adapter_power_status(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
@@ -1044,9 +1025,6 @@ static const struct iw_priv_args r8192_private_args[] = {
}, {
SIOCIWFIRSTPRIV + 0x1,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
- }, {
- SIOCIWFIRSTPRIV + 0x2,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
}, {
SIOCIWFIRSTPRIV + 0x6,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, IW_PRIV_TYPE_NONE,
@@ -1072,7 +1050,7 @@ static const struct iw_priv_args r8192_private_args[] = {
static iw_handler r8192_private_handler[] = {
(iw_handler)_rtl92e_wx_set_debug, /*SIOCIWSECONDPRIV*/
(iw_handler)_rtl92e_wx_set_scan_type,
- (iw_handler)_rtl92e_wx_set_rawtx,
+ (iw_handler)NULL,
(iw_handler)NULL,
(iw_handler)NULL,
(iw_handler)NULL,
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index d3ac6ea71030..98b8b7db027e 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -1755,10 +1755,6 @@ int rtllib_wx_get_freq(struct rtllib_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
void rtllib_wx_sync_scan_wq(void *data);

-int rtllib_wx_set_rawtx(struct rtllib_device *ieee,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra);
-
int rtllib_wx_get_name(struct rtllib_device *ieee, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);

diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
index bd2b8bba86eb..f32584291704 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
@@ -436,38 +436,6 @@ int rtllib_wx_get_mode(struct rtllib_device *ieee, struct iw_request_info *a,
}
EXPORT_SYMBOL(rtllib_wx_get_mode);

-int rtllib_wx_set_rawtx(struct rtllib_device *ieee,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
-{
- int *parms = (int *)extra;
- int enable = (parms[0] > 0);
- short prev = ieee->raw_tx;
-
- mutex_lock(&ieee->wx_mutex);
-
- if (enable)
- ieee->raw_tx = 1;
- else
- ieee->raw_tx = 0;
-
- netdev_info(ieee->dev, "raw TX is %s\n",
- ieee->raw_tx ? "enabled" : "disabled");
-
- if (ieee->iw_mode == IW_MODE_MONITOR) {
- if (prev == 0 && ieee->raw_tx)
- netif_carrier_on(ieee->dev);
-
- if (prev && ieee->raw_tx == 1)
- netif_carrier_off(ieee->dev);
- }
-
- mutex_unlock(&ieee->wx_mutex);
-
- return 0;
-}
-EXPORT_SYMBOL(rtllib_wx_set_rawtx);
-
int rtllib_wx_get_name(struct rtllib_device *ieee, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
--
2.42.0

2023-10-03 19:33:33

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 03/11] staging: rtl8192e: Remove function rtllib_start_monitor_mode()

Remove equation with raw_tx in function rtllib_start_monitor_mode() as it
is always false. rtllib_start_monitor_mode() is then empty and can be
removed as well.

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

diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index de1808b372d9..babd48aa327d 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -2135,13 +2135,6 @@ void rtllib_wake_all_queues(struct rtllib_device *ieee)
netif_tx_wake_all_queues(ieee->dev);
}

-static void rtllib_start_monitor_mode(struct rtllib_device *ieee)
-{
- /* reset hardware status */
- if (ieee->raw_tx)
- netif_carrier_on(ieee->dev);
-}
-
/* this is called only in user context, with wx_mutex held */
static void rtllib_start_bss(struct rtllib_device *ieee)
{
@@ -2371,9 +2364,6 @@ void rtllib_start_protocol(struct rtllib_device *ieee)
case IW_MODE_INFRA:
rtllib_start_bss(ieee);
break;
- case IW_MODE_MONITOR:
- rtllib_start_monitor_mode(ieee);
- break;
}
}

--
2.42.0

2023-10-03 19:33:45

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 05/11] staging: rtl8192e: Remove unused parameter mesh_flag

Remove unused parameter mesh_flag of function
rtllib_softmac_start_protocol().

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
drivers/staging/rtl8192e/rtllib.h | 2 +-
drivers/staging/rtl8192e/rtllib_softmac.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index d01cfca39ef5..9c872819969a 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -611,7 +611,7 @@ static int _rtl92e_sta_up(struct net_device *dev)
rtl92e_check_rfctrl_gpio_timer(&priv->gpio_polling_timer);

if (priv->rtllib->link_state != MAC80211_LINKED)
- rtllib_softmac_start_protocol(priv->rtllib, 0);
+ rtllib_softmac_start_protocol(priv->rtllib);
rtllib_reset_queue(priv->rtllib);
_rtl92e_watchdog_timer_cb(&priv->watch_dog_timer);

diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 41b34331380c..546eedfeb43e 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -1705,7 +1705,7 @@ void rtllib_EnableIntelPromiscuousMode(struct net_device *dev, bool bInitState);
void rtllib_DisableIntelPromiscuousMode(struct net_device *dev,
bool bInitState);
void rtllib_softmac_stop_protocol(struct rtllib_device *ieee);
-void rtllib_softmac_start_protocol(struct rtllib_device *ieee, u8 mesh_flag);
+void rtllib_softmac_start_protocol(struct rtllib_device *ieee);

void rtllib_reset_queue(struct rtllib_device *ieee);
void rtllib_wake_all_queues(struct rtllib_device *ieee);
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index babd48aa327d..11395dbc9d4d 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -2316,7 +2316,7 @@ void rtllib_stop_protocol(struct rtllib_device *ieee)
ieee->assocresp_ies_len = 0;
}

-void rtllib_softmac_start_protocol(struct rtllib_device *ieee, u8 mesh_flag)
+void rtllib_softmac_start_protocol(struct rtllib_device *ieee)
{
mutex_lock(&ieee->wx_mutex);
rtllib_start_protocol(ieee);
--
2.42.0

2023-10-03 19:33:58

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 06/11] staging: rtl8192e: Remove function _rtl92e_wx_set_promisc_mode()

Remove function _rtl92e_wx_set_promisc_mode() as this functionality is
not commonly used and the tool to access it is deprecated.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 47 +---------------------
drivers/staging/rtl8192e/rtllib.h | 4 +-
drivers/staging/rtl8192e/rtllib_softmac.c | 43 --------------------
3 files changed, 2 insertions(+), 92 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index f28e70a0da4f..2f5acdd71339 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -918,48 +918,6 @@ static int _rtl92e_wx_get_gen_ie(struct net_device *dev,
return ret;
}

-#define OID_RT_INTEL_PROMISCUOUS_MODE 0xFF0101F6
-
-static int _rtl92e_wx_set_promisc_mode(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
-{
- struct r8192_priv *priv = rtllib_priv(dev);
- struct rtllib_device *ieee = priv->rtllib;
-
- u32 info_buf[3];
-
- u32 oid;
- u32 promiscuous_on;
- u32 fltr_src_sta_frame;
-
- if (copy_from_user(info_buf, wrqu->data.pointer, sizeof(info_buf)))
- return -EFAULT;
-
- oid = info_buf[0];
- promiscuous_on = info_buf[1];
- fltr_src_sta_frame = info_buf[2];
-
- if (oid == OID_RT_INTEL_PROMISCUOUS_MODE) {
- ieee->intel_promiscuous_md_info.promiscuous_on =
- (promiscuous_on) ? (true) : (false);
- ieee->intel_promiscuous_md_info.fltr_src_sta_frame =
- (fltr_src_sta_frame) ? (true) : (false);
- (promiscuous_on) ?
- (rtllib_EnableIntelPromiscuousMode(dev, false)) :
- (rtllib_DisableIntelPromiscuousMode(dev, false));
-
- netdev_info(dev,
- "=======>%s(), on = %d, filter src sta = %d\n",
- __func__, promiscuous_on,
- fltr_src_sta_frame);
- } else {
- return -1;
- }
-
- return 0;
-}
-
static int _rtl92e_wx_get_promisc_mode(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
@@ -1037,9 +995,6 @@ static const struct iw_priv_args r8192_private_args[] = {
SIOCIWFIRSTPRIV + 0xb,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, IW_PRIV_TYPE_NONE,
"lps_force"
- }, {
- SIOCIWFIRSTPRIV + 0x16,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, "setpromisc"
}, {
SIOCIWFIRSTPRIV + 0x17,
0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 45, "getpromisc"
@@ -1070,7 +1025,7 @@ static iw_handler r8192_private_handler[] = {
(iw_handler)NULL,
(iw_handler)NULL,
(iw_handler)NULL,
- (iw_handler)_rtl92e_wx_set_promisc_mode,
+ (iw_handler)NULL,
(iw_handler)_rtl92e_wx_get_promisc_mode,
};

diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 546eedfeb43e..a02e8c976ca0 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -1701,9 +1701,7 @@ void rtllib_stop_protocol(struct rtllib_device *ieee);

void rtllib_EnableNetMonitorMode(struct net_device *dev, bool bInitState);
void rtllib_DisableNetMonitorMode(struct net_device *dev, bool bInitState);
-void rtllib_EnableIntelPromiscuousMode(struct net_device *dev, bool bInitState);
-void rtllib_DisableIntelPromiscuousMode(struct net_device *dev,
- bool bInitState);
+
void rtllib_softmac_stop_protocol(struct rtllib_device *ieee);
void rtllib_softmac_start_protocol(struct rtllib_device *ieee);

diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 11395dbc9d4d..206f8e05d5d0 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -406,49 +406,6 @@ void rtllib_DisableNetMonitorMode(struct net_device *dev,
ieee->AllowAllDestAddrHandler(dev, false, !bInitState);
}

-/* Enables the specialized promiscuous mode required by Intel.
- * In this mode, Intel intends to hear traffics from/to other STAs in the
- * same BSS. Therefore we don't have to disable checking BSSID and we only need
- * to allow all dest. BUT: if we enable checking BSSID then we can't recv
- * packets from other STA.
- */
-void rtllib_EnableIntelPromiscuousMode(struct net_device *dev,
- bool bInitState)
-{
- bool bFilterOutNonAssociatedBSSID = false;
-
- struct rtllib_device *ieee = netdev_priv_rsl(dev);
-
- netdev_info(dev, "========>Enter Intel Promiscuous Mode\n");
-
- ieee->AllowAllDestAddrHandler(dev, true, !bInitState);
- ieee->SetHwRegHandler(dev, HW_VAR_CECHK_BSSID,
- (u8 *)&bFilterOutNonAssociatedBSSID);
-
- ieee->net_promiscuous_md = true;
-}
-EXPORT_SYMBOL(rtllib_EnableIntelPromiscuousMode);
-
-/* Disables the specialized promiscuous mode required by Intel.
- * See MgntEnableIntelPromiscuousMode for detail.
- */
-void rtllib_DisableIntelPromiscuousMode(struct net_device *dev,
- bool bInitState)
-{
- bool bFilterOutNonAssociatedBSSID = true;
-
- struct rtllib_device *ieee = netdev_priv_rsl(dev);
-
- netdev_info(dev, "========>Exit Intel Promiscuous Mode\n");
-
- ieee->AllowAllDestAddrHandler(dev, false, !bInitState);
- ieee->SetHwRegHandler(dev, HW_VAR_CECHK_BSSID,
- (u8 *)&bFilterOutNonAssociatedBSSID);
-
- ieee->net_promiscuous_md = false;
-}
-EXPORT_SYMBOL(rtllib_DisableIntelPromiscuousMode);
-
static void rtllib_send_probe(struct rtllib_device *ieee)
{
struct sk_buff *skb;
--
2.42.0

2023-10-03 19:34:01

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 04/11] staging: rtl8192e: Remove unused variable raw_tx

Remove unused variable raw_tx as it is just set to 0 and not used.

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

diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 98b8b7db027e..41b34331380c 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -1364,7 +1364,6 @@ struct rtllib_device {
u64 ps_time;
bool polling;

- short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning_continue;
diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c
index abd6bfd4dfa3..195d8aa88138 100644
--- a/drivers/staging/rtl8192e/rtllib_module.c
+++ b/drivers/staging/rtl8192e/rtllib_module.c
@@ -114,7 +114,6 @@ struct net_device *alloc_rtllib(int sizeof_priv)
ieee->drop_unencrypted = 0;
ieee->privacy_invoked = 0;
ieee->ieee802_1x = 1;
- ieee->raw_tx = 0;
ieee->hwsec_active = 0;

memset(ieee->swcamtable, 0, sizeof(struct sw_cam_table) * 32);
--
2.42.0

2023-10-03 19:34:11

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 07/11] staging: rtl8192e: Remove function _rtl92e_wx_get_promisc_mode()

Remove function _rtl92e_wx_get_promisc_mode() as this functionality is
not commonly used and the tool to access it is deprecated.

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

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index 2f5acdd71339..d0b68b258af7 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -918,25 +918,6 @@ static int _rtl92e_wx_get_gen_ie(struct net_device *dev,
return ret;
}

-static int _rtl92e_wx_get_promisc_mode(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
-{
- struct r8192_priv *priv = rtllib_priv(dev);
- struct rtllib_device *ieee = priv->rtllib;
-
- mutex_lock(&priv->wx_mutex);
-
- snprintf(extra, 45, "PromiscuousMode:%d, FilterSrcSTAFrame:%d",
- ieee->intel_promiscuous_md_info.promiscuous_on,
- ieee->intel_promiscuous_md_info.fltr_src_sta_frame);
- wrqu->data.length = strlen(extra) + 1;
-
- mutex_unlock(&priv->wx_mutex);
-
- return 0;
-}
-
#define IW_IOCTL(x) ((x) - SIOCSIWCOMMIT)
static iw_handler r8192_wx_handlers[] = {
[IW_IOCTL(SIOCGIWNAME)] = _rtl92e_wx_get_name,
@@ -995,9 +976,6 @@ static const struct iw_priv_args r8192_private_args[] = {
SIOCIWFIRSTPRIV + 0xb,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, IW_PRIV_TYPE_NONE,
"lps_force"
- }, {
- SIOCIWFIRSTPRIV + 0x17,
- 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 45, "getpromisc"
}

};
@@ -1015,18 +993,6 @@ static iw_handler r8192_private_handler[] = {
(iw_handler)NULL,
(iw_handler)_rtl92e_wx_set_lps_awake_interval,
(iw_handler)_rtl92e_wx_set_force_lps,
- (iw_handler)NULL,
- (iw_handler)NULL,
- (iw_handler)NULL,
- (iw_handler)NULL,
- (iw_handler)NULL,
- (iw_handler)NULL,
- (iw_handler)NULL,
- (iw_handler)NULL,
- (iw_handler)NULL,
- (iw_handler)NULL,
- (iw_handler)NULL,
- (iw_handler)_rtl92e_wx_get_promisc_mode,
};

static struct iw_statistics *_rtl92e_get_wireless_stats(struct net_device *dev)
--
2.42.0

2023-10-03 19:34:11

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 08/11] staging: rtl8192e: Remove constant variable fltr_src_sta_frame

Remove variable fltr_src_sta_frame as it is set to 0 and unchanged. The
equation results accordingly. Remove dead code.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 --
drivers/staging/rtl8192e/rtllib.h | 1 -
drivers/staging/rtl8192e/rtllib_rx.c | 10 ----------
3 files changed, 13 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 9c872819969a..f15f73be41a2 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -741,8 +741,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
priv->rtllib->iw_mode = IW_MODE_INFRA;
priv->rtllib->net_promiscuous_md = false;
priv->rtllib->intel_promiscuous_md_info.promiscuous_on = false;
- priv->rtllib->intel_promiscuous_md_info.fltr_src_sta_frame =
- false;
priv->rtllib->ieee_up = 0;
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index a02e8c976ca0..748ae8d35c1a 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -1177,7 +1177,6 @@ struct rt_pmkid_list {

struct rt_intel_promisc_mode {
bool promiscuous_on;
- bool fltr_src_sta_frame;
};

/*************** DRIVER STATUS *****/
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index a7b6f837024d..1086dd0809be 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -956,16 +956,6 @@ static int rtllib_rx_data_filter(struct rtllib_device *ieee, struct ieee80211_hd
return -1;
}

- /* Filter packets sent by an STA that will be forwarded by AP */
- if (ieee->intel_promiscuous_md_info.promiscuous_on &&
- ieee->intel_promiscuous_md_info.fltr_src_sta_frame) {
- if ((fc & IEEE80211_FCTL_TODS) && !(fc & IEEE80211_FCTL_FROMDS) &&
- !ether_addr_equal(dst, ieee->current_network.bssid) &&
- ether_addr_equal(bssid, ieee->current_network.bssid)) {
- return -1;
- }
- }
-
/* Nullfunc frames may have PS-bit set, so they must be passed to
* hostap_handle_sta_rx() before being dropped here.
*/
--
2.42.0

2023-10-03 19:34:31

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 09/11] staging: rtl8192e: Remove constant variable promiscuous_on

Remove variable promiscuous_on as it is set to 0 and unchanged. The
equation results accordingly. Remove dead code.

Signed-off-by: Philipp Hortmann <[email protected]>
---
.../staging/rtl8192e/rtl8192e/r8192E_dev.c | 5 +----
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 -
drivers/staging/rtl8192e/rtllib.h | 5 -----
drivers/staging/rtl8192e/rtllib_rx.c | 22 +++++++++----------
4 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 6cfc2254487b..e343e10e011a 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -706,10 +706,7 @@ void rtl92e_link_change(struct net_device *dev)

reg = rtl92e_readl(dev, RCR);
if (priv->rtllib->link_state == MAC80211_LINKED) {
- if (ieee->intel_promiscuous_md_info.promiscuous_on)
- ;
- else
- priv->receive_config = reg |= RCR_CBSSID;
+ priv->receive_config = reg |= RCR_CBSSID;
} else {
priv->receive_config = reg &= ~RCR_CBSSID;
}
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index f15f73be41a2..ef17472bea05 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -740,7 +740,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
priv->rtllib->mode = WIRELESS_MODE_AUTO;
priv->rtllib->iw_mode = IW_MODE_INFRA;
priv->rtllib->net_promiscuous_md = false;
- priv->rtllib->intel_promiscuous_md_info.promiscuous_on = false;
priv->rtllib->ieee_up = 0;
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 748ae8d35c1a..97bb00bdbf4d 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -1175,10 +1175,6 @@ struct rt_pmkid_list {
u8 bUsed;
};

-struct rt_intel_promisc_mode {
- bool promiscuous_on;
-};
-
/*************** DRIVER STATUS *****/
#define STATUS_SCANNING 0
/*************** DRIVER STATUS *****/
@@ -1258,7 +1254,6 @@ struct rtllib_device {

int iw_mode; /* operating mode (IW_MODE_*) */
bool net_promiscuous_md;
- struct rt_intel_promisc_mode intel_promiscuous_md_info;

spinlock_t lock;
spinlock_t wpax_suitlist_lock;
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 1086dd0809be..f03ec5f53b34 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -959,18 +959,16 @@ static int rtllib_rx_data_filter(struct rtllib_device *ieee, struct ieee80211_hd
/* Nullfunc frames may have PS-bit set, so they must be passed to
* hostap_handle_sta_rx() before being dropped here.
*/
- if (!ieee->intel_promiscuous_md_info.promiscuous_on) {
- if (stype != IEEE80211_STYPE_DATA &&
- stype != IEEE80211_STYPE_DATA_CFACK &&
- stype != IEEE80211_STYPE_DATA_CFPOLL &&
- stype != IEEE80211_STYPE_DATA_CFACKPOLL &&
- stype != IEEE80211_STYPE_QOS_DATA) {
- if (stype != IEEE80211_STYPE_NULLFUNC)
- netdev_dbg(ieee->dev,
- "RX: dropped data frame with no data (type=0x%02x, subtype=0x%02x)\n",
- type, stype);
- return -1;
- }
+ if (stype != IEEE80211_STYPE_DATA &&
+ stype != IEEE80211_STYPE_DATA_CFACK &&
+ stype != IEEE80211_STYPE_DATA_CFPOLL &&
+ stype != IEEE80211_STYPE_DATA_CFACKPOLL &&
+ stype != IEEE80211_STYPE_QOS_DATA) {
+ if (stype != IEEE80211_STYPE_NULLFUNC)
+ netdev_dbg(ieee->dev,
+ "RX: dropped data frame with no data (type=0x%02x, subtype=0x%02x)\n",
+ type, stype);
+ return -1;
}

/* packets from our adapter are dropped (echo) */
--
2.42.0

2023-10-03 19:34:34

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 10/11] staging: rtl8192e: Remove constant variable net_promiscuous_md

Remove variable net_promiscuous_md as it is set to 0 and unchanged. The
equations result accordingly. Remove dead code.

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

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index ef17472bea05..f46cb152930a 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -739,7 +739,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev)
priv->chan = 1;
priv->rtllib->mode = WIRELESS_MODE_AUTO;
priv->rtllib->iw_mode = IW_MODE_INFRA;
- priv->rtllib->net_promiscuous_md = false;
priv->rtllib->ieee_up = 0;
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
@@ -1030,15 +1029,12 @@ static void _rtl92e_watchdog_wq_cb(void *data)
MAC80211_NOLINK) &&
(ieee->rf_power_state == rf_on) && !ieee->is_set_key &&
(!ieee->proto_stoppping) && !ieee->wx_set_enc) {
- if ((ieee->pwr_save_ctrl.ReturnPoint ==
- IPS_CALLBACK_NONE) &&
- (!ieee->net_promiscuous_md)) {
+ if (ieee->pwr_save_ctrl.ReturnPoint == IPS_CALLBACK_NONE) {
rtl92e_ips_enter(dev);
}
}
}
- if ((ieee->link_state == MAC80211_LINKED) && (ieee->iw_mode ==
- IW_MODE_INFRA) && (!ieee->net_promiscuous_md)) {
+ if ((ieee->link_state == MAC80211_LINKED) && (ieee->iw_mode == IW_MODE_INFRA)) {
if (ieee->link_detect_info.NumRxOkInPeriod > 100 ||
ieee->link_detect_info.NumTxOkInPeriod > 100)
bBusyTraffic = true;
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index d0b68b258af7..c367e4fa2af1 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -209,7 +209,6 @@ static int _rtl92e_wx_set_mode(struct net_device *dev,
union iwreq_data *wrqu, char *b)
{
struct r8192_priv *priv = rtllib_priv(dev);
- struct rtllib_device *ieee = netdev_priv_rsl(dev);

enum rt_rf_power_state rt_state;
int ret;
@@ -218,8 +217,7 @@ static int _rtl92e_wx_set_mode(struct net_device *dev,
return 0;
rt_state = priv->rtllib->rf_power_state;
mutex_lock(&priv->wx_mutex);
- if (wrqu->mode == IW_MODE_MONITOR ||
- ieee->net_promiscuous_md) {
+ if (wrqu->mode == IW_MODE_MONITOR) {
if (rt_state == rf_off) {
if (priv->rtllib->rf_off_reason >
RF_CHANGE_BY_IPS) {
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 97bb00bdbf4d..6d54c03f5680 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -1253,7 +1253,6 @@ struct rtllib_device {
int scan_age;

int iw_mode; /* operating mode (IW_MODE_*) */
- bool net_promiscuous_md;

spinlock_t lock;
spinlock_t wpax_suitlist_lock;
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index f03ec5f53b34..9a5fdf16f6a1 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -1255,12 +1255,8 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
/*Filter pkt not to me*/
multicast = is_multicast_ether_addr(hdr->addr1);
unicast = !multicast;
- if (unicast && !ether_addr_equal(dev->dev_addr, hdr->addr1)) {
- if (ieee->net_promiscuous_md)
- bToOtherSTA = true;
- else
- goto rx_dropped;
- }
+ if (unicast && !ether_addr_equal(dev->dev_addr, hdr->addr1))
+ goto rx_dropped;

/*Filter pkt has too small length */
hdrlen = rtllib_rx_get_hdrlen(ieee, skb, rx_stats);
--
2.42.0

2023-10-03 19:34:51

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 11/11] staging: rtl8192e: Remove constant variable bToOtherSTA

Remove variable bToOtherSTA as it is set to 0 and unchanged. The equations
result accordingly. Remove dead code.

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

diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 9a5fdf16f6a1..124c1651856b 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -1244,7 +1244,6 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
u8 bssid[ETH_ALEN] = {0};

size_t hdrlen = 0;
- bool bToOtherSTA = false;
int ret = 0, i = 0;

fc = le16_to_cpu(hdr->frame_control);
@@ -1278,8 +1277,6 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,

/* Filter MGNT Frame */
if (type == RTLLIB_FTYPE_MGMT) {
- if (bToOtherSTA)
- goto rx_dropped;
if (rtllib_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
@@ -1289,10 +1286,8 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
/* Filter WAPI DATA Frame */

/* Update statstics for AP roaming */
- if (!bToOtherSTA) {
- ieee->link_detect_info.NumRecvDataInPeriod++;
- ieee->link_detect_info.NumRxOkInPeriod++;
- }
+ ieee->link_detect_info.NumRecvDataInPeriod++;
+ ieee->link_detect_info.NumRxOkInPeriod++;

/* Data frame - extract src/dst addresses */
rtllib_rx_extract_addr(ieee, hdr, dst, src, bssid);
@@ -1308,7 +1303,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
/* Send pspoll based on moredata */
if ((ieee->iw_mode == IW_MODE_INFRA) &&
(ieee->sta_sleep == LPS_IS_SLEEP) &&
- (ieee->polling) && (!bToOtherSTA)) {
+ (ieee->polling)) {
if (WLAN_FC_MORE_DATA(fc)) {
/* more data bit is set, let's request a new frame
* from the AP
@@ -1334,8 +1329,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
/* Get TS for Rx Reorder */
hdr = (struct ieee80211_hdr *)skb->data;
if (ieee->current_network.qos_data.active && IsQoSDataFrame(skb->data)
- && !is_multicast_ether_addr(hdr->addr1)
- && (!bToOtherSTA)) {
+ && !is_multicast_ether_addr(hdr->addr1)) {
TID = Frame_QoSTID(skb->data);
SeqNum = WLAN_GET_SEQ_SEQ(sc);
rtllib_get_ts(ieee, (struct ts_common_info **)&ts, hdr->addr2, TID,
@@ -1366,18 +1360,16 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
/* Update WAPI PN */

/* Check if leave LPS */
- if (!bToOtherSTA) {
- if (ieee->bIsAggregateFrame)
- nr_subframes = rxb->nr_subframes;
- else
- nr_subframes = 1;
- if (unicast)
- ieee->link_detect_info.NumRxUnicastOkInPeriod += nr_subframes;
- rtllib_rx_check_leave_lps(ieee, unicast, nr_subframes);
- }
+ if (ieee->bIsAggregateFrame)
+ nr_subframes = rxb->nr_subframes;
+ else
+ nr_subframes = 1;
+ if (unicast)
+ ieee->link_detect_info.NumRxUnicastOkInPeriod += nr_subframes;
+ rtllib_rx_check_leave_lps(ieee, unicast, nr_subframes);

/* Indicate packets to upper layer or Rx Reorder */
- if (!ieee->ht_info->cur_rx_reorder_enable || ts == NULL || bToOtherSTA)
+ if (!ieee->ht_info->cur_rx_reorder_enable || ts == NULL)
rtllib_rx_indicate_pkt_legacy(ieee, rx_stats, rxb, dst, src);
else
RxReorderIndicatePacket(ieee, rxb, ts, SeqNum);
--
2.42.0