The TX page pool optimization significantly improves performance on MT8196 when IOMMU is enabled, but this benefit is platform-specific. Restrict this feature to MT8196 where it has been tested and validated. On MT8196 with IOMMU enabled, DMA mapping overhead increases dramatically compared to IOMMU-disabled configurations: dma_unmap_single() in mt76_connac_txp_skb_unmap_hw() (NAPI context): - IOMMU disabled: 181.25 ns (avg over 20,000 calls) - IOMMU enabled: 5216.19 ns (avg over 21,000 calls) dma_map_single() in mt76_dma_tx_queue_skb() (workqueue context): - IOMMU disabled: 880.20 ns (avg over 20,000 calls) - IOMMU enabled: 2106.65 ns (avg over 20,000 calls) The TX page pool mitigates this overhead by reusing DMA mappings, but should only be enabled on platforms where it has been verified to work correctly. Signed-off-by: Eason Lai -- v2: no change --- drivers/net/wireless/mediatek/mt76/mt792x_dma.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_dma.c b/drivers/net/wireless/mediatek/mt76/mt792x_dma.c index 9f052c56d1b2..833298b5d497 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_dma.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_dma.c @@ -478,6 +478,7 @@ 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; @@ -485,6 +486,13 @@ int mt792x_dma_tx_page_pool_init(struct mt792x_dev *dev) 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++) { -- 2.45.2