From patchwork Sat Nov 26 15:42: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: 26259 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4700210wrr; Sat, 26 Nov 2022 07:47:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf5YhYSneQDttvv8GZRsBRIw7ST/gufjBQZj1MEA6xQWWNY5q4r/PCA0SGFVcvm26cF1KjgC X-Received: by 2002:aa7:d816:0:b0:458:4868:814 with SMTP id v22-20020aa7d816000000b0045848680814mr40930899edq.190.1669477669789; Sat, 26 Nov 2022 07:47:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669477669; cv=none; d=google.com; s=arc-20160816; b=uYAvZz4PXlE9anQIhh40Zo8PQl4eivsvfX5BZLLVK8kvXf78SqlwdQfM3n8P8phm7b npiMOxc+R3SIc2ZqGB8ersEmVZ1WIb+EllLaPH2XkjBb0SRwYb0HNbFwTixZoBzuhnFE fJx4jvGJb2x4VC5lXC8ujWUBgl4uDBBsc74f8K0TixIkBp7hA4WGoIvetAxkwD1pCol2 T2wHOX/uGMfYdgRVSc/t93ta+QlRX3Bf3PN4kVbVkC++hget1r5lBp1qK8Fk/JGzpP+e 8jd8NhyoijjkotnV29OXEST9LKEsOJimyv0lcD6ISE5KU0R1Nt438YhJdoKTd/j6KcsL 8q+g== 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=S69bmkHlZtp34tFtJ3CeF0DFu2Udi4pD0wxh0H4wDtg=; b=T7m1GzFbmstXa+h8El2wXO/RM7E9cOnU8SbMjCeFTdH22+dtAVxeOMZbok0IXL1ZYP tjd/D5Nth7LDHVhQYcjr8ypRsFQnM7OrpUGcfNB+hgxbyvMjzTXf9RYVvG5LWCWIaJXs S8nhALhd3Bq0bFxLSyZvfKfw/TWJo6s8fWRZiJWN/Ado4QNC4SIm+grB8v3DVQyLRXsw EZ8P0yflwCHFpkjYueYi3UqgjfNYZFwWomGbR1d8EDMs9jFO5CxIb+DKGtXoANZ4QAzo /kCpMsmFJPGVnayhBf/bLGEBs4J8YzRirVaYtG2PARKAsGj7b9iwQCYXky9+4WZjMhd5 n1IQ== 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 h4-20020aa7c944000000b004692b547022si5583596edt.526.2022.11.26.07.47.26; Sat, 26 Nov 2022 07:47:49 -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 S229670AbiKZPnO (ORCPT + 99 others); Sat, 26 Nov 2022 10:43:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbiKZPnH (ORCPT ); Sat, 26 Nov 2022 10:43: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 9E44FCE20 for ; Sat, 26 Nov 2022 07:43:06 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] 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 1oyxKW-0000Lt-Mt; Sat, 26 Nov 2022 16:43: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 3/5] staging: r8188eu: fix the number of probereq retries Date: Sat, 26 Nov 2022 16:42:51 +0100 Message-Id: <20221126154253.178275-4-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126154253.178275-1-martin@kaiser.cx> References: <20221126154253.178275-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?1750574216865007107?= X-GMAIL-MSGID: =?utf-8?q?1750574216865007107?= issue_probereq_ex sends a probe request and retries if this fails. There's no point in making the number of retries configurable. Hard-code the value that's used by issue_probereq_ex's only caller. Simplify the code to check the loop condition only once. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 21 +++++++------------ .../staging/r8188eu/include/rtw_mlme_ext.h | 3 +-- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 990336244030..667f54e313ef 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -4482,21 +4482,16 @@ inline void issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *ps _issue_probereq(padapter, pssid, da, false); } -void issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da, - int try_cnt) +void issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da) { - int ret; - int i = 0; - - do { - ret = _issue_probereq(padapter, pssid, da, true); - - i++; + int i; - if (i < try_cnt && ret == _FAIL) + for (i = 0; i < 3; i++) { + if (_issue_probereq(padapter, pssid, da, true) == _FAIL) msleep(1); - - } while ((i < try_cnt) && (ret == _FAIL)); + else + break; + } } /* if psta == NULL, indicate we are station (client) now... */ @@ -7046,7 +7041,7 @@ void linked_status_chk(struct adapter *padapter) } if (rx_chk != _SUCCESS) - issue_probereq_ex(padapter, &pmlmeinfo->network.Ssid, psta->hwaddr, 3); + issue_probereq_ex(padapter, &pmlmeinfo->network.Ssid, psta->hwaddr); if ((tx_chk != _SUCCESS && pmlmeinfo->link_count++ == 0xf) || rx_chk != _SUCCESS) { tx_chk = issue_nulldata(padapter, psta->hwaddr, 0, 3, 1); diff --git a/drivers/staging/r8188eu/include/rtw_mlme_ext.h b/drivers/staging/r8188eu/include/rtw_mlme_ext.h index 04fd673d3a04..089bd5446773 100644 --- a/drivers/staging/r8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/r8188eu/include/rtw_mlme_ext.h @@ -512,8 +512,7 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short status); void issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da); -void issue_probereq_ex(struct adapter *adapter, struct ndis_802_11_ssid *pssid, - u8 *da, int try_cnt); +void issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da); int issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned int power_mode, int try_cnt, int wait_ms); int issue_qos_nulldata(struct adapter *padapter, unsigned char *da,