AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/07/30 07:56 flow patch-triage
1m Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch modifies DMA and TX page pool logic for MediaTek mt76 Wi-Fi drivers (specifically mt7925 and mt792x_dma). The page pool optimization is strictly gated behind `of_machine_is_compatible(\"mediatek,mt8196\")`, which requires the MT8196 SoC. Furthermore, the modified code is exclusively for MMIO/PCIe-based devices, which are not emulated in standard virtualized environments like QEMU/GCE, making it unreachable during fuzzing.",
  "WorthFuzzing": false
}

1/1 2026/07/30 07:56 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 25f5444218a58a423f323ba3647dbfaa663fe911\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Thu Jul 30 07:56:30 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c\nindex 3220418592174..a4dca0e7d557a 100644\n--- a/drivers/net/wireless/mediatek/mt76/dma.c\n+++ b/drivers/net/wireless/mediatek/mt76/dma.c\n@@ -4,6 +4,8 @@\n  */\n \n #include \u003clinux/dma-mapping.h\u003e\n+#include \u003clinux/iommu.h\u003e\n+#include \u003cnet/page_pool/helpers.h\u003e\n #include \"mt76.h\"\n #include \"dma.h\"\n #include \"mt76_connac.h\"\n@@ -43,6 +45,7 @@ mt76_alloc_rxwi(struct mt76_dev *dev)\n \tif (!t)\n \t\treturn NULL;\n \n+\tt-\u003eskb = NULL;\n \tt-\u003eptr = NULL;\n \treturn t;\n }\n@@ -79,16 +82,20 @@ __mt76_get_rxwi(struct mt76_dev *dev)\n \treturn t;\n }\n \n-static struct mt76_txwi_cache *\n+struct mt76_txwi_cache *\n mt76_get_txwi(struct mt76_dev *dev)\n {\n \tstruct mt76_txwi_cache *t = __mt76_get_txwi(dev);\n \n-\tif (t)\n+\tif (t) {\n+\t\tt-\u003eskb = NULL;\n+\t\tt-\u003eptr = NULL;\n \t\treturn t;\n+\t}\n \n \treturn mt76_alloc_txwi(dev);\n }\n+EXPORT_SYMBOL_GPL(mt76_get_txwi);\n \n struct mt76_txwi_cache *\n mt76_get_rxwi(struct mt76_dev *dev)\n@@ -306,7 +313,7 @@ mt76_dma_add_rx_buf(struct mt76_dev *dev, struct mt76_queue *q,\n \treturn idx;\n }\n \n-static int\n+int\n mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,\n \t\t struct mt76_queue_buf *buf, int nbufs, u32 info,\n \t\t struct sk_buff *skb, void *txwi)\n@@ -374,6 +381,7 @@ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,\n \n \treturn idx;\n }\n+EXPORT_SYMBOL_GPL(mt76_dma_add_buf);\n \n static void\n mt76_dma_tx_cleanup_idx(struct mt76_dev *dev, struct mt76_queue *q, int idx,\n@@ -427,6 +435,11 @@ mt76_dma_tx_cleanup(struct mt76_dev *dev, struct mt76_queue *q, bool flush)\n \t\tmt76_queue_tx_complete(dev, q, \u0026entry);\n \n \t\tif (entry.txwi) {\n+\t\t\tif (entry.skb \u0026\u0026 entry.txwi-\u003eptr) {\n+\t\t\t\tmt76_put_page_pool_buf(entry.txwi-\u003eptr, false);\n+\t\t\t\tentry.txwi-\u003eptr = NULL;\n+\t\t\t}\n+\n \t\t\tif (!(dev-\u003edrv-\u003edrv_flags \u0026 MT_DRV_TXWI_NO_FREE))\n \t\t\t\tmt76_put_txwi(dev, entry.txwi);\n \t\t}\n@@ -694,6 +707,7 @@ mt76_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,\n \t\t\tgoto unmap;\n \n \t\ttx_info.buf[n].addr = addr;\n+\t\ttx_info.buf[n].skip_unmap = false;\n \t\ttx_info.buf[n++].len = iter-\u003elen;\n \t}\n \ttx_info.nbuf = n;\n@@ -718,9 +732,11 @@ mt76_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,\n \t\t\t\ttx_info.info, tx_info.skb, t);\n \n unmap:\n-\tfor (n--; n \u003e 0; n--)\n-\t\tdma_unmap_single(dev-\u003edma_dev, tx_info.buf[n].addr,\n-\t\t\t\t tx_info.buf[n].len, DMA_TO_DEVICE);\n+\tfor (n--; n \u003e 0; n--) {\n+\t\tif (!tx_info.buf[n].skip_unmap)\n+\t\t\tdma_unmap_single(dev-\u003edma_dev, tx_info.buf[n].addr,\n+\t\t\t\t\t tx_info.buf[n].len, DMA_TO_DEVICE);\n+\t}\n \n free:\n #ifdef CONFIG_NL80211_TESTMODE\ndiff --git a/drivers/net/wireless/mediatek/mt76/dma.h b/drivers/net/wireless/mediatek/mt76/dma.h\nindex 2a0226c83f3c9..4ef070f426ba3 100644\n--- a/drivers/net/wireless/mediatek/mt76/dma.h\n+++ b/drivers/net/wireless/mediatek/mt76/dma.h\n@@ -170,6 +170,9 @@ int mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q,\n \t\t     bool allow_direct);\n void mt76_dma_queue_reset(struct mt76_dev *dev, struct mt76_queue *q,\n \t\t\t  bool reset_idx);\n+int mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,\n+\t\t     struct mt76_queue_buf *buf, int nbufs, u32 info,\n+\t\t     struct sk_buff *skb, void *txwi);\n \n static inline void\n mt76_dma_reset_tx_queue(struct mt76_dev *dev, struct mt76_queue *q)\ndiff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h\nindex 3822eb8fd88fc..2cd98dde936d3 100644\n--- a/drivers/net/wireless/mediatek/mt76/mt76.h\n+++ b/drivers/net/wireless/mediatek/mt76/mt76.h\n@@ -446,10 +446,8 @@ struct mt76_txwi_cache {\n \tstruct list_head list;\n \tdma_addr_t dma_addr;\n \n-\tunion {\n-\t\tstruct sk_buff *skb;\n-\t\tvoid *ptr;\n-\t};\n+\tstruct sk_buff *skb;\n+\tvoid *ptr;\n \n \tu8 qid;\n \tu8 phy_idx;\n@@ -960,6 +958,8 @@ struct mt76_dev {\n \tint tx_dma_idx[4];\n \tenum mt76_hwrro_mode hwrro_mode;\n \n+\tbool tx_prealloc_enabled;\n+\n \tstruct mt76_worker tx_worker;\n \tstruct napi_struct tx_napi;\n \n@@ -1788,6 +1788,7 @@ mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)\n \n void mt76_put_txwi(struct mt76_dev *dev, struct mt76_txwi_cache *t);\n void mt76_put_rxwi(struct mt76_dev *dev, struct mt76_txwi_cache *t);\n+struct mt76_txwi_cache *mt76_get_txwi(struct mt76_dev *dev);\n struct mt76_txwi_cache *mt76_get_rxwi(struct mt76_dev *dev);\n void mt76_free_pending_rxwi(struct mt76_dev *dev);\n void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,\ndiff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c\nindex fc9f782032ef2..a47e05cd2a076 100644\n--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c\n+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c\n@@ -250,6 +250,12 @@ void mt76_connac_txp_skb_unmap(struct mt76_dev *dev,\n {\n \tstruct mt76_connac_txp_common *txp;\n \n+\tif (t-\u003eptr) {\n+\t\tmt76_put_page_pool_buf(t-\u003eptr, false);\n+\t\tt-\u003eptr = NULL;\n+\t\treturn;\n+\t}\n+\n \ttxp = mt76_connac_txwi_to_txp(dev, t);\n \tif (is_mt76_fw_txp(dev))\n \t\tmt76_connac_txp_skb_unmap_fw(dev, \u0026txp-\u003efw);\ndiff --git a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c\nindex ea64303283edb..1304048a18014 100644\n--- a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c\n+++ b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c\n@@ -295,6 +295,8 @@ static int mt7925_dma_init(struct mt792x_dev *dev)\n \t\t\t  mt792x_poll_tx);\n \tnapi_enable(\u0026dev-\u003emt76.tx_napi);\n \n+\tmt792x_dma_tx_page_pool_init(dev);\n+\n \treturn mt792x_dma_enable(dev);\n }\n \ndiff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h\nindex 70073b43af543..8cf53538e642f 100644\n--- a/drivers/net/wireless/mediatek/mt76/mt792x.h\n+++ b/drivers/net/wireless/mediatek/mt76/mt792x.h\n@@ -445,6 +445,7 @@ void mt792x_dma_cleanup(struct mt792x_dev *dev);\n int mt792x_dma_alloc_queues(struct mt792x_dev *dev,\n \t\t\t    const struct mt792x_dma_layout *layout);\n int mt792x_dma_enable(struct mt792x_dev *dev);\n+int mt792x_dma_tx_page_pool_init(struct mt792x_dev *dev);\n int mt792x_wpdma_reset(struct mt792x_dev *dev, bool force);\n int mt792x_wpdma_reinit_cond(struct mt792x_dev *dev);\n int mt792x_dma_disable(struct mt792x_dev *dev, bool force);\ndiff --git a/drivers/net/wireless/mediatek/mt76/mt792x_dma.c b/drivers/net/wireless/mediatek/mt76/mt792x_dma.c\nindex fc326447c7929..690dd5eddef21 100644\n--- a/drivers/net/wireless/mediatek/mt76/mt792x_dma.c\n+++ b/drivers/net/wireless/mediatek/mt76/mt792x_dma.c\n@@ -3,11 +3,16 @@\n \n #include \u003clinux/module.h\u003e\n #include \u003clinux/firmware.h\u003e\n+#include \u003clinux/iommu.h\u003e\n+#include \u003cnet/page_pool/helpers.h\u003e\n+#include \u003clinux/of.h\u003e\n \n #include \"mt792x.h\"\n #include \"dma.h\"\n #include \"trace.h\"\n \n+static void mt792x_dma_attach(struct mt76_dev *dev);\n+\n irqreturn_t mt792x_irq_handler(int irq, void *dev_instance)\n {\n \tstruct mt792x_dev *dev = dev_instance;\n@@ -92,7 +97,7 @@ int mt792x_dma_alloc_queues(struct mt792x_dev *dev,\n {\n \tint ret;\n \n-\tmt76_dma_attach(\u0026dev-\u003emt76);\n+\tmt792x_dma_attach(\u0026dev-\u003emt76);\n \n \tret = mt792x_dma_disable(dev, true);\n \tif (ret)\n@@ -366,6 +371,276 @@ int mt792x_wpdma_reinit_cond(struct mt792x_dev *dev)\n }\n EXPORT_SYMBOL_GPL(mt792x_wpdma_reinit_cond);\n \n+static int mt792x_create_tx_page_pool(struct mt76_dev *dev, struct mt76_queue *q)\n+{\n+\tstruct page_pool_params pp_params = {\n+\t\t.order = 0,\n+\t\t.flags = 0,\n+\t\t.nid = NUMA_NO_NODE,\n+\t\t.dev = dev-\u003edma_dev,\n+\t};\n+\n+\tpp_params.pool_size = 256;\n+\tpp_params.flags |= PP_FLAG_DMA_MAP;\n+\tpp_params.dma_dir = DMA_BIDIRECTIONAL;\n+\tpp_params.max_len = PAGE_SIZE;\n+\tpp_params.offset = 0;\n+\n+\tq-\u003epage_pool = page_pool_create(\u0026pp_params);\n+\tif (IS_ERR(q-\u003epage_pool)) {\n+\t\tint err = PTR_ERR(q-\u003epage_pool);\n+\n+\t\tq-\u003epage_pool = NULL;\n+\t\tdev_warn(dev-\u003edev, \"Failed to create TX page pool for queue %d (err=%d)\\n\",\n+\t\t\t q-\u003ehw_idx, err);\n+\t\treturn 0;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int mt792x_dma_tx_page_pool_init(struct mt792x_dev *dev)\n+{\n+\tstruct mt76_dev *mdev = \u0026dev-\u003emt76;\n+\tint i, ret, pool_count = 0;\n+\tbool is_mt8196;\n+\n+\tif (!iommu_get_domain_for_dev(mdev-\u003edma_dev))\n+\t\treturn 0;\n+\n+\tif (!mt76_is_mmio(mdev))\n+\t\treturn 0;\n+\n+\tis_mt8196 = of_machine_is_compatible(\"mediatek,mt8196\");\n+\tif (!is_mt8196) {\n+\t\tdev_info(mdev-\u003edev, \"Not MT8196 platform, TX page pool optimization disabled\\n\");\n+\t\treturn 0;\n+\t}\n+\n+\tdev_info(mdev-\u003edev, \"MT8196 platform detected, enabling TX page pool optimization\\n\");\n+\tmdev-\u003etx_prealloc_enabled = true;\n+\n+\tfor (i = 0; i \u003c ARRAY_SIZE(mdev-\u003ephy.q_tx); i++) {\n+\t\tstruct mt76_queue *q = mdev-\u003ephy.q_tx[i];\n+\n+\t\tif (!q)\n+\t\t\tcontinue;\n+\n+\t\tret = mt792x_create_tx_page_pool(mdev, q);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\tif (q-\u003epage_pool)\n+\t\t\tpool_count++;\n+\t}\n+\n+\tif (pool_count \u003e 0)\n+\t\tdev_info(mdev-\u003edev,\n+\t\t\t \"IOMMU enabled, created %d TX page pools\\n\", pool_count);\n+\n+\treturn 0;\n+}\n+EXPORT_SYMBOL_GPL(mt792x_dma_tx_page_pool_init);\n+\n+static void mt792x_dma_tx_page_pool_cleanup(struct mt792x_dev *dev)\n+{\n+\tstruct mt76_dev *mdev = \u0026dev-\u003emt76;\n+\tint i;\n+\n+\tfor (i = 0; i \u003c ARRAY_SIZE(mdev-\u003ephy.q_tx); i++) {\n+\t\tstruct mt76_queue *q = mdev-\u003ephy.q_tx[i];\n+\n+\t\tif (!q || !q-\u003epage_pool)\n+\t\t\tcontinue;\n+\n+\t\tpage_pool_destroy(q-\u003epage_pool);\n+\t\tq-\u003epage_pool = NULL;\n+\t}\n+\n+\tmdev-\u003etx_prealloc_enabled = false;\n+}\n+\n+static void *\n+mt792x_dma_tx_alloc_page_pool_buf(struct mt76_dev *dev, struct mt76_queue *q,\n+\t\t\t\t  struct sk_buff *skb, dma_addr_t *dma_addr,\n+\t\t\t\t  int *buf_len)\n+{\n+\tstruct page *page;\n+\tvoid *buf;\n+\tint len;\n+\tu32 offset;\n+\n+\tif (!q-\u003epage_pool || !dev-\u003etx_prealloc_enabled)\n+\t\treturn NULL;\n+\n+\tlen = skb_headlen(skb);\n+\tif (len \u003e PAGE_SIZE)\n+\t\treturn NULL;\n+\n+\tbuf = mt76_get_page_pool_buf(q, \u0026offset, len);\n+\tif (!buf)\n+\t\treturn NULL;\n+\n+\tpage = virt_to_head_page(buf);\n+\t*dma_addr = page_pool_get_dma_addr(page) + offset;\n+\tif (unlikely(!*dma_addr)) {\n+\t\tdev_warn_ratelimited(dev-\u003edev, \"Page pool returned NULL DMA address\\n\");\n+\t\tmt76_put_page_pool_buf(buf, false);\n+\t\treturn NULL;\n+\t}\n+\n+\t*buf_len = len;\n+\n+\tdma_sync_single_for_cpu(dev-\u003edma_dev, *dma_addr, len, DMA_TO_DEVICE);\n+\tskb_copy_from_linear_data(skb, buf, len);\n+\tdma_sync_single_for_device(dev-\u003edma_dev, *dma_addr, len, DMA_TO_DEVICE);\n+\n+\treturn buf;\n+}\n+\n+static int\n+mt792x_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,\n+\t\t\tenum mt76_txq_id qid, struct sk_buff *skb,\n+\t\t\tstruct mt76_wcid *wcid, struct ieee80211_sta *sta)\n+{\n+\tstruct ieee80211_tx_status status = {\n+\t\t.sta = sta,\n+\t};\n+\tstruct mt76_tx_info tx_info = {\n+\t\t.skb = skb,\n+\t};\n+\tstruct mt76_dev *dev = phy-\u003edev;\n+\tstruct ieee80211_hw *hw;\n+\tint len, n = 0, ret = -ENOMEM;\n+\tstruct mt76_txwi_cache *t;\n+\tstruct sk_buff *iter;\n+\tdma_addr_t addr;\n+\tu8 *txwi;\n+\n+\tif (test_bit(MT76_RESET, \u0026phy-\u003estate))\n+\t\tgoto free_skb;\n+\n+\tt = mt76_get_txwi(dev);\n+\tif (!t)\n+\t\tgoto free_skb;\n+\n+\ttxwi = mt76_get_txwi_ptr(dev, t);\n+\n+\tskb-\u003eprev = NULL;\n+\tskb-\u003enext = NULL;\n+\tif (dev-\u003edrv-\u003edrv_flags \u0026 MT_DRV_TX_ALIGNED4_SKBS)\n+\t\tmt76_insert_hdr_pad(skb);\n+\n+\tlen = skb_headlen(skb);\n+\n+\tif (dev-\u003etx_prealloc_enabled \u0026\u0026 q-\u003epage_pool \u0026\u0026\n+\t    !skb_has_frag_list(skb) \u0026\u0026 !skb_shinfo(skb)-\u003enr_frags) {\n+\t\tvoid *buf;\n+\t\tint pp_len;\n+\n+\t\tbuf = mt792x_dma_tx_alloc_page_pool_buf(dev, q, skb, \u0026addr, \u0026pp_len);\n+\t\tif (buf) {\n+\t\t\tt-\u003eptr = buf;\n+\t\t\tlen = pp_len;\n+\n+\t\t\ttx_info.buf[n].addr = t-\u003edma_addr;\n+\t\t\ttx_info.buf[n++].len = dev-\u003edrv-\u003etxwi_size;\n+\t\t\ttx_info.buf[n].addr = addr;\n+\t\t\ttx_info.buf[n].len = len;\n+\t\t\ttx_info.buf[n].skip_unmap = true;\n+\t\t\tn++;\n+\n+\t\t\tgoto skip_dma_map;\n+\t\t}\n+\t}\n+\n+\taddr = dma_map_single(dev-\u003edma_dev, skb-\u003edata, len, DMA_TO_DEVICE);\n+\tif (unlikely(dma_mapping_error(dev-\u003edma_dev, addr)))\n+\t\tgoto free;\n+\n+\tt-\u003eptr = NULL;\n+\n+\ttx_info.buf[n].addr = t-\u003edma_addr;\n+\ttx_info.buf[n++].len = dev-\u003edrv-\u003etxwi_size;\n+\ttx_info.buf[n].addr = addr;\n+\ttx_info.buf[n++].len = len;\n+\n+skip_dma_map:\n+\tskb_walk_frags(skb, iter) {\n+\t\tif (n == ARRAY_SIZE(tx_info.buf))\n+\t\t\tgoto unmap;\n+\n+\t\taddr = dma_map_single(dev-\u003edma_dev, iter-\u003edata, iter-\u003elen,\n+\t\t\t\t      DMA_TO_DEVICE);\n+\t\tif (unlikely(dma_mapping_error(dev-\u003edma_dev, addr)))\n+\t\t\tgoto unmap;\n+\n+\t\ttx_info.buf[n].addr = addr;\n+\t\ttx_info.buf[n].skip_unmap = false;\n+\t\ttx_info.buf[n++].len = iter-\u003elen;\n+\t}\n+\ttx_info.nbuf = n;\n+\n+\tif (q-\u003equeued + (tx_info.nbuf + 1) / 2 \u003e= q-\u003endesc - 1) {\n+\t\tret = -ENOMEM;\n+\t\tgoto unmap;\n+\t}\n+\n+\tdma_sync_single_for_cpu(dev-\u003edma_dev, t-\u003edma_addr, dev-\u003edrv-\u003etxwi_size,\n+\t\t\t\tDMA_TO_DEVICE);\n+\tret = dev-\u003edrv-\u003etx_prepare_skb(dev, txwi, qid, wcid, sta, \u0026tx_info);\n+\tdma_sync_single_for_device(dev-\u003edma_dev, t-\u003edma_addr, dev-\u003edrv-\u003etxwi_size,\n+\t\t\t\t   DMA_TO_DEVICE);\n+\tif (ret \u003c 0)\n+\t\tgoto unmap;\n+\n+\treturn mt76_dma_add_buf(dev, q, tx_info.buf, tx_info.nbuf,\n+\t\t\t\ttx_info.info, tx_info.skb, t);\n+\n+unmap:\n+\tfor (n--; n \u003e 0; n--) {\n+\t\tif (!tx_info.buf[n].skip_unmap)\n+\t\t\tdma_unmap_single(dev-\u003edma_dev, tx_info.buf[n].addr,\n+\t\t\t\t\t tx_info.buf[n].len, DMA_TO_DEVICE);\n+\t}\n+\n+\tif (t-\u003eptr) {\n+\t\tmt76_put_page_pool_buf(t-\u003eptr, false);\n+\t\tt-\u003eptr = NULL;\n+\t}\n+\n+free:\n+#ifdef CONFIG_NL80211_TESTMODE\n+\tif (mt76_is_testmode_skb(dev, skb, \u0026hw)) {\n+\t\tstruct mt76_phy *phy = hw-\u003epriv;\n+\n+\t\tif (tx_info.skb == phy-\u003etest.tx_skb)\n+\t\t\tphy-\u003etest.tx_done--;\n+\t}\n+#endif\n+\n+\tmt76_put_txwi(dev, t);\n+\n+free_skb:\n+\tstatus.skb = tx_info.skb;\n+\thw = mt76_tx_status_get_hw(dev, tx_info.skb);\n+\tspin_lock_bh(\u0026dev-\u003erx_lock);\n+\tieee80211_tx_status_ext(hw, \u0026status);\n+\tspin_unlock_bh(\u0026dev-\u003erx_lock);\n+\n+\treturn ret;\n+}\n+\n+static struct mt76_queue_ops mt792x_queue_ops;\n+\n+static void mt792x_dma_attach(struct mt76_dev *dev)\n+{\n+\tmt76_dma_attach(dev);\n+\tmt792x_queue_ops = *dev-\u003equeue_ops;\n+\tmt792x_queue_ops.tx_queue_skb = mt792x_dma_tx_queue_skb;\n+\tdev-\u003equeue_ops = \u0026mt792x_queue_ops;\n+}\n+\n int mt792x_dma_disable(struct mt792x_dev *dev, bool force)\n {\n \t/* disable WFDMA0 */\n@@ -431,6 +706,8 @@ void mt792x_dma_cleanup(struct mt792x_dev *dev)\n \t\t MT_WFDMA0_RST_LOGIC_RST);\n \n \tmt76_dma_cleanup(\u0026dev-\u003emt76);\n+\n+\tmt792x_dma_tx_page_pool_cleanup(dev);\n }\n EXPORT_SYMBOL_GPL(mt792x_dma_cleanup);\n \n"
}

