From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
stable@dpdk.org, Akhil Goyal <gakhil@marvell.com>,
Anoob Joseph <anoobj@marvell.com>,
Nithin Dabilpuram <ndabilpuram@marvell.com>
Subject: [PATCH 2/3] test/security_inline_proto: fix MTU calculation underflow
Date: Mon, 22 Jun 2026 12:18:33 +0100 [thread overview]
Message-ID: <20260622111835.233554-3-bruce.richardson@intel.com> (raw)
In-Reply-To: <20260622111835.233554-1-bruce.richardson@intel.com>
When testing with some NICs it was observed that the max MTU calculation
could underflow. Despite the RTE_MIN, due to integer promotion, this
lead to the configuring of the port with an excessively large, invalid
value. For example, if lim_nb_seg_max == 0, that meant that
max_data_room - 256 is -256 for comparison purposes using standard
integers (promoted from uint16_t). That is lower than the max mtu so the
-256 value is chosen, which becomes >65000 when converted back to
uint16_t.
Fix this by a) checking for seg_max == 0 b) doing calculations using
uint32_t and c) checking explicitly for underflow before subtracting.
Fixes: 3edd1197a605 ("test/security: add multi-segment inline IPsec cases")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
app/test/test_security_inline_proto.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/app/test/test_security_inline_proto.c b/app/test/test_security_inline_proto.c
index bc3ef54f71..81fce7364c 100644
--- a/app/test/test_security_inline_proto.c
+++ b/app/test/test_security_inline_proto.c
@@ -2045,8 +2045,19 @@ inline_ipsec_testsuite_setup(void)
memcpy(&local_port_conf, &port_conf, sizeof(port_conf));
/* Add Multi seg flags */
if (sg_mode) {
- uint16_t max_data_room = RTE_MBUF_DEFAULT_DATAROOM *
- dev_info.rx_desc_lim.nb_seg_max;
+ uint32_t max_data_room;
+
+ if (dev_info.rx_desc_lim.nb_seg_max == 0) {
+ printf("SG mode unsupported: invalid max Rx segments (0)\n");
+ return TEST_SKIPPED;
+ }
+
+ max_data_room = RTE_MBUF_DEFAULT_DATAROOM * dev_info.rx_desc_lim.nb_seg_max;
+ if (max_data_room <= 256) {
+ printf("SG mode unsupported: max data room (%u) too small\n",
+ max_data_room);
+ return TEST_SKIPPED;
+ }
local_port_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_SCATTER;
local_port_conf.txmode.offloads |= RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
--
2.53.0
next prev parent reply other threads:[~2026-06-22 11:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 11:18 [PATCH 0/3] Fixes for inline ipsec test cases Bruce Richardson
2026-06-22 11:18 ` [PATCH 1/3] test/security_inline_proto: remove fast-free Tx flag Bruce Richardson
2026-06-22 11:18 ` Bruce Richardson [this message]
2026-06-22 11:18 ` [PATCH 3/3] test/security_inline_proto: check for capabilities Bruce Richardson
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=20260622111835.233554-3-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=ndabilpuram@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