patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v1 1/5] net/ark: update pkt director initial state
@ 2021-03-04 16:56 Ed Czeck
  2021-03-04 16:56 ` [dpdk-stable] [PATCH v1 2/5] net/ark: refactor Rx buffer recovery Ed Czeck
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Ed Czeck @ 2021-03-04 16:56 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, john.miller, stable

Fixes: b33ccdb17f55 ("net/ark: provide API for hardware modules MPU RQP and pktdir")
Cc: stable@dpdk.org

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 1 +
 drivers/net/ark/ark_pktdir.c | 2 +-
 drivers/net/ark/ark_pktdir.h | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index ef650a465..477e1de02 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -321,6 +321,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 	ark->rqpacing =
 		(struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
 	ark->started = 0;
+	ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
 
 	ARK_PMD_LOG(INFO, "Sys Ctrl Const = 0x%x  HW Commit_ID: %08x\n",
 		      ark->sysctrl.t32[4],
diff --git a/drivers/net/ark/ark_pktdir.c b/drivers/net/ark/ark_pktdir.c
index 25e121831..dbfd2924b 100644
--- a/drivers/net/ark/ark_pktdir.c
+++ b/drivers/net/ark/ark_pktdir.c
@@ -22,7 +22,7 @@ ark_pktdir_init(void *base)
 		return inst;
 	}
 	inst->regs = (struct ark_pkt_dir_regs *)base;
-	inst->regs->ctrl = 0x00110110;	/* POR state */
+	inst->regs->ctrl = ARK_PKT_DIR_INIT_VAL; /* POR state */
 	return inst;
 }
 
diff --git a/drivers/net/ark/ark_pktdir.h b/drivers/net/ark/ark_pktdir.h
index 4afd128f9..b5577cebb 100644
--- a/drivers/net/ark/ark_pktdir.h
+++ b/drivers/net/ark/ark_pktdir.h
@@ -7,7 +7,7 @@
 
 #include <stdint.h>
 
-#define ARK_PKTDIR_BASE_ADR  0xa0000
+#define ARK_PKT_DIR_INIT_VAL 0x0110
 
 typedef void *ark_pkt_dir_t;
 
-- 
2.17.1


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

* [dpdk-stable] [PATCH v1 2/5] net/ark: refactor Rx buffer recovery
  2021-03-04 16:56 [dpdk-stable] [PATCH v1 1/5] net/ark: update pkt director initial state Ed Czeck
@ 2021-03-04 16:56 ` Ed Czeck
  2021-03-04 20:33 ` [dpdk-stable] [PATCH v2 1/5] net/ark: update pkt director initial state Ed Czeck
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Ed Czeck @ 2021-03-04 16:56 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, john.miller, stable

Allocate mbufs for Rx path in bulk of at least 64 buffers
to improve performance. Allow recovery even without
a rx operation to support lack of buffers in pool.

Fixes: be410a861598 ("net/ark: add recovery for lack of mbufs")
Cc: stable@dpdk.org

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_ethdev_rx.c | 49 ++++++++-------------------------
 1 file changed, 11 insertions(+), 38 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index d29d3db78..8e55b851a 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -26,9 +26,6 @@ static uint32_t eth_ark_rx_jumbo(struct ark_rx_queue *queue,
 				 struct rte_mbuf *mbuf0,
 				 uint32_t cons_index);
 static inline int eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue);
-static int eth_ark_rx_seed_recovery(struct ark_rx_queue *queue,
-				    uint32_t *pnb,
-				    struct rte_mbuf **mbufs);
 
 /* ************************************************************************* */
 struct ark_rx_queue {
@@ -54,7 +51,7 @@ struct ark_rx_queue {
 	/* The queue Index is used within the dpdk device structures */
 	uint16_t queue_index;
 
-	uint32_t last_cons;
+	uint32_t unused;
 
 	/* separate cache line */
 	/* second cache line - fields only used in slow path */
@@ -105,9 +102,8 @@ static inline void
 eth_ark_rx_update_cons_index(struct ark_rx_queue *queue, uint32_t cons_index)
 {
 	queue->cons_index = cons_index;
-	eth_ark_rx_seed_mbufs(queue);
-	if (((cons_index - queue->last_cons) >= 64U)) {
-		queue->last_cons = cons_index;
+	if ((cons_index + queue->queue_size - queue->seed_index) >= 64U) {
+		eth_ark_rx_seed_mbufs(queue);
 		ark_mpu_set_producer(queue->mpu, queue->seed_index);
 	}
 }
@@ -321,9 +317,7 @@ eth_ark_recv_pkts(void *rx_queue,
 			break;
 	}
 
-	if (unlikely(nb != 0))
-		/* report next free to FPGA */
-		eth_ark_rx_update_cons_index(queue, cons_index);
+	eth_ark_rx_update_cons_index(queue, cons_index);
 
 	return nb;
 }
@@ -458,11 +452,13 @@ eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 	int status = rte_pktmbuf_alloc_bulk(queue->mb_pool, mbufs, nb);
 
 	if (unlikely(status != 0)) {
-		/* Try to recover from lack of mbufs in pool */
-		status = eth_ark_rx_seed_recovery(queue, &nb, mbufs);
-		if (unlikely(status != 0)) {
-			return -1;
-		}
+		ARK_PMD_LOG(NOTICE,
+			    "Could not allocate %u mbufs from pool"
+			    " for RX queue %u;"
+			    " %u free buffers remaining in queue\n",
+			    nb, queue->queue_index,
+			    queue->seed_index - queue->cons_index);
+		return -1;
 	}
 
 	if (ARK_DEBUG_CORE) {		/* DEBUG */
@@ -511,29 +507,6 @@ eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 	return 0;
 }
 
-int
-eth_ark_rx_seed_recovery(struct ark_rx_queue *queue,
-			 uint32_t *pnb,
-			 struct rte_mbuf **mbufs)
-{
-	int status = -1;
-
-	/* Ignore small allocation failures */
-	if (*pnb <= 64)
-		return -1;
-
-	*pnb = 64U;
-	status = rte_pktmbuf_alloc_bulk(queue->mb_pool, mbufs, *pnb);
-	if (status != 0) {
-		ARK_PMD_LOG(NOTICE,
-			    "ARK: Could not allocate %u mbufs from pool for RX queue %u;"
-			    " %u free buffers remaining in queue\n",
-			    *pnb, queue->queue_index,
-			    queue->seed_index - queue->cons_index);
-	}
-	return status;
-}
-
 void
 eth_ark_rx_dump_queue(struct rte_eth_dev *dev, uint16_t queue_id,
 		      const char *msg)
-- 
2.17.1


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

* [dpdk-stable] [PATCH v2 1/5] net/ark: update pkt director initial state
  2021-03-04 16:56 [dpdk-stable] [PATCH v1 1/5] net/ark: update pkt director initial state Ed Czeck
  2021-03-04 16:56 ` [dpdk-stable] [PATCH v1 2/5] net/ark: refactor Rx buffer recovery Ed Czeck
