Currently the E-Switch manager vport ID is supposed to be default - 0
for standalone NICs, and 0xFFFE for the SmartNICs, and is deduced from
the device PCI ID.

This uses the new method that takes the value queried from firmware as
vport ID by default. If the new method is not provided (legacy
firmware), fallback to use the PCI id approach.

Fixes: a564038699f9 ("net/mlx5: support E-Switch manager egress traffic match")
Cc: sta...@dpdk.org

Signed-off-by: Shun Hao <sh...@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index ef9c66eddf..9152614a13 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -97,6 +97,10 @@ static int16_t
 flow_dv_get_esw_manager_vport_id(struct rte_eth_dev *dev)
 {
        struct mlx5_priv *priv = dev->data->dev_private;
+       struct mlx5_common_device *cdev = priv->sh->cdev;
+
+       if (cdev->config.hca_attr.esw_mgr_vport_id_valid)
+               return (int16_t)cdev->config.hca_attr.esw_mgr_vport_id;
 
        if (priv->pci_dev == NULL)
                return 0;
-- 
2.20.0

Reply via email to