From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Tetsuya Mukawa <mtetsuyah@gmail.com>
Subject: [PATCH v2 2/2] net/null: revise info_get
Date: Tue, 6 Jan 2026 08:47:15 -0800 [thread overview]
Message-ID: <20260106164815.158430-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20260106164815.158430-1-stephen@networkplumber.org>
The dev_info_get callback does not need to check for invalid arguments
since that is already done at ethdev layer.
Make the min/max MTU values reflect the most an Ethernet type
PMD would allow.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test/test_pmd_null.c | 13 +++++++++++--
drivers/net/null/rte_eth_null.c | 11 ++++-------
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/app/test/test_pmd_null.c b/app/test/test_pmd_null.c
index c6a8bba701..ee62d7ecb5 100644
--- a/app/test/test_pmd_null.c
+++ b/app/test/test_pmd_null.c
@@ -430,6 +430,10 @@ static int
test_null_dev_info(void)
{
struct rte_eth_dev_info dev_info;
+ const uint16_t jumbo_mtu = RTE_ETHER_MAX_JUMBO_FRAME_LEN
+ - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN;
+ const uint16_t min_mtu = RTE_ETHER_MIN_LEN - RTE_ETHER_HDR_LEN -
+ RTE_ETHER_CRC_LEN;
int ret;
ret = rte_eth_dev_info_get(port_id, &dev_info);
@@ -438,8 +442,13 @@ test_null_dev_info(void)
/* Verify expected device info values */
TEST_ASSERT(dev_info.max_mac_addrs == 1,
"Expected max_mac_addrs=1, got %u", dev_info.max_mac_addrs);
- TEST_ASSERT(dev_info.max_rx_pktlen == UINT32_MAX,
- "Unexpected max_rx_pktlen");
+
+ TEST_ASSERT(dev_info.max_mtu == jumbo_mtu,
+ "Unexpected max_mtu: %u", dev_info.max_mtu);
+ TEST_ASSERT(dev_info.min_mtu == min_mtu,
+ "Unexpected min_mtu: %u", dev_info.max_mtu);
+ TEST_ASSERT(dev_info.max_rx_pktlen == RTE_ETHER_MAX_JUMBO_FRAME_LEN,
+ "Unexpected max_rx_pktlen: %u", dev_info.max_rx_pktlen);
TEST_ASSERT(dev_info.min_rx_bufsize == 0,
"Expected min_rx_bufsize=0, got %u", dev_info.min_rx_bufsize);
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 46e7e7bd8c..2928f0d2d5 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -298,19 +298,16 @@ static int
eth_dev_info(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
- struct pmd_internals *internals;
-
- if ((dev == NULL) || (dev_info == NULL))
- return -EINVAL;
+ struct pmd_internals *internals = dev->data->dev_private;
- internals = dev->data->dev_private;
dev_info->max_mac_addrs = 1;
- dev_info->max_rx_pktlen = (uint32_t)-1;
dev_info->max_rx_queues = RTE_DIM(internals->rx_null_queues);
dev_info->max_tx_queues = RTE_DIM(internals->tx_null_queues);
- dev_info->min_rx_bufsize = 0;
dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS | RTE_ETH_TX_OFFLOAD_MT_LOCKFREE;
+ dev_info->max_rx_pktlen = RTE_ETHER_MAX_JUMBO_FRAME_LEN;
+ dev_info->max_mtu = RTE_ETHER_MAX_JUMBO_FRAME_LEN
+ - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN;
dev_info->reta_size = internals->reta_size;
dev_info->flow_type_rss_offloads = internals->flow_type_rss_offloads;
dev_info->hash_key_size = sizeof(internals->rss_key);
--
2.51.0
prev parent reply other threads:[~2026-01-06 16:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-04 22:25 [PATCH] test: add a test for null PMD Stephen Hemminger
2026-01-05 14:49 ` Marat Khalili
2026-01-05 17:38 ` Stephen Hemminger
2026-01-06 16:47 ` [PATCH v2 0/2] net/null: add a test Stephen Hemminger
2026-01-06 16:47 ` [PATCH v2 1/2] test: add a test for null PMD Stephen Hemminger
2026-01-06 17:40 ` Marat Khalili
2026-01-06 18:01 ` Stephen Hemminger
2026-01-06 16:47 ` Stephen Hemminger [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=20260106164815.158430-3-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=mtetsuyah@gmail.com \
/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).