From: edwin.brossette@6wind.com
To: dev@dpdk.org
Cc: olivier.matz@6wind.com, didier.pallard@6wind.com,
lauren.hardy@6wind.com, dsinghrawat@marvell.com,
palok@marvell.com, Edwin Brossette <edwin.brossette@6wind.com>,
stable@dpdk.org
Subject: [PATCH 5/5] net/qede: fix rx_buf_size calculation
Date: Tue, 22 Apr 2025 17:51:43 +0200 [thread overview]
Message-ID: <20250422155143.3893525-5-edwin.brossette@6wind.com> (raw)
In-Reply-To: <20250422155143.3893525-1-edwin.brossette@6wind.com>
From: Edwin Brossette <edwin.brossette@6wind.com>
When the MTU configured is lower than maximum mbuf size (all packet data
can be stored in a single mbuf), then rx buffer size is configured with
MTU + some overhead. A flooring is applied to this value to align it,
meaning its actual value is going to be lower than expected.
This is a considerable design flaw, because a data packet fitting
exactly the MTU might not fit in the rx buffer. What is observed in this
case is that the nic splits the datagram in two segments, essentially
doing Rx scatter. However, the qede pmd does not expect gather scatter
in this case and does not use the required function: it uses
qede_recv_pkts_regular() which is not capable of handling this case.
Thus, we end up with malformed packet with m->nb_segs = 2 and
m->next = NULL. This means the last part of the data is missing.
CEIL max_rx_pktlen instead of FLOORing it. Also change the check on
max_rx_pktlen > bufsz in qede_rx_queue_setup(): if this ceiling would
make max_rx_pktlen exceed mbuf size, then force enable scatter-gather
mode.
Fixes: 318d7da3122b ("net/qede: fix Rx buffer size calculation")
CC: stable@dpdk.org
Signed-off-by: Edwin Brossette <edwin.brossette@6wind.com>
Acked-by: Didier Pallard <didier.pallard@6wind.com>
---
drivers/net/qede/qede_rxtx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index ea77f09e18be..2a6f1290ad4a 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -111,7 +111,7 @@ qede_calc_rx_buf_size(struct rte_eth_dev *dev, uint16_t mbufsz,
rx_buf_size = max_frame_size;
/* Align to cache-line size if needed */
- return QEDE_FLOOR_TO_CACHE_LINE_SIZE(rx_buf_size);
+ return QEDE_CEIL_TO_CACHE_LINE_SIZE(rx_buf_size);
}
static struct qede_rx_queue *
@@ -237,7 +237,7 @@ qede_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qid,
/* cache align the mbuf size to simplify rx_buf_size calculation */
bufsz = QEDE_FLOOR_TO_CACHE_LINE_SIZE(bufsz);
if ((rxmode->offloads & RTE_ETH_RX_OFFLOAD_SCATTER) ||
- max_rx_pktlen > bufsz) {
+ QEDE_CEIL_TO_CACHE_LINE_SIZE(max_rx_pktlen) > bufsz) {
if (!dev->data->scattered_rx) {
DP_INFO(edev, "Forcing scatter-gather mode\n");
dev->data->scattered_rx = 1;
--
2.35.0.4.g44a5d4affccf
prev parent reply other threads:[~2025-04-22 15:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-22 15:39 QEDE bug report Edwin Brossette
2025-04-22 15:51 ` [PATCH 1/5] qede: fix tunnel checksums offload flags edwin.brossette
2025-04-22 15:51 ` [PATCH 2/5] net/qede: fix bad sanity check on Rx queue release edwin.brossette
2025-04-23 15:30 ` Stephen Hemminger
2025-04-22 15:51 ` [PATCH 3/5] Revert "net/qede: fix maximum Rx packet length" edwin.brossette
2025-04-22 15:51 ` [PATCH 4/5] net/qede: fix QEDE_ETH_OVERHEAD being counted twice in rx_buf_size edwin.brossette
2025-04-22 15:51 ` edwin.brossette [this message]
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=20250422155143.3893525-5-edwin.brossette@6wind.com \
--to=edwin.brossette@6wind.com \
--cc=dev@dpdk.org \
--cc=didier.pallard@6wind.com \
--cc=dsinghrawat@marvell.com \
--cc=lauren.hardy@6wind.com \
--cc=olivier.matz@6wind.com \
--cc=palok@marvell.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).