DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xueming Li <xuemingl@nvidia.com>
To: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Cc: dev@dpdk.org, xuemingl@nvidia.com, Asaf Penso <asafp@nvidia.com>,
	Matan Azrad <matan@nvidia.com>,
	Shahaf Shuler <shahafs@nvidia.com>
Subject: [dpdk-dev] [PATCH v5 9/9] net/mlx5: probe host PF representor with SubFunction
Date: Sun, 28 Mar 2021 13:48:15 +0000	[thread overview]
Message-ID: <1616939297-15627-10-git-send-email-xuemingl@nvidia.com> (raw)
In-Reply-To: <1616939297-15627-1-git-send-email-xuemingl@nvidia.com>
In-Reply-To: <1608304614-13908-2-git-send-email-xuemingl@nvidia.com>

To simplify BlueField HPF representor(vf[-1]) probe, this patch allows
probe it with "sf" syntax: "sf[-1]".

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 drivers/net/mlx5/linux/mlx5_os.c | 14 ++++++++++----
 drivers/net/mlx5/mlx5.h          |  3 ++-
 drivers/net/mlx5/mlx5_ethdev.c   | 25 +++++++++++++++++++++----
 3 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 5bdc8caee5..74f72188ff 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -710,11 +710,15 @@ mlx5_representor_match(struct mlx5_dev_spawn_data *spawn,
 	struct mlx5_switch_info *switch_info = &spawn->info;
 	unsigned int p, f;
 	uint16_t id;
-	uint16_t repr_id = mlx5_representor_id_encode(switch_info);
+	uint16_t repr_id = mlx5_representor_id_encode(switch_info,
+						      eth_da->type);
 
 	switch (eth_da->type) {
 	case RTE_ETH_REPRESENTOR_SF:
-		if (switch_info->name_type != MLX5_PHYS_PORT_NAME_TYPE_PFSF) {
+		if (!(spawn->info.port_name == -1 &&
+		      switch_info->name_type ==
+				MLX5_PHYS_PORT_NAME_TYPE_PFHPF) &&
+		    switch_info->name_type != MLX5_PHYS_PORT_NAME_TYPE_PFSF) {
 			rte_errno = EBUSY;
 			return false;
 		}
@@ -742,7 +746,8 @@ mlx5_representor_match(struct mlx5_dev_spawn_data *spawn,
 		if (spawn->pf_bond < 0) {
 			/* For non-LAG mode, allow and ignore pf. */
 			switch_info->pf_num = eth_da->ports[p];
-			repr_id = mlx5_representor_id_encode(switch_info);
+			repr_id = mlx5_representor_id_encode(switch_info,
+							     eth_da->type);
 		}
 		for (f = 0; f < eth_da->nb_representor_ports; ++f) {
 			id = MLX5_REPRESENTOR_ID
@@ -1107,7 +1112,8 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	priv->vport_id = switch_info->representor ?
 			 switch_info->port_name + 1 : -1;
 #endif
-	priv->representor_id = mlx5_representor_id_encode(switch_info);
+	priv->representor_id = mlx5_representor_id_encode(switch_info,
+							  eth_da->type);
 	/*
 	 * Look for sibling devices in order to reuse their switch domain
 	 * if any, otherwise allocate one.
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index a1d2798373..fa9e68ded9 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -1055,7 +1055,8 @@ int mlx5_representor_info_get(struct rte_eth_dev *dev,
 		((repr_id) & 0xfff)
 #define MLX5_REPRESENTOR_TYPE(repr_id) \
 		(((repr_id) >> 12) & 3)
-uint16_t mlx5_representor_id_encode(const struct mlx5_switch_info *info);
+uint16_t mlx5_representor_id_encode(const struct mlx5_switch_info *info,
+				    enum rte_eth_representor_type hpf_type);
 int mlx5_fw_version_get(struct rte_eth_dev *dev, char *fw_ver,
 			size_t fw_size);
 int mlx5_dev_infos_get(struct rte_eth_dev *dev,
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 4f97a69a20..564d7132e0 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -363,12 +363,15 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
  *
  * @param info
  *   Port switch info.
+ * @param hpf_type
+ *   Use this type if port is HPF.
  *
  * @return
  *   Encoded representor ID.
  */
 uint16_t
-mlx5_representor_id_encode(const struct mlx5_switch_info *info)
+mlx5_representor_id_encode(const struct mlx5_switch_info *info,
+			   enum rte_eth_representor_type hpf_type)
 {
 	enum rte_eth_representor_type type = RTE_ETH_REPRESENTOR_VF;
 	uint16_t repr = info->port_name;
@@ -377,8 +380,10 @@ mlx5_representor_id_encode(const struct mlx5_switch_info *info)
 		return UINT16_MAX;
 	if (info->name_type == MLX5_PHYS_PORT_NAME_TYPE_PFSF)
 		type = RTE_ETH_REPRESENTOR_SF;
-	if (info->name_type == MLX5_PHYS_PORT_NAME_TYPE_PFHPF)
+	if (info->name_type == MLX5_PHYS_PORT_NAME_TYPE_PFHPF) {
+		type = hpf_type;
 		repr = UINT16_MAX;
+	}
 	return MLX5_REPRESENTOR_ID(info->pf_num, type, repr);
 }
 
@@ -403,7 +408,7 @@ mlx5_representor_info_get(struct rte_eth_dev *dev,
 			  struct rte_eth_representor_info *info)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
-	int n_type = 3; /* Number of representor types, VF, HPF and SF. */
+	int n_type = 4; /* Representor types, VF, HPF@VF, SF and HPF@SF. */
 	int n_pf = 2; /* Number of PFs. */
 	int i = 0, pf;
 
@@ -424,7 +429,7 @@ mlx5_representor_info_get(struct rte_eth_dev *dev,
 		snprintf(info->ranges[i].name,
 			 sizeof(info->ranges[i].name), "pf%dvf", pf);
 		i++;
-		/* HPF range. */
+		/* HPF range of VF type. */
 		info->ranges[i].type = RTE_ETH_REPRESENTOR_VF;
 		info->ranges[i].controller = 0;
 		info->ranges[i].pf = pf;
@@ -448,6 +453,18 @@ mlx5_representor_info_get(struct rte_eth_dev *dev,
 		snprintf(info->ranges[i].name,
 			 sizeof(info->ranges[i].name), "pf%dsf", pf);
 		i++;
+		/* HPF range of SF type. */
+		info->ranges[i].type = RTE_ETH_REPRESENTOR_SF;
+		info->ranges[i].controller = 0;
+		info->ranges[i].pf = pf;
+		info->ranges[i].vf = UINT16_MAX;
+		info->ranges[i].id_base =
+			MLX5_REPRESENTOR_ID(pf, info->ranges[i].type, -1);
+		info->ranges[i].id_end =
+			MLX5_REPRESENTOR_ID(pf, info->ranges[i].type, -1);
+		snprintf(info->ranges[i].name,
+			 sizeof(info->ranges[i].name), "pf%dsf", pf);
+		i++;
 	}
 out:
 	return n_type * n_pf;
-- 
2.25.1


  parent reply	other threads:[~2021-03-28 13:49 UTC|newest]

Thread overview: 126+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18 15:16 [dpdk-dev] [RFC 0/9] support global syntax Xueming Li
2020-12-18 15:16 ` [dpdk-dev] [RFC 1/9] devargs: fix data buffer storage type Xueming Li
2021-01-08 14:54   ` [dpdk-dev] [PATCH v1 0/7] eal: support global syntax Xueming Li
2021-01-08 14:54   ` [dpdk-dev] [PATCH v1 1/7] devargs: fix data buffer storage type Xueming Li
2021-01-08 14:54   ` [dpdk-dev] [PATCH v1 2/7] devargs: fix memory leak on parsing error Xueming Li
2021-01-08 14:54   ` [dpdk-dev] [PATCH v1 3/7] devargs: fix memory leak in legacy parser Xueming Li
2021-01-08 14:54   ` [dpdk-dev] [PATCH v1 4/7] devargs: fix buffer data memory leak Xueming Li
2021-01-08 14:54   ` [dpdk-dev] [PATCH v1 5/7] kvargs: add get by key function Xueming Li
2021-01-08 14:54   ` [dpdk-dev] [PATCH v1 6/7] devargs: support new global device syntax Xueming Li
2021-01-08 14:54   ` [dpdk-dev] [PATCH v1 7/7] bus/pci: add new global device syntax support Xueming Li
2021-01-08 15:14   ` [dpdk-dev] [PATCH v1 0/2] mlx5: support global syntax Xueming Li
2021-01-08 15:14   ` [dpdk-dev] [PATCH v1 1/2] common/mlx5: support device " Xueming Li
2021-01-08 15:15   ` [dpdk-dev] [PATCH v1 2/2] net/mlx5: support new " Xueming Li
2021-01-18 11:29   ` [dpdk-dev] [PATCH v3 0/9] net/mlx5: support SubFunction representor Xueming Li
2021-01-18 11:29   ` [dpdk-dev] [PATCH v3 1/9] common/mlx5: update representor name parsing Xueming Li
2021-01-18 11:29   ` [dpdk-dev] [PATCH v3 2/9] net/mlx5: support representor of sub function Xueming Li
2021-01-18 11:29   ` [dpdk-dev] [PATCH v3 3/9] net/mlx5: revert setting bonding representor to first PF Xueming Li
2021-01-18 11:29   ` [dpdk-dev] [PATCH v3 4/9] net/mlx5: refactor bonding representor probe Xueming Li
2021-01-18 11:29   ` [dpdk-dev] [PATCH v3 5/9] net/mlx5: support representor from multiple PFs Xueming Li
2021-01-18 11:29   ` [dpdk-dev] [PATCH v3 6/9] net/mlx5: save bonding member ports information Xueming Li
2021-01-18 11:29   ` [dpdk-dev] [PATCH v3 7/9] " Xueming Li
2021-01-18 16:17     ` Slava Ovsiienko
2021-01-18 23:05       ` Xueming(Steven) Li
2021-01-18 11:29   ` [dpdk-dev] [PATCH v3 8/9] net/mlx5: fix setting VF default MAC through representor Xueming Li
2021-01-18 11:29   ` [dpdk-dev] [PATCH v3 9/9] net/mlx5: improve bonding xstats Xueming Li
2021-01-18 15:16   ` [dpdk-dev] [PATCH v2 0/5] eal: enable global device syntax Xueming Li
2021-01-18 15:16   ` [dpdk-dev] [PATCH v2 1/5] devargs: fix memory leak on parsing error Xueming Li
2021-03-18  9:12     ` Thomas Monjalon
2021-01-18 15:16   ` [dpdk-dev] [PATCH v2 2/5] devargs: refactor scratch buffer storage Xueming Li
2021-03-18  9:14     ` Thomas Monjalon
2021-01-18 15:16   ` [dpdk-dev] [PATCH v2 3/5] kvargs: add get by key function Xueming Li
2021-01-18 15:16   ` [dpdk-dev] [PATCH v2 4/5] devargs: parse name from global device syntax Xueming Li
2021-01-18 15:16   ` [dpdk-dev] [PATCH v2 5/5] devargs: enable global device syntax devargs Xueming Li
2021-01-18 15:26   ` [dpdk-dev] [PATCH v2 0/2] mlx5: support global device syntax Xueming Li
2021-09-20  8:07     ` Thomas Monjalon
2021-09-23  6:47       ` Xueming(Steven) Li
2021-09-23  6:45     ` [dpdk-dev] [PATCH v3] net/mlx5: support new " Xueming Li
2021-09-29 19:37       ` Thomas Monjalon
2021-01-18 15:26   ` [dpdk-dev] [PATCH v2 1/2] common/mlx5: support device global syntax Xueming Li
2021-04-05 10:54     ` Slava Ovsiienko
2021-04-08 12:24       ` Raslan Darawsheh
2021-04-08 14:04         ` Raslan Darawsheh
2021-04-08 14:08           ` Xueming(Steven) Li
2021-04-08 14:13             ` Raslan Darawsheh
2021-04-19  9:29               ` Raslan Darawsheh
2021-04-19 10:36                 ` Raslan Darawsheh
2021-01-18 15:26   ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: support new global device syntax Xueming Li
2021-04-05 10:56     ` Slava Ovsiienko
2021-01-19  7:28   ` [dpdk-dev] [PATCH v4 0/8] net/mlx5: support SubFunction representor Xueming Li
2021-01-19  7:28   ` [dpdk-dev] [PATCH v4 1/8] common/mlx5: update representor name parsing Xueming Li
2021-01-19  7:28   ` [dpdk-dev] [PATCH v4 2/8] net/mlx5: support representor of sub function Xueming Li
2021-01-19  7:28   ` [dpdk-dev] [PATCH v4 3/8] net/mlx5: revert setting bonding representor to first PF Xueming Li
2021-01-19  7:28   ` [dpdk-dev] [PATCH v4 4/8] net/mlx5: refactor bonding representor probe Xueming Li
2021-01-19  7:28   ` [dpdk-dev] [PATCH v4 5/8] net/mlx5: support representor from multiple PFs Xueming Li
2021-01-19  7:28   ` [dpdk-dev] [PATCH v4 6/8] net/mlx5: save bonding member ports information Xueming Li
2021-01-19  7:28   ` [dpdk-dev] [PATCH v4 7/8] net/mlx5: fix setting VF default MAC through representor Xueming Li
2021-01-19  7:28   ` [dpdk-dev] [PATCH v4 8/8] net/mlx5: improve bonding xstats Xueming Li
2021-03-28 13:48   ` [dpdk-dev] [PATCH v5 0/9] net/mlx5: support SubFunction representor Xueming Li
2021-03-31  7:20     ` Raslan Darawsheh
2021-03-31  7:27       ` Xueming(Steven) Li
2021-03-28 13:48   ` [dpdk-dev] [PATCH v5 1/9] common/mlx5: sub-function representor port name parsing Xueming Li
2021-03-28 13:48   ` [dpdk-dev] [PATCH v5 2/9] net/mlx5: support representor of sub function Xueming Li
2021-03-28 13:48   ` [dpdk-dev] [PATCH v5 3/9] net/mlx5: revert setting bonding representor to first PF Xueming Li
2021-03-28 13:48   ` [dpdk-dev] [PATCH v5 4/9] net/mlx5: refactor bonding representor probe Xueming Li
2021-03-28 13:48   ` [dpdk-dev] [PATCH v5 5/9] net/mlx5: support list value of representor PF Xueming Li
2021-03-28 13:48   ` [dpdk-dev] [PATCH v5 6/9] net/mlx5: save bonding member ports information Xueming Li
2021-03-28 13:48   ` [dpdk-dev] [PATCH v5 7/9] net/mlx5: fix setting VF default MAC through representor Xueming Li
2021-03-31  7:46     ` Raslan Darawsheh
2021-03-28 13:48   ` [dpdk-dev] [PATCH v5 8/9] net/mlx5: improve xstats of bonding port Xueming Li
2021-03-28 13:48   ` Xueming Li [this message]
2021-03-30  7:37     ` [dpdk-dev] [PATCH v5 9/9] net/mlx5: probe host PF representor with SubFunction Slava Ovsiienko
2021-03-30 12:15   ` [dpdk-dev] [PATCH v3 0/5] eal: enable global device syntax by default Xueming Li
2021-03-31  8:23     ` Gaëtan Rivet
2021-03-30 12:15   ` [dpdk-dev] [PATCH v3 1/5] devargs: unify scratch buffer storage Xueming Li
2021-04-01  9:04     ` Kinsella, Ray
2021-03-30 12:15   ` [dpdk-dev] [PATCH v3 2/5] devargs: fix memory leak on parsing error Xueming Li
2021-03-30 12:15   ` [dpdk-dev] [PATCH v3 3/5] kvargs: add get by key function Xueming Li
2021-04-01  9:06     ` Kinsella, Ray
2021-04-01  9:10       ` Xueming(Steven) Li
2021-03-30 12:15   ` [dpdk-dev] [PATCH v3 4/5] bus: add device arguments name parsing API Xueming Li
2021-03-31 10:19     ` Thomas Monjalon
2021-04-01 15:13       ` Xueming(Steven) Li
2021-04-08 23:49         ` Thomas Monjalon
2021-03-30 12:15   ` [dpdk-dev] [PATCH v3 5/5] devargs: parse global device syntax Xueming Li
2021-04-10 14:23   ` [dpdk-dev] [PATCH v4 0/5] eal: enable global device syntax by default Xueming Li
2021-04-10 14:23   ` [dpdk-dev] [PATCH v4 1/5] devargs: unify scratch buffer storage Xueming Li
2021-04-10 19:59     ` Tal Shnaiderman
2021-04-12 12:07       ` Xueming(Steven) Li
2021-04-10 14:23   ` [dpdk-dev] [PATCH v4 2/5] devargs: fix memory leak on parsing error Xueming Li
2021-04-10 14:23   ` [dpdk-dev] [PATCH v4 3/5] kvargs: add get by key function Xueming Li
2021-04-12  6:52     ` Olivier Matz
2021-04-12 12:07       ` Xueming(Steven) Li
2021-04-12 21:18         ` Thomas Monjalon
2021-04-10 14:23   ` [dpdk-dev] [PATCH v4 4/5] bus: add device arguments name parsing API Xueming Li
2021-04-12 21:16     ` Thomas Monjalon
2021-04-12 23:37       ` Xueming(Steven) Li
2021-04-10 14:23   ` [dpdk-dev] [PATCH v4 5/5] devargs: parse global device syntax Xueming Li
2021-04-12 21:24     ` Thomas Monjalon
2021-04-12 23:47       ` Xueming(Steven) Li
2021-04-13  3:14   ` [dpdk-dev] [PATCH v5 0/5] eal: enable global device syntax by default Xueming Li
2021-04-14 19:49     ` Thomas Monjalon
2021-04-23 11:06       ` Kinsella, Ray
2021-04-23 11:39         ` Gaëtan Rivet
2021-04-23 12:35           ` Kinsella, Ray
2021-09-02 14:46       ` Thomas Monjalon
2021-04-13  3:14   ` [dpdk-dev] [PATCH v5 1/5] devargs: unify scratch buffer storage Xueming Li
2021-04-16  7:00     ` David Marchand
2021-04-16 12:32       ` Aaron Conole
2021-04-16 12:43         ` [dpdk-dev] [dpdklab] " Lincoln Lavoie
2021-04-16 12:58           ` Thomas Monjalon
2021-04-16 13:14             ` Lincoln Lavoie
2021-04-13  3:14   ` [dpdk-dev] [PATCH v5 2/5] devargs: fix memory leak on parsing error Xueming Li
2021-04-13  3:14   ` [dpdk-dev] [PATCH v5 3/5] kvargs: add get by key function Xueming Li
2021-04-13  3:14   ` [dpdk-dev] [PATCH v5 4/5] bus: add device arguments name parsing API Xueming Li
2021-04-13  3:14   ` [dpdk-dev] [PATCH v5 5/5] devargs: parse global device syntax Xueming Li
2021-09-28  8:29     ` David Marchand
2021-09-28  9:04       ` Thomas Monjalon
2021-10-03 10:51         ` Xueming(Steven) Li
2020-12-18 15:16 ` [dpdk-dev] [RFC 2/9] devargs: fix memory leak on parsing error Xueming Li
2020-12-18 15:16 ` [dpdk-dev] [RFC 3/9] devargs: fix memory leak in legacy parser Xueming Li
2020-12-18 15:16 ` [dpdk-dev] [RFC 4/9] devargs: fix buffer data memory leak Xueming Li
2020-12-18 15:16 ` [dpdk-dev] [RFC 5/9] kvargs: add get by key function Xueming Li
2020-12-18 15:16 ` [dpdk-dev] [RFC 6/9] devargs: support new global device syntax Xueming Li
2020-12-18 15:16 ` [dpdk-dev] [RFC 7/9] bus/pci: add new global device syntax support Xueming Li
2020-12-18 15:16 ` [dpdk-dev] [RFC 8/9] common/mlx5: support device global syntax Xueming Li
2020-12-18 15:16 ` [dpdk-dev] [RFC 9/9] net/mlx5: support new " Xueming Li

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=1616939297-15627-10-git-send-email-xuemingl@nvidia.com \
    --to=xuemingl@nvidia.com \
    --cc=asafp@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=viacheslavo@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).