From: Eason Lai <eason.lai@mediatek.com>
To: <nbd@nbd.name>, <lorenzo@kernel.org>
Cc: <linux-wireless@vger.kernel.org>,
<linux-mediatek@lists.infradead.org>, <kun.wu@mediatek.com>,
<deren.wu@mediatek.com>, <sean.wang@mediatek.com>,
<quan.zhou@mediatek.com>, <ryder.lee@mediatek.com>,
<leon.yen@mediatek.com>, <litien.chang@mediatek.com>,
<jb.tsai@mediatek.com>, <eason.lai@mediatek.com>
Subject: [PATCH v2 1/3] wifi: mt76: Separate skb and ptr pointers in mt76_txwi_cache
Date: Wed, 29 Jul 2026 10:34:32 +0800 [thread overview]
Message-ID: <20260729023434.1105517-2-eason.lai@mediatek.com> (raw)
In-Reply-To: <20260729023434.1105517-1-eason.lai@mediatek.com>
Split the skb/ptr union into separate skb and ptr fields to
support keeping both the SKB pointer and page pool pointer
at the same time.
Also add skip_unmap flag to tx_info.buf to handle cases where DMA
unmapping should be skipped.
Signed-off-by: Eason Lai <eason.lai@mediatek.com>
---
v2: revert to original naming for less intrusive
---
drivers/net/wireless/mediatek/mt76/dma.c | 15 +++++++++++----
drivers/net/wireless/mediatek/mt76/mt76.h | 6 ++----
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
index 1658c37835cf..57632656eafa 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -43,6 +43,7 @@ mt76_alloc_rxwi(struct mt76_dev *dev)
if (!t)
return NULL;
+ t->skb = NULL;
t->ptr = NULL;
return t;
}
@@ -84,8 +85,11 @@ mt76_get_txwi(struct mt76_dev *dev)
{
struct mt76_txwi_cache *t = __mt76_get_txwi(dev);
- if (t)
+ if (t) {
+ t->skb = NULL;
+ t->ptr = NULL;
return t;
+ }
return mt76_alloc_txwi(dev);
}
@@ -716,6 +720,7 @@ mt76_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,
goto unmap;
tx_info.buf[n].addr = addr;
+ tx_info.buf[n].skip_unmap = false;
tx_info.buf[n++].len = iter->len;
}
tx_info.nbuf = n;
@@ -740,9 +745,11 @@ mt76_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,
tx_info.info, tx_info.skb, t);
unmap:
- for (n--; n > 0; n--)
- dma_unmap_single(dev->dma_dev, tx_info.buf[n].addr,
- tx_info.buf[n].len, DMA_TO_DEVICE);
+ for (n--; n > 0; n--) {
+ if (!tx_info.buf[n].skip_unmap)
+ dma_unmap_single(dev->dma_dev, tx_info.buf[n].addr,
+ tx_info.buf[n].len, DMA_TO_DEVICE);
+ }
free:
#ifdef CONFIG_NL80211_TESTMODE
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 0090e16e8f78..ec679d12a2af 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -446,10 +446,8 @@ struct mt76_txwi_cache {
struct list_head list;
dma_addr_t dma_addr;
- union {
- struct sk_buff *skb;
- void *ptr;
- };
+ struct sk_buff *skb;
+ void *ptr;
u8 qid;
u8 phy_idx;
--
2.45.2
next prev parent reply other threads:[~2026-07-29 2:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 7:55 [PATCH 0/3] Fix TX performance degradation when IOMMU is enabled Eason Lai
2026-07-09 7:55 ` [PATCH 1/3] wifi: mt76: Separate skb and page_pool_buf pointers in mt76_txwi_cache Eason Lai
2026-07-09 8:19 ` Lorenzo Bianconi
2026-07-13 1:57 ` Eason Lai (賴易聖)
2026-07-09 7:55 ` [PATCH 2/3] wifi: mt76: mt792x: Add TX page pool support for IOMMU-enabled systems Eason Lai
2026-07-09 8:27 ` Lorenzo Bianconi
2026-07-13 3:13 ` Eason Lai (賴易聖)
2026-07-09 7:55 ` [PATCH 3/3] wifi: mt76: mt792x: Restrict TX page pool to MT8196 platform Eason Lai
2026-07-29 2:34 ` [PATCH v2 0/3] wifi: mt76: Fix TX performance degradation when IOMMU is enabled Eason Lai
2026-07-29 2:34 ` Eason Lai [this message]
2026-07-29 2:34 ` [PATCH v2 2/3] wifi: mt76: mt792x: Add TX page pool support for IOMMU-enabled systems Eason Lai
2026-07-29 2:34 ` [PATCH v2 3/3] wifi: mt76: mt792x: Restrict TX page pool to MT8196 platform Eason Lai
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=20260729023434.1105517-2-eason.lai@mediatek.com \
--to=eason.lai@mediatek.com \
--cc=deren.wu@mediatek.com \
--cc=jb.tsai@mediatek.com \
--cc=kun.wu@mediatek.com \
--cc=leon.yen@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=litien.chang@mediatek.com \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=quan.zhou@mediatek.com \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox