From patchwork Sun Nov 6 17:04:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 16165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1588254wru; Sun, 6 Nov 2022 09:07:34 -0800 (PST) X-Google-Smtp-Source: AMsMyM5kizgi809kvCCExxq1fSPquyqNLixZJvowsSXE53lhmFe6XLPPvf9fj+S5XTZVS7ampTDs X-Received: by 2002:a17:906:5a56:b0:7ad:c391:42ee with SMTP id my22-20020a1709065a5600b007adc39142eemr39551541ejc.127.1667754453973; Sun, 06 Nov 2022 09:07:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667754453; cv=none; d=google.com; s=arc-20160816; b=f98Z3UHfJwdlrmvkMz2N1/8Pgt/HFJj3I4/eGSYB7fOfOOuNAAz99HAYzCLuj3xzEi NC9YSWK7tG5OG6qjc83bR6g/uLy8EovLAWMZ/XWLTrpnceQc59Yrq4MsFc2uZJRTZXPu PM2SztNNfIGVaBd+OlKngord+N5fPspl1AA+oPiVIBoXhgQEZt3czSnY0EaaIg/UHYoq krIc3r7NWrZWNgdJFXH2lkCS0N3yKHY0IBOUKWSro5mEY38s1Dqqo0dacGZ0YfBEN+im +nGEYw3bmycF/gSBFtwc4+m1mL9wxcC/cc1CFvkV7FxQ3+l6owHnRu5w4KQGvCFBXiR8 5K6g== 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=sms11Mp3HeqaDKNRYZhxRc92oZ3FzBDTjgrLHdiTT3A=; b=apg5gUs2rsBsRBlhFFicI9e1sZieGwO/IrSc16GNK63mh+MB0lf4/BZDj3QLkHKZUs FuFmT8Rmc4l4BVvHqRx4M4pQaSSVbWdxJM4uD8Khg5JSH08GdHWbGMcrCco9PaZqOixS RBW95sZgBnEOOuIus1Hz93Je2peKu9GazUfaq/iIvXmIck/6jhW+HmJ0XtxmxJw4YzLY 3tHfACqCMJaRHDssDPjYTG4aV7jhdpysHIHZ0WYrtyOkOBQNLXV79SUiFBdDCBdJBY5f 9DsRbbCuZ8QRjqO9PClkOgt/SdeOCrNIziKOnax9LlxjvcKolguSp4s+aZ65febC70p6 xMQQ== 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 hb13-20020a170907160d00b007707f83375bsi6799753ejc.945.2022.11.06.09.07.10; Sun, 06 Nov 2022 09:07:33 -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 S230365AbiKFRGQ (ORCPT + 99 others); Sun, 6 Nov 2022 12:06:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbiKFRFt (ORCPT ); Sun, 6 Nov 2022 12:05:49 -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 2E93FFAFF for ; Sun, 6 Nov 2022 09:05:03 -0800 (PST) Received: from ipservice-092-217-068-220.092.217.pools.vodafone-ip.de ([92.217.68.220] 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 1orj4u-0001KU-8f; Sun, 06 Nov 2022 18:05: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/3] staging: r8188eu: use a qos_hdr in validate_recv_data_frame Date: Sun, 6 Nov 2022 18:04:53 +0100 Message-Id: <20221106170455.743058-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221106170455.743058-1-martin@kaiser.cx> References: <20221106170455.743058-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?1748767293947084904?= X-GMAIL-MSGID: =?utf-8?q?1748767293947084904?= Define a struct ieee80211_qos_hdr in the validate_recv_data_frame function. Use this struct to replace some numeric offsets and make the code easier to understand. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_recv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index cb0f35d7ab98..245b931c483d 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -1032,7 +1032,6 @@ static int validate_recv_data_frame(struct adapter *adapter, struct recv_frame *precv_frame) { struct sta_info *psta = NULL; - u8 *ptr = precv_frame->rx_data; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)precv_frame->rx_data; struct rx_pkt_attrib *pattrib = &precv_frame->attrib; struct security_priv *psecuritypriv = &adapter->securitypriv; @@ -1071,10 +1070,12 @@ static int validate_recv_data_frame(struct adapter *adapter, pattrib->ack_policy = 0; /* parsing QC field */ if (pattrib->qos) { + struct ieee80211_qos_hdr *qos_hdr = (struct ieee80211_qos_hdr *)hdr; + pattrib->priority = ieee80211_get_tid(hdr); - pattrib->ack_policy = GetAckpolicy((ptr + 24)); - pattrib->amsdu = GetAMsdu((ptr + 24)); - pattrib->hdrlen = 26; + pattrib->ack_policy = GetAckpolicy(&qos_hdr->qos_ctrl); + pattrib->amsdu = GetAMsdu(&qos_hdr->qos_ctrl); + pattrib->hdrlen += sizeof(*qos_hdr); if (pattrib->priority != 0 && pattrib->priority != 3) adapter->recvpriv.bIsAnyNonBEPkts = true; From patchwork Sun Nov 6 17:04:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 16163 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1588144wru; Sun, 6 Nov 2022 09:07:16 -0800 (PST) X-Google-Smtp-Source: AMsMyM6IbfZdKai8Y1t71Ve6FbQdkMfCutA4oMpF4Vatpqw0lmoOGe6zVt5qCG1J2lo1cPNyf0ul X-Received: by 2002:a05:6402:78c:b0:461:a7f3:2d61 with SMTP id d12-20020a056402078c00b00461a7f32d61mr45811634edy.84.1667754435939; Sun, 06 Nov 2022 09:07:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667754435; cv=none; d=google.com; s=arc-20160816; b=SIye2OmL2Ky0uInXPlzI/7xvmC4aUR9TN8rachQGn1p+hvR+5QbdMPKUPY6QBuEJM8 QumXVDYs3/24xFgaY8n9N+Opv/2+jZeqfDyyMFQ4t5DvwAQk4vtOOojxNd3vTmRiYQLz 2OXZsQkmfdqkrgadKoQ1ORXN5YqTYs6uaj6rDR5ib9OuknNoHK01WAlJ27EdkMxXgPQL tIP4bjcbs6Z5vtmfwLuXyepSiUkSZqjMN4uSwThLE1eHEORp+45e0Daklg9fUkIQDnjF inED0Zor0Lamo5hwJnOjO7Qmepz7eUwNeWBweY/GcA1xwF9lMgjtX2x/TfwGnldRIrw5 ZQtQ== 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=uDyOvkm6/+OKBHgvu7fmcFq3OmFFRwHI49Wxj7re1+o=; b=VncYvBbRXmFp7M3mQaBxbdIDhAHDJy0IN5B01D+sYQFxPdr5zk3B9L2vxxwpmH7ANR bX9Hl3fqOE4PZtDwbFKSUsfJ50qo7w60s0AQyj3nnZkwJQaaG1bSvhGQ9RFLPMGtIucs J/4W4227wgZJtMXUDU/HRFJtbTmNQmvhAy9iLI4tVqs8BeoXo3A4FSUpRy44GzgqML5z Of+h+2bn0ajwCMFiPRJpkjgBCslgtmzph6b6hsiRW52qPfU8RLJ/bUKqOoyagSfB3218 8b/2uxugr/C9U80sJPW6iBKURTW1VDizB9+rbBbSXEO1uhbqCdTRzS9P4p/vZ3yZqHS8 QKRw== 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 s4-20020a056402520400b00461d97e5287si7581282edd.344.2022.11.06.09.06.52; Sun, 06 Nov 2022 09:07:15 -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 S230442AbiKFRGX (ORCPT + 99 others); Sun, 6 Nov 2022 12:06:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230366AbiKFRFx (ORCPT ); Sun, 6 Nov 2022 12:05:53 -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 6C193FCE5 for ; Sun, 6 Nov 2022 09:05:06 -0800 (PST) Received: from ipservice-092-217-068-220.092.217.pools.vodafone-ip.de ([92.217.68.220] 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 1orj4u-0001KU-Vi; Sun, 06 Nov 2022 18:05:01 +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/3] staging: r8188eu: drop another removal/stop check Date: Sun, 6 Nov 2022 18:04:54 +0100 Message-Id: <20221106170455.743058-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221106170455.743058-1-martin@kaiser.cx> References: <20221106170455.743058-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?1748767275134502224?= X-GMAIL-MSGID: =?utf-8?q?1748767275134502224?= There's no need to check bDriverStopped and bSurpriseRemoved in issue_probereq_ex. The code path looks like issue_probereq_ex _issue_probereq dump_mgntframe or dump_mgntframe_and_wait_ack All paths from dump_mgntframe check the two variables. dump_mgntframe_and_wait_ack contains a check as well. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 17803aca83c8..bfd6afd7266e 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -4496,9 +4496,6 @@ int issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, i++; - if (padapter->bDriverStopped || padapter->bSurpriseRemoved) - break; - if (i < try_cnt && wait_ms > 0 && ret == _FAIL) msleep(wait_ms); From patchwork Sun Nov 6 17:04:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 16164 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1588223wru; Sun, 6 Nov 2022 09:07:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ptABp1jCAQfPFyLIn7UjLfeg5jbmdERHTF9Ul8tCkTOeXCe5Y/PQe4F2Q+lta1yhSKqgh X-Received: by 2002:a17:906:4ecc:b0:7ae:4f8e:1d7 with SMTP id i12-20020a1709064ecc00b007ae4f8e01d7mr6591916ejv.339.1667754449848; Sun, 06 Nov 2022 09:07:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667754449; cv=none; d=google.com; s=arc-20160816; b=UWsnEDiSYwiPs6f114XB8ADCVR5wpB/KAEzJ84QJ8pM8mCUgXS/St4qW0LxDcfWoLg is+5MJ9FyqADXm/lxrjx2HwH69m0UUh9Ng0FLXkOAtZYTdzMCAOVkABwT4YPDwKZ+J8r pqDxlYnNWgPO+VFtuNxi2aSXFFNzdo2VouHfv0HWZAZFbLeDkshXwhKjWkVrg+WlftKl HQ+uGvKQgxUe2/4GpwzxuA5H8Ap9kEkKiJR4hQQ/Jyj7YRX+Z3mLHf+jNsBneCqntLV2 LgDcmzs/7QMphkKwGVfQzf67fYkHsVHaUX9M2iKY1Gy9Z8BcgeRf0oLPQ2enOZJRzxr3 KsiA== 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=xfNxVhybfKl5gi348mpSZ7LIuOrIKyGa9hl7V6e0URI=; b=po3NLlGkiJxkfUDK2Z68WJnMpoPVGiRZeE/ZjIeAsZO8K0lqGaLw4OZsIrtAErHkqH Wvkbjjsvycmnaycgdaf3TUzB3zyRyGXgMJ219cJIdDRfioOQsyk3l/f0/MureKN/JZpu 1F/uHo5nDHRb0MPRztp7wz+yA0XicwPDfm15VxrxANbsoK9AYmcK/gYeBIUXC+ql1Yfz MxHPYJzxIqVTiAvLhL+1I3xD9PueY0IuqvwWWqSmy9pOSEjfTvcfDwNYyJ/xkmUNhOBE mMNrgI53D6EcJka4KkPSIv+OGdGoU13NHM2xAm+6paQiomUFIyr/m+dAY5yuFAclXdfq Gt2w== 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 go37-20020a1709070da500b0078e1246e7d6si7135313ejc.748.2022.11.06.09.07.04; Sun, 06 Nov 2022 09:07:29 -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 S230424AbiKFRG0 (ORCPT + 99 others); Sun, 6 Nov 2022 12:06:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230327AbiKFRFy (ORCPT ); Sun, 6 Nov 2022 12:05:54 -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 CFB3D10069 for ; Sun, 6 Nov 2022 09:05:06 -0800 (PST) Received: from ipservice-092-217-068-220.092.217.pools.vodafone-ip.de ([92.217.68.220] 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 1orj4v-0001KU-QH; Sun, 06 Nov 2022 18:05:01 +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/3] staging: r8188eu: drop removal/stop check in dump_mgntframe_and_wait_ack Date: Sun, 6 Nov 2022 18:04:55 +0100 Message-Id: <20221106170455.743058-4-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221106170455.743058-1-martin@kaiser.cx> References: <20221106170455.743058-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?1748767289568312799?= X-GMAIL-MSGID: =?utf-8?q?1748767289568312799?= We can remove the checks for bDriverStopped and bSurpriseRemoved in dump_mgntframe_and_wait_ack. The code path from this function looks like dump_mgntframe_and_wait_ack rtl8188eu_mgnt_xmit rtw_dump_xframe loop over all fragments rtw_write_port is called for each fragment. bSurpriseRemoved and bDriverStopped are checked in rtw_write_port. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index bfd6afd7266e..be33489d3dfd 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -3988,9 +3988,6 @@ s32 dump_mgntframe_and_wait_ack(struct adapter *padapter, struct xmit_frame *pmg u32 timeout_ms = 500;/* 500ms */ struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - if (padapter->bSurpriseRemoved || padapter->bDriverStopped) - return -1; - mutex_lock(&pxmitpriv->ack_tx_mutex); pxmitpriv->ack_tx = true;