patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v1] drivers: fix incorrect E-Switch manager vport ID
@ 2022-02-22 15:07 Shun Hao
  2022-02-23 14:34 ` Raslan Darawsheh
  2022-02-23 14:39 ` Raslan Darawsheh
  0 siblings, 2 replies; 6+ messages in thread
From: Shun Hao @ 2022-02-22 15:07 UTC (permalink / raw)
  To: matan, viacheslavo, orika, thomas, Xueming Li; +Cc: dev, rasland, stable

One of the E-Switch vports plays the special role - it is assigned as
"E-Switch manager" and has some special exclusive rights and duties - it
maintains all the representors, manages FDB domain flows, etc. By
default, the E-Switch vport index was supposed to be zero on standalone
NICs (regular ConnectX) and 0xFFFE SmartNIC (BlueField), but that was
not always correct - this index can be assigned with any value by
kernel/hypervisor.

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.

To handle this and do not suggest any default values, can use DevX API
to query E-Switch manager vport ID directly from the firmware during
initialization, and use that value 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: stable@dpdk.org

Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/common/mlx5/mlx5_devx_cmds.c | 12 ++++++++++++
 drivers/common/mlx5/mlx5_devx_cmds.h |  2 ++
 drivers/common/mlx5/mlx5_prm.h       | 12 ++++++++++++
 drivers/net/mlx5/mlx5_flow_dv.c      |  4 ++++
 4 files changed, 30 insertions(+)

diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index 2e807a0829..6d632b97ed 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -1130,6 +1130,18 @@ mlx5_devx_cmd_query_hca_attr(void *ctx,
 			goto error;
 		}
 	}
