Skip to contentSkip to conversation

selftests, bpf: remove AF_XDP samples

PATCH Applied Magnus Karlsson 6 participants 10 messages Jun 30, 2022 – Jul 5, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests, bpf: remove AF_XDP samples

From: Magnus Karlsson <[email protected]>

Remove the AF_XDP samples from samples/bpf as they are dependent on the AF_XDP support in libbpf. This support has now been removed in the 1.0 release, so these samples cannot be compiled anymore. Please start to use libxdp instead. It is backwards compatible with the AF_XDP support that was offered in libbpf. New samples can be found in the various xdp-project repositories connected to libxdp and by googling.

---
 MAINTAINERS                     |    2 -
 samples/bpf/Makefile            |    9 -
 samples/bpf/xdpsock.h           |   19 -
 samples/bpf/xdpsock_ctrl_proc.c |  190 ---
 samples/bpf/xdpsock_kern.c      |   24 -
 samples/bpf/xdpsock_user.c      | 2019 -------------------------------
 samples/bpf/xsk_fwd.c           | 1085 -----------------
 7 files changed, 3348 deletions(-)
 delete mode 100644 samples/bpf/xdpsock.h
 delete mode 100644 samples/bpf/xdpsock_ctrl_proc.c
 delete mode 100644 samples/bpf/xdpsock_kern.c
 delete mode 100644 samples/bpf/xdpsock_user.c
 delete mode 100644 samples/bpf/xsk_fwd.c
MAINTAINERS +0 -2
index ca95b1833b97..ccd774c37c56 100644
@@ -21749,8 +21749,6 @@ F:	include/uapi/linux/if_xdp.h
 F:	include/uapi/linux/xdp_diag.h
 F:	include/net/netns/xdp.h
 F:	net/xdp/
-F:	samples/bpf/xdpsock*
-F:	tools/lib/bpf/xsk*
 
 XEN BLOCK SUBSYSTEM
 M:	Roger Pau Monné <[email protected]>
samples/bpf/Makefile +0 -9
index 03e3d3529ac9..5002a5b9a7da 100644
@@ -45,9 +45,6 @@ tprogs-y += xdp_rxq_info
 tprogs-y += syscall_tp
 tprogs-y += cpustat
 tprogs-y += xdp_adjust_tail
-tprogs-y += xdpsock
-tprogs-y += xdpsock_ctrl_proc
-tprogs-y += xsk_fwd
 tprogs-y += xdp_fwd
 tprogs-y += task_fd_query
 tprogs-y += xdp_sample_pkts
@@ -109,9 +106,6 @@ xdp_rxq_info-objs := xdp_rxq_info_user.o
 syscall_tp-objs := syscall_tp_user.o
 cpustat-objs := cpustat_user.o
 xdp_adjust_tail-objs := xdp_adjust_tail_user.o
-xdpsock-objs := xdpsock_user.o
-xdpsock_ctrl_proc-objs := xdpsock_ctrl_proc.o
-xsk_fwd-objs := xsk_fwd.o
 xdp_fwd-objs := xdp_fwd_user.o
 task_fd_query-objs := task_fd_query_user.o $(TRACE_HELPERS)
 xdp_sample_pkts-objs := xdp_sample_pkts_user.o
@@ -179,7 +173,6 @@ always-y += xdp_sample_pkts_kern.o
 always-y += ibumad_kern.o
 always-y += hbm_out_kern.o
 always-y += hbm_edt_kern.o
-always-y += xdpsock_kern.o
 
 ifeq ($(ARCH), arm)
 # Strip all except -D__LINUX_ARM_ARCH__ option needed to handle linux
@@ -224,8 +217,6 @@ TPROGLDLIBS_tracex4		+= -lrt
 TPROGLDLIBS_trace_output	+= -lrt
 TPROGLDLIBS_map_perf_test	+= -lrt
 TPROGLDLIBS_test_overhead	+= -lrt
-TPROGLDLIBS_xdpsock		+= -pthread -lcap
-TPROGLDLIBS_xsk_fwd		+= -pthread
 
 # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline:
 # make M=samples/bpf LLC=~/git/llvm-project/llvm/build/bin/llc CLANG=~/git/llvm-project/llvm/build/bin/clang
