[PATCH net-next 07/10] net/mlx5e: Use the correct DMA dev when data_direct pdev enabled
From: Tariq Toukan
Date: Thu Oct 08 2026 - 09:32:05 EST
From: Dragos Tatulea <dtatulea@xxxxxxxxxx>
When the private flag is set, always return the data direct
PCI device instead of the NIC PF PCI device in .ndo_queue_get_dma_dev.
Rename netdev argument to netdev because there are too many confusing
"dev"-based names in this function.
Signed-off-by: Dragos Tatulea <dtatulea@xxxxxxxxxx>
Signed-off-by: Tariq Toukan <tariqt@xxxxxxxxxx>
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index d5282a301621..6476baf71bde 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -5897,10 +5897,10 @@ static int mlx5e_queue_start(struct net_device *dev,
return 0;
}
-static struct device *mlx5e_queue_get_dma_dev(struct net_device *dev,
+static struct device *mlx5e_queue_get_dma_dev(struct net_device *netdev,
int queue_index)
{
- struct mlx5e_priv *priv = netdev_priv(dev);
+ struct mlx5e_priv *priv = netdev_priv(netdev);
struct mlx5e_channels *channels;
struct device *pdev = NULL;
struct mlx5e_channel *ch;
@@ -5913,7 +5913,16 @@ static struct device *mlx5e_queue_get_dma_dev(struct net_device *dev,
goto out;
ch = channels->c[queue_index];
- pdev = ch->pdev;
+ if (MLX5E_GET_PFLAG(&channels->params, MLX5E_PFLAG_DATA_DIRECT)) {
+ struct mlx5_core_dev *mdev = ch->mdev;
+ struct mlx5_data_direct_dev *dd_dev;
+
+ dd_dev = mlx5_data_direct_get_dev(mdev->data_direct);
+ if (dd_dev)
+ pdev = &dd_dev->pdev->dev;
+ } else {
+ pdev = ch->pdev;
+ }
out:
mutex_unlock(&priv->state_lock);
--
2.44.0