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;