diff mbox series

[v2] wifi: rtl8xxxu: correct the error value of 'timeout'

Message ID 20231115050123.951862-1-suhui@nfschina.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series [v2] wifi: rtl8xxxu: correct the error value of 'timeout' | expand

Commit Message

Su Hui Nov. 15, 2023, 5:01 a.m. UTC
When 'rtl8xxxu_dma_agg_pages <= page_thresh', 'timeout' should equal to
'page_thresh' rather than '4'. Change the code order to fix this problem.

Fixes: fd83f1227826 ("rtl8xxxu: gen1: Add module parameters to adjust DMA aggregation parameters")
Signed-off-by: Su Hui <suhui@nfschina.com>
---
v2:
 -  correct the problem about Fixes tag.

 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Ping-Ke Shih Nov. 17, 2023, 2:53 a.m. UTC | #1
> -----Original Message-----
> From: Su Hui <suhui@nfschina.com>
> Sent: Wednesday, November 15, 2023 1:01 PM
> To: Ping-Ke Shih <pkshih@realtek.com>; Jes.Sorensen@gmail.com
> Cc: Su Hui <suhui@nfschina.com>; kvalo@kernel.org; linux-wireless@vger.kernel.org;
> linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: [PATCH v2] wifi: rtl8xxxu: correct the error value of 'timeout'
> 
> When 'rtl8xxxu_dma_agg_pages <= page_thresh', 'timeout' should equal to
> 'page_thresh' rather than '4'. Change the code order to fix this problem.
> 
> Fixes: fd83f1227826 ("rtl8xxxu: gen1: Add module parameters to adjust DMA aggregation parameters")
> Signed-off-by: Su Hui <suhui@nfschina.com>
> ---

Checking logic of agg_pages and agg_timeout, I think we should correct it
by below changes. So, NACK this patch. 

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 43ee7592bc6e..c9e227aed685 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -4760,7 +4760,7 @@ void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv)
        page_thresh = (priv->fops->rx_agg_buf_size / 512);
        if (rtl8xxxu_dma_agg_pages >= 0) {
                if (rtl8xxxu_dma_agg_pages <= page_thresh)
-                       timeout = page_thresh;
+                       page_thresh = rtl8xxxu_dma_agg_pages;
                else if (rtl8xxxu_dma_agg_pages <= 6)
                        dev_err(&priv->udev->dev,
                                "%s: dma_agg_pages=%i too small, minimum is 6\n",
Dan Carpenter Nov. 20, 2023, 2:09 p.m. UTC | #2
On Fri, Nov 17, 2023 at 02:53:52AM +0000, Ping-Ke Shih wrote:
> 
> 
> > -----Original Message-----
> > From: Su Hui <suhui@nfschina.com>
> > Sent: Wednesday, November 15, 2023 1:01 PM
> > To: Ping-Ke Shih <pkshih@realtek.com>; Jes.Sorensen@gmail.com
> > Cc: Su Hui <suhui@nfschina.com>; kvalo@kernel.org; linux-wireless@vger.kernel.org;
> > linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org
> > Subject: [PATCH v2] wifi: rtl8xxxu: correct the error value of 'timeout'
> > 
> > When 'rtl8xxxu_dma_agg_pages <= page_thresh', 'timeout' should equal to
> > 'page_thresh' rather than '4'. Change the code order to fix this problem.
> > 
> > Fixes: fd83f1227826 ("rtl8xxxu: gen1: Add module parameters to adjust DMA aggregation parameters")
> > Signed-off-by: Su Hui <suhui@nfschina.com>
> > ---
> 
> Checking logic of agg_pages and agg_timeout, I think we should correct it
> by below changes. So, NACK this patch. 
> 
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> index 43ee7592bc6e..c9e227aed685 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> @@ -4760,7 +4760,7 @@ void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv)
>         page_thresh = (priv->fops->rx_agg_buf_size / 512);
>         if (rtl8xxxu_dma_agg_pages >= 0) {
>                 if (rtl8xxxu_dma_agg_pages <= page_thresh)
> -                       timeout = page_thresh;
> +                       page_thresh = rtl8xxxu_dma_agg_pages;

Yeah.  That looks correct.  What I suggested earlier was wrong.

regards,
dan carpenter
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 43ee7592bc6e..9cab8b1dc486 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -4757,6 +4757,12 @@  void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv)
 	 *   RxAggPageTimeout = 4 or 6 (absolute time 34ms/(2^6))
 	 */
 
+	/* REG_RXDMA_AGG_PG_TH + 1 seems to be the timeout register on
+	 * gen2 chips and rtl8188eu. The rtl8723au seems unhappy if we
+	 * don't set it, so better set both.
+	 */
+	timeout = 4;
+
 	page_thresh = (priv->fops->rx_agg_buf_size / 512);
 	if (rtl8xxxu_dma_agg_pages >= 0) {
 		if (rtl8xxxu_dma_agg_pages <= page_thresh)
@@ -4771,12 +4777,6 @@  void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv)
 				__func__, rtl8xxxu_dma_agg_pages, page_thresh);
 	}
 	rtl8xxxu_write8(priv, REG_RXDMA_AGG_PG_TH, page_thresh);
-	/*
-	 * REG_RXDMA_AGG_PG_TH + 1 seems to be the timeout register on
-	 * gen2 chips and rtl8188eu. The rtl8723au seems unhappy if we
-	 * don't set it, so better set both.
-	 */
-	timeout = 4;
 
 	if (rtl8xxxu_dma_agg_timeout >= 0) {
 		if (rtl8xxxu_dma_agg_timeout <= 127)