DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] Increase the queue number of representor port
@ 2024-08-30  2:29 Chaoyong He
  2024-08-30  2:30 ` [PATCH 1/3] net/nfp: remove restrictions on port queue number Chaoyong He
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chaoyong He @ 2024-08-30  2:29 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He

This patch series increase rxq/txq number of representor ports, aims to
increase the speed of slow path.

Long Wu (3):
  net/nfp: remove restrictions on port queue number
  net/nfp: increase representor port rxq number
  net/nfp: increase representor port txq number

 drivers/net/nfp/flower/nfp_flower.c           |  8 +--
 drivers/net/nfp/flower/nfp_flower.h           |  2 +-
 .../net/nfp/flower/nfp_flower_representor.c   | 59 +++++++++++--------
 .../net/nfp/flower/nfp_flower_representor.h   |  2 +-
 drivers/net/nfp/nfp_rxtx.c                    |  4 +-
 5 files changed, 40 insertions(+), 35 deletions(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] net/nfp: remove restrictions on port queue number
  2024-08-30  2:29 [PATCH 0/3] Increase the queue number of representor port Chaoyong He
@ 2024-08-30  2:30 ` Chaoyong He
  2024-08-30  2:30 ` [PATCH 2/3] net/nfp: increase representor port rxq number Chaoyong He
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Chaoyong He @ 2024-08-30  2:30 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Long Wu, Chaoyong He, Peng Zhang

From: Long Wu <long.wu@corigine.com>

The flower firmware can support multi-queue for representor port now,
so remove restrictions on queue number of representor port.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_representor.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index b1589cf78c..130795357d 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -56,8 +56,8 @@ nfp_flower_repr_dev_infos_get(__rte_unused struct rte_eth_dev *dev,
 	pf_hw = repr->app_fw_flower->pf_hw;
 
 	/* Hardcoded pktlen and queues for now */
-	dev_info->max_rx_queues = 1;
-	dev_info->max_tx_queues = 1;
+	dev_info->max_rx_queues = (uint16_t)pf_hw->max_rx_queues;
+	dev_info->max_tx_queues = (uint16_t)pf_hw->max_tx_queues;
 	dev_info->min_rx_bufsize = RTE_ETHER_MIN_MTU;
 	dev_info->max_rx_pktlen = 9000;
 
@@ -581,10 +581,6 @@ nfp_flower_pf_repr_init(struct rte_eth_dev *eth_dev,
 	/* This backer port is that of the eth_device created for the PF vNIC */
 	eth_dev->data->backer_port_id = 0;
 
-	/* Only single queues for representor devices */
-	eth_dev->data->nb_rx_queues = 1;
-	eth_dev->data->nb_tx_queues = 1;
-
 	/* Allocating memory for mac addr */
 	eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", RTE_ETHER_ADDR_LEN, 0);
 	if (eth_dev->data->mac_addrs == NULL) {
@@ -662,10 +658,6 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev,
 	/* This backer port is that of the eth_device created for the PF vNIC */
 	eth_dev->data->backer_port_id = 0;
 
-	/* Only single queues for representor devices */
-	eth_dev->data->nb_rx_queues = 1;
-	eth_dev->data->nb_tx_queues = 1;
-
 	/* Allocating memory for mac addr */
 	eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", RTE_ETHER_ADDR_LEN, 0);
 	if (eth_dev->data->mac_addrs == NULL) {
-- 
2.39.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] net/nfp: increase representor port rxq number
  2024-08-30  2:29 [PATCH 0/3] Increase the queue number of representor port Chaoyong He
  2024-08-30  2:30 ` [PATCH 1/3] net/nfp: remove restrictions on port queue number Chaoyong He
