[PATCH v1] mt76: mt7915: wed: find rx token by physical address
Shengyu Qu
wiagn233 at outlook.com
Tue Mar 11 01:51:28 PDT 2025
Hi Shih,
Can you also give this patch a review? Seems I also need to convert to
reverse Xmas tree order for this patch, will do it in next version.
Best regards,
Shengyu
在 2025/2/22 19:38, Shengyu Qu 写道:
> 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/+/737340322ab22b138fd200e020d61ffdbe3e36a9/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 at mediatek.com>
> Signed-off-by: Shengyu Qu <wiagn233 at outlook.com>
> ---
> drivers/net/wireless/mediatek/mt76/dma.c | 25 +++++++++++++++++++++++-
> 1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
> index 844af16ee551..5bf63014263c 100644
> --- a/drivers/net/wireless/mediatek/mt76/dma.c
> +++ b/drivers/net/wireless/mediatek/mt76/dma.c
> @@ -444,9 +444,32 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
> mt76_dma_should_drop_buf(drop, ctrl, buf1, desc_info);
>
> if (mt76_queue_is_wed_rx(q)) {
> + u32 id, find = 0;
> 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;
> +
> + 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)) {
> + find = 1;
> + token = id;
> +
> + /* 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 (!find)
> + return NULL;
> + }
>
> + t = mt76_rx_token_release(dev, token);
> if (!t)
> return NULL;
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xE3520CC91929C8E7.asc
Type: application/pgp-keys
Size: 6868 bytes
Desc: OpenPGP public key
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20250311/3a463285/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20250311/3a463285/attachment.sig>
More information about the linux-arm-kernel
mailing list