@ 2021-03-04 20:33 ` Ed Czeck
  2021-03-04 20:33   ` [dpdk-stable] [PATCH v2 2/5] net/ark: refactor Rx buffer recovery Ed Czeck
  2021-03-08 22:29 ` [dpdk-stable] [PATCH v3 1/6] net/ark: update pkt director initial state Ed Czeck
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Ed Czeck @ 2021-03-04 20:33 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, john.miller, stable

Fixes: b33ccdb17f55 ("net/ark: provide API for hardware modules MPU RQP and pktdir")
Cc: stable@dpdk.org

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 1 +
 drivers/net/ark/ark_pktdir.c | 2 +-
 drivers/net/ark/ark_pktdir.h | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index ef650a465..477e1de02 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -321,6 +321,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 	ark->rqpacing =
 		(struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
 	ark->started = 0;
+	ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
 
 	ARK_PMD_LOG(INFO, "Sys Ctrl Const = 0x%x  HW Commit_ID: %08x\n",
 		      ark->sysctrl.t32[4],
diff --git a/drivers/net/ark/ark_pktdir.c b/drivers/net/ark/ark_pktdir.c
index 25e121831..dbfd2924b 100644
--- a/drivers/net/ark/ark_pktdir.c
+++ b/drivers/net/ark/ark_pktdir.c
@@ -22,7 +22,7 @@ ark_pktdir_init(void *base)
 		return inst;
 	}
 	inst->regs = (struct ark_pkt_dir_regs *)base;
-	inst->regs->ctrl = 0x00110110;	/* POR state */
+	inst->regs->ctrl = ARK_PKT_DIR_INIT_VAL; /* POR state */
 	return inst;
 }
 
diff --git a/drivers/net/ark/ark_pktdir.h b/drivers/net/ark/ark_pktdir.h
index 4afd128f9..b5577cebb 100644
--- a/drivers/net/ark/ark_pktdir.h
+++ b/drivers/net/ark/ark_pktdir.h
@@ -7,7 +7,7 @@
 
 #include <stdint.h>
 
-#define ARK_PKTDIR_BASE_ADR  0xa0000
+#define ARK_PKT_DIR_INIT_VAL 0x0110
 
 typedef void *ark_pkt_dir_t;
 
-- 
2.17.1


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

* [dpdk-stable] [PATCH v2 2/5] net/ark: refactor Rx buffer recovery
  2021-03-04 20:33 ` [dpdk-stable] [PATCH v2 1/5] net/ark: update pkt director initial state Ed Czeck
