DPDK patches and discussions
 help / color / mirror / Atom feed
From: beilei.xing@intel.com
To: jingjing.wu@intel.com, qi.z.zhang@intel.com
Cc: dev@dpdk.org, Beilei Xing <beilei.xing@intel.com>
Subject: [PATCH 09/15] common/idpf: init create vport info
Date: Thu,  8 Dec 2022 07:53:03 +0000	[thread overview]
Message-ID: <20221208075309.37852-10-beilei.xing@intel.com> (raw)
In-Reply-To: <20221208075309.37852-1-beilei.xing@intel.com>

From: Beilei Xing <beilei.xing@intel.com>

Initialize create vport info in common module.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/common/idpf/idpf_common_device.c | 35 +++++++++++++++++
 drivers/common/idpf/idpf_common_device.h | 11 ++++++
 drivers/common/idpf/version.map          |  1 +
 drivers/net/idpf/idpf_ethdev.c           | 48 +++---------------------
 drivers/net/idpf/idpf_ethdev.h           |  8 ----
 5 files changed, 53 insertions(+), 50 deletions(-)

diff --git a/drivers/common/idpf/idpf_common_device.c b/drivers/common/idpf/idpf_common_device.c
index fddd772cf2..3580028dce 100644
--- a/drivers/common/idpf/idpf_common_device.c
+++ b/drivers/common/idpf/idpf_common_device.c
@@ -637,4 +637,39 @@ idpf_config_irq_unmap(struct idpf_vport *vport, uint16_t nb_rx_queues)
 	return 0;
 }
 
+int
+idpf_create_vport_info_init(struct idpf_vport *vport,
+			    struct virtchnl2_create_vport *vport_info)
+{
+	struct idpf_adapter *adapter = vport->adapter;
+
+	vport_info->vport_type = rte_cpu_to_le_16(VIRTCHNL2_VPORT_TYPE_DEFAULT);
+	if (adapter->txq_model == 0) {
+		vport_info->txq_model =
+			rte_cpu_to_le_16(VIRTCHNL2_QUEUE_MODEL_SPLIT);
+		vport_info->num_tx_q = IDPF_DEFAULT_TXQ_NUM;
+		vport_info->num_tx_complq =
+			IDPF_DEFAULT_TXQ_NUM * IDPF_TX_COMPLQ_PER_GRP;
+	} else {
+		vport_info->txq_model =
+			rte_cpu_to_le_16(VIRTCHNL2_QUEUE_MODEL_SINGLE);
+		vport_info->num_tx_q = IDPF_DEFAULT_TXQ_NUM;
+		vport_info->num_tx_complq = 0;
+	}
+	if (adapter->rxq_model == 0) {
+		vport_info->rxq_model =
+			rte_cpu_to_le_16(VIRTCHNL2_QUEUE_MODEL_SPLIT);
+		vport_info->num_rx_q = IDPF_DEFAULT_RXQ_NUM;
+		vport_info->num_rx_bufq =
+			IDPF_DEFAULT_RXQ_NUM * IDPF_RX_BUFQ_PER_GRP;
+	} else {
+		vport_info->rxq_model =
+			rte_cpu_to_le_16(VIRTCHNL2_QUEUE_MODEL_SINGLE);
+		vport_info->num_rx_q = IDPF_DEFAULT_RXQ_NUM;
+		vport_info->num_rx_bufq = 0;
+	}
+
+	return 0;
+}
+
 RTE_LOG_REGISTER_SUFFIX(idpf_common_logtype, common, NOTICE);
diff --git a/drivers/common/idpf/idpf_common_device.h b/drivers/common/idpf/idpf_common_device.h
index 43a11b4822..97db8d9f53 100644
--- a/drivers/common/idpf/idpf_common_device.h
+++ b/drivers/common/idpf/idpf_common_device.h
@@ -16,6 +16,11 @@
 #define IDPF_CTLQ_LEN		64
 #define IDPF_DFLT_MBX_BUF_SIZE	4096
 
