~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/bpf/bpftool/Documentation/bpftool-net.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/bpf/bpftool/Documentation/bpftool-net.rst (Architecture m68k) and /tools/bpf/bpftool/Documentation/bpftool-net.rst (Architecture ppc)


  1 .. SPDX-License-Identifier: (GPL-2.0-only OR B      1 .. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
  2                                                     2 
  3 ================                                    3 ================
  4 bpftool-net                                         4 bpftool-net
  5 ================                                    5 ================
  6 ----------------------------------------------      6 -------------------------------------------------------------------------------
  7 tool for inspection of networking related bpf       7 tool for inspection of networking related bpf prog attachments
  8 ----------------------------------------------      8 -------------------------------------------------------------------------------
  9                                                     9 
 10 :Manual section: 8                                 10 :Manual section: 8
 11                                                    11 
 12 .. include:: substitutions.rst                     12 .. include:: substitutions.rst
 13                                                    13 
 14 SYNOPSIS                                           14 SYNOPSIS
 15 ========                                           15 ========
 16                                                    16 
 17 **bpftool** [*OPTIONS*] **net** *COMMAND*          17 **bpftool** [*OPTIONS*] **net** *COMMAND*
 18                                                    18 
 19 *OPTIONS* := { |COMMON_OPTIONS| }                  19 *OPTIONS* := { |COMMON_OPTIONS| }
 20                                                    20 
 21 *COMMANDS* := { **show** | **list** | **attach     21 *COMMANDS* := { **show** | **list** | **attach** | **detach** | **help** }
 22                                                    22 
 23 NET COMMANDS                                       23 NET COMMANDS
 24 ============                                       24 ============
 25                                                    25 
 26 | **bpftool** **net** { **show** | **list** }      26 | **bpftool** **net** { **show** | **list** } [ **dev** *NAME* ]
 27 | **bpftool** **net attach** *ATTACH_TYPE* *PR     27 | **bpftool** **net attach** *ATTACH_TYPE* *PROG* **dev** *NAME* [ **overwrite** ]
 28 | **bpftool** **net detach** *ATTACH_TYPE* **d     28 | **bpftool** **net detach** *ATTACH_TYPE* **dev** *NAME*
 29 | **bpftool** **net help**                         29 | **bpftool** **net help**
 30 |                                                  30 |
 31 | *PROG* := { **id** *PROG_ID* | **pinned** *F     31 | *PROG* := { **id** *PROG_ID* | **pinned** *FILE* | **tag** *PROG_TAG* | **name** *PROG_NAME* }
 32 | *ATTACH_TYPE* := { **xdp** | **xdpgeneric**      32 | *ATTACH_TYPE* := { **xdp** | **xdpgeneric** | **xdpdrv** | **xdpoffload** | **tcx_ingress** | **tcx_egress** }
 33                                                    33 
 34 DESCRIPTION                                        34 DESCRIPTION
 35 ===========                                        35 ===========
 36 bpftool net { show | list } [ dev *NAME* ]         36 bpftool net { show | list } [ dev *NAME* ]
 37     List bpf program attachments in the kernel     37     List bpf program attachments in the kernel networking subsystem.
 38                                                    38 
 39     Currently, device driver xdp attachments,      39     Currently, device driver xdp attachments, tcx, netkit and old-style tc
 40     classifier/action attachments, flow_dissec     40     classifier/action attachments, flow_dissector as well as netfilter
 41     attachments are implemented, i.e., for pro     41     attachments are implemented, i.e., for program types **BPF_PROG_TYPE_XDP**,
 42     **BPF_PROG_TYPE_SCHED_CLS**, **BPF_PROG_TY     42     **BPF_PROG_TYPE_SCHED_CLS**, **BPF_PROG_TYPE_SCHED_ACT**,
 43     **BPF_PROG_TYPE_FLOW_DISSECTOR**, **BPF_PR     43     **BPF_PROG_TYPE_FLOW_DISSECTOR**, **BPF_PROG_TYPE_NETFILTER**.
 44                                                    44 
 45     For programs attached to a particular cgro     45     For programs attached to a particular cgroup, e.g.,
 46     **BPF_PROG_TYPE_CGROUP_SKB**, **BPF_PROG_T     46     **BPF_PROG_TYPE_CGROUP_SKB**, **BPF_PROG_TYPE_CGROUP_SOCK**,
 47     **BPF_PROG_TYPE_SOCK_OPS** and **BPF_PROG_     47     **BPF_PROG_TYPE_SOCK_OPS** and **BPF_PROG_TYPE_CGROUP_SOCK_ADDR**, users
 48     can use **bpftool cgroup** to dump cgroup      48     can use **bpftool cgroup** to dump cgroup attachments. For sk_{filter, skb,
 49     msg, reuseport} and lwt/seg6 bpf programs,     49     msg, reuseport} and lwt/seg6 bpf programs, users should consult other
 50     tools, e.g., iproute2.                         50     tools, e.g., iproute2.
 51                                                    51 
 52     The current output will start with all xdp     52     The current output will start with all xdp program attachments, followed by
 53     all tcx, netkit, then tc class/qdisc bpf p     53     all tcx, netkit, then tc class/qdisc bpf program attachments, then
 54     flow_dissector and finally netfilter progr     54     flow_dissector and finally netfilter programs. Both xdp programs and
 55     tcx/netkit/tc programs are ordered based o     55     tcx/netkit/tc programs are ordered based on ifindex number. If multiple bpf
 56     programs attached to the same networking d     56     programs attached to the same networking device through **tc**, the order
 57     will be first all bpf programs attached to     57     will be first all bpf programs attached to tcx, netkit, then tc classes,
 58     then all bpf programs attached to non clsa     58     then all bpf programs attached to non clsact qdiscs, and finally all bpf
 59     programs attached to root and clsact qdisc     59     programs attached to root and clsact qdisc.
 60                                                    60 
 61 bpftool net attach *ATTACH_TYPE* *PROG* dev *N     61 bpftool net attach *ATTACH_TYPE* *PROG* dev *NAME* [ overwrite ]
 62     Attach bpf program *PROG* to network inter     62     Attach bpf program *PROG* to network interface *NAME* with type specified
 63     by *ATTACH_TYPE*. Previously attached bpf      63     by *ATTACH_TYPE*. Previously attached bpf program can be replaced by the
 64     command used with **overwrite** option. Cu     64     command used with **overwrite** option. Currently, only XDP-related modes
 65     are supported for *ATTACH_TYPE*.               65     are supported for *ATTACH_TYPE*.
 66                                                    66 
 67     *ATTACH_TYPE* can be of:                       67     *ATTACH_TYPE* can be of:
 68     **xdp** - try native XDP and fallback to g     68     **xdp** - try native XDP and fallback to generic XDP if NIC driver does not support it;
 69     **xdpgeneric** - Generic XDP. runs at gene     69     **xdpgeneric** - Generic XDP. runs at generic XDP hook when packet already enters receive path as skb;
 70     **xdpdrv** - Native XDP. runs earliest poi     70     **xdpdrv** - Native XDP. runs earliest point in driver's receive path;
 71     **xdpoffload** - Offload XDP. runs directl     71     **xdpoffload** - Offload XDP. runs directly on NIC on each packet reception;
 72     **tcx_ingress** - Ingress TCX. runs on ing     72     **tcx_ingress** - Ingress TCX. runs on ingress net traffic;
 73     **tcx_egress** - Egress TCX. runs on egres     73     **tcx_egress** - Egress TCX. runs on egress net traffic;
 74                                                    74 
 75 bpftool net detach *ATTACH_TYPE* dev *NAME*        75 bpftool net detach *ATTACH_TYPE* dev *NAME*
 76     Detach bpf program attached to network int     76     Detach bpf program attached to network interface *NAME* with type specified
 77     by *ATTACH_TYPE*. To detach bpf program, s     77     by *ATTACH_TYPE*. To detach bpf program, same *ATTACH_TYPE* previously used
 78     for attach must be specified. Currently, o     78     for attach must be specified. Currently, only XDP-related modes are
 79     supported for *ATTACH_TYPE*.                   79     supported for *ATTACH_TYPE*.
 80                                                    80 
 81 bpftool net help                                   81 bpftool net help
 82     Print short help message.                      82     Print short help message.
 83                                                    83 
 84 OPTIONS                                            84 OPTIONS
 85 =======                                            85 =======
 86 .. include:: common_options.rst                    86 .. include:: common_options.rst
 87                                                    87 
 88 EXAMPLES                                           88 EXAMPLES
 89 ========                                           89 ========
 90                                                    90 
 91 | **# bpftool net**                                91 | **# bpftool net**
 92                                                    92 
 93 ::                                                 93 ::
 94                                                    94 
 95       xdp:                                         95       xdp:
 96       eth0(2) driver id 198                        96       eth0(2) driver id 198
 97                                                    97 
 98       tc:                                          98       tc:
 99       eth0(2) htb name prefix_matcher.o:[cls_p     99       eth0(2) htb name prefix_matcher.o:[cls_prefix_matcher_htb] id 111727 act []
100       eth0(2) clsact/ingress fbflow_icmp id 13    100       eth0(2) clsact/ingress fbflow_icmp id 130246 act []
101       eth0(2) clsact/egress prefix_matcher.o:[    101       eth0(2) clsact/egress prefix_matcher.o:[cls_prefix_matcher_clsact] id 111726
102       eth0(2) clsact/egress cls_fg_dscp id 108    102       eth0(2) clsact/egress cls_fg_dscp id 108619 act []
103       eth0(2) clsact/egress fbflow_egress id 1    103       eth0(2) clsact/egress fbflow_egress id 130245
104                                                   104 
105 |                                                 105 |
106 | **# bpftool -jp net**                           106 | **# bpftool -jp net**
107                                                   107 
108 ::                                                108 ::
109                                                   109 
110     [{                                            110     [{
111             "xdp": [{                             111             "xdp": [{
112                     "devname": "eth0",            112                     "devname": "eth0",
113                     "ifindex": 2,                 113                     "ifindex": 2,
114                     "mode": "driver",             114                     "mode": "driver",
115                     "id": 198                     115                     "id": 198
116                 }                                 116                 }
117             ],                                    117             ],
118             "tc": [{                              118             "tc": [{
119                     "devname": "eth0",            119                     "devname": "eth0",
120                     "ifindex": 2,                 120                     "ifindex": 2,
121                     "kind": "htb",                121                     "kind": "htb",
122                     "name": "prefix_matcher.o:    122                     "name": "prefix_matcher.o:[cls_prefix_matcher_htb]",
123                     "id": 111727,                 123                     "id": 111727,
124                     "act": []                     124                     "act": []
125                 },{                               125                 },{
126                     "devname": "eth0",            126                     "devname": "eth0",
127                     "ifindex": 2,                 127                     "ifindex": 2,
128                     "kind": "clsact/ingress",     128                     "kind": "clsact/ingress",
129                     "name": "fbflow_icmp",        129                     "name": "fbflow_icmp",
130                     "id": 130246,                 130                     "id": 130246,
131                     "act": []                     131                     "act": []
132                 },{                               132                 },{
133                     "devname": "eth0",            133                     "devname": "eth0",
134                     "ifindex": 2,                 134                     "ifindex": 2,
135                     "kind": "clsact/egress",      135                     "kind": "clsact/egress",
136                     "name": "prefix_matcher.o:    136                     "name": "prefix_matcher.o:[cls_prefix_matcher_clsact]",
137                     "id": 111726,                 137                     "id": 111726,
138                 },{                               138                 },{
139                     "devname": "eth0",            139                     "devname": "eth0",
140                     "ifindex": 2,                 140                     "ifindex": 2,
141                     "kind": "clsact/egress",      141                     "kind": "clsact/egress",
142                     "name": "cls_fg_dscp",        142                     "name": "cls_fg_dscp",
143                     "id": 108619,                 143                     "id": 108619,
144                     "act": []                     144                     "act": []
145                 },{                               145                 },{
146                     "devname": "eth0",            146                     "devname": "eth0",
147                     "ifindex": 2,                 147                     "ifindex": 2,
148                     "kind": "clsact/egress",      148                     "kind": "clsact/egress",
149                     "name": "fbflow_egress",      149                     "name": "fbflow_egress",
150                     "id": 130245,                 150                     "id": 130245,
151                 }                                 151                 }
152             ]                                     152             ]
153         }                                         153         }
154     ]                                             154     ]
155                                                   155 
156 |                                                 156 |
157 | **# bpftool net attach xdpdrv id 16 dev enp6    157 | **# bpftool net attach xdpdrv id 16 dev enp6s0np0**
158 | **# bpftool net**                               158 | **# bpftool net**
159                                                   159 
160 ::                                                160 ::
161                                                   161 
162       xdp:                                        162       xdp:
163       enp6s0np0(4) driver id 16                   163       enp6s0np0(4) driver id 16
164                                                   164 
165 |                                                 165 |
166 | **# bpftool net attach xdpdrv id 16 dev enp6    166 | **# bpftool net attach xdpdrv id 16 dev enp6s0np0**
167 | **# bpftool net attach xdpdrv id 20 dev enp6    167 | **# bpftool net attach xdpdrv id 20 dev enp6s0np0 overwrite**
168 | **# bpftool net**                               168 | **# bpftool net**
169                                                   169 
170 ::                                                170 ::
171                                                   171 
172       xdp:                                        172       xdp:
173       enp6s0np0(4) driver id 20                   173       enp6s0np0(4) driver id 20
174                                                   174 
175 |                                                 175 |
176 | **# bpftool net attach xdpdrv id 16 dev enp6    176 | **# bpftool net attach xdpdrv id 16 dev enp6s0np0**
177 | **# bpftool net detach xdpdrv dev enp6s0np0*    177 | **# bpftool net detach xdpdrv dev enp6s0np0**
178 | **# bpftool net**                               178 | **# bpftool net**
179                                                   179 
180 ::                                                180 ::
181                                                   181 
182       xdp:                                        182       xdp:
183                                                   183 
184 |                                                 184 |
185 | **# bpftool net attach tcx_ingress name tc_p    185 | **# bpftool net attach tcx_ingress name tc_prog dev lo**
186 | **# bpftool net**                               186 | **# bpftool net**
187 |                                                 187 |
188                                                   188 
189 ::                                                189 ::
190                                                   190 
191       tc:                                         191       tc:
192       lo(1) tcx/ingress tc_prog prog_id 29        192       lo(1) tcx/ingress tc_prog prog_id 29
193                                                   193 
194 |                                                 194 |
195 | **# bpftool net attach tcx_ingress name tc_p    195 | **# bpftool net attach tcx_ingress name tc_prog dev lo**
196 | **# bpftool net detach tcx_ingress dev lo**     196 | **# bpftool net detach tcx_ingress dev lo**
197 | **# bpftool net**                               197 | **# bpftool net**
198 |                                                 198 |
199                                                   199 
200 ::                                                200 ::
201                                                   201 
202       tc:                                         202       tc:
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php