Re: [bpf-next v6 2/3] bpftool: Update doc (add autoattach to prog load)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/24/22 12:13 PM, Wang Yufen wrote:
Add autoattach optional to prog load|loadall for supporting
one-step load-attach-pin_link.

Signed-off-by: Wang Yufen <wangyufen@xxxxxxxxxx>
---
  tools/bpf/bpftool/Documentation/bpftool-prog.rst | 13 +++++++++++--
  1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/bpf/bpftool/Documentation/bpftool-prog.rst b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
index eb1b2a254eb1..2d9f27a0120f 100644
--- a/tools/bpf/bpftool/Documentation/bpftool-prog.rst
+++ b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
@@ -31,7 +31,7 @@ PROG COMMANDS
  |	**bpftool** **prog dump xlated** *PROG* [{**file** *FILE* | **opcodes** | **visual** | **linum**}]
  |	**bpftool** **prog dump jited**  *PROG* [{**file** *FILE* | **opcodes** | **linum**}]
  |	**bpftool** **prog pin** *PROG* *FILE*
-|	**bpftool** **prog** { **load** | **loadall** } *OBJ* *PATH* [**type** *TYPE*] [**map** {**idx** *IDX* | **name** *NAME*} *MAP*] [**dev** *NAME*] [**pinmaps** *MAP_DIR*]
+|	**bpftool** **prog** { **load** | **loadall** } *OBJ* *PATH* [**type** *TYPE*] [**map** {**idx** *IDX* | **name** *NAME*} *MAP*] [**dev** *NAME*] [**pinmaps** *MAP_DIR*] [**autoattach**]
  |	**bpftool** **prog attach** *PROG* *ATTACH_TYPE* [*MAP*]
  |	**bpftool** **prog detach** *PROG* *ATTACH_TYPE* [*MAP*]
  |	**bpftool** **prog tracelog**
@@ -131,7 +131,7 @@ DESCRIPTION
  		  contain a dot character ('.'), which is reserved for future
  		  extensions of *bpffs*.
- **bpftool prog { load | loadall }** *OBJ* *PATH* [**type** *TYPE*] [**map** {**idx** *IDX* | **name** *NAME*} *MAP*] [**dev** *NAME*] [**pinmaps** *MAP_DIR*]
+	**bpftool prog { load | loadall }** *OBJ* *PATH* [**type** *TYPE*] [**map** {**idx** *IDX* | **name** *NAME*} *MAP*] [**dev** *NAME*] [**pinmaps** *MAP_DIR*] [**autoattach**]
  		  Load bpf program(s) from binary *OBJ* and pin as *PATH*.
  		  **bpftool prog load** pins only the first program from the
  		  *OBJ* as *PATH*. **bpftool prog loadall** pins all programs
@@ -150,6 +150,15 @@ DESCRIPTION
  		  Optional **pinmaps** argument can be provided to pin all
  		  maps under *MAP_DIR* directory.
+ If **autoattach** is specified program will be attached
+		  before pin. In that case, only the link (representing the
+		  program attached to its hook) is pinned, not the program as
+		  such, so the path won't show in "**bpftool prog show -f**",
+		  only show in "**bpftool link show -f**". Also, this only works
+		  when bpftool (libbpf) is able to infer all necessary information
+		  from the objectfile, in particular, it's not supported for all
+		  program types.

Related to Quentin's comment, the documentation should also describe clear semantics
on what happens in failure case. I presume the use case you have in mind is to use
this facility for scripts e.g. to run/load some tests objs? Thus would be good to describe
to users what they need to do/clean up when things only partially succeed etc..

  		  Note: *PATH* must be located in *bpffs* mount. It must not
  		  contain a dot character ('.'), which is reserved for future
  		  extensions of *bpffs*.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux