DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/4] net/ark: add device capabilities record
@ 2022-01-19 19:12 John Miller
  2022-01-19 19:12 ` [PATCH 2/4] net/ark: support arbitrary mbuf size John Miller
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: John Miller @ 2022-01-19 19:12 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: John Miller

Add static record of supported device capabilities.

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

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index b618cba3f0..0414c78bb5 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -96,6 +96,26 @@ static const struct rte_pci_id pci_id_ark_map[] = {
 	{.vendor_id = 0, /* sentinel */ },
 };
 
+struct ark_caps {
+	bool rqpacing;
+};
+struct ark_dev_caps {
+	uint32_t  device_id;
+	struct ark_caps  caps;
+};
+static const struct ark_dev_caps
+ark_device_caps[] = {
+		     {0x100d, {.rqpacing = true} },
+		     {0x100e, {.rqpacing = true} },
+		     {0x100f, {.rqpacing = true} },
+		     {0x1010, {.rqpacing = false} },
+		     {0x1017, {.rqpacing = true} },
+		     {0x1018, {.rqpacing = true} },
+		     {0x1019, {.rqpacing = true} },
+		     {0x101e, {.rqpacing = false} },
+		     {.device_id = 0,}
+};
+
 static int
 eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		struct rte_pci_device *pci_dev)
@@ -256,6 +276,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 	int ret;
 	int port_count = 1;
 	int p;
+	bool rqpacing = false;
 
 	ark->eth_dev = dev;
 
@@ -270,6 +291,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 	rte_eth_copy_pci_info(dev, pci_dev);
 	dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
+	p = 0;
+	while (ark_device_caps[p].device_id != 0) {
+		if (pci_dev->id.device_id == ark_device_caps[p].device_id) {
+			rqpacing = ark_device_caps[p].caps.rqpacing;
+			break;
+		}
+		p++;
+	}
+
 	/* Use dummy function until setup */
 	dev->rx_pkt_burst = &eth_ark_recv_pkts_noop;
 	dev->tx_pkt_burst = &eth_ark_xmit_pkts_noop;
@@ -288,8 +318,12 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 	ark->pktgen.v  = (void *)&ark->bar0[ARK_PKTGEN_BASE];
 	ark->pktchkr.v  = (void *)&ark->bar0[ARK_PKTCHKR_BASE];
 
-	ark->rqpacing =
-		(struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
+	if (rqpacing) {
+		ark->rqpacing =
+			(struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
+	} else {
+		ark->rqpacing = NULL;
+	}
 	ark->started = 0;
 	ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
 
@@ -309,13 +343,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 		return -1;
 	}
 	if (ark->sysctrl.t32[3] != 0) {
-		if (ark_rqp_lasped(ark->rqpacing)) {
-			ARK_PMD_LOG(ERR, "Arkville Evaluation System - "
-				    "Timer has Expired\n");
-			return -1;
+		if (ark->rqpacing) {
+			if (ark_rqp_lasped(ark->rqpacing)) {
+				ARK_PMD_LOG(ERR, "Arkville Evaluation System - "
+					    "Timer has Expired\n");
+				return -1;
+			}
+			ARK_PMD_LOG(WARNING, "Arkville Evaluation System - "
+				    "Timer is Running\n");
 		}
-		ARK_PMD_LOG(WARNING, "Arkville Evaluation System - "
-			    "Timer is Running\n");
 	}
 
 	ARK_PMD_LOG(DEBUG,
@@ -499,7 +535,8 @@ ark_config_device(struct rte_eth_dev *dev)
 	ark_ddm_stats_reset(ark->ddm.v);
 
 	ark_ddm_stop(ark->ddm.v, 0);
-	ark_rqp_stats_reset(ark->rqpacing);
+	if (ark->rqpacing)
+		ark_rqp_stats_reset(ark->rqpacing);
 
 	return 0;
 }
@@ -695,7 +732,8 @@ eth_ark_dev_close(struct rte_eth_dev *dev)
 	/*
 	 * TODO This should only be called once for the device during shutdown
 	 */
-	ark_rqp_dump(ark->rqpacing);
+	if (ark->rqpacing)
+		ark_rqp_dump(ark->rqpacing);
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
 		eth_ark_tx_queue_release(dev->data->tx_queues[i]);
-- 
2.25.1


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

* [PATCH 2/4] net/ark: support arbitrary mbuf size
  2022-01-19 19:12 [PATCH 1/4] net/ark: add device capabilities record John Miller
@ 2022-01-19 19:12 ` John Miller
  2022-01-26 16:46   ` Ferruh Yigit
  2022-01-19 19:12 ` [PATCH 3/4] net/ark: publish include file for external access John Miller
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: John Miller @ 2022-01-19 19:12 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: John Miller

Support arbitrary mbuf size per queue.