+	if (attr->eswitch_manager) {
+		hcattr = mlx5_devx_get_hca_cap(ctx, in, out, &rc,
+				MLX5_SET_HCA_CAP_OP_MOD_ESW |
+				MLX5_HCA_CAP_OPMOD_GET_CUR);
+		if (!hcattr)
+			return rc;
+		attr->esw_mgr_vport_id_valid =
+			MLX5_GET(esw_cap, hcattr,
+				 esw_manager_vport_number_valid);
+		attr->esw_mgr_vport_id =
+			MLX5_GET(esw_cap, hcattr, esw_manager_vport_number);
+	}
 	return 0;
 error:
 	rc = (rc > 0) ? -rc : rc;
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h
index 37821b493e..4373761c29 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.h
+++ b/drivers/common/mlx5/mlx5_devx_cmds.h
@@ -252,6 +252,8 @@ struct mlx5_hca_attr {
 	uint32_t umr_modify_entity_size_disabled:1;
 	uint32_t umr_indirect_mkey_disabled:1;
 	uint32_t log_min_stride_wqe_sz:5;
+	uint32_t esw_mgr_vport_id_valid:1; /* E-Switch Mgr vport ID is valid. */
+	uint16_t esw_mgr_vport_id; /* E-Switch Mgr vport ID . */
 	uint16_t max_wqe_sz_sq;
 };
 
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 495b63191a..b9e39aa717 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -1264,6 +1264,7 @@ enum {
 	MLX5_GET_HCA_CAP_OP_MOD_QOS_CAP = 0xc << 1,
 	MLX5_GET_HCA_CAP_OP_MOD_ROCE = 0x4 << 1,
 	MLX5_GET_HCA_CAP_OP_MOD_NIC_FLOW_TABLE = 0x7 << 1,
+	MLX5_SET_HCA_CAP_OP_MOD_ESW = 0x9 << 1,
 	MLX5_GET_HCA_CAP_OP_MOD_VDPA_EMULATION = 0x13 << 1,
 	MLX5_GET_HCA_CAP_OP_MOD_PARSE_GRAPH_NODE_CAP = 0x1C << 1,
 	MLX5_GET_HCA_CAP_OP_MOD_GENERAL_DEVICE_2 = 0x20 << 1,
@@ -1926,6 +1927,16 @@ struct mlx5_ifc_cmd_hca_cap_2_bits {
 	u8 reserved_at_100[0x700];
 };
 
+struct mlx5_ifc_esw_cap_bits {
+	u8 reserved_at_0[0x60];
+
+	u8 esw_manager_vport_number_valid[0x1];
+	u8 reserved_at_61[0xf];
+	u8 esw_manager_vport_number[0x10];
+
+	u8 reserved_at_80[0x780];
+};
+
 union mlx5_ifc_hca_cap_union_bits {
 	struct mlx5_ifc_cmd_hca_cap_bits cmd_hca_cap;
 	struct mlx5_ifc_cmd_hca_cap_2_bits cmd_hca_cap_2;
@@ -1934,6 +1945,7 @@ union mlx5_ifc_hca_cap_union_bits {
 	struct mlx5_ifc_qos_cap_bits qos_cap;
 	struct mlx5_ifc_virtio_emulation_cap_bits vdpa_caps;
 	struct mlx5_ifc_flow_table_nic_cap_bits flow_table_nic_cap;
+	struct mlx5_ifc_esw_cap_bits esw_cap;
 	struct mlx5_ifc_roce_caps_bits roce_caps;
 	u8 reserved_at_0[0x8000];
 };
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index c30cb4c203..272f000a99 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH v1] drivers: fix incorrect E-Switch manager vport ID
  2022-02-22 15:07 [PATCH v1] drivers: fix incorrect E-Switch manager vport ID Shun Hao
@ 2022-02-23 14:34 ` Raslan Darawsheh
  2022-02-23 14:39 ` Raslan Darawsheh
  1 sibling, 0 replies; 6+ messages in thread
From: Raslan Darawsheh @ 2022-02-23 14:34 UTC (permalink / raw)
  To: Shun Hao, Matan Azrad, Slava Ovsiienko, Ori Kam,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Xueming(Steven) Li
  Cc: dev@dpdk.org  , stable

HI,

> -----Original Message-----
> From: Shun Hao <shunh@nvidia.com>
> Sent: Tuesday, February 22, 2022 5:07 PM
> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; orika@nvidia.com ; thomas@monjalon.net ;
> Xueming(Steven) Li <xuemingl@nvidia.com>
> Cc: dev@dpdk.org ; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org
> Subject: [PATCH v1] drivers: fix incorrect E-Switch manager vport ID
> 
> One of the E-Switch vports plays the special role - it is assigned as "E-Switch
> manager" and has some special exclusive rights and duties - it maintains all
> the representors, manages FDB domain flows, etc. By default, the E-Switch
> vport index was supposed to be zero on standalone NICs (regular ConnectX)
> and 0xFFFE SmartNIC (BlueField), but that was not always correct - this index
> can be assigned with any value by kernel/hypervisor.
> 
> 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.
> 
> To handle this and do not suggest any default values, can use DevX API to
> query E-Switch manager vport ID directly from the firmware during
> initialization, and use that value 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: stable@dpdk.org
> 
> Signed-off-by: Shun Hao <shunh@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH v1] drivers: fix incorrect E-Switch manager vport ID
  2022-02-22 15:07 [PATCH v1] drivers: fix incorrect E-Switch manager vport ID Shun Hao
  2022-02-23 14:34 ` Raslan Darawsheh
@ 2022-02-23 14:39 ` Raslan Darawsheh
  2022-02-23 18:59   ` Ferruh Yigit
  1 sibling, 1 reply; 6+ messages in thread
From: Raslan Darawsheh @ 2022-02-23 14:39 UTC (permalink / raw)
  To: Shun Hao, Matan Azrad, Slava Ovsiienko, Ori Kam,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Xueming(Steven) Li
  Cc: dpdk-dev, stable

Hi,

> -----Original Message-----
> From: Shun Hao <shunh@nvidia.com>
> Sent: Tuesday, February 22, 2022 5:07 PM
> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; orika@nvidia.com ; thomas@monjalon.net ;
> Xueming(Steven) Li <xuemingl@nvidia.com>
> Cc: dev@dpdk.org ; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org
> Subject: [PATCH v1] drivers: fix incorrect E-Switch manager vport ID
> 
> One of the E-Switch vports plays the special role - it is assigned as "E-Switch
> manager" and has some special exclusive rights and duties - it maintains all
> the representors, manages FDB domain flows, etc. By default, the E-Switch
> vport index was supposed to be zero on standalone NICs (regular ConnectX)
> and 0xFFFE SmartNIC (BlueField), but that was not always correct - this index
> can be assigned with any value by kernel/hypervisor.
> 
> 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.
> 
> To handle this and do not suggest any default values, can use DevX API to
> query E-Switch manager vport ID directly from the firmware during
> initialization, and use that value 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: stable@dpdk.org
> 
> Signed-off-by: Shun Hao <shunh@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] drivers: fix incorrect E-Switch manager vport ID
  2022-02-23 14:39 ` Raslan Darawsheh
