From patchwork Mon Jan 23 20:53:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 47381 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1811055wrn; Mon, 23 Jan 2023 12:56:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXvE3PJKCwQK/e8TnYFMJuirxix0J+MrxFRW6skU3N50VFw5wWgQdBRGzHFye0S1y69x74Fx X-Received: by 2002:a17:907:9150:b0:84d:150d:5006 with SMTP id l16-20020a170907915000b0084d150d5006mr24698558ejs.49.1674507379348; Mon, 23 Jan 2023 12:56:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674507379; cv=none; d=google.com; s=arc-20160816; b=MyZlp9ZiEOPOtfQa5eSRMbvhP2gcI/HbIvFky+7rUdEb5HAv142Rre5zHFWvkkDBE/ 8zhEW9uP6ALe16IPMHBgRwBfmfmBbFVH3ohYljA7AxUjonOmErif5QC+RkCWXA1s0FOQ dvxv7u1Wpe8kxtkJX4mDhtIri3K2MWMOSlUYxP19GqhI7bbFQ4Wbx+6DjlZy0EUjlFul gBy2sb7kegFr9ItJV7+oV+B+Y2ET0UREKoSiw97YOHxoxU/AMUgyQjYtGjdsSxfCwyGO 9B8Hl8LrMYWL8NQ/W3fi2NTcFBbSJcnrQEtcxPjalqgtwwjEMo+mU+Eqsx9CA0urLZuw h8XA== 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=tHwhIWxeYt5X/8lYAui/YFafjM3KUNTZFiG5I8NHkQI=; b=AfCvRj1VrvyaSSM10zq01cobBaRedSjhyq+69KF3vgfxIlPuNeJovAl+7f0tj4rwon 3y/MIm4BHXFE6gsFkyxV3Y3RcBDZYCKI9chqG31RXfnVSLnI3Zk5DRfWCxD1GY4QIcFC hkAe6IC3GK2nnhryawkrPfkd6+JOmPcrxbGpySki+nM4+BsiYqzOdAdxlGpCNW5Bqz3I p8ST2/Mm2d91GxVn3JcAvxumJwHDEq3z2jrUgJGNh47oEugwO2vhD60V7s06rzjtKUXs ZjB9SqDMzBZAH6+jnMP5OVwoBy+QsAPhW91rzbqjhc7lnJKHYuTLlVIl0OUwhbFyr7ZI gdRw== 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 gs16-20020a1709072d1000b0087752be1dcasi21272724ejc.914.2023.01.23.12.55.54; Mon, 23 Jan 2023 12:56:19 -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 S231872AbjAWUyJ (ORCPT + 99 others); Mon, 23 Jan 2023 15:54:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231548AbjAWUyD (ORCPT ); Mon, 23 Jan 2023 15:54:03 -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 D8DEF83DE for ; Mon, 23 Jan 2023 12:54:01 -0800 (PST) Received: from ipservice-092-217-089-134.092.217.pools.vodafone-ip.de ([92.217.89.134] 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 1pK3pD-0000Lk-Uh; Mon, 23 Jan 2023 21:53:56 +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 01/23] staging: r8188eu: we use a constant number of hw_xmit entries Date: Mon, 23 Jan 2023 21:53:20 +0100 Message-Id: <20230123205342.229589-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230123205342.229589-1-martin@kaiser.cx> References: <20230123205342.229589-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?1755848249717721433?= X-GMAIL-MSGID: =?utf-8?q?1755848249717721433?= struct xmit_priv contains a pointer to an array of struct hw_xmit entries. xmit_priv's (ill-named) hwxmit_entry component stores the size of this array, i.e. the number of hw_xmit entries that are used. The array size is constant, it's initialised to HWXMIT_ENTRY and never updated. Simplify the code accordingly. Remove hwxmit_entry, do not pass the array size as a function parameter and use HWXMIT_ENTRY in the code that handles the array. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_xmit.c | 8 +++----- drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 2 +- drivers/staging/r8188eu/include/rtw_xmit.h | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c index c51f6eabef87..5f2426be6c11 100644 --- a/drivers/staging/r8188eu/core/rtw_xmit.c +++ b/drivers/staging/r8188eu/core/rtw_xmit.c @@ -1375,7 +1375,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, str return pxmitframe; } -struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i, int entry) +struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i) { struct list_head *sta_plist, *sta_phead; struct hw_xmit *phwxmit; @@ -1397,7 +1397,7 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi spin_lock_bh(&pxmitpriv->lock); - for (i = 0; i < entry; i++) { + for (i = 0; i < HWXMIT_ENTRY; i++) { phwxmit = phwxmit_i + inx[i]; sta_phead = get_list_head(phwxmit->sta_queue); @@ -1501,9 +1501,7 @@ int rtw_alloc_hwxmits(struct adapter *padapter) struct hw_xmit *hwxmits; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - pxmitpriv->hwxmit_entry = HWXMIT_ENTRY; - - pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry, sizeof(struct hw_xmit), GFP_KERNEL); + pxmitpriv->hwxmits = kcalloc(HWXMIT_ENTRY, sizeof(struct hw_xmit), GFP_KERNEL); if (!pxmitpriv->hwxmits) return -ENOMEM; diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c index d1af76cc2091..e097fa14dc6e 100644 --- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c +++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c @@ -398,7 +398,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmit if (!pxmitbuf) return false; - pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry); + pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits); if (!pxmitframe) { /* no more xmit frame, release xmit buffer */ rtw_free_xmitbuf(pxmitpriv, pxmitbuf); diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h index 883eacd98224..cc32167fb4dc 100644 --- a/drivers/staging/r8188eu/include/rtw_xmit.h +++ b/drivers/staging/r8188eu/include/rtw_xmit.h @@ -273,7 +273,6 @@ struct xmit_priv { u64 last_tx_bytes; u64 last_tx_pkts; struct hw_xmit *hwxmits; - u8 hwxmit_entry; u8 wmm_para_seq[4];/* sequence for wmm ac parameter strength * from large to small. it's value is 0->vo, * 1->vi, 2->be, 3->bk. */ @@ -324,7 +323,7 @@ struct tx_servq *rtw_get_sta_pending(struct adapter *padapter, s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe); struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, - struct hw_xmit *phwxmit_i, int entry); + struct hw_xmit *phwxmit_i); s32 rtw_xmit_classifier(struct adapter *padapter, struct xmit_frame *pxmitframe);