DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shun Hao <shunh@nvidia.com>
To: <matan@nvidia.com>, <viacheslavo@nvidia.com>,
	<orika@nvidia.com   >, <thomas@monjalon.net >,
	Xueming Li <xuemingl@nvidia.com>
Cc: <dev@dpdk.org  >, <rasland@nvidia.com>, <stable@dpdk.org>
Subject: [PATCH v2 2/2] net/mlx5: new method to get E-Switch manager vport ID
Date: Fri, 18 Feb 2022 09:45:56 +0200	[thread overview]
Message-ID: <20220218074556.25036-3-shunh@nvidia.com> (raw)
In-Reply-To: <20220218074556.25036-1-shunh@nvidia.com>

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: stable@dpdk.org

Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@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


      parent reply	other threads:[~2022-02-18  7:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-18  7:45 [PATCH v2 0/2] Get E-Switch Manager " Shun Hao
2022-02-18  7:45 ` [PATCH v2 1/2] common/mlx5: query E-Switch manager " Shun Hao
2022-02-18  7:45 ` Shun Hao [this message]

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=20220218074556.25036-3-shunh@nvidia.com \
    --to=shunh@nvidia.com \
    --cc=dev@dpdk.org   \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com    \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net  \
    --cc=viacheslavo@nvidia.com \
    --cc=xuemingl@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;
as well as URLs for NNTP newsgroup(s).