* [PATCH 0/2] fix AF_PACKET PMD rollover fanout mode
@ 2026-10-23 16:22 Frank Dressler
2026-10-23 16:22 ` [PATCH 1/2] net/af_packet: do not set rollover flag in rollover mode Frank Dressler
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Frank Dressler @ 2026-10-23 16:22 UTC (permalink / raw)
To: stephen; +Cc: dev
This series fixes a bug in the AF_PACKET PMD that prevented it from
running in rollover fanout mode.
History: 364e08f2bb introduced the AF_PACKET PMD in 2014 and
unconditionally set the rollover flag. In 2025, d3bc77ab05 added
code allowing the user to select the fanout mode, including rollover
mode. Both the flag and the mode were introduced in Linux in 2013
with 77f65ebdca but their combination has been rejected ever since.
Because of that, rollover mode has never worked in the PMD.
The first patch clears the rollover _flag_ when the rollover _mode_
is set.
The second patch adds a test that checks that each fanout mode the
PMD supports is accepted by the kernel.
Frank Dressler (2):
net/af_packet: do not set rollover flag in rollover mode
test/af_packet: add test for fanout modes
app/test/test_pmd_af_packet.c | 41 +++++++++++++++++++++++
drivers/net/af_packet/rte_eth_af_packet.c | 2 ++
2 files changed, 43 insertions(+)
--
2.56.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/2] net/af_packet: do not set rollover flag in rollover mode 2026-10-23 16:22 [PATCH 0/2] fix AF_PACKET PMD rollover fanout mode Frank Dressler @ 2026-10-23 16:22 ` Frank Dressler 2026-10-23 16:22 ` [PATCH 2/2] test/af_packet: add test for fanout modes Frank Dressler 2026-10-23 17:11 ` [PATCH 0/2] fix AF_PACKET PMD rollover fanout mode Stephen Hemminger 2 siblings, 0 replies; 4+ messages in thread From: Frank Dressler @ 2026-10-23 16:22 UTC (permalink / raw) To: stephen; +Cc: dev, tudor.cornea, stable The kernel rejects fanout configurations in which both the rollover mode and the rollover flag are set. Because the PMD always set the flag, the mode never worked. Fixes: d3bc77ab05a4 ("net/af_packet: allow changing fanout mode") Cc: tudor.cornea@gmail.com Cc: stable@dpdk.org Signed-off-by: Frank Dressler <frank@dressler.pro> --- drivers/net/af_packet/rte_eth_af_packet.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index ef57719803..870536a8b2 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -844,6 +844,8 @@ get_fanout_mode(const char *fanout_mode) } else if (!strcmp(fanout_mode, "cpu")) { load_balance |= PACKET_FANOUT_CPU; } else if (!strcmp(fanout_mode, "rollover")) { + /* setting both is rejected by kernel */ + load_balance &= ~PACKET_FANOUT_FLAG_ROLLOVER; load_balance |= PACKET_FANOUT_ROLLOVER; } else if (!strcmp(fanout_mode, "rnd")) { load_balance |= PACKET_FANOUT_RND; -- 2.56.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] test/af_packet: add test for fanout modes 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 2026-10-23 17:11 ` [PATCH 0/2] fix AF_PACKET PMD rollover fanout mode Stephen Hemminger 2 siblings, 0 replies; 4+ messages in thread From: Frank Dressler @ 2026-10-23 16:22 UTC (permalink / raw) To: stephen; +Cc: dev 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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] fix AF_PACKET PMD rollover fanout mode 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 ` [PATCH 2/2] test/af_packet: add test for fanout modes Frank Dressler @ 2026-10-23 17:11 ` Stephen Hemminger 2 siblings, 0 replies; 4+ messages in thread From: Stephen Hemminger @ 2026-10-23 17:11 UTC (permalink / raw) To: Frank Dressler; +Cc: dev On Fri, 23 Oct 2026 17:22:45 +0100 Frank Dressler <frank@dressler.pro> wrote: > This series fixes a bug in the AF_PACKET PMD that prevented it from > running in rollover fanout mode. > > History: 364e08f2bb introduced the AF_PACKET PMD in 2014 and > unconditionally set the rollover flag. In 2025, d3bc77ab05 added > code allowing the user to select the fanout mode, including rollover > mode. Both the flag and the mode were introduced in Linux in 2013 > with 77f65ebdca but their combination has been rejected ever since. > Because of that, rollover mode has never worked in the PMD. > > The first patch clears the rollover _flag_ when the rollover _mode_ > is set. > > The second patch adds a test that checks that each fanout mode the > PMD supports is accepted by the kernel. > > Frank Dressler (2): > net/af_packet: do not set rollover flag in rollover mode > test/af_packet: add test for fanout modes LGTM - applied to next-net ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-23 17:11 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` [PATCH 2/2] test/af_packet: add test for fanout modes Frank Dressler 2026-10-23 17:11 ` [PATCH 0/2] fix AF_PACKET PMD rollover fanout mode Stephen Hemminger
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox