staging: rtl8192e: Use standard functions like ieee80211_is_beacon()
cover staging: rtl8192e: Use standard functions like ieee80211_is_beacon()
Remove useless equation in debug output. Use standard functions like ieee80211_is_beacon(). Optimize code for improved readability.
Tested with rtl8192e (WLL6130-D99) in Mode n (12.5 MB/s) Transferred this patch over wlan connection of rtl8192e.
Philipp Hortmann (8):
staging: rtl8192e: Remove useless equation in debug output
staging: rtl8192e: Use standard ieee80211 function in rtllib_rx_mgt()
staging: rtl8192e: Use standard function in
rtllib_process_probe_response()
staging: rtl8192e: Use standard function in
rtllib_rx_check_duplicate()
staging: rtl8192e: Use standard function in softmac_mgmt_xmit()
staging: rtl8192e: Replace rtl92e_disable_irq with rtl92e_irq_disable
staging: rtl8192e: Replace rtl92e_enable_irq with rtl92e_irq_enable
staging: rtl8192e: Remove rtllib_get_payload()
.../staging/rtl8192e/rtl8192e/r8192E_dev.c | 6 +-- .../staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 - drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 18 ------- drivers/staging/rtl8192e/rtllib.h | 24 --------- drivers/staging/rtl8192e/rtllib_rx.c | 54 ++++++------------- drivers/staging/rtl8192e/rtllib_softmac.c | 11 +--- 6 files changed, 22 insertions(+), 93 deletions(-)
Signature · 1 line
2.41.0
PATCH 1/8 staging: rtl8192e: Remove useless equation in debug output
When "switch (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)))" results in "case RTLLIB_STYPE_BEACON:" there is no need to calculate this again inside "case" and when a frame is a beacon there is no need to print the frame identifier again as it is explicit.
Same for PROBE RESPONSE and PROBE REQUEST. Remove dead code.
--- drivers/staging/rtl8192e/rtllib_rx.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/staging/rtl8192e/rtllib_rx.c +3 -6
@@ -2652,8 +2652,7 @@ static void rtllib_rx_mgt(struct rtllib_device *ieee,switch (WLAN_FC_GET_STYPE (le16_to_cpu (header->frame_ctl))) {case RTLLIB_STYPE_BEACON : -netdev_dbg (ieee->dev,"received BEACON (%d)\n" , -WLAN_FC_GET_STYPE (le16_to_cpu (header->frame_ctl))); +netdev_dbg (ieee->dev,"received BEACON\n" );rtllib_process_probe_response ( ieee, (struct rtllib_probe_response *)header, stats);
@@ -2666,14 +2665,12 @@ static void rtllib_rx_mgt(struct rtllib_device *ieee,break ;case RTLLIB_STYPE_PROBE_RESP : -netdev_dbg (ieee->dev,"received PROBE RESPONSE (%d)\n" , -WLAN_FC_GET_STYPE (le16_to_cpu (header->frame_ctl))); +netdev_dbg (ieee->dev,"received PROBE RESPONSE\n" );rtllib_process_probe_response (ieee, (struct rtllib_probe_response *)header, stats);break ;case RTLLIB_STYPE_PROBE_REQ : -netdev_dbg (ieee->dev,"received PROBE REQUEST (%d)\n" , -WLAN_FC_GET_STYPE (le16_to_cpu (header->frame_ctl))); +netdev_dbg (ieee->dev,"received PROBE REQUEST\n" );if ((ieee->softmac_features &IEEE_SOFTMAC_PROBERS ) && (ieee->iw_mode ==IW_MODE_ADHOC && ieee->link_state ==MAC80211_LINKED ))
Signature · 1 line
2.41.0
PATCH 2/8 staging: rtl8192e: Use standard ieee80211 function in rtllib_rx_mgt()
In reply to Philipp HortmannReplace WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)) and comparison with standard function to avoid proprietary code and to increase readability.
--- drivers/staging/rtl8192e/rtllib_rx.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
drivers/staging/rtl8192e/rtllib_rx.c +5 -13
@@ -2644,14 +2644,11 @@ static void rtllib_rx_mgt(struct rtllib_device *ieee, {struct rtllib_hdr_4addr *header = (struct rtllib_hdr_4addr *)skb->data; -if ((WLAN_FC_GET_STYPE (le16_to_cpu (header->frame_ctl)) != -RTLLIB_STYPE_PROBE_RESP ) && - (WLAN_FC_GET_STYPE (le16_to_cpu (header->frame_ctl)) != -RTLLIB_STYPE_BEACON )) +if (!ieee80211_is_probe_resp (header->frame_ctl) && + (!ieee80211_is_beacon (header->frame_ctl))) ieee->last_rx_ps_time = jiffies; -switch (WLAN_FC_GET_STYPE (le16_to_cpu (header->frame_ctl))) { -case RTLLIB_STYPE_BEACON : +if (ieee80211_is_beacon (header->frame_ctl)) {netdev_dbg (ieee->dev,"received BEACON\n" ); rtllib_process_probe_response( ieee, (struct rtllib_probe_response *)header,
@@ -2661,20 +2658,15 @@ static void rtllib_rx_mgt(struct rtllib_device *ieee, ieee->iw_mode == IW_MODE_INFRA && ieee->link_state == MAC80211_LINKED))schedule_work (&ieee->ps_task); - -break ; - -case RTLLIB_STYPE_PROBE_RESP : + }else if (ieee80211_is_probe_resp (header->frame_ctl)) {netdev_dbg (ieee->dev,"received PROBE RESPONSE\n" );rtllib_process_probe_response (ieee, (struct rtllib_probe_response *)header, stats); -break ; -case RTLLIB_STYPE_PROBE_REQ : + }else if (ieee80211_is_probe_req (header->frame_ctl)) {netdev_dbg (ieee->dev,"received PROBE REQUEST\n" );if ((ieee->softmac_features &IEEE_SOFTMAC_PROBERS ) && (ieee->iw_mode ==IW_MODE_ADHOC && ieee->link_state ==MAC80211_LINKED ))rtllib_rx_probe_rq (ieee, skb); -break ; } }
Signature · 1 line
2.41.0
PATCH 3/8 staging: rtl8192e: Use standard function in rtllib_process_probe_response()
In reply to Philipp HortmannReplace proprietary is_beacon() with ieee80211_is_beacon() and proprietary "WLAN_FC_GET_STYPE(frame_ctl) == RTLLIB_STYPE_PROBE_RESP" with standard function to increase readability.
--- drivers/staging/rtl8192e/rtllib_rx.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
drivers/staging/rtl8192e/rtllib_rx.c +7 -12
@@ -2448,11 +2448,6 @@ static inline void update_network(struct rtllib_device *ieee, dst->BssCcxVerNumber = src->BssCcxVerNumber; } -static inline int is_beacon (u16 fc) -{ -return (WLAN_FC_GET_STYPE (fc) ==RTLLIB_STYPE_BEACON ); -} -static int IsPassiveChannel (struct rtllib_device *rtllib,u8 channel) {if (channel >MAX_CHANNEL_NUMBER ) {
@@ -2491,7 +2486,7 @@ static inline void rtllib_process_probe_response(short renew;struct rtllib_network *network =kzalloc (sizeof (struct rtllib_network ),GFP_ATOMIC ); -u16 frame_ctl =le16_to_cpu (beacon->header.frame_ctl); +__le16 frame_ctl = beacon->header.frame_ctl;if (!network)return ;
@@ -2521,14 +2516,14 @@ static inline void rtllib_process_probe_response(netdev_dbg (ieee->dev,"Dropped '%s' ( %pM) via %s.\n" ,escape_essid (info_element->data, info_element->len), beacon->header.addr3, -is_beacon (frame_ctl) ?"BEACON" :"PROBE RESPONSE" ); +ieee80211_is_beacon (frame_ctl) ?"BEACON" :"PROBE RESPONSE" ); goto free_network; }if (!rtllib_legal_channel (ieee, network->channel)) goto free_network; -if (WLAN_FC_GET_STYPE (frame_ctl) ==RTLLIB_STYPE_PROBE_RESP ) { +if (ieee80211_is_probe_resp (frame_ctl)) {if (IsPassiveChannel (ieee, network->channel)) { netdev_info(ieee->dev, "GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n",
@@ -2561,7 +2556,7 @@ static inline void rtllib_process_probe_response(else ieee->current_network.buseprotection = false; } -if (is_beacon (frame_ctl)) { +if (ieee80211_is_beacon (frame_ctl)) {if (ieee->link_state >=MAC80211_LINKED ) ieee->link_detect_info.NumRecvBcnInPeriod++; }
@@ -2597,7 +2592,7 @@ static inline void rtllib_process_probe_response(netdev_dbg (ieee->dev,"Adding '%s' ( %pM) via %s.\n" ,escape_essid (network->ssid, network->ssid_len), network->bssid, -is_beacon (frame_ctl) ?"BEACON" :"PROBE RESPONSE" ); +ieee80211_is_beacon (frame_ctl) ?"BEACON" :"PROBE RESPONSE" );memcpy (target, network,sizeof (*target));list_add_tail (&target->list, &ieee->network_list);
@@ -2607,7 +2602,7 @@ static inline void rtllib_process_probe_response(netdev_dbg (ieee->dev,"Updating '%s' ( %pM) via %s.\n" ,escape_essid (target->ssid, target->ssid_len), target->bssid, -is_beacon (frame_ctl) ?"BEACON" :"PROBE RESPONSE" ); +ieee80211_is_beacon (frame_ctl) ?"BEACON" :"PROBE RESPONSE" );/* we have an entry and we are going to update it. But this * entry may be already expired. In this case we do the same
@@ -2628,7 +2623,7 @@ static inline void rtllib_process_probe_response( }spin_unlock_irqrestore (&ieee->lock, flags); -if (is_beacon (frame_ctl) && +if (ieee80211_is_beacon (frame_ctl) &&is_same_network (&ieee->current_network, network, (network->ssid_len ?1 :0 )) && (ieee->link_state ==MAC80211_LINKED )) {
Signature · 1 line
2.41.0
PATCH 4/8 staging: rtl8192e: Use standard function in rtllib_rx_check_duplicate()
In reply to Philipp HortmannUse standard function ieee80211_is_beacon() to avoid proprietary code and to increase readability.
--- drivers/staging/rtl8192e/rtllib_rx.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/rtl8192e/rtllib_rx.c +2 -6
@@ -904,11 +904,8 @@ static int rtllib_rx_check_duplicate(struct rtllib_device *ieee, {struct rtllib_hdr_4addr *hdr = (struct rtllib_hdr_4addr *)skb->data;u16 fc, sc; -u8 frag, type, stype; +u8 frag; - fc =le16_to_cpu (hdr->frame_ctl); - type =WLAN_FC_GET_TYPE (fc); - stype =WLAN_FC_GET_STYPE (fc); sc =le16_to_cpu (hdr->seq_ctl); frag =WLAN_GET_SEQ_FRAG (sc);
@@ -916,8 +913,7 @@ static int rtllib_rx_check_duplicate(struct rtllib_device *ieee, !ieee->current_network.qos_data.active || !IsDataFrame(skb->data) || IsLegacyDataFrame(skb->data)) { -if (!((type ==RTLLIB_FTYPE_MGMT ) && - (stype ==RTLLIB_STYPE_BEACON ))) { +if (!ieee80211_is_beacon (hdr->frame_ctl)) {if (is_duplicate_packet (ieee, hdr))return -1 ; }
Signature · 1 line
2.41.0
kernel test robot
build botRe: [PATCH 4/8] staging: rtl8192e: Use standard function in rtllib_rx_check_duplicate()
kernel test robot noticed the following build warnings:
Hi Philipp,
kernel test robot noticed the following build warnings:
[auto build test WARNING on staging/staging-testing]
url: https://github.com/intel-lab-lkp/linux/commits/Philipp-Hortmann/staging-rtl8192e-Remove-useless-equation-in-debug-output/20230910-022154 base: staging/staging-testing patch link: https://lore.kernel.org/r/c636aadd4cf4898c57c348a1d789790c5a459749.1694282907.git.philipp.g.hortmann%40gmail.com patch subject: [PATCH 4/8] staging: rtl8192e: Use standard function in rtllib_rx_check_duplicate() config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230912/[email protected]/config) compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230912/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/staging/rtl8192e/rtllib_rx.c:925:9: warning: variable 'fc' is uninitialized when used here [-Wuninitialized]
if ((fc & (1 << 11)) && (frag == pRxTS->rx_last_frag_num) &&
^~
drivers/staging/rtl8192e/rtllib_rx.c:906:8: note: initialize the variable 'fc' to silence this warning
u16 fc, sc;
^
= 01 warning generated.
vim +/fc +925 drivers/staging/rtl8192e/rtllib_rx.c
94a799425eee82 Larry Finger 2011-08-23 901
49aab5fd9df153 Larry Finger 2011-08-25 902 static int rtllib_rx_check_duplicate(struct rtllib_device *ieee,
49aab5fd9df153 Larry Finger 2011-08-25 903 struct sk_buff *skb, u8 multicast)
94a799425eee82 Larry Finger 2011-08-23 904 {
94a799425eee82 Larry Finger 2011-08-23 905 struct rtllib_hdr_4addr *hdr = (struct rtllib_hdr_4addr *)skb->data;
94a799425eee82 Larry Finger 2011-08-23 906 u16 fc, sc;
ffed9955529a37 Philipp Hortmann 2023-09-09 907 u8 frag;
94a799425eee82 Larry Finger 2011-08-23 908
94a799425eee82 Larry Finger 2011-08-23 909 sc = le16_to_cpu(hdr->seq_ctl);
94a799425eee82 Larry Finger 2011-08-23 910 frag = WLAN_GET_SEQ_FRAG(sc);
94a799425eee82 Larry Finger 2011-08-23 911
ccdbe14b77a5e3 Philipp Hortmann 2022-11-13 912 if (!ieee->ht_info->cur_rx_reorder_enable ||
94a799425eee82 Larry Finger 2011-08-23 913 !ieee->current_network.qos_data.active ||
94a799425eee82 Larry Finger 2011-08-23 914 !IsDataFrame(skb->data) ||
94a799425eee82 Larry Finger 2011-08-23 915 IsLegacyDataFrame(skb->data)) {
ffed9955529a37 Philipp Hortmann 2023-09-09 916 if (!ieee80211_is_beacon(hdr->frame_ctl)) {
db8971b618ed96 Larry Finger 2011-08-25 917 if (is_duplicate_packet(ieee, hdr))
94a799425eee82 Larry Finger 2011-08-23 918 return -1;
94a799425eee82 Larry Finger 2011-08-23 919 }
94a799425eee82 Larry Finger 2011-08-23 920 } else {
2c47ae282a4bba Larry Finger 2011-07-18 921 struct rx_ts_record *pRxTS = NULL;
3a6b70c3f3558a Matthew Casey 2014-08-22 922
74724de1c40192 Larry Finger 2011-07-18 923 if (GetTs(ieee, (struct ts_common_info **)&pRxTS, hdr->addr2,
94a799425eee82 Larry Finger 2011-08-23 924 (u8)Frame_QoSTID((u8 *)(skb->data)), RX_DIR, true)) {
3b32b210c0717d William Durand 2021-03-01 @925 if ((fc & (1 << 11)) && (frag == pRxTS->rx_last_frag_num) &&
6d852649821da7 William Durand 2021-03-01 926 (WLAN_GET_SEQ_SEQ(sc) == pRxTS->rx_last_seq_num))
94a799425eee82 Larry Finger 2011-08-23 927 return -1;
3b32b210c0717d William Durand 2021-03-01 928 pRxTS->rx_last_frag_num = frag;
6d852649821da7 William Durand 2021-03-01 929 pRxTS->rx_last_seq_num = WLAN_GET_SEQ_SEQ(sc);
94a799425eee82 Larry Finger 2011-08-23 930 } else {
11e672c3e2d2a1 Mateusz Kulikowski 2015-05-31 931 netdev_warn(ieee->dev, "%s(): No TS! Skip the check!\n",
11e672c3e2d2a1 Mateusz Kulikowski 2015-05-31 932 __func__);
94a799425eee82 Larry Finger 2011-08-23 933 return -1;
94a799425eee82 Larry Finger 2011-08-23 934 }
94a799425eee82 Larry Finger 2011-08-23 935 }
94a799425eee82 Larry Finger 2011-08-23 936
94a799425eee82 Larry Finger 2011-08-23 937 return 0;
94a799425eee82 Larry Finger 2011-08-23 938 }
db8971b618ed96 Larry Finger 2011-08-25 939 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 5/8 staging: rtl8192e: Use standard function in softmac_mgmt_xmit()
In reply to Philipp HortmannUse standard function ieee80211_is_beacon() to avoid proprietary code to identify beacon and to increase readability in softmac_mgmt_xmit() and _rtl92e_translate_rx_signal_stats()
--- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtllib.h | 1 - drivers/staging/rtl8192e/rtllib_softmac.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +1 -1
@@ -1584,7 +1584,7 @@ static void _rtl92e_translate_rx_signal_stats(struct net_device *dev, (!pstats->bHwError) && (!pstats->bCRC) && (!pstats->bICV)); bpacket_toself = bpacket_match_bssid &&/* check this */ ether_addr_equal (praddr, priv->rtllib->dev->dev_addr); -if (WLAN_FC_GET_FRAMETYPE (fc) ==RTLLIB_STYPE_BEACON ) +if (ieee80211_is_beacon (hdr->frame_ctl)) bPacketBeacon = true;_rtl92e_process_phyinfo (priv, tmp_buf, &previous_stats, pstats); _rtl92e_query_rxphystatus(priv, pstats, pdesc, pdrvinfo,
drivers/staging/rtl8192e/rtllib.h +0 -1
@@ -459,7 +459,6 @@ enum _REG_PREAMBLE_MODE {#define WLAN_FC_GET_STYPE (fc) ((fc) & RTLLIB_FCTL_STYPE)#define WLAN_FC_MORE_DATA (fc) ((fc) & RTLLIB_FCTL_MOREDATA) -#define WLAN_FC_GET_FRAMETYPE (fc) ((fc) & RTLLIB_FCTL_FRAMETYPE)#define WLAN_GET_SEQ_FRAG (seq) ((seq) & RTLLIB_SCTL_FRAG)#define WLAN_GET_SEQ_SEQ (seq) (((seq) & RTLLIB_SCTL_SEQ) >> 4)
drivers/staging/rtl8192e/rtllib_softmac.c +1 -1
@@ -197,7 +197,7 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee)/* called with 2nd param 0, no mgmt lock required */ rtllib_sta_wakeup (ieee,0 ); -if (le16_to_cpu (header->frame_ctl) ==RTLLIB_STYPE_BEACON ) +if (ieee80211_is_beacon (header->frame_ctl)) tcb_desc->queue_index =BEACON_QUEUE ;else tcb_desc->queue_index =MGNT_QUEUE ;
Signature · 1 line
2.41.0
PATCH 6/8 staging: rtl8192e: Replace rtl92e_disable_irq with rtl92e_irq_disable
In reply to Philipp HortmannReplace rtl92e_disable_irq with rtl92e_irq_disable to increase readability. priv->irq_enabled = 0 was set in both functions.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 9 --------- 3 files changed, 1 insertion(+), 11 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +1 -1
@@ -1879,7 +1879,7 @@ void rtl92e_enable_irq(struct net_device *dev)rtl92e_writel (dev,INTA_MASK , priv->irq_mask[0 ]); } -void rtl92e_disable_irq (struct net_device *dev) +void rtl92e_irq_disable (struct net_device *dev) {struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv (dev);
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +0 -1
@@ -17,7 +17,6 @@ void rtl92e_ack_irq(struct net_device *dev, u32 *p_inta);void rtl92e_enable_rx (struct net_device *dev);void rtl92e_enable_tx (struct net_device *dev);void rtl92e_enable_irq (struct net_device *dev); -void rtl92e_disable_irq (struct net_device *dev);void rtl92e_init_variables (struct net_device *dev);void rtl92e_start_beacon (struct net_device *dev);void rtl92e_set_reg (struct net_device *dev,u8 variable,u8 *val);
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -9
@@ -236,15 +236,6 @@ void rtl92e_irq_enable(struct net_device *dev)rtl92e_enable_irq (dev); } -void rtl92e_irq_disable (struct net_device *dev) -{ -struct r8192_priv *priv =rtllib_priv (dev); - -rtl92e_disable_irq (dev); - - priv->irq_enabled =0 ; -} -static void _rtl92e_set_chan (struct net_device *dev,short ch) {struct r8192_priv *priv =rtllib_priv (dev);
Signature · 1 line
2.41.0
PATCH 7/8 staging: rtl8192e: Replace rtl92e_enable_irq with rtl92e_irq_enable
In reply to Philipp HortmannReplace rtl92e_enable_irq with rtl92e_irq_enable to increase readability. priv->irq_enabled = 1 was set in both functions.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 9 --------- 3 files changed, 1 insertion(+), 11 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +1 -1
@@ -1870,7 +1870,7 @@ rtl92e_init_variables(struct net_device *dev) priv->bfirst_after_down = false; } -void rtl92e_enable_irq (struct net_device *dev) +void rtl92e_irq_enable (struct net_device *dev) {struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv (dev);
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +0 -1
@@ -16,7 +16,6 @@ bool rtl92e_is_rx_stuck(struct net_device *dev);void rtl92e_ack_irq (struct net_device *dev,u32 *p_inta);void rtl92e_enable_rx (struct net_device *dev);void rtl92e_enable_tx (struct net_device *dev); -void rtl92e_enable_irq (struct net_device *dev);void rtl92e_init_variables (struct net_device *dev);void rtl92e_start_beacon (struct net_device *dev);void rtl92e_set_reg (struct net_device *dev,u8 variable,u8 *val);
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -9
@@ -227,15 +227,6 @@ static void _rtl92e_tx_timeout(struct net_device *dev, unsigned int txqueue)netdev_info (dev,"TXTIMEOUT" ); } -void rtl92e_irq_enable (struct net_device *dev) -{ -struct r8192_priv *priv =rtllib_priv (dev); - - priv->irq_enabled =1 ; - -rtl92e_enable_irq (dev); -} -static void _rtl92e_set_chan (struct net_device *dev,short ch) {struct r8192_priv *priv =rtllib_priv (dev);
Signature · 1 line
2.41.0
PATCH 8/8 staging: rtl8192e: Remove rtllib_get_payload()
In reply to Philipp Hortmannrtllib_process_action() is only called in one place with management frames. Frame is passed over to rtllib_get_payload() which passes it to rtllib_get_hdrlen(). In rtllib_get_hdrlen() all management frames return with hdrlen = RTLLIB_3ADDR_LEN. Therefore the switch in rtllib_get_payload() is useless and dead code. The condition act == NULL cannot occur and can also be removed. Then rtllib_hdr_2addr is not used anymore and can be removed as well.
--- drivers/staging/rtl8192e/rtllib.h | 23 ----------------------- drivers/staging/rtl8192e/rtllib_softmac.c | 9 +-------- 2 files changed, 1 insertion(+), 31 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -23
@@ -692,14 +692,6 @@ struct rtllib_hdr_1addr {u8 payload[]; } __packed; -struct rtllib_hdr_2addr { -__le16 frame_ctl; -__le16 duration_id; -u8 addr1[ETH_ALEN ]; -u8 addr2[ETH_ALEN ]; -u8 payload[]; -} __packed; -struct rtllib_hdr_3addr {__le16 frame_ctl;__le16 duration_id;
@@ -1781,21 +1773,6 @@ static inline int rtllib_get_hdrlen(u16 fc)return hdrlen; } -static inline u8 *rtllib_get_payload (struct rtllib_hdr *hdr) -{ -switch (rtllib_get_hdrlen (le16_to_cpu (hdr->frame_ctl))) { -case RTLLIB_1ADDR_LEN : -return ((struct rtllib_hdr_1addr *)hdr)->payload; -case RTLLIB_2ADDR_LEN : -return ((struct rtllib_hdr_2addr *)hdr)->payload; -case RTLLIB_3ADDR_LEN : -return ((struct rtllib_hdr_3addr *)hdr)->payload; -case RTLLIB_4ADDR_LEN : -return ((struct rtllib_hdr_4addr *)hdr)->payload; - } -return NULL ; -} -static inline int rtllib_is_ofdm_rate (u8 rate) {switch (rate & ~RTLLIB_BASIC_RATE_MASK ) {
drivers/staging/rtl8192e/rtllib_softmac.c +1 -8
@@ -1921,16 +1921,9 @@ EXPORT_SYMBOL(rtllib_ps_tx_ack);static void rtllib_process_action (struct rtllib_device *ieee,struct sk_buff *skb) { -struct rtllib_hdr_3addr *header = (struct rtllib_hdr_3addr *)skb->data; -u8 *act =rtllib_get_payload ((struct rtllib_hdr *)header); +u8 *act = skb->data +RTLLIB_3ADDR_LEN ;u8 category =0 ; -if (act ==NULL ) { -netdev_warn (ieee->dev, -"Error getting payload of action frame\n" ); -return ; - } - category = *act; act++;switch (category) {
Signature · 1 line
2.41.0