* [dpdk-stable] [PATCH 20.11] net/bnxt: fix fallback mbuf allocation logic
@ 2021-02-08 15:14 Lance Richardson
2021-02-08 16:00 ` Luca Boccassi
0 siblings, 1 reply; 2+ messages in thread
From: Lance Richardson @ 2021-02-08 15:14 UTC (permalink / raw)
To: Ajit Khaparde, Somnath Kotur, Venkat Duvvuru; +Cc: stable
[-- Attachment #1: Type: text/plain, Size: 3135 bytes --]
Fixes for fallback mbuf allocation logic.
- Iterate over all processed descriptors (representor and
non-representor) when checking allocation status.
- Invoke fallback allocation logic when an allocation
failure has occurred for any received packet, not
just the last.
Based on upstream commit c86e930165c3 ("net/bnxt: fix fallback
mbuf allocation logic"), with changes to resolve conflicts caused
by the absence of upstream commit c7de4195cc4c ("net/bnxt: modify
ring index logic")
Fixes: 6dc83230b43b ("net/bnxt: support port representor data path")
Fixes: d9dd0b29ed31 ("net/bnxt: fix Rx handling and buffer allocation logic")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
---
drivers/net/bnxt/bnxt_rxr.c | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index fdbe6f71ea..fed1e67739 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -827,6 +827,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
struct bnxt_rx_ring_info *rxr = rxq->rx_ring;
uint32_t raw_cons = cpr->cp_raw_cons;
+ bool alloc_failed = false;
uint32_t cons;
int nb_rx_pkts = 0;
int nb_rep_rx_pkts = 0;
@@ -875,12 +876,16 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
/* TODO: Avoid magic numbers... */
if ((CMP_TYPE(rxcmp) & 0x30) == 0x10) {
rc = bnxt_rx_pkt(&rx_pkts[nb_rx_pkts], rxq, &raw_cons);
- if (likely(!rc) || rc == -ENOMEM)
+ if (!rc)
nb_rx_pkts++;
- if (rc == -EBUSY) /* partial completion */
+ else if (rc == -EBUSY) /* partial completion */
break;
- if (rc == -ENODEV) /* completion for representor */
+ else if (rc == -ENODEV) /* completion for representor */
nb_rep_rx_pkts++;
+ else if (rc == -ENOMEM) {
+ nb_rx_pkts++;
+ alloc_failed = true;
+ }
} else if (!BNXT_NUM_ASYNC_CPR(rxq->bp)) {
evt =
bnxt_event_hwrm_resp_handler(rxq->bp,
@@ -917,21 +922,22 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
bnxt_db_cq(cpr);
/* Attempt to alloc Rx buf in case of a previous allocation failure. */
- if (rc == -ENOMEM) {
- int i = RING_NEXT(rxr->rx_ring_struct, prod);
- int cnt = nb_rx_pkts;
+ if (alloc_failed) {
+ uint16_t cnt;
+
+ for (cnt = 0; cnt < nb_rx_pkts + nb_rep_rx_pkts; cnt++) {
+ struct rte_mbuf **rx_buf;
- for (; cnt;
- i = RING_NEXT(rxr->rx_ring_struct, i), cnt--) {
- struct rte_mbuf **rx_buf = &rxr->rx_buf_ring[i];
+ prod = RING_NEXT(rxr->rx_ring_struct, prod);
+ rx_buf = &rxr->rx_buf_ring[prod];
/* Buffer already allocated for this index. */
if (*rx_buf != NULL && *rx_buf != &rxq->fake_mbuf)
continue;
/* This slot is empty. Alloc buffer for Rx */
- if (!bnxt_alloc_rx_data(rxq, rxr, i)) {
- rxr->rx_prod = i;
+ if (!bnxt_alloc_rx_data(rxq, rxr, prod)) {
+ rxr->rx_prod = prod;
bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
} else {
PMD_DRV_LOG(ERR, "Alloc mbuf failed\n");
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-stable] [PATCH 20.11] net/bnxt: fix fallback mbuf allocation logic
2021-02-08 15:14 [dpdk-stable] [PATCH 20.11] net/bnxt: fix fallback mbuf allocation logic Lance Richardson
@ 2021-02-08 16:00 ` Luca Boccassi
0 siblings, 0 replies; 2+ messages in thread
From: Luca Boccassi @ 2021-02-08 16:00 UTC (permalink / raw)
To: Lance Richardson, Ajit Khaparde, Somnath Kotur, Venkat Duvvuru; +Cc: stable
On Mon, 2021-02-08 at 10:14 -0500, Lance Richardson wrote:
> Error verifying signature: parse error
> Fixes for fallback mbuf allocation logic.
> - Iterate over all processed descriptors (representor and
> non-representor) when checking allocation status.
> - Invoke fallback allocation logic when an allocation
> failure has occurred for any received packet, not
> just the last.
>
> Based on upstream commit c86e930165c3 ("net/bnxt: fix fallback
> mbuf allocation logic"), with changes to resolve conflicts caused
> by the absence of upstream commit c7de4195cc4c ("net/bnxt: modify
> ring index logic")
>
> Fixes: 6dc83230b43b ("net/bnxt: support port representor data path")
> Fixes: d9dd0b29ed31 ("net/bnxt: fix Rx handling and buffer allocation logic")
> Cc: stable@dpdk.org
>
> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
> ---
> drivers/net/bnxt/bnxt_rxr.c | 28 +++++++++++++++++-----------
> 1 file changed, 17 insertions(+), 11 deletions(-)
Acked-by: Luca Boccassi <luca.boccassi@microsoft.com>
Thanks, applied.
--
Kind regards,
Luca Boccassi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-08 16:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 15:14 [dpdk-stable] [PATCH 20.11] net/bnxt: fix fallback mbuf allocation logic Lance Richardson
2021-02-08 16:00 ` Luca Boccassi
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).