All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Frank Dressler <frank@dressler.pro>
Cc: dev@dpdk.org, thomas@monjalon.net, david.marchand@redhat.com,
	ktraynor@redhat.com, Bing Zhao <bingz@nvidia.com>
Subject: Re: [PATCH] net/af_packet: fix build with old kernel headers
Date: Sun, 8 Nov 2026 08:22:11 -0800	[thread overview]
Message-ID: <20261108082211.1f190f4b@phoenix.local> (raw)
In-Reply-To: <0374e022-3c41-4a6b-9464-7f879ef02ce1@dressler.pro>

On Sat, 7 Nov 2026 11:11:54 +0000
Frank Dressler <frank@dressler.pro> wrote:

> On 11/6/26 14:27, Bing Zhao wrote:
> 
>  > The PACKET_IGNORE_OUTGOING socket option is used unconditionally,
>  > but it was only added to the uapi headers in Linux 4.20. The build
>  > fails on distributions shipping older kernel headers, like RHEL 8
>  > (kernel-headers-4.18.0-193.el8, gcc 8.5.0):  
> 
> On 11/6/26 16:06, Frank Dressler wrote:
>  > If RHEL 8 uses Linux 4.18, [...]
>  > If DPDK needs to stay compatible with RHEL 8, [...]  
> 
> Short version: RHEL itself does't seem to ship any DPDK that is too
> new for its kernel. The RHEL 8 compatibility requirement may instead
> come from NVIDIA's DOCA, which ships DPDK 26.03 on RHEL 8. If so, the
> question is whether upstream DPDK should support that combination, or
> whether it is better handled on the DOCA side. Details below.
> 
> Bing Zhao, is that the use case behind the patch?
> 
> Details:
> I read too much into Bing Zhao's statement that the new code does not
> build with the RHEL 8 kernel. That statement is true.I incorrectly
> assumed RHEL itself ships a DPDK version that is too new for its
> kernel, which is not the case.

The important parts that were missed here.
 - flag should not be accepted if underlying kernel does not support it.
 - failure should be at compile time not runtime.

Either remove this part:

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 44f82c0309..ecd4a9801e 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -32,11 +32,6 @@
 #include <unistd.h>
 #include <poll.h>
 
-/* Added in Linux 6.2. Older kernels ignore it. */
-#ifndef PACKET_FANOUT_FLAG_IGNORE_OUTGOING
-#define PACKET_FANOUT_FLAG_IGNORE_OUTGOING 0x4000
-#endif
-
 #define ETH_AF_PACKET_IFACE_ARG                "iface"
 #define ETH_AF_PACKET_NUM_Q_ARG                "qpairs"
 #define ETH_AF_PACKET_BLOCKSIZE_ARG    "blocksz"


Or add a bunch of #ifdef like this.

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 44f82c0309..6ffdfd8524 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -32,11 +32,6 @@
 #include <unistd.h>
 #include <poll.h>
 
-/* Added in Linux 6.2. Older kernels ignore it. */
-#ifndef PACKET_FANOUT_FLAG_IGNORE_OUTGOING
-#define PACKET_FANOUT_FLAG_IGNORE_OUTGOING 0x4000
-#endif
-
 #define ETH_AF_PACKET_IFACE_ARG		"iface"
 #define ETH_AF_PACKET_NUM_Q_ARG		"qpairs"
 #define ETH_AF_PACKET_BLOCKSIZE_ARG	"blocksz"
@@ -44,7 +39,10 @@
 #define ETH_AF_PACKET_FRAMECOUNT_ARG	"framecnt"
 #define ETH_AF_PACKET_QDISC_BYPASS_ARG	"qdisc_bypass"
 #define ETH_AF_PACKET_FANOUT_MODE_ARG	"fanout_mode"
-#define ETH_AF_PACKET_IGNORE_OUTGOING_ARG	"ignore_outgoing"
+
+#ifdef PACKET_FANOUT_FLAG_IGNORE_OUTGOING
+#define ETH_AF_PACKET_IGNORE_OUTGOING_ARG "ignore_outgoing"
+#endif
 
 #define DFLT_FRAME_SIZE		(1 << 11)
 #define DFLT_FRAME_COUNT	(1 << 9)
@@ -110,7 +108,9 @@ static const char *valid_arguments[] = {
 	ETH_AF_PACKET_FRAMECOUNT_ARG,
 	ETH_AF_PACKET_QDISC_BYPASS_ARG,
 	ETH_AF_PACKET_FANOUT_MODE_ARG,
+#ifdef ETH_AF_PACKET_IGNORE_OUTGOING_ARG
 	ETH_AF_PACKET_IGNORE_OUTGOING_ARG,
+#endif
 	NULL
 };
 
@@ -1002,6 +1002,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
 		goto error;
 	}
 
+#ifdef PACKET_FANOUT_FLAG_IGNORE_OUTGOING
 	/*
 	 * Set the flag opportunistically if multiple queues are requested.
 	 * It takes effect from Linux 6.2. Older kernels ignore it and the
@@ -1009,6 +1010,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
 	 */
 	if (ignore_outgoing != 0 && nb_queues > 1)
 		fanout_arg |= PACKET_FANOUT_FLAG_IGNORE_OUTGOING << 16;
+#endif
 
 	for (q = 0; q < nb_queues; q++) {
 		/* Open an AF_PACKET socket for this queue... */
@@ -1053,6 +1055,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
 #endif
 		}
 
+#ifdef PACKET_IGNORE_OUTGOING
 		if (ignore_outgoing != 0 && nb_queues == 1) {
 			rc = setsockopt(qsockfd, SOL_PACKET, PACKET_IGNORE_OUTGOING,
 					&ignore_outgoing, sizeof(ignore_outgoing));
@@ -1064,6 +1067,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
 				goto error;
 			}
 		}
+#endif
 
 		rc = setsockopt(qsockfd, SOL_PACKET, PACKET_RX_RING, req, sizeof(*req));
 		if (rc == -1) {
@@ -1314,11 +1318,14 @@ rte_eth_from_packet(struct rte_vdev_device *dev,
 			fanout_mode = pair->value;
 			continue;
 		}
+
+#ifdef ETH_AF_PACKET_IGNORE_OUTGOING_ARG
 		if (strstr(pair->key, ETH_AF_PACKET_IGNORE_OUTGOING_ARG) != NULL) {
 			if (parse_uint(pair->key, pair->value, &ignore_outgoing, 1) < 0)
 				return -1;
 			continue;
 		}
+#endif
 	}
 
 	if (framesize > blocksize) {



  reply	other threads:[~2026-11-08 16:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 14:27 [PATCH] net/af_packet: fix build with old kernel headers Bing Zhao
2026-11-06 14:46 ` Thomas Monjalon
2026-11-06 16:06 ` Frank Dressler
2026-11-07 11:11   ` Frank Dressler
2026-11-08 16:22     ` Stephen Hemminger [this message]
2026-11-08 18:51       ` Frank Dressler
2026-11-08 20:29         ` Stephen Hemminger
2026-11-09 15:47 ` [PATCH v2] " Bing Zhao
2026-11-09 17:47   ` Stephen Hemminger
2026-11-10 10:39     ` Thomas Monjalon
2026-11-10 12:52       ` Frank Dressler
2026-11-10 13:56         ` Thomas Monjalon
2026-11-10 14:23           ` Frank Dressler
2026-11-10 16:51   ` 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=20261108082211.1f190f4b@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=bingz@nvidia.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=frank@dressler.pro \
    --cc=ktraynor@redhat.com \
    --cc=thomas@monjalon.net \
    /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.