DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/3] net/ark: support secondary process
@ 2023-02-17 15:47 Ed Czeck
  2023-02-17 15:47 ` [PATCH 2/3] net/ark: support for single function with multiple port Ed Czeck
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Ed Czeck @ 2023-02-17 15:47 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: John Miller, Shepard Siegel, Anatoly Burakov

From: John Miller <john.miller@atomicrules.com>

disable device configuration for secondary processes

Signed-off-by: John Miller <john.miller@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index b2995427c8..f96722551e 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -147,6 +147,9 @@ eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	struct rte_eth_dev *eth_dev;
 	int ret;
 
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+		fprintf(stderr, "ARK probed by secondary process\n");
+
 	eth_dev = rte_eth_dev_pci_allocate(pci_dev, sizeof(struct ark_adapter));
 
 	if (eth_dev == NULL)
@@ -385,9 +388,11 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 		    0xcafef00d, ark->sysctrl.t32[4], __func__);
 
 	/* We are a single function multi-port device. */
-	ret = ark_config_device(dev);
-	if (ret)
-		return -1;
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+		ret = ark_config_device(dev);
+		if (ret)
+			return -1;
+	}
 
 	dev->dev_ops = &ark_eth_dev_ops;
 	dev->rx_queue_count = eth_ark_dev_rx_queue_count;
-- 
2.34.1


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

* [PATCH 2/3] net/ark: support for single function with multiple port
  2023-02-17 15:47 [PATCH 1/3] net/ark: support secondary process Ed Czeck
@ 2023-02-17 15:47 ` Ed Czeck
  2023-02-17 15:47 ` [PATCH 3/3] net/ark: resize data field to match fpga access Ed Czeck
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Ed Czeck @ 2023-02-17 15:47 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: Shepard Siegel, John Miller

allows the creation of multiple ports from one ark device via
the use of ark pmd extension, though the splitting of queues
Add unique dev_private data for each port

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

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index f96722551e..2fff3cd6ba 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -432,6 +432,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;
+	ark->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;
@@ -457,7 +458,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 * ark->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..176fbcda17 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -112,7 +112,11 @@ struct ark_adapter {
 	ark_pkt_chkr_t pc;
 	ark_pkt_dir_t pd;
 
+	/* For single function, multiple ports */
 	int num_ports;
+	uint16_t qbase;
+	uint16_t num_queues;
+
 	bool isvf;
 
 	/* Packet generator/checker args */
-- 
2.34.1


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

* [PATCH 3/3] net/ark: resize data field to match fpga access
  2023-02-17 15:47 [PATCH 1/3] net/ark: support secondary process Ed Czeck
  2023-02-17 15:47 ` [PATCH 2/3] net/ark: support for single function with multiple port Ed Czeck
