[PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks
From: Ruizhe Zhou <hidden>
Date: 2026-09-03 08:50:01
Also in:
lkml
A lot of Ethernet drivers set a >32 bit DMA mask and retry with a 32-bit mask if the first call fails. This treats the return value of dma_set_mask_and_coherent() as an indication that the platform requires a narrower DMA width. That is not a correct interpretation of dma_set_mask_and_coherent(). The mask describes the DMA addresses the device can accept and constrains subsequent mappings to that range. A wider mask includes every address permitted by a 32-bit mask, including addresses from a platform that only produces 32-bit DMA addresses. Retrying with 32 bits therefore adds a stricter constraint and cannot correct a failure to establish the wider mask. The DMA API HOWTO explicitly calls this fallback pattern incorrect [1]. See [2] and [3] for details. A net subsystem tree-wide audit found 28 Ethernet drivers with this pattern. This series contains 14 straightforward cases where the fallback can be removed without changing the mask selected for the device. The return-value check is retained. DMA setup errors are still reported and still abort device initialization. The other 14 cases are less straightforward. So I will submit those as a separate follow-up after review of this series concludes and any issues are resolved. Testing was compile-only. No hardware testing was performed. [1] DMA API HOWTO, "DMA addressing capabilities" https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities [2] DMA direct addressability change, commit 91ef26f91417 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=91ef26f914171cf753330f13724fd9142b5b1640 [3] DMA HOWTO correction, commit f7ae20f2fc4e https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f7ae20f2fc4e Best regards, Ruizhe Zhou Ruizhe Zhou (14): net: atlantic: Remove obsolete 32-bit DMA mask fallback net: alx: Remove obsolete 32-bit DMA mask fallback net: systemport: Remove obsolete 32-bit DMA mask fallback bnxt_en: Remove obsolete 32-bit DMA mask fallback enic: Remove obsolete 32-bit DMA mask fallback net: hns3: Remove obsolete 32-bit DMA mask fallback fm10k: Remove obsolete 32-bit DMA mask fallback net/mlx4: Remove obsolete 32-bit DMA mask fallback net/mlx5: Remove obsolete 32-bit DMA mask fallback mlxsw: pci: Remove obsolete 32-bit DMA mask fallback eth: fbnic: Remove obsolete 32-bit DMA mask fallback net: pch_gbe: Remove obsolete 32-bit DMA mask fallback net: renesas: rswitch: Remove obsolete 32-bit DMA mask fallback net: niu: Remove obsolete 32-bit DMA mask fallback .../ethernet/aquantia/atlantic/aq_pci_func.c | 2 -- drivers/net/ethernet/atheros/alx/main.c | 13 +++++-------- drivers/net/ethernet/broadcom/bcmsysport.c | 2 -- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++-- drivers/net/ethernet/cisco/enic/enic_main.c | 19 ++++--------------- .../hisilicon/hns3/hns3pf/hclge_main.c | 9 ++------- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 2 -- drivers/net/ethernet/mellanox/mlx4/main.c | 8 ++------ .../net/ethernet/mellanox/mlx5/core/main.c | 8 ++------ drivers/net/ethernet/mellanox/mlxsw/pci.c | 7 ++----- drivers/net/ethernet/meta/fbnic/fbnic_pci.c | 2 -- .../ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 10 ++++------ drivers/net/ethernet/renesas/rswitch_main.c | 7 ++----- drivers/net/ethernet/sun/niu.c | 10 +++------- 14 files changed, 28 insertions(+), 75 deletions(-) base-commit: e16acadb9a0f7a0f04318e4b3a8e89e8ddd0c905 -- 2.27.0