@ 2022-02-23 18:59   ` Ferruh Yigit
  2022-02-24  9:20     ` Raslan Darawsheh
  0 siblings, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2022-02-23 18:59 UTC (permalink / raw)
  To: Raslan Darawsheh, Shun Hao, Matan Azrad, Slava Ovsiienko,
	Ori Kam, NBU-Contact-Thomas Monjalon (EXTERNAL),
	Xueming(Steven) Li
  Cc: dpdk-dev, stable

On 2/23/2022 2:39 PM, Raslan Darawsheh wrote:
> Hi,
> 
>> -----Original Message-----
>> From: Shun Hao <shunh@nvidia.com>
>> Sent: Tuesday, February 22, 2022 5:07 PM
>> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
>> <viacheslavo@nvidia.com>; orika@nvidia.com ; thomas@monjalon.net ;
>> Xueming(Steven) Li <xuemingl@nvidia.com>
>> Cc: dev@dpdk.org ; Raslan Darawsheh <rasland@nvidia.com>;
>> stable@dpdk.org
>> Subject: [PATCH v1] drivers: fix incorrect E-Switch manager vport ID
>>
>> One of the E-Switch vports plays the special role - it is assigned as "E-Switch
>> manager" and has some special exclusive rights and duties - it maintains all
>> the representors, manages FDB domain flows, etc. By default, the E-Switch
>> vport index was supposed to be zero on standalone NICs (regular ConnectX)
>> and 0xFFFE SmartNIC (BlueField), but that was not always correct - this index
>> can be assigned with any value by kernel/hypervisor.
>>
>> 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.
>>
>> To handle this and do not suggest any default values, can use DevX API to
>> query E-Switch manager vport ID directly from the firmware during
>> initialization, and use that value 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: stable@dpdk.org
>>
>> Signed-off-by: Shun Hao <shunh@nvidia.com>
>> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> 
> Patch applied to next-net-mlx,
> 

Hi Raslan,

Can you make a patch to add 'E-Switch' keyword to './devtools/words-case.txt',
in the syntax how it suppose to be? (There are various variants of it in
the commit history.)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH v1] drivers: fix incorrect E-Switch manager vport ID
  2022-02-23 18:59   ` Ferruh Yigit
@ 2022-02-24  9:20     ` Raslan Darawsheh
  0 siblings, 0 replies; 6+ messages in thread
From: Raslan Darawsheh @ 2022-02-24  9:20 UTC (permalink / raw)
  To: Ferruh Yigit, Shun Hao, Matan Azrad, Slava Ovsiienko, Ori Kam,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Xueming(Steven) Li
  Cc: dpdk-dev, stable

