From patchwork Fri Dec 2 09:31:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 28829 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp738794wrr; Fri, 2 Dec 2022 01:45:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf4hot1RRcvFAd2J+33YqHcUpClWLnPTA4gmglv5FqKtT79fk8oR9f7NhR3KoqKvBOEOuNcd X-Received: by 2002:a05:6402:2912:b0:46a:c132:8a25 with SMTP id ee18-20020a056402291200b0046ac1328a25mr31002178edb.205.1669974351988; Fri, 02 Dec 2022 01:45:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669974351; cv=none; d=google.com; s=arc-20160816; b=M4xRKDHefPommdAatHAlvwmquQ2knYVIRjcsHaHP9RM9tL4w+7xchn5l2SCQ5fb3Xd T4a7yACNukS4UE24ATja6A7fo8a+kZTHGhTK6dqs20GfERIAsQCfEoiDZ8yurlmHn/av TLqUnZf7OOKkanaPi+0r0o2ROB4e8HOZYfwcb5pVUEPLEtJ5Rb1VcO6FFytyKjo1G3fP /Q5r449eqeFxk6McrE1gZS4Tk6yHsJARvw+vjBGtN1w9M8ecSc0awYGx1czS70BAFcwq lxGEyO43vFZtIgxyauRe4cNl/WFOvgCETDWm6P/zvV+GTmYmfA5OeJviTLZ3TbyLvdrA 1EDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=th+yQwNDmUC4eTr0QSQ3EUiovXZojiPvgC6D7y6UTdM=; b=kzIo4m0RfSyuWFqH1eRiv82Sstb46F+6ZYmvOcFqJ/6pUNPxncnzXErfL0Uu4CNByf V2m6IueGbnBNvG/t244zQ51CgA3B8S64AetMvvP0FSuugEl7OqNMQfvdBt7yIYREsc0j 05bhRJp+hQrrMMWnHOT88thky8fxe4jVZ2FkEqHNNlNintAQv5HIPMaO/uLdtaqtNsqX wKPFaAJQjptcHVASpoFq6prFVoL4qBhVrhwLr4jLCpt2/eFw9BmeFOW9SXRqyiDdzYNK rZcgxDdC0CK45Hgp8ZO09WCtBM4nMXMDjCl0DMdpxHCi1OhxZGwLBcY2trjip0fKaWFK ks2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t13-20020a170906178d00b0078d0f57b0e2si4507973eje.412.2022.12.02.01.45.28; Fri, 02 Dec 2022 01:45:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232508AbiLBJc0 (ORCPT + 99 others); Fri, 2 Dec 2022 04:32:26 -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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751095026037393876?= X-GMAIL-MSGID: =?utf-8?q?1751095026037393876?= 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 --- 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_frame, struct wlan_bssid_ex *bssid) { + struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; int i; u32 len; u8 *p; - u16 val16, subtype; + u16 val16; u8 *pframe = precv_frame->rx_data; u32 packet_len = precv_frame->len; u8 ie_offset; @@ -5982,23 +5983,18 @@ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, st memset(bssid, 0, sizeof(struct wlan_bssid_ex)); - subtype = GetFrameSubType(pframe); - - if (subtype == WIFI_BEACON) { + if (ieee80211_is_beacon(mgmt->frame_control)) { bssid->Reserved[0] = 1; ie_offset = _BEACON_IE_OFFSET_; + } else if (ieee80211_is_probe_req(mgmt->frame_control)) { + ie_offset = _PROBEREQ_IE_OFFSET_; + bssid->Reserved[0] = 2; + } else if (ieee80211_is_probe_resp(mgmt->frame_control)) { + ie_offset = _PROBERSP_IE_OFFSET_; + bssid->Reserved[0] = 3; } else { - /* FIXME : more type */ - if (subtype == WIFI_PROBEREQ) { - ie_offset = _PROBEREQ_IE_OFFSET_; - bssid->Reserved[0] = 2; - } else if (subtype == WIFI_PROBERSP) { - ie_offset = _PROBERSP_IE_OFFSET_; - bssid->Reserved[0] = 3; - } else { - bssid->Reserved[0] = 0; - ie_offset = _FIXED_IE_LENGTH_; - } + bssid->Reserved[0] = 0; + ie_offset = _FIXED_IE_LENGTH_; } bssid->Length = sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + len; From patchwork Fri Dec 2 09:31:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 28830 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp738869wrr; Fri, 2 Dec 2022 01:46:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf5sv3/tw1sjT0kx1vDpcJNzV1DRQqnAf73rhYip53zkES8W7SFib8un/Tab6Wbtupz7+rM0 X-Received: by 2002:aa7:cf03:0:b0:46b:35dc:cf4d with SMTP id a3-20020aa7cf03000000b0046b35dccf4dmr20330126edy.423.1669974366329; Fri, 02 Dec 2022 01:46:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669974366; cv=none; d=google.com; s=arc-20160816; b=laQ3Uq45ftC6llae+2fvpnPKHzRGFMJUzm3HsftOWTafr/s/vlQpCnFRxqSA4McoMu yVdGvv20DBlnvp46y/+piCUFb1YMIJRQZxLr7DBe/EOJCifAycW73JWN/H45gMilP3ZO WTyYWybSCxZ1zy0toSND42oMeN4za3VIiRnpGSYFidOQplkSMDosgV4MP+QysSD09iqA BRQaXcHbBellpE5kH1Y50zEOEgG3CmWRrb2kvs+Xf5ecy5i+KlK5Z+lmpJhl2aiUoMCc 5ncxGqGUBBBGFB+ovH+kMXRprxyGMEc5uZi9nMvWPz8/jBFN6xjxTKb3p8oTPV3mS+ky ZItg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=cq4J0F4KXv/cd0s5xpjf8slws79emXa1cLEna5YUAvw=; b=l3Uwwvh3JTiWdRzrVRKCjoKTOtZVfc0Q7lwjh8ukSGBGMAGG3xgtMtEVehF+3/LMFM 00Q/dhAZKbMJ/FzLNF0jU84BRdu8BWyh70Xbyu/tJS/RxJaaF0BrUVjyb38muC1YKsJ/ 0WyzfqrxgLH5OeqPnc7UNIY2h09c1GRbdMVJMbdx1Ksw06bVq2CeJf8vodBnJtQJQX8b dGUzund4QCfjoRskJd9GKMrgbE+KJz6bOimahP52Tfchj36Nx7G094rnjD027Vf8hzIe cZXXLT/ApmzokqAqq7r+aa0qdYCIfqwGeqPs2udXCOERAlvgKZigaJb788YvFUrQRYfV PyJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt7-20020a1709072d8700b007309e8d567fsi7037687ejc.145.2022.12.02.01.45.42; Fri, 02 Dec 2022 01:46:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231661AbiLBJc3 (ORCPT + 99 others); Fri, 2 Dec 2022 04:32:29 -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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751095041232157895?= X-GMAIL-MSGID: =?utf-8?q?1751095041232157895?= 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 --- 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_info *psta) int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) { + struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)pframe; unsigned int len; unsigned char *p; - unsigned short val16, subtype; + unsigned short val16; struct wlan_network *cur_network = &Adapter->mlmepriv.cur_network; /* u8 wpa_ie[255], rsn_ie[255]; */ u16 wpa_len = 0, rsn_len = 0; @@ -908,9 +909,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) if (!bssid) return _FAIL; - subtype = GetFrameSubType(pframe) >> 4; - - if (subtype == WIFI_BEACON) + if (ieee80211_is_beacon(mgmt->frame_control)) bssid->Reserved[0] = 1; bssid->Length = sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + len;