samples/bpf/xdpsock.h deleted +0 -19
deleted file mode 100644
index fd70cce60712..000000000000
@@ -1,19 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0
- *
- * Copyright(c) 2019 Intel Corporation.
- */
-
-#ifndef XDPSOCK_H_
-#define XDPSOCK_H_
-
-#define MAX_SOCKS 4
-
-#define SOCKET_NAME "sock_cal_bpf_fd"
-#define MAX_NUM_OF_CLIENTS 10
-
-#define CLOSE_CONN  1
-
-typedef __u64 u64;
-typedef __u32 u32;
-
-#endif /* XDPSOCK_H */
samples/bpf/xdpsock_ctrl_proc.c deleted +0 -190

190 lines not on this page · raw message

samples/bpf/xdpsock_kern.c deleted +0 -24
deleted file mode 100644
index 05430484375c..000000000000
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/bpf.h>
-#include <bpf/bpf_helpers.h>
-#include "xdpsock.h"
-
-/* This XDP program is only needed for the XDP_SHARED_UMEM mode.
- * If you do not use this mode, libbpf can supply an XDP program for you.
- */
-
-struct {
-	__uint(type, BPF_MAP_TYPE_XSKMAP);
-	__uint(max_entries, MAX_SOCKS);
-	__uint(key_size, sizeof(int));
-	__uint(value_size, sizeof(int));
-} xsks_map SEC(".maps");
-
-static unsigned int rr;
-
-SEC("xdp_sock") int xdp_sock_prog(struct xdp_md *ctx)
-{
-	rr = (rr + 1) & (MAX_SOCKS - 1);
-
-	return bpf_redirect_map(&xsks_map, rr, XDP_DROP);
-}
samples/bpf/xdpsock_user.c deleted +0 -2019

2,019 lines not on this page · raw message

samples/bpf/xsk_fwd.c deleted +0 -1085

707 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

base-commit: f0cf642c56b76dfbbb5f2be67fa180191d5ab0ef

Signature · 1 line
2.34.1

Part of the diff is not shown here. View the raw message.

Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Magnus Karlsson

From: Magnus Karlsson <[email protected]>

Remove the AF_XDP samples from samples/bpf as they are dependent on the AF_XDP support in libbpf. This support has now been removed in the 1.0 release, so these samples cannot be compiled anymore. Please start to use libxdp instead. It is backwards compatible with the AF_XDP support that was offered in libbpf. New samples can be found in the various xdp-project repositories connected to libxdp and by googling.

Acked-by on v1 1/1
#2 lore raw
In reply to Magnus Karlsson
Quoted 8 lines · Magnus Karlsson

From: Magnus Karlsson <[email protected]>

Remove the AF_XDP samples from samples/bpf as they are dependent on the AF_XDP support in libbpf. This support has now been removed in the 1.0 release, so these samples cannot be compiled anymore. Please start to use libxdp instead. It is backwards compatible with the AF_XDP support that was offered in libbpf. New samples can be found in the various xdp-project repositories connected to libxdp and by googling.

R.I.P.

Quoted 2 lines
#3 lore raw
In reply to Magnus Karlsson
Quoted 10 lines · Magnus Karlsson

From: Magnus Karlsson <[email protected]>

Remove the AF_XDP samples from samples/bpf as they are dependent on the AF_XDP support in libbpf. This support has now been removed in the 1.0 release, so these samples cannot be compiled anymore. Please start to use libxdp instead. It is backwards compatible with the AF_XDP support that was offered in libbpf. New samples can be found in the various xdp-project repositories connected to libxdp and by googling.

Will you (or Maciej) be submitting these samples to XDP-tools[1] which is the current home for libxdp or maybe BPF-examples[2] ?

[1] https://github.com/xdp-project/xdp-tools
[2] https://github.com/xdp-project/bpf-examples

I know Toke is ready to take over maintaining these, but we will appreciate someone to open a PR with this code...

Quoted 8 lines
---
  MAINTAINERS                     |    2 -
  samples/bpf/Makefile            |    9 -
  samples/bpf/xdpsock.h           |   19 -
  samples/bpf/xdpsock_ctrl_proc.c |  190 ---
  samples/bpf/xdpsock_kern.c      |   24 -
  samples/bpf/xdpsock_user.c      | 2019 -------------------------------
  samples/bpf/xsk_fwd.c           | 1085 -----------------

The code in samples/bpf/xsk_fwd.c is interesting, because it contains a buffer memory manager, something I've seen people struggle with getting right and performant (at the same time).

You can get my ACK if someone commits to port this to [1] or [2], or a 3rd place that have someone what will maintain this in the future.

--Jesper

