From: Frank Dressler <frank@dressler.pro>
To: stephen@networkplumber.org
Cc: dev@dpdk.org
Subject: [PATCH 2/2] test/af_packet: add test for fanout modes
Date: Fri, 23 Oct 2026 17:22:47 +0100 [thread overview]
Message-ID: <20261023162247.276245-3-frank@dressler.pro> (raw)
In-Reply-To: <20261023162247.276245-1-frank@dressler.pro>
The added test checks if the kernel accepts each of the fanout
modes the AF_PACKET PMD supports.
Signed-off-by: Frank Dressler <frank@dressler.pro>
---
app/test/test_pmd_af_packet.c | 41 +++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/app/test/test_pmd_af_packet.c b/app/test/test_pmd_af_packet.c
index b668ca5b81..478a0a6355 100644
--- a/app/test/test_pmd_af_packet.c
+++ b/app/test/test_pmd_af_packet.c
@@ -992,6 +992,46 @@ test_af_packet_multi_queue(void)
return TEST_SUCCESS;
}
+/*
+ * Test: Fanout modes
+ */
+static int
+test_af_packet_fanout_modes(void)
+{
+ static const char * const modes[] = {
+ "hash", "lb", "cpu", "rollover", "rnd", "qm",
+ };
+ uint16_t test_port;
+ char devargs[256];
+ unsigned int i;
+ int ret;
+
+ if (!tap_created) {
+ printf("SKIPPED: TAP interface not available (need root)\n");
+ return TEST_SKIPPED;
+ }
+
+ for (i = 0; i < RTE_DIM(modes); i++) {
+ snprintf(devargs, sizeof(devargs), "iface=%s,qpairs=2,fanout_mode=%s",
+ TAP_DEV_NAME, modes[i]);
+
+ ret = rte_vdev_init("net_af_packet_fanout", devargs);
+ TEST_ASSERT(ret == 0,
+ "Failed to create af_packet sockets with fanout_mode=%s: %d",
+ modes[i], ret);
+
+ ret = rte_eth_dev_get_port_by_name("net_af_packet_fanout", &test_port);
+ if (ret == 0)
+ rte_eth_dev_close(test_port);
+ rte_vdev_uninit("net_af_packet_fanout");
+ TEST_ASSERT(ret == 0,
+ "af_packet port with fanout_mode=%s has no port id: %d",
+ modes[i], ret);
+ }
+
+ return TEST_SUCCESS;
+}
+
/*
* Multi-threaded test context
*/
@@ -1108,6 +1148,7 @@ static struct unit_test_suite af_packet_test_suite = {
TEST_CASE(test_af_packet_frame_config),
TEST_CASE(test_af_packet_qdisc_bypass),
TEST_CASE(test_af_packet_multi_queue),
+ TEST_CASE(test_af_packet_fanout_modes),
TEST_CASES_END() /**< NULL terminate unit test array */
}
--
2.56.0
next prev parent reply other threads:[~2026-10-23 16:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 16:22 [PATCH 0/2] fix AF_PACKET PMD rollover fanout mode Frank Dressler
2026-10-23 16:22 ` [PATCH 1/2] net/af_packet: do not set rollover flag in rollover mode Frank Dressler
2026-10-23 16:22 ` Frank Dressler [this message]
2026-10-23 17:11 ` [PATCH 0/2] fix AF_PACKET PMD rollover fanout mode 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=20261023162247.276245-3-frank@dressler.pro \
--to=frank@dressler.pro \
--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