2/1 2026/07/30 07:56 agent patch-evaluator
1m Model:
best-expensive

Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch modifies DMA and TX page pool logic for MediaTek mt76 Wi-Fi drivers (specifically mt7925 and mt792x_dma). The page pool optimization is strictly gated behind `of_machine_is_compatible(\"mediatek,mt8196\")`, which requires the MT8196 SoC. Furthermore, the modified code is exclusively for MMIO/PCIe-based devices, which are not emulated in standard virtualized environments like QEMU/GCE, making it unreachable during fuzzing.",
  "WorthFuzzing": false
}

Instruction:
You are an expert Linux kernel maintainer.
Your job is to review a provided patch series and determine
if it makes functional changes to the kernel that should be fuzzed.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively
use your code access tools to examine the actual source code and confirm any assumptions.

Return WorthFuzzing=false if the patch only contains:
- Modifications to Documentation/, Kconfig files, or code comments.
- Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints.
- Changes to numeric constants or macros that do not functionally alter execution flow.
- Code paths that are impossible to reach in virtualized environments like GCE or QEMU,
  even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim).
- Code in vendor-specific PCIe switch, SmartNIC, or GPU drivers (e.g., mlxsw, pds_core, qed,
  ionic, amdgpu) that require physical PCIe hardware cards not emulated in standard QEMU.