@ 2023-02-17 15:47 ` Ed Czeck
  2023-02-17 15:47 ` [PATCH] " Ed Czeck
  2023-02-17 16:30 ` [PATCH 1/3] net/ark: support secondary process Stephen Hemminger
  3 siblings, 0 replies; 6+ messages in thread
From: Ed Czeck @ 2023-02-17 15:47 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: Shepard Siegel, John Miller

all fpga acces are multiples of 4 bytes

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_mpu.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ark/ark_mpu.h b/drivers/net/ark/ark_mpu.h
index 9d2b70d35f..10842ba484 100644
--- a/drivers/net/ark/ark_mpu.h
+++ b/drivers/net/ark/ark_mpu.h
@@ -39,8 +39,7 @@ struct ark_mpu_id_t {
 
 #define ARK_MPU_HW 0x010
 struct ark_mpu_hw_t {
-	uint16_t num_queues;
-	uint16_t reserved;
+	uint32_t num_queues;
 	uint32_t hw_depth;
 	uint32_t obj_size;
 	uint32_t obj_per_mrr;
-- 
2.34.1


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

* [PATCH] net/ark: resize data field to match fpga access
  2023-02-17 15:47 [PATCH 1/3] net/ark: support secondary process Ed Czeck
  2023-02-17 15:47 ` [PATCH 2/3] net/ark: support for single function with multiple port Ed Czeck
  2023-02-17 15:47 ` [PATCH 3/3] net/ark: resize data field to match fpga access Ed Czeck
@ 2023-02-17 15:47 ` Ed Czeck
  2023-02-17 16:30 ` [PATCH 1/3] net/ark: support secondary process Stephen Hemminger
  3 siblings, 0 replies; 6+ messages in thread
From: Ed Czeck @ 2023-02-17 15:47 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: Shepard Siegel, John Miller

all fpga acces are multiples of 4 bytes

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_mpu.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ark/ark_mpu.h b/drivers/net/ark/ark_mpu.h
index 9d2b70d35f..10842ba484 100644
--- a/drivers/net/ark/ark_mpu.h
+++ b/drivers/net/ark/ark_mpu.h
@@ -39,8 +39,7 @@ struct ark_mpu_id_t {
 
 #define ARK_MPU_HW 0x010
 struct ark_mpu_hw_t {
-	uint16_t num_queues;
-	uint16_t reserved;
+	uint32_t num_queues;
 	uint32_t hw_depth;
 	uint32_t obj_size;
 	uint32_t obj_per_mrr;
-- 
2.34.1


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

* Re: [PATCH 1/3] net/ark: support secondary process
  2023-02-17 15:47 [PATCH 1/3] net/ark: support secondary process Ed Czeck
                   ` (2 preceding siblings ...)
  2023-02-17 15:47 ` [PATCH] " Ed Czeck
@ 2023-02-17 16:30 ` Stephen Hemminger
  3 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2023-02-17 16:30 UTC (permalink / raw)
  To: Ed Czeck; +Cc: dev, ferruh.yigit, John Miller, Shepard Siegel, Anatoly Burakov

On Fri, 17 Feb 2023 10:47:56 -0500
Ed Czeck <ed.czeck@atomicrules.com> wrote:

> diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
> index b2995427c8..f96722551e 100644
> --- a/drivers/net/ark/ark_ethdev.c
> +++ b/drivers/net/ark/ark_ethdev.c
> @@ -147,6 +147,9 @@ eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>  	struct rte_eth_dev *eth_dev;
>  	int ret;
>  
> +	if (rte_eal_process_type() == RTE_PROC_SECONDARY)
> +		fprintf(stderr, "ARK probed by secondary process\n");

Use standard logging for error messages please.

		ARK_PMD_LOG(DEBUG, "Secondary process probed\n");

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

* [PATCH 2/3] net/ark: support for single function with multiple port
  2023-02-17 16:00 Ed Czeck
@ 2023-02-17 16:00 ` Ed Czeck
  0 siblings, 0 replies; 6+ messages in thread
From: Ed Czeck @ 2023-02-17 16:00 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: Shepard Siegel, John Miller

allows the creation of multiple ports from one ark device via
the use of ark pmd extension, though the splitting of queues
Add unique dev_private data for each port

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

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index f96722551e..2fff3cd6ba 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -432,6 +432,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;
+	ark->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;
@@ -457,7 +458,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 * ark->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..176fbcda17 100644
--- a/drivers/net/ark/ark_global.h
+++ b/drivers/net/ark/ark_global.h
@@ -112,7 +112,11 @@ struct ark_adapter {
 	ark_pkt_chkr_t pc;
 	ark_pkt_dir_t pd;
 
+	/* For single function, multiple ports */
 	int num_ports;
+	uint16_t qbase;
+	uint16_t num_queues;
+
 	bool isvf;
 
 	/* Packet generator/checker args */
-- 
2.34.1


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

end of thread, other threads:[~2023-02-17 16:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-17 15:47 [PATCH 1/3] net/ark: support secondary process Ed Czeck
2023-02-17 15:47 ` [PATCH 2/3] net/ark: support for single function with multiple port Ed Czeck
2023-02-17 15:47 ` [PATCH 3/3] net/ark: resize data field to match fpga access Ed Czeck
2023-02-17 15:47 ` [PATCH] " Ed Czeck
2023-02-17 16:30 ` [PATCH 1/3] net/ark: support secondary process Stephen Hemminger
2023-02-17 16:00 Ed Czeck
2023-02-17 16:00 ` [PATCH 2/3] net/ark: support for single function with multiple port Ed Czeck

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