DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v2 1/3] net/ark: add device capabilities record
       [not found] <20220119191255.273988-ed.czeck@atomicrules.com>
@ 2022-02-10 14:34 ` John Miller
  2022-02-10 14:34   ` [PATCH v2 2/3] net/ark: support arbitrary mbuf size John Miller
  2022-02-10 14:34   ` [PATCH v2 3/3] net/ark: support chunk DMA transfers John Miller
  2022-02-11 11:39 ` [PATCH v2 1/3] net/ark: add device capabilities record John Miller
  2022-02-15 22:19 ` [PATCH v3 1/7] " John Miller
  2 siblings, 2 replies; 16+ messages in thread
From: John Miller @ 2022-02-10 14:34 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, John Miller

---

v2:
Certain variants require that PCIe read-requests be correctly
throttled. This is called "rqpacing" in Arkville, and has to do
with credit and flow control on certain Arkville implementations.

Improved code readability and comments.

---


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

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index b618cba3f0..9f5f375174 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -85,17 +85,53 @@ static const char * const valid_arguments[] = {
 	NULL
 };
 
+#define AR_VENDOR_ID 0x1d6c
 static const struct rte_pci_id pci_id_ark_map[] = {
-	{RTE_PCI_DEVICE(0x1d6c, 0x100d)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x100e)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x100f)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x1010)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x1017)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x1018)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x1019)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100d)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100e)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100f)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1010)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1017)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1018)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1019)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101e)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101f)},
 	{.vendor_id = 0, /* sentinel */ },
 };
 
+/*
+ * This structure is used to statically define the capabilities
+ * of supported devices.
+ * Capabilities:
+ *  rqpacing -
+ * Some HW variants require that PCIe read-requests be correctly throttled.
+ * This is called "rqpacing" and has to do with credit and flow control
+ * on certain Arkville implementations.
+ */
+struct ark_caps {
+	bool rqpacing;
+};
+struct ark_dev_caps {
+	uint32_t  device_id;
+	struct ark_caps  caps;
+};
+#define SET_DEV_CAPS(id, rqp) \
+	{id, {.rqpacing = rqp} }
+
+static const struct ark_dev_caps
+ark_device_caps[] = {
+		     SET_DEV_CAPS(0x100d, true),
+		     SET_DEV_CAPS(0x100e, true),
+		     SET_DEV_CAPS(0x100f, true),
+		     SET_DEV_CAPS(0x1010, false),
+		     SET_DEV_CAPS(0x1017, true),
+		     SET_DEV_CAPS(0x1018, true),
+		     SET_DEV_CAPS(0x1019, true),
+		     SET_DEV_CAPS(0x101e, false),
+		     SET_DEV_CAPS(0x101f, 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 +292,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 +307,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 +334,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 +359,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 +551,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 +748,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] 16+ messages in thread

* [PATCH v2 2/3] net/ark: support arbitrary mbuf size
  2022-02-10 14:34 ` [PATCH v2 1/3] net/ark: add device capabilities record John Miller
@ 2022-02-10 14:34   ` John Miller
  2022-02-10 14:34   ` [PATCH v2 3/3] net/ark: support chunk DMA transfers John Miller
  1 sibling, 0 replies; 16+ messages in thread
From: John Miller @ 2022-02-10 14:34 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, John Miller

---

v2:
Added arbitrary mbuf size per queue capability.

Updated ARK_UDM_CONST3 value to reflect the version number
read from the HW that is required to support this change.

---

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 9f5f375174..e2c0adf8cb 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -527,14 +527,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] 16+ messages in thread

* [PATCH v2 3/3] net/ark: support chunk DMA transfers
  2022-02-10 14:34 ` [PATCH v2 1/3] net/ark: add device capabilities record John Miller
  2022-02-10 14:34   ` [PATCH v2 2/3] net/ark: support arbitrary mbuf size John Miller
