Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Tariq Toukan <tariqt@nvidia.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, <netdev@vger.kernel.org>,
	Paolo Abeni <pabeni@redhat.com>
Cc: Gal Pressman <gal@nvidia.com>, Leon Romanovsky <leon@kernel.org>,
	<linux-rdma@vger.kernel.org>, Mark Bloch <mbloch@nvidia.com>,
	Moshe Shemesh <moshe@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Tariq Toukan <tariqt@nvidia.com>,
	Yishai Hadas <yishaih@nvidia.com>
Subject: [PATCH net-next 1/2] net/mlx5: Declare no DMA segment boundary restriction
Date: Fri, 20 Nov 2026 10:18:18 +0200	[thread overview]
Message-ID: <20261120081819.2538191-2-tariqt@nvidia.com> (raw)
In-Reply-To: <20261120081819.2538191-1-tariqt@nvidia.com>

From: Yishai Hadas <yishaih@nvidia.com>

The PCI core initialises every PCI device with a DMA segment boundary
mask of 0xffffffff in pci_device_add(), which forbids any segment from
crossing a 4GB-aligned address regardless of its length. mlx5_core
raises the default maximum segment size to 2GB but never overrides the
boundary, although the device has no such limitation.

Consumers such as ib_umem_get() coalesce physically contiguous pages up
to the maximum segment size without consulting the boundary mask.
Registering a large MR can therefore produce a segment that crosses a
4GB-aligned address, which the DMA API debug checker reports:

  DMA-API: mlx5_core 0000:08:00.0: mapping sg segment across boundary
  [start=0x00000002ffe27000] [end=0x000000030020efff]
  [boundary=0x00000000ffffffff]

The segment is about 4MB long, well below the 2GB maximum, but it spans
the 12GB (0x300000000) boundary: the upper halves of start and end are
0x2 and 0x3.

Set the segment boundary mask to ULONG_MAX so the DMA constraints
declared for the device match what the hardware supports.

Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 079e91c98041..b3f4d319d29e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -190,6 +190,7 @@ static int set_dma_caps(struct pci_dev *pdev)
 	}
 
 	dma_set_max_seg_size(&pdev->dev, 2u * 1024 * 1024 * 1024);
+	dma_set_seg_boundary(&pdev->dev, ULONG_MAX);
 	return err;
 }
 
-- 
2.44.0


  reply	other threads:[~2026-11-20  8:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  8:18 [PATCH net-next 0/2] net/mlx5: Declare no DMA segment boundary restriction Tariq Toukan
2026-11-20  8:18 ` Tariq Toukan [this message]
2026-11-20  8:30   ` [PATCH net-next 1/2] " sashiko-bot
2026-11-20  8:18 ` [PATCH net-next 2/2] net/mlx5: Declare no DMA segment boundary for data direct device Tariq Toukan
2026-11-20  8:30   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261120081819.2538191-2-tariqt@nvidia.com \
    --to=tariqt@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=gal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=moshe@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=yishaih@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox