From patchwork Tue Nov 29 20:51:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 27507 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp568064wrr; Tue, 29 Nov 2022 13:07:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf7S4fbbjRXjR5Bace7fQYOwbJMMywd4ifb5ZW7mF4Y1i9Qi+IXNA040Ou5aY1rzww/UPEkB X-Received: by 2002:a05:6a00:440b:b0:56b:b53f:e887 with SMTP id br11-20020a056a00440b00b0056bb53fe887mr39390589pfb.3.1669756077770; Tue, 29 Nov 2022 13:07:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669756077; cv=none; d=google.com; s=arc-20160816; b=TdYFxI1uWeEi8YrlEA2pbyN4E6G6zDX3nvO8xIktKunh4FLDL6cT9q6x77oDqsxvGR aJg1fkNfPWMBVuQ8anNzhb6Zwv0ujvo50nB37D5S5oigXyWr7u6KapHauhm16GSpPztv JzfyOwpzdBC1LLkj1NqyZXI8eVjDDNH04Wrsz8GJnXDPCQMj4D4QPvdLNDuygB4C1lfJ UHxoq4IIlo6Opwa0sqwpgc+9IIifprJxj2WjS2Jfbe1fOhtKxMeQKNxcpmwcgJaVHywM X60CMPAgFDusylnpnBs0nfOWf6kagiSwQlqiEtcGse56aqrOBJ7DpRr5LQegTupfTaGP 1gJg== 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=OtLeSre2S74mgd3s3gUT97rB1yFOLl7gQYAYwnSWSpw=; b=gz/Fh/d/WNwmucw0vspwCEzMD3H89UMigWhIYB4PVJAIhvFRlAn9hqycm4gRvQrWap FCK+usJAd+uJiMsa/zq5b0bP3qGHxGYLnWEECzoSoLKt21sY3UfQP2x04kptr1FmhGV6 RPhYPFVE305WbE8r2qpSNO8R4J3+aCeFdr/95cQ9Jwdowb3iaIm/KlNsUuCmaE+LNY3C lIbLPlBqFB9L0rXqjgEM+fwoZwFKNkS4hccD9fhhfezvG6q/F9AVSfYH3wSjBhoQzz7N 9NBpvETBRxD9kWjWP0tt0oztX6czuZ2gNITLlz7nkYOtR7T8ww3aS08QUy1YguOLWuMt Tlgg== 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 r10-20020a63514a000000b00476f2b0b330si16511086pgl.700.2022.11.29.13.07.42; Tue, 29 Nov 2022 13:07:57 -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 S236439AbiK2UwK (ORCPT + 99 others); Tue, 29 Nov 2022 15:52:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236315AbiK2UwH (ORCPT ); Tue, 29 Nov 2022 15:52:07 -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 E08565FE7 for ; Tue, 29 Nov 2022 12:52:05 -0800 (PST) Received: from dslb-188-104-061-001.188.104.pools.vodafone-ip.de ([188.104.61.1] 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 1p07aC-0001pO-Aq; Tue, 29 Nov 2022 21:52:00 +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/5] staging: r8188eu: use ieee80211_mgmt to parse addresses Date: Tue, 29 Nov 2022 21:51:48 +0100 Message-Id: <20221129205152.128172-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221129205152.128172-1-martin@kaiser.cx> References: <20221129205152.128172-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?1750866148979611337?= X-GMAIL-MSGID: =?utf-8?q?1750866148979611337?= Define a struct ieee80211_mgmt in the OnDisassoc function and use it to parse the addresses in the incoming disassoc message. This replaces some driver-specific functions for address parsing. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index d32b2d569e23..b2b2cb57ed04 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1427,6 +1427,7 @@ static void OnDeAuth(struct adapter *padapter, struct recv_frame *precv_frame) static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) { + struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; u16 reason; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -1434,8 +1435,7 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) u8 *pframe = precv_frame->rx_data; struct wifidirect_info *pwdinfo = &padapter->wdinfo; - /* check A3 */ - if (!(!memcmp(GetAddr3Ptr(pframe), get_my_bssid(&pmlmeinfo->network), ETH_ALEN))) + if (memcmp(mgmt->bssid, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) return; if (pwdinfo->rx_invitereq_info.scan_op_ch_only) { @@ -1449,7 +1449,7 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; - psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); + psta = rtw_get_stainfo(pstapriv, mgmt->sa); if (psta) { u8 updated = 0; @@ -1466,7 +1466,7 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) return; } else { - receive_disconnect(padapter, GetAddr3Ptr(pframe), reason); + receive_disconnect(padapter, mgmt->bssid, reason); } pmlmepriv->LinkDetectInfo.bBusyTraffic = false; } From patchwork Tue Nov 29 20:51:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 27504 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp567331wrr; Tue, 29 Nov 2022 13:06:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf5NpEN3bZqkUEm6HniBqftqGdVTn5GyfHAbUYq6wqw952i4nn1CPL8DzXhswjwHGCXbJvic X-Received: by 2002:a17:906:d211:b0:79d:f5f2:6f55 with SMTP id w17-20020a170906d21100b0079df5f26f55mr31321744ejz.531.1669755985264; Tue, 29 Nov 2022 13:06:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669755985; cv=none; d=google.com; s=arc-20160816; b=LYMOM64q86POKNns3cXdDCUnqX9ocY5S+u5DkN+SAgs8hfJorWJ7lZhR06PJi04WpJ idkkoVzWBFBNYRhG/18o5HrvN+UO/b5UOu2uP7ySAHHNqhhmzQDSdeGrJwB5pDYUbEIE owS5iWv1RZmFGRLGqCop1rELqpFRxbPdxujf83Le2z9YwXNGzn6Wtja3vdlPg7r+dQH/ FGE6aZHTwDzdQFX7yZgJhWGLsDNuLVmAoh7Kp2zh6OHpTPNdpgHa5z9C5gvfrDWULPnk at0IEoWGteaOyLWUonGNm7zeGEQb5POOPoTHnDcoQ/4MPUQ+Pq9+YsquvlqCe1eqNHOd a0Sw== 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=lNeTLQb2dpzxBJbemZXySm0yXayZjnijU2hhhaUXrxk=; b=oluf1/DO42+aQnR/9C7Cp/Q4YQpX4NsjFu07yC8zHyaurnai51VtzCT/Wg/aiYuHdC u9j/zBUrrrrnM9wNiukiXM3Kw1ZYzZVU3YbtVA4BaetlAzx3lmi8h7jid/5nUjpVg+c9 G4syUdMk48WLdHroNYjDvBIPMpEBmOarKe1TSS61HqM8MwY5Np6aAwZ8okC+DL+5Sg0v B0zNRKIM9i2cBoI1YX+/ZhzjLjPZbbYfteExFVNorRo5HdKVSFOCT4IemJJ9T2gwJueo 2xDOeF8+jAWShxGiEdQoK2hLNE8GPFdEifMnli2vlf6Sf9hKsmFsI7JGNcZ4Jv4tlLwq EKZA== 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 f10-20020a056402354a00b00469c73c9605si14232604edd.269.2022.11.29.13.05.58; Tue, 29 Nov 2022 13:06:25 -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 S236567AbiK2Uw0 (ORCPT + 99 others); Tue, 29 Nov 2022 15:52:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236607AbiK2UwV (ORCPT ); Tue, 29 Nov 2022 15:52: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 5925A1B788 for ; Tue, 29 Nov 2022 12:52:20 -0800 (PST) Received: from dslb-188-104-061-001.188.104.pools.vodafone-ip.de ([188.104.61.1] 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 1p07aQ-0001pO-3E; Tue, 29 Nov 2022 21:52: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/5] staging: r8188eu: read reason code from ieee80211_mgmt Date: Tue, 29 Nov 2022 21:51:49 +0100 Message-Id: <20221129205152.128172-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221129205152.128172-1-martin@kaiser.cx> References: <20221129205152.128172-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?1750866052014379929?= X-GMAIL-MSGID: =?utf-8?q?1750866052014379929?= Use the struct ieee80211_mgmt to read the reason code instead of parsing the message manually. Remove the pframe pointer, it's no longer used. Signed-off-by: Martin Kaiser --- 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 b2b2cb57ed04..fe58d4e3e260 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1432,7 +1432,6 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - u8 *pframe = precv_frame->rx_data; struct wifidirect_info *pwdinfo = &padapter->wdinfo; if (memcmp(mgmt->bssid, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) @@ -1443,7 +1442,7 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) _set_timer(&pwdinfo->reset_ch_sitesurvey, 10); } - reason = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN)); + reason = le16_to_cpu(mgmt->u.disassoc.reason_code); if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { struct sta_info *psta; From patchwork Tue Nov 29 20:51:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 27505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp567922wrr; Tue, 29 Nov 2022 13:07:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf7/T9i5OkRYmcmpMmYcIaKSEYYPCB0/vWvovuz+TAXCFnZ8zJiiHvzjn+AgXXy8IP413kH/ X-Received: by 2002:aa7:980c:0:b0:574:80b6:5706 with SMTP id e12-20020aa7980c000000b0057480b65706mr29042015pfl.30.1669756061184; Tue, 29 Nov 2022 13:07:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669756061; cv=none; d=google.com; s=arc-20160816; b=LZXMl5loT9QreypKU4It+WiMymFdcjUnST0gHy3DlsaZsXLlJ+CY+CHtc6tB0h0kk8 y6NuhfSUIWozHK2xz5/W94mDR5fr2T2UUayjV7bN4SXSxagDS1z1gMpKaeoCBJqniQZE miSnpWSpBY1kw5yk1uOOU5/yWYZt9oKj5m2c1/1cyg6q6GbgrLSkcMBfvSW6MeZp5jp8 ZcGKTZfhfffWwsTW7aqf+IFjpAYbK+vzquRBKA5mX+E34jETWvk9COw9+v8i8gVvVcJS ftIcJbGRU9bUgX7DTaeH9Wms5XQkyIjeZ82Jb4P1IzJvWIjAnO0Puc1qnHKANWi2ZsNz tXoQ== 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=nDqBmaYjepcaULXf01e5RBgZ7FUv3DjUHMptIxB4vsc=; b=C6gxghRcXDB6F3mlmA15Q18fry4JOKyDZKErNrewANgWWWDs2rwFmrhTsA7ymzgVml w0GcIhYqCXs0GgBKUkOLAsTwXMZUjQVxldEKkAapwfyDDjPWzVvtmMxzz9Bk00ckB6Lo rD7jK4xPVWzpy2lWXbRDKRQIXu15TAzywBvZ7+dmljBw5IhMYmQNt7a3C/CGKogFXIoZ heajUKWLdkNeFreFs8ZhERGsxdsPBSXhzi7k4NFs18+LwUgvYnxPT56gGVvESXfmGZA5 EGxumdIJV+W22ujo2WOxenmXp9o9jbDoP7IG/W6bkah77LKItRhDXUjS4UlvBdoMYMcC NsXw== 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 x23-20020a170902821700b00188fadf1f1asi14182835pln.101.2022.11.29.13.07.25; Tue, 29 Nov 2022 13:07:41 -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 S236568AbiK2Uw3 (ORCPT + 99 others); Tue, 29 Nov 2022 15:52:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236627AbiK2UwV (ORCPT ); Tue, 29 Nov 2022 15:52: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 86B0018E3A for ; Tue, 29 Nov 2022 12:52:20 -0800 (PST) Received: from dslb-188-104-061-001.188.104.pools.vodafone-ip.de ([188.104.61.1] 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 1p07aQ-0001pO-E5; Tue, 29 Nov 2022 21:52: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 3/5] staging: r8188eu: move bBusyTraffic update Date: Tue, 29 Nov 2022 21:51:50 +0100 Message-Id: <20221129205152.128172-4-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221129205152.128172-1-martin@kaiser.cx> References: <20221129205152.128172-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?1750866131246806502?= X-GMAIL-MSGID: =?utf-8?q?1750866131246806502?= Move the update of bBusyTraffic into the else branch. The if branch ends with a return statement, so bBusyTraffic will not be updated in this case. With this change in place, we can reorder the code and save some levels of indentation. Signed-off-by: Martin Kaiser --- 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 fe58d4e3e260..dd1e0b4fc5a0 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1466,8 +1466,8 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) return; } else { receive_disconnect(padapter, mgmt->bssid, reason); + pmlmepriv->LinkDetectInfo.bBusyTraffic = false; } - pmlmepriv->LinkDetectInfo.bBusyTraffic = false; } static void OnAction_back(struct adapter *padapter, struct recv_frame *precv_frame) From patchwork Tue Nov 29 20:51:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 27503 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp567315wrr; Tue, 29 Nov 2022 13:06:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf4VppYJf5qO7cVg07vyIqmBTsERo9eUuUfUo3S6lHUDbN9rpD0uEx9vIF7P8vroPD5bGfPJ X-Received: by 2002:a17:902:b40b:b0:188:75bb:36d4 with SMTP id x11-20020a170902b40b00b0018875bb36d4mr40170098plr.55.1669755982308; Tue, 29 Nov 2022 13:06:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669755982; cv=none; d=google.com; s=arc-20160816; b=Xh9zJ4Vfm8QQWjIecsbWwj+Er1iYi4qnEsXqivt9K+BSKz1FnIfgu//nq+QWXu72Ld VkfQ1Ma3BEJceSI4orGMqv5Ni5OYjsJoTiU7BGww3opTe5EwgOJvod6fZiVWz2o+Yhxl DpwfaKRhkW9rCJOHutZHvBIm7BSumrJwPEVr87FEhOHHTfji6zQ7vkkiKoqlQj7emrYT T2D1UL5F1bfOym+xBNQsFaOeR1WsRRZbo8ME4jdR8LHdyce3k25aMtxwp49cOsNOB/u8 ggW4sTROJX8pMMjteqzqkiov59rt4/ZRN7Jan2K5Faq5RVUljxtjZjVaWWb8utHmMXT6 uyzw== 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=BNA1E/NA02d1ETmTBkm/Ggf9scxIq2GGBJ6E/n0Vc4c=; b=jOcu+8Kb65JHnIKH3+k4Ib/+Qrw+ZdrDojXCdrLhST4Yd3m/iSekw3VuGej3JCWJOU j6xN+5cg6Vr4ayY0dDPnXi06HhlClAYA9ZVTZaJkP881znTVwCLHx3cBFSYee0fh67KX kybYVHKxH+zsbPydQAqLVzhe5XFypBTEBPw66Vq/ityWLg3rJjeRRUhlB/j/CdIH1Bzv 3gQMLNbYdz1uyxYlO/XGbFiciqv7knre7Xly6vHzk8ZaCIwfqzWIMbtP7dn66op5JM7y bX38H9ap1RSlZdBuX6ffDu57NvxogAyMAsE8H8iOY7zyWJfEhOAcN57cgSCKIRkMSL++ OyrQ== 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 e128-20020a636986000000b00476e62744a8si15675505pgc.388.2022.11.29.13.06.07; Tue, 29 Nov 2022 13:06:22 -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 S236689AbiK2Uwb (ORCPT + 99 others); Tue, 29 Nov 2022 15:52:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236509AbiK2UwX (ORCPT ); Tue, 29 Nov 2022 15:52:23 -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 8C29B5FE7 for ; Tue, 29 Nov 2022 12:52:22 -0800 (PST) Received: from dslb-188-104-061-001.188.104.pools.vodafone-ip.de ([188.104.61.1] 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 1p07aT-0001pO-0u; Tue, 29 Nov 2022 21:52:17 +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 4/5] staging: r8188eu: handle the non-ap case first Date: Tue, 29 Nov 2022 21:51:51 +0100 Message-Id: <20221129205152.128172-5-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221129205152.128172-1-martin@kaiser.cx> References: <20221129205152.128172-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?1750866048433898093?= X-GMAIL-MSGID: =?utf-8?q?1750866048433898093?= The OnDisassoc function hasn't got much to do if we're not working as an access point. Move this case out of the large if statement to simplify the code. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 36 ++++++++++----------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index dd1e0b4fc5a0..d5c9eb52fb0e 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1433,6 +1433,8 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wifidirect_info *pwdinfo = &padapter->wdinfo; + struct sta_info *psta; + struct sta_priv *pstapriv = &padapter->stapriv; if (memcmp(mgmt->bssid, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) return; @@ -1444,29 +1446,25 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) reason = le16_to_cpu(mgmt->u.disassoc.reason_code); - if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - struct sta_info *psta; - struct sta_priv *pstapriv = &padapter->stapriv; - - psta = rtw_get_stainfo(pstapriv, mgmt->sa); - if (psta) { - u8 updated = 0; + if (!check_fwstate(pmlmepriv, WIFI_AP_STATE)) { + receive_disconnect(padapter, mgmt->bssid, reason); + pmlmepriv->LinkDetectInfo.bBusyTraffic = false; + return; + } - spin_lock_bh(&pstapriv->asoc_list_lock); - if (!list_empty(&psta->asoc_list)) { - list_del_init(&psta->asoc_list); - pstapriv->asoc_list_cnt--; - updated = ap_free_sta(padapter, psta, false, reason); - } - spin_unlock_bh(&pstapriv->asoc_list_lock); + psta = rtw_get_stainfo(pstapriv, mgmt->sa); + if (psta) { + u8 updated = 0; - associated_clients_update(padapter, updated); + spin_lock_bh(&pstapriv->asoc_list_lock); + if (!list_empty(&psta->asoc_list)) { + list_del_init(&psta->asoc_list); + pstapriv->asoc_list_cnt--; + updated = ap_free_sta(padapter, psta, false, reason); } + spin_unlock_bh(&pstapriv->asoc_list_lock); - return; - } else { - receive_disconnect(padapter, mgmt->bssid, reason); - pmlmepriv->LinkDetectInfo.bBusyTraffic = false; + associated_clients_update(padapter, updated); } } From patchwork Tue Nov 29 20:51:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 27506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp567960wrr; Tue, 29 Nov 2022 13:07:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf48BPa0aFyH2PSnxy4Kwd81ZE9gGx96jhebZjxxLtM+FMJGcd38S0XECtIKjDHRF5aNNXA1 X-Received: by 2002:a17:902:aa04:b0:17f:6fee:3334 with SMTP id be4-20020a170902aa0400b0017f6fee3334mr39325029plb.10.1669756066059; Tue, 29 Nov 2022 13:07:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669756066; cv=none; d=google.com; s=arc-20160816; b=cyYbEyk/M6fHOS7RULewyA9t8Tu0KyaTEjfGF2Af6W31wLkfhA4EBQ1XQ2eG5niaRX qJuIPglkSeXSXHtwEcpNSsujUrkex0z4jc45WWkGqXf/2zSJJvtCdebJ3wIBd2ITYkt+ 5gJeycg2pRZL9yUBOJHq9sSU/3s9Cn62GQP++vSRkkHQIUW66MatfTCcXK/lh/x/Ywtb tL2+CpDPu5XMYCisHU+54MhLrdboiftRkvJ2K2e2w9LM2dPn6DFwW14yt6uf/49lpEn9 cMzZtkhngWzm7Oa91QYR3TwftMJ4y5D2DSqHnu+nYjmRcKYW47XK0flVRyla5hE4NxFG 2YBQ== 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=TH38Velay2+bpQVz3MzXudsBkZ7EGlWEN8wicl5hbZk=; b=bnCc9KPg0CrXXC4+N+vdydyofMDfZbO1i9fD/8REIs/siB5OhXUOMnJq8DKMYwhvvm GAvpCDe1i8SWPfVQyAryuA8IqxYaVFGleDvVPf4nlHqA1tAzFtjCxDz1ee3piUK7W4Je zYttatWW/HPr4SfrCtTdXXHP/37Ga/TjYUv71/sKAcco4KuPrfCO6xk3RjC0IGrgG7Id BbMVEyvXx/VLtp+ZbbKBUmRmD8kYX2Mbqzl1KZ6jnBPCC84Ebtj73kvYxdrfDV1EtlNv i+zXb2bAcrhCf/7htFtffz78AuNFyFNxKji/6qDMTv072WOm47BbFepxJtiVQCXz8JZT NnXw== 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 jw1-20020a170903278100b00189380323f7si10426789plb.318.2022.11.29.13.07.30; Tue, 29 Nov 2022 13:07:46 -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 S236734AbiK2Uwf (ORCPT + 99 others); Tue, 29 Nov 2022 15:52:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236609AbiK2UwZ (ORCPT ); Tue, 29 Nov 2022 15:52:25 -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 B7EC712606 for ; Tue, 29 Nov 2022 12:52:24 -0800 (PST) Received: from dslb-188-104-061-001.188.104.pools.vodafone-ip.de ([188.104.61.1] 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 1p07aU-0001pO-QO; Tue, 29 Nov 2022 21:52:18 +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 5/5] staging: r8188eu: simplify err handling for unknown station Date: Tue, 29 Nov 2022 21:51:52 +0100 Message-Id: <20221129205152.128172-6-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221129205152.128172-1-martin@kaiser.cx> References: <20221129205152.128172-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?1750866136686619471?= X-GMAIL-MSGID: =?utf-8?q?1750866136686619471?= If we receive a disassoc message from an unknown station, we can drop this message immediately. Reorder the code to make this clearer. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index d5c9eb52fb0e..49e0b50b1243 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -1435,6 +1435,7 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) struct wifidirect_info *pwdinfo = &padapter->wdinfo; struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; + u8 updated = 0; if (memcmp(mgmt->bssid, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) return; @@ -1453,19 +1454,18 @@ static void OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) } psta = rtw_get_stainfo(pstapriv, mgmt->sa); - if (psta) { - u8 updated = 0; - - spin_lock_bh(&pstapriv->asoc_list_lock); - if (!list_empty(&psta->asoc_list)) { - list_del_init(&psta->asoc_list); - pstapriv->asoc_list_cnt--; - updated = ap_free_sta(padapter, psta, false, reason); - } - spin_unlock_bh(&pstapriv->asoc_list_lock); + if (!psta) + return; - associated_clients_update(padapter, updated); + spin_lock_bh(&pstapriv->asoc_list_lock); + if (!list_empty(&psta->asoc_list)) { + list_del_init(&psta->asoc_list); + pstapriv->asoc_list_cnt--; + updated = ap_free_sta(padapter, psta, false, reason); } + spin_unlock_bh(&pstapriv->asoc_list_lock); + + associated_clients_update(padapter, updated); } static void OnAction_back(struct adapter *padapter, struct recv_frame *precv_frame)