From: Dengdui Huang <huangdengdui@huawei.com>
To: <dev@dpdk.org>
Cc: <lihuisong@huawei.com>, <fengchengwen@huawei.com>,
<stephen@networkplumber.org>
Subject: [PATCH v5 1/2] net/hns3: fix cannot look the CRC data
Date: Fri, 16 May 2025 15:15:18 +0800 [thread overview]
Message-ID: <20250516071519.3190805-2-huangdengdui@huawei.com> (raw)
In-Reply-To: <20250516071519.3190805-1-huangdengdui@huawei.com>
When the packet is received into a multisegment mbuf and
the last segment contains only CRC data, the driver should
not release this segment. Otherwise, the application cannot
look the CRC data. This patch fixes it.
Fixes: 8973d7c4ca12 ("net/hns3: support keeping CRC")
Cc: stable@dpdk.org
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
---
drivers/net/hns3/hns3_rxtx.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index bb7ffee12c..49b6f16ccd 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2386,18 +2386,16 @@ hns3_rxd_to_vlan_tci(struct hns3_rx_queue *rxq, struct rte_mbuf *mb,
}
static inline void
-recalculate_data_len(struct rte_mbuf *first_seg, struct rte_mbuf *last_seg,
- struct rte_mbuf *rxm, struct hns3_rx_queue *rxq,
- uint16_t data_len)
+recalculate_data_len(struct rte_mbuf *last_seg, struct rte_mbuf *rxm,
+ struct hns3_rx_queue *rxq)
{
+ uint16_t data_len = rxm->data_len;
uint8_t crc_len = rxq->crc_len;
if (data_len <= crc_len) {
- rte_pktmbuf_free_seg(rxm);
- first_seg->nb_segs--;
+ rxm->data_len = 0;
last_seg->data_len = (uint16_t)(last_seg->data_len -
(crc_len - data_len));
- last_seg->next = NULL;
} else
rxm->data_len = (uint16_t)(data_len - crc_len);
}
@@ -2728,8 +2726,7 @@ hns3_recv_scattered_pkts(void *rx_queue,
rxm->next = NULL;
if (unlikely(rxq->crc_len > 0)) {
first_seg->pkt_len -= rxq->crc_len;
- recalculate_data_len(first_seg, last_seg, rxm, rxq,
- rxm->data_len);
+ recalculate_data_len(last_seg, rxm, rxq);
}
first_seg->port = rxq->port_id;
--
2.33.0
next prev parent reply other threads:[~2025-05-16 7:15 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-06 1:10 [PATCH] net/hns3: fix Rx packet truncation when KEEP CRC enabled Jie Hai
2024-02-07 14:15 ` Ferruh Yigit
2024-02-20 3:58 ` Jie Hai
2024-02-23 13:53 ` Ferruh Yigit
2024-02-26 3:16 ` Jie Hai
2024-02-26 16:43 ` Ferruh Yigit
2024-02-28 2:27 ` huangdengdui
2024-02-28 13:07 ` Ferruh Yigit
2024-02-29 3:58 ` huangdengdui
2024-02-29 9:25 ` Ferruh Yigit
2024-03-01 6:55 ` huangdengdui
2024-03-01 11:10 ` Ferruh Yigit
2024-03-08 11:36 ` Jie Hai
2024-03-22 6:28 ` Jie Hai
2024-06-03 1:38 ` Jie Hai
2024-06-03 2:33 ` Stephen Hemminger
2024-06-03 5:24 ` Morten Brørup
2024-06-03 7:07 ` Andrew Rybchenko
2024-07-18 11:48 ` [PATCH v2 0/3] bugfix about KEEP CRC offload Jie Hai
2024-07-18 11:48 ` [PATCH v2 1/3] ethdev: add description for " Jie Hai
2024-07-18 11:57 ` Morten Brørup
2024-07-18 11:48 ` [PATCH v2 2/3] net/hns3: fix packet length do not contain CRC data length Jie Hai
2024-07-18 11:48 ` [PATCH v2 3/3] net/hns3: fix Rx packet without CRC data Jie Hai
2024-11-26 23:17 ` [RFC] net/hns3: clarify handling of crc reinsert Stephen Hemminger
2024-07-18 12:35 ` [PATCH v2 0/3] bugfix about KEEP CRC offload lihuisong (C)
2024-11-26 23:12 ` Stephen Hemminger
2024-07-19 9:04 ` [PATCH v3 " Jie Hai
2024-07-19 9:04 ` [PATCH v3 1/3] ethdev: add description for " Jie Hai
2024-09-05 6:33 ` Andrew Rybchenko
2024-11-22 17:10 ` Stephen Hemminger
2024-11-26 7:47 ` Jie Hai
2024-11-26 23:51 ` Stephen Hemminger
2024-11-22 17:35 ` Stephen Hemminger
2024-07-19 9:04 ` [PATCH v3 2/3] net/hns3: fix packet length do not contain CRC data length Jie Hai
2024-07-19 9:04 ` [PATCH v3 3/3] net/hns3: fix Rx packet without CRC data Jie Hai
2024-11-24 19:42 ` Stephen Hemminger
2024-11-25 17:45 ` Stephen Hemminger
2024-11-26 2:40 ` huangdengdui
2024-11-26 3:16 ` Stephen Hemminger
2024-11-27 0:16 ` Stephen Hemminger
2024-11-27 2:32 ` Jie Hai
2024-11-27 3:21 ` Stephen Hemminger
2024-07-19 9:49 ` [PATCH v3 0/3] bugfix about KEEP CRC offload fengchengwen
2024-08-09 9:21 ` Jie Hai
2024-09-05 2:53 ` Jie Hai
2024-10-18 1:39 ` Jie Hai
2024-11-06 2:19 ` Jie Hai
2024-11-13 3:14 ` Jie Hai
2024-11-27 10:08 ` [PATCH v4] net/hns3: fix Rx packet without CRC data Jie Hai
2024-11-29 1:36 ` Jie Hai
2024-11-29 17:12 ` Stephen Hemminger
2024-11-30 2:26 ` huangdengdui
2024-12-02 19:35 ` Stephen Hemminger
2025-05-16 7:15 ` [PATCH v5 0/2] bugfix about KEEP CRC offload Dengdui Huang
2025-05-16 7:15 ` Dengdui Huang [this message]
2025-05-16 7:15 ` [PATCH v5 2/2] net/hns3: fix Rx packet without CRC data Dengdui Huang
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=20250516071519.3190805-2-huangdengdui@huawei.com \
--to=huangdengdui@huawei.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=lihuisong@huawei.com \
--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).