DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Peng Zhang <peng.zhang@corigine.com>,
	Chaoyong He <chaoyong.he@corigine.com>,
	Long Wu <long.wu@corigine.com>
Subject: [PATCH 17/23] net/nfp: configure the VF queue
Date: Wed, 19 Jun 2024 17:58:24 +0800	[thread overview]
Message-ID: <20240619095830.3479757-18-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240619095830.3479757-1-chaoyong.he@corigine.com>

From: Peng Zhang <peng.zhang@corigine.com>

Configure the VF queue, now every VF just have one queue.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/common/nfp/nfp_common_ctrl.h |  2 ++
 drivers/net/nfp/nfp_ethdev.c         |  3 +++
 drivers/net/nfp/nfp_net_common.c     | 38 ++++++++++++++++++++++++++++
 drivers/net/nfp/nfp_net_common.h     |  2 ++
 4 files changed, 45 insertions(+)

diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h
index a52c33508e..69596dd6f5 100644
--- a/drivers/common/nfp/nfp_common_ctrl.h
+++ b/drivers/common/nfp/nfp_common_ctrl.h
@@ -24,9 +24,11 @@
 /* VF config mailbox */
 #define NFP_NET_VF_CFG_MB               0x0
 #define NFP_NET_VF_CFG_MB_CAP           0x0
+#define   NFP_NET_VF_CFG_MB_CAP_QUEUE_CONFIG      (0x1 << 7)
 #define   NFP_NET_VF_CFG_MB_CAP_SPLIT             (0x1 << 8)
 #define NFP_NET_VF_CFG_MB_RET           0x2
 #define NFP_NET_VF_CFG_MB_UPD           0x4
+#define   NFP_NET_VF_CFG_MB_UPD_QUEUE_CONFIG      (0x1 << 7)
 #define   NFP_NET_VF_CFG_MB_UPD_SPLIT             (0x1 << 8)
 #define NFP_NET_VF_CFG_MB_VF_CNT        0x6
 #define NFP_NET_VF_CFG_MB_VF_NUM        0x7
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index f9f0884c88..1d88f33756 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -36,6 +36,7 @@
 #define NFP_PF_DRIVER_NAME net_nfp_pf
 #define NFP_PF_FORCE_RELOAD_FW   "force_reload_fw"
 #define NFP_CPP_SERVICE_ENABLE   "cpp_service_enable"
