staging: r8188eu: clean up OnAction
cover staging: r8188eu: clean up OnAction
Simplify the OnAction function. Remove unused action categories. Use a switch statement instead of a table for the three remaining categories.
Martin Kaiser (9):
staging: r8188eu: action category ht is not used
staging: r8188eu: action category wmm is not used
staging: r8188eu: remove unused action handler prototypes
staging: r8188eu: remove action_handler string
staging: r8188eu: remove an unused category define
staging: r8188eu: replace OnAction_tbl with switch-case
staging: r8188eu: use ieee80211_mgmt for action category
staging: r8188eu: use standard category defines
staging: r8188eu: remove unused IEEE_* defines
drivers/staging/r8188eu/core/rtw_mlme_ext.c | 62 +++++++------------ drivers/staging/r8188eu/core/rtw_p2p.c | 4 +- drivers/staging/r8188eu/include/ieee80211.h | 10 --- .../staging/r8188eu/include/rtw_mlme_ext.h | 16 ----- 4 files changed, 23 insertions(+), 69 deletions(-)
Signature · 1 line
2.30.2
PATCH 1/9 staging: r8188eu: action category ht is not used
The r8188eu driver does not handle the ht action category. Remove the empty handler function, the entry in OnAction_tbl and the define for the category.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 6 ------ drivers/staging/r8188eu/include/ieee80211.h | 1 - drivers/staging/r8188eu/include/rtw_mlme_ext.h | 2 -- 3 files changed, 9 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +0 -6
@@ -35,7 +35,6 @@ static mlme_handler mlme_sta_tbl[] = {static struct action_handler OnAction_tbl[] = { {RTW_WLAN_CATEGORY_BACK ,"ACTION_BACK" , &OnAction_back}, {RTW_WLAN_CATEGORY_PUBLIC ,"ACTION_PUBLIC" , on_action_public}, - {RTW_WLAN_CATEGORY_HT ,"ACTION_HT" , &OnAction_ht}, {RTW_WLAN_CATEGORY_WMM ,"ACTION_WMM" , &OnAction_wmm}, {RTW_WLAN_CATEGORY_P2P ,"ACTION_P2P" , &OnAction_p2p}, };
@@ -3837,11 +3836,6 @@ unsigned int on_action_public(struct adapter *padapter, struct recv_frame *precvreturn ret; } -unsigned int OnAction_ht (struct adapter *padapter,struct recv_frame *precv_frame) -{ -return _SUCCESS; -} -unsigned int OnAction_wmm (struct adapter *padapter,struct recv_frame *precv_frame) {return _SUCCESS;
drivers/staging/r8188eu/include/ieee80211.h +0 -1
@@ -598,7 +598,6 @@ static inline int is_broadcast_mac_addr(const u8 *addr)enum rtw_ieee80211_category {RTW_WLAN_CATEGORY_BACK =3 ,RTW_WLAN_CATEGORY_PUBLIC =4 ,/* IEEE 802.11 public action frames */ -RTW_WLAN_CATEGORY_HT =7 ,RTW_WLAN_CATEGORY_TDLS =12 ,RTW_WLAN_CATEGORY_WMM =17 ,RTW_WLAN_CATEGORY_P2P =0x7f ,/* P2P action frames */
drivers/staging/r8188eu/include/rtw_mlme_ext.h +0 -2
@@ -577,8 +577,6 @@ unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_frame);unsigned int on_action_public (struct adapter *padapter,struct recv_frame *precv_frame); -unsigned int OnAction_ht (struct adapter *padapter, -struct recv_frame *precv_frame);unsigned int OnAction_wmm (struct adapter *padapter,struct recv_frame *precv_frame); unsigned int OnAction_p2p(struct adapter *padapter,
Signature · 1 line
2.30.2
PATCH 2/9 staging: r8188eu: action category wmm is not used
In reply to Martin KaiserThe r8188eu driver does not handle the wmm action category. Remove the empty handler function, the entry in OnAction_tbl and the define for the category.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 6 ------ drivers/staging/r8188eu/include/ieee80211.h | 1 - drivers/staging/r8188eu/include/rtw_mlme_ext.h | 2 -- 3 files changed, 9 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +0 -6
@@ -35,7 +35,6 @@ static mlme_handler mlme_sta_tbl[] = {static struct action_handler OnAction_tbl[] = { {RTW_WLAN_CATEGORY_BACK ,"ACTION_BACK" , &OnAction_back}, {RTW_WLAN_CATEGORY_PUBLIC ,"ACTION_PUBLIC" , on_action_public}, - {RTW_WLAN_CATEGORY_WMM ,"ACTION_WMM" , &OnAction_wmm}, {RTW_WLAN_CATEGORY_P2P ,"ACTION_P2P" , &OnAction_p2p}, };
@@ -3836,11 +3835,6 @@ unsigned int on_action_public(struct adapter *padapter, struct recv_frame *precvreturn ret; } -unsigned int OnAction_wmm (struct adapter *padapter,struct recv_frame *precv_frame) -{ -return _SUCCESS; -} -unsigned int OnAction_p2p (struct adapter *padapter,struct recv_frame *precv_frame) {u8 *frame_body;
drivers/staging/r8188eu/include/ieee80211.h +0 -1
@@ -599,7 +599,6 @@ enum rtw_ieee80211_category {RTW_WLAN_CATEGORY_BACK =3 ,RTW_WLAN_CATEGORY_PUBLIC =4 ,/* IEEE 802.11 public action frames */ RTW_WLAN_CATEGORY_TDLS =12 , -RTW_WLAN_CATEGORY_WMM =17 , RTW_WLAN_CATEGORY_P2P = 0x7f,/* P2P action frames */ };
drivers/staging/r8188eu/include/rtw_mlme_ext.h +0 -2
@@ -577,8 +577,6 @@ unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_frame);unsigned int on_action_public (struct adapter *padapter,struct recv_frame *precv_frame); -unsigned int OnAction_wmm (struct adapter *padapter, -struct recv_frame *precv_frame);unsigned int OnAction_p2p (struct adapter *padapter,struct recv_frame *precv_frame);
Signature · 1 line
2.30.2
PATCH 3/9 staging: r8188eu: remove unused action handler prototypes
In reply to Martin KaiserFor some action categories, we removed the handler function, but we forgot the prototypes. Remove them as well.
--- drivers/staging/r8188eu/include/rtw_mlme_ext.h | 6 ------ 1 file changed, 6 deletions(-)
drivers/staging/r8188eu/include/rtw_mlme_ext.h +0 -6
@@ -567,12 +567,6 @@ unsigned int OnDeAuth(struct adapter *padapter,unsigned int OnAction (struct adapter *padapter,struct recv_frame *precv_frame); -unsigned int on_action_spct (struct adapter *padapter, -struct recv_frame *precv_frame); -unsigned int OnAction_qos (struct adapter *padapter, -struct recv_frame *precv_frame); -unsigned int OnAction_dls (struct adapter *padapter, -struct recv_frame *precv_frame);unsigned int OnAction_back (struct adapter *padapter,struct recv_frame *precv_frame); unsigned int on_action_public(struct adapter *padapter,
Signature · 1 line
2.30.2
PATCH 4/9 staging: r8188eu: remove action_handler string
In reply to Martin KaiserRemove the unused str component from struct action_handler and the corresponding entries in OnAction_tbl.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 6 +++--- drivers/staging/r8188eu/include/rtw_mlme_ext.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +3 -3
@@ -33,9 +33,9 @@ static mlme_handler mlme_sta_tbl[] = { };static struct action_handler OnAction_tbl[] = { - {RTW_WLAN_CATEGORY_BACK ,"ACTION_BACK" , &OnAction_back}, - {RTW_WLAN_CATEGORY_PUBLIC ,"ACTION_PUBLIC" , on_action_public}, - {RTW_WLAN_CATEGORY_P2P ,"ACTION_P2P" , &OnAction_p2p}, + {RTW_WLAN_CATEGORY_BACK , &OnAction_back}, + {RTW_WLAN_CATEGORY_PUBLIC , on_action_public}, + {RTW_WLAN_CATEGORY_P2P , &OnAction_p2p}, };static u8 null_addr[ETH_ALEN ] = {0 ,0 ,0 ,0 ,0 ,0 };
drivers/staging/r8188eu/include/rtw_mlme_ext.h +0 -1
@@ -188,7 +188,6 @@ typedef unsigned int (*mlme_handler)(struct adapter *adapt, struct recv_frame *fstruct action_handler {unsigned int num; -char * str;unsigned int (*func)(struct adapter *adapt,struct recv_frame *frame); };
Signature · 1 line
2.30.2
PATCH 5/9 staging: r8188eu: remove an unused category define
In reply to Martin KaiserRTW_WLAN_CATEGORY_TDLS is not used. Remove the define.
--- drivers/staging/r8188eu/include/ieee80211.h | 1 - 1 file changed, 1 deletion(-)
drivers/staging/r8188eu/include/ieee80211.h +0 -1
@@ -598,7 +598,6 @@ static inline int is_broadcast_mac_addr(const u8 *addr)enum rtw_ieee80211_category {RTW_WLAN_CATEGORY_BACK =3 ,RTW_WLAN_CATEGORY_PUBLIC =4 ,/* IEEE 802.11 public action frames */ -RTW_WLAN_CATEGORY_TDLS =12 ,RTW_WLAN_CATEGORY_P2P =0x7f ,/* P2P action frames */ };
Signature · 1 line
2.30.2
PATCH 6/9 staging: r8188eu: replace OnAction_tbl with switch-case
In reply to Martin KaiserOnAction_tbl has only three entries. It's simpler to use a switch statement instead of iterating over the table.
We can then remove the table itself and struct action_handler, which was used only for the table entries.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 22 +++++++++---------- .../staging/r8188eu/include/rtw_mlme_ext.h | 5 ----- 2 files changed, 10 insertions(+), 17 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +10 -12
@@ -32,12 +32,6 @@ static mlme_handler mlme_sta_tbl[] = { OnAction, }; -static struct action_handler OnAction_tbl[] = { - {RTW_WLAN_CATEGORY_BACK , &OnAction_back}, - {RTW_WLAN_CATEGORY_PUBLIC , on_action_public}, - {RTW_WLAN_CATEGORY_P2P , &OnAction_p2p}, -}; -static u8 null_addr[ETH_ALEN ] = {0 ,0 ,0 ,0 ,0 ,0 };/**************************************************
@@ -3877,9 +3871,7 @@ unsigned int OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_fraunsigned int OnAction (struct adapter *padapter,struct recv_frame *precv_frame) { -int i;unsigned char category; -struct action_handler *ptable;unsigned char *frame_body;u8 *pframe = precv_frame->rx_data;
@@ -3887,10 +3879,16 @@ unsigned int OnAction(struct adapter *padapter, struct recv_frame *precv_frame) category = frame_body[0 ]; -for (i =0 ; i <ARRAY_SIZE (OnAction_tbl); i++) { - ptable = &OnAction_tbl[i]; -if (category == ptable->num) - ptable->func (padapter, precv_frame); +switch (category) { +case RTW_WLAN_CATEGORY_BACK : +OnAction_back (padapter, precv_frame); +break ; +case RTW_WLAN_CATEGORY_PUBLIC : +on_action_public (padapter, precv_frame); +break ; +case RTW_WLAN_CATEGORY_P2P : +OnAction_p2p (padapter, precv_frame); +break ; }return _SUCCESS; }
drivers/staging/r8188eu/include/rtw_mlme_ext.h +0 -5
@@ -186,11 +186,6 @@ enum SCAN_STATE {typedef unsigned int (*mlme_handler )(struct adapter *adapt,struct recv_frame *frame); -struct action_handler { -unsigned int num; -unsigned int (*func)(struct adapter *adapt,struct recv_frame *frame); -}; -struct ss_res {int state;int bss_cnt;
Signature · 1 line
2.30.2
PATCH 7/9 staging: r8188eu: use ieee80211_mgmt for action category
In reply to Martin KaiserUse the struct ieee80211_mgmt from ieee80211.h to read the action category. There's no need to parse the incoming frame ourselves.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +2 -8
@@ -3871,15 +3871,9 @@ unsigned int OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_fraunsigned int OnAction (struct adapter *padapter,struct recv_frame *precv_frame) { -unsigned char category; -unsigned char *frame_body; -u8 *pframe = precv_frame->rx_data; - - frame_body = (unsigned char *)(pframe +sizeof (struct ieee80211_hdr_3addr )); - - category = frame_body[0 ]; +struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; -switch (category) { +switch (mgmt->u.action.category) {case RTW_WLAN_CATEGORY_BACK :OnAction_back (padapter, precv_frame);break ;
Signature · 1 line
2.30.2
PATCH 8/9 staging: r8188eu: use standard category defines
In reply to Martin KaiserReplace some of the driver-specific defines for action categories with the defines from ieee80211.h.
--- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 24 ++++++++++----------- drivers/staging/r8188eu/core/rtw_p2p.c | 4 ++-- drivers/staging/r8188eu/include/ieee80211.h | 2 -- 3 files changed, 14 insertions(+), 16 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme_ext.c +12 -12
@@ -1494,7 +1494,7 @@ unsigned int OnAction_back(struct adapter *padapter, struct recv_frame *precv_fr frame_body = (unsigned char *)(pframe +sizeof (struct ieee80211_hdr_3addr )); category = frame_body[0 ]; -if (category ==RTW_WLAN_CATEGORY_BACK ) {/* representing Block Ack */ +if (category ==WLAN_CATEGORY_BACK ) {/* representing Block Ack */ if (!pmlmeinfo->HT_enable)return _SUCCESS; action = frame_body[1 ];
@@ -1551,7 +1551,7 @@ static int get_reg_classes_full_count(struct p2p_channels *channel_list)void issue_p2p_GO_request (struct adapter *padapter,u8 *raddr) { -unsigned char category =RTW_WLAN_CATEGORY_PUBLIC ; +unsigned char category =WLAN_CATEGORY_PUBLIC ;u8 action =P2P_PUB_ACTION_ACTION ;__be32 p2poui =cpu_to_be32 (P2POUI );u8 oui_subtype =P2P_GO_NEGO_REQ ;
@@ -1881,7 +1881,7 @@ void issue_p2p_GO_request(struct adapter *padapter, u8 *raddr)static void issue_p2p_GO_response (struct adapter *padapter,u8 *raddr,u8 *frame_body,uint len,u8 result) { -unsigned char category =RTW_WLAN_CATEGORY_PUBLIC ; +unsigned char category =WLAN_CATEGORY_PUBLIC ;u8 action =P2P_PUB_ACTION_ACTION ;__be32 p2poui =cpu_to_be32 (P2POUI );u8 oui_subtype =P2P_GO_NEGO_RESP ;
@@ -2243,7 +2243,7 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8 *raddr, u8 *framestatic void issue_p2p_GO_confirm (struct adapter *padapter,u8 *raddr,u8 result) { -unsigned char category =RTW_WLAN_CATEGORY_PUBLIC ; +unsigned char category =WLAN_CATEGORY_PUBLIC ;u8 action =P2P_PUB_ACTION_ACTION ;__be32 p2poui =cpu_to_be32 (P2POUI );u8 oui_subtype =P2P_GO_NEGO_CONF ;
@@ -2404,7 +2404,7 @@ static void issue_p2p_GO_confirm(struct adapter *padapter, u8 *raddr, u8 result)void issue_p2p_invitation_request (struct adapter *padapter,u8 *raddr) { -unsigned char category =RTW_WLAN_CATEGORY_PUBLIC ; +unsigned char category =WLAN_CATEGORY_PUBLIC ;u8 action =P2P_PUB_ACTION_ACTION ;__be32 p2poui =cpu_to_be32 (P2POUI );u8 oui_subtype =P2P_INVIT_REQ ;
@@ -2651,7 +2651,7 @@ void issue_p2p_invitation_request(struct adapter *padapter, u8 *raddr)void issue_p2p_invitation_response (struct adapter *padapter,u8 *raddr,u8 dialogToken,u8 status_code) { -unsigned char category =RTW_WLAN_CATEGORY_PUBLIC ; +unsigned char category =WLAN_CATEGORY_PUBLIC ;u8 action =P2P_PUB_ACTION_ACTION ;__be32 p2poui =cpu_to_be32 (P2POUI );u8 oui_subtype =P2P_INVIT_RESP ;
@@ -2841,7 +2841,7 @@ void issue_p2p_invitation_response(struct adapter *padapter, u8 *raddr, u8 dialovoid issue_p2p_provision_request (struct adapter *padapter,u8 *pssid,u8 ussidlen,u8 *pdev_raddr) { -unsigned char category =RTW_WLAN_CATEGORY_PUBLIC ; +unsigned char category =WLAN_CATEGORY_PUBLIC ;u8 action =P2P_PUB_ACTION_ACTION ;u8 dialogToken =1 ;u8 oui_subtype =P2P_PROVISION_DISC_REQ ;
@@ -3812,7 +3812,7 @@ unsigned int on_action_public(struct adapter *padapter, struct recv_frame *precv goto exit; category = frame_body[0 ]; -if (category !=RTW_WLAN_CATEGORY_PUBLIC ) +if (category !=WLAN_CATEGORY_PUBLIC ) goto exit; action = frame_body[1 ];
@@ -3874,10 +3874,10 @@ unsigned int OnAction(struct adapter *padapter, struct recv_frame *precv_frame)struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data;switch (mgmt->u.action.category) { -case RTW_WLAN_CATEGORY_BACK : +case WLAN_CATEGORY_BACK :OnAction_back (padapter, precv_frame);break ; -case RTW_WLAN_CATEGORY_PUBLIC : +case WLAN_CATEGORY_PUBLIC :on_action_public (padapter, precv_frame);break ;case RTW_WLAN_CATEGORY_P2P :
@@ -5370,7 +5370,7 @@ int issue_deauth_ex(struct adapter *padapter, u8 *da, unsigned short reason, intvoid issue_action_BA (struct adapter *padapter,unsigned char *raddr,unsigned char action,unsigned short status) { -u8 category =RTW_WLAN_CATEGORY_BACK ; +u8 category =WLAN_CATEGORY_BACK ;u16 start_seq;u16 BA_para_set;u16 reason_code;
@@ -5504,7 +5504,7 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter)if (pmlmeinfo->bwmode_updated)return ; - category =RTW_WLAN_CATEGORY_PUBLIC ; + category =WLAN_CATEGORY_PUBLIC ; action =ACT_PUBLIC_BSSCOEXIST ; pmgntframe =alloc_mgtxmitframe (pxmitpriv);
drivers/staging/r8188eu/core/rtw_p2p.c +2 -2
@@ -171,7 +171,7 @@ static void issue_p2p_devdisc_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 sstruct adapter *padapter = pwdinfo->padapter;struct xmit_priv *pxmitpriv = &padapter->xmitpriv;struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; -unsigned char category =RTW_WLAN_CATEGORY_PUBLIC ; +unsigned char category =WLAN_CATEGORY_PUBLIC ;u8 action =P2P_PUB_ACTION_ACTION ;__be32 p2poui =cpu_to_be32 (P2POUI );u8 oui_subtype =P2P_DEVDISC_RESP ;
@@ -233,7 +233,7 @@ static void issue_p2p_devdisc_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 sstatic void issue_p2p_provision_resp (struct wifidirect_info *pwdinfo,u8 *raddr,u8 *frame_body,u16 config_method) {struct adapter *padapter = pwdinfo->padapter; -unsigned char category =RTW_WLAN_CATEGORY_PUBLIC ; +unsigned char category =WLAN_CATEGORY_PUBLIC ;u8 action =P2P_PUB_ACTION_ACTION ;u8 dialogToken = frame_body[7 ];/* The Dialog Token of provisioning discovery request frame. */ __be32 p2poui =cpu_to_be32 (P2POUI );
drivers/staging/r8188eu/include/ieee80211.h +0 -2
@@ -596,8 +596,6 @@ static inline int is_broadcast_mac_addr(const u8 *addr)/* Action category code */ enum rtw_ieee80211_category { -RTW_WLAN_CATEGORY_BACK =3 , -RTW_WLAN_CATEGORY_PUBLIC =4 ,/* IEEE 802.11 public action frames */ RTW_WLAN_CATEGORY_P2P =0x7f ,/* P2P action frames */ };
Signature · 1 line
2.30.2
PATCH 9/9 staging: r8188eu: remove unused IEEE_* defines
In reply to Martin KaiserThe IEEE_* defines in the driver's ieee80211.h header file are not used. Remove them.
--- drivers/staging/r8188eu/include/ieee80211.h | 5 ----- 1 file changed, 5 deletions(-)
drivers/staging/r8188eu/include/ieee80211.h +0 -5
@@ -589,11 +589,6 @@ static inline int is_broadcast_mac_addr(const u8 *addr)#define MAXTID 16 -#define IEEE_A (1<<0) -#define IEEE_B (1<<1) -#define IEEE_G (1<<2) -#define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) -/* Action category code */ enum rtw_ieee80211_category {RTW_WLAN_CATEGORY_P2P =0x7f ,/* P2P action frames */
Signature · 1 line
2.30.2