Signed-off-by: John Miller <john.miller@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c    |  8 --------
 drivers/net/ark/ark_ethdev_rx.c | 23 +++++++++++++++++++----
 drivers/net/ark/ark_udm.h       |  2 +-
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 0414c78bb5..b9843414b1 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -511,14 +511,6 @@ ark_config_device(struct rte_eth_dev *dev)
 		mpu = RTE_PTR_ADD(mpu, ARK_MPU_QOFFSET);
 	}
 
-	ark_udm_stop(ark->udm.v, 0);
-	ark_udm_configure(ark->udm.v,
-			  RTE_PKTMBUF_HEADROOM,
-			  RTE_MBUF_DEFAULT_DATAROOM,
-			  ARK_RX_WRITE_TIME_NS);
-	ark_udm_stats_reset(ark->udm.v);
-	ark_udm_stop(ark->udm.v, 0);
-
 	/* TX -- DDM */
 	if (ark_ddm_stop(ark->ddm.v, 1))
 		ARK_PMD_LOG(ERR, "Unable to stop DDM\n");
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 98658ce621..1000f50be0 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -12,7 +12,6 @@
 
 #define ARK_RX_META_SIZE 32
 #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
-#define ARK_RX_MAX_NOCHAIN (RTE_MBUF_DEFAULT_DATAROOM)
 
 /* Forward declarations */
 struct ark_rx_queue;