+#define IDPF_DEFAULT_RXQ_NUM	16
+#define IDPF_RX_BUFQ_PER_GRP	2
+#define IDPF_DEFAULT_TXQ_NUM	16
+#define IDPF_TX_COMPLQ_PER_GRP	1
+
 #define IDPF_MAX_PKT_TYPE	1024
 
 #define IDPF_DFLT_INTERVAL	16
@@ -33,6 +38,9 @@ struct idpf_adapter {
 	uint8_t *mbx_resp; /* buffer to store the mailbox response from cp */
 
 	uint32_t ptype_tbl[IDPF_MAX_PKT_TYPE] __rte_cache_min_aligned;
+
+	uint32_t txq_model; /* 0 - split queue model, non-0 - single queue model */
+	uint32_t rxq_model; /* 0 - split queue model, non-0 - single queue model */
 };
 
 struct idpf_chunks_info {
@@ -165,5 +173,8 @@ __rte_internal
 int idpf_config_irq_map(struct idpf_vport *vport, uint16_t nb_rx_queues);
 __rte_internal
 int idpf_config_irq_unmap(struct idpf_vport *vport, uint16_t nb_rx_queues);
+__rte_internal
+int idpf_create_vport_info_init(struct idpf_vport *vport,
+				struct virtchnl2_create_vport *vport_info);
 
 #endif /* _IDPF_COMMON_DEVICE_H_ */
diff --git a/drivers/common/idpf/version.map b/drivers/common/idpf/version.map
index 06ea907b3d..ca94196248 100644
--- a/drivers/common/idpf/version.map
+++ b/drivers/common/idpf/version.map
@@ -20,6 +20,7 @@ INTERNAL {
 	idpf_config_rss;
 	idpf_config_irq_map;
 	idpf_config_irq_unmap;
+	idpf_create_vport_info_init;
 
 	local: *;
 };
diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index a6942ad8ae..06625252b6 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -133,42 +133,6 @@ idpf_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 	return ptypes;
 }
 
-static int
-idpf_init_vport_req_info(struct rte_eth_dev *dev,
-			 struct virtchnl2_create_vport *vport_info)
-{
-	struct idpf_vport *vport = dev->data->dev_private;
-	struct idpf_adapter_ext *adapter = IDPF_ADAPTER_TO_EXT(vport->adapter);
-
-	vport_info->vport_type = rte_cpu_to_le_16(VIRTCHNL2_VPORT_TYPE_DEFAULT);
-	if (adapter->txq_model == 0) {
-		vport_info->txq_model =
-			rte_cpu_to_le_16(VIRTCHNL2_QUEUE_MODEL_SPLIT);
-		vport_info->num_tx_q = IDPF_DEFAULT_TXQ_NUM;
-		vport_info->num_tx_complq =
-			IDPF_DEFAULT_TXQ_NUM * IDPF_TX_COMPLQ_PER_GRP;
-	} else {
-		vport_info->txq_model =
-			rte_cpu_to_le_16(VIRTCHNL2_QUEUE_MODEL_SINGLE);
-		vport_info->num_tx_q = IDPF_DEFAULT_TXQ_NUM;
-		vport_info->num_tx_complq = 0;
-	}
-	if (adapter->rxq_model == 0) {
-		vport_info->rxq_model =
-			rte_cpu_to_le_16(VIRTCHNL2_QUEUE_MODEL_SPLIT);
-		vport_info->num_rx_q = IDPF_DEFAULT_RXQ_NUM;
-		vport_info->num_rx_bufq =
-			IDPF_DEFAULT_RXQ_NUM * IDPF_RX_BUFQ_PER_GRP;
-	} else {
-		vport_info->rxq_model =
-			rte_cpu_to_le_16(VIRTCHNL2_QUEUE_MODEL_SINGLE);
-		vport_info->num_rx_q = IDPF_DEFAULT_RXQ_NUM;
-		vport_info->num_rx_bufq = 0;
-	}
-
-	return 0;
-}
-
 static int
 idpf_init_rss(struct idpf_vport *vport)
 {
@@ -557,12 +521,12 @@ idpf_parse_devargs(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *adap
 		goto bail;
 
 	ret = rte_kvargs_process(kvlist, IDPF_TX_SINGLE_Q, &parse_bool,
-				 &adapter->txq_model);
+				 &adapter->base.txq_model);
 	if (ret != 0)
 		goto bail;
 
 	ret = rte_kvargs_process(kvlist, IDPF_RX_SINGLE_Q, &parse_bool,
-				 &adapter->rxq_model);
+				 &adapter->base.rxq_model);
 	if (ret != 0)
 		goto bail;
 
