* [PATCH v2 bpf-nxt] Documentation/bpf: Add heading and example for extensions in filter.rst @ 2021-07-12 17:37 ` Roy, UjjaL 2021-07-14 0:20 ` John Fastabend 0 siblings, 1 reply; 4+ messages in thread From: Roy, UjjaL @ 2021-07-12 17:37 UTC (permalink / raw) To: Song Liu, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, David S . Miller, Jakub Kicinski, Jonathan Corbet, Paul Walmsley, Palmer Dabbelt, Albert Ou, Nathan Chancellor, Nick Desaulniers Cc: Networking, BPF, Linux Doc Mailing List, open list, linux-riscv, clang-built-linux [1] https://www.kernel.org/doc/html/latest/bpf/ Add new heading for extensions to make it more readable. Also, add one more example of filtering interface index for better understanding. Signed-off-by: Roy, UjjaL <royujjal@gmail.com> Acked-by: Song Liu <songliubraving@fb.com> --- Documentation/networking/filter.rst | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Documentation/networking/filter.rst b/Documentation/networking/filter.rst index 3e2221f4abe4..5f13905b12e0 100644 --- a/Documentation/networking/filter.rst +++ b/Documentation/networking/filter.rst @@ -320,13 +320,6 @@ Examples for low-level BPF: ret #-1 drop: ret #0 -**(Accelerated) VLAN w/ id 10**:: - - ld vlan_tci - jneq #10, drop - ret #-1 - drop: ret #0 - **icmp random packet sampling, 1 in 4**:: ldh [12] @@ -358,6 +351,22 @@ Examples for low-level BPF: bad: ret #0 /* SECCOMP_RET_KILL_THREAD */ good: ret #0x7fff0000 /* SECCOMP_RET_ALLOW */ +Examples for low-level BPF extension: + +**Packet for interface index 13**:: + + ld ifidx + jneq #13, drop + ret #-1 + drop: ret #0 + +**(Accelerated) VLAN w/ id 10**:: + + ld vlan_tci + jneq #10, drop + ret #-1 + drop: ret #0 + The above example code can be placed into a file (here called "foo"), and then be passed to the bpf_asm tool for generating opcodes, output that xt_bpf and cls_bpf understands and can directly be loaded with. Example with above -- 2.17.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH v2 bpf-nxt] Documentation/bpf: Add heading and example for extensions in filter.rst 2021-07-12 17:37 ` [PATCH v2 bpf-nxt] Documentation/bpf: Add heading and example for extensions in filter.rst Roy, UjjaL @ 2021-07-14 0:20 ` John Fastabend 2021-07-16 1:48 ` Alexei Starovoitov 0 siblings, 1 reply; 4+ messages in thread From: John Fastabend @ 2021-07-14 0:20 UTC (permalink / raw) To: Roy, UjjaL, Song Liu, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, David S . Miller, Jakub Kicinski, Jonathan Corbet, Paul Walmsley, Palmer Dabbelt, Albert Ou, Nathan Chancellor, Nick Desaulniers Cc: Networking, BPF, Linux Doc Mailing List, open list, linux-riscv, clang-built-linux Roy, UjjaL wrote: > [1] https://www.kernel.org/doc/html/latest/bpf/ > > Add new heading for extensions to make it more readable. Also, add one > more example of filtering interface index for better understanding. > > Signed-off-by: Roy, UjjaL <royujjal@gmail.com> > Acked-by: Song Liu <songliubraving@fb.com> Looks OK to me. I thought the original was readable without the header, but if it helps someone seems easy enough to do. Acked-by: John Fastabend <john.fastabend@gmail.com> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 bpf-nxt] Documentation/bpf: Add heading and example for extensions in filter.rst 2021-07-14 0:20 ` John Fastabend @ 2021-07-16 1:48 ` Alexei Starovoitov 2021-07-16 20:12 ` Daniel Borkmann 0 siblings, 1 reply; 4+ messages in thread From: Alexei Starovoitov @ 2021-07-16 1:48 UTC (permalink / raw) To: John Fastabend Cc: Roy, UjjaL, Song Liu, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song, KP Singh, David S . Miller, Jakub Kicinski, Jonathan Corbet, Paul Walmsley, Palmer Dabbelt, Albert Ou, Nathan Chancellor, Nick Desaulniers, Networking, BPF, Linux Doc Mailing List, open list, linux-riscv, Clang-Built-Linux ML On Tue, Jul 13, 2021 at 5:20 PM John Fastabend <john.fastabend@gmail.com> wrote: > > Roy, UjjaL wrote: > > [1] https://www.kernel.org/doc/html/latest/bpf/ > > > > Add new heading for extensions to make it more readable. Also, add one > > more example of filtering interface index for better understanding. > > > > Signed-off-by: Roy, UjjaL <royujjal@gmail.com> > > Acked-by: Song Liu <songliubraving@fb.com> > > Looks OK to me. I thought the original was readable without the header, but > if it helps someone seems easy enough to do. > > Acked-by: John Fastabend <john.fastabend@gmail.com> I cannot figure out how to apply this patch, because I see: Applying: Documentation/bpf: Add heading and example for extensions in filter.rst fatal: empty ident name (for <>) not allowed Any idea? ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 bpf-nxt] Documentation/bpf: Add heading and example for extensions in filter.rst 2021-07-16 1:48 ` Alexei Starovoitov @ 2021-07-16 20:12 ` Daniel Borkmann 0 siblings, 0 replies; 4+ messages in thread From: Daniel Borkmann @ 2021-07-16 20:12 UTC (permalink / raw) To: Alexei Starovoitov, John Fastabend Cc: Roy, UjjaL, Song Liu, Alexei Starovoitov, Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song, KP Singh, David S . Miller, Jakub Kicinski, Jonathan Corbet, Paul Walmsley, Palmer Dabbelt, Albert Ou, Nathan Chancellor, Nick Desaulniers, Networking, BPF, Linux Doc Mailing List, open list, linux-riscv, Clang-Built-Linux ML On 7/16/21 3:48 AM, Alexei Starovoitov wrote: > On Tue, Jul 13, 2021 at 5:20 PM John Fastabend <john.fastabend@gmail.com> wrote: >> >> Roy, UjjaL wrote: >>> [1] https://www.kernel.org/doc/html/latest/bpf/ >>> >>> Add new heading for extensions to make it more readable. Also, add one >>> more example of filtering interface index for better understanding. >>> >>> Signed-off-by: Roy, UjjaL <royujjal@gmail.com> >>> Acked-by: Song Liu <songliubraving@fb.com> >> >> Looks OK to me. I thought the original was readable without the header, but >> if it helps someone seems easy enough to do. >> >> Acked-by: John Fastabend <john.fastabend@gmail.com> > > I cannot figure out how to apply this patch, because I see: > Applying: Documentation/bpf: Add heading and example for extensions in > filter.rst > fatal: empty ident name (for <>) not allowed > > Any idea? Same happened on my side. Maybe not sent via git-send-email(1)? Anyway, I've applied manually meanwhile. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-16 20:13 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <"Roy, UjjaL" <royujjal@gmail.com> 2021-07-12 17:37 ` [PATCH v2 bpf-nxt] Documentation/bpf: Add heading and example for extensions in filter.rst Roy, UjjaL 2021-07-14 0:20 ` John Fastabend 2021-07-16 1:48 ` Alexei Starovoitov 2021-07-16 20:12 ` Daniel Borkmann
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).