Hi,

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Wednesday, February 23, 2022 9:00 PM
> To: Raslan Darawsheh <rasland@nvidia.com>; Shun Hao
> <shunh@nvidia.com>; Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>; NBU-Contact-
> Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>; Xueming(Steven)
> Li <xuemingl@nvidia.com>
> Cc: dpdk-dev <dev@dpdk.org>; stable@dpdk.org
> Subject: Re: [PATCH v1] drivers: fix incorrect E-Switch manager vport ID
> 
> On 2/23/2022 2:39 PM, Raslan Darawsheh wrote:
> > Hi,
> >
> >> -----Original Message-----
> >> From: Shun Hao <shunh@nvidia.com>
> >> Sent: Tuesday, February 22, 2022 5:07 PM
> >> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> >> <viacheslavo@nvidia.com>; orika@nvidia.com ; thomas@monjalon.net ;
> >> Xueming(Steven) Li <xuemingl@nvidia.com>
> >> Cc: dev@dpdk.org ; Raslan Darawsheh <rasland@nvidia.com>;
> >> stable@dpdk.org
> >> Subject: [PATCH v1] drivers: fix incorrect E-Switch manager vport ID
> >>
> >> One of the E-Switch vports plays the special role - it is assigned as
> >> "E-Switch manager" and has some special exclusive rights and duties -
> >> it maintains all the representors, manages FDB domain flows, etc. By
> >> default, the E-Switch vport index was supposed to be zero on
> >> standalone NICs (regular ConnectX) and 0xFFFE SmartNIC (BlueField),
> >> but that was not always correct - this index can be assigned with any value
> by kernel/hypervisor.
> >>
> >> 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.
> >>
> >> To handle this and do not suggest any default values, can use DevX
> >> API to query E-Switch manager vport ID directly from the firmware
> >> during initialization, and use that value 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: stable@dpdk.org
> >>
> >> Signed-off-by: Shun Hao <shunh@nvidia.com>
> >> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> >
> > Patch applied to next-net-mlx,
> >
> 
> Hi Raslan,
> 
> Can you make a patch to add 'E-Switch' keyword to './devtools/words-
> case.txt', in the syntax how it suppose to be? (There are various variants of it
> in the commit history.)

Sure, will send a patch for it, and I think the correct syntax should be E-Switch as written in this patch.

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1] drivers: fix incorrect E-Switch manager vport ID
@ 2022-02-22  8:40 Shun Hao
  0 siblings, 0 replies; 6+ messages in thread
From: Shun Hao @ 2022-02-22  8:40 UTC (permalink / raw)
  To: matan, viacheslavo, orika, thomas, Xueming Li; +Cc: dev, rasland, stable

One of the E-Switch vports plays the special role - it is assigned as
"E-Switch manager" and has some special exclusive rights and duties - it
maintains all the representors, manages FDB domain flows, etc. By
default, the E-Switch vport index was supposed to be zero on standalone
NICs (regular ConnectX) and 0xFFFE SmartNIC (BlueField), but that was
not always correct - this index can be assigned with any value by
kernel/hypervisor.

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.

To handle this and do not suggest any default values, can use DevX API
to query E-Switch manager vport ID directly from the firmware during
initializaiton, and use that value 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: stable@dpdk.org

Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/common/mlx5/mlx5_devx_cmds.c | 12 ++++++++++++
 drivers/common/mlx5/mlx5_devx_cmds.h |  2 ++
 drivers/common/mlx5/mlx5_prm.h       | 12 ++++++++++++
 drivers/net/mlx5/mlx5_flow_dv.c      |  4 ++++
 4 files changed, 30 insertions(+)

diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index 2e807a0829..6d632b97ed 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -1130,6 +1130,18 @@ mlx5_devx_cmd_query_hca_attr(void *ctx,
 			goto error;
 		}
 	}