@ 2024-08-30  2:30 ` Chaoyong He
  2024-08-30  2:30 ` [PATCH 3/3] net/nfp: increase representor port txq number Chaoyong He
  2024-09-02 11:04 ` [PATCH 0/3] Increase the queue number of representor port Ferruh Yigit
  3 siblings, 0 replies; 5+ messages in thread
From: Chaoyong He @ 2024-08-30  2:30 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Long Wu, Chaoyong He, Peng Zhang

From: Long Wu <long.wu@corigine.com>

This commit supports configuring multiple Rx queues for flower
representor port.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower.c           |  8 ++--
 drivers/net/nfp/flower/nfp_flower.h           |  2 +-
 .../net/nfp/flower/nfp_flower_representor.c   | 40 +++++++++++++------
 .../net/nfp/flower/nfp_flower_representor.h   |  2 +-
 drivers/net/nfp/nfp_rxtx.c                    |  4 +-
 5 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index fa272790bc..8d781658ea 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -126,24 +126,24 @@ nfp_flower_get_repr(struct nfp_net_hw_priv *hw_priv,
 }
 
 bool
-nfp_flower_pf_dispatch_pkts(struct nfp_net_hw_priv *hw_priv,
+nfp_flower_pf_dispatch_pkts(struct nfp_net_rxq *rxq,
 		struct rte_mbuf *mbuf,
 		uint32_t port_id)
 {
 	struct nfp_flower_representor *repr;
 
-	repr = nfp_flower_get_repr(hw_priv, port_id);
+	repr = nfp_flower_get_repr(rxq->hw_priv, port_id);
 	if (repr == NULL) {
 		PMD_RX_LOG(ERR, "Can not get repr for port %u", port_id);
 		return false;
 	}
 
-	if (repr->ring == NULL) {
+	if (repr->ring == NULL || repr->ring[rxq->qidx] == NULL) {
 		PMD_RX_LOG(ERR, "No ring available for repr_port %s", repr->name);
 		return false;
 	}
 
-	if (rte_ring_enqueue(repr->ring, (void *)mbuf) != 0)
+	if (rte_ring_enqueue(repr->ring[rxq->qidx], (void *)mbuf) != 0)
 		return false;
 
 	return true;
diff --git a/drivers/net/nfp/flower/nfp_flower.h b/drivers/net/nfp/flower/nfp_flower.h
index b0d8fb0ed4..1dc868fb68 100644
--- a/drivers/net/nfp/flower/nfp_flower.h
+++ b/drivers/net/nfp/flower/nfp_flower.h
@@ -110,7 +110,7 @@ nfp_flower_support_decap_v2(const struct nfp_app_fw_flower *app_fw_flower)
 int nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv);
 void nfp_uninit_app_fw_flower(struct nfp_net_hw_priv *hw_priv);
 int nfp_secondary_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv);
-bool nfp_flower_pf_dispatch_pkts(struct nfp_net_hw_priv *hw_priv,
+bool nfp_flower_pf_dispatch_pkts(struct nfp_net_rxq *rxq,
 		struct rte_mbuf *mbuf,
 		uint32_t port_id);
 uint16_t nfp_flower_pf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 130795357d..96433b9f87 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -138,13 +138,14 @@ nfp_flower_repr_dev_stop(struct rte_eth_dev *dev)
 static int
 nfp_flower_repr_rx_queue_setup(struct rte_eth_dev *dev,
 		uint16_t rx_queue_id,
-		__rte_unused uint16_t nb_rx_desc,
+		uint16_t nb_rx_desc,
 		unsigned int socket_id,
 		__rte_unused const struct rte_eth_rxconf *rx_conf,
 		__rte_unused struct rte_mempool *mb_pool)
 {
 	struct nfp_net_rxq *rxq;
 	struct nfp_net_hw *pf_hw;
+	char ring_name[RTE_RING_NAMESIZE];
 	struct nfp_flower_representor *repr;
 
 	repr = dev->data->dev_private;
@@ -156,6 +157,15 @@ nfp_flower_repr_rx_queue_setup(struct rte_eth_dev *dev,
 	if (rxq == NULL)
 		return -ENOMEM;
 
+	snprintf(ring_name, sizeof(ring_name), "%s-%s-%u", repr->name, "Rx", rx_queue_id);
+	repr->ring[rx_queue_id] = rte_ring_create(ring_name, nb_rx_desc,
+			rte_socket_id(), 0);
+	if (repr->ring[rx_queue_id] == NULL) {
+		PMD_DRV_LOG(ERR, "rte_ring_create failed for rx queue %u", rx_queue_id);
+		rte_free(rxq);
+		return -ENOMEM;
+	}
+
 	rxq->hw = pf_hw;
 	rxq->qidx = rx_queue_id;
 	rxq->port_id = dev->data->port_id;
@@ -249,18 +259,18 @@ nfp_flower_repr_rx_burst(void *rx_queue,
 
 	dev = &rte_eth_devices[rxq->port_id];
 	repr = dev->data->dev_private;
-	if (unlikely(repr->ring == NULL)) {
+	if (unlikely(repr->ring == NULL) ||
+			unlikely(repr->ring[rxq->qidx] == NULL)) {
 		PMD_RX_LOG(ERR, "representor %s has no ring configured!",
 				repr->name);
 		return 0;
 	}
 
-	total_dequeue = rte_ring_dequeue_burst(repr->ring, (void *)rx_pkts,
-			nb_pkts, &available);
+	total_dequeue = rte_ring_dequeue_burst(repr->ring[rxq->qidx],
+			(void *)rx_pkts, nb_pkts, &available);
 	if (total_dequeue != 0) {
-		PMD_RX_LOG(DEBUG, "Representor Rx burst for %s, port_id: %#x, "
-				"received: %u, available: %u", repr->name,
-				repr->port_id, total_dequeue, available);
+		PMD_RX_LOG(DEBUG, "Port: %#x, queue: %hu received: %u, available: %u",
+				repr->port_id, rxq->qidx, total_dequeue, available);
 
 		data_len = 0;
 		for (i = 0; i < total_dequeue; i++)
@@ -328,12 +338,16 @@ static void
 nfp_flower_repr_free_queue(struct rte_eth_dev *eth_dev)
 {
 	uint16_t i;
+	struct nfp_flower_representor *repr;
 
 	for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
 		rte_free(eth_dev->data->tx_queues[i]);
 
-	for (i = 0; i < eth_dev->data->nb_rx_queues; i++)
+	for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+		repr = eth_dev->data->dev_private;
+		rte_ring_free(repr->ring[i]);
 		rte_free(eth_dev->data->rx_queues[i]);
+	}
 }
 
 static void
@@ -378,7 +392,7 @@ nfp_flower_repr_uninit(struct rte_eth_dev *eth_dev)
 
 	repr = eth_dev->data->dev_private;
 	rte_free(repr->repr_xstats_base);
-	rte_ring_free(repr->ring);
+	rte_free(repr->ring);
 
 	if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) {
 		index = NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM(repr->port_id);
@@ -627,9 +641,11 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev,
 	 */
 	snprintf(ring_name, sizeof(ring_name), "%s_%s", init_repr_data->name, "ring");
 	numa_node = rte_socket_id();
-	repr->ring = rte_ring_create(ring_name, 256, numa_node, RING_F_SC_DEQ);
+	repr->ring = rte_zmalloc_socket(ring_name,
+			sizeof(struct rte_ring *) * app_fw_flower->pf_hw->max_rx_queues,
+			RTE_CACHE_LINE_SIZE, numa_node);
 	if (repr->ring == NULL) {
-		PMD_DRV_LOG(ERR, "rte_ring_create failed for %s", ring_name);
+		PMD_DRV_LOG(ERR, "Ring create failed for %s", ring_name);
 		return -ENOMEM;
 	}
 
@@ -704,7 +720,7 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev,
 mac_cleanup:
 	rte_free(eth_dev->data->mac_addrs);
 ring_cleanup:
-	rte_ring_free(repr->ring);
+	rte_free(repr->ring);
 
 	return ret;
 }
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.h b/drivers/net/nfp/flower/nfp_flower_representor.h
index c068c4462c..70ca7b97db 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.h
+++ b/drivers/net/nfp/flower/nfp_flower_representor.h
@@ -17,7 +17,7 @@ struct nfp_flower_representor {
 	char name[RTE_ETH_NAME_MAX_LEN];
 	struct rte_ether_addr mac_addr;
 	struct nfp_app_fw_flower *app_fw_flower;
-	struct rte_ring *ring;
+	struct rte_ring **ring;
 	struct rte_eth_link link;
 	struct rte_eth_stats repr_stats;
 
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index da41a0e663..05218537f7 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -419,7 +419,6 @@ nfp_net_recv_pkts(void *rx_queue,
 	struct nfp_net_dp_buf *rxb;
 	struct nfp_net_rx_desc *rxds;
 	uint16_t avail_multiplexed = 0;
-	struct nfp_net_hw_priv *hw_priv;
 
 	rxq = rx_queue;
 	if (unlikely(rxq == NULL)) {
@@ -432,7 +431,6 @@ nfp_net_recv_pkts(void *rx_queue,
 	}
 
 	hw = rxq->hw;
-	hw_priv = rxq->hw_priv;
 
 	while (avail + avail_multiplexed < nb_pkts) {
 		rxb = &rxq->rxbufs[rxq->rd_p];
@@ -523,7 +521,7 @@ nfp_net_recv_pkts(void *rx_queue,
 
 		if (((meta.flags >> NFP_NET_META_PORTID) & 0x1) == 0) {
 			rx_pkts[avail++] = mb;
-		} else if (nfp_flower_pf_dispatch_pkts(hw_priv, mb, meta.port_id)) {
+		} else if (nfp_flower_pf_dispatch_pkts(rxq, mb, meta.port_id)) {
 			avail_multiplexed++;
 		} else {
 			rte_pktmbuf_free(mb);
-- 
2.39.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] net/nfp: increase representor port txq number
  2024-08-30  2:29 [PATCH 0/3] Increase the queue number of representor port Chaoyong He
  2024-08-30  2:30 ` [PATCH 1/3] net/nfp: remove restrictions on port queue number Chaoyong He
  2024-08-30  2:30 ` [PATCH 2/3] net/nfp: increase representor port rxq number Chaoyong He
@ 2024-08-30  2:30 ` Chaoyong He
  2024-09-02 11:04 ` [PATCH 0/3] Increase the queue number of representor port Ferruh Yigit
  3 siblings, 0 replies; 5+ messages in thread
From: Chaoyong He @ 2024-08-30  2:30 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Long Wu, Chaoyong He, Peng Zhang

From: Long Wu <long.wu@corigine.com>

This commit supports configuring multiple Tx queues for flower
representor port.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_representor.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 96433b9f87..872b8a6db4 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -315,12 +315,11 @@ nfp_flower_repr_tx_burst(void *tx_queue,
 	/* This points to the PF vNIC that owns this representor */
 	dev = repr->app_fw_flower->pf_ethdev;
 
-	/* Only using Tx queue 0 for now. */
-	pf_tx_queue = dev->data->tx_queues[0];
+	pf_tx_queue = dev->data->tx_queues[txq->qidx];
 	sent = nfp_flower_pf_xmit_pkts(pf_tx_queue, tx_pkts, nb_pkts);
 	if (sent != 0) {
-		PMD_TX_LOG(DEBUG, "Representor Tx burst for %s, port_id: %#x transmitted: %hu",
-				repr->name, repr->port_id, sent);
+		PMD_TX_LOG(DEBUG, "Port: %#x transmitted: %hu queue: %u",
+				repr->port_id, sent, txq->qidx);
 
 		data_len = 0;
 		for (i = 0; i < sent; i++)
-- 
2.39.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] Increase the queue number of representor port
  2024-08-30  2:29 [PATCH 0/3] Increase the queue number of representor port Chaoyong He
                   ` (2 preceding siblings ...)
  2024-08-30  2:30 ` [PATCH 3/3] net/nfp: increase representor port txq number Chaoyong He
@ 2024-09-02 11:04 ` Ferruh Yigit
  3 siblings, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2024-09-02 11:04 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers

On 8/30/2024 3:29 AM, Chaoyong He wrote:
> This patch series increase rxq/txq number of representor ports, aims to
> increase the speed of slow path.
> 
> Long Wu (3):
>   net/nfp: remove restrictions on port queue number
>   net/nfp: increase representor port rxq number
>   net/nfp: increase representor port txq number
>

Series applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-02 11:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-30  2:29 [PATCH 0/3] Increase the queue number of representor port Chaoyong He
2024-08-30  2:30 ` [PATCH 1/3] net/nfp: remove restrictions on port queue number Chaoyong He
2024-08-30  2:30 ` [PATCH 2/3] net/nfp: increase representor port rxq number Chaoyong He
2024-08-30  2:30 ` [PATCH 3/3] net/nfp: increase representor port txq number Chaoyong He
2024-09-02 11:04 ` [PATCH 0/3] Increase the queue number of representor port Ferruh Yigit

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).