patch 'net/ark: support single function with multiple port' has been queued to stable release 22.11.4

Xueming Li xuemingl at nvidia.com
Sun Oct 22 16:22:06 CEST 2023


Hi,

FYI, your patch has been queued to stable release 22.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/15/23. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=e054f121ef867aa4c96659f6b57ed3513a6dc48c

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From e054f121ef867aa4c96659f6b57ed3513a6dc48c Mon Sep 17 00:00:00 2001
From: Ed Czeck <ed.czeck at atomicrules.com>
Date: Tue, 10 Oct 2023 16:42:05 -0400
Subject: [PATCH] net/ark: support single function with multiple port
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit bf73ee28f47b1df65407ab324bc9d3452aea90c2 ]

Support the creation of multiple ports from one ark device via
the use of ark pmd extension.  I.e., one device with q queue can
seen a p ports each with q/p queues.

Add unique dev_private data for each port to manage queue assignment.

This patch repairs a latent issue uncovered during testing.

Fixes: 6799275eeea6 ("net/ark: support virtual functions")

Signed-off-by: Ed Czeck <ed.czeck at atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c    | 15 ++++++++++++++-
 drivers/net/ark/ark_ethdev_rx.c |  6 +++---
 drivers/net/ark/ark_ethdev_tx.c |  2 +-
 drivers/net/ark/ark_global.h    |  3 +++
 4 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index c654a229f7..c1681e8ecd 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -299,6 +299,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 	int ret;
 	int port_count = 1;
 	int p;
+	uint16_t num_queues;
 	bool rqpacing = false;

 	ark->eth_dev = dev;
@@ -426,6 +427,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 			ark->user_ext.dev_get_port_count(dev,
 				 ark->user_data[dev->data->port_id]);
 	ark->num_ports = port_count;
+	num_queues = ark_api_num_queues_per_port(ark->mpurx.v, port_count);

 	for (p = 0; p < port_count; p++) {
 		struct rte_eth_dev *eth_dev;
@@ -451,7 +453,18 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 		}

 		eth_dev->device = &pci_dev->device;
-		eth_dev->data->dev_private = ark;
+		/* Device requires new dev_private data */
+		eth_dev->data->dev_private =
+			rte_zmalloc_socket(name,
+					   sizeof(struct ark_adapter),
+					   RTE_CACHE_LINE_SIZE,
+					   rte_socket_id());
+
+		memcpy(eth_dev->data->dev_private, ark,
+		       sizeof(struct ark_adapter));
+		ark = eth_dev->data->dev_private;
+		ark->qbase = p * num_queues;
+
 		eth_dev->dev_ops = ark->eth_dev->dev_ops;
 		eth_dev->tx_pkt_burst = ark->eth_dev->tx_pkt_burst;
 		eth_dev->rx_pkt_burst = ark->eth_dev->rx_pkt_burst;
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index cbc0416bc2..38bc69dff4 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -68,7 +68,7 @@ struct ark_rx_queue {
 static int
 eth_ark_rx_hw_setup(struct rte_eth_dev *dev,
 		    struct ark_rx_queue *queue,
-		    uint16_t rx_queue_id __rte_unused, uint16_t rx_queue_idx)
+		    uint16_t rx_queue_idx)
 {
 	rte_iova_t queue_base;
 	rte_iova_t phys_addr_q_base;
@@ -124,7 +124,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	uint32_t i;
 	int status;

-	int qidx = queue_idx;
+	int qidx = ark->qbase + queue_idx;

 	/* We may already be setup, free memory prior to re-allocation */
 	if (dev->data->rx_queues[queue_idx] != NULL) {
@@ -215,7 +215,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 	/* MPU Setup */
 	if (status == 0)
-		status = eth_ark_rx_hw_setup(dev, queue, qidx, queue_idx);
+		status = eth_ark_rx_hw_setup(dev, queue, queue_idx);

 	if (unlikely(status != 0)) {
 		struct rte_mbuf **mbuf;
diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c
index 5940a592a2..4792754f19 100644
--- a/drivers/net/ark/ark_ethdev_tx.c
+++ b/drivers/net/ark/ark_ethdev_tx.c
@@ -229,7 +229,7 @@ eth_ark_tx_queue_setup(struct rte_eth_dev *dev,
 	struct ark_tx_queue *queue;
 	int status;

-	int qidx = queue_idx;
+	int qidx = ark->qbase + queue_idx;

 	if (!rte_is_power_of_2(nb_desc)) {
 		ARK_PMD_LOG(ERR,
diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h
index 71d0b53e03..2f198edfe4 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -112,7 +112,10 @@ struct ark_adapter {
 	ark_pkt_chkr_t pc;
 	ark_pkt_dir_t pd;

+	/* For single function, multiple ports */
 	int num_ports;
+	uint16_t qbase;
+
 	bool isvf;

 	/* Packet generator/checker args */
--
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-10-22 22:17:37.939693100 +0800
+++ 0097-net-ark-support-single-function-with-multiple-port.patch	2023-10-22 22:17:34.366723700 +0800
@@ -1 +1 @@
-From bf73ee28f47b1df65407ab324bc9d3452aea90c2 Mon Sep 17 00:00:00 2001
+From e054f121ef867aa4c96659f6b57ed3513a6dc48c Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit bf73ee28f47b1df65407ab324bc9d3452aea90c2 ]
@@ -25 +28 @@
-index 3ddcc9b461..90d3c8abe6 100644
+index c654a229f7..c1681e8ecd 100644
@@ -28 +31 @@
-@@ -300,6 +300,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
+@@ -299,6 +299,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
@@ -36 +39 @@
-@@ -427,6 +428,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
+@@ -426,6 +427,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
@@ -44 +47 @@
-@@ -452,7 +454,18 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
+@@ -451,7 +453,18 @@ eth_ark_dev_init(struct rte_eth_dev *dev)


More information about the stable mailing list