[RFC PATCH bpf-next 3/3] bpftool: add document for net attach/detach on tcx subcommand

Tao Chen posted 3 patches 1 year, 6 months ago
There is a newer version of this series
[RFC PATCH bpf-next 3/3] bpftool: add document for net attach/detach on tcx subcommand
Posted by Tao Chen 1 year, 6 months ago
This commit adds sample output for net attach/detach on
tcx subcommand.

Signed-off-by: Tao Chen <chen.dylane@gmail.com>
---
 .../bpf/bpftool/Documentation/bpftool-net.rst | 22 ++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/Documentation/bpftool-net.rst b/tools/bpf/bpftool/Documentation/bpftool-net.rst
index 348812881297..64de7a33f176 100644
--- a/tools/bpf/bpftool/Documentation/bpftool-net.rst
+++ b/tools/bpf/bpftool/Documentation/bpftool-net.rst
@@ -29,7 +29,7 @@ NET COMMANDS
 | **bpftool** **net help**
 |
 | *PROG* := { **id** *PROG_ID* | **pinned** *FILE* | **tag** *PROG_TAG* | **name** *PROG_NAME* }
-| *ATTACH_TYPE* := { **xdp** | **xdpgeneric** | **xdpdrv** | **xdpoffload** }
+| *ATTACH_TYPE* := { **xdp** | **xdpgeneric** | **xdpdrv** | **xdpoffload** | **tcxingress** | **tcxegress** }
 
 DESCRIPTION
 ===========
@@ -69,6 +69,8 @@ bpftool net attach *ATTACH_TYPE* *PROG* dev *NAME* [ overwrite ]
     **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;
+    **tcxingress** - Ingress TC. runs on ingress net traffic;
+    **tcxegress** - Egress TC. runs on egress net traffic;
 
 bpftool net detach *ATTACH_TYPE* dev *NAME*
     Detach bpf program attached to network interface *NAME* with type specified
@@ -178,3 +180,21 @@ EXAMPLES
 ::
 
       xdp:
+
+|
+| **# bpf net attach tcxingress name tc_prog dev lo**
+| **# bpf net**
+|
+
+::
+      tc:
+      lo(1) tcx/ingress tc_prog prog_id 29
+
+|
+| **# bpf net attach tcxingress name tc_prog dev lo**
+| **# bpf net detach tcxingress dev lo**
+| **# bpf net**
+|
+
+::
+      tc:
-- 
2.34.1
Re: [RFC PATCH bpf-next 3/3] bpftool: add document for net attach/detach on tcx subcommand
Posted by Quentin Monnet 1 year, 6 months ago
2024-07-15 12:37 UTC+0100 ~ Tao Chen <chen.dylane@gmail.com>
> This commit adds sample output for net attach/detach on
> tcx subcommand.
> 
> Signed-off-by: Tao Chen <chen.dylane@gmail.com>
> ---
>  .../bpf/bpftool/Documentation/bpftool-net.rst | 22 ++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/bpf/bpftool/Documentation/bpftool-net.rst b/tools/bpf/bpftool/Documentation/bpftool-net.rst
> index 348812881297..64de7a33f176 100644
> --- a/tools/bpf/bpftool/Documentation/bpftool-net.rst
> +++ b/tools/bpf/bpftool/Documentation/bpftool-net.rst
> @@ -29,7 +29,7 @@ NET COMMANDS
>  | **bpftool** **net help**
>  |
>  | *PROG* := { **id** *PROG_ID* | **pinned** *FILE* | **tag** *PROG_TAG* | **name** *PROG_NAME* }
> -| *ATTACH_TYPE* := { **xdp** | **xdpgeneric** | **xdpdrv** | **xdpoffload** }
> +| *ATTACH_TYPE* := { **xdp** | **xdpgeneric** | **xdpdrv** | **xdpoffload** | **tcxingress** | **tcxegress** }
>  
>  DESCRIPTION
>  ===========
> @@ -69,6 +69,8 @@ bpftool net attach *ATTACH_TYPE* *PROG* dev *NAME* [ overwrite ]
>      **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;
> +    **tcxingress** - Ingress TC. runs on ingress net traffic;
> +    **tcxegress** - Egress TC. runs on egress net traffic;


I'd keep "TCX" rather than "TC" in the docs, please, to avoid confusion
with programs attached to clsact qdiscs, for example.