@@ -663,7 +627,7 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params)
 	struct idpf_vport_param *param = init_params;
 	struct idpf_adapter_ext *adapter = param->adapter;
 	/* for sending create vport virtchnl msg prepare */
-	struct virtchnl2_create_vport vport_req_info;
+	struct virtchnl2_create_vport create_vport_info;
 	int ret = 0;
 
 	dev->dev_ops = &idpf_eth_dev_ops;
@@ -671,14 +635,14 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params)
 	vport->sw_idx = param->idx;
 	vport->devarg_id = param->devarg_id;
 
-	memset(&vport_req_info, 0, sizeof(vport_req_info));
-	ret = idpf_init_vport_req_info(dev, &vport_req_info);
+	memset(&create_vport_info, 0, sizeof(create_vport_info));
+	ret = idpf_create_vport_info_init(vport, &create_vport_info);
 	if (ret != 0) {
 		PMD_INIT_LOG(ERR, "Failed to init vport req_info.");
 		goto err;
 	}
 
-	ret = idpf_vport_init(vport, &vport_req_info, dev->data);
+	ret = idpf_vport_init(vport, &create_vport_info, dev->data);
 	if (ret != 0) {
 		PMD_INIT_LOG(ERR, "Failed to init vports.");
 		goto err;
diff --git a/drivers/net/idpf/idpf_ethdev.h b/drivers/net/idpf/idpf_ethdev.h
index 32ae11ea11..2d7876489b 100644
--- a/drivers/net/idpf/idpf_ethdev.h
+++ b/drivers/net/idpf/idpf_ethdev.h
@@ -22,14 +22,9 @@
 
 #define IDPF_MAX_VPORT_NUM	8
 
-#define IDPF_DEFAULT_RXQ_NUM	16
-#define IDPF_DEFAULT_TXQ_NUM	16
-
 #define IDPF_INVALID_VPORT_IDX	0xffff
 #define IDPF_TXQ_PER_GRP	1
-#define IDPF_TX_COMPLQ_PER_GRP	1
 #define IDPF_RXQ_PER_GRP	1
-#define IDPF_RX_BUFQ_PER_GRP	2
 
 #define IDPF_DFLT_Q_VEC_NUM	1
 
@@ -77,9 +72,6 @@ struct idpf_adapter_ext {
 
 	char name[IDPF_ADAPTER_NAME_LEN];
 
-	uint32_t txq_model; /* 0 - split queue model, non-0 - single queue model */
-	uint32_t rxq_model; /* 0 - split queue model, non-0 - single queue model */
-
 	struct idpf_vport **vports;
 	uint16_t max_vport_nb;
 
-- 
2.26.2


  parent reply	other threads:[~2022-12-08  7:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08  7:52 [PATCH 00/15] net/idpf: refactor idpf pmd beilei.xing
2022-12-08  7:52 ` [PATCH 01/15] common/idpf: add adapter structure beilei.xing
2022-12-08  7:52 ` [PATCH 02/15] common/idpf: add vport structure beilei.xing
2022-12-08  7:52 ` [PATCH 03/15] common/idpf: move vc functions to common module beilei.xing
2022-12-08  7:52 ` [PATCH 04/15] common/idpf: introduce adapter init and deinit beilei.xing
2022-12-08  7:52 ` [PATCH 05/15] common/idpf: add vport init/deinit beilei.xing
2022-12-08  7:53 ` [PATCH 06/15] common/idpf: add config RSS beilei.xing
2022-12-08  7:53 ` [PATCH 07/15] common/idpf: add irq map/unmap beilei.xing
2022-12-08  7:53 ` [PATCH 08/15] common/idpf: move ptype table to adapter structure beilei.xing
2022-12-08  7:53 ` beilei.xing [this message]
2022-12-08  7:53 ` [PATCH 10/15] common/idpf: add vector flags in vport beilei.xing
2022-12-08  7:53 ` [PATCH 11/15] common/idpf: add rxq and txq struct beilei.xing
2022-12-08  7:53 ` [PATCH 12/15] common/idpf: add help functions for queue setup and release beilei.xing
2022-12-08  7:53 ` [PATCH 13/15] common/idpf: add scalar data path beilei.xing
2022-12-08  7:53 ` [PATCH 14/15] common/idpf: add vec queue setup beilei.xing
2022-12-08  7:53 ` [PATCH 15/15] common/idpf: add avx512 for single queue model beilei.xing
2023-01-06  9:16 ` [PATCH v2 00/15] net/idpf: introduce idpf common modle beilei.xing
2023-01-06  9:16   ` [PATCH v2 01/15] common/idpf: add adapter structure beilei.xing
2023-01-06  9:16   ` [PATCH v2 02/15] common/idpf: add vport structure beilei.xing
2023-01-06  9:16   ` [PATCH v2 03/15] common/idpf: move vc functions to common module beilei.xing
2023-01-06  9:16   ` [PATCH v2 04/15] common/idpf: introduce adapter init and deinit beilei.xing
2023-01-06  9:16   ` [PATCH v2 05/15] common/idpf: add vport init/deinit beilei.xing
2023-01-08 12:10     ` Zhang, Qi Z
2023-01-09  1:34       ` Xing, Beilei
2023-01-06  9:16   ` [PATCH v2 06/15] common/idpf: add config RSS beilei.xing
2023-01-06  9:16   ` [PATCH v2 07/15] common/idpf: add irq map/unmap beilei.xing
2023-01-17  1:14     ` Zhang, Qi Z
2023-01-06  9:16   ` [PATCH v2 08/15] common/idpf: move ptype table to adapter structure beilei.xing
2023-01-06  9:16   ` [PATCH v2 09/15] common/idpf: init create vport info beilei.xing
2023-01-06  9:16   ` [PATCH v2 10/15] common/idpf: add vector flags in vport beilei.xing
2023-01-06  9:16   ` [PATCH v2 11/15] common/idpf: add rxq and txq struct beilei.xing
2023-01-06  9:16   ` [PATCH v2 12/15] common/idpf: add help functions for queue setup and release beilei.xing
2023-01-06  9:16   ` [PATCH v2 13/15] common/idpf: add scalar data path beilei.xing
2023-01-06  9:16   ` [PATCH v2 14/15] common/idpf: add vec queue setup beilei.xing
2023-01-06  9:16   ` [PATCH v2 15/15] common/idpf: add avx512 for single queue model beilei.xing
     [not found] <https://patches.dpdk.org/project/dpdk/cover/20230106091627.13530-1-beilei.xing@intel.com/>
2023-01-17  7:26 ` [PATCH v3 00/15] net/idpf: introduce idpf common modle beilei.xing
2023-01-17  7:26   ` [PATCH 09/15] common/idpf: init create vport info beilei.xing

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=20221208075309.37852-10-beilei.xing@intel.com \
    --to=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=qi.z.zhang@intel.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).