DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richards@intel.com>
To: dev@dpdk.org
Cc: ferruh.yigit@amd.com, thomas@monjalon.net,
	mb@smartsharesystems.com,
	Bruce Richardson <bruce.richards@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>
Subject: [RFC PATCH v2 05/26] ethdev: use separate Rx and Tx queue limits
Date: Tue, 13 Aug 2024 16:59:42 +0100	[thread overview]
Message-ID: <20240813160003.423935-6-bruce.richards@intel.com> (raw)
In-Reply-To: <20240813160003.423935-1-bruce.richards@intel.com>

Update library to use the new defines RTE_MAX_ETHPORT_TX_QUEUES and
RTE_MAX_ETHPORT_RX_QUEUES rather than the old define
RTE_MAX_QUEUES_PER_PORT.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/ethdev/ethdev_driver.h  |  8 ++++----
 lib/ethdev/ethdev_private.c | 24 ++++++++++++++----------
 lib/ethdev/rte_ethdev.c     | 16 +++++++---------
 lib/ethdev/rte_ethdev.h     | 18 +++++++++---------
 4 files changed, 34 insertions(+), 32 deletions(-)

diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 883e59a927..51ec8e8395 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -84,12 +84,12 @@ struct __rte_cache_aligned rte_eth_dev {
 	 * User-supplied functions called from rx_burst to post-process
 	 * received packets before passing them to the user
 	 */
-	RTE_ATOMIC(struct rte_eth_rxtx_callback *) post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
+	RTE_ATOMIC(struct rte_eth_rxtx_callback *) post_rx_burst_cbs[RTE_MAX_ETHPORT_RX_QUEUES];
 	/**
 	 * User-supplied functions called from tx_burst to pre-process
 	 * received packets before passing them to the driver for transmission
 	 */
-	RTE_ATOMIC(struct rte_eth_rxtx_callback *) pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
+	RTE_ATOMIC(struct rte_eth_rxtx_callback *) pre_tx_burst_cbs[RTE_MAX_ETHPORT_TX_QUEUES];
 
 	enum rte_eth_dev_state state; /**< Flag indicating the port state */
 	void *security_ctx; /**< Context for security ops */
@@ -165,9 +165,9 @@ struct __rte_cache_aligned rte_eth_dev_data {
 		flow_configured : 1;
 
 	/** Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0) */
-	uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
+	uint8_t rx_queue_state[RTE_MAX_ETHPORT_RX_QUEUES];
 	/** Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0) */
-	uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
+	uint8_t tx_queue_state[RTE_MAX_ETHPORT_TX_QUEUES];
 
 	uint32_t dev_flags;             /**< Capabilities */
 	int numa_node;                  /**< NUMA node connection */
diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c
index 626524558a..e00530f370 100644
--- a/lib/ethdev/ethdev_private.c
+++ b/lib/ethdev/ethdev_private.c
@@ -190,7 +190,8 @@ struct dummy_queue {
 	bool rx_warn_once;
 	bool tx_warn_once;
 };
-static struct dummy_queue *dummy_queues_array[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT];
+static struct dummy_queue *dummy_rxq_array[RTE_MAX_ETHPORTS][RTE_MAX_ETHPORT_RX_QUEUES];
+static struct dummy_queue *dummy_txq_array[RTE_MAX_ETHPORTS][RTE_MAX_ETHPORT_TX_QUEUES];
 static struct dummy_queue per_port_queues[RTE_MAX_ETHPORTS];
 RTE_INIT(dummy_queue_init)
 {
@@ -199,8 +200,10 @@ RTE_INIT(dummy_queue_init)
 	for (port_id = 0; port_id < RTE_DIM(per_port_queues); port_id++) {
 		unsigned int q;
 
-		for (q = 0; q < RTE_DIM(dummy_queues_array[port_id]); q++)
-			dummy_queues_array[port_id][q] = &per_port_queues[port_id];
+		for (q = 0; q < RTE_DIM(dummy_rxq_array[port_id]); q++)
+			dummy_rxq_array[port_id][q] = &per_port_queues[port_id];
+		for (q = 0; q < RTE_DIM(dummy_txq_array[port_id]); q++)
+			dummy_txq_array[port_id][q] = &per_port_queues[port_id];
 	}
 }
 
@@ -245,7 +248,8 @@ dummy_eth_tx_burst(void *txq,
 void
 eth_dev_fp_ops_reset(struct rte_eth_fp_ops *fpo)
 {
-	static RTE_ATOMIC(void *) dummy_data[RTE_MAX_QUEUES_PER_PORT];
+	static RTE_ATOMIC(void *) dummy_rx_data[RTE_MAX_ETHPORT_RX_QUEUES];
+	static RTE_ATOMIC(void *) dummy_tx_data[RTE_MAX_ETHPORT_TX_QUEUES];
 	uintptr_t port_id = fpo - rte_eth_fp_ops;
 
 	per_port_queues[port_id].rx_warn_once = false;
@@ -254,12 +258,12 @@ eth_dev_fp_ops_reset(struct rte_eth_fp_ops *fpo)
 		.rx_pkt_burst = dummy_eth_rx_burst,
 		.tx_pkt_burst = dummy_eth_tx_burst,
 		.rxq = {
-			.data = (void **)&dummy_queues_array[port_id],
-			.clbk = dummy_data,
+			.data = (void **)&dummy_rxq_array[port_id],
+			.clbk = dummy_rx_data,
 		},
 		.txq = {
-			.data = (void **)&dummy_queues_array[port_id],
-			.clbk = dummy_data,
+			.data = (void **)&dummy_txq_array[port_id],
+			.clbk = dummy_tx_data,
 		},
 	};
 }
@@ -420,7 +424,7 @@ eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 	if (dev->data->rx_queues == NULL && nb_queues != 0) { /* first time configuration */
 		dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues",
 				sizeof(dev->data->rx_queues[0]) *
-				RTE_MAX_QUEUES_PER_PORT,
+				RTE_MAX_ETHPORT_RX_QUEUES,
 				RTE_CACHE_LINE_SIZE);
 		if (dev->data->rx_queues == NULL) {
 			dev->data->nb_rx_queues = 0;
@@ -450,7 +454,7 @@ eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 	if (dev->data->tx_queues == NULL && nb_queues != 0) { /* first time configuration */
 		dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues",
 				sizeof(dev->data->tx_queues[0]) *
-				RTE_MAX_QUEUES_PER_PORT,
+				RTE_MAX_ETHPORT_TX_QUEUES,
 				RTE_CACHE_LINE_SIZE);
 		if (dev->data->tx_queues == NULL) {
 			dev->data->nb_tx_queues = 0;
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index f1c658f49e..7999327beb 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1367,18 +1367,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 			nb_tx_q = RTE_ETH_DEV_FALLBACK_TX_NBQUEUES;
 	}
 
-	if (nb_rx_q > RTE_MAX_QUEUES_PER_PORT) {
+	if (nb_rx_q > RTE_MAX_ETHPORT_RX_QUEUES) {
 		RTE_ETHDEV_LOG_LINE(ERR,
 			"Number of Rx queues requested (%u) is greater than max supported(%d)",
-			nb_rx_q, RTE_MAX_QUEUES_PER_PORT);
+			nb_rx_q, RTE_MAX_ETHPORT_RX_QUEUES);
 		ret = -EINVAL;
 		goto rollback;
 	}
 
-	if (nb_tx_q > RTE_MAX_QUEUES_PER_PORT) {
+	if (nb_tx_q > RTE_MAX_ETHPORT_TX_QUEUES) {
 		RTE_ETHDEV_LOG_LINE(ERR,
 			"Number of Tx queues requested (%u) is greater than max supported(%d)",
-			nb_tx_q, RTE_MAX_QUEUES_PER_PORT);
+			nb_tx_q, RTE_MAX_ETHPORT_TX_QUEUES);
 		ret = -EINVAL;
 		goto rollback;
 	}
@@ -3811,11 +3811,9 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
 		return eth_err(port_id, diag);
 	}
 
-	/* Maximum number of queues should be <= RTE_MAX_QUEUES_PER_PORT */
-	dev_info->max_rx_queues = RTE_MIN(dev_info->max_rx_queues,
-			RTE_MAX_QUEUES_PER_PORT);
-	dev_info->max_tx_queues = RTE_MIN(dev_info->max_tx_queues,
-			RTE_MAX_QUEUES_PER_PORT);
+	/* Maximum number of queues should be <= RTE_MAX_ETHPORT_RX/TX_QUEUES */
+	dev_info->max_rx_queues = RTE_MIN(dev_info->max_rx_queues, RTE_MAX_ETHPORT_RX_QUEUES);
+	dev_info->max_tx_queues = RTE_MIN(dev_info->max_tx_queues, RTE_MAX_ETHPORT_TX_QUEUES);
 
 	dev_info->driver_name = dev->device->driver->name;
 	dev_info->nb_rx_queues = dev->data->nb_rx_queues;
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 548fada1c7..06d6a3dcd0 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -6090,7 +6090,7 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
 
 #ifdef RTE_ETHDEV_DEBUG_RX
 	if (port_id >= RTE_MAX_ETHPORTS ||
-			queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+			queue_id >= RTE_MAX_ETHPORT_RX_QUEUES) {
 		RTE_ETHDEV_LOG_LINE(ERR,
 			"Invalid port_id=%u or queue_id=%u",
 			port_id, queue_id);
@@ -6161,7 +6161,7 @@ rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
 
 #ifdef RTE_ETHDEV_DEBUG_RX
 	if (port_id >= RTE_MAX_ETHPORTS ||
-			queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+			queue_id >= RTE_MAX_ETHPORT_RX_QUEUES) {
 		RTE_ETHDEV_LOG_LINE(ERR,
 			"Invalid port_id=%u or queue_id=%u",
 			port_id, queue_id);
@@ -6234,7 +6234,7 @@ rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
 
 #ifdef RTE_ETHDEV_DEBUG_RX
 	if (port_id >= RTE_MAX_ETHPORTS ||
-			queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+			queue_id >= RTE_MAX_ETHPORT_RX_QUEUES) {
 		RTE_ETHDEV_LOG_LINE(ERR,
 			"Invalid port_id=%u or queue_id=%u",
 			port_id, queue_id);
@@ -6305,7 +6305,7 @@ static inline int rte_eth_tx_descriptor_status(uint16_t port_id,
 
 #ifdef RTE_ETHDEV_DEBUG_TX
 	if (port_id >= RTE_MAX_ETHPORTS ||
-			queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+			queue_id >= RTE_MAX_ETHPORT_TX_QUEUES) {
 		RTE_ETHDEV_LOG_LINE(ERR,
 			"Invalid port_id=%u or queue_id=%u",
 			port_id, queue_id);
@@ -6429,7 +6429,7 @@ rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id,
 
 #ifdef RTE_ETHDEV_DEBUG_TX
 	if (port_id >= RTE_MAX_ETHPORTS ||
-			queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+			queue_id >= RTE_MAX_ETHPORT_TX_QUEUES) {
 		RTE_ETHDEV_LOG_LINE(ERR,
 			"Invalid port_id=%u or queue_id=%u",
 			port_id, queue_id);
@@ -6539,7 +6539,7 @@ rte_eth_tx_prepare(uint16_t port_id, uint16_t queue_id,
 
 #ifdef RTE_ETHDEV_DEBUG_TX
 	if (port_id >= RTE_MAX_ETHPORTS ||
-			queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+			queue_id >= RTE_MAX_ETHPORT_TX_QUEUES) {
 		RTE_ETHDEV_LOG_LINE(ERR,
 			"Invalid port_id=%u or queue_id=%u",
 			port_id, queue_id);
@@ -6744,7 +6744,7 @@ rte_eth_recycle_mbufs(uint16_t rx_port_id, uint16_t rx_queue_id,
 
 #ifdef RTE_ETHDEV_DEBUG_TX
 	if (tx_port_id >= RTE_MAX_ETHPORTS ||
-			tx_queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+			tx_queue_id >= RTE_MAX_ETHPORT_TX_QUEUES) {
 		RTE_ETHDEV_LOG_LINE(ERR,
 				"Invalid tx_port_id=%u or tx_queue_id=%u",
 				tx_port_id, tx_queue_id);
@@ -6770,7 +6770,7 @@ rte_eth_recycle_mbufs(uint16_t rx_port_id, uint16_t rx_queue_id,
 
 #ifdef RTE_ETHDEV_DEBUG_RX
 	if (rx_port_id >= RTE_MAX_ETHPORTS ||
-			rx_queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+			rx_queue_id >= RTE_MAX_ETHPORT_RX_QUEUES) {
 		RTE_ETHDEV_LOG_LINE(ERR, "Invalid rx_port_id=%u or rx_queue_id=%u",
 				rx_port_id, rx_queue_id);
 		return 0;
@@ -6890,7 +6890,7 @@ rte_eth_tx_queue_count(uint16_t port_id, uint16_t queue_id)
 		goto out;
 	}
 
-	if (queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+	if (queue_id >= RTE_MAX_ETHPORT_TX_QUEUES) {
 		RTE_ETHDEV_LOG_LINE(ERR, "Invalid queue_id=%u for port_id=%u",
 				    queue_id, port_id);
 		rc = -EINVAL;
-- 
2.43.0


  parent reply	other threads:[~2024-08-14  7:49 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12 13:29 [RFC PATCH] config: make queues per port a meson config option Bruce Richardson
2024-08-12 14:10 ` Morten Brørup
2024-08-12 14:18   ` Bruce Richardson
2024-08-12 15:02     ` Morten Brørup
2024-08-12 15:09       ` Bruce Richardson
2024-08-13 15:59 ` [RFC PATCH v2 00/26] add meson config options for queues per port Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 01/26] cryptodev: remove use of ethdev max queues definition Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 02/26] eventdev: remove use of ethev queues define Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 03/26] app/test-bbdev: remove use of ethdev queue count value Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 04/26] config: add separate defines for max Rx and Tx queues Bruce Richardson
2024-08-13 15:59   ` Bruce Richardson [this message]
2024-08-13 15:59   ` [RFC PATCH v2 06/26] bpf: use separate Rx and Tx queue limits Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 07/26] latencystats: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 08/26] pdump: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 09/26] power: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 10/26] net/af_xdp: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 11/26] net/cnxk: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 12/26] net/failsafe: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 13/26] net/hns3: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 14/26] net/mlx5: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 15/26] net/null: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 16/26] net/sfc: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 17/26] net/thunderx: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 18/26] net/vhost: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 19/26] app/dumpcap: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 20/26] app/test-pmd: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 21/26] examples/ipsec-secgw: " Bruce Richardson
2024-08-13 15:59   ` [RFC PATCH v2 22/26] examples/l3fwd-power: " Bruce Richardson
2024-08-13 16:00   ` [RFC PATCH v2 23/26] examples/l3fwd: " Bruce Richardson
2024-08-13 16:00   ` [RFC PATCH v2 24/26] examples/vhost: " Bruce Richardson
2024-08-13 16:00   ` [RFC PATCH v2 25/26] config: make queues per port a meson config option Bruce Richardson
2024-08-13 16:00   ` [RFC PATCH v2 26/26] config: add computed max queues define for compatibility Bruce Richardson
2024-08-14 15:01     ` Stephen Hemminger
2024-08-14 15:12       ` Bruce Richardson
2024-08-14  7:43   ` [RFC PATCH v2 00/26] add meson config options for queues per port Morten Brørup
2024-08-14  7:48   ` Morten Brørup
2024-08-14  7:51     ` Bruce Richardson
2024-08-14 10:49 ` [PATCH v3 " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 01/26] cryptodev: remove use of ethdev max queues definition Bruce Richardson
2024-09-19 13:16     ` David Marchand
2024-08-14 10:49   ` [PATCH v3 02/26] eventdev: remove use of ethev queues define Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 03/26] app/test-bbdev: remove use of ethdev queue count value Bruce Richardson
2024-09-19 13:36     ` David Marchand
2024-08-14 10:49   ` [PATCH v3 04/26] config: add separate defines for max Rx and Tx queues Bruce Richardson
2024-09-10  2:54     ` fengchengwen
2024-10-10 16:27       ` Stephen Hemminger
2024-10-10 16:32         ` Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 05/26] ethdev: use separate Rx and Tx queue limits Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 06/26] bpf: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 07/26] latencystats: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 08/26] pdump: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 09/26] power: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 10/26] net/af_xdp: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 11/26] net/cnxk: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 12/26] net/failsafe: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 13/26] net/hns3: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 14/26] net/mlx5: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 15/26] net/null: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 16/26] net/sfc: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 17/26] net/thunderx: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 18/26] net/vhost: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 19/26] app/dumpcap: " Bruce Richardson
2024-10-03 23:38     ` Stephen Hemminger
2024-08-14 10:49   ` [PATCH v3 20/26] app/test-pmd: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 21/26] examples/ipsec-secgw: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 22/26] examples/l3fwd-power: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 23/26] examples/l3fwd: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 24/26] examples/vhost: " Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 25/26] config: make queues per port a meson config option Bruce Richardson
2024-08-14 10:49   ` [PATCH v3 26/26] config: add computed max queues define for compatibility Bruce Richardson
2024-09-19 14:14   ` [PATCH v3 00/26] add meson config options for queues per port David Marchand
2024-09-19 15:08     ` Bruce Richardson

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=20240813160003.423935-6-bruce.richards@intel.com \
    --to=bruce.richards@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=mb@smartsharesystems.com \
    --cc=thomas@monjalon.net \
    /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).