From: Wencheng Li <liwencheng@phytium.com.cn>
To: stephen@networkplumber.org
Cc: dev@dpdk.org, liwencheng@phytium.com.cn
Subject: [PATCH v3 3/6] net/macb: fix logic error in macb_rxq_rearm function
Date: Tue, 10 Dec 2024 07:07:06 +0000 [thread overview]
Message-ID: <1733814426-412107-1-git-send-email-liwencheng@phytium.com.cn> (raw)
In-Reply-To: <1731310965-1743397-1-git-send-email-liwencheng@phytium.com.cn>
Fixed an issue in the macb_rxq_rearm function where descriptors
were incorrectly set when mbuf allocation failed, leading to abnormal
behavior of the network card.
Fixes: e02b0b31cbdc ("net/macb: add NEON vectorized Rx/Tx")
Cc: liwencheng@phytium.com.cn
Signed-off-by: Wencheng Li <liwencheng@phytium.com.cn>
---
drivers/net/macb/macb_rxtx_vec_neon.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/drivers/net/macb/macb_rxtx_vec_neon.c b/drivers/net/macb/macb_rxtx_vec_neon.c
index 7f02a57..3888d5d 100644
--- a/drivers/net/macb/macb_rxtx_vec_neon.c
+++ b/drivers/net/macb/macb_rxtx_vec_neon.c
@@ -70,8 +70,6 @@ static inline void macb_rxq_rearm(struct macb_rx_queue *rxq)
struct macb *bp;
register int i = 0;
struct macb_rx_entry *rxe;
-
- uint32x2_t zero = vdup_n_u32(0);
uint8x8_t rearm_data_vec;
bp = rxq->bp;
@@ -85,14 +83,7 @@ static inline void macb_rxq_rearm(struct macb_rx_queue *rxq)
/* Pull 'n' more MBUFs into the software ring */
if (unlikely(rte_mempool_get_bulk(rxq->mb_pool, (void *)rxe,
MACB_RXQ_REARM_THRESH) < 0)) {
- if (rxq->rxrearm_nb + (unsigned int)MACB_RXQ_REARM_THRESH >=
- rxq->nb_rx_desc) {
- MACB_LOG(ERR, "allocate mbuf fail!\n");
- for (i = 0; i < MACB_DESCS_PER_LOOP; i++) {
- rxe[i].mbuf = &rxq->fake_mbuf;
- vst1_u32((uint32_t *)&desc[MACB_DESC_ADDR_INTERVAL * i], zero);
- }
- }
+ MACB_LOG(ERR, "allocate mbuf fail!\n");
rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed +=
MACB_RXQ_REARM_THRESH;
return;
@@ -173,16 +164,16 @@ static uint16_t macb_recv_raw_pkts_vec(struct macb_rx_queue *rxq,
};
uint16x8_t crc_adjust = {0, 0, rxq->crc_len, 0, rxq->crc_len, 0, 0, 0};
- /* nb_pkts shall be less equal than MACB_MAX_RX_BURST */
- nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, MACB_DESCS_PER_LOOP);
- nb_pkts = RTE_MIN(nb_pkts, MACB_MAX_RX_BURST);
-
desc = rxq->rx_ring + rxq->rx_tail * MACB_DESC_ADDR_INTERVAL;
rte_prefetch_non_temporal(desc);
if (rxq->rxrearm_nb >= MACB_RXQ_REARM_THRESH)
macb_rxq_rearm(rxq);
+ nb_pkts = RTE_MIN(nb_pkts, rxq->nb_rx_desc - rxq->rxrearm_nb);
+ nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, MACB_DESCS_PER_LOOP);
+ nb_pkts = RTE_MIN(nb_pkts, MACB_MAX_RX_BURST);
+
/* Make hw descriptor updates visible to CPU */
rte_rmb();
--
2.7.4
next prev parent reply other threads:[~2024-12-10 7:07 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-01 10:07 [PATCH v1 1/2] net/macb: add new driver liwencheng
2024-11-01 10:07 ` [PATCH v1 2/2] /usertools/dpdk-devbind:add the binding and unbinding of platform device liwencheng
2024-11-05 8:43 ` [PATCH v2 3/3] usertools/dpdk-devbind: add platform device bind/unbind liwencheng
2024-11-06 3:34 ` [PATCH v2 3/3] usertools/dpdk-devbind: add bind/unbind for platform device liwencheng
2024-11-11 7:43 ` liwencheng
2024-12-03 8:15 ` [PATCH][v2, " Wencheng Li
2024-11-06 3:55 ` [PATCH v1 2/2] /usertools/dpdk-devbind:add the binding and unbinding of " Stephen Hemminger
2024-11-12 1:08 ` liwencheng
2024-11-01 16:13 ` [PATCH v1 1/2] net/macb: add new driver Stephen Hemminger
2024-11-01 17:42 ` Stephen Hemminger
2024-11-02 5:43 ` Stephen Hemminger
2024-11-05 8:41 ` [PATCH v2 1/3] " liwencheng
2024-11-05 8:41 ` [PATCH v2 2/3] net/macb: add NEON vectorized Rx/Tx liwencheng
2024-11-06 3:33 ` liwencheng
2024-11-11 7:42 ` liwencheng
2024-12-06 8:08 ` [PATCH v3 " Wencheng Li
2024-12-10 7:05 ` [PATCH v3 2/6] " Wencheng Li
2024-12-10 7:07 ` Wencheng Li [this message]
2024-11-06 3:32 ` [PATCH v2 1/3] net/macb: add new driver liwencheng
2024-11-11 7:42 ` liwencheng
2024-12-06 8:06 ` [PATCH v3 " Wencheng Li
2024-12-10 7:04 ` [PATCH v3 1/6] " Wencheng Li
2024-12-10 7:07 ` [PATCH v3 4/6] net/macb: zero ol_flags in each recv function Wencheng Li
2024-12-10 7:08 ` [PATCH v3 5/6] net/macb: fix tab errors in meson.build file Wencheng Li
2024-12-10 19:46 ` Stephen Hemminger
2024-12-02 20:31 ` [PATCH v2 1/3] net/macb: add new driver Stephen Hemminger
2024-11-22 17:55 ` Stephen Hemminger
2024-11-22 20:38 ` Stephen Hemminger
2024-11-22 20:44 ` Stephen Hemminger
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=1733814426-412107-1-git-send-email-liwencheng@phytium.com.cn \
--to=liwencheng@phytium.com.cn \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.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).