From: Stephen Hemminger <stephen@networkplumber.org>
To: Frank Dressler <frank@dressler.pro>
Cc: dev@dpdk.org
Subject: Re: [PATCH v7 0/4] net/af_packet: do not return outgoing packets from rte_eth_rx_burst
Date: Sat, 17 Oct 2026 14:18:26 -0700 [thread overview]
Message-ID: <20261017141826.0d364768@phoenix.local> (raw)
In-Reply-To: <20261016211942.217041-1-frank@dressler.pro>
On Fri, 16 Oct 2026 22:19:38 +0100
Frank Dressler <frank@dressler.pro> wrote:
> The third patch adds PACKET_IGNORE_OUTGOING which moves the
> filtering into the kernel. It is supported since Linux 4.20 but only
> works for single-queue AF_PACKET scenarios. Multi-queue AF_PACKET
> is still filtered in the PMD.
>
> The fourth patch adds PACKET_FANOUT_FLAG_IGNORE_OUTGOING which is
> supported since Linux 6.2 and moves the filtering into the kernel
> for the multi-queue scenarios. The kernel does not expose a direct
> way to check whether it supports PACKET_FANOUT_FLAG_IGNORE_OUTGOING
> but it also does not return an error when the sockopt is set on
> kernels that do not support it. Because of that the sockopt is set
> opportunistically. The PMD check is kept, since older kernels accept
> the flag without effect and support cannot be detected.
>
> Overall we get the following:
>
> | Single Queue | Multi-Queue
> ------------+--------------+-------------
> Kernel 5.4+ | in kernel | in PMD
> Kernel 6.2+ | in kernel | in kernel
>
> I tested this on both, kernel 7.2.8 and kernel 5.4.0 with both single
> and multiple queues. My results, strace'ing testpmd 7.2.8, with the
> variants of ignore_outgoing=0|1 and single/multi-queue:
>
> Kernel 5.4.0:
> qpairs=1,ignore_outgoing=0: -
> qpairs=1,ignore_outgoing=1: setsockopt(14, SOL_PACKET, 0x17 /* PACKET_??? */, [1], 4) = 0
> // 0x17 is PACKET_IGNORE_OUTGOING
>
> qpairs=2,ignore_outgoing=0: setsockopt(14, SOL_PACKET, PACKET_FANOUT, [-1878917532], 4) = 0
> // -1878917532 does NOT contain PACKET_FANOUT_FLAG_IGNORE_OUTGOING<<16
> qpairs=2,ignore_outgoing=1: setsockopt(14, SOL_PACKET, PACKET_FANOUT, [-805175699], 4) = 0
> // -805175699 does contain PACKET_FANOUT_FLAG_IGNORE_OUTGOING<<16
>
> Kernel 7.2.8:
> qpairs=1,ignore_outgoing=0: -
> qpairs=1,ignore_outgoing=1: setsockopt(13, SOL_PACKET, PACKET_IGNORE_OUTGOING, [1], 4) = 0
>
> qpairs=2,ignore_outgoing=0: setsockopt(13, SOL_PACKET, PACKET_FANOUT, [-1878978899], 4) = 0
> // -1878978899 does NOT contain PACKET_FANOUT_FLAG_IGNORE_OUTGOING<<16
> qpairs=2,ignore_outgoing=1: setsockopt(13, SOL_PACKET, PACKET_FANOUT, [-805236964], 4) = 0
> // -805236964 does contain PACKET_FANOUT_FLAG_IGNORE_OUTGOING<<16
>
> They show that the setsockopt succeeds even on the old kernel that
> does not support PACKET_FANOUT_FLAG_IGNORE_OUTGOING, so setting it
> opportunistically is fine. They also show that the code only tries to
> set PACKET_FANOUT_FLAG_IGNORE_OUTGOING or PACKET_IGNORE_OUTGOING when
> requested by ignore_outgoing=1. And it shows that
> PACKET_IGNORE_OUTGOING is used for single and
> PACKET_FANOUT_FLAG_IGNORE_OUTGOING for multi-queue.
>
> I have also manually ran testpmd in all modes and both kernels to
> verify that ignore_outgoing works as expected, sending packets and
> checking what testpmd was receiving (``set verbose 1``).
>
>
> v7:
> - log ignore_outgoing with %u
> - use n_inject for both sides of the ignore_outgoing test
> - mention Linux 4.20 once in the single-queue commit message
> - keep the release note to the devarg, not where filtering happens
Applied to next-net with simplification of the release note.
prev parent reply other threads:[~2026-10-17 21:18 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-04 4:22 [PATCH] net/af_packet: add capture direction option Frank Dressler
2026-10-04 16:10 ` Stephen Hemminger
2026-10-05 0:26 ` Frank Dressler
2026-10-05 0:28 ` [PATCH v2] net/af_packet: add option to ignore outgoing packets Frank Dressler
2026-10-05 16:41 ` Stephen Hemminger
2026-10-06 6:42 ` [PATCH v3] " Frank Dressler
2026-10-06 13:41 ` Stephen Hemminger
2026-10-09 15:02 ` [PATCH v4 0/3] net/af_packet: do not return outgoing packets from rte_eth_rx_burst Frank Dressler
2026-10-09 15:02 ` [PATCH v4 1/3] net/af_packet: filter Rx of outgoing packets in the PMD Frank Dressler
2026-10-09 15:02 ` [PATCH v4 2/3] net/af_packet: use kernel to filter single-queue Rx Frank Dressler
2026-10-09 15:02 ` [PATCH v4 3/3] net/af_packet: use kernel to filter multi-queue Rx Frank Dressler
2026-10-09 15:10 ` [PATCH v5 0/3] net/af_packet: do not return outgoing packets from rte_eth_rx_burst Frank Dressler
2026-10-09 15:10 ` [PATCH v5 1/3] net/af_packet: filter Rx of outgoing packets in the PMD Frank Dressler
2026-10-09 15:10 ` [PATCH v5 2/3] net/af_packet: use kernel to filter single-queue Rx Frank Dressler
2026-10-09 15:10 ` [PATCH v5 3/3] net/af_packet: use kernel to filter multi-queue Rx Frank Dressler
2026-10-09 20:03 ` [PATCH v5 0/3] net/af_packet: do not return outgoing packets from rte_eth_rx_burst Stephen Hemminger
2026-10-15 11:55 ` Frank Dressler
2026-10-15 11:14 ` [PATCH v6 0/4] " Frank Dressler
2026-10-15 11:14 ` [PATCH v6 1/4] test/af_packet: ignore stray packets in loopback test Frank Dressler
2026-10-15 11:14 ` [PATCH v6 2/4] net/af_packet: filter Rx of outgoing packets in the PMD Frank Dressler
2026-10-15 11:14 ` [PATCH v6 3/4] net/af_packet: use kernel to filter single-queue Rx Frank Dressler
2026-10-15 11:14 ` [PATCH v6 4/4] net/af_packet: use kernel to filter multi-queue Rx Frank Dressler
2026-10-15 19:28 ` [PATCH v6 0/4] net/af_packet: do not return outgoing packets from rte_eth_rx_burst Stephen Hemminger
[not found] ` <20261016211942.217041-1-frank@dressler.pro>
2026-10-16 21:19 ` [PATCH v7 1/4] test/af_packet: ignore stray packets in loopback test Frank Dressler
2026-10-16 21:19 ` [PATCH v7 2/4] net/af_packet: filter Rx of outgoing packets in the PMD Frank Dressler
2026-10-16 21:19 ` [PATCH v7 3/4] net/af_packet: use kernel to filter single-queue Rx Frank Dressler
2026-10-16 21:19 ` [PATCH v7 4/4] net/af_packet: use kernel to filter multi-queue Rx Frank Dressler
2026-10-17 21:18 ` 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=20261017141826.0d364768@phoenix.local \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=frank@dressler.pro \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.