From nobody Fri Apr 17 09:24:15 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 AD840C4332F for ; Fri, 2 Dec 2022 09:32:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232820AbiLBJc2 (ORCPT ); Fri, 2 Dec 2022 04:32:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232573AbiLBJcT (ORCPT ); Fri, 2 Dec 2022 04:32:19 -0500 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 47097BDCF2 for ; Fri, 2 Dec 2022 01:32:19 -0800 (PST) Received: from ipservice-092-217-087-074.092.217.pools.vodafone-ip.de ([92.217.87.74] 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 1p12Oy-0001zC-5v; Fri, 02 Dec 2022 10:32:12 +0100 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 1/2] staging: r8188eu: use subtype helpers in collect_bss_info Date: Fri, 2 Dec 2022 10:31:58 +0100 Message-Id: <20221202093159.404111-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221202093159.404111-1-martin@kaiser.cx> References: <20221202093159.404111-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 the iee80211 helper functions to check the frame subtype in collect_bss_info. Replace the call to the driver-specific GetFrameSubType function. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 26 +++++++++------------ 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/= r8188eu/core/rtw_mlme_ext.c index 95a9470f4c99..1b9cf7596a76 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -5963,10 +5963,11 @@ void site_survey(struct adapter *padapter) /* collect bss info from Beacon and Probe request/response frames. */ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_fra= me, struct wlan_bssid_ex *bssid) { + struct ieee80211_mgmt *mgmt =3D (struct ieee80211_mgmt *)precv_frame->rx_= data; int i; u32 len; u8 *p; - u16 val16, subtype; + u16 val16; u8 *pframe =3D precv_frame->rx_data; u32 packet_len =3D precv_frame->len; u8 ie_offset; @@ -5982,23 +5983,18 @@ u8 collect_bss_info(struct adapter *padapter, struc= t recv_frame *precv_frame, st =20 memset(bssid, 0, sizeof(struct wlan_bssid_ex)); =20 - subtype =3D GetFrameSubType(pframe); - - if (subtype =3D=3D WIFI_BEACON) { + if (ieee80211_is_beacon(mgmt->frame_control)) { bssid->Reserved[0] =3D 1; ie_offset =3D _BEACON_IE_OFFSET_; + } else if (ieee80211_is_probe_req(mgmt->frame_control)) { + ie_offset =3D _PROBEREQ_IE_OFFSET_; + bssid->Reserved[0] =3D 2; + } else if (ieee80211_is_probe_resp(mgmt->frame_control)) { + ie_offset =3D _PROBERSP_IE_OFFSET_; + bssid->Reserved[0] =3D 3; } else { - /* FIXME : more type */ - if (subtype =3D=3D WIFI_PROBEREQ) { - ie_offset =3D _PROBEREQ_IE_OFFSET_; - bssid->Reserved[0] =3D 2; - } else if (subtype =3D=3D WIFI_PROBERSP) { - ie_offset =3D _PROBERSP_IE_OFFSET_; - bssid->Reserved[0] =3D 3; - } else { - bssid->Reserved[0] =3D 0; - ie_offset =3D _FIXED_IE_LENGTH_; - } + bssid->Reserved[0] =3D 0; + ie_offset =3D _FIXED_IE_LENGTH_; } =20 bssid->Length =3D sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + len; --=20 2.30.2 From nobody Fri Apr 17 09:24:15 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 D32CBC4332F for ; Fri, 2 Dec 2022 09:32:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232725AbiLBJca (ORCPT ); Fri, 2 Dec 2022 04:32:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232708AbiLBJcV (ORCPT ); Fri, 2 Dec 2022 04:32:21 -0500 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 B859EBE111 for ; Fri, 2 Dec 2022 01:32:20 -0800 (PST) Received: from ipservice-092-217-087-074.092.217.pools.vodafone-ip.de ([92.217.87.74] 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 1p12P0-0001zC-3F; Fri, 02 Dec 2022 10:32:14 +0100 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 2/2] staging: r8188eu: use subtype helper in rtw_check_bcn_info Date: Fri, 2 Dec 2022 10:31:59 +0100 Message-Id: <20221202093159.404111-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221202093159.404111-1-martin@kaiser.cx> References: <20221202093159.404111-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 ieee80211_is_beacon to check the frame subtype in rtw_check_bcn_info. Replace the call to the driver-specific GetFrameSubType function. Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- drivers/staging/r8188eu/core/rtw_wlan_util.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging= /r8188eu/core/rtw_wlan_util.c index da3465d6bb0f..f1ebb5358cb9 100644 --- a/drivers/staging/r8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c @@ -874,9 +874,10 @@ void VCS_update(struct adapter *padapter, struct sta_i= nfo *psta) =20 int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_le= n) { + struct ieee80211_mgmt *mgmt =3D (struct ieee80211_mgmt *)pframe; unsigned int len; unsigned char *p; - unsigned short val16, subtype; + unsigned short val16; struct wlan_network *cur_network =3D &Adapter->mlmepriv.cur_network; /* u8 wpa_ie[255], rsn_ie[255]; */ u16 wpa_len =3D 0, rsn_len =3D 0; @@ -908,9 +909,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pf= rame, u32 packet_len) if (!bssid) return _FAIL; =20 - subtype =3D GetFrameSubType(pframe) >> 4; - - if (subtype =3D=3D WIFI_BEACON) + if (ieee80211_is_beacon(mgmt->frame_control)) bssid->Reserved[0] =3D 1; =20 bssid->Length =3D sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + len; --=20 2.30.2