+#define NFP_QUEUE_PER_VF     1
 
 struct nfp_net_init {
 	/** Sequential physical port number, only valid for CoreNIC firmware */
@@ -1973,6 +1974,8 @@ nfp_net_get_vf_info(struct nfp_pf_dev *pf_dev,
 	if (ret < 0)
 		return ret;
 
+	pf_dev->queue_per_vf = NFP_QUEUE_PER_VF;
+
 	return 0;
 }
 
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index e1cae983b2..f8566d94d7 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -2654,6 +2654,38 @@ nfp_net_sriov_update(struct nfp_net_hw *net_hw,
 	return 0;
 }
 
+static int
+nfp_net_vf_queues_config(struct nfp_net_hw *net_hw,
+		struct nfp_pf_dev *pf_dev)
+{
+	int ret;
+	uint32_t i;
+	uint32_t offset;
+
+	ret = nfp_net_sriov_check(pf_dev, NFP_NET_VF_CFG_MB_CAP_QUEUE_CONFIG);
+	if (ret != 0) {
+		if (ret == -ENOTSUP) {
+			PMD_INIT_LOG(WARNING, "Set VF max queue not supported");
+			return 0;
+		}
+
+		PMD_INIT_LOG(ERR, "Set VF max queue failed");
+		return ret;
+	}
+
+	offset = NFP_NET_VF_CFG_MB_SZ + pf_dev->max_vfs * NFP_NET_VF_CFG_SZ;
+	for (i = 0; i < pf_dev->sriov_vf; i++) {
+		ret = nfp_net_vf_reconfig(net_hw, pf_dev, NFP_NET_VF_CFG_MB_UPD_QUEUE_CONFIG,
+				pf_dev->queue_per_vf, pf_dev->vf_base_id + offset + i);
+		if (ret != 0) {
+			PMD_INIT_LOG(ERR, "Set VF max_queue failed");
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
 static int
 nfp_net_sriov_init(struct nfp_net_hw *net_hw,
 		struct nfp_pf_dev *pf_dev)
@@ -2697,5 +2729,11 @@ nfp_net_vf_config_app_init(struct nfp_net_hw *net_hw,
 		return ret;
 	}
 
+	ret = nfp_net_vf_queues_config(net_hw, pf_dev);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to config vf queue");
+		return ret;
+	}
+
 	return 0;
 }
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index 4b5029f3f4..b5c6152857 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -158,6 +158,8 @@ struct nfp_pf_dev {
 	uint8_t total_phyports;
 	/** Id of first VF that belongs to this PF */
 	uint8_t vf_base_id;
+	/** Number of queues per VF */
+	uint32_t queue_per_vf;
 };
 
 #define NFP_NET_FLOW_LIMIT    1024
-- 
2.39.1


  parent reply	other threads:[~2024-06-19 10:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
2024-06-19  9:58 ` [PATCH 01/23] net/nfp: fix dereference of null pointer Chaoyong He
2024-07-07 18:56   ` Ferruh Yigit
2024-07-08  1:35     ` Chaoyong He
2024-06-19  9:58 ` [PATCH 02/23] net/nfp: disable ctrl VNIC queues Chaoyong He
2024-06-19  9:58 ` [PATCH 03/23] net/nfp: fix dereference of null pointer Chaoyong He
2024-06-19  9:58 ` [PATCH 04/23] net/nfp: fix repeat disable the port Chaoyong He
2024-06-19  9:58 ` [PATCH 05/23] net/nfp: fix repeat set the speed configure Chaoyong He
2024-06-19  9:58 ` [PATCH 06/23] net/nfp: make the logic simpler by adding local variable Chaoyong He
2024-06-19  9:58 ` [PATCH 07/23] net/nfp: rename the variable name Chaoyong He
2024-06-19  9:58 ` [PATCH 08/23] net/nfp: export function ID get interface Chaoyong He
2024-06-19  9:58 ` [PATCH 09/23] net/nfp: extract total phyports Chaoyong He
2024-06-19  9:58 ` [PATCH 10/23] net/nfp: extract the initialize helper function Chaoyong He
2024-06-19  9:58 ` [PATCH 11/23] net/nfp: get the VF configuration Chaoyong He
2024-06-19  9:58 ` [PATCH 12/23] net/nfp: refactor the logic of flower service Chaoyong He
2024-06-19  9:58 ` [PATCH 13/23] net/nfp: get the first VF ID of the PF Chaoyong He
2024-06-19  9:58 ` [PATCH 14/23] net/nfp: add the helper function to map rtsym with offset Chaoyong He
2024-06-19  9:58 ` [PATCH 15/23] net/nfp: add the VF table to record the VF information Chaoyong He
2024-06-19  9:58 ` [PATCH 16/23] net/nfp: support configuration of VF numbers Chaoyong He
2024-06-19  9:58 ` Chaoyong He [this message]
2024-06-19  9:58 ` [PATCH 18/23] net/nfp: add check for numbers of VF representor port Chaoyong He
2024-06-19  9:58 ` [PATCH 19/23] net/nfp: add support of ring pop and push Chaoyong He
2024-06-19  9:58 ` [PATCH 20/23] net/nfp: add resource share mode of host context Chaoyong He
2024-06-19  9:58 ` [PATCH 21/23] net/nfp: add resource share mode of mask ID Chaoyong He
2024-06-19  9:58 ` [PATCH 22/23] net/nfp: add device active command for nsp service Chaoyong He
2024-06-19  9:58 ` [PATCH 23/23] net/nfp: add support of flower firmware with multiple PF Chaoyong He
2024-07-07 18:56 ` [PATCH 00/23] support " Ferruh Yigit

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=20240619095830.3479757-18-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=peng.zhang@corigine.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).