From: Ed Czeck <ed.czeck@atomicrules.com>
To: dev@dpdk.org, ferruh.yigit@intel.com
Cc: shepard.siegel@atomicrules.com, john.miller@atomicrules.com,
stable@dpdk.org
Subject: [dpdk-dev] [PATCH v1 2/5] net/ark: refactor Rx buffer recovery
Date: Thu, 4 Mar 2021 11:56:34 -0500 [thread overview]
Message-ID: <20210304165637.24658-2-ed.czeck@atomicrules.com> (raw)
In-Reply-To: <20210304165637.24658-1-ed.czeck@atomicrules.com>
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
next prev parent reply other threads:[~2021-03-04 16:56 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-04 16:56 [dpdk-dev] [PATCH v1 1/5] net/ark: update pkt director initial state Ed Czeck
2021-03-04 16:56 ` Ed Czeck [this message]
2021-03-04 16:56 ` [dpdk-dev] [PATCH v1 3/5] net/ark: update internal structs to reflect FPGA updates Ed Czeck
2021-03-04 16:56 ` [dpdk-dev] [PATCH v1 4/5] net/ark: generalize meta data between FPGA and PMD Ed Czeck
2021-03-04 16:56 ` [dpdk-dev] [PATCH v1 5/5] net/ark: localize internal packet generator code Ed Czeck
2021-03-04 20:33 ` [dpdk-dev] [PATCH v2 1/5] net/ark: update pkt director initial state Ed Czeck
2021-03-04 20:33 ` [dpdk-dev] [PATCH v2 2/5] net/ark: refactor Rx buffer recovery Ed Czeck
2021-03-04 20:33 ` [dpdk-dev] [PATCH v2 3/5] net/ark: update internal structs to reflect FPGA updates Ed Czeck
2021-03-05 15:38 ` Ferruh Yigit
2021-03-04 20:33 ` [dpdk-dev] [PATCH v2 4/5] net/ark: generalize meta data between FPGA and PMD Ed Czeck
2021-03-05 15:31 ` Ferruh Yigit
2021-03-04 20:33 ` [dpdk-dev] [PATCH v2 5/5] net/ark: localize internal packet generator code Ed Czeck
2021-03-08 22:29 ` [dpdk-dev] [PATCH v3 1/6] net/ark: update pkt director initial state Ed Czeck
2021-03-08 22:29 ` [dpdk-dev] [PATCH v3 2/6] net/ark: refactor Rx buffer recovery Ed Czeck
2021-03-08 22:29 ` [dpdk-dev] [PATCH v3 3/6] net/ark: update internal structs to reflect FPGA updates Ed Czeck
2021-03-09 11:32 ` Ferruh Yigit
2021-03-08 22:29 ` [dpdk-dev] [PATCH v3 4/6] net/ark: generalize meta data between FPGA and PMD Ed Czeck
2021-03-08 22:29 ` [dpdk-dev] [PATCH v3 5/6] net/ark: cleanup and document ark dynamic extansion Ed Czeck
2021-03-09 11:43 ` Ferruh Yigit
2021-03-08 22:29 ` [dpdk-dev] [PATCH v3 6/6] net/ark: localize internal packet generator code Ed Czeck
2021-03-09 16:08 ` [dpdk-dev] [PATCH v4 1/6] net/ark: update pkt director initial state Ed Czeck
2021-03-09 16:08 ` [dpdk-dev] [PATCH v4 2/6] net/ark: refactor Rx buffer recovery Ed Czeck
2021-03-09 16:08 ` [dpdk-dev] [PATCH v4 3/6] net/ark: update internal structs to reflect FPGA updates Ed Czeck
2021-03-09 16:08 ` [dpdk-dev] [PATCH v4 4/6] net/ark: cleanup ark dynamic extension interface Ed Czeck
2021-03-09 17:50 ` Ferruh Yigit
2021-03-10 15:11 ` Ed Czeck
2021-03-10 16:29 ` Ferruh Yigit
2021-03-09 16:08 ` [dpdk-dev] [PATCH v4 5/6] net/ark: generalize meta data between FPGA and PMD Ed Czeck
2021-03-09 17:36 ` Ferruh Yigit
2021-03-10 15:02 ` Ed Czeck
2021-03-10 16:44 ` Ferruh Yigit
2021-03-10 21:53 ` Ed Czeck
2021-03-10 22:46 ` Ferruh Yigit
2021-03-11 13:15 ` Ed Czeck
2021-03-09 16:08 ` [dpdk-dev] [PATCH v4 6/6] net/ark: localize internal packet generator code Ed Czeck
2021-03-18 17:36 ` [dpdk-dev] [PATCH v5 1/6] net/ark: update pkt director initial state Ed Czeck
2021-03-18 17:36 ` [dpdk-dev] [PATCH v5 2/6] net/ark: refactor Rx buffer recovery Ed Czeck
2021-03-18 17:36 ` [dpdk-dev] [PATCH v5 3/6] net/ark: update internal structs to reflect FPGA updates Ed Czeck
2021-03-18 17:36 ` [dpdk-dev] [PATCH v5 4/6] net/ark: cleanup ark dynamic extension interface Ed Czeck
2021-03-18 17:36 ` [dpdk-dev] [PATCH v5 5/6] net/ark: generalize meta data between FPGA and PMD Ed Czeck
2021-03-18 17:37 ` [dpdk-dev] [PATCH v5 6/6] net/ark: localize internal packet generator code Ed Czeck
2021-03-22 15:59 ` [dpdk-dev] [PATCH v5 1/6] net/ark: update pkt director initial state Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210304165637.24658-2-ed.czeck@atomicrules.com \
--to=ed.czeck@atomicrules.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=john.miller@atomicrules.com \
--cc=shepard.siegel@atomicrules.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).