Skip to content

Commit

Permalink
bpftool: ci: mirror: Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'refs/remotes/upstream/master'

Conflicts:
	docs/bpftool-net.rst
Conflict resolved and new content formatted.


Signed-off-by: Rameez Rehman <rameezrehman408@hotmail.com>
  • Loading branch information
rameezrehman408 committed Sep 30, 2023
2 parents 12c04a0 + e17d6cf commit 96163c0
Show file tree
Hide file tree
Showing 17 changed files with 820 additions and 67 deletions.
2 changes: 1 addition & 1 deletion BPF-CHECKPOINT-COMMIT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
496720b7cfb6574a8f6f4d434f23e3d1e6cfaeb9
57eb5e1c5c57972c95e8efab6bc81b87161b0b07
2 changes: 1 addition & 1 deletion CHECKPOINT-COMMIT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a3e7e6b17946f48badce98d7ac360678a0ea7393
45ee73a0722b9e1d0b7a524d06756291b13b5912
40 changes: 21 additions & 19 deletions docs/bpftool-net.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
bpftool-net
================
-------------------------------------------------------------------------------
tool for inspection of netdev/tc related bpf prog attachments
tool for inspection of networking related bpf prog attachments
-------------------------------------------------------------------------------

:Manual section: 8
Expand Down Expand Up @@ -37,23 +37,28 @@ DESCRIPTION
bpftool net { show | list } [ dev *NAME* ]
List bpf program attachments in the kernel networking subsystem.

Currently, only device driver xdp attachments and tc filter
classification/action attachments are implemented, i.e., for program
types **BPF_PROG_TYPE_SCHED_CLS**, **BPF_PROG_TYPE_SCHED_ACT** and
**BPF_PROG_TYPE_XDP**. For programs attached to a particular cgroup,
e.g., **BPF_PROG_TYPE_CGROUP_SKB**, **BPF_PROG_TYPE_CGROUP_SOCK**,
Currently, device driver xdp attachments, tcx and old-style tc
classifier/action attachments, flow_dissector as well as netfilter
attachments are implemented, i.e., for program types
**BPF_PROG_TYPE_XDP**, **BPF_PROG_TYPE_SCHED_CLS**,
**BPF_PROG_TYPE_SCHED_ACT**, **BPF_PROG_TYPE_FLOW_DISSECTOR**,
**BPF_PROG_TYPE_NETFILTER**.

For programs attached to a particular cgroup, e.g.,
**BPF_PROG_TYPE_CGROUP_SKB**, **BPF_PROG_TYPE_CGROUP_SOCK**,
**BPF_PROG_TYPE_SOCK_OPS** and **BPF_PROG_TYPE_CGROUP_SOCK_ADDR**, users
can use **bpftool cgroup** to dump cgroup attachments. For sk_{filter,
skb, msg, reuseport} and lwt/seg6 bpf programs, users should consult
other tools, e.g., iproute2.

The current output will start with all xdp program attachments, followed
by all tc class/qdisc bpf program attachments. Both xdp programs and tc
programs are ordered based on ifindex number. If multiple bpf programs
attached to the same networking device through **tc filter**, the order
will be first all bpf programs attached to tc classes, then all bpf
programs attached to non clsact qdiscs, and finally all bpf programs
attached to root and clsact qdisc.
by all tcx, then tc class/qdisc bpf program attachments, then
flow_dissector and finally netfilter programs. Both xdp programs and
tcx/tc programs are ordered based on ifindex number. If multiple bpf
programs attached to the same networking device through **tc**, the
order will be first all bpf programs attached to tcx, then tc classes,
then all bpf programs attached to non clsact qdiscs, and finally all bpf
programs attached to root and clsact qdisc.

bpftool net attach *ATTACH_TYPE* *PROG* dev *NAME* [ overwrite ]
Attach bpf program *PROG* to network interface *NAME* with type
Expand All @@ -62,13 +67,10 @@ DESCRIPTION
XDP-related modes are supported for *ATTACH_TYPE*.

*ATTACH_TYPE* can be of:
**xdp** - try native XDP and fallback to generic XDP if NIC driver does
not support it;
**xdpgeneric** - Generic XDP. runs at generic XDP hook when packet
already enters receive path as skb;
**xdpdrv** - Native XDP. runs earliest point in driver's receive path;
**xdpoffload** - Offload XDP. runs directly on NIC on each packet
reception;
- **xdp** - try native XDP and fallback to generic XDP if NIC driver does not support it;
- **xdpgeneric** - Generic XDP. runs at generic XDP hook when packet already enters receive path as skb;
- **xdpdrv** - Native XDP. runs earliest point in driver's receive path;
- **xdpoffload** - Offload XDP. runs directly on NIC on each packet reception;

bpftool net detach *ATTACH_TYPE* dev *NAME*
Detach bpf program attached to network interface *NAME* with type
Expand Down
6 changes: 4 additions & 2 deletions include/linux/compiler-gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
+ __GNUC_PATCHLEVEL__)
#endif

#if GCC_VERSION >= 70000 && !defined(__CHECKER__)
# define __fallthrough __attribute__ ((fallthrough))
#if __has_attribute(__fallthrough__)
# define fallthrough __attribute__((__fallthrough__))
#else
# define fallthrough do {} while (0) /* fallthrough */
#endif

#if __has_attribute(__error__)
Expand Down
4 changes: 0 additions & 4 deletions include/linux/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,4 @@
# define __weak __attribute__((weak))
#endif

#ifndef __fallthrough
# define __fallthrough
#endif

#endif
14 changes: 13 additions & 1 deletion include/uapi/asm-generic/bitsperlong.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _UAPI__ASM_GENERIC_BITS_PER_LONG
#define _UAPI__ASM_GENERIC_BITS_PER_LONG

#ifndef __BITS_PER_LONG
/*
* In order to keep safe and avoid regression, only unify uapi
* bitsperlong.h for some archs which are using newer toolchains
* that have the definitions of __CHAR_BIT__ and __SIZEOF_LONG__.
* See the following link for more info:
* https://lore.kernel.org/linux-arch/b9624545-2c80-49a1-ac3c-39264a591f7b@app.fastmail.com/
*/
#if defined(__CHAR_BIT__) && defined(__SIZEOF_LONG__)
#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
#else
/*
* There seems to be no way of detecting this automatically from user
* space, so 64 bit architectures should override this in their
* bitsperlong.h. In particular, an architecture that supports
* both 32 and 64 bit user space must not rely on CONFIG_64BIT
* to decide it, but rather check a compiler provided macro.
*/
#ifndef __BITS_PER_LONG
#define __BITS_PER_LONG 32
#endif
#endif

#endif /* _UAPI__ASM_GENERIC_BITS_PER_LONG */
Loading

0 comments on commit 96163c0

Please sign in to comment.