#4 lore raw
Quoted 32 lines · Jesper Dangaard Brouer
Quoted 10 lines · Magnus Karlsson

From: Magnus Karlsson <[email protected]>

Remove the AF_XDP samples from samples/bpf as they are dependent on the AF_XDP support in libbpf. This support has now been removed in the 1.0 release, so these samples cannot be compiled anymore. Please start to use libxdp instead. It is backwards compatible with the AF_XDP support that was offered in libbpf. New samples can be found in the various xdp-project repositories connected to libxdp and by googling.

Will you (or Maciej) be submitting these samples to XDP-tools[1] which is the current home for libxdp or maybe BPF-examples[2] ?

[1] https://github.com/xdp-project/xdp-tools
[2] https://github.com/xdp-project/bpf-examples

I know Toke is ready to take over maintaining these, but we will appreciate someone to open a PR with this code...

Quoted 8 lines
---
  MAINTAINERS                     |    2 -
  samples/bpf/Makefile            |    9 -
  samples/bpf/xdpsock.h           |   19 -
  samples/bpf/xdpsock_ctrl_proc.c |  190 ---
  samples/bpf/xdpsock_kern.c      |   24 -
  samples/bpf/xdpsock_user.c      | 2019 -------------------------------
  samples/bpf/xsk_fwd.c           | 1085 -----------------
Quoted 3 lines

The code in samples/bpf/xsk_fwd.c is interesting, because it contains a buffer memory manager, something I've seen people struggle with getting right and performant (at the same time).

I can push xsk_fwd to BPF-examples. Though I do think that xdpsock has become way too big to serve as a sample. It slowly turned into a catch all demonstrating every single feature of AF_XDP. We need a minimal example and then likely other samples for other features that should be demoed. So I suggest that xdpsock dies here and we start over with something minimal and use xsk_fwd for the forwarding and mempool example.

Toke, I think you told me at Recipes in Paris that someone from RedHat was working on an example. Did I remember correctly?

Quoted 5 lines

You can get my ACK if someone commits to port this to [1] or [2], or a 3rd place that have someone what will maintain this in the future.

--Jesper

#5 lore raw
Quoted 46 lines · Magnus Karlsson
Quoted 32 lines · Jesper Dangaard Brouer
Quoted 10 lines · Magnus Karlsson

From: Magnus Karlsson <[email protected]>

Remove the AF_XDP samples from samples/bpf as they are dependent on the AF_XDP support in libbpf. This support has now been removed in the 1.0 release, so these samples cannot be compiled anymore. Please start to use libxdp instead. It is backwards compatible with the AF_XDP support that was offered in libbpf. New samples can be found in the various xdp-project repositories connected to libxdp and by googling.

Will you (or Maciej) be submitting these samples to XDP-tools[1] which is the current home for libxdp or maybe BPF-examples[2] ?

[1] https://github.com/xdp-project/xdp-tools
[2] https://github.com/xdp-project/bpf-examples

I know Toke is ready to take over maintaining these, but we will appreciate someone to open a PR with this code...

Quoted 8 lines
---
  MAINTAINERS                     |    2 -
  samples/bpf/Makefile            |    9 -
  samples/bpf/xdpsock.h           |   19 -
  samples/bpf/xdpsock_ctrl_proc.c |  190 ---
  samples/bpf/xdpsock_kern.c      |   24 -
  samples/bpf/xdpsock_user.c      | 2019 -------------------------------
  samples/bpf/xsk_fwd.c           | 1085 -----------------
Quoted 3 lines

The code in samples/bpf/xsk_fwd.c is interesting, because it contains a buffer memory manager, something I've seen people struggle with getting right and performant (at the same time).

I can push xsk_fwd to BPF-examples. Though I do think that xdpsock has become way too big to serve as a sample. It slowly turned into a catch all demonstrating every single feature of AF_XDP. We need a minimal example and then likely other samples for other features that should be demoed. So I suggest that xdpsock dies here and we start over with something minimal and use xsk_fwd for the forwarding and mempool example.

Quoted 2 lines

Toke, I think you told me at Recipes in Paris that someone from RedHat was working on an example. Did I remember correctly?

I think I was probably referring to
https://github.com/xdp-project/xdp-tools/pull/158 ? Which has sadly stalled :(

-Toke

#6 lore raw
In reply to Magnus Karlsson
Quoted 7 lines