- Driver .remove, .shutdown, or pci_unregister_driver teardown callbacks (e.g., igb_remove)
  that are executed only during PCI hot-unplug or sysfs driver unbind operations.

If it modifies reachable core kernel logic, drivers, or architectures, use your code search
tools to verify the code can be executed, then return WorthFuzzing=true.

When returning WorthFuzzing=true, you MUST ALSO:
1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols.
   Avoid listing generic hot-path functions to prevent skewed test distributions.
   Prefer non-static, non-inlined API entrypoint functions over internal static helper functions
   (which are inlined by the compiler and do not have distinct symbol addresses).
2. Identify any specific CONFIG_ options required to properly test this new/modified feature.
   Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions.
   Also check "depends on" lines in Kconfig to include any non-standard parent subsystem configs
   needed for Kbuild to compile the code statically into vmlinux. List them in the EnableConfigs
   output array, and DO NOT add a 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
For your convenience, here is the diff of the changes:
commit 25f5444218a58a423f323ba3647dbfaa663fe911
Author: syz-cluster <triage@syzkaller.com>
Date:   Thu Jul 30 07:56:30 2026 +0000

    syz-cluster: applied patch under review

diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
index 3220418592174..a4dca0e7d557a 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -4,6 +4,8 @@
  */
 
 #include <linux/dma-mapping.h>
+#include <linux/iommu.h>
+#include <net/page_pool/helpers.h>
 #include "mt76.h"
 #include "dma.h"
 #include "mt76_connac.h"
@@ -43,6 +45,7 @@ mt76_alloc_rxwi(struct mt76_dev *dev)
 	if (!t)
 		return NULL;
 
+	t->skb = NULL;
 	t->ptr = NULL;
 	return t;
 }
@@ -79,16 +82,20 @@ __mt76_get_rxwi(struct mt76_dev *dev)
 	return t;
 }
 
-static struct mt76_txwi_cache *
+struct mt76_txwi_cache *
 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);
 }
+EXPORT_SYMBOL_GPL(mt76_get_txwi);
 
 struct mt76_txwi_cache *
 mt76_get_rxwi(struct mt76_dev *dev)
@@ -306,7 +313,7 @@ mt76_dma_add_rx_buf(struct mt76_dev *dev, struct mt76_queue *q,
 	return idx;
 }
 
-static int
+int
 mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,
 		 struct mt76_queue_buf *buf, int nbufs, u32 info,
 		 struct sk_buff *skb, void *txwi)
@@ -374,6 +381,7 @@ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,
 
 	return idx;
 }
+EXPORT_SYMBOL_GPL(mt76_dma_add_buf);
 
 static void
 mt76_dma_tx_cleanup_idx(struct mt76_dev *dev, struct mt76_queue *q, int idx,
@@ -427,6 +435,11 @@ mt76_dma_tx_cleanup(struct mt76_dev *dev, struct mt76_queue *q, bool flush)
 		mt76_queue_tx_complete(dev, q, &entry);
 
 		if (entry.txwi) {
+			if (entry.skb && entry.txwi->ptr) {
+				mt76_put_page_pool_buf(entry.txwi->ptr, false);
+				entry.txwi->ptr = NULL;
+			}
+
 			if (!(dev->drv->drv_flags & MT_DRV_TXWI_NO_FREE))
 				mt76_put_txwi(dev, entry.txwi);
 		}
@@ -694,6 +707,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;
@@ -718,9 +732,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/dma.h b/drivers/net/wireless/mediatek/mt76/dma.h
index 2a0226c83f3c9..4ef070f426ba3 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.h
+++ b/drivers/net/wireless/mediatek/mt76/dma.h
@@ -170,6 +170,9 @@ int mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q,
 		     bool allow_direct);
 void mt76_dma_queue_reset(struct mt76_dev *dev, struct mt76_queue *q,
 			  bool reset_idx);
+int mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,
+		     struct mt76_queue_buf *buf, int nbufs, u32 info,
+		     struct sk_buff *skb, void *txwi);
 
 static inline void
 mt76_dma_reset_tx_queue(struct mt76_dev *dev, struct mt76_queue *q)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 3822eb8fd88fc..2cd98dde936d3 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;
@@ -960,6 +958,8 @@ struct mt76_dev {
 	int tx_dma_idx[4];
 	enum mt76_hwrro_mode hwrro_mode;
 
+	bool tx_prealloc_enabled;
+
 	struct mt76_worker tx_worker;
 	struct napi_struct tx_napi;
 
@@ -1788,6 +1788,7 @@ mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)
 
 void mt76_put_txwi(struct mt76_dev *dev, struct mt76_txwi_cache *t);
 void mt76_put_rxwi(struct mt76_dev *dev, struct mt76_txwi_cache *t);
+struct mt76_txwi_cache *mt76_get_txwi(struct mt76_dev *dev);
 struct mt76_txwi_cache *mt76_get_rxwi(struct mt76_dev *dev);
 void mt76_free_pending_rxwi(struct mt76_dev *dev);
 void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
index fc9f782032ef2..a47e05cd2a076 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
@@ -250,6 +250,12 @@ void mt76_connac_txp_skb_unmap(struct mt76_dev *dev,
 {
 	struct mt76_connac_txp_common *txp;
 
+	if (t->ptr) {
+		mt76_put_page_pool_buf(t->ptr, false);
+		t->ptr = NULL;
+		return;
+	}
+
 	txp = mt76_connac_txwi_to_txp(dev, t);
 	if (is_mt76_fw_txp(dev))
 		mt76_connac_txp_skb_unmap_fw(dev, &txp->fw);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
index ea64303283edb..1304048a18014 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
@@ -295,6 +295,8 @@ static int mt7925_dma_init(struct mt792x_dev *dev)
 			  mt792x_poll_tx);
 	napi_enable(&dev->mt76.tx_napi);
 
+	mt792x_dma_tx_page_pool_init(dev);
+
 	return mt792x_dma_enable(dev);
 }
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h
index 70073b43af543..8cf53538e642f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x.h
+++ b/drivers/net/wireless/mediatek/mt76/mt792x.h
@@ -445,6 +445,7 @@ void mt792x_dma_cleanup(struct mt792x_dev *dev);
 int mt792x_dma_alloc_queues(struct mt792x_dev *dev,
 			    const struct mt792x_dma_layout *layout);
 int mt792x_dma_enable(struct mt792x_dev *dev);
+int mt792x_dma_tx_page_pool_init(struct mt792x_dev *dev);
 int mt792x_wpdma_reset(struct mt792x_dev *dev, bool force);
 int mt792x_wpdma_reinit_cond(struct mt792x_dev *dev);
 int mt792x_dma_disable(struct mt792x_dev *dev, bool force);
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_dma.c b/drivers/net/wireless/mediatek/mt76/mt792x_dma.c
index fc326447c7929..690dd5eddef21 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_dma.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_dma.c
@@ -3,11 +3,16 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/iommu.h>
+#include <net/page_pool/helpers.h>
+#include <linux/of.h>
 
 #include "mt792x.h"
 #include "dma.h"
 #include "trace.h"
 
