2022-07-24 15:56:36

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 0/5] staging: r8188eu: use struct ieee80211_mgmt in OnAssocRsp

Use a struct ieee80211_mgmt in OnAssocRsp to read elements of the
association response message.

Martin Kaiser (5):
staging: r8188eu: get da from ieee80211_mgmt
staging: r8188eu: read status_code from struct ieee80211_mgmt
staging: r8188eu: read capability info from struct ieee80211_mgmt
staging: r8188eu: read aid from struct ieee80211_mgmt
staging: r8188eu: use offsetof for ie start offset

drivers/staging/r8188eu/core/rtw_mlme_ext.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

--
2.30.2


2022-07-24 15:59:52

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 2/5] staging: r8188eu: read status_code from struct ieee80211_mgmt

Read the status code of the association response message from struct
ieee80211_mgmt instead of parsing the message ourselves.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_mlme_ext.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index 48ed329cec72..663048bc8e7d 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -1271,7 +1271,6 @@ unsigned int OnAssocRsp(struct adapter *padapter, struct recv_frame *precv_frame
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data;
uint i;
int res;
- unsigned short status;
struct ndis_802_11_var_ie *pIE;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
@@ -1291,9 +1290,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, struct recv_frame *precv_frame

_cancel_timer_ex(&pmlmeext->link_timer);

- /* status */
- status = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN + 2));
- if (status > 0) {
+ if (le16_to_cpu(mgmt->u.assoc_resp.status_code) > 0) {
pmlmeinfo->state = WIFI_FW_NULL_STATE;
res = -4;
goto report_assoc_result;
--
2.30.2

2022-07-24 16:03:10

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 5/5] staging: r8188eu: use offsetof for ie start offset

Use offsetof to calculate the start offset of the information elements in
an association response message.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/core/rtw_mlme_ext.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index 25e47efa5b9c..37c90d9e66bf 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -1307,7 +1307,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, struct recv_frame *precv_frame
/* following are moved to join event callback function */
/* to handle HT, WMM, rate adaptive, update MAC reg */
/* for not to handle the synchronous IO in the tasklet */
- for (i = (6 + WLAN_HDR_A3_LEN); i < pkt_len;) {
+ for (i = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); i < pkt_len;) {
pIE = (struct ndis_802_11_var_ie *)(pframe + i);

switch (pIE->ElementID) {
--
2.30.2

2022-07-24 18:38:59

by Philipp Hortmann

[permalink] [raw]
Subject: Re: [PATCH 0/5] staging: r8188eu: use struct ieee80211_mgmt in OnAssocRsp

On 7/24/22 17:39, Martin Kaiser wrote:
> Use a struct ieee80211_mgmt in OnAssocRsp to read elements of the
> association response message.
>
> Martin Kaiser (5):
> staging: r8188eu: get da from ieee80211_mgmt
> staging: r8188eu: read status_code from struct ieee80211_mgmt
> staging: r8188eu: read capability info from struct ieee80211_mgmt
> staging: r8188eu: read aid from struct ieee80211_mgmt
> staging: r8188eu: use offsetof for ie start offset
>
> drivers/staging/r8188eu/core/rtw_mlme_ext.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
>

Tested-by: Philipp Hortmann <[email protected]> # Edimax N150

2022-08-06 11:56:40

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH v2 0/5] staging: r8188eu: use struct ieee80211_mgmt in OnAssocRsp

Use a struct ieee80211_mgmt in OnAssocRsp to read elements of the
association response message. This should be easier than parsing the
message manually.

v2:
- rewrite the commit messages to say to more clearly why (in my opinion)
the patches change the code for the better

Martin Kaiser (5):
staging: r8188eu: replace a get_da call
staging: r8188eu: read status_code from struct ieee80211_mgmt
staging: r8188eu: read capability info from struct ieee80211_mgmt
staging: r8188eu: read aid from struct ieee80211_mgmt
staging: r8188eu: simplify the calculation of ie start offset

drivers/staging/r8188eu/core/rtw_mlme_ext.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

--
2.30.2

2022-08-06 21:06:14

by Philipp Hortmann

[permalink] [raw]
Subject: Re: [PATCH v2 0/5] staging: r8188eu: use struct ieee80211_mgmt in OnAssocRsp

On 8/6/22 13:13, Martin Kaiser wrote:
> Use a struct ieee80211_mgmt in OnAssocRsp to read elements of the
> association response message. This should be easier than parsing the
> message manually.
>
> v2:
> - rewrite the commit messages to say to more clearly why (in my opinion)
> the patches change the code for the better
>
> Martin Kaiser (5):
> staging: r8188eu: replace a get_da call
> staging: r8188eu: read status_code from struct ieee80211_mgmt
> staging: r8188eu: read capability info from struct ieee80211_mgmt
> staging: r8188eu: read aid from struct ieee80211_mgmt
> staging: r8188eu: simplify the calculation of ie start offset
>
> drivers/staging/r8188eu/core/rtw_mlme_ext.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
>
Tested-by: Philipp Hortmann <[email protected]> # Edimax N150