* [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks
@ 2026-09-03 8:43 Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 01/14] net: atlantic: Remove obsolete 32-bit DMA mask fallback Ruizhe Zhou
` (14 more replies)
0 siblings, 15 replies; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Sukhdeep Singh, Chris Snook, Florian Fainelli,
Michael Chan, Pavan Chebbi, Satish Kharat, Jian Shen, Jijie Shao,
Tony Nguyen, Przemek Kitszel, Tariq Toukan, Saeed Mahameed,
Leon Romanovsky, Mark Bloch, Ido Schimmel, Petr Machata,
Alexander Duyck
Cc: netdev, linux-kernel, Ruizhe Zhou
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH net-next 01/14] net: atlantic: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
@ 2026-09-03 8:43 ` Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 02/14] net: alx: " Ruizhe Zhou
` (13 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Sukhdeep Singh, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, Ruizhe Zhou
The DMA API guarantees support for masks of 32 bits or wider and
explicitly identifies retrying a 32-bit mask after a 64-bit request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure still aborts initialization.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
---
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
index 005d6ef4fc36..04b3ef840b36 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
@@ -125,8 +125,6 @@ static int aq_pci_func_init(struct pci_dev *pdev)
int err;
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
- if (err)
- err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (err) {
err = -ENOSR;
goto err_exit;
--
2.27.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH net-next 02/14] net: alx: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 01/14] net: atlantic: Remove obsolete 32-bit DMA mask fallback Ruizhe Zhou
@ 2026-09-03 8:43 ` Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 03/14] net: systemport: " Ruizhe Zhou
` (12 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Chris Snook, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, Ruizhe Zhou
The DMA API guarantees support for masks of 32 bits or wider and
explicitly identifies retrying a 32-bit mask after a 64-bit request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure is still reported and aborts initialization.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
---
drivers/net/ethernet/atheros/alx/main.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
index ab262e66f986..3ca69fd14a5c 100644
--- a/drivers/net/ethernet/atheros/alx/main.c
+++ b/drivers/net/ethernet/atheros/alx/main.c
@@ -1727,15 +1727,12 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
* shared register for the high 32 bits, so only a single, aligned,
* 4 GB physical address range can be used for descriptors.
*/
- if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
- dev_dbg(&pdev->dev, "DMA to 64-BIT addresses\n");
- } else {
- err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
- if (err) {
- dev_err(&pdev->dev, "No usable DMA config, aborting\n");
- goto out_pci_disable;
- }
+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+ if (err) {
+ dev_err(&pdev->dev, "No usable DMA config, aborting\n");
+ goto out_pci_disable;
}
+ dev_dbg(&pdev->dev, "DMA to 64-BIT addresses\n");
err = pci_request_mem_regions(pdev, alx_drv_name);
if (err) {
--
2.27.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH net-next 03/14] net: systemport: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 01/14] net: atlantic: Remove obsolete 32-bit DMA mask fallback Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 02/14] net: alx: " Ruizhe Zhou
@ 2026-09-03 8:43 ` Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 04/14] bnxt_en: " Ruizhe Zhou
` (11 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Florian Fainelli, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, Ruizhe Zhou, Broadcom internal kernel review list
The DMA API guarantees support for masks of 32 bits or wider and
explicitly identifies retrying a 32-bit mask after a wider request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure is still reported and aborts initialization.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 4d06c6ba6641..4f0ec136b606 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2453,8 +2453,6 @@ static int bcm_sysport_probe(struct platform_device *pdev)
return -EINVAL;
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40));
- if (ret)
- ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (ret) {
dev_err(&pdev->dev, "unable to set DMA mask: %d\n", ret);
return ret;
--
2.27.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH net-next 04/14] bnxt_en: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
` (2 preceding siblings ...)
2026-09-03 8:43 ` [PATCH net-next 03/14] net: systemport: " Ruizhe Zhou
@ 2026-09-03 8:43 ` Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 05/14] enic: " Ruizhe Zhou
` (10 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Michael Chan, Pavan Chebbi, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, Ruizhe Zhou
The DMA API guarantees support for masks of 32 bits or wider and
explicitly identifies retrying a 32-bit mask after a 64-bit request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure is still reported and aborts initialization.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index d59bcca73a2b..1d5cb53f4258 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -15610,8 +15610,8 @@ static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)
goto init_err_disable;
}
- if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) != 0 &&
- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) != 0) {
+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+ if (rc) {
dev_err(&pdev->dev, "System does not support DMA, aborting\n");
rc = -EIO;
goto init_err_release;
--
2.27.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH net-next 05/14] enic: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
` (3 preceding siblings ...)
2026-09-03 8:43 ` [PATCH net-next 04/14] bnxt_en: " Ruizhe Zhou
@ 2026-09-03 8:43 ` Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 06/14] net: hns3: " Ruizhe Zhou
` (9 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Satish Kharat, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, Ruizhe Zhou
The DMA API guarantees support for masks of 32 bits or wider and
explicitly identifies retrying a 32-bit mask after a wider request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure is still reported and aborts initialization.
A successful setup now necessarily uses the 47-bit mask, so remove the
redundant using_dac flag and advertise NETIF_F_HIGHDMA directly.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
---
drivers/net/ethernet/cisco/enic/enic_main.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index 0baef7a120ec..d32fd03bbf6a 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -2991,7 +2991,6 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
struct device *dev = &pdev->dev;
struct net_device *netdev;
struct enic *enic;
- int using_dac = 0;
unsigned int i;
int err;
#ifdef CONFIG_PCI_IOV
@@ -3033,20 +3032,11 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_set_master(pdev);
- /* Query PCI controller on system for DMA addressing
- * limitation for the device. Try 47-bit first, and
- * fail to 32-bit.
- */
-
+ /* The device supports DMA addresses up to 47 bits. */
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(47));
if (err) {
- err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
- if (err) {
- dev_err(dev, "No usable DMA configuration, aborting\n");
- goto err_out_release_regions;
- }
- } else {
- using_dac = 1;
+ dev_err(dev, "No usable DMA configuration, aborting\n");
+ goto err_out_release_regions;
}
/* Map vNIC resources from BAR0-5
@@ -3319,8 +3309,7 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev->hw_features |= NETIF_F_NTUPLE;
#endif
- if (using_dac)
- netdev->features |= NETIF_F_HIGHDMA;
+ netdev->features |= NETIF_F_HIGHDMA;
netdev->priv_flags |= IFF_UNICAST_FLT;
--
2.27.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH net-next 06/14] net: hns3: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
` (4 preceding siblings ...)
2026-09-03 8:43 ` [PATCH net-next 05/14] enic: " Ruizhe Zhou
@ 2026-09-03 8:43 ` Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 07/14] fm10k: " Ruizhe Zhou
` (8 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Jian Shen, Jijie Shao, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, Ruizhe Zhou
The DMA API guarantees support for masks of 32 bits or wider and
explicitly identifies retrying a 32-bit mask after a 64-bit request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure is still reported and aborts initialization.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index e6af939c1c19..e43bd2035edb 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -9156,13 +9156,8 @@ static int hclge_pci_init(struct hclge_dev *hdev)
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (ret) {
- ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
- if (ret) {
- dev_err(&pdev->dev,
- "can't set consistent PCI DMA\n");
- goto err_disable_device;
- }
- dev_warn(&pdev->dev, "set DMA mask to 32 bits\n");
+ dev_err(&pdev->dev, "can't set consistent PCI DMA\n");
+ goto err_disable_device;
}
ret = pci_request_regions(pdev, HCLGE_DRIVER_NAME);
--
2.27.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH net-next 07/14] fm10k: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
` (5 preceding siblings ...)
2026-09-03 8:43 ` [PATCH net-next 06/14] net: hns3: " Ruizhe Zhou
@ 2026-09-03 8:43 ` Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 08/14] net/mlx4: " Ruizhe Zhou
` (7 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, Ruizhe Zhou, intel-wired-lan
The DMA API guarantees support for masks of 32 bits or wider and
explicitly identifies retrying a 32-bit mask after a wider request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure is still reported and aborts initialization.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
---
drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index f5b4d062709a..afe939f8f4ef 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -2111,8 +2111,6 @@ static int fm10k_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(48));
- if (err)
- err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (err) {
dev_err(&pdev->dev,
"DMA configuration failed: %d\n", err);
--
2.27.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH net-next 08/14] net/mlx4: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
` (6 preceding siblings ...)
2026-09-03 8:43 ` [PATCH net-next 07/14] fm10k: " Ruizhe Zhou
@ 2026-09-03 8:43 ` Ruizhe Zhou
2026-09-07 8:37 ` Tariq Toukan
2026-09-03 8:43 ` [PATCH net-next 09/14] net/mlx5: " Ruizhe Zhou
` (6 subsequent siblings)
14 siblings, 1 reply; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Tariq Toukan, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, Ruizhe Zhou, linux-rdma
The DMA API guarantees support for masks of 32 bits or wider and
explicitly identifies retrying a 32-bit mask after a 64-bit request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure is still reported and aborts initialization.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
---
drivers/net/ethernet/mellanox/mlx4/main.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index c851daa5da9f..036135df23bf 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -3863,12 +3863,8 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data,
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (err) {
- dev_warn(&pdev->dev, "Warning: couldn't set 64-bit PCI DMA mask\n");
- err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
- if (err) {
- dev_err(&pdev->dev, "Can't set PCI DMA mask, aborting\n");
- goto err_release_regions;
- }
+ dev_err(&pdev->dev, "Can't set PCI DMA mask, aborting\n");
+ goto err_release_regions;
}
/* Allow large DMA segments, up to the firmware limit of 1 GB */
--
2.27.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH net-next 09/14] net/mlx5: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
` (7 preceding siblings ...)
2026-09-03 8:43 ` [PATCH net-next 08/14] net/mlx4: " Ruizhe Zhou
@ 2026-09-03 8:43 ` Ruizhe Zhou
2026-09-07 8:40 ` Tariq Toukan
2026-09-03 8:43 ` [PATCH net-next 10/14] mlxsw: pci: " Ruizhe Zhou
` (5 subsequent siblings)
14 siblings, 1 reply; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: netdev, linux-kernel, Ruizhe Zhou, linux-rdma
The DMA API guarantees support for masks of 32 bits or wider and
explicitly identifies retrying a 32-bit mask after a 64-bit request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure is still reported and aborts initialization.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
---
drivers/net/ethernet/mellanox/mlx5/core/main.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 5f28d906c35b..3a3b0ec4aad1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -184,12 +184,8 @@ static int set_dma_caps(struct pci_dev *pdev)
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (err) {
- dev_warn(&pdev->dev, "Warning: couldn't set 64-bit PCI DMA mask\n");
- err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
- if (err) {
- dev_err(&pdev->dev, "Can't set PCI DMA mask, aborting\n");
- return err;
- }
+ dev_err(&pdev->dev, "Can't set PCI DMA mask, aborting\n");
+ return err;
}
dma_set_max_seg_size(&pdev->dev, 2u * 1024 * 1024 * 1024);
--
2.27.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH net-next 10/14] mlxsw: pci: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
` (8 preceding siblings ...)
2026-09-03 8:43 ` [PATCH net-next 09/14] net/mlx5: " Ruizhe Zhou
@ 2026-09-03 8:43 ` Ruizhe Zhou
2026-09-04 16:00 ` Petr Machata
2026-09-03 8:43 ` [PATCH net-next 11/14] eth: fbnic: " Ruizhe Zhou
` (4 subsequent siblings)
14 siblings, 1 reply; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Ido Schimmel, Petr Machata, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, Ruizhe Zhou
The DMA API guarantees support for masks of 32 bits or wider and
explicitly identifies retrying a 32-bit mask after a 64-bit request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure is still reported and aborts initialization.
Update the error message to identify the combined streaming and coherent
DMA mask operation.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
---
drivers/net/ethernet/mellanox/mlxsw/pci.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c
index bfe3268dfdc1..dceb69945d26 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/pci.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c
@@ -2429,11 +2429,8 @@ static int mlxsw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (err) {
- err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
- if (err) {
- dev_err(&pdev->dev, "dma_set_mask failed\n");
- goto err_pci_set_dma_mask;
- }
+ dev_err(&pdev->dev, "dma_set_mask_and_coherent failed\n");
+ goto err_pci_set_dma_mask;
}
if (pci_resource_len(pdev, 0) < MLXSW_PCI_BAR0_SIZE) {
--
2.27.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH net-next 11/14] eth: fbnic: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
` (9 preceding siblings ...)
2026-09-03 8:43 ` [PATCH net-next 10/14] mlxsw: pci: " Ruizhe Zhou
@ 2026-09-03 8:43 ` Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 12/14] net: pch_gbe: " Ruizhe Zhou
` (3 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Alexander Duyck, Jakub Kicinski, Andrew Lunn, David S. Miller,
Eric Dumazet, Paolo Abeni
Cc: netdev, linux-kernel, Ruizhe Zhou, kernel-team
The DMA API guarantees support for masks of 32 bits or wider and
explicitly identifies retrying a 32-bit mask after a wider request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure is still reported and aborts initialization.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
---
drivers/net/ethernet/meta/fbnic/fbnic_pci.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
index 8b9bc9e8ea56..47d5dfbf3368 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
@@ -276,8 +276,6 @@ static int fbnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(46));
- if (err)
- err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (err) {
dev_err(&pdev->dev, "DMA configuration failed: %d\n", err);
return err;
--
2.27.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH net-next 12/14] net: pch_gbe: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
` (10 preceding siblings ...)
2026-09-03 8:43 ` [PATCH net-next 11/14] eth: fbnic: " Ruizhe Zhou
@ 2026-09-03 8:43 ` Ruizhe Zhou
2026-09-08 11:46 ` netdev-bot+sashiko
2026-09-03 8:43 ` [PATCH net-next 13/14] net: renesas: rswitch: " Ruizhe Zhou
` (2 subsequent siblings)
14 siblings, 1 reply; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, Ruizhe Zhou
The DMA API guarantees support for masks of 32 bits or wider and
explicitly identifies retrying a 32-bit mask after a 64-bit request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure is still reported and aborts initialization.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
---
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 88c5c52e0e38..ba3d10f9aec6 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -2504,12 +2504,10 @@ static int pch_gbe_probe(struct pci_dev *pdev,
if (ret)
return ret;
- if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
- ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
- if (ret) {
- dev_err(&pdev->dev, "ERR: No usable DMA configuration, aborting\n");
- return ret;
- }
+ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+ if (ret) {
+ dev_err(&pdev->dev, "ERR: No usable DMA configuration, aborting\n");
+ return ret;
}
ret = pcim_iomap_regions(pdev, 1 << PCH_GBE_PCI_BAR, pci_name(pdev));
--
2.27.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH net-next 13/14] net: renesas: rswitch: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
` (11 preceding siblings ...)
2026-09-03 8:43 ` [PATCH net-next 12/14] net: pch_gbe: " Ruizhe Zhou
@ 2026-09-03 8:43 ` Ruizhe Zhou
2026-09-03 9:43 ` Geert Uytterhoeven
2026-09-03 8:43 ` [PATCH net-next 14/14] net: niu: " Ruizhe Zhou
2026-09-08 23:50 ` [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks patchwork-bot+netdevbpf
14 siblings, 1 reply; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, Ruizhe Zhou, Yoshihiro Shimoda, linux-renesas-soc
The DMA API guarantees support for masks of 32 bits or wider and
explicitly identifies retrying a 32-bit mask after a wider request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure still aborts initialization.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
---
drivers/net/ethernet/renesas/rswitch_main.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/renesas/rswitch_main.c b/drivers/net/ethernet/renesas/rswitch_main.c
index 755232994fcc..64b821ca02f8 100644
--- a/drivers/net/ethernet/renesas/rswitch_main.c
+++ b/drivers/net/ethernet/renesas/rswitch_main.c
@@ -2162,11 +2162,8 @@ static int renesas_eth_sw_probe(struct platform_device *pdev)
return -ENOMEM;
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40));
- if (ret < 0) {
- ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
- if (ret < 0)
- return ret;
- }
+ if (ret)
+ return ret;
priv->gwca.index = AGENT_INDEX_GWCA;
priv->gwca.num_queues = min(RSWITCH_NUM_PORTS * NUM_QUEUES_PER_NDEV,
--
2.27.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH net-next 14/14] net: niu: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
` (12 preceding siblings ...)
2026-09-03 8:43 ` [PATCH net-next 13/14] net: renesas: rswitch: " Ruizhe Zhou
@ 2026-09-03 8:43 ` Ruizhe Zhou
2026-09-08 23:50 ` [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks patchwork-bot+netdevbpf
14 siblings, 0 replies; 21+ messages in thread
From: Ruizhe Zhou @ 2026-09-03 8:43 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, Ruizhe Zhou
The DMA API guarantees support for masks of 32 bits or wider and
explicitly identifies retrying a 32-bit mask after a wider request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure is still reported and aborts initialization.
A successful setup now necessarily uses the 44-bit mask, so advertise
NETIF_F_HIGHDMA directly after checking the result.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
---
drivers/net/ethernet/sun/niu.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index 54dd7281191d..c74a97fe5464 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -9835,15 +9835,11 @@ static int niu_pci_init_one(struct pci_dev *pdev,
PCI_EXP_DEVCTL_RELAX_EN);
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(44));
- if (!err)
- dev->features |= NETIF_F_HIGHDMA;
if (err) {
- err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
- if (err) {
- dev_err(&pdev->dev, "No usable DMA configuration, aborting\n");
- goto err_out_release_parent;
- }
+ dev_err(&pdev->dev, "No usable DMA configuration, aborting\n");
+ goto err_out_release_parent;
}
+ dev->features |= NETIF_F_HIGHDMA;
niu_set_basic_features(dev);
--
2.27.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH net-next 13/14] net: renesas: rswitch: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 ` [PATCH net-next 13/14] net: renesas: rswitch: " Ruizhe Zhou
@ 2026-09-03 9:43 ` Geert Uytterhoeven
0 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2026-09-03 9:43 UTC (permalink / raw)
To: Ruizhe Zhou
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, linux-kernel, Yoshihiro Shimoda,
linux-renesas-soc
Hi Ruizhe,
Thanks for your patch!
On Thu, 3 Sept 2026 at 11:27, Ruizhe Zhou <zhouruizhe@resnics.com> wrote:
> The DMA API guarantees support for masks of 32 bits or wider and
Really?
> explicitly identifies retrying a 32-bit mask after a wider request as
> incorrect:
> https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
AFAIUI, that is only true iff the wider request is DMA_BIT_MASK(64).
> Remove the obsolete fallback while retaining the error check so that a
> genuine DMA setup failure still aborts initialization.
Have you tested this on actual hardware, with/without IOMMU support?
> Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
> ---
> drivers/net/ethernet/renesas/rswitch_main.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/renesas/rswitch_main.c b/drivers/net/ethernet/renesas/rswitch_main.c
> index 755232994fcc..64b821ca02f8 100644
> --- a/drivers/net/ethernet/renesas/rswitch_main.c
> +++ b/drivers/net/ethernet/renesas/rswitch_main.c
> @@ -2162,11 +2162,8 @@ static int renesas_eth_sw_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40));
> - if (ret < 0) {
> - ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> - if (ret < 0)
> - return ret;
> - }
> + if (ret)
> + return ret;
>
> priv->gwca.index = AGENT_INDEX_GWCA;
> priv->gwca.num_queues = min(RSWITCH_NUM_PORTS * NUM_QUEUES_PER_NDEV,
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH net-next 10/14] mlxsw: pci: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 ` [PATCH net-next 10/14] mlxsw: pci: " Ruizhe Zhou
@ 2026-09-04 16:00 ` Petr Machata
0 siblings, 0 replies; 21+ messages in thread
From: Petr Machata @ 2026-09-04 16:00 UTC (permalink / raw)
To: Ruizhe Zhou
Cc: Ido Schimmel, Petr Machata, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
Ruizhe Zhou <zhouruizhe@resnics.com> writes:
> The DMA API guarantees support for masks of 32 bits or wider and
> explicitly identifies retrying a 32-bit mask after a 64-bit request as
> incorrect:
> https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
>
> Remove the obsolete fallback while retaining the error check so that a
> genuine DMA setup failure is still reported and aborts initialization.
> Update the error message to identify the combined streaming and coherent
> DMA mask operation.
>
> Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
Doco: "dma_set_mask_and_coherent() never return fail when DMA_BIT_MASK(64)."
Checking code, the only way that I see that dma_set_mask_and_coherent()
returns error is if dma_supported() returns 0. This could happen if:
- use_dma_iommu() fails, but that doesn't consider mask, so retrying
with 32 doesn't help.
- if ops->dma_supported fails. But I checked several architectures where
mlxsw could even theoretically be relevant, and it's basically always
some mask > X type of expression, so retrying with a smaller mask does
not help.
- The fallback of dma_direct_supported() is like that as well.
So yeah. I think this is correct.
Reviewed-by: Petr Machata <petrm@nvidia.com>
> ---
> drivers/net/ethernet/mellanox/mlxsw/pci.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c
> index bfe3268dfdc1..dceb69945d26 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c
> @@ -2429,11 +2429,8 @@ static int mlxsw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>
> err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
> if (err) {
> - err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
> - if (err) {
> - dev_err(&pdev->dev, "dma_set_mask failed\n");
> - goto err_pci_set_dma_mask;
> - }
> + dev_err(&pdev->dev, "dma_set_mask_and_coherent failed\n");
> + goto err_pci_set_dma_mask;
> }
>
> if (pci_resource_len(pdev, 0) < MLXSW_PCI_BAR0_SIZE) {
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH net-next 08/14] net/mlx4: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 ` [PATCH net-next 08/14] net/mlx4: " Ruizhe Zhou
@ 2026-09-07 8:37 ` Tariq Toukan
0 siblings, 0 replies; 21+ messages in thread
From: Tariq Toukan @ 2026-09-07 8:37 UTC (permalink / raw)
To: Ruizhe Zhou, Tariq Toukan, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, linux-rdma
On 03/09/2026 11:43, Ruizhe Zhou wrote:
> The DMA API guarantees support for masks of 32 bits or wider and
> explicitly identifies retrying a 32-bit mask after a 64-bit request as
> incorrect:
> https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
>
> Remove the obsolete fallback while retaining the error check so that a
> genuine DMA setup failure is still reported and aborts initialization.
>
You also switched dev_warn into dev_err.
Patch LGTM.
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
> Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
> ---
> drivers/net/ethernet/mellanox/mlx4/main.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
> index c851daa5da9f..036135df23bf 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/main.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/main.c
> @@ -3863,12 +3863,8 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data,
>
> err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
> if (err) {
> - dev_warn(&pdev->dev, "Warning: couldn't set 64-bit PCI DMA mask\n");
> - err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> - if (err) {
> - dev_err(&pdev->dev, "Can't set PCI DMA mask, aborting\n");
> - goto err_release_regions;
> - }
> + dev_err(&pdev->dev, "Can't set PCI DMA mask, aborting\n");
> + goto err_release_regions;
> }
>
> /* Allow large DMA segments, up to the firmware limit of 1 GB */
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH net-next 09/14] net/mlx5: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 ` [PATCH net-next 09/14] net/mlx5: " Ruizhe Zhou
@ 2026-09-07 8:40 ` Tariq Toukan
0 siblings, 0 replies; 21+ messages in thread
From: Tariq Toukan @ 2026-09-07 8:40 UTC (permalink / raw)
To: Ruizhe Zhou, Saeed Mahameed, Leon Romanovsky, Mark Bloch,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: netdev, linux-kernel, linux-rdma
On 03/09/2026 11:43, Ruizhe Zhou wrote:
> The DMA API guarantees support for masks of 32 bits or wider and
> explicitly identifies retrying a 32-bit mask after a 64-bit request as
> incorrect:
> https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
>
> Remove the obsolete fallback while retaining the error check so that a
> genuine DMA setup failure is still reported and aborts initialization.
>
> Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/main.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> index 5f28d906c35b..3a3b0ec4aad1 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> @@ -184,12 +184,8 @@ static int set_dma_caps(struct pci_dev *pdev)
>
> err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
> if (err) {
> - dev_warn(&pdev->dev, "Warning: couldn't set 64-bit PCI DMA mask\n");
> - err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> - if (err) {
> - dev_err(&pdev->dev, "Can't set PCI DMA mask, aborting\n");
> - return err;
> - }
> + dev_err(&pdev->dev, "Can't set PCI DMA mask, aborting\n");
> + return err;
> }
>
> dma_set_max_seg_size(&pdev->dev, 2u * 1024 * 1024 * 1024);
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH net-next 12/14] net: pch_gbe: Remove obsolete 32-bit DMA mask fallback
2026-09-03 8:43 ` [PATCH net-next 12/14] net: pch_gbe: " Ruizhe Zhou
@ 2026-09-08 11:46 ` netdev-bot+sashiko
0 siblings, 0 replies; 21+ messages in thread
From: netdev-bot+sashiko @ 2026-09-08 11:46 UTC (permalink / raw)
To: zhouruizhe
Cc: michael.chan, pavan.chebbi, andrew+netdev, davem, edumazet, kuba,
pabeni, netdev, linux-kernel
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider:
Critical: 0 · High: 1 · Medium: 0 · Low: 0
- [High] pch_gbe (Intel EG20T / OKI ML7223/ML7831 GbE) is a 32-bit-DMA-
only controller, but after this patch `pch_gbe_probe()` requests…
--
net: pch_gbe: Remove obsolete 32-bit DMA mask fallback
This removes the DMA_BIT_MASK(32) retry in pch_gbe_probe() and keeps only
the DMA_BIT_MASK(64) request, on the grounds that the DMA API guarantees
masks of 32 bits or wider and that retrying a narrower mask is incorrect.
The error check and dev_err() are retained.
> diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> index 88c5c52e0e38..ba3d10f9aec6 100644
> --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> @@ -2504,12 +2504,10 @@ static int pch_gbe_probe(struct pci_dev *pdev,
> if (ret)
> return ret;
>
> - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
> - ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> - if (ret) {
> - dev_err(&pdev->dev, "ERR: No usable DMA configuration, aborting\n");
> - return ret;
> - }
> + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
> + if (ret) {
> + dev_err(&pdev->dev, "ERR: No usable DMA configuration, aborting\n");
> + return ret;
> }
[Severity: High]
Can this device actually address 64 bits? After this change the 64-bit
request is the only mask pch_gbe_probe() ever installs, and the fallback
that used to leave the device with a 32-bit mask is gone.
The descriptors in pch_gbe.h only carry a 32-bit address:
struct pch_gbe_rx_desc {
u32 buffer_addr;
...
};
struct pch_gbe_tx_desc {
u32 buffer_addr;
...
};
and the ring registers in struct pch_gbe_regs are 32-bit with no
companion high-address register:
u32 RX_DSC_BASE;
u32 RX_DSC_SIZE;
...
u32 TX_DSC_BASE;
pch_gbe_configure_tx() narrows the coherent ring address into a u32 local
and programs it with one iowrite32():
u32 tdba, tdlen, dctrl;
...
tdba = adapter->tx_ring->dma;
tdlen = adapter->tx_ring->size - 0x10;
iowrite32(tdba, &hw->reg->TX_DSC_BASE);
iowrite32(tdlen, &hw->reg->TX_DSC_SIZE);
iowrite32(tdba, &hw->reg->TX_DSC_SW_P);
pch_gbe_configure_rx() does the same with rdba, and the per-packet paths
store dma_addr_t straight into the u32 descriptor fields:
pch_gbe_tx_queue():
tx_desc->buffer_addr = (buffer_info->dma);
pch_gbe_alloc_rx_buffers():
rx_desc->buffer_addr = (buffer_info->dma);
There is no lower_32_bits()/upper_32_bits() handling anywhere in the
driver. With a 64-bit mask declared, dma_alloc_coherent() and
dma_map_single() may return addresses above 4 GB, which are then silently
truncated into these u32 fields and registers. Does that leave the MAC
bus-mastering to the truncated address, writing received frames into
unrelated memory, transmitting unrelated memory, or walking a bogus
descriptor ring, with nothing reported?
Since dma_direct_supported() accepts any mask of 32 bits or wider, the
64-bit request always succeeds under direct mapping, so this looks like
the live path rather than a theoretical one. The driver is buildable for
MIPS_GENERIC and X86_32 (dma_addr_t is 64-bit with PAE) as well as
COMPILE_TEST:
depends on PCI && (MIPS_GENERIC || X86_32 || COMPILE_TEST)
Would requesting DMA_BIT_MASK(32) here, i.e. the width the hardware
actually implements, be the right way to apply the cited
dma-api-howto guidance instead of keeping the 64-bit request?
One smaller point on the changelog. It says the error check is retained
"so that a genuine DMA setup failure is still reported and aborts
initialization", but by the same premise quoted just above it ("The DMA
API guarantees support for masks of 32 bits or wider"), can that
dev_err()/return ret branch ever be taken for a mask of 32 bits or wider?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260903084339.870562-1-zhouruizhe%40resnics.com
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
` (13 preceding siblings ...)
2026-09-03 8:43 ` [PATCH net-next 14/14] net: niu: " Ruizhe Zhou
@ 2026-09-08 23:50 ` patchwork-bot+netdevbpf
14 siblings, 0 replies; 21+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-08 23:50 UTC (permalink / raw)
To: =?utf-8?b?5ZGo552/5ZOyIDx6aG91cnVpemhlQHJlc25pY3MuY29tPg==?=
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, sukhdeeps,
chris.snook, florian.fainelli, michael.chan, pavan.chebbi,
satishkh, shenjian15, shaojijie, anthony.l.nguyen,
przemyslaw.kitszel, tariqt, saeedm, leon, mbloch, idosch, petrm,
alexanderduyck, netdev, linux-kernel
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 3 Sep 2026 16:43:25 +0800 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [net-next,01/14] net: atlantic: Remove obsolete 32-bit DMA mask fallback
https://git.kernel.org/netdev/net-next/c/78113e4c4002
- [net-next,02/14] net: alx: Remove obsolete 32-bit DMA mask fallback
https://git.kernel.org/netdev/net-next/c/fc5a6ed4992c
- [net-next,03/14] net: systemport: Remove obsolete 32-bit DMA mask fallback
https://git.kernel.org/netdev/net-next/c/12a924aebcf5
- [net-next,04/14] bnxt_en: Remove obsolete 32-bit DMA mask fallback
https://git.kernel.org/netdev/net-next/c/f60b86ea8864
- [net-next,05/14] enic: Remove obsolete 32-bit DMA mask fallback
https://git.kernel.org/netdev/net-next/c/0b861b6ee2ec
- [net-next,06/14] net: hns3: Remove obsolete 32-bit DMA mask fallback
https://git.kernel.org/netdev/net-next/c/e7d0cff7773b
- [net-next,07/14] fm10k: Remove obsolete 32-bit DMA mask fallback
https://git.kernel.org/netdev/net-next/c/f7cf8452c58f
- [net-next,08/14] net/mlx4: Remove obsolete 32-bit DMA mask fallback
https://git.kernel.org/netdev/net-next/c/ee95313d1aef
- [net-next,09/14] net/mlx5: Remove obsolete 32-bit DMA mask fallback
https://git.kernel.org/netdev/net-next/c/7b85fba09ebe
- [net-next,10/14] mlxsw: pci: Remove obsolete 32-bit DMA mask fallback
https://git.kernel.org/netdev/net-next/c/68161cab4810
- [net-next,11/14] eth: fbnic: Remove obsolete 32-bit DMA mask fallback
https://git.kernel.org/netdev/net-next/c/453248082a5d
- [net-next,12/14] net: pch_gbe: Remove obsolete 32-bit DMA mask fallback
https://git.kernel.org/netdev/net-next/c/85996f110325
- [net-next,13/14] net: renesas: rswitch: Remove obsolete 32-bit DMA mask fallback
https://git.kernel.org/netdev/net-next/c/0a8bc1ad90ad
- [net-next,14/14] net: niu: Remove obsolete 32-bit DMA mask fallback
https://git.kernel.org/netdev/net-next/c/03011820f02f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2026-09-08 23:51 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-03 8:43 [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 01/14] net: atlantic: Remove obsolete 32-bit DMA mask fallback Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 02/14] net: alx: " Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 03/14] net: systemport: " Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 04/14] bnxt_en: " Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 05/14] enic: " Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 06/14] net: hns3: " Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 07/14] fm10k: " Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 08/14] net/mlx4: " Ruizhe Zhou
2026-09-07 8:37 ` Tariq Toukan
2026-09-03 8:43 ` [PATCH net-next 09/14] net/mlx5: " Ruizhe Zhou
2026-09-07 8:40 ` Tariq Toukan
2026-09-03 8:43 ` [PATCH net-next 10/14] mlxsw: pci: " Ruizhe Zhou
2026-09-04 16:00 ` Petr Machata
2026-09-03 8:43 ` [PATCH net-next 11/14] eth: fbnic: " Ruizhe Zhou
2026-09-03 8:43 ` [PATCH net-next 12/14] net: pch_gbe: " Ruizhe Zhou
2026-09-08 11:46 ` netdev-bot+sashiko
2026-09-03 8:43 ` [PATCH net-next 13/14] net: renesas: rswitch: " Ruizhe Zhou
2026-09-03 9:43 ` Geert Uytterhoeven
2026-09-03 8:43 ` [PATCH net-next 14/14] net: niu: " Ruizhe Zhou
2026-09-08 23:50 ` [PATCH net-next 00/14] net: Remove obsolete 32-bit DMA mask fallbacks patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®