I can push xsk_fwd to BPF-examples. Though I do think that xdpsock has become way too big to serve as a sample. It slowly turned into a catch all demonstrating every single feature of AF_XDP. We need a minimal example and then likely other samples for other features that should be demoed. So I suggest that xdpsock dies here and we start over with something minimal and use xsk_fwd for the forwarding and mempool example.

As an AF_XDP user, I want to say that I often refer to xdpsock to understand how to use a feature - it is very useful especially when there's a lack of good AF_XDP documentation.

Srivats

#7 lore raw
Quoted 9 lines · Srivats P
Quoted 8 lines

I can push xsk_fwd to BPF-examples. Though I do think that xdpsock has become way too big to serve as a sample. It slowly turned into a catch all demonstrating every single feature of AF_XDP. We need a minimal example and then likely other samples for other features that should be demoed. So I suggest that xdpsock dies here and we start over with something minimal and use xsk_fwd for the forwarding and mempool example.

Quoted 3 lines

As an AF_XDP user, I want to say that I often refer to xdpsock to understand how to use a feature - it is very useful especially when there's a lack of good AF_XDP documentation.

Fully agree with you that we need a sample, but a better location for it is in libxdp as xdpsock demonstrates how to use libxdp interfaces. We cannot require that people install libxdp just to be able to compile samples/bpf/. And the sample should be simpler IMO. So let us use this as an opportunity to improve things.

Quoted 1 line

Srivats

#8 lore raw
In reply to Magnus Karlsson
Quoted 38 lines · Magnus Karlsson
Quoted 32 lines · Jesper Dangaard Brouer
Quoted 10 lines · Magnus Karlsson

From: Magnus Karlsson <[email protected]>

Remove the AF_XDP samples from samples/bpf as they are dependent on the AF_XDP support in libbpf. This support has now been removed in the 1.0 release, so these samples cannot be compiled anymore. Please start to use libxdp instead. It is backwards compatible with the AF_XDP support that was offered in libbpf. New samples can be found in the various xdp-project repositories connected to libxdp and by googling.

Will you (or Maciej) be submitting these samples to XDP-tools[1] which is the current home for libxdp or maybe BPF-examples[2] ?

[1] https://github.com/xdp-project/xdp-tools
[2] https://github.com/xdp-project/bpf-examples

I know Toke is ready to take over maintaining these, but we will appreciate someone to open a PR with this code...

Quoted 8 lines
---
   MAINTAINERS                     |    2 -
   samples/bpf/Makefile            |    9 -
   samples/bpf/xdpsock.h           |   19 -
   samples/bpf/xdpsock_ctrl_proc.c |  190 ---
   samples/bpf/xdpsock_kern.c      |   24 -
   samples/bpf/xdpsock_user.c      | 2019 -------------------------------
   samples/bpf/xsk_fwd.c           | 1085 -----------------
Quoted 3 lines

The code in samples/bpf/xsk_fwd.c is interesting, because it contains a buffer memory manager, something I've seen people struggle with getting right and performant (at the same time).

Quoted 7 lines

I can push xsk_fwd to BPF-examples. Though I do think that xdpsock has become way too big to serve as a sample. It slowly turned into a catch all demonstrating every single feature of AF_XDP. We need a minimal example and then likely other samples for other features that should be demoed. So I suggest that xdpsock dies here and we start over with something minimal and use xsk_fwd for the forwarding and mempool example.

I trust that we in bpf-examples[0] will see a PR with this from you/Intel, so:

Quoted 6 lines

Toke, I think you told me at Recipes in Paris that someone from RedHat was working on an example. Did I remember correctly?

Quoted 3 lines

You can get my ACK if someone commits to port this to [1] or [2], or a 3rd place that have someone what will maintain this in the future.

[0] https://github.com/xdp-project/bpf-examples/

#9 lore raw
In reply to Magnus Karlsson
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Quoted 10 lines · On Thu, 30 Jun 2022 11:37:17 +0200 you wrote:

From: Magnus Karlsson <[email protected]>

Remove the AF_XDP samples from samples/bpf as they are dependent on the AF_XDP support in libbpf. This support has now been removed in the 1.0 release, so these samples cannot be compiled anymore. Please start to use libxdp instead. It is backwards compatible with the AF_XDP support that was offered in libbpf. New samples can be found in the various xdp-project repositories connected to libxdp and by googling.

[...]

Here is the summary with links:
- [bpf-next] selftests, bpf: remove AF_XDP samples

    https://git.kernel.org/bpf/bpf-next/c/cfb5a2dbf141

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html