+static void mt792x_dma_attach(struct mt76_dev *dev);
+
 irqreturn_t mt792x_irq_handler(int irq, void *dev_instance)
 {
 	struct mt792x_dev *dev = dev_instance;
@@ -92,7 +97,7 @@ int mt792x_dma_alloc_queues(struct mt792x_dev *dev,
 {
 	int ret;
 
-	mt76_dma_attach(&dev->mt76);
+	mt792x_dma_attach(&dev->mt76);
 
 	ret = mt792x_dma_disable(dev, true);
 	if (ret)
@@ -366,6 +371,276 @@ int mt792x_wpdma_reinit_cond(struct mt792x_dev *dev)
 }
 EXPORT_SYMBOL_GPL(mt792x_wpdma_reinit_cond);
 
+static int mt792x_create_tx_page_pool(struct mt76_dev *dev, struct mt76_queue *q)
+{
+	struct page_pool_params pp_params = {
+		.order = 0,
+		.flags = 0,
+		.nid = NUMA_NO_NODE,
+		.dev = dev->dma_dev,
+	};
+
+	pp_params.pool_size = 256;
+	pp_params.flags |= PP_FLAG_DMA_MAP;
+	pp_params.dma_dir = DMA_BIDIRECTIONAL;
+	pp_params.max_len = PAGE_SIZE;
+	pp_params.offset = 0;
+
+	q->page_pool = page_pool_create(&pp_params);
+	if (IS_ERR(q->page_pool)) {
+		int err = PTR_ERR(q->page_pool);
+
+		q->page_pool = NULL;
+		dev_warn(dev->dev, "Failed to create TX page pool for queue %d (err=%d)\n",
+			 q->hw_idx, err);
+		return 0;
+	}
+
+	return 0;
+}
+
+int mt792x_dma_tx_page_pool_init(struct mt792x_dev *dev)
+{
+	struct mt76_dev *mdev = &dev->mt76;
+	int i, ret, pool_count = 0;
+	bool is_mt8196;
+
+	if (!iommu_get_domain_for_dev(mdev->dma_dev))
+		return 0;
+
+	if (!mt76_is_mmio(mdev))
+		return 0;
+
+	is_mt8196 = of_machine_is_compatible("mediatek,mt8196");
+	if (!is_mt8196) {
+		dev_info(mdev->dev, "Not MT8196 platform, TX page pool optimization disabled\n");
+		return 0;
+	}
+
+	dev_info(mdev->dev, "MT8196 platform detected, enabling TX page pool optimization\n");
+	mdev->tx_prealloc_enabled = true;
+
+	for (i = 0; i < ARRAY_SIZE(mdev->phy.q_tx); i++) {
+		struct mt76_queue *q = mdev->phy.q_tx[i];
+
+		if (!q)
+			continue;
+
+		ret = mt792x_create_tx_page_pool(mdev, q);
+		if (ret)
+			return ret;
+
+		if (q->page_pool)
+			pool_count++;
+	}
+
+	if (pool_count > 0)
+		dev_info(mdev->dev,
+			 "IOMMU enabled, created %d TX page pools\n", pool_count);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(mt792x_dma_tx_page_pool_init);
+
+static void mt792x_dma_tx_page_pool_cleanup(struct mt792x_dev *dev)
+{
+	struct mt76_dev *mdev = &dev->mt76;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(mdev->phy.q_tx); i++) {
+		struct mt76_queue *q = mdev->phy.q_tx[i];
+
+		if (!q || !q->page_pool)
+			continue;
+
+		page_pool_destroy(q->page_pool);
+		q->page_pool = NULL;
+	}
+
+	mdev->tx_prealloc_enabled = false;
+}
+
+static void *
+mt792x_dma_tx_alloc_page_pool_buf(struct mt76_dev *dev, struct mt76_queue *q,
+				  struct sk_buff *skb, dma_addr_t *dma_addr,
+				  int *buf_len)
+{
+	struct page *page;
+	void *buf;
+	int len;
+	u32 offset;
+
+	if (!q->page_pool || !dev->tx_prealloc_enabled)
+		return NULL;
+
+	len = skb_headlen(skb);
+	if (len > PAGE_SIZE)
+		return NULL;
+
+	buf = mt76_get_page_pool_buf(q, &offset, len);
+	if (!buf)
+		return NULL;
+
+	page = virt_to_head_page(buf);
+	*dma_addr = page_pool_get_dma_addr(page) + offset;
+	if (unlikely(!*dma_addr)) {
+		dev_warn_ratelimited(dev->dev, "Page pool returned NULL DMA address\n");
+		mt76_put_page_pool_buf(buf, false);
+		return NULL;
+	}
+
+	*buf_len = len;
+
+	dma_sync_single_for_cpu(dev->dma_dev, *dma_addr, len, DMA_TO_DEVICE);
+	skb_copy_from_linear_data(skb, buf, len);
+	dma_sync_single_for_device(dev->dma_dev, *dma_addr, len, DMA_TO_DEVICE);
+
+	return buf;
+}
+
+static int
+mt792x_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,
+			enum mt76_txq_id qid, struct sk_buff *skb,
+			struct mt76_wcid *wcid, struct ieee80211_sta *sta)
+{
+	struct ieee80211_tx_status status = {
+		.sta = sta,
+	};
+	struct mt76_tx_info tx_info = {
+		.skb = skb,
+	};
+	struct mt76_dev *dev = phy->dev;
+	struct ieee80211_hw *hw;
+	int len, n = 0, ret = -ENOMEM;
+	struct mt76_txwi_cache *t;
+	struct sk_buff *iter;
+	dma_addr_t addr;
+	u8 *txwi;
+
+	if (test_bit(MT76_RESET, &phy->state))
+		goto free_skb;
+
+	t = mt76_get_txwi(dev);
+	if (!t)
+		goto free_skb;
+
+	txwi = mt76_get_txwi_ptr(dev, t);
+
+	skb->prev = NULL;
+	skb->next = NULL;
+	if (dev->drv->drv_flags & MT_DRV_TX_ALIGNED4_SKBS)
+		mt76_insert_hdr_pad(skb);
+
+	len = skb_headlen(skb);
+
+	if (dev->tx_prealloc_enabled && q->page_pool &&
+	    !skb_has_frag_list(skb) && !skb_shinfo(skb)->nr_frags) {
+		void *buf;
+		int pp_len;
+
+		buf = mt792x_dma_tx_alloc_page_pool_buf(dev, q, skb, &addr, &pp_len);
+		if (buf) {
+			t->ptr = buf;
+			len = pp_len;
+
+			tx_info.buf[n].addr = t->dma_addr;
+			tx_info.buf[n++].len = dev->drv->txwi_size;
+			tx_info.buf[n].addr = addr;
+			tx_info.buf[n].len = len;
+			tx_info.buf[n].skip_unmap = true;
+			n++;
+
+			goto skip_dma_map;
+		}
+	}
+
+	addr = dma_map_single(dev->dma_dev, skb->data, len, DMA_TO_DEVICE);
+	if (unlikely(dma_mapping_error(dev->dma_dev, addr)))
+		goto free;
+
+	t->ptr = NULL;
+
+	tx_info.buf[n].addr = t->dma_addr;
+	tx_info.buf[n++].len = dev->drv->txwi_size;
+	tx_info.buf[n].addr = addr;
+	tx_info.buf[n++].len = len;
+
+skip_dma_map:
+	skb_walk_frags(skb, iter) {
+		if (n == ARRAY_SIZE(tx_info.buf))
+			goto unmap;
+
+		addr = dma_map_single(dev->dma_dev, iter->data, iter->len,
+				      DMA_TO_DEVICE);
+		if (unlikely(dma_mapping_error(dev->dma_dev, addr)))
+			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;
+
+	if (q->queued + (tx_info.nbuf + 1) / 2 >= q->ndesc - 1) {
+		ret = -ENOMEM;
+		goto unmap;
+	}
+
+	dma_sync_single_for_cpu(dev->dma_dev, t->dma_addr, dev->drv->txwi_size,
+				DMA_TO_DEVICE);
+	ret = dev->drv->tx_prepare_skb(dev, txwi, qid, wcid, sta, &tx_info);
+	dma_sync_single_for_device(dev->dma_dev, t->dma_addr, dev->drv->txwi_size,
+				   DMA_TO_DEVICE);
+	if (ret < 0)
+		goto unmap;
+
+	return mt76_dma_add_buf(dev, q, tx_info.buf, tx_info.nbuf,
+				tx_info.info, tx_info.skb, t);
+
+unmap:
+	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);
+	}
+
+	if (t->ptr) {
+		mt76_put_page_pool_buf(t->ptr, false);
+		t->ptr = NULL;
+	}
+
+free:
+#ifdef CONFIG_NL80211_TESTMODE
+	if (mt76_is_testmode_skb(dev, skb, &hw)) {
+		struct mt76_phy *phy = hw->priv;
+
+		if (tx_info.skb == phy->test.tx_skb)
+			phy->test.tx_done--;
+	}
+#endif
+
+	mt76_put_txwi(dev, t);
+
+free_skb:
+	status.skb = tx_info.skb;
+	hw = mt76_tx_status_get_hw(dev, tx_info.skb);
+	spin_lock_bh(&dev->rx_lock);
+	ieee80211_tx_status_ext(hw, &status);
+	spin_unlock_bh(&dev->rx_lock);
+
+	return ret;
+}
+
+static struct mt76_queue_ops mt792x_queue_ops;
+
+static void mt792x_dma_attach(struct mt76_dev *dev)
+{
+	mt76_dma_attach(dev);
+	mt792x_queue_ops = *dev->queue_ops;
+	mt792x_queue_ops.tx_queue_skb = mt792x_dma_tx_queue_skb;
+	dev->queue_ops = &mt792x_queue_ops;
+}
+
 int mt792x_dma_disable(struct mt792x_dev *dev, bool force)
 {
 	/* disable WFDMA0 */
@@ -431,6 +706,8 @@ void mt792x_dma_cleanup(struct mt792x_dev *dev)
 		 MT_WFDMA0_RST_LOGIC_RST);
 
 	mt76_dma_cleanup(&dev->mt76);
+
+	mt792x_dma_tx_page_pool_cleanup(dev);
 }
 EXPORT_SYMBOL_GPL(mt792x_dma_cleanup);
 

3/2 2026/07/30 07:56 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 8837
							output: 42
							thoughts: 1071
						

Thoughts:
**Fuzzing Feasibility Assessment: MT76 Patch**

Okay, let's break this down. My initial thought is to determine if this patch, specifically the one touching `mt7925` and `mt792x_dma.c` within the `mt76` driver, is worth fuzzing. It's adding a TX page pool optimization, which sounds potentially interesting from a performance and, potentially, vulnerability perspective.

The kicker is that this optimization is conditional: it's only enabled if the system reports itself as an MT8196 platform via `of_machine_is_compatible("mediatek,mt8196")`. Hmm, the MT8196. That's a physical SoC, a MediaTek one, and it's unlikely we'll encounter it in standard fuzzing environments like QEMU or GCE, which are my go-to's.

Wait, the `of_machine_is_compatible` check relies on the device tree's root node's "compatible" string. Unless the fuzzer runs with a device tree specifically crafted to *claim* MT8196 compatibility, this code path won't be triggered. That's a huge hurdle. Even if we *did* manage to fake that compatibility, we're dealing with a Wi-Fi driver for the mt7925/mt792x series. This is PCIe/SDIO/USB. Wait, mt7925 is the Wi-Fi chip, not emulated by default. Okay, I recall mac80211_hwsim being emulated, but mt76 drivers talk to real hardware.

The fact that it is a MediaTek Wi-Fi and not a generic chip is a bigger problem. And this patch checks `mt76_is_mmio(mdev)`, meaning it's an MMIO device, almost certainly PCIe or platform-integrated. Syzkaller is not set up to emulate MediaTek PCIe/MMIO Wi-Fi chips, that's just not going to happen.

So, in normal virtualized setups, this code is unreachable.

Let's double check if my assumptions about `mt76` are entirely correct. I remember `mt76` also has USB drivers (mt76x0u, mt76x2u, etc.). Syzkaller *does* have USB fuzzing support. But this patch specifically modifies `mt7925/pci.c` and `mt792x_dma.c`, and the crucial `mt76_is_mmio(mdev)` check confirms it's not a USB device in this case. Also, the `of_machine_is_compatible("mediatek,mt8196")` restriction makes it *very* unlikely to be reached in x86 or ARM64 QEMU unless the DT is meticulously crafted, and even then, there's no virtual hardware for mt7925 PCI.

Let me just verify that the conditional check is indeed what I think it is:
```c
	is_mt8196 = of_machine_is_compatible("mediatek,mt8196");
	if (!is_mt8196) {
		dev_info(mdev->dev, "Not MT8196 platform, TX page pool optimization disabled\n");
		return 0;
	}
```
Yep, it's a hard dependency on the MT8196 SoC.

Therefore, WorthFuzzing = False.

**Reasoning:** The patch adds a TX page pool optimization specifically for the MediaTek MT7925 Wi-Fi driver, and this is strictly gated by the MT8196 SoC via `of_machine_is_compatible("mediatek,mt8196")`. It's targeting hardware that is MMIO/PCIe, which is not emulated in standard virtualized environments like QEMU/GCE. Therefore, this code is unreachable in a fuzzed environment.

Let me quickly double-check if there are *any* other changes. `mt76_get_txwi` and `mt76_dma_add_buf` are exported. `mt76_dma_tx_cleanup` has a small change to free `entry.txwi->ptr` if it exists, and `mt76_dma_tx_queue_skb` has a tiny change for `skip_unmap`. But these are all in `drivers/net/wireless/mediatek/mt76/dma.c`, which seems to be the core DMA code of the mt76 driver. Wait, does the USB side of mt76 use