@ 2022-02-10 14:34   ` John Miller
  1 sibling, 0 replies; 16+ messages in thread
From: John Miller @ 2022-02-10 14:34 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, John Miller

---

v2:
Various performance optimizations and behavior fixes

- Chunk mpu transfer use 64 objects (512 byte)  to maintain memory
  read alignment
- Align mpu memory allocation to be at 512 byte boundaries
- Reduce force-close allocation from 10000 objects to 64 objects
- Add memory write barriers for read and wait status functions
  in ddm, udm and mpu.
- Configuration status updates for internal packet checker and generator.

---

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] 16+ messages in thread

* [PATCH v2 1/3] net/ark: add device capabilities record
       [not found] <20220119191255.273988-ed.czeck@atomicrules.com>
  2022-02-10 14:34 ` [PATCH v2 1/3] net/ark: add device capabilities record John Miller
@ 2022-02-11 11:39 ` John Miller
  2022-02-11 11:39   ` [PATCH v2 2/3] net/ark: support arbitrary mbuf size John Miller
                     ` (2 more replies)
  2022-02-15 22:19 ` [PATCH v3 1/7] " John Miller
  2 siblings, 3 replies; 16+ messages in thread
From: John Miller @ 2022-02-11 11:39 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, John Miller

Add a device capabilities record for supported features.
Certain variants require that PCIe read-requests be correctly
throttled. This is called "rqpacing" in Arkville, and has to do
with credit and flow control on certain Arkville implementations.

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

---
v2:
- Improved code readability and comments.
---
 drivers/net/ark/ark_ethdev.c | 88 +++++++++++++++++++++++++++++-------
 1 file changed, 71 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index b618cba3f0..9f5f375174 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -85,17 +85,53 @@ static const char * const valid_arguments[] = {
 	NULL
 };
 
+#define AR_VENDOR_ID 0x1d6c
 static const struct rte_pci_id pci_id_ark_map[] = {
-	{RTE_PCI_DEVICE(0x1d6c, 0x100d)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x100e)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x100f)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x1010)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x1017)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x1018)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x1019)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100d)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100e)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100f)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1010)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1017)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1018)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1019)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101e)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101f)},
 	{.vendor_id = 0, /* sentinel */ },
 };
 
+/*
+ * This structure is used to statically define the capabilities
+ * of supported devices.
+ * Capabilities:
+ *  rqpacing -
+ * Some HW variants require that PCIe read-requests be correctly throttled.
+ * This is called "rqpacing" and has to do with credit and flow control
+ * on certain Arkville implementations.
+ */
+struct ark_caps {
+	bool rqpacing;
+};
+struct ark_dev_caps {
+	uint32_t  device_id;
+	struct ark_caps  caps;
+};
+#define SET_DEV_CAPS(id, rqp) \
+	{id, {.rqpacing = rqp} }
+
+static const struct ark_dev_caps
+ark_device_caps[] = {
+		     SET_DEV_CAPS(0x100d, true),
+		     SET_DEV_CAPS(0x100e, true),
+		     SET_DEV_CAPS(0x100f, true),
+		     SET_DEV_CAPS(0x1010, false),
+		     SET_DEV_CAPS(0x1017, true),
+		     SET_DEV_CAPS(0x1018, true),
+		     SET_DEV_CAPS(0x1019, true),
+		     SET_DEV_CAPS(0x101e, false),
+		     SET_DEV_CAPS(0x101f, 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 +292,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 +307,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 +334,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 +359,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 +551,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 +748,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] 16+ messages in thread

* [PATCH v2 2/3] net/ark: support arbitrary mbuf size
  2022-02-11 11:39 ` [PATCH v2 1/3] net/ark: add device capabilities record John Miller
@ 2022-02-11 11:39   ` John Miller
  2022-02-11 11:39   ` [PATCH v2 3/3] net/ark: support chunk DMA transfers John Miller
  2022-02-14 14:00   ` [PATCH v2 1/3] net/ark: add device capabilities record Ferruh Yigit
  2 siblings, 0 replies; 16+ messages in thread
From: John Miller @ 2022-02-11 11:39 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, John Miller

Added arbitrary mbuf size per queue capability.
Updated ARK_UDM_CONST3 value to reflect the version number
read from the HW that is required to support this change.

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

---
v2:
- Added more details to the git log.
---
 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 9f5f375174..e2c0adf8cb 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -527,14 +527,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] 16+ messages in thread