+	if (attr->eswitch_manager) {
+		hcattr = mlx5_devx_get_hca_cap(ctx, in, out, &rc,
+				MLX5_SET_HCA_CAP_OP_MOD_ESW |
+				MLX5_HCA_CAP_OPMOD_GET_CUR);
+		if (!hcattr)
+			return rc;
+		attr->esw_mgr_vport_id_valid =
+			MLX5_GET(esw_cap, hcattr,
+				 esw_manager_vport_number_valid);
+		attr->esw_mgr_vport_id =
+			MLX5_GET(esw_cap, hcattr, esw_manager_vport_number);
+	}
 	return 0;
 error:
 	rc = (rc > 0) ? -rc : rc;
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h
index 37821b493e..4373761c29 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.h
+++ b/drivers/common/mlx5/mlx5_devx_cmds.h
@@ -252,6 +252,8 @@ struct mlx5_hca_attr {
 	uint32_t umr_modify_entity_size_disabled:1;
 	uint32_t umr_indirect_mkey_disabled:1;
 	uint32_t log_min_stride_wqe_sz:5;
+	uint32_t esw_mgr_vport_id_valid:1; /* E-Switch Mgr vport ID is valid. */
+	uint16_t esw_mgr_vport_id; /* E-Switch Mgr vport ID . */
 	uint16_t max_wqe_sz_sq;
 };
 
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 495b63191a..b9e39aa717 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -1264,6 +1264,7 @@ enum {
 	MLX5_GET_HCA_CAP_OP_MOD_QOS_CAP = 0xc << 1,
 	MLX5_GET_HCA_CAP_OP_MOD_ROCE = 0x4 << 1,
 	MLX5_GET_HCA_CAP_OP_MOD_NIC_FLOW_TABLE = 0x7 << 1,
+	MLX5_SET_HCA_CAP_OP_MOD_ESW = 0x9 << 1,
 	MLX5_GET_HCA_CAP_OP_MOD_VDPA_EMULATION = 0x13 << 1,
 	MLX5_GET_HCA_CAP_OP_MOD_PARSE_GRAPH_NODE_CAP = 0x1C << 1,
 	MLX5_GET_HCA_CAP_OP_MOD_GENERAL_DEVICE_2 = 0x20 << 1,
@@ -1926,6 +1927,16 @@ struct mlx5_ifc_cmd_hca_cap_2_bits {
 	u8 reserved_at_100[0x700];
 };
 
+struct mlx5_ifc_esw_cap_bits {
+	u8 reserved_at_0[0x60];
+
+	u8 esw_manager_vport_number_valid[0x1];
+	u8 reserved_at_61[0xf];
+	u8 esw_manager_vport_number[0x10];
+
+	u8 reserved_at_80[0x780];
+};
+
 union mlx5_ifc_hca_cap_union_bits {
 	struct mlx5_ifc_cmd_hca_cap_bits cmd_hca_cap;
 	struct mlx5_ifc_cmd_hca_cap_2_bits cmd_hca_cap_2;
@@ -1934,6 +1945,7 @@ union mlx5_ifc_hca_cap_union_bits {
 	struct mlx5_ifc_qos_cap_bits qos_cap;
 	struct mlx5_ifc_virtio_emulation_cap_bits vdpa_caps;
 	struct mlx5_ifc_flow_table_nic_cap_bits flow_table_nic_cap;
+	struct mlx5_ifc_esw_cap_bits esw_cap;
 	struct mlx5_ifc_roce_caps_bits roce_caps;
 	u8 reserved_at_0[0x8000];
 };
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index c30cb4c203..272f000a99 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-24  9:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 15:07 [PATCH v1] drivers: fix incorrect E-Switch manager vport ID Shun Hao
2022-02-23 14:34 ` Raslan Darawsheh
2022-02-23 14:39 ` Raslan Darawsheh
2022-02-23 18:59   ` Ferruh Yigit
2022-02-24  9:20     ` Raslan Darawsheh
  -- strict thread matches above, loose matches on Subject: below --
2022-02-22  8:40 Shun Hao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).