@ 2021-03-04 20:33   ` Ed Czeck
  0 siblings, 0 replies; 12+ messages in thread
From: Ed Czeck @ 2021-03-04 20:33 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, john.miller, stable

Allocate mbufs for Rx path in bulk of at least 64 buffers
to improve performance. Allow recovery even without
a rx operation to support lack of buffers in pool.

Fixes: be410a861598 ("net/ark: add recovery for lack of mbufs")
Cc: stable@dpdk.org

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_ethdev_rx.c | 49 ++++++++-------------------------
 1 file changed, 11 insertions(+), 38 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index d29d3db78..8e55b851a 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -26,9 +26,6 @@ static uint32_t eth_ark_rx_jumbo(struct ark_rx_queue *queue,
 				 struct rte_mbuf *mbuf0,
 				 uint32_t cons_index);
 static inline int eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue);
-static int eth_ark_rx_seed_recovery(struct ark_rx_queue *queue,
-				    uint32_t *pnb,
-				    struct rte_mbuf **mbufs);
 
 /* ************************************************************************* */
 struct ark_rx_queue {
@@ -54,7 +51,7 @@ struct ark_rx_queue {
 	/* The queue Index is used within the dpdk device structures */
 	uint16_t queue_index;
 
-	uint32_t last_cons;
+	uint32_t unused;
 
 	/* separate cache line */
 	/* second cache line - fields only used in slow path */
@@ -105,9 +102,8 @@ static inline void
 eth_ark_rx_update_cons_index(struct ark_rx_queue *queue, uint32_t cons_index)
 {
 	queue->cons_index = cons_index;
-	eth_ark_rx_seed_mbufs(queue);
-	if (((cons_index - queue->last_cons) >= 64U)) {
-		queue->last_cons = cons_index;
+	if ((cons_index + queue->queue_size - queue->seed_index) >= 64U) {
+		eth_ark_rx_seed_mbufs(queue);
 		ark_mpu_set_producer(queue->mpu, queue->seed_index);
 	}
 }
@@ -321,9 +317,7 @@ eth_ark_recv_pkts(void *rx_queue,
 			break;
 	}
 
-	if (unlikely(nb != 0))
-		/* report next free to FPGA */
-		eth_ark_rx_update_cons_index(queue, cons_index);
+	eth_ark_rx_update_cons_index(queue, cons_index);
 
 	return nb;
 }
@@ -458,11 +452,13 @@ eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 	int status = rte_pktmbuf_alloc_bulk(queue->mb_pool, mbufs, nb);
 
 	if (unlikely(status != 0)) {
-		/* Try to recover from lack of mbufs in pool */
-		status = eth_ark_rx_seed_recovery(queue, &nb, mbufs);
-		if (unlikely(status != 0)) {
-			return -1;
-		}
+		ARK_PMD_LOG(NOTICE,
+			    "Could not allocate %u mbufs from pool"
+			    " for RX queue %u;"
+			    " %u free buffers remaining in queue\n",
+			    nb, queue->queue_index,
+			    queue->seed_index - queue->cons_index);
+		return -1;
 	}
 
 	if (ARK_DEBUG_CORE) {		/* DEBUG */
@@ -511,29 +507,6 @@ eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 	return 0;
 }
 
-int
-eth_ark_rx_seed_recovery(struct ark_rx_queue *queue,
-			 uint32_t *pnb,
-			 struct rte_mbuf **mbufs)
-{
-	int status = -1;
-
-	/* Ignore small allocation failures */
-	if (*pnb <= 64)
-		return -1;
-
-	*pnb = 64U;
-	status = rte_pktmbuf_alloc_bulk(queue->mb_pool, mbufs, *pnb);
-	if (status != 0) {
-		ARK_PMD_LOG(NOTICE,
-			    "ARK: Could not allocate %u mbufs from pool for RX queue %u;"
-			    " %u free buffers remaining in queue\n",
-			    *pnb, queue->queue_index,
-			    queue->seed_index - queue->cons_index);
-	}
-	return status;
-}
-
 void
 eth_ark_rx_dump_queue(struct rte_eth_dev *dev, uint16_t queue_id,
 		      const char *msg)
-- 
2.17.1


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

* [dpdk-stable] [PATCH v3 1/6] net/ark: update pkt director initial state
  2021-03-04 16:56 [dpdk-stable] [PATCH v1 1/5] net/ark: update pkt director initial state Ed Czeck
  2021-03-04 16:56 ` [dpdk-stable] [PATCH v1 2/5] net/ark: refactor Rx buffer recovery Ed Czeck
  2021-03-04 20:33 ` [dpdk-stable] [PATCH v2 1/5] net/ark: update pkt director initial state Ed Czeck
@ 2021-03-08 22:29 ` Ed Czeck
  2021-03-08 22:29   ` [dpdk-stable] [PATCH v3 2/6] net/ark: refactor Rx buffer recovery Ed Czeck
  2021-03-09 16:08 ` [dpdk-stable] [PATCH v4 1/6] net/ark: update pkt director initial state Ed Czeck
  2021-03-18 17:36 ` [dpdk-stable] [PATCH v5 1/6] net/ark: update pkt director initial state Ed Czeck
  4 siblings, 1 reply; 12+ messages in thread
From: Ed Czeck @ 2021-03-08 22:29 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, john.miller, stable

Fixes: b33ccdb17f55 ("net/ark: provide API for hardware modules MPU RQP and pktdir")
Cc: stable@dpdk.org

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 1 +
 drivers/net/ark/ark_pktdir.c | 2 +-
 drivers/net/ark/ark_pktdir.h | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index ef650a465..477e1de02 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -321,6 +321,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 	ark->rqpacing =
 		(struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
 	ark->started = 0;
+	ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
 
 	ARK_PMD_LOG(INFO, "Sys Ctrl Const = 0x%x  HW Commit_ID: %08x\n",
 		      ark->sysctrl.t32[4],
diff --git a/drivers/net/ark/ark_pktdir.c b/drivers/net/ark/ark_pktdir.c
index 25e121831..dbfd2924b 100644
--- a/drivers/net/ark/ark_pktdir.c
+++ b/drivers/net/ark/ark_pktdir.c
@@ -22,7 +22,7 @@ ark_pktdir_init(void *base)
 		return inst;
 	}
 	inst->regs = (struct ark_pkt_dir_regs *)base;
-	inst->regs->ctrl = 0x00110110;	/* POR state */
+	inst->regs->ctrl = ARK_PKT_DIR_INIT_VAL; /* POR state */
 	return inst;
 }
 
diff --git a/drivers/net/ark/ark_pktdir.h b/drivers/net/ark/ark_pktdir.h
index 4afd128f9..b5577cebb 100644
--- a/drivers/net/ark/ark_pktdir.h
+++ b/drivers/net/ark/ark_pktdir.h
@@ -7,7 +7,7 @@
 
 #include <stdint.h>
 
-#define ARK_PKTDIR_BASE_ADR  0xa0000
+#define ARK_PKT_DIR_INIT_VAL 0x0110
 
 typedef void *ark_pkt_dir_t;
 
-- 
2.17.1


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

* [dpdk-stable] [PATCH v3 2/6] net/ark: refactor Rx buffer recovery
  2021-03-08 22:29 ` [dpdk-stable] [PATCH v3 1/6] net/ark: update pkt director initial state Ed Czeck