* [PATCH v2 3/3] net/ark: support chunk DMA transfers
  2022-02-11 11:39 ` [PATCH v2 1/3] net/ark: add device capabilities record John Miller
  2022-02-11 11:39   ` [PATCH v2 2/3] net/ark: support arbitrary mbuf size John Miller
@ 2022-02-11 11:39   ` John Miller
  2022-02-14 13:59     ` Ferruh Yigit
  2022-02-14 14:00   ` [PATCH v2 1/3] net/ark: add device capabilities record Ferruh Yigit
  2 siblings, 1 reply; 16+ messages in thread
From: John Miller @ 2022-02-11 11:39 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, John Miller

Add support for chunk DMA transfers.
Various performance optimizations and behavior fixes.
Chunk mpu transfer use 64 objects (512 byte) to maintain memory
read alignment.
Align mpu memory allocation to be at 512 byte boundaries.
Reduce force-close allocation from 10000 objects to 64 objects.
Add memory write barriers for read and wait status functions
in ddm, udm and mpu.
Configuration status updates for internal packet checker and
generator.

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

---
v2:
- Added more details to the git log.
---
 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] 16+ messages in thread

* Re: [PATCH v2 3/3] net/ark: support chunk DMA transfers
  2022-02-11 11:39   ` [PATCH v2 3/3] net/ark: support chunk DMA transfers John Miller
@ 2022-02-14 13:59     ` Ferruh Yigit
  0 siblings, 0 replies; 16+ messages in thread
From: Ferruh Yigit @ 2022-02-14 13:59 UTC (permalink / raw)
  To: John Miller, dev; +Cc: shepard.siegel

On 2/11/2022 11:39 AM, John Miller wrote:
> Add support for chunk DMA transfers.
> Various performance optimizations and behavior fixes.
> Chunk mpu transfer use 64 objects (512 byte) to maintain memory
> read alignment.
> Align mpu memory allocation to be at 512 byte boundaries.
> Reduce force-close allocation from 10000 objects to 64 objects.
> Add memory write barriers for read and wait status functions
> in ddm, udm and mpu.
> Configuration status updates for internal packet checker and
> generator.
> 

Hi John,

When all above done in same patch, it is harder to differentiate
what change bellow is for any item listed above.
And this will be challenge for whoever wants to debug code and
reads this commit to figure out.

As far as I understand these 'various performance optimizations'
are independent updates, can you split them into their own
patches?
Each independent and logically separate optimization can go
into a separate patch.

Thanks,
ferruh

> Signed-off-by: John Miller <john.miller@atomicrules.com>
> 
> ---
> v2:
> - Added more details to the git log.
> ---
>   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;
>   }
>   


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

* Re: [PATCH v2 1/3] net/ark: add device capabilities record
  2022-02-11 11:39 ` [PATCH v2 1/3] net/ark: add device capabilities record John Miller
  2022-02-11 11:39   ` [PATCH v2 2/3] net/ark: support arbitrary mbuf size John Miller
  2022-02-11 11:39   ` [PATCH v2 3/3] net/ark: support chunk DMA transfers John Miller