4/2 2026/07/30 07:56 tool grepper
0m Args:
{
  "Expression": "mt76_dma_tx_cleanup",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76"
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/dma.c=386=static void\ndrivers/net/wireless/mediatek/mt76/dma.c:387:mt76_dma_tx_cleanup_idx(struct mt76_dev *dev, struct mt76_queue *q, int idx,\ndrivers/net/wireless/mediatek/mt76/dma.c-388-\t\t\tstruct mt76_queue_entry *prev_e)\n--\ndrivers/net/wireless/mediatek/mt76/dma.c=417=static void\ndrivers/net/wireless/mediatek/mt76/dma.c:418:mt76_dma_tx_cleanup(struct mt76_dev *dev, struct mt76_queue *q, bool flush)\ndrivers/net/wireless/mediatek/mt76/dma.c-419-{\n--\ndrivers/net/wireless/mediatek/mt76/dma.c-432-\twhile (q-\u003equeued \u003e 0 \u0026\u0026 q-\u003etail != last) {\ndrivers/net/wireless/mediatek/mt76/dma.c:433:\t\tmt76_dma_tx_cleanup_idx(dev, q, q-\u003etail, \u0026entry);\ndrivers/net/wireless/mediatek/mt76/dma.c-434-\t\tmt76_npu_txdesc_cleanup(q, q-\u003etail);\n--\ndrivers/net/wireless/mediatek/mt76/dma.c=1164=static const struct mt76_queue_ops mt76_dma_ops = {\n--\ndrivers/net/wireless/mediatek/mt76/dma.c-1169-\t.tx_queue_skb = mt76_dma_tx_queue_skb,\ndrivers/net/wireless/mediatek/mt76/dma.c:1170:\t.tx_cleanup = mt76_dma_tx_cleanup,\ndrivers/net/wireless/mediatek/mt76/dma.c-1171-\t.rx_queue_init = mt76_dma_rx_queue_init,\n--\ndrivers/net/wireless/mediatek/mt76/dma.c=1183=void mt76_dma_cleanup(struct mt76_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/dma.c-1198-\t\tfor (j = 0; j \u003c ARRAY_SIZE(phy-\u003eq_tx); j++)\ndrivers/net/wireless/mediatek/mt76/dma.c:1199:\t\t\tmt76_dma_tx_cleanup(dev, phy-\u003eq_tx[j], true);\ndrivers/net/wireless/mediatek/mt76/dma.c-1200-\t}\n--\ndrivers/net/wireless/mediatek/mt76/dma.c-1202-\tfor (i = 0; i \u003c ARRAY_SIZE(dev-\u003eq_mcu); i++)\ndrivers/net/wireless/mediatek/mt76/dma.c:1203:\t\tmt76_dma_tx_cleanup(dev, dev-\u003eq_mcu[i], true);\ndrivers/net/wireless/mediatek/mt76/dma.c-1204-\n"
}

5/2 2026/07/30 07:56 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 11813
							output: 40
							thoughts: 48
						

Thoughts:
Okay, here's my interpretation of those thoughts, presented as a personal thought process, as requested:

**Investigating the mt76_dma_tx_cleanup Function**

Alright, I'm diving into the `mt76_dma_tx_cleanup` function here. My immediate thought is, "Where does this fit into the broader picture?" It's clear that it's a part of `mt76_dma_ops`, which is pretty standard for DMA operations within the mt76 framework, but I need to understand its role. I'm wondering about the utilization of this specific object, if it's used by any of the USB drivers or if the driver relies on some other DMA structures. Let's see if this has a USB dependency.



6/2 2026/07/30 07:56 tool grepper
0m Args:
{
  "Expression": "mt76_dma_ops",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76"
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/dma.c=1124=mt76_dma_init(struct mt76_dev *dev,\n--\ndrivers/net/wireless/mediatek/mt76/dma.c-1163-\ndrivers/net/wireless/mediatek/mt76/dma.c:1164:static const struct mt76_queue_ops mt76_dma_ops = {\ndrivers/net/wireless/mediatek/mt76/dma.c-1165-\t.init = mt76_dma_init,\n--\ndrivers/net/wireless/mediatek/mt76/dma.c=1177=void mt76_dma_attach(struct mt76_dev *dev)\ndrivers/net/wireless/mediatek/mt76/dma.c-1178-{\ndrivers/net/wireless/mediatek/mt76/dma.c:1179:\tdev-\u003equeue_ops = \u0026mt76_dma_ops;\ndrivers/net/wireless/mediatek/mt76/dma.c-1180-}\n"
}

7/2 2026/07/30 07:56 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 12362
							output: 40
							thoughts: 16
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience:

**Tracing the DMA Attachment Point**

Okay, so I need to figure out which driver or subsystem is calling `mt76_dma_attach`. That function is crucial for, presumably, initializing DMA engine interaction within the MediaTek wireless driver stack. My first instinct, given my experience with this architecture, is to reach for some static analysis tools – specifically, I'll probably start with `grep` (or my IDE's "find usages" function, depending on the scale). I need to determine the call sites, looking for any immediate callers within the `mt76` tree, and also those in related kernel areas.

I'll be paying attention to the context of the calls. Is it being done during probe? Module initialization? Something within the initialization of a specific hardware instance? A potentially dynamic reconfiguration path? I'll quickly check the relevant header files to refresh my memory on any related data structures passed to that function, to see how the caller populates them.

If `grep` reveals a manageable number of calls, I’ll then want to trace the code path leading to the call, likely going down to the core driver modules, the firmware interactions, and the DMA resource allocation logic. My goal is to understand the control flow, the data dependencies, and the potential error handling that surrounds this DMA attachment. This will guide my understanding of the conditions under which DMA is initialized, and what might influence its success or failure, which in turn informs my thinking about any bugs potentially related to this piece of the puzzle. The deeper I go, the more I can anticipate problems, such as race conditions, memory corruption, or DMA buffer management issues.



8/2 2026/07/30 07:56 tool grepper
0m Args:
{
  "Expression": "mt76_dma_attach",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76"
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/dma.c=1164=static const struct mt76_queue_ops mt76_dma_ops = {\n--\ndrivers/net/wireless/mediatek/mt76/dma.c-1176-\ndrivers/net/wireless/mediatek/mt76/dma.c:1177:void mt76_dma_attach(struct mt76_dev *dev)\ndrivers/net/wireless/mediatek/mt76/dma.c-1178-{\n--\ndrivers/net/wireless/mediatek/mt76/dma.c-1180-}\ndrivers/net/wireless/mediatek/mt76/dma.c:1181:EXPORT_SYMBOL_GPL(mt76_dma_attach);\ndrivers/net/wireless/mediatek/mt76/dma.c-1182-\n--\ndrivers/net/wireless/mediatek/mt76/dma.h=166=int mt76_dma_rx_poll(struct napi_struct *napi, int budget);\ndrivers/net/wireless/mediatek/mt76/dma.h:167:void mt76_dma_attach(struct mt76_dev *dev);\ndrivers/net/wireless/mediatek/mt76/dma.h-168-void mt76_dma_cleanup(struct mt76_dev *dev);\n--\ndrivers/net/wireless/mediatek/mt76/mt7603/dma.c=176=int mt7603_dma_init(struct mt7603_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7603/dma.c-180-\ndrivers/net/wireless/mediatek/mt76/mt7603/dma.c:181:\tmt76_dma_attach(\u0026dev-\u003emt76);\ndrivers/net/wireless/mediatek/mt76/mt7603/dma.c-182-\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/dma.c=220=int mt7615_dma_init(struct mt7615_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/dma.c-225-\ndrivers/net/wireless/mediatek/mt76/mt7615/dma.c:226:\tmt76_dma_attach(\u0026dev-\u003emt76);\ndrivers/net/wireless/mediatek/mt76/mt7615/dma.c-227-\n--\ndrivers/net/wireless/mediatek/mt76/mt76x02_mmio.c=175=int mt76x02_dma_init(struct mt76x02_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt76x02_mmio.c-193-\ndrivers/net/wireless/mediatek/mt76/mt76x02_mmio.c:194:\tmt76_dma_attach(\u0026dev-\u003emt76);\ndrivers/net/wireless/mediatek/mt76/mt76x02_mmio.c-195-\n--\ndrivers/net/wireless/mediatek/mt76/mt7915/dma.c=408=int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)\n--\ndrivers/net/wireless/mediatek/mt76/mt7915/dma.c-416-\ndrivers/net/wireless/mediatek/mt76/mt7915/dma.c:417:\tmt76_dma_attach(\u0026dev-\u003emt76);\ndrivers/net/wireless/mediatek/mt76/mt7915/dma.c-418-\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c=171=static int mt7921_dma_init(struct mt792x_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-195-\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c:196:\tmt76_dma_attach(\u0026dev-\u003emt76);\ndrivers/net/wireless/mediatek/mt76/mt7921/pci.c-197-\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c=636=static void mt792x_dma_attach(struct mt76_dev *dev)\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-637-{\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c:638:\tmt76_dma_attach(dev);\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-639-\tmt792x_queue_ops = *dev-\u003equeue_ops;\n--\ndrivers/net/wireless/mediatek/mt76/mt7996/dma.c=664=int mt7996_dma_init(struct mt7996_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7996/dma.c-673-\ndrivers/net/wireless/mediatek/mt76/mt7996/dma.c:674:\tmt76_dma_attach(\u0026dev-\u003emt76);\ndrivers/net/wireless/mediatek/mt76/mt7996/dma.c-675-\n"
}

9/2 2026/07/30 07:56 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 14291
							output: 38
							thoughts: 145
						

Thoughts:
Okay, let's break this down.

**Analyzing DMA Attachment Points in mt76 Drivers**

Right, so I'm looking at the `mt76` drivers and specifically trying to understand how DMA is handled. The text points out that every single caller of `mt76_dma_attach` appears to be rooted in the MMIO or PCI driver side of things. I'm seeing it in `mt7603`, `mt7615`, `mt76x02_mmio.c`, `mt7915`, `mt7921/pci.c`, `mt792x_dma.c`, and `mt7996`. That's a pretty consistent pattern. This suggests that the direct memory access setup is tightly coupled with those specific hardware interfaces.

Now, the interesting part. It also makes a distinction. The text highlights that USB drivers, specifically like `mt76x02_usb.c`, seem to be avoiding `mt76_dma_attach` and instead utilizing `mt76_usb_attach` or a similar variant. That's a critical difference. It makes sense, of course, because USB has its own DMA protocols, but I need to make sure I'm not missing anything.

Hold on, let me quickly double-check that USB behavior... I should verify the `mt76x02_usb.c` and also the generic `usb.c` files within mt76 just to confirm that this separation is consistent and to see how the USB-specific attachment logic is implemented in this driver framework.



10/2 2026/07/30 07:57 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "mt76_usb_",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76"
}

Results:
{
  "error": "no matches"
}

11/2 2026/07/30 07:57 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 14836
							output: 30
							thoughts: 13
						

Thoughts:
Okay, here's my attempt at summarizing that thought process, tailored for an expert audience:

**Diving into the mt76 USB Drivers**

Right, let's get down to brass tacks. I need to get a handle on the USB driver landscape within the `mt76` framework. Specifically, I'm thinking about the existing drivers. I'm imagining a quick scan through the code, a mental map of what's implemented, what's supported, and where potential overlaps or omissions might be. I need to understand the architectural choices that have been made - is there a unified interface, or are we dealing with a more fragmented approach? Are there any obvious areas for optimization or refactoring I can start to identify, just based on a high-level view? And of course, I'm already anticipating some of the common problem areas, like resource allocation, power management, and interrupt handling. Time to dig in.



12/2 2026/07/30 07:57 tool codesearch-dir-index
0m Args:
{
  "Dir": "drivers/net/wireless/mediatek/mt76"
}

Results:
{
  "Files": [
    "agg-rx.c",
    "channel.c",
    "debugfs.c",
    "dma.c",
    "dma.h",
    "eeprom.c",
    "mac80211.c",
    "mcu.c",
    "mmio.c",
    "mt76.h",
    "mt76_connac.h",
    "mt76_connac2_mac.h",
    "mt76_connac3_mac.c",
    "mt76_connac3_mac.h",
    "mt76_connac_mac.c",
    "mt76_connac_mcu.c",
    "mt76_connac_mcu.h",
    "mt76x02.h",
    "mt76x02_beacon.c",
    "mt76x02_debugfs.c",
    "mt76x02_dfs.c",
    "mt76x02_dfs.h",
    "mt76x02_dma.h",
    "mt76x02_eeprom.c",
    "mt76x02_eeprom.h",
    "mt76x02_mac.c",
    "mt76x02_mac.h",
    "mt76x02_mcu.c",
    "mt76x02_mcu.h",
    "mt76x02_mmio.c",
    "mt76x02_phy.c",
    "mt76x02_phy.h",
    "mt76x02_regs.h",
    "mt76x02_trace.c",
    "mt76x02_trace.h",
    "mt76x02_txrx.c",
    "mt76x02_usb.h",
    "mt76x02_usb_core.c",
    "mt76x02_usb_mcu.c",
    "mt76x02_util.c",
    "mt792x.h",
    "mt792x_acpi_sar.c",
    "mt792x_acpi_sar.h",
    "mt792x_core.c",
    "mt792x_debugfs.c",
    "mt792x_dma.c",
    "mt792x_mac.c",
    "mt792x_regs.h",
    "mt792x_trace.c",
    "mt792x_trace.h",
    "mt792x_usb.c",
    "npu.c",
    "pci.c",
    "scan.c",
    "sdio.c",
    "sdio.h",
    "sdio_txrx.c",
    "testmode.c",
    "testmode.h",
    "trace.c",
    "trace.h",
    "tx.c",
    "usb.c",
    "usb_trace.c",
    "usb_trace.h",
    "util.c",
    "util.h",
    "wed.c"
  ],
  "Subdirs": [
    "mt7603",
    "mt7615",
    "mt76x0",
    "mt76x2",
    "mt7915",
    "mt7921",
    "mt7925",
    "mt7996"
  ]
}

13/2 2026/07/30 07:57 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 15887
							output: 46
							thoughts: 34
						

Thoughts:
Okay, here's my interpretation of those thoughts, tailored for an expert audience, and delivered as a first-person summary:

**Digging into the USB Driver**

Alright, so the initial thought process zeroes in on `usb.c`. Good, that's the likely location for interaction with the USB subsystem. My immediate next step would be to figure out *how* it's interfacing with the DMA engine. I need to understand the data flow, and how the driver handles TX operations.

The real question I need answered right now is: does this driver utilize the `mt76_dma_tx_cleanup` function? That's the crux. If it does, then I have a good starting point for understanding how this driver handles transmission completion and error handling. If not, it means I need to dig deeper into the TX path to identify whatever equivalent mechanism is being used to manage DMA transfers. I am trying to understand the flow for debugging.



14/2 2026/07/30 07:57 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "mt76_dma_tx_cleanup",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76/usb.c"
}

Results:
{
  "error": "no matches"
}

15/2 2026/07/30 07:57 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 16181
							output: 46
							thoughts: 20
						

Thoughts:
Okay, here's my interpretation of that thought process, tailored for an expert audience, and presented as if it were my own internal monologue:

**Investigating DMA Buffer Management in USB Context**

Right, so I'm digging into the USB subsystem and trying to understand its memory management. Specifically, I'm wondering about the interaction with DMA buffers. My immediate question is: does the `usb.c` driver, or more broadly, the USB stack in this context, leverage the `mt76_dma_add_buf` function? It's a key function in a related wireless driver, `mt76`. I'm trying to determine if there's any code reuse here for DMA buffer management, perhaps within the larger USB-related network driver. Knowing that would provide some context as to the underlying DMA implementation being used. Are they relying on something specific to the USB controller or if it's more generic with respect to `mt76`'s DMA implementation? The answer will influence how I approach understanding the data transfer flow and potential optimization strategies.



16/2 2026/07/30 07:57 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "mt76_dma_add_buf",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76/usb.c"
}

Results:
{
  "error": "no matches"
}

17/2 2026/07/30 07:57 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 16484
							output: 42
							thoughts: 143
						

Thoughts:
**Analyzing DMA Driver Changes**

Okay, so looking at these changes, it seems the modifications in `dma.c` are specifically targeted at DMA-based devices, focusing on PCI or MMIO interactions. Then, `mt792x_dma.c` appears to be dedicated to the MT8196 platform. I need to dig a little deeper here, let's see, what is `mt792x_dma_tx_queue_skb` doing in `mt792x_dma.c`? Ah, right, that function is assigned to `tx_queue_skb` within `mt792x_dma_attach`. Now, the important question...is `mt792x_dma_attach` being called by the USB driver? Specifically, is that happening within `mt792x_usb.c`? That's the crux of understanding the interaction here. I need to verify that connection to understand how DMA is being utilized by the MT8196 platform through USB.



18/2 2026/07/30 07:57 tool grepper
0m Args:
{
  "Expression": "mt792x_dma_attach",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76"
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/mt792x_dma.c-13-\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c:14:static void mt792x_dma_attach(struct mt76_dev *dev);\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-15-\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c=95=int mt792x_dma_alloc_queues(struct mt792x_dev *dev,\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-99-\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c:100:\tmt792x_dma_attach(\u0026dev-\u003emt76);\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-101-\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c=634=static struct mt76_queue_ops mt792x_queue_ops;\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-635-\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c:636:static void mt792x_dma_attach(struct mt76_dev *dev)\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-637-{\n"
}

19/2 2026/07/30 07:57 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 17336
							output: 45
							thoughts: 49
						

Thoughts:
Okay, let me think this through.

**Digging into the MT792x DMA Allocation**

Alright, so I'm tracing through this MT792x driver code. The key question I need to answer is about DMA queue allocation. Specifically, I see `mt792x_dma_alloc_queues` being called. My immediate thought is, who's the parent function calling `mt792x_dma_alloc_queues`? That's the crucial link I need to understand the larger context. Also, I see `mt792x_dma_alloc_queues` calls `mt792x_dma_attach`. What does the `attach` function do here?



20/2 2026/07/30 07:57 tool grepper
0m Args:
{
  "Expression": "mt792x_dma_alloc_queues",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76"
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/mt7925/pci.c=255=static int mt7927_dma_init(struct mt792x_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/pci.c-258-\ndrivers/net/wireless/mediatek/mt76/mt7925/pci.c:259:\tret = mt792x_dma_alloc_queues(dev, \u0026mt7927_dma_layout);\ndrivers/net/wireless/mediatek/mt76/mt7925/pci.c-260-\tif (ret)\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/pci.c=282=static int mt7925_dma_init(struct mt792x_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/pci.c-285-\ndrivers/net/wireless/mediatek/mt76/mt7925/pci.c:286:\tret = mt792x_dma_alloc_queues(dev, \u0026mt7925_dma_layout);\ndrivers/net/wireless/mediatek/mt76/mt7925/pci.c-287-\tif (ret)\n--\ndrivers/net/wireless/mediatek/mt76/mt792x.h=444=void mt792x_dma_cleanup(struct mt792x_dev *dev);\ndrivers/net/wireless/mediatek/mt76/mt792x.h:445:int mt792x_dma_alloc_queues(struct mt792x_dev *dev,\ndrivers/net/wireless/mediatek/mt76/mt792x.h-446-\t\t\t    const struct mt792x_dma_layout *layout);\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c=93=EXPORT_SYMBOL_GPL(mt792x_rx_poll_complete);\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-94-\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c:95:int mt792x_dma_alloc_queues(struct mt792x_dev *dev,\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-96-\t\t\t    const struct mt792x_dma_layout *layout)\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-148-}\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c:149:EXPORT_SYMBOL_GPL(mt792x_dma_alloc_queues);\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-150-\n"
}

21/2 2026/07/30 07:57 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 18392
							output: 51
							thoughts: 50
						

Thoughts:
Okay, here's my interpretation of those thoughts, tailored for an expert audience, presented in the first person:

**Initial DMA Queue Allocation Review**

Alright, let's see, `mt792x_dma_alloc_queues` is being called. My immediate assumption is that it's exclusively within the `mt7925/pci.c` driver, which is expected. That's a reasonable starting point, and I'd typically expect this in the PCI initialization path. However, a quick cross-check is in order.

Hmm, wait a second. Before I get too far down this path, I need to verify. What about the `mt7921/pci.c` driver? Is this allocation also happening there? I need to quickly determine if this is handled in a similar fashion, or if there's a variation in DMA queue allocation between these similar, but not identical, MediaTek chipsets. This could be a critical point that the code is structured in the same way, or whether there is a difference that is the source of an issue.



22/2 2026/07/30 07:57 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "mt792x_dma_alloc_queues",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76/mt7921"
}

Results:
{
  "error": "no matches"
}

23/2 2026/07/30 07:57 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 18740
							output: 36
							thoughts: 137
						

Thoughts:
**Investigating MT7925 Driver Usage**

Okay, so I'm looking into the MediaTek drivers and it seems `mt7921/pci.c` bypasses `mt792x_dma_alloc_queues` entirely, directly calling `mt76_dma_attach`. That's interesting. So, it looks like `mt792x_dma_alloc_queues` is *only* used by `mt7925/pci.c`. Right, and `mt7925` is definitely a PCIe device. Hmm, I wonder if that model is emulated in QEMU? No, that's not the case. It's not reachable via USB either, since it is in `pci.c`. Wait, did I misremember? Doesn't `mt7925` *also* have a USB driver? I need to double-check that... Let me look into that possibility.



24/2 2026/07/30 07:57 tool codesearch-dir-index
0m Args:
{
  "Dir": "drivers/net/wireless/mediatek/mt76/mt7925"
}

Results:
{
  "Files": [
    "debugfs.c",
    "init.c",
    "mac.c",
    "mac.h",
    "main.c",
    "mcu.c",
    "mcu.h",
    "mt7925.h",
    "pci.c",
    "pci_mac.c",
    "pci_mcu.c",
    "regd.c",
    "regd.h",
    "regs.h",
    "testmode.c",
    "usb.c"
  ],
  "Subdirs": null
}

25/2 2026/07/30 07:57 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 19253
							output: 55
							thoughts: 43
						

Thoughts:
Okay, here's my take on those thoughts, framed from my perspective as a highly knowledgeable professional:

**Digging into the MT7925 USB Implementation**

Right, so `mt7925` has a `usb.c` file – that's a good starting point. My initial thought is to dive right into the details of *how* the USB interface is managed within that driver. I need to understand the data flow, the resource allocation, the whole shebang. The question that immediately pops into my head is whether or not the driver leverages the `mt792x_dma_alloc_queues` function. That function will likely shed light on the DMA engine usage within the context of USB transfers. Are they using the same allocation scheme for USB DMA queues as they use for other interfaces? Knowing this would allow me to form the beginnings of a model for the mt7925's USB implementation. The answer would quickly suggest the level of integration and shared resource use across the MT7925's communication pathways. Understanding the DMA queue allocation is fundamental to understanding the performance characteristics and potential bottlenecks of the USB subsystem, and I need to explore it to get the full picture.



26/2 2026/07/30 07:57 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "mt792x_dma_alloc_queues",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76/mt7925/usb.c"
}

Results:
{
  "error": "no matches"
}

27/2 2026/07/30 07:57 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 19619
							output: 44
							thoughts: 14
						

Thoughts:
Okay, let's dive into this. Here's my thought process on examining `usb.c` for initialization procedures, presented as if it were my own stream of consciousness:

**Initializing USB - The Hunt Begins!**

Alright, time to get my hands dirty. I need to understand how this USB subsystem gets itself off the ground. My focus is initialization – where does the magic begin? Let's trace it down. Time to open up `usb.c` and start poking around. I'm looking for the obvious clues, the functions or data structures responsible for setting up the USB controller, configuring endpoints, and generally getting the hardware ready to rumble. Let's see what this particular implementation considers essential for the initial boot-up phase. The initialization routine will give the whole game away!



28/2 2026/07/30 07:57 tool grepper
0m Args:
{
  "Expression": "dma",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76/mt7925/usb.c"
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/mt7925/usb.c=80=static int mt7925u_mac_reset(struct mt792x_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c-106-\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c:107:\terr = mt792xu_dma_init(dev, false);\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c-108-\tif (err)\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c=143=static int mt7925u_probe(struct usb_interface *usb_intf,\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c-236-\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c:237:\tret = mt792xu_dma_init(dev, false);\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c-238-\tif (ret)\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c=295=static int mt7925u_resume(struct usb_interface *intf)\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c-317-\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c:318:\tif (reinit || mt792x_dma_need_reinit(dev)) {\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c:319:\t\terr = mt792xu_dma_init(dev, true);\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c-320-\t\tif (err)\n"
}

29/2 2026/07/30 07:57 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 20384
							output: 42
							thoughts: 64
						

Thoughts:
Okay, let's break this down.

**Initial DMA Initialization Review**

Right, so we're starting with `mt792xu_dma_init`. My immediate question is, what's happening underneath the hood here? The key, I suspect, lies in the relationship between this function and the DMA subsystem initialization. Specifically, I need to understand whether `mt792xu_dma_init` delegates to `mt792x_dma_tx_page_pool_init` to manage the page pools, or if it's going with `mt792x_dma_attach` for its internal DMA attachment mechanism. That's the crux of this initialization flow, understanding how the DMA is ultimately configured. I need to trace this next step.



30/2 2026/07/30 07:57 tool grepper
0m Args:
{
  "Expression": "mt792xu_dma_init",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76"
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/mt7921/usb.c=89=static int mt7921u_mac_reset(struct mt792x_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c-119-\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c:120:\terr = mt792xu_dma_init(dev, false);\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c-121-\tif (err)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c=150=static int mt7921u_probe(struct usb_interface *usb_intf,\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c-237-\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c:238:\tret = mt792xu_dma_init(dev, false);\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c-239-\tif (ret)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c=291=static int mt7921u_resume(struct usb_interface *intf)\n--\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c-313-\tif (reinit || mt792x_dma_need_reinit(dev)) {\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c:314:\t\terr = mt792xu_dma_init(dev, true);\ndrivers/net/wireless/mediatek/mt76/mt7921/usb.c-315-\t\tif (err)\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c=80=static int mt7925u_mac_reset(struct mt792x_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c-106-\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c:107:\terr = mt792xu_dma_init(dev, false);\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c-108-\tif (err)\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c=143=static int mt7925u_probe(struct usb_interface *usb_intf,\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c-236-\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c:237:\tret = mt792xu_dma_init(dev, false);\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c-238-\tif (ret)\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c=295=static int mt7925u_resume(struct usb_interface *intf)\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c-318-\tif (reinit || mt792x_dma_need_reinit(dev)) {\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c:319:\t\terr = mt792xu_dma_init(dev, true);\ndrivers/net/wireless/mediatek/mt76/mt7925/usb.c-320-\t\tif (err)\n--\ndrivers/net/wireless/mediatek/mt76/mt792x.h=513=int mt792x_load_firmware(struct mt792x_dev *dev);\n--\ndrivers/net/wireless/mediatek/mt76/mt792x.h-517-#define MT_USB_TYPE_UHW_VENDOR\t(USB_TYPE_VENDOR | 0x1e)\ndrivers/net/wireless/mediatek/mt76/mt792x.h:518:int mt792xu_dma_init(struct mt792x_dev *dev, bool resume);\ndrivers/net/wireless/mediatek/mt76/mt792x.h-519-int mt792xu_mcu_power_on(struct mt792x_dev *dev);\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_usb.c=302=static const struct mt792xu_wfsys_desc mt7925_wfsys_desc = {\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_usb.c-310-\ndrivers/net/wireless/mediatek/mt76/mt792x_usb.c:311:int mt792xu_dma_init(struct mt792x_dev *dev, bool resume)\ndrivers/net/wireless/mediatek/mt76/mt792x_usb.c-312-{\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_usb.c-336-}\ndrivers/net/wireless/mediatek/mt76/mt792x_usb.c:337:EXPORT_SYMBOL_GPL(mt792xu_dma_init);\ndrivers/net/wireless/mediatek/mt76/mt792x_usb.c-338-\n"
}

31/2 2026/07/30 07:57 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 22154
							output: 50
							thoughts: 28
						

Thoughts:
Here's my take on those thoughts, tailored for an expert audience:

**Diving into the MT792X DMA Initialization**

Alright, let's get down to brass tacks and dissect `mt792xu_dma_init` within `mt792x_usb.c`. This is where the rubber meets the road, the low-level DMA setup is always crucial for performance on these USB-based wireless solutions. I need to understand how they're handling descriptor allocation, potential buffer alignment concerns, and, of course, interrupt handling. Specifically, I'm thinking about:

*   **Descriptor Chaining:** How are they organizing the DMA descriptors? Are they using simple ring buffers, or something more complex with scatter-gather lists for fragmented transfers? I'm particularly interested in how they're handling descriptor reuse. Are there any potential race conditions I should look for here?
*   **Buffer Management:** Are they pre-allocating buffers, or dynamically allocating them as needed? What's the strategy for ensuring coherent memory mappings between the host and the device, especially with respect to cache coherency? Any chance of DMA buffer overflows.
*   **Error Handling:** What's the error recovery strategy? Are they employing DMA error handlers? If so, what do they look like? How are they reporting DMA errors? I want to know about potential lock-ups or silent data corruption.
*   **Clock Gating and Power Management:** How's the clock gating handled during low traffic. The DMA engines are a potential power hog, so how is it configured?
*   **Interrupts:** And, finally, the interrupts. Are they using MSI-X or standard interrupts? What's the interrupt coalescing strategy, if any? Are there any potential interrupt latency problems or interrupt storms?
*   **Potential Bottlenecks:** I need to analyze how well the DMA throughput scales with various traffic scenarios and the potential bottlenecks within the architecture that could affect overall system performance.

I'm assuming there's some device-specific hardware involved here. I'm hoping I can get a good idea of its capabilities through this function. Time to dig in and see how they are actually doing it.



32/2 2026/07/30 07:57 tool read-file
0m Args:
{
  "File": "drivers/net/wireless/mediatek/mt76/mt792x_usb.c",
  "FirstLine": 311,
  "LineCount": 30
}

Results:
{
  "Contents": " 311:\tint mt792xu_dma_init(struct mt792x_dev *dev, bool resume)\n 312:\t{\n 313:\t\tint err;\n 314:\t\n 315:\t\tmt792xu_wfdma_init(dev);\n 316:\t\n 317:\t\tmt76_clear(dev, MT_UDMA_WLCFG_0, MT_WL_RX_FLUSH);\n 318:\t\n 319:\t\tmt76_set(dev, MT_UDMA_WLCFG_0,\n 320:\t\t\t MT_WL_RX_EN | MT_WL_TX_EN |\n 321:\t\t\t MT_WL_RX_MPSZ_PAD0 | MT_TICK_1US_EN);\n 322:\t\tmt76_clear(dev, MT_UDMA_WLCFG_0,\n 323:\t\t\t   MT_WL_RX_AGG_TO | MT_WL_RX_AGG_LMT);\n 324:\t\tmt76_clear(dev, MT_UDMA_WLCFG_1, MT_WL_RX_AGG_PKT_LMT);\n 325:\t\n 326:\t\tif (resume)\n 327:\t\t\treturn 0;\n 328:\t\n 329:\t\terr = mt792xu_dma_rx_evt_ep4(dev);\n 330:\t\tif (err)\n 331:\t\t\treturn err;\n 332:\t\n 333:\t\tmt792xu_epctl_rst_opt(dev, false);\n 334:\t\n 335:\t\treturn 0;\n 336:\t}\n 337:\tEXPORT_SYMBOL_GPL(mt792xu_dma_init);\n 338:\t\n 339:\tint mt792xu_wfsys_reset(struct mt792x_dev *dev)\n 340:\t{\n"
}

33/2 2026/07/30 07:57 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 23222
							output: 48
							thoughts: 72
						

Thoughts:
Okay, let me think this through.

**DMA Initialization Sequence Deep Dive**

Alright, I'm digging into this DMA initialization flow for the `mt792xu` driver. The code suggests that `mt792xu_dma_init` function *doesn't* directly call either `mt792x_dma_tx_page_pool_init` or `mt792x_dma_attach`. That's unexpected.  I need to understand the relationship between these functions, and how the DMA system is brought up.

My immediate question now is: where the heck *is* `mt792x_dma_tx_page_pool_init` being called? It's essential for the TX path's page pool setup, so it *must* be called somewhere. I need to trace this back. Is it called in an earlier initialization phase, maybe during probe, or is it handled by another initialization function? This is key for understanding how packets actually get sent out over the air. I'll need to go back up the call stack. Let's start with searching the codebase to find where `mt792x_dma_tx_page_pool_init` is invoked.



34/2 2026/07/30 07:58 tool grepper
0m Args:
{
  "Expression": "mt792x_dma_tx_page_pool_init",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76"
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/mt7925/pci.c=282=static int mt7925_dma_init(struct mt792x_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/pci.c-297-\ndrivers/net/wireless/mediatek/mt76/mt7925/pci.c:298:\tmt792x_dma_tx_page_pool_init(dev);\ndrivers/net/wireless/mediatek/mt76/mt7925/pci.c-299-\n--\ndrivers/net/wireless/mediatek/mt76/mt792x.h=447=int mt792x_dma_enable(struct mt792x_dev *dev);\ndrivers/net/wireless/mediatek/mt76/mt792x.h:448:int mt792x_dma_tx_page_pool_init(struct mt792x_dev *dev);\ndrivers/net/wireless/mediatek/mt76/mt792x.h-449-int mt792x_wpdma_reset(struct mt792x_dev *dev, bool force);\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c=374=static int mt792x_create_tx_page_pool(struct mt76_dev *dev, struct mt76_queue *q)\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-401-\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c:402:int mt792x_dma_tx_page_pool_init(struct mt792x_dev *dev)\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-403-{\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-442-}\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c:443:EXPORT_SYMBOL_GPL(mt792x_dma_tx_page_pool_init);\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-444-\n"
}

35/2 2026/07/30 07:58 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 24237
							output: 40
							thoughts: 205
						

Thoughts:
**Unreachable Code and DMA Considerations**

Okay, so I'm looking at this code and immediately see a problem. This particular function is only called within `mt7925/pci.c`. The fact that it's in a PCI driver is the key here. And since there's no PCI emulation for the mt7925 in QEMU, coupled with that explicit `of_machine_is_compatible("mediatek,mt8196")` check, this code is, as far as I can tell, completely inaccessible during standard fuzzing. It's a dead end, practically speaking.

Let's shift gears quickly and check what else changed. I'm going to look into `dma.c`. Specifically, it seems `mt76_get_txwi` has been modified. Ah, right, they're clearing `t->skb` and `t->ptr` on cached entry returns:

```c
 	if (t) {
+		t->skb = NULL;
+		t->ptr = NULL;
 		return t;
+	}
```

This is interesting, a potential optimization perhaps, or possibly a subtle bug fix. Now the question is, does this function `mt76_get_txwi` get called by any USB drivers? That's the next avenue to explore to understand if this has any implications for my testing. Let me check the call sites...



36/2 2026/07/30 07:58 tool grepper
0m Args:
{
  "Expression": "mt76_get_txwi",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76"
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/dma.c=53=static struct mt76_txwi_cache *\ndrivers/net/wireless/mediatek/mt76/dma.c:54:__mt76_get_txwi(struct mt76_dev *dev)\ndrivers/net/wireless/mediatek/mt76/dma.c-55-{\n--\ndrivers/net/wireless/mediatek/mt76/dma.c=85=struct mt76_txwi_cache *\ndrivers/net/wireless/mediatek/mt76/dma.c:86:mt76_get_txwi(struct mt76_dev *dev)\ndrivers/net/wireless/mediatek/mt76/dma.c-87-{\ndrivers/net/wireless/mediatek/mt76/dma.c:88:\tstruct mt76_txwi_cache *t = __mt76_get_txwi(dev);\ndrivers/net/wireless/mediatek/mt76/dma.c-89-\n--\ndrivers/net/wireless/mediatek/mt76/dma.c-97-}\ndrivers/net/wireless/mediatek/mt76/dma.c:98:EXPORT_SYMBOL_GPL(mt76_get_txwi);\ndrivers/net/wireless/mediatek/mt76/dma.c-99-\n--\ndrivers/net/wireless/mediatek/mt76/dma.c=137=mt76_free_pending_txwi(struct mt76_dev *dev)\n--\ndrivers/net/wireless/mediatek/mt76/dma.c-141-\tlocal_bh_disable();\ndrivers/net/wireless/mediatek/mt76/dma.c:142:\twhile ((t = __mt76_get_txwi(dev)) != NULL) {\ndrivers/net/wireless/mediatek/mt76/dma.c-143-\t\tdma_unmap_single(dev-\u003edma_dev, t-\u003edma_addr, dev-\u003edrv-\u003etxwi_size,\ndrivers/net/wireless/mediatek/mt76/dma.c-144-\t\t\t\t DMA_TO_DEVICE);\ndrivers/net/wireless/mediatek/mt76/dma.c:145:\t\tkfree(mt76_get_txwi_ptr(dev, t));\ndrivers/net/wireless/mediatek/mt76/dma.c-146-\t}\n--\ndrivers/net/wireless/mediatek/mt76/dma.c=653=mt76_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,\n--\ndrivers/net/wireless/mediatek/mt76/dma.c-677-\ndrivers/net/wireless/mediatek/mt76/dma.c:678:\tt = mt76_get_txwi(dev);\ndrivers/net/wireless/mediatek/mt76/dma.c-679-\tif (!t)\n--\ndrivers/net/wireless/mediatek/mt76/dma.c-683-\tt-\u003eqid = qid;\ndrivers/net/wireless/mediatek/mt76/dma.c:684:\ttxwi = mt76_get_txwi_ptr(dev, t);\ndrivers/net/wireless/mediatek/mt76/dma.c-685-\n--\ndrivers/net/wireless/mediatek/mt76/mt76.h=1395=static inline u8 *\ndrivers/net/wireless/mediatek/mt76/mt76.h:1396:mt76_get_txwi_ptr(struct mt76_dev *dev, struct mt76_txwi_cache *t)\ndrivers/net/wireless/mediatek/mt76/mt76.h-1397-{\n--\ndrivers/net/wireless/mediatek/mt76/mt76.h=1790=void mt76_put_rxwi(struct mt76_dev *dev, struct mt76_txwi_cache *t);\ndrivers/net/wireless/mediatek/mt76/mt76.h:1791:struct mt76_txwi_cache *mt76_get_txwi(struct mt76_dev *dev);\ndrivers/net/wireless/mediatek/mt76/mt76.h-1792-struct mt76_txwi_cache *mt76_get_rxwi(struct mt76_dev *dev);\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c=1517=mt7615_txwi_free(struct mt7615_dev *dev, struct mt76_txwi_cache *txwi)\n--\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c-1527-\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c:1528:\ttxwi_data = (__le32 *)mt76_get_txwi_ptr(mdev, txwi);\ndrivers/net/wireless/mediatek/mt76/mt7615/mac.c-1529-\tval = le32_to_cpu(txwi_data[1]);\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac.h=333=mt76_connac_txwi_to_txp(struct mt76_dev *dev, struct mt76_txwi_cache *t)\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac.h-339-\ndrivers/net/wireless/mediatek/mt76/mt76_connac.h:340:\ttxwi = mt76_get_txwi_ptr(dev, t);\ndrivers/net/wireless/mediatek/mt76/mt76_connac.h-341-\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c=1178=void mt76_connac2_txwi_free(struct mt76_dev *dev, struct mt76_txwi_cache *t,\n--\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c-1189-\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c:1190:\ttxwi = (__le32 *)mt76_get_txwi_ptr(dev, t);\ndrivers/net/wireless/mediatek/mt76/mt76_connac_mac.c-1191-\tif (sta) {\n--\ndrivers/net/wireless/mediatek/mt76/mt76x02_mac.c=906=void mt76x02_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e)\n--\ndrivers/net/wireless/mediatek/mt76/mt76x02_mac.c-918-\ndrivers/net/wireless/mediatek/mt76/mt76x02_mac.c:919:\ttxwi_ptr = mt76_get_txwi_ptr(mdev, e-\u003etxwi);\ndrivers/net/wireless/mediatek/mt76/mt76x02_mac.c-920-\ttxwi = (struct mt76x02_txwi *)txwi_ptr;\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/mac.c=1074=void mt7925_txwi_free(struct mt792x_dev *dev, struct mt76_txwi_cache *t,\n--\ndrivers/net/wireless/mediatek/mt76/mt7925/mac.c-1085-\ndrivers/net/wireless/mediatek/mt76/mt7925/mac.c:1086:\ttxwi = (__le32 *)mt76_get_txwi_ptr(mdev, t);\ndrivers/net/wireless/mediatek/mt76/mt7925/mac.c-1087-\tif (sta) {\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c=502=mt792x_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-522-\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c:523:\tt = mt76_get_txwi(dev);\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-524-\tif (!t)\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-526-\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c:527:\ttxwi = mt76_get_txwi_ptr(dev, t);\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-528-\n--\ndrivers/net/wireless/mediatek/mt76/mt7996/mac.c=1243=mt7996_txwi_free(struct mt7996_dev *dev, struct mt76_txwi_cache *t,\n--\ndrivers/net/wireless/mediatek/mt76/mt7996/mac.c-1254-\ndrivers/net/wireless/mediatek/mt76/mt7996/mac.c:1255:\ttxwi = (__le32 *)mt76_get_txwi_ptr(mdev, t);\ndrivers/net/wireless/mediatek/mt76/mt7996/mac.c-1256-\tif (link_sta) {\n"
}

37/2 2026/07/30 07:58 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 27360
							output: 42
							thoughts: 61
						

Thoughts:
Okay, let's see... I'm looking at this `mt76_get_txwi` function. The code seems to suggest that it's *only* ever called from within `dma.c` and `mt792x_dma.c`. Hmm, right, that makes perfect sense. Given those file names, it's pretty clear this is exclusively for devices that utilize DMA—Direct Memory Access—for their data transfers. This function, therefore, is intimately tied to the DMA operation.

**DMA Function Investigation**

Now, the next logical question that pops into my head is, what about `mt76_dma_add_buf`? Since `mt76_get_txwi` is directly concerned with the DMA aspects of data transfer, and given how closely related those functions are likely to be, I'm thinking I should next scrutinize the `mt76_dma_add_buf` function. I will check where that's called from and how it interfaces with the `mt76_get_txwi` function. I think this function is the next logical avenue to explore in my investigation.



38/2 2026/07/30 07:58 tool grepper
0m Args:
{
  "Expression": "mt76_dma_add_buf",
  "PathPrefix": "drivers/net/wireless/mediatek/mt76"
}

Results:
{
  "Output": "drivers/net/wireless/mediatek/mt76/dma.c=316=int\ndrivers/net/wireless/mediatek/mt76/dma.c:317:mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,\ndrivers/net/wireless/mediatek/mt76/dma.c-318-\t\t struct mt76_queue_buf *buf, int nbufs, u32 info,\n--\ndrivers/net/wireless/mediatek/mt76/dma.c-383-}\ndrivers/net/wireless/mediatek/mt76/dma.c:384:EXPORT_SYMBOL_GPL(mt76_dma_add_buf);\ndrivers/net/wireless/mediatek/mt76/dma.c-385-\n--\ndrivers/net/wireless/mediatek/mt76/dma.c=620=mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,\n--\ndrivers/net/wireless/mediatek/mt76/dma.c-640-\tspin_lock_bh(\u0026q-\u003elock);\ndrivers/net/wireless/mediatek/mt76/dma.c:641:\tmt76_dma_add_buf(dev, q, \u0026buf, 1, tx_info, skb, NULL);\ndrivers/net/wireless/mediatek/mt76/dma.c-642-\tmt76_dma_kick_queue(dev, q);\n--\ndrivers/net/wireless/mediatek/mt76/dma.c=653=mt76_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,\n--\ndrivers/net/wireless/mediatek/mt76/dma.c-730-\ndrivers/net/wireless/mediatek/mt76/dma.c:731:\treturn mt76_dma_add_buf(dev, q, tx_info.buf, tx_info.nbuf,\ndrivers/net/wireless/mediatek/mt76/dma.c-732-\t\t\t\ttx_info.info, tx_info.skb, t);\n--\ndrivers/net/wireless/mediatek/mt76/dma.h=171=void mt76_dma_queue_reset(struct mt76_dev *dev, struct mt76_queue *q,\ndrivers/net/wireless/mediatek/mt76/dma.h-172-\t\t\t  bool reset_idx);\ndrivers/net/wireless/mediatek/mt76/dma.h:173:int mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,\ndrivers/net/wireless/mediatek/mt76/dma.h-174-\t\t     struct mt76_queue_buf *buf, int nbufs, u32 info,\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c=502=mt792x_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,\n--\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-596-\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c:597:\treturn mt76_dma_add_buf(dev, q, tx_info.buf, tx_info.nbuf,\ndrivers/net/wireless/mediatek/mt76/mt792x_dma.c-598-\t\t\t\ttx_info.info, tx_info.skb, t);\n"
}

39/2 2026/07/30 07:58 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 28675
							output: 146
							thoughts: 294
						

Thoughts:
**Unreachable Code in Virtualized Environments**

Okay, let me think this through. This patch only touches code within `dma.c` and `mt792x_dma.c`. That immediately tells me this is strictly about DMA-based devices – meaning PCI or MMIO, nothing we'd be emulating in QEMU. Wait a minute, what about the `mac80211_hwsim` module? That's a software simulator, completely separate from the `mt76` stack. And what about `mt76` testmode? That's just a Netlink interface for sending commands. It still needs the underlying hardware to be present and responsive.

Since the hardware isn't available, the driver will never probe, and consequently, the queues won't be allocated in this virtual environment. This means that everything in this patch, the DMA and the TX page pool logic specifically for those MediaTek mt76 Wi-Fi drivers, it is just never going to be executed. And that `of_machine_is_compatible("mediatek,mt8196")` gating is just a cherry on top confirming that we are definitely not going to see any of this. I am going to mark this as WorthFuzzing=false. I am confident that these changes are completely unreachable in any virtualized context we're using for fuzzing.



40/2 2026/07/30 07:58 tool set-results
0m Args:
{
  "EnableConfigs": [],
  "FocusSymbols": [],
  "Reasoning": "The patch modifies DMA and TX page pool logic for MediaTek mt76 Wi-Fi drivers (specifically mt7925 and mt792x_dma). The page pool optimization is strictly gated behind `of_machine_is_compatible(\"mediatek,mt8196\")`, which requires the MT8196 SoC. Furthermore, the modified code is exclusively for MMIO/PCIe-based devices, which are not emulated in standard virtualized environments like QEMU/GCE, making it unreachable during fuzzing.",
  "WorthFuzzing": false
}

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch modifies DMA and TX page pool logic for MediaTek mt76 Wi-Fi drivers (specifically mt7925 and mt792x_dma). The page pool optimization is strictly gated behind `of_machine_is_compatible(\"mediatek,mt8196\")`, which requires the MT8196 SoC. Furthermore, the modified code is exclusively for MMIO/PCIe-based devices, which are not emulated in standard virtualized environments like QEMU/GCE, making it unreachable during fuzzing.",
  "WorthFuzzing": false
}

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)