@ 2021-03-08 22:29   ` Ed Czeck
  0 siblings, 0 replies; 12+ messages in thread
From: Ed Czeck @ 2021-03-08 22:29 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, john.miller, stable

Allocate mbufs for Rx path in bulk of at least 64 buffers
to improve performance. Allow recovery even without
a Rx operation to support lack of buffers in pool.

Fixes: be410a861598 ("net/ark: add recovery for lack of mbufs")
Cc: stable@dpdk.org

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_ethdev_rx.c | 49 ++++++++-------------------------
 1 file changed, 11 insertions(+), 38 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index d29d3db78..8e55b851a 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -26,9 +26,6 @@ static uint32_t eth_ark_rx_jumbo(struct ark_rx_queue *queue,
 				 struct rte_mbuf *mbuf0,
 				 uint32_t cons_index);
 static inline int eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue);
-static int eth_ark_rx_seed_recovery(struct ark_rx_queue *queue,
-				    uint32_t *pnb,
-				    struct rte_mbuf **mbufs);
 
 /* ************************************************************************* */
 struct ark_rx_queue {
@@ -54,7 +51,7 @@ struct ark_rx_queue {
 	/* The queue Index is used within the dpdk device structures */
 	uint16_t queue_index;
 
-	uint32_t last_cons;
+	uint32_t unused;
 
 	/* separate cache line */
 	/* second cache line - fields only used in slow path */
@@ -105,9 +102,8 @@ static inline void
 eth_ark_rx_update_cons_index(struct ark_rx_queue *queue, uint32_t cons_index)
 {
 	queue->cons_index = cons_index;
-	eth_ark_rx_seed_mbufs(queue);
-	if (((cons_index - queue->last_cons) >= 64U)) {
-		queue->last_cons = cons_index;
+	if ((cons_index + queue->queue_size - queue->seed_index) >= 64U) {
+		eth_ark_rx_seed_mbufs(queue);
 		ark_mpu_set_producer(queue->mpu, queue->seed_index);
 	}
 }
@@ -321,9 +317,7 @@ eth_ark_recv_pkts(void *rx_queue,
 			break;
 	}
 
-	if (unlikely(nb != 0))
-		/* report next free to FPGA */
-		eth_ark_rx_update_cons_index(queue, cons_index);
+	eth_ark_rx_update_cons_index(queue, cons_index);
 
 	return nb;
 }
@@ -458,11 +452,13 @@ eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 	int status = rte_pktmbuf_alloc_bulk(queue->mb_pool, mbufs, nb);
 
 	if (unlikely(status != 0)) {
-		/* Try to recover from lack of mbufs in pool */
-		status = eth_ark_rx_seed_recovery(queue, &nb, mbufs);
-		if (unlikely(status != 0)) {
-			return -1;
-		}
+		ARK_PMD_LOG(NOTICE,
+			    "Could not allocate %u mbufs from pool"
+			    " for RX queue %u;"
+			    " %u free buffers remaining in queue\n",
+			    nb, queue->queue_index,
+			    queue->seed_index - queue->cons_index);
+		return -1;
 	}
 
 	if (ARK_DEBUG_CORE) {		/* DEBUG */
@@ -511,29 +507,6 @@ eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 	return 0;
 }
 
-int
-eth_ark_rx_seed_recovery(struct ark_rx_queue *queue,
-			 uint32_t *pnb,
-			 struct rte_mbuf **mbufs)
-{
-	int status = -1;
-
-	/* Ignore small allocation failures */
-	if (*pnb <= 64)
-		return -1;
-
-	*pnb = 64U;
-	status = rte_pktmbuf_alloc_bulk(queue->mb_pool, mbufs, *pnb);
-	if (status != 0) {
-		ARK_PMD_LOG(NOTICE,
-			    "ARK: Could not allocate %u mbufs from pool for RX queue %u;"
-			    " %u free buffers remaining in queue\n",
-			    *pnb, queue->queue_index,
-			    queue->seed_index - queue->cons_index);
-	}
-	return status;
-}
-
 void
 eth_ark_rx_dump_queue(struct rte_eth_dev *dev, uint16_t queue_id,
 		      const char *msg)
-- 
2.17.1


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

* [dpdk-stable] [PATCH v4 1/6] net/ark: update pkt director initial state
  2021-03-04 16:56 [dpdk-stable] [PATCH v1 1/5] net/ark: update pkt director initial state Ed Czeck
                   ` (2 preceding siblings ...)
  2021-03-08 22:29 ` [dpdk-stable] [PATCH v3 1/6] net/ark: update pkt director initial state Ed Czeck
@ 2021-03-09 16:08 ` Ed Czeck
  2021-03-09 16:08   ` [dpdk-stable] [PATCH v4 2/6] net/ark: refactor Rx buffer recovery Ed Czeck
  2021-03-18 17:36 ` [dpdk-stable] [PATCH v5 1/6] net/ark: update pkt director initial state Ed Czeck
  4 siblings, 1 reply; 12+ messages in thread