@@ -41,6 +40,9 @@ struct ark_rx_queue {
 	rx_user_meta_hook_fn rx_user_meta_hook;
 	void *ext_user_data;
 
+	uint32_t dataroom;
+	uint32_t headroom;
+
 	uint32_t queue_size;
 	uint32_t queue_mask;
 
@@ -164,6 +166,9 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 
 	/* NOTE zmalloc is used, no need to 0 indexes, etc. */
 	queue->mb_pool = mb_pool;
+	queue->dataroom = rte_pktmbuf_data_room_size(mb_pool) -
+		RTE_PKTMBUF_HEADROOM;
+	queue->headroom = RTE_PKTMBUF_HEADROOM;
 	queue->phys_qid = qidx;
 	queue->queue_index = queue_idx;
 	queue->queue_size = nb_desc;
@@ -196,6 +201,15 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	queue->udm = RTE_PTR_ADD(ark->udm.v, qidx * ARK_UDM_QOFFSET);
 	queue->mpu = RTE_PTR_ADD(ark->mpurx.v, qidx * ARK_MPU_QOFFSET);
 
+	/* Configure UDM per queue */
+	ark_udm_stop(queue->udm, 0);
+	ark_udm_configure(queue->udm,
+			  RTE_PKTMBUF_HEADROOM,
+			  queue->dataroom,
+			  ARK_RX_WRITE_TIME_NS);
+	ark_udm_stats_reset(queue->udm);
+	ark_udm_stop(queue->udm, 0);
+
 	/* populate mbuf reserve */
 	status = eth_ark_rx_seed_mbufs(queue);
 
@@ -276,6 +290,7 @@ eth_ark_recv_pkts(void *rx_queue,
 		mbuf->data_len = meta->pkt_len;
 
 		if (ARK_DEBUG_CORE) {	/* debug sanity checks */
+
 			if ((meta->pkt_len > (1024 * 16)) ||
 			    (meta->pkt_len == 0)) {
 				ARK_PMD_LOG(DEBUG, "RX: Bad Meta Q: %u"
@@ -304,7 +319,7 @@ eth_ark_recv_pkts(void *rx_queue,
 			}
 		}
 
-		if (unlikely(meta->pkt_len > ARK_RX_MAX_NOCHAIN))
+		if (unlikely(meta->pkt_len > queue->dataroom))
 			cons_index = eth_ark_rx_jumbo
 				(queue, meta, mbuf, cons_index + 1);
 		else
@@ -345,14 +360,14 @@ eth_ark_rx_jumbo(struct ark_rx_queue *queue,
 	/* first buf populated by called */
 	mbuf_prev = mbuf0;
 	segments = 1;
-	data_len = RTE_MIN(meta->pkt_len, RTE_MBUF_DEFAULT_DATAROOM);
+	data_len = RTE_MIN(meta->pkt_len, queue->dataroom);
 	remaining = meta->pkt_len - data_len;
 	mbuf0->data_len = data_len;
 
 	/* HW guarantees that the data does not exceed prod_index! */
 	while (remaining != 0) {
 		data_len = RTE_MIN(remaining,
-				   RTE_MBUF_DEFAULT_DATAROOM);
+				   queue->dataroom);
 
 		remaining -= data_len;
 		segments += 1;
diff --git a/drivers/net/ark/ark_udm.h b/drivers/net/ark/ark_udm.h
index 4e51a5e82c..1cbcd94a98 100644
--- a/drivers/net/ark/ark_udm.h
+++ b/drivers/net/ark/ark_udm.h
@@ -33,7 +33,7 @@ struct ark_rx_meta {
 #define ARK_RX_WRITE_TIME_NS 2500
 #define ARK_UDM_SETUP 0
 #define ARK_UDM_CONST2 0xbACECACE
-#define ARK_UDM_CONST3 0x334d4455
+#define ARK_UDM_CONST3 0x344d4455
 #define ARK_UDM_CONST ARK_UDM_CONST3
 struct ark_udm_setup_t {
 	uint32_t r0;
-- 
2.25.1


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

* [PATCH 3/4] net/ark: publish include file for external access
  2022-01-19 19:12 [PATCH 1/4] net/ark: add device capabilities record John Miller
  2022-01-19 19:12 ` [PATCH 2/4] net/ark: support arbitrary mbuf size John Miller
@ 2022-01-19 19:12 ` John Miller
  2022-01-26 16:48   ` Ferruh Yigit
  2022-01-19 19:12 ` [PATCH 4/4] net/ark: support chunk DMA transfers John Miller
  2022-01-26 16:45 ` [PATCH 1/4] net/ark: add device capabilities record Ferruh Yigit
  3 siblings, 1 reply; 9+ messages in thread
From: John Miller @ 2022-01-19 19:12 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: John Miller

publish rte_pmd_ark.h for external access to extension

Signed-off-by: John Miller <john.miller@atomicrules.com>
---
 doc/guides/nics/ark.rst                      | 4 ++--
 drivers/net/ark/meson.build                  | 2 ++
 drivers/net/ark/{ark_ext.h => rte_pmd_ark.h} | 8 ++++++--
 3 files changed, 10 insertions(+), 4 deletions(-)
 rename drivers/net/ark/{ark_ext.h => rte_pmd_ark.h} (97%)

diff --git a/doc/guides/nics/ark.rst b/doc/guides/nics/ark.rst
index da61814b5d..bcc3babd53 100644
--- a/doc/guides/nics/ark.rst
+++ b/doc/guides/nics/ark.rst
@@ -143,7 +143,7 @@ object file contains extension (or hook) functions that are registered
 and then called during PMD operations.
 
 The allowable set of extension functions are defined and documented in
-``ark_ext.h``, only the initialization function,
+``rte_pmd_ark.h``, only the initialization function,
 ``rte_pmd_ark_dev_init()``, is required; all others are optional. The
 following sections give a small extension example along with
 instructions for compiling and using the extension.
@@ -157,7 +157,7 @@ during RX from user meta data coming from FPGA hardware.
 
 .. code-block:: c
 
-   #include <ark_ext.h>
+   #include <rte_pmd_ark.h>
    #include <rte_mbuf.h>
    #include <rte_ethdev.h>
    #include <rte_malloc.h>
diff --git a/drivers/net/ark/meson.build b/drivers/net/ark/meson.build
index 8d87744c22..83488d87a8 100644
--- a/drivers/net/ark/meson.build
+++ b/drivers/net/ark/meson.build
@@ -7,6 +7,8 @@ if is_windows
     subdir_done()
 endif
 
+headers = files('rte_pmd_ark.h')
+
 sources = files(
         'ark_ddm.c',
         'ark_ethdev.c',
diff --git a/drivers/net/ark/ark_ext.h b/drivers/net/ark/rte_pmd_ark.h
similarity index 97%
rename from drivers/net/ark/ark_ext.h
rename to drivers/net/ark/rte_pmd_ark.h
index d235d0ff85..f77c36eb2d 100644
--- a/drivers/net/ark/ark_ext.h
+++ b/drivers/net/ark/rte_pmd_ark.h
@@ -5,7 +5,11 @@
 #ifndef _ARK_EXT_H_
 #define _ARK_EXT_H_
 
-#include <ethdev_driver.h>
+#include <stdint.h>
+struct rte_eth_dev;
+struct rte_mbuf;
+struct rte_ether_addr;
+struct rte_eth_stats;
 
 /* The following section lists function prototypes for Arkville's
  * dynamic PMD extension. User's who create an extension
@@ -55,7 +59,7 @@ void rte_pmd_ark_dev_uninit(struct rte_eth_dev *dev, void *user_data);
  *   user argument from dev_init() call.
  * @return (0) if successful.
  */
-uint8_t dev_get_port_count(struct rte_eth_dev *dev, void *user_data);
+uint8_t rte_pmd_ark_dev_get_port_count(struct rte_eth_dev *dev, void *user_data);
 
 /**
  * Extension prototype, optional implementation.
-- 
2.25.1


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

* [PATCH 4/4] net/ark: support chunk DMA transfers
  2022-01-19 19:12 [PATCH 1/4] net/ark: add device capabilities record John Miller
  2022-01-19 19:12 ` [PATCH 2/4] net/ark: support arbitrary mbuf size John Miller
  2022-01-19 19:12 ` [PATCH 3/4] net/ark: publish include file for external access John Miller
@ 2022-01-19 19:12 ` John Miller
  2022-01-26 16:52   ` Ferruh Yigit
  2022-01-26 16:45 ` [PATCH 1/4] net/ark: add device capabilities record Ferruh Yigit
  3 siblings, 1 reply; 9+ messages in thread
From: John Miller @ 2022-01-19 19:12 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: John Miller

Add support for chunk DMA transfers.

Signed-off-by: John Miller <john.miller@atomicrules.com>
---
 drivers/net/ark/ark_ddm.c       |  1 +
 drivers/net/ark/ark_ethdev_rx.c | 16 +++++++++-------
 drivers/net/ark/ark_mpu.c       |  1 +
 drivers/net/ark/ark_pktchkr.c   |  2 +-
 drivers/net/ark/ark_pktgen.c    |  2 +-
 drivers/net/ark/ark_udm.c       |  3 +++
 6 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ark/ark_ddm.c b/drivers/net/ark/ark_ddm.c
index 2321371572..b16c739d50 100644
--- a/drivers/net/ark/ark_ddm.c
+++ b/drivers/net/ark/ark_ddm.c
@@ -55,6 +55,7 @@ ark_ddm_stop(struct ark_ddm_t *ddm, const int wait)
 	int cnt = 0;
 
 	ddm->cfg.command = 2;
+	rte_wmb();
 	while (wait && (ddm->cfg.stop_flushed & 0x01) == 0) {
 		if (cnt++ > 1000)
 			return 1;
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 1000f50be0..49134ea08f 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -12,6 +12,7 @@
 
 #define ARK_RX_META_SIZE 32
 #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
+#define ARK_RX_MPU_CHUNK (64U)
 
 /* Forward declarations */
 struct ark_rx_queue;
@@ -104,7 +105,7 @@ static inline void
 eth_ark_rx_update_cons_index(struct ark_rx_queue *queue, uint32_t cons_index)
 {
 	queue->cons_index = cons_index;
-	if ((cons_index + queue->queue_size - queue->seed_index) >= 64U) {
+	if ((cons_index + queue->queue_size - queue->seed_index) >= ARK_RX_MPU_CHUNK) {
 		eth_ark_rx_seed_mbufs(queue);
 		ark_mpu_set_producer(queue->mpu, queue->seed_index);
 	}
@@ -179,12 +180,12 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	queue->reserve_q =
 		rte_zmalloc_socket("Ark_rx_queue mbuf",
 				   nb_desc * sizeof(struct rte_mbuf *),
-				   64,
+				   512,
 				   socket_id);
 	queue->paddress_q =
 		rte_zmalloc_socket("Ark_rx_queue paddr",
 				   nb_desc * sizeof(rte_iova_t),
-				   64,
+				   512,
 				   socket_id);
 
 	if (queue->reserve_q == 0 || queue->paddress_q == 0) {
@@ -455,7 +456,8 @@ eth_ark_rx_stop_queue(struct rte_eth_dev *dev, uint16_t queue_id)
 static inline int
 eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 {
-	uint32_t limit = queue->cons_index + queue->queue_size;
+	uint32_t limit = (queue->cons_index & ~(ARK_RX_MPU_CHUNK - 1)) +
+		queue->queue_size;
 	uint32_t seed_index = queue->seed_index;
 
 	uint32_t count = 0;
@@ -618,14 +620,14 @@ eth_ark_udm_force_close(struct rte_eth_dev *dev)
 
 			ark_mpu_start(queue->mpu);
 			/* Add some buffers */
-			index = 100000 + queue->seed_index;
+			index = ARK_RX_MPU_CHUNK + queue->seed_index;
 			ark_mpu_set_producer(queue->mpu, index);
 		}
 		/* Wait to allow data to pass */
 		usleep(100);
 
-		ARK_PMD_LOG(DEBUG, "UDM forced flush attempt, stopped = %d\n",
-				ark_udm_is_flushed(ark->udm.v));
+		ARK_PMD_LOG(NOTICE, "UDM forced flush attempt, stopped = %d\n",
+			    ark_udm_is_flushed(ark->udm.v));
 	}
 	ark_udm_reset(ark->udm.v);
 }
diff --git a/drivers/net/ark/ark_mpu.c b/drivers/net/ark/ark_mpu.c
index 8160c1de7b..b8e94b6ed3 100644
--- a/drivers/net/ark/ark_mpu.c
+++ b/drivers/net/ark/ark_mpu.c
@@ -68,6 +68,7 @@ ark_mpu_reset(struct ark_mpu_t *mpu)
 	int cnt = 0;
 
 	mpu->cfg.command = MPU_CMD_RESET;
+	rte_wmb();
 
 	while (mpu->cfg.command != MPU_CMD_IDLE) {
 		if (cnt++ > 1000)
diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/net/ark/ark_pktchkr.c
index 84bb567a41..12a5abb2f7 100644
--- a/drivers/net/ark/ark_pktchkr.c
+++ b/drivers/net/ark/ark_pktchkr.c
@@ -113,7 +113,7 @@ ark_pktchkr_stopped(ark_pkt_chkr_t handle)
 	struct ark_pkt_chkr_inst *inst = (struct ark_pkt_chkr_inst *)handle;
 	uint32_t r = inst->sregs->pkt_start_stop;
 
-	return (((r >> 16) & 1) == 1);
+	return (((r >> 16) & 1) == 1) || (r == 0);
 }
 
 void
diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c
index 515bfe461c..6195ef997f 100644
--- a/drivers/net/ark/ark_pktgen.c
+++ b/drivers/net/ark/ark_pktgen.c
@@ -107,7 +107,7 @@ ark_pktgen_paused(ark_pkt_gen_t handle)
 	struct ark_pkt_gen_inst *inst = (struct ark_pkt_gen_inst *)handle;
 	uint32_t r = inst->regs->pkt_start_stop;
 
-	return (((r >> 16) & 1) == 1);
+	return (((r >> 24) & 1) == 1) || (((r >> 16) & 1) == 1)  || (r == 0);
 }
 
 void
diff --git a/drivers/net/ark/ark_udm.c b/drivers/net/ark/ark_udm.c
index 28c4500a2c..9ebed89627 100644
--- a/drivers/net/ark/ark_udm.c
+++ b/drivers/net/ark/ark_udm.c
@@ -33,7 +33,9 @@ ark_udm_stop(struct ark_udm_t *udm, const int wait)
 {
 	int cnt = 0;
 
+	udm->setup.r0 = 0;
 	udm->cfg.command = 2;
+	rte_wmb();
 
 	while (wait && (udm->cfg.stop_flushed & 0x01) == 0) {
 		if (cnt++ > 1000)
@@ -70,6 +72,7 @@ ark_udm_reset(struct ark_udm_t *udm)
 void
 ark_udm_start(struct ark_udm_t *udm)
 {
+	udm->setup.r0 = 0x100;
 	udm->cfg.command = 1;
 }
 
-- 
2.25.1


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

* Re: [PATCH 1/4] net/ark: add device capabilities record
  2022-01-19 19:12 [PATCH 1/4] net/ark: add device capabilities record John Miller
                   ` (2 preceding siblings ...)
  2022-01-19 19:12 ` [PATCH 4/4] net/ark: support chunk DMA transfers John Miller
@ 2022-01-26 16:45 ` Ferruh Yigit
  3 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2022-01-26 16:45 UTC (permalink / raw)
  To: John Miller, dev

On 1/19/2022 7:12 PM, John Miller wrote:
> Add static record of supported device capabilities.
> 
> Signed-off-by: John Miller <john.miller@atomicrules.com>
> ---
>   drivers/net/ark/ark_ethdev.c | 58 +++++++++++++++++++++++++++++-------
>   1 file changed, 48 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
> index b618cba3f0..0414c78bb5 100644
> --- a/drivers/net/ark/ark_ethdev.c
> +++ b/drivers/net/ark/ark_ethdev.c
> @@ -96,6 +96,26 @@ static const struct rte_pci_id pci_id_ark_map[] = {
>   	{.vendor_id = 0, /* sentinel */ },
>   };
>   
> +struct ark_caps {
> +	bool rqpacing;

Can you please put some comment that what this 'rqpacing' capability is?
Either to commit log, or as a comment to the code, or both.

> +};
> +struct ark_dev_caps {
> +	uint32_t  device_id;
> +	struct ark_caps  caps;
> +};
> +static const struct ark_dev_caps
> +ark_device_caps[] = {
> +		     {0x100d, {.rqpacing = true} },
> +		     {0x100e, {.rqpacing = true} },
> +		     {0x100f, {.rqpacing = true} },
> +		     {0x1010, {.rqpacing = false} },
> +		     {0x1017, {.rqpacing = true} },
> +		     {0x1018, {.rqpacing = true} },
> +		     {0x1019, {.rqpacing = true} },
> +		     {0x101e, {.rqpacing = false} },

This device, 0x101e, even not probed, it looks odd to keep capability for it.

And it will increase the readability if you can use macros for device/vendor ID.

> +		     {.device_id = 0,}
> +};
> +
>   static int
>   eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>   		struct rte_pci_device *pci_dev)
> @@ -256,6 +276,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
>   	int ret;
>   	int port_count = 1;
>   	int p;
> +	bool rqpacing = false;
>   
>   	ark->eth_dev = dev;
>   
> @@ -270,6 +291,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
>   	rte_eth_copy_pci_info(dev, pci_dev);
>   	dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
>   
> +	p = 0;
> +	while (ark_device_caps[p].device_id != 0) {
> +		if (pci_dev->id.device_id == ark_device_caps[p].device_id) {
> +			rqpacing = ark_device_caps[p].caps.rqpacing;
> +			break;
> +		}
> +		p++;
> +	}
> +
>   	/* Use dummy function until setup */
>   	dev->rx_pkt_burst = &eth_ark_recv_pkts_noop;
>   	dev->tx_pkt_burst = &eth_ark_xmit_pkts_noop;
> @@ -288,8 +318,12 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
>   	ark->pktgen.v  = (void *)&ark->bar0[ARK_PKTGEN_BASE];
>   	ark->pktchkr.v  = (void *)&ark->bar0[ARK_PKTCHKR_BASE];
>   
> -	ark->rqpacing =
> -		(struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
> +	if (rqpacing) {
> +		ark->rqpacing =
> +			(struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
> +	} else {
> +		ark->rqpacing = NULL;
> +	}
>   	ark->started = 0;
>   	ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
>   
> @@ -309,13 +343,15 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
>   		return -1;
>   	}
>   	if (ark->sysctrl.t32[3] != 0) {
> -		if (ark_rqp_lasped(ark->rqpacing)) {
> -			ARK_PMD_LOG(ERR, "Arkville Evaluation System - "
> -				    "Timer has Expired\n");
> -			return -1;
> +		if (ark->rqpacing) {
> +			if (ark_rqp_lasped(ark->rqpacing)) {
> +				ARK_PMD_LOG(ERR, "Arkville Evaluation System - "
> +					    "Timer has Expired\n");
> +				return -1;
> +			}
> +			ARK_PMD_LOG(WARNING, "Arkville Evaluation System - "
> +				    "Timer is Running\n");
>   		}
> -		ARK_PMD_LOG(WARNING, "Arkville Evaluation System - "
> -			    "Timer is Running\n");
>   	}
>   
>   	ARK_PMD_LOG(DEBUG,
> @@ -499,7 +535,8 @@ ark_config_device(struct rte_eth_dev *dev)
>   	ark_ddm_stats_reset(ark->ddm.v);
>   
>   	ark_ddm_stop(ark->ddm.v, 0);
> -	ark_rqp_stats_reset(ark->rqpacing);
> +	if (ark->rqpacing)
> +		ark_rqp_stats_reset(ark->rqpacing);
>   
>   	return 0;
>   }
> @@ -695,7 +732,8 @@ eth_ark_dev_close(struct rte_eth_dev *dev)
>   	/*
>   	 * TODO This should only be called once for the device during shutdown
>   	 */
> -	ark_rqp_dump(ark->rqpacing);
> +	if (ark->rqpacing)
> +		ark_rqp_dump(ark->rqpacing);
>   
>   	for (i = 0; i < dev->data->nb_tx_queues; i++) {
>   		eth_ark_tx_queue_release(dev->data->tx_queues[i]);


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

* Re: [PATCH 2/4] net/ark: support arbitrary mbuf size
  2022-01-19 19:12 ` [PATCH 2/4] net/ark: support arbitrary mbuf size John Miller
@ 2022-01-26 16:46   ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2022-01-26 16:46 UTC (permalink / raw)
  To: John Miller, dev

On 1/19/2022 7:12 PM, John Miller wrote:
> diff --git a/drivers/net/ark/ark_udm.h b/drivers/net/ark/ark_udm.h
> index 4e51a5e82c..1cbcd94a98 100644
> --- a/drivers/net/ark/ark_udm.h
> +++ b/drivers/net/ark/ark_udm.h
> @@ -33,7 +33,7 @@ struct ark_rx_meta {
>   #define ARK_RX_WRITE_TIME_NS 2500
>   #define ARK_UDM_SETUP 0
>   #define ARK_UDM_CONST2 0xbACECACE
> -#define ARK_UDM_CONST3 0x334d4455
> +#define ARK_UDM_CONST3 0x344d4455
>   #define ARK_UDM_CONST ARK_UDM_CONST3
>   struct ark_udm_setup_t {
>   	uint32_t r0;

What is this change for? It looks unrelated with the rest of the patch.
May it be added by mistake?

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

* Re: [PATCH 3/4] net/ark: publish include file for external access
  2022-01-19 19:12 ` [PATCH 3/4] net/ark: publish include file for external access John Miller
@ 2022-01-26 16:48   ` Ferruh Yigit
  2022-01-26 16:49     ` Ferruh Yigit
  0 siblings, 1 reply; 9+ messages in thread
From: Ferruh Yigit @ 2022-01-26 16:48 UTC (permalink / raw)
  To: John Miller, dev

On 1/19/2022 7:12 PM, John Miller wrote:
> publish rte_pmd_ark.h for external access to extension
> 

I have rejected same patch 2 or 3 times since PMD first upstreamed,
it is frustrating that it keeps coming :(

Please find the reasoning of why it is rejected from archives.

> Signed-off-by: John Miller <john.miller@atomicrules.com>


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

* Re: [PATCH 3/4] net/ark: publish include file for external access
  2022-01-26 16:48   ` Ferruh Yigit
@ 2022-01-26 16:49     ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2022-01-26 16:49 UTC (permalink / raw)
  To: John Miller, dev; +Cc: Shepard Siegel, Ed Czeck

On 1/26/2022 4:48 PM, Ferruh Yigit wrote:
> On 1/19/2022 7:12 PM, John Miller wrote:
>> publish rte_pmd_ark.h for external access to extension
>>
> 
> I have rejected same patch 2 or 3 times since PMD first upstreamed,
> it is frustrating that it keeps coming :(
> 

cc'ed Shepard & Ed.

> Please find the reasoning of why it is rejected from archives.
> 
>> Signed-off-by: John Miller <john.miller@atomicrules.com>
> 

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

* Re: [PATCH 4/4] net/ark: support chunk DMA transfers
  2022-01-19 19:12 ` [PATCH 4/4] net/ark: support chunk DMA transfers John Miller
@ 2022-01-26 16:52   ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2022-01-26 16:52 UTC (permalink / raw)
  To: John Miller, dev

On 1/19/2022 7:12 PM, John Miller wrote:
> Add support for chunk DMA transfers.
> 
> Signed-off-by: John Miller <john.miller@atomicrules.com>
> ---
>   drivers/net/ark/ark_ddm.c       |  1 +
>   drivers/net/ark/ark_ethdev_rx.c | 16 +++++++++-------
>   drivers/net/ark/ark_mpu.c       |  1 +
>   drivers/net/ark/ark_pktchkr.c   |  2 +-
>   drivers/net/ark/ark_pktgen.c    |  2 +-
>   drivers/net/ark/ark_udm.c       |  3 +++
>   6 files changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/ark/ark_ddm.c b/drivers/net/ark/ark_ddm.c
> index 2321371572..b16c739d50 100644
> --- a/drivers/net/ark/ark_ddm.c
> +++ b/drivers/net/ark/ark_ddm.c
> @@ -55,6 +55,7 @@ ark_ddm_stop(struct ark_ddm_t *ddm, const int wait)
>   	int cnt = 0;
>   
>   	ddm->cfg.command = 2;
> +	rte_wmb();

Is the new memory barrier related to the chunk DMA transfer?

>   	while (wait && (ddm->cfg.stop_flushed & 0x01) == 0) {
>   		if (cnt++ > 1000)
>   			return 1;
> diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
> index 1000f50be0..49134ea08f 100644
> --- a/drivers/net/ark/ark_ethdev_rx.c
> +++ b/drivers/net/ark/ark_ethdev_rx.c
> @@ -12,6 +12,7 @@
>   
>   #define ARK_RX_META_SIZE 32
>   #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE)
> +#define ARK_RX_MPU_CHUNK (64U)
>   
>   /* Forward declarations */
>   struct ark_rx_queue;
> @@ -104,7 +105,7 @@ static inline void
>   eth_ark_rx_update_cons_index(struct ark_rx_queue *queue, uint32_t cons_index)
>   {
>   	queue->cons_index = cons_index;
> -	if ((cons_index + queue->queue_size - queue->seed_index) >= 64U) {
> +	if ((cons_index + queue->queue_size - queue->seed_index) >= ARK_RX_MPU_CHUNK) {
>   		eth_ark_rx_seed_mbufs(queue);
>   		ark_mpu_set_producer(queue->mpu, queue->seed_index);
>   	}
> @@ -179,12 +180,12 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
>   	queue->reserve_q =
>   		rte_zmalloc_socket("Ark_rx_queue mbuf",
>   				   nb_desc * sizeof(struct rte_mbuf *),
> -				   64,
> +				   512,
>   				   socket_id);
>   	queue->paddress_q =
>   		rte_zmalloc_socket("Ark_rx_queue paddr",
>   				   nb_desc * sizeof(rte_iova_t),
> -				   64,
> +				   512,
>   				   socket_id);
>   
>   	if (queue->reserve_q == 0 || queue->paddress_q == 0) {
> @@ -455,7 +456,8 @@ eth_ark_rx_stop_queue(struct rte_eth_dev *dev, uint16_t queue_id)
>   static inline int
>   eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
>   {
> -	uint32_t limit = queue->cons_index + queue->queue_size;
> +	uint32_t limit = (queue->cons_index & ~(ARK_RX_MPU_CHUNK - 1)) +
> +		queue->queue_size;
>   	uint32_t seed_index = queue->seed_index;
>   
>   	uint32_t count = 0;
> @@ -618,14 +620,14 @@ eth_ark_udm_force_close(struct rte_eth_dev *dev)
>   
>   			ark_mpu_start(queue->mpu);
>   			/* Add some buffers */
> -			index = 100000 + queue->seed_index;
> +			index = ARK_RX_MPU_CHUNK + queue->seed_index;

100000 is replaced by '64', the diff is huge, just double checking if this
is what intended?

>   			ark_mpu_set_producer(queue->mpu, index);
>   		}
>   		/* Wait to allow data to pass */
>   		usleep(100);
>   
> -		ARK_PMD_LOG(DEBUG, "UDM forced flush attempt, stopped = %d\n",
> -				ark_udm_is_flushed(ark->udm.v));
> +		ARK_PMD_LOG(NOTICE, "UDM forced flush attempt, stopped = %d\n",
> +			    ark_udm_is_flushed(ark->udm.v));
>   	}
>   	ark_udm_reset(ark->udm.v);
>   }
> diff --git a/drivers/net/ark/ark_mpu.c b/drivers/net/ark/ark_mpu.c
> index 8160c1de7b..b8e94b6ed3 100644
> --- a/drivers/net/ark/ark_mpu.c
> +++ b/drivers/net/ark/ark_mpu.c
> @@ -68,6 +68,7 @@ ark_mpu_reset(struct ark_mpu_t *mpu)
>   	int cnt = 0;
>   
>   	mpu->cfg.command = MPU_CMD_RESET;
> +	rte_wmb();
>   
>   	while (mpu->cfg.command != MPU_CMD_IDLE) {
>   		if (cnt++ > 1000)
> diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/net/ark/ark_pktchkr.c
> index 84bb567a41..12a5abb2f7 100644
> --- a/drivers/net/ark/ark_pktchkr.c
> +++ b/drivers/net/ark/ark_pktchkr.c
> @@ -113,7 +113,7 @@ ark_pktchkr_stopped(ark_pkt_chkr_t handle)
>   	struct ark_pkt_chkr_inst *inst = (struct ark_pkt_chkr_inst *)handle;
>   	uint32_t r = inst->sregs->pkt_start_stop;
>   
> -	return (((r >> 16) & 1) == 1);
> +	return (((r >> 16) & 1) == 1) || (r == 0);
>   }
>   
>   void
> diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c
> index 515bfe461c..6195ef997f 100644
> --- a/drivers/net/ark/ark_pktgen.c
> +++ b/drivers/net/ark/ark_pktgen.c
> @@ -107,7 +107,7 @@ ark_pktgen_paused(ark_pkt_gen_t handle)
>   	struct ark_pkt_gen_inst *inst = (struct ark_pkt_gen_inst *)handle;
>   	uint32_t r = inst->regs->pkt_start_stop;
>   
> -	return (((r >> 16) & 1) == 1);
> +	return (((r >> 24) & 1) == 1) || (((r >> 16) & 1) == 1)  || (r == 0);

Overall I am having difficulties to match changes to the commit log,
are these related changes?

Can you please give more details in the commit log what is done,
to help the review?

>   }
>   
>   void
> diff --git a/drivers/net/ark/ark_udm.c b/drivers/net/ark/ark_udm.c
> index 28c4500a2c..9ebed89627 100644
> --- a/drivers/net/ark/ark_udm.c
> +++ b/drivers/net/ark/ark_udm.c
> @@ -33,7 +33,9 @@ ark_udm_stop(struct ark_udm_t *udm, const int wait)
>   {
>   	int cnt = 0;
>   
> +	udm->setup.r0 = 0;

ditto

>   	udm->cfg.command = 2;
> +	rte_wmb();
>   
>   	while (wait && (udm->cfg.stop_flushed & 0x01) == 0) {
>   		if (cnt++ > 1000)
> @@ -70,6 +72,7 @@ ark_udm_reset(struct ark_udm_t *udm)
>   void
>   ark_udm_start(struct ark_udm_t *udm)
>   {
> +	udm->setup.r0 = 0x100;
>   	udm->cfg.command = 1;
>   }
>   


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

end of thread, other threads:[~2022-01-26 16:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 19:12 [PATCH 1/4] net/ark: add device capabilities record John Miller
2022-01-19 19:12 ` [PATCH 2/4] net/ark: support arbitrary mbuf size John Miller
2022-01-26 16:46   ` Ferruh Yigit
2022-01-19 19:12 ` [PATCH 3/4] net/ark: publish include file for external access John Miller
2022-01-26 16:48   ` Ferruh Yigit
2022-01-26 16:49     ` Ferruh Yigit
2022-01-19 19:12 ` [PATCH 4/4] net/ark: support chunk DMA transfers John Miller
2022-01-26 16:52   ` Ferruh Yigit
2022-01-26 16:45 ` [PATCH 1/4] net/ark: add device capabilities record 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).