From 112cf3e93bfe5dff0e5ab7fd9ce06065dfd86fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= Date: Tue, 29 Nov 2022 21:40:50 +0100 Subject: [PATCH] AF_XDP-example: Conditionally define socket options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Old system include headers don't have they SO_PREFER_BUSY_POLL and SO_BUSY_POLL_BUDGET socket option defines. Add conditional defines to the AF_XDP-example userspace code so we can still compile if they are missing. Fixes #76. Signed-off-by: Toke Høiland-Jørgensen --- AF_XDP-example/xdpsock.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/AF_XDP-example/xdpsock.c b/AF_XDP-example/xdpsock.c index 006566a..58253fa 100644 --- a/AF_XDP-example/xdpsock.c +++ b/AF_XDP-example/xdpsock.c @@ -53,6 +53,14 @@ #define PF_XDP AF_XDP #endif +#ifndef SO_PREFER_BUSY_POLL +#define SO_PREFER_BUSY_POLL 69 +#endif + +#ifndef SO_BUSY_POLL_BUDGET +#define SO_BUSY_POLL_BUDGET 70 +#endif + #define NUM_FRAMES (4 * 1024) #define MIN_PKT_SIZE 64