From: Ed Czeck @ 2021-03-09 16:08 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, john.miller, stable

Fixes: b33ccdb17f55 ("net/ark: provide API for hardware modules MPU RQP and pktdir")
Cc: stable@dpdk.org

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 1 +
 drivers/net/ark/ark_pktdir.c | 2 +-
 drivers/net/ark/ark_pktdir.h | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index ef650a465..477e1de02 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -321,6 +321,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 	ark->rqpacing =
 		(struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
 	ark->started = 0;
+	ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
 
 	ARK_PMD_LOG(INFO, "Sys Ctrl Const = 0x%x  HW Commit_ID: %08x\n",
 		      ark->sysctrl.t32[4],
diff --git a/drivers/net/ark/ark_pktdir.c b/drivers/net/ark/ark_pktdir.c
index 25e121831..dbfd2924b 100644
--- a/drivers/net/ark/ark_pktdir.c
+++ b/drivers/net/ark/ark_pktdir.c
@@ -22,7 +22,7 @@ ark_pktdir_init(void *base)
 		return inst;
 	}
 	inst->regs = (struct ark_pkt_dir_regs *)base;
-	inst->regs->ctrl = 0x00110110;	/* POR state */
+	inst->regs->ctrl = ARK_PKT_DIR_INIT_VAL; /* POR state */
 	return inst;
 }
 
diff --git a/drivers/net/ark/ark_pktdir.h b/drivers/net/ark/ark_pktdir.h
index 4afd128f9..b5577cebb 100644
--- a/drivers/net/ark/ark_pktdir.h
+++ b/drivers/net/ark/ark_pktdir.h
@@ -7,7 +7,7 @@
 
 #include <stdint.h>
 
-#define ARK_PKTDIR_BASE_ADR  0xa0000
+#define ARK_PKT_DIR_INIT_VAL 0x0110
 
 typedef void *ark_pkt_dir_t;
 
-- 
2.17.1


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

* [dpdk-stable] [PATCH v4 2/6] net/ark: refactor Rx buffer recovery
  2021-03-09 16:08 ` [dpdk-stable] [PATCH v4 1/6] net/ark: update pkt director initial state Ed Czeck
@ 2021-03-09 16:08   ` Ed Czeck
  0 siblings, 0 replies; 12+ messages in thread
From: Ed Czeck @ 2021-03-09 16:08 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: shepard.siegel, john.miller, stable

Allocate mbufs for Rx path in bulk of at least 64 buffers
to improve performance. Allow recovery even without
a Rx operation to support lack of buffers in pool.

Fixes: be410a861598 ("net/ark: add recovery for lack of mbufs")
Cc: stable@dpdk.org

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_ethdev_rx.c | 49 ++++++++-------------------------
 1 file changed, 11 insertions(+), 38 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index d29d3db78..8e55b851a 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -26,9 +26,6 @@ static uint32_t eth_ark_rx_jumbo(struct ark_rx_queue *queue,
 				 struct rte_mbuf *mbuf0,
 				 uint32_t cons_index);
 static inline int eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue);
