From 2b632f7f4aedeeae18614a1c3eb7dfb59cad990c Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 13 Aug 2023 08:36:23 +0200 Subject: [PATCH] staging: rtl8192e: Remove unsupported mode IW_MODE_MASTER 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_MASTER 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_MASTER. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/9cd4574e4cfe0a2d7afce03c9b868757e215a23c.1691908402.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/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_rx.c | 4 +--- drivers/staging/rtl8192e/rtllib_softmac.c | 11 +---------- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 9 ++------- drivers/staging/rtl8192e/rtllib_tx.c | 2 -- 8 files changed, 9 insertions(+), 44 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 5bfd84b..58e90b7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -59,10 +59,6 @@ static void _rtl92e_update_msr(struct net_device *dev) if (priv->rtllib->link_state == MAC80211_LINKED) msr |= MSR_LINK_ADHOC; break; - case IW_MODE_MASTER: - if (priv->rtllib->link_state == MAC80211_LINKED) - msr |= MSR_LINK_MASTER; - break; default: break; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 1c49d5d..598bfc0 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -118,8 +118,7 @@ void rtl92e_ips_enter(struct net_device *dev) rt_state = priv->rtllib->rf_power_state; if (rt_state == rf_on && !psc->bSwRfProcessing && - (priv->rtllib->link_state != MAC80211_LINKED) && - (priv->rtllib->iw_mode != IW_MODE_MASTER)) { + (priv->rtllib->link_state != MAC80211_LINKED)) { psc->eInactivePowerState = rf_off; _rtl92e_ps_update_rf_state(dev); } @@ -210,8 +209,7 @@ void rtl92e_leisure_ps_enter(struct net_device *dev) if (!((priv->rtllib->iw_mode == IW_MODE_INFRA) && (priv->rtllib->link_state == MAC80211_LINKED)) - || (priv->rtllib->iw_mode == IW_MODE_ADHOC) || - (priv->rtllib->iw_mode == IW_MODE_MASTER)) + || (priv->rtllib->iw_mode == IW_MODE_ADHOC)) return; if (psc->bLeisurePs) { diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index f9fa3f2..f19feea 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -363,8 +363,7 @@ void HTConstructInfoElement(struct rtllib_device *ieee, u8 *posHTInfo, } memset(posHTInfo, 0, *len); - if ((ieee->iw_mode == IW_MODE_ADHOC) || - (ieee->iw_mode == IW_MODE_MASTER)) { + if (ieee->iw_mode == IW_MODE_ADHOC) { pHTInfoEle->ControlChl = ieee->current_network.channel; pHTInfoEle->ExtChlOffset = ((!pHT->bRegBW40MHz) ? HT_EXTCHNL_OFFSET_NO_EXT : diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index 24a8b9f..419ff72 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -182,15 +182,7 @@ static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee, struct list_head *psearch_list; struct ts_common_info *pRet = NULL; - if (ieee->iw_mode == IW_MODE_MASTER) { - if (TxRxSelect == TX_DIR) { - search_dir[DIR_DOWN] = true; - search_dir[DIR_BI_DIR] = true; - } else { - search_dir[DIR_UP] = true; - search_dir[DIR_BI_DIR] = true; - } - } else if (ieee->iw_mode == IW_MODE_ADHOC) { + if (ieee->iw_mode == IW_MODE_ADHOC) { if (TxRxSelect == TX_DIR) search_dir[DIR_UP] = true; else @@ -311,9 +303,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, (&ieee->Tx_TS_Admit_List) : (&ieee->Rx_TS_Admit_List); - Dir = (ieee->iw_mode == IW_MODE_MASTER) ? - ((TxRxSelect == TX_DIR) ? DIR_DOWN : DIR_UP) : - ((TxRxSelect == TX_DIR) ? DIR_UP : DIR_DOWN); + Dir = ((TxRxSelect == TX_DIR) ? DIR_UP : DIR_DOWN); if (!list_empty(pUnusedList)) { (*ppTS) = list_entry(pUnusedList->next, diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 8a4029f..b3f5ab3 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -1496,7 +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_MASTER: case IW_MODE_REPEAT: break; case IW_MODE_MONITOR: @@ -2682,8 +2681,7 @@ static void rtllib_rx_mgt(struct rtllib_device *ieee, netdev_dbg(ieee->dev, "received PROBE REQUEST (%d)\n", WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))); if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) && - ((ieee->iw_mode == IW_MODE_ADHOC || - ieee->iw_mode == IW_MODE_MASTER) && + (ieee->iw_mode == IW_MODE_ADHOC && ieee->link_state == MAC80211_LINKED)) rtllib_rx_probe_rq(ieee, skb); break; diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 0e52b20..6fa1d6a 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -935,8 +935,7 @@ static struct sk_buff *rtllib_assoc_resp(struct rtllib_device *ieee, u8 *dest) 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(ieee->iw_mode == IW_MODE_MASTER ? - WLAN_CAPABILITY_ESS : WLAN_CAPABILITY_IBSS); + assoc->capability = cpu_to_le16(WLAN_CAPABILITY_IBSS); assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME); @@ -2248,8 +2247,6 @@ rtllib_rx_auth(struct rtllib_device *ieee, struct sk_buff *skb, netdev_dbg(ieee->dev, "Received authentication response"); rtllib_rx_auth_resp(ieee, skb); - } else if (ieee->iw_mode == IW_MODE_MASTER) { - rtllib_rx_auth_rq(ieee, skb); } } return 0; @@ -2309,9 +2306,6 @@ inline int rtllib_rx_frame_softmac(struct rtllib_device *ieee, break; case RTLLIB_STYPE_ASSOC_REQ: case RTLLIB_STYPE_REASSOC_REQ: - if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && - ieee->iw_mode == IW_MODE_MASTER) - rtllib_rx_assoc_rq(ieee, skb); break; case RTLLIB_STYPE_AUTH: rtllib_rx_auth(ieee, skb, rx_stats); @@ -2807,9 +2801,6 @@ void rtllib_start_protocol(struct rtllib_device *ieee) case IW_MODE_ADHOC: rtllib_start_ibss(ieee); break; - case IW_MODE_MASTER: - rtllib_start_master_bss(ieee); - break; case IW_MODE_MONITOR: rtllib_start_monitor_mode(ieee); break; diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c index aad91da..0b690f0 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c @@ -51,8 +51,7 @@ int rtllib_wx_set_freq(struct rtllib_device *ieee, struct iw_request_info *a, ieee->current_network.channel = fwrq->m; ieee->set_chan(ieee->dev, ieee->current_network.channel); - if (ieee->iw_mode == IW_MODE_ADHOC || - ieee->iw_mode == IW_MODE_MASTER) + if (ieee->iw_mode == IW_MODE_ADHOC) if (ieee->link_state == MAC80211_LINKED) { rtllib_stop_send_beacons(ieee); rtllib_start_send_beacons(ieee); @@ -125,10 +124,6 @@ int rtllib_wx_set_wap(struct rtllib_device *ieee, mutex_lock(&ieee->wx_mutex); /* use ifconfig hw ether */ - if (ieee->iw_mode == IW_MODE_MASTER) { - ret = -1; - goto out; - } if (temp->sa_family != ARPHRD_ETHER) { ret = -EINVAL; @@ -366,7 +361,7 @@ void rtllib_wx_sync_scan_wq(void *data) ieee->link_detect_info.NumRecvBcnInPeriod = 1; ieee->link_detect_info.NumRecvDataInPeriod = 1; } - if (ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) + if (ieee->iw_mode == IW_MODE_ADHOC) rtllib_start_send_beacons(ieee); rtllib_wake_all_queues(ieee); diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 24fd402..4199aee 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -463,8 +463,6 @@ static void rtllib_query_protectionmode(struct rtllib_device *ieee, } if (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_PREAMBLE) tcb_desc->bUseShortPreamble = true; - if (ieee->iw_mode == IW_MODE_MASTER) - goto NO_PROTECTION; return; NO_PROTECTION: tcb_desc->bRTSEnable = false; -- 2.7.4