@ 2022-02-14 14:00   ` Ferruh Yigit
  2 siblings, 0 replies; 16+ messages in thread
From: Ferruh Yigit @ 2022-02-14 14:00 UTC (permalink / raw)
  To: John Miller, dev; +Cc: shepard.siegel

On 2/11/2022 11:39 AM, John Miller wrote:
> Add a device capabilities record for supported features.
> Certain variants require that PCIe read-requests be correctly
> throttled. This is called "rqpacing" in Arkville, and has to do
> with credit and flow control on certain Arkville implementations.
> 
> Signed-off-by: John Miller <john.miller@atomicrules.com>
> 
> ---
> v2:
> - Improved code readability and comments.
> ---
>   drivers/net/ark/ark_ethdev.c | 88 +++++++++++++++++++++++++++++-------
>   1 file changed, 71 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
> index b618cba3f0..9f5f375174 100644
> --- a/drivers/net/ark/ark_ethdev.c
> +++ b/drivers/net/ark/ark_ethdev.c
> @@ -85,17 +85,53 @@ static const char * const valid_arguments[] = {
>   	NULL
>   };
>   
> +#define AR_VENDOR_ID 0x1d6c
>   static const struct rte_pci_id pci_id_ark_map[] = {
> -	{RTE_PCI_DEVICE(0x1d6c, 0x100d)},
> -	{RTE_PCI_DEVICE(0x1d6c, 0x100e)},
> -	{RTE_PCI_DEVICE(0x1d6c, 0x100f)},
> -	{RTE_PCI_DEVICE(0x1d6c, 0x1010)},
> -	{RTE_PCI_DEVICE(0x1d6c, 0x1017)},
> -	{RTE_PCI_DEVICE(0x1d6c, 0x1018)},
> -	{RTE_PCI_DEVICE(0x1d6c, 0x1019)},
> +	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100d)},
> +	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100e)},
> +	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100f)},
> +	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1010)},
> +	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1017)},
> +	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1018)},
> +	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1019)},
> +	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101e)},
> +	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101f)},

Here two new device support added, can you please separate it
to its own patch?

Also is this new device support deserve driver documentation
or release notes update?

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

* [PATCH v3 1/7] net/ark: add device capabilities record
       [not found] <20220119191255.273988-ed.czeck@atomicrules.com>
  2022-02-10 14:34 ` [PATCH v2 1/3] net/ark: add device capabilities record John Miller
  2022-02-11 11:39 ` [PATCH v2 1/3] net/ark: add device capabilities record John Miller
@ 2022-02-15 22:19 ` John Miller
  2022-02-15 22:19   ` [PATCH v3 2/7] net/ark: add support for new devices John Miller
                     ` (6 more replies)
  2 siblings, 7 replies; 16+ messages in thread
From: John Miller @ 2022-02-15 22:19 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, John Miller

Add a device capabilities record for supported features.
Certain variants require that PCIe read-requests be correctly
throttled. This is called "rqpacing" in Arkville, and has to do
with credit and flow control on certain Arkville implementations.

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

---
v2:
- Improved code readability and comments.

v3:
- Split	patch to separate new supported	devices.
---
 drivers/net/ark/ark_ethdev.c | 84 ++++++++++++++++++++++++++++--------
 1 file changed, 67 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 230a1272e9..d2b1cb083b 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -85,17 +85,49 @@ static const char * const valid_arguments[] = {
 	NULL
 };
 
+#define AR_VENDOR_ID 0x1d6c
 static const struct rte_pci_id pci_id_ark_map[] = {
-	{RTE_PCI_DEVICE(0x1d6c, 0x100d)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x100e)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x100f)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x1010)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x1017)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x1018)},
-	{RTE_PCI_DEVICE(0x1d6c, 0x1019)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100d)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100e)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x100f)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1010)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1017)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1018)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1019)},
 	{.vendor_id = 0, /* sentinel */ },
 };
 