-static int eth_ark_rx_seed_recovery(struct ark_rx_queue *queue,
-				    uint32_t *pnb,
-				    struct rte_mbuf **mbufs);
 
 /* ************************************************************************* */
 struct ark_rx_queue {
@@ -54,7 +51,7 @@ struct ark_rx_queue {
 	/* The queue Index is used within the dpdk device structures */
 	uint16_t queue_index;
 
-	uint32_t last_cons;
+	uint32_t unused;
 
 	/* separate cache line */
 	/* second cache line - fields only used in slow path */
@@ -105,9 +102,8 @@ static inline void
 eth_ark_rx_update_cons_index(struct ark_rx_queue *queue, uint32_t cons_index)
 {
 	queue->cons_index = cons_index;
-	eth_ark_rx_seed_mbufs(queue);
-	if (((cons_index - queue->last_cons) >= 64U)) {
-		queue->last_cons = cons_index;
+	if ((cons_index + queue->queue_size - queue->seed_index) >= 64U) {
+		eth_ark_rx_seed_mbufs(queue);
 		ark_mpu_set_producer(queue->mpu, queue->seed_index);
 	}
 }
@@ -321,9 +317,7 @@ eth_ark_recv_pkts(void *rx_queue,
 			break;
 	}
 
-	if (unlikely(nb != 0))
-		/* report next free to FPGA */
-		eth_ark_rx_update_cons_index(queue, cons_index);
+	eth_ark_rx_update_cons_index(queue, cons_index);
 
 	return nb;
 }
@@ -458,11 +452,13 @@ eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 	int status = rte_pktmbuf_alloc_bulk(queue->mb_pool, mbufs, nb);
 
 	if (unlikely(status != 0)) {
-		/* Try to recover from lack of mbufs in pool */
-		status = eth_ark_rx_seed_recovery(queue, &nb, mbufs);
-		if (unlikely(status != 0)) {
-			return -1;
-		}
+		ARK_PMD_LOG(NOTICE,
+			    "Could not allocate %u mbufs from pool"
+			    " for RX queue %u;"
+			    " %u free buffers remaining in queue\n",
+			    nb, queue->queue_index,
+			    queue->seed_index - queue->cons_index);
+		return -1;
 	}
 
 	if (ARK_DEBUG_CORE) {		/* DEBUG */
@@ -511,29 +507,6 @@ eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 	return 0;
 }
 
-int
-eth_ark_rx_seed_recovery(struct ark_rx_queue *queue,
-			 uint32_t *pnb,
-			 struct rte_mbuf **mbufs)
-{
-	int status = -1;
-
-	/* Ignore small allocation failures */
-	if (*pnb <= 64)
-		return -1;
-
-	*pnb = 64U;
-	status = rte_pktmbuf_alloc_bulk(queue->mb_pool, mbufs, *pnb);
-	if (status != 0) {
-		ARK_PMD_LOG(NOTICE,
-			    "ARK: Could not allocate %u mbufs from pool for RX queue %u;"
-			    " %u free buffers remaining in queue\n",
-			    *pnb, queue->queue_index,
-			    queue->seed_index - queue->cons_index);
-	}
-	return status;
-}
-
 void
 eth_ark_rx_dump_queue(struct rte_eth_dev *dev, uint16_t queue_id,
 		      const char *msg)
-- 
2.17.1


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

* [dpdk-stable] [PATCH v5 1/6] net/ark: update pkt director initial state
  2021-03-04 16:56 [dpdk-stable] [PATCH v1 1/5] net/ark: update pkt director initial state Ed Czeck
                   ` (3 preceding siblings ...)
  2021-03-09 16:08 ` [dpdk-stable] [PATCH v4 1/6] net/ark: update pkt director initial state Ed Czeck
@ 2021-03-18 17:36 ` Ed Czeck
  2021-03-18 17:36   ` [dpdk-stable] [PATCH v5 2/6] net/ark: refactor Rx buffer recovery Ed Czeck
  2021-03-22 15:59   ` [dpdk-stable] [PATCH v5 1/6] net/ark: update pkt director initial state Ferruh Yigit
  4 siblings, 2 replies; 12+ messages in thread
From: Ed Czeck @ 2021-03-18 17:36 UTC (permalink / raw)
  To: dev, ferruh.yigit, bruce.richardson; +Cc: shepard.siegel, john.miller, stable

Fixes: b33ccdb17f55 ("net/ark: provide API for hardware modules MPU RQP and pktdir")
Cc: stable@dpdk.org

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 1 +
 drivers/net/ark/ark_pktdir.c | 2 +-
 drivers/net/ark/ark_pktdir.h | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index ef650a465..477e1de02 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -321,6 +321,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 	ark->rqpacing =
 		(struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
 	ark->started = 0;
+	ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
 
 	ARK_PMD_LOG(INFO, "Sys Ctrl Const = 0x%x  HW Commit_ID: %08x\n",
 		      ark->sysctrl.t32[4],
diff --git a/drivers/net/ark/ark_pktdir.c b/drivers/net/ark/ark_pktdir.c
index 25e121831..dbfd2924b 100644
--- a/drivers/net/ark/ark_pktdir.c
+++ b/drivers/net/ark/ark_pktdir.c
@@ -22,7 +22,7 @@ ark_pktdir_init(void *base)
 		return inst;
 	}
 	inst->regs = (struct ark_pkt_dir_regs *)base;
-	inst->regs->ctrl = 0x00110110;	/* POR state */
+	inst->regs->ctrl = ARK_PKT_DIR_INIT_VAL; /* POR state */
 	return inst;
 }
 
diff --git a/drivers/net/ark/ark_pktdir.h b/drivers/net/ark/ark_pktdir.h
index 4afd128f9..b5577cebb 100644
--- a/drivers/net/ark/ark_pktdir.h
+++ b/drivers/net/ark/ark_pktdir.h
@@ -7,7 +7,7 @@
 
 #include <stdint.h>
 
-#define ARK_PKTDIR_BASE_ADR  0xa0000
+#define ARK_PKT_DIR_INIT_VAL 0x0110
 
 typedef void *ark_pkt_dir_t;
 
-- 
2.17.1


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

* [dpdk-stable] [PATCH v5 2/6] net/ark: refactor Rx buffer recovery
  2021-03-18 17:36 ` [dpdk-stable] [PATCH v5 1/6] net/ark: update pkt director initial state Ed Czeck
@ 2021-03-18 17:36   ` Ed Czeck
  2021-03-22 15:59   ` [dpdk-stable] [PATCH v5 1/6] net/ark: update pkt director initial state Ferruh Yigit
  1 sibling, 0 replies; 12+ messages in thread
From: Ed Czeck @ 2021-03-18 17:36 UTC (permalink / raw)
  To: dev, ferruh.yigit, bruce.richardson; +Cc: shepard.siegel, john.miller, stable

Allocate mbufs for Rx path in bulk of at least 64 buffers
to improve performance. Allow recovery even without
a Rx operation to support lack of buffers in pool.

Fixes: be410a861598 ("net/ark: add recovery for lack of mbufs")
Cc: stable@dpdk.org

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_ethdev_rx.c | 49 ++++++++-------------------------
 1 file changed, 11 insertions(+), 38 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index d29d3db78..8e55b851a 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -26,9 +26,6 @@ static uint32_t eth_ark_rx_jumbo(struct ark_rx_queue *queue,
 				 struct rte_mbuf *mbuf0,
 				 uint32_t cons_index);
 static inline int eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue);
-static int eth_ark_rx_seed_recovery(struct ark_rx_queue *queue,
-				    uint32_t *pnb,
-				    struct rte_mbuf **mbufs);
 
 /* ************************************************************************* */
 struct ark_rx_queue {
@@ -54,7 +51,7 @@ struct ark_rx_queue {
 	/* The queue Index is used within the dpdk device structures */
 	uint16_t queue_index;
 
-	uint32_t last_cons;
+	uint32_t unused;
 
 	/* separate cache line */
 	/* second cache line - fields only used in slow path */
@@ -105,9 +102,8 @@ static inline void
 eth_ark_rx_update_cons_index(struct ark_rx_queue *queue, uint32_t cons_index)
 {
 	queue->cons_index = cons_index;
-	eth_ark_rx_seed_mbufs(queue);
-	if (((cons_index - queue->last_cons) >= 64U)) {
-		queue->last_cons = cons_index;
+	if ((cons_index + queue->queue_size - queue->seed_index) >= 64U) {
+		eth_ark_rx_seed_mbufs(queue);
 		ark_mpu_set_producer(queue->mpu, queue->seed_index);
 	}
 }
@@ -321,9 +317,7 @@ eth_ark_recv_pkts(void *rx_queue,
 			break;
 	}
 
-	if (unlikely(nb != 0))
-		/* report next free to FPGA */
-		eth_ark_rx_update_cons_index(queue, cons_index);
+	eth_ark_rx_update_cons_index(queue, cons_index);
 
 	return nb;
 }
@@ -458,11 +452,13 @@ eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 	int status = rte_pktmbuf_alloc_bulk(queue->mb_pool, mbufs, nb);
 
 	if (unlikely(status != 0)) {
-		/* Try to recover from lack of mbufs in pool */
-		status = eth_ark_rx_seed_recovery(queue, &nb, mbufs);
-		if (unlikely(status != 0)) {
-			return -1;
-		}
+		ARK_PMD_LOG(NOTICE,
+			    "Could not allocate %u mbufs from pool"
+			    " for RX queue %u;"
+			    " %u free buffers remaining in queue\n",
+			    nb, queue->queue_index,
+			    queue->seed_index - queue->cons_index);
+		return -1;
 	}
 
 	if (ARK_DEBUG_CORE) {		/* DEBUG */
@@ -511,29 +507,6 @@ eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
 	return 0;
 }
 
-int
-eth_ark_rx_seed_recovery(struct ark_rx_queue *queue,
-			 uint32_t *pnb,
-			 struct rte_mbuf **mbufs)
-{
-	int status = -1;
-
-	/* Ignore small allocation failures */
-	if (*pnb <= 64)
-		return -1;
-
-	*pnb = 64U;
-	status = rte_pktmbuf_alloc_bulk(queue->mb_pool, mbufs, *pnb);
-	if (status != 0) {
-		ARK_PMD_LOG(NOTICE,
-			    "ARK: Could not allocate %u mbufs from pool for RX queue %u;"
-			    " %u free buffers remaining in queue\n",
-			    *pnb, queue->queue_index,
-			    queue->seed_index - queue->cons_index);
-	}
-	return status;
-}
-
 void
 eth_ark_rx_dump_queue(struct rte_eth_dev *dev, uint16_t queue_id,
 		      const char *msg)
-- 
2.17.1


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

* Re: [dpdk-stable] [PATCH v5 1/6] net/ark: update pkt director initial state
  2021-03-18 17:36 ` [dpdk-stable] [PATCH v5 1/6] net/ark: update pkt director initial state Ed Czeck
  2021-03-18 17:36   ` [dpdk-stable] [PATCH v5 2/6] net/ark: refactor Rx buffer recovery Ed Czeck
@ 2021-03-22 15:59   ` Ferruh Yigit
  1 sibling, 0 replies; 12+ messages in thread
From: Ferruh Yigit @ 2021-03-22 15:59 UTC (permalink / raw)
  To: Ed Czeck, dev, bruce.richardson; +Cc: shepard.siegel, john.miller, stable

On 3/18/2021 5:36 PM, Ed Czeck wrote:
> Fixes: b33ccdb17f55 ("net/ark: provide API for hardware modules MPU RQP and pktdir")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>

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


Release note updates distributed into relevant patches while merging.

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

* [dpdk-stable] [PATCH v1 1/5] net/ark: update pkt director initial state
@ 2021-03-04 16:54 Ed Czeck
  0 siblings, 0 replies; 12+ messages in thread
From: Ed Czeck @ 2021-03-04 16:54 UTC (permalink / raw)
  To: czeck; +Cc: stable

Fixes: b33ccdb17f55 ("net/ark: provide API for hardware modules MPU RQP and pktdir")
Cc: stable@dpdk.org

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
---
 drivers/net/ark/ark_ethdev.c | 1 +
 drivers/net/ark/ark_pktdir.c | 2 +-
 drivers/net/ark/ark_pktdir.h | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index ef650a465..477e1de02 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -321,6 +321,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 	ark->rqpacing =
 		(struct ark_rqpace_t *)(ark->bar0 + ARK_RCPACING_BASE);
 	ark->started = 0;
+	ark->pkt_dir_v = ARK_PKT_DIR_INIT_VAL;
 
 	ARK_PMD_LOG(INFO, "Sys Ctrl Const = 0x%x  HW Commit_ID: %08x\n",
 		      ark->sysctrl.t32[4],
diff --git a/drivers/net/ark/ark_pktdir.c b/drivers/net/ark/ark_pktdir.c
index 25e121831..dbfd2924b 100644
--- a/drivers/net/ark/ark_pktdir.c
+++ b/drivers/net/ark/ark_pktdir.c
@@ -22,7 +22,7 @@ ark_pktdir_init(void *base)
 		return inst;
 	}
 	inst->regs = (struct ark_pkt_dir_regs *)base;
-	inst->regs->ctrl = 0x00110110;	/* POR state */
+	inst->regs->ctrl = ARK_PKT_DIR_INIT_VAL; /* POR state */
 	return inst;
 }
 
diff --git a/drivers/net/ark/ark_pktdir.h b/drivers/net/ark/ark_pktdir.h
index 4afd128f9..b5577cebb 100644
--- a/drivers/net/ark/ark_pktdir.h
+++ b/drivers/net/ark/ark_pktdir.h
@@ -7,7 +7,7 @@
 
 #include <stdint.h>
 
-#define ARK_PKTDIR_BASE_ADR  0xa0000
+#define ARK_PKT_DIR_INIT_VAL 0x0110
 
 typedef void *ark_pkt_dir_t;
 
-- 
2.17.1


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

end of thread, other threads:[~2021-03-22 16:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-04 16:56 [dpdk-stable] [PATCH v1 1/5] net/ark: update pkt director initial state Ed Czeck
2021-03-04 16:56 ` [dpdk-stable] [PATCH v1 2/5] net/ark: refactor Rx buffer recovery Ed Czeck
2021-03-04 20:33 ` [dpdk-stable] [PATCH v2 1/5] net/ark: update pkt director initial state Ed Czeck
2021-03-04 20:33   ` [dpdk-stable] [PATCH v2 2/5] net/ark: refactor Rx buffer recovery Ed Czeck
2021-03-08 22:29 ` [dpdk-stable] [PATCH v3 1/6] net/ark: update pkt director initial state Ed Czeck
2021-03-08 22:29   ` [dpdk-stable] [PATCH v3 2/6] net/ark: refactor Rx buffer recovery Ed Czeck
2021-03-09 16:08 ` [dpdk-stable] [PATCH v4 1/6] net/ark: update pkt director initial state Ed Czeck
2021-03-09 16:08   ` [dpdk-stable] [PATCH v4 2/6] net/ark: refactor Rx buffer recovery Ed Czeck
2021-03-18 17:36 ` [dpdk-stable] [PATCH v5 1/6] net/ark: update pkt director initial state Ed Czeck
2021-03-18 17:36   ` [dpdk-stable] [PATCH v5 2/6] net/ark: refactor Rx buffer recovery Ed Czeck
2021-03-22 15:59   ` [dpdk-stable] [PATCH v5 1/6] net/ark: update pkt director initial state Ferruh Yigit
  -- strict thread matches above, loose matches on Subject: below --
2021-03-04 16:54 [dpdk-stable] [PATCH v1 1/5] " Ed Czeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).