From nobody Sat Apr 11 19:53:11 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAE0BC19F2D for ; Sat, 6 Aug 2022 11:14:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241803AbiHFLOZ (ORCPT ); Sat, 6 Aug 2022 07:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229921AbiHFLOP (ORCPT ); Sat, 6 Aug 2022 07:14:15 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 464B211806 for ; Sat, 6 Aug 2022 04:14:14 -0700 (PDT) Received: from dslb-188-097-043-167.188.097.pools.vodafone-ip.de ([188.97.43.167] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1oKHkt-0001FX-Bb; Sat, 06 Aug 2022 13:14:07 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH v2 1/5] staging: r8188eu: replace a get_da call Date: Sat, 6 Aug 2022 13:13:48 +0200 Message-Id: <20220806111352.690650-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220806111352.690650-1-martin@kaiser.cx> References: <20220724153917.138848-1-martin@kaiser.cx> <20220806111352.690650-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The r8188eu driver implements an internal get_da function to read the destination address (da) from an incoming message. Callers of this function should be updated to use the ieee80211 framework, with the goal of removing get_da eventually. This patch replaces a get_da call in the OnAssocRsp function. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- v2: - rewrite the summary and the commit message drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index 32d0e101d0c2..f5f718488929 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1320,6 +1320,7 @@ unsigned int OnAssocReq(struct adapter *padapter, str= uct recv_frame *precv_frame =20 unsigned int OnAssocRsp(struct adapter *padapter, struct recv_frame *precv= _frame) { + struct ieee80211_mgmt *mgmt =3D (struct ieee80211_mgmt *)precv_frame->rx_= data; uint i; int res; unsigned short status; @@ -1331,7 +1332,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, str= uct recv_frame *precv_frame uint pkt_len =3D precv_frame->len; =20 /* check A1 matches or not */ - if (memcmp(myid(&padapter->eeprompriv), get_da(pframe), ETH_ALEN)) + if (memcmp(myid(&padapter->eeprompriv), mgmt->da, ETH_ALEN)) return _SUCCESS; =20 if (!(pmlmeinfo->state & (WIFI_FW_AUTH_SUCCESS | WIFI_FW_ASSOC_STATE))) --=20 2.30.2 From nobody Sat Apr 11 19:53:11 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07199C19F2D for ; Sat, 6 Aug 2022 11:14:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238417AbiHFLOR (ORCPT ); Sat, 6 Aug 2022 07:14:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229695AbiHFLOP (ORCPT ); Sat, 6 Aug 2022 07:14:15 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AF4D11815 for ; Sat, 6 Aug 2022 04:14:14 -0700 (PDT) Received: from dslb-188-097-043-167.188.097.pools.vodafone-ip.de ([188.97.43.167] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1oKHku-0001FX-7C; Sat, 06 Aug 2022 13:14:08 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH v2 2/5] staging: r8188eu: read status_code from struct ieee80211_mgmt Date: Sat, 6 Aug 2022 13:13:49 +0200 Message-Id: <20220806111352.690650-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220806111352.690650-1-martin@kaiser.cx> References: <20220724153917.138848-1-martin@kaiser.cx> <20220806111352.690650-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Read the status code of the association response message from struct ieee80211_mgmt. This should be easier to understand and to review than calculating the offset manually. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- v2: - rewrite the commit message 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 f5f718488929..53444cb1dba9 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1323,7 +1323,6 @@ unsigned int OnAssocRsp(struct adapter *padapter, str= uct recv_frame *precv_frame struct ieee80211_mgmt *mgmt =3D (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 =3D &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo =3D &pmlmeext->mlmext_info; @@ -1343,9 +1342,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, str= uct recv_frame *precv_frame =20 _cancel_timer_ex(&pmlmeext->link_timer); =20 - /* status */ - status =3D 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 =3D WIFI_FW_NULL_STATE; res =3D -4; goto report_assoc_result; --=20 2.30.2 From nobody Sat Apr 11 19:53:11 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00C5AC19F2D for ; Sat, 6 Aug 2022 11:14:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241797AbiHFLOa (ORCPT ); Sat, 6 Aug 2022 07:14:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232296AbiHFLOP (ORCPT ); Sat, 6 Aug 2022 07:14:15 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AE9711810 for ; Sat, 6 Aug 2022 04:14:14 -0700 (PDT) Received: from dslb-188-097-043-167.188.097.pools.vodafone-ip.de ([188.97.43.167] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1oKHkv-0001FX-1w; Sat, 06 Aug 2022 13:14:09 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH v2 3/5] staging: r8188eu: read capability info from struct ieee80211_mgmt Date: Sat, 6 Aug 2022 13:13:50 +0200 Message-Id: <20220806111352.690650-4-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220806111352.690650-1-martin@kaiser.cx> References: <20220724153917.138848-1-martin@kaiser.cx> <20220806111352.690650-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Read the capability info of the association response message from struct ieee80211_mgmt. This should be easier to understand and to review than calculating the offset manually. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- v2: - rewrite the commit message drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index 53444cb1dba9..0a78b8bbb66a 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1348,8 +1348,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, str= uct recv_frame *precv_frame goto report_assoc_result; } =20 - /* get capabilities */ - pmlmeinfo->capability =3D le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LE= N)); + pmlmeinfo->capability =3D le16_to_cpu(mgmt->u.assoc_resp.capab_info); =20 /* set slot time */ pmlmeinfo->slotTime =3D (pmlmeinfo->capability & BIT(10)) ? 9 : 20; --=20 2.30.2 From nobody Sat Apr 11 19:53:11 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40169C25B07 for ; Sat, 6 Aug 2022 11:14:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241762AbiHFLO1 (ORCPT ); Sat, 6 Aug 2022 07:14:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230161AbiHFLOP (ORCPT ); Sat, 6 Aug 2022 07:14:15 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 161B811818 for ; Sat, 6 Aug 2022 04:14:15 -0700 (PDT) Received: from dslb-188-097-043-167.188.097.pools.vodafone-ip.de ([188.97.43.167] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1oKHkv-0001FX-T5; Sat, 06 Aug 2022 13:14:09 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH v2 4/5] staging: r8188eu: read aid from struct ieee80211_mgmt Date: Sat, 6 Aug 2022 13:13:51 +0200 Message-Id: <20220806111352.690650-5-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220806111352.690650-1-martin@kaiser.cx> References: <20220724153917.138848-1-martin@kaiser.cx> <20220806111352.690650-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Read the aid of the association response message from struct ieee80211_mgmt. This should be easier to understand and to review than calculating the offset manually. Remove the cast to int, aid is a u16. Keep the 0x3fff mask that is currently applied to the aid. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- v2: - rewrite the commit message drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index 0a78b8bbb66a..10074355b82d 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1353,8 +1353,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, str= uct recv_frame *precv_frame /* set slot time */ pmlmeinfo->slotTime =3D (pmlmeinfo->capability & BIT(10)) ? 9 : 20; =20 - /* AID */ - pmlmeinfo->aid =3D (int)(le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN= + 4)) & 0x3fff); + pmlmeinfo->aid =3D le16_to_cpu(mgmt->u.assoc_resp.aid) & 0x3fff; res =3D pmlmeinfo->aid; =20 /* following are moved to join event callback function */ --=20 2.30.2 From nobody Sat Apr 11 19:53:11 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CD6EC25B0C for ; Sat, 6 Aug 2022 11:14:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241850AbiHFLOd (ORCPT ); Sat, 6 Aug 2022 07:14:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234864AbiHFLOQ (ORCPT ); Sat, 6 Aug 2022 07:14:16 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0959011806 for ; Sat, 6 Aug 2022 04:14:15 -0700 (PDT) Received: from dslb-188-097-043-167.188.097.pools.vodafone-ip.de ([188.97.43.167] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1oKHkw-0001FX-PE; Sat, 06 Aug 2022 13:14:10 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH v2 5/5] staging: r8188eu: simplify the calculation of ie start offset Date: Sat, 6 Aug 2022 13:13:52 +0200 Message-Id: <20220806111352.690650-6-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220806111352.690650-1-martin@kaiser.cx> References: <20220724153917.138848-1-martin@kaiser.cx> <20220806111352.690650-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use offsetof to calculate the start offset of the information elements in an association response message. This should make it easier to understand how the offset is calculated. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- v2: - rewrite the commit message 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 10074355b82d..6d3d5ff9a00e 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1359,7 +1359,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, str= uct 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 =3D (6 + WLAN_HDR_A3_LEN); i < pkt_len;) { + for (i =3D offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); i < pk= t_len;) { pIE =3D (struct ndis_802_11_var_ie *)(pframe + i); =20 switch (pIE->ElementID) { --=20 2.30.2