All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Shengyu Qu <wiagn233@outlook.com>, "nbd@nbd.name" <nbd@nbd.name>,
	"lorenzo@kernel.org" <lorenzo@kernel.org>,
	"ryder.lee@mediatek.com" <ryder.lee@mediatek.com>,
	"shayne.chen@mediatek.com" <shayne.chen@mediatek.com>,
	"sean.wang@mediatek.com" <sean.wang@mediatek.com>,
	"johannes@sipsolutions.net" <johannes@sipsolutions.net>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"angelogioacchino.delregno@collabora.com"
	<angelogioacchino.delregno@collabora.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>
Cc: Peter Chiu <chui-hao.chiu@mediatek.com>
Subject: RE: [PATCH v2] mt76: mt7915: wed: find rx token by physical address
Date: Fri, 14 Mar 2025 00:38:18 +0000	[thread overview]
Message-ID: <e935ee9c19de4b9baf547aa6861d23e7@realtek.com> (raw)
In-Reply-To: <TYCPR01MB843753CE1DBAF4FAEF76B17698D32@TYCPR01MB8437.jpnprd01.prod.outlook.com>

Shengyu Qu <wiagn233@outlook.com> wrote:
> The token id in RxDMAD may be incorrect when it is not the last frame
> due to WED HW bug. Lookup correct token id by physical address in sdp0.
> 
> Downstream patch link:
> https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/737340322ab22b138fd200e02
> 0d61ffdbe3e36a9/autobuild/autobuild_5.4_mac80211_release/mt7988_wifi7_mac80211_mlo/package/kernel/mt76
> /patches/0062-mtk-wifi-mt76-mt7915-wed-find-rx-token-by-physical-a.patch
> 
> Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
> Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
> ---
> Changes since v1:
>  - Reordered code sequence to reversed Xmas tree order
>  - Renamed some variables
> ---
>  drivers/net/wireless/mediatek/mt76/dma.c | 26 +++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
> index 844af16ee5513..25893686cbe85 100644
> --- a/drivers/net/wireless/mediatek/mt76/dma.c
> +++ b/drivers/net/wireless/mediatek/mt76/dma.c
> @@ -445,8 +445,32 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
> 
>         if (mt76_queue_is_wed_rx(q)) {
>                 u32 token = FIELD_GET(MT_DMA_CTL_TOKEN, buf1);
> -               struct mt76_txwi_cache *t = mt76_rx_token_release(dev, token);
> +               struct mt76_txwi_cache *t;
> +               bool found = false;
> +               u32 id;
> +
> +               if (*more) {
> +                       spin_lock_bh(&dev->rx_token_lock);
> +
> +                       idr_for_each_entry(&dev->rx_token, t, id) {
> +                               if (t->dma_addr == le32_to_cpu(desc->buf0)) {
> +                                       token = id;
> +                                       found = 1;

found = true;

Since you are digging how frequent this can occur, you may decide to have a
conversion function afterward, so it would be good to move this loop
into a function, like mt76_dma_get_id_from_txwi(dev, t). Then the you can
replace the implementation at that time.

By the way, I personally don't like so many indents. A function can ease
indents.

> +
> +                                       /* Write correct id back to DMA*/
> +                                       u32p_replace_bits(&buf1, id,
> +                                                         MT_DMA_CTL_TOKEN);
> +                                       WRITE_ONCE(desc->buf1, cpu_to_le32(buf1));
> +                                       break;
> +                               }
> +                       }
> +
> +                       spin_unlock_bh(&dev->rx_token_lock);
> +                       if (!found)
> +                               return NULL;
> +               }
> 
> +               t = mt76_rx_token_release(dev, token);
>                 if (!t)
>                         return NULL;
> 
> --
> 2.48.1


      reply	other threads:[~2025-03-14  0:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13 13:11 [PATCH v2] mt76: mt7915: wed: find rx token by physical address Shengyu Qu
2025-03-14  0:38 ` Ping-Ke Shih [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e935ee9c19de4b9baf547aa6861d23e7@realtek.com \
    --to=pkshih@realtek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chui-hao.chiu@mediatek.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    --cc=wiagn233@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.