+/*
+ * This structure is used to statically define the capabilities
+ * of supported devices.
+ * Capabilities:
+ *  rqpacing -
+ * Some HW variants require that PCIe read-requests be correctly throttled.
+ * This is called "rqpacing" and has to do with credit and flow control
+ * on certain Arkville implementations.
+ */
+struct ark_caps {
+	bool rqpacing;
+};
+struct ark_dev_caps {
+	uint32_t  device_id;
+	struct ark_caps  caps;
+};
+#define SET_DEV_CAPS(id, rqp) \
+	{id, {.rqpacing = rqp} }
+
+static const struct ark_dev_caps
+ark_device_caps[] = {
+		     SET_DEV_CAPS(0x100d, true),
+		     SET_DEV_CAPS(0x100e, true),
+		     SET_DEV_CAPS(0x100f, true),
+		     SET_DEV_CAPS(0x1010, false),
+		     SET_DEV_CAPS(0x1017, true),
+		     SET_DEV_CAPS(0x1018, true),
+		     SET_DEV_CAPS(0x1019, true),
+		     {.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 +288,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 +303,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 = rte_eth_pkt_burst_dummy;
 	dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
@@ -288,8 +330,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 +355,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 +547,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 +744,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] 16+ messages in thread

* [PATCH v3 2/7] net/ark: add support for new devices
  2022-02-15 22:19 ` [PATCH v3 1/7] " John Miller
@ 2022-02-15 22:19   ` John Miller
  2022-02-15 22:19   ` [PATCH v3 3/7] net/ark: support arbitrary mbuf size John Miller
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: John Miller @ 2022-02-15 22:19 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, John Miller

Add two new supported device ID's.
Add documentation for new devices.

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

---
v3:
- Split patch and added documentation
---
 doc/guides/nics/ark.rst      | 2 ++
 drivers/net/ark/ark_ethdev.c | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/doc/guides/nics/ark.rst b/doc/guides/nics/ark.rst
index da61814b5d..60b61e08e8 100644
--- a/doc/guides/nics/ark.rst
+++ b/doc/guides/nics/ark.rst
@@ -297,6 +297,8 @@ ARK PMD supports the following Arkville RTL PCIe instances including:
 * ``1d6c:1017`` - AR-ARK-FX1 [Arkville 64B Multi-Homed Primary Endpoint]
 * ``1d6c:1018`` - AR-ARK-FX1 [Arkville 64B Multi-Homed Secondary Endpoint]
 * ``1d6c:1019`` - AR-ARK-FX1 [Arkville 64B Multi-Homed Tertiary Endpoint]
+* ``1d6c:101e`` - AR-ARKA-FX1 [Arkville 64B DPDK Data Mover for Agilex R-Tile]
+* ``1d6c:101f`` - AR-TK242 [2x100GbE Packet Capture Device]
 
 Supported Operating Systems
 ---------------------------
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index d2b1cb083b..a13f74718b 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -94,6 +94,8 @@ static const struct rte_pci_id pci_id_ark_map[] = {
 	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1017)},
 	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1018)},
 	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x1019)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101e)},
+	{RTE_PCI_DEVICE(AR_VENDOR_ID, 0x101f)},
 	{.vendor_id = 0, /* sentinel */ },
 };
 
@@ -125,6 +127,8 @@ ark_device_caps[] = {
 		     SET_DEV_CAPS(0x1017, true),
 		     SET_DEV_CAPS(0x1018, true),
 		     SET_DEV_CAPS(0x1019, true),
+		     SET_DEV_CAPS(0x101e, false),
+		     SET_DEV_CAPS(0x101f, false),
 		     {.device_id = 0,}
 };
 
-- 
2.25.1


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

* [PATCH v3 3/7] net/ark: support arbitrary mbuf size
  2022-02-15 22:19 ` [PATCH v3 1/7] " John Miller
  2022-02-15 22:19   ` [PATCH v3 2/7] net/ark: add support for new devices John Miller
@ 2022-02-15 22:19   ` John Miller
  2022-02-15 22:19   ` [PATCH v3 4/7] net/ark: packet generator and checker status update John Miller
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: John Miller @ 2022-02-15 22:19 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, John Miller

Added arbitrary mbuf size per queue capability.
Updated ARK_UDM_CONST3 value to reflect the version number
read from the HW that is required to support this change.

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 a13f74718b..51b9e04701 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -527,14 +527,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 37a88cbede..0478702cbe 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);
 
@@ -267,6 +281,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"
@@ -295,7 +310,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
@@ -336,14 +351,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] 16+ messages in thread

* [PATCH v3 4/7] net/ark: packet generator and checker status update
  2022-02-15 22:19 ` [PATCH v3 1/7] " John Miller
  2022-02-15 22:19   ` [PATCH v3 2/7] net/ark: add support for new devices John Miller
  2022-02-15 22:19   ` [PATCH v3 3/7] net/ark: support arbitrary mbuf size John Miller
@ 2022-02-15 22:19   ` John Miller
  2022-02-15 22:19   ` [PATCH v3 5/7] net/ark: support chunk DMA transfers John Miller
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: John Miller @ 2022-02-15 22:19 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, John Miller

Configuration status updates for internal packet checker and
generator.

Signed-off-by: John Miller <john.miller@atomicrules.com>
---
 drivers/net/ark/ark_pktchkr.c | 2 +-
 drivers/net/ark/ark_pktgen.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

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
-- 
2.25.1


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

* [PATCH v3 5/7] net/ark: support chunk DMA transfers
  2022-02-15 22:19 ` [PATCH v3 1/7] " John Miller
                     ` (2 preceding siblings ...)
  2022-02-15 22:19   ` [PATCH v3 4/7] net/ark: packet generator and checker status update John Miller
@ 2022-02-15 22:19   ` John Miller
  2022-02-15 22:19   ` [PATCH v3 6/7] net/ark: add memory write barriers in critical code paths John Miller
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: John Miller @ 2022-02-15 22:19 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, John Miller

Add support for chunk DMA transfers.

Chunk mpu transfer use 64 objects (512 byte) to maintain memory
read alignment.

Align mpu memory allocation to be at 512 byte boundaries.

Reduce force-close allocation from 10000 objects to 64 objects.

Signed-off-by: John Miller <john.miller@atomicrules.com>
---
 drivers/net/ark/ark_ethdev_rx.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 0478702cbe..0fbb2603db 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) {
@@ -446,7 +447,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;
@@ -609,14 +611,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);
 }
-- 
2.25.1


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

* [PATCH v3 6/7] net/ark: add memory write barriers in critical code paths
  2022-02-15 22:19 ` [PATCH v3 1/7] " John Miller
                     ` (3 preceding siblings ...)
  2022-02-15 22:19   ` [PATCH v3 5/7] net/ark: support chunk DMA transfers John Miller
@ 2022-02-15 22:19   ` John Miller
  2022-02-15 22:19   ` [PATCH v3 7/7] net/ark: add performance optimizations John Miller
  2022-02-16 10:25   ` [PATCH v3 1/7] net/ark: add device capabilities record Ferruh Yigit
  6 siblings, 0 replies; 16+ messages in thread
From: John Miller @ 2022-02-15 22:19 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, John Miller

Add memory write barriers for read and wait status functions
in ddm, udm and mpu.

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

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_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_udm.c b/drivers/net/ark/ark_udm.c
index 28c4500a2c..cb3cf5c941 100644
--- a/drivers/net/ark/ark_udm.c
+++ b/drivers/net/ark/ark_udm.c
@@ -34,6 +34,7 @@ ark_udm_stop(struct ark_udm_t *udm, const int wait)
 	int cnt = 0;
 
 	udm->cfg.command = 2;
+	rte_wmb();
 
 	while (wait && (udm->cfg.stop_flushed & 0x01) == 0) {
 		if (cnt++ > 1000)
-- 
2.25.1


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

* [PATCH v3 7/7] net/ark: add performance optimizations
  2022-02-15 22:19 ` [PATCH v3 1/7] " John Miller
                     ` (4 preceding siblings ...)
  2022-02-15 22:19   ` [PATCH v3 6/7] net/ark: add memory write barriers in critical code paths John Miller
@ 2022-02-15 22:19   ` John Miller
  2022-02-16 10:25   ` [PATCH v3 1/7] net/ark: add device capabilities record Ferruh Yigit
  6 siblings, 0 replies; 16+ messages in thread
From: John Miller @ 2022-02-15 22:19 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, John Miller

Added software register writes for hw optimization and
performance fixes.

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

diff --git a/drivers/net/ark/ark_udm.c b/drivers/net/ark/ark_udm.c
index cb3cf5c941..9ebed89627 100644
--- a/drivers/net/ark/ark_udm.c
+++ b/drivers/net/ark/ark_udm.c
@@ -33,6 +33,7 @@ ark_udm_stop(struct ark_udm_t *udm, const int wait)
 {
 	int cnt = 0;
 
+	udm->setup.r0 = 0;
 	udm->cfg.command = 2;
 	rte_wmb();
 
@@ -71,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] 16+ messages in thread

* Re: [PATCH v3 1/7] net/ark: add device capabilities record
  2022-02-15 22:19 ` [PATCH v3 1/7] " John Miller
                     ` (5 preceding siblings ...)
  2022-02-15 22:19   ` [PATCH v3 7/7] net/ark: add performance optimizations John Miller
@ 2022-02-16 10:25   ` Ferruh Yigit
  6 siblings, 0 replies; 16+ messages in thread
From: Ferruh Yigit @ 2022-02-16 10:25 UTC (permalink / raw)
  To: John Miller, dev; +Cc: shepard.siegel

On 2/15/2022 10:19 PM, John Miller wrote:
> Add a device capabilities record for supported features.
> Certain variants require that PCIe read-requests be correctly
> throttled. This is called "rqpacing" in Arkville, and has to do
> with credit and flow control on certain Arkville implementations.
> 
> Signed-off-by: John Miller<john.miller@atomicrules.com>
> 
> ---
> v2:
> - Improved code readability and comments.
> 
> v3:
> - Split	patch to separate new supported	devices.

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

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

end of thread, other threads:[~2022-02-16 10:25 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220119191255.273988-ed.czeck@atomicrules.com>
2022-02-10 14:34 ` [PATCH v2 1/3] net/ark: add device capabilities record John Miller
2022-02-10 14:34   ` [PATCH v2 2/3] net/ark: support arbitrary mbuf size John Miller
2022-02-10 14:34   ` [PATCH v2 3/3] net/ark: support chunk DMA transfers John Miller
2022-02-11 11:39 ` [PATCH v2 1/3] net/ark: add device capabilities record John Miller
2022-02-11 11:39   ` [PATCH v2 2/3] net/ark: support arbitrary mbuf size John Miller
2022-02-11 11:39   ` [PATCH v2 3/3] net/ark: support chunk DMA transfers John Miller
2022-02-14 13:59     ` Ferruh Yigit
2022-02-14 14:00   ` [PATCH v2 1/3] net/ark: add device capabilities record Ferruh Yigit
2022-02-15 22:19 ` [PATCH v3 1/7] " John Miller
2022-02-15 22:19   ` [PATCH v3 2/7] net/ark: add support for new devices John Miller
2022-02-15 22:19   ` [PATCH v3 3/7] net/ark: support arbitrary mbuf size John Miller
2022-02-15 22:19   ` [PATCH v3 4/7] net/ark: packet generator and checker status update John Miller
2022-02-15 22:19   ` [PATCH v3 5/7] net/ark: support chunk DMA transfers John Miller
2022-02-15 22:19   ` [PATCH v3 6/7] net/ark: add memory write barriers in critical code paths John Miller
2022-02-15 22:19   ` [PATCH v3 7/7] net/ark: add performance optimizations John Miller
2022-02-16 10:25   ` [PATCH v3 1/7] 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).