netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v3,0/4] tools: bpftool: add net attach/detach command to attach XDP prog
@ 2019-08-07  2:25 Daniel T. Lee
  2019-08-07  2:25 ` [v3,1/4] tools: bpftool: add net attach command to attach XDP on interface Daniel T. Lee
                   ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: Daniel T. Lee @ 2019-08-07  2:25 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov; +Cc: netdev

Currently, bpftool net only supports dumping progs attached on the
interface. To attach XDP prog on interface, user must use other tool
(eg. iproute2). By this patch, with `bpftool net attach/detach`, user
can attach/detach XDP prog on interface.

    # bpftool prog
	16: xdp  name xdp_prog1  tag 539ec6ce11b52f98  gpl
        loaded_at 2019-08-07T08:30:17+0900  uid 0
    ...
	20: xdp  name xdp_fwd_prog  tag b9cb69f121e4a274  gpl
        loaded_at 2019-08-07T08:30:17+0900  uid 0
    
	# bpftool net attach xdpdrv id 16 dev enp6s0np0
    # bpftool net
    xdp:
	enp6s0np0(4) driver id 16
    
	# bpftool net attach xdpdrv id 20 dev enp6s0np0 overwrite
    # bpftool net
    xdp:
	enp6s0np0(4) driver id 20

	# bpftool net detach xdpdrv dev enp6s0np0
    # bpftool net
    xdp:


While this patch only contains support for XDP, through `net
attach/detach`, bpftool can further support other prog attach types.

XDP attach/detach tested on Mellanox ConnectX-4 and Netronome Agilio.

---
Changes in v3:
  - added 'overwrite' option for replacing previously attached XDP prog
  - command argument order has been changed ('ATTACH_TYPE' comes first)
  - add 'dev' keyword in front of <devname>
  - added bash-completion and documentation

Changes in v2:
  - command 'load/unload' changed to 'attach/detach' for the consistency

Daniel T. Lee (4):
  tools: bpftool: add net attach command to attach XDP on interface
  tools: bpftool: add net detach command to detach XDP on interface
  tools: bpftool: add bash-completion for net attach/detach
  tools: bpftool: add documentation for net attach/detach

 .../bpf/bpftool/Documentation/bpftool-net.rst |  51 ++++-
 tools/bpf/bpftool/bash-completion/bpftool     |  64 ++++++-
 tools/bpf/bpftool/net.c                       | 181 ++++++++++++++++--
 3 files changed, 273 insertions(+), 23 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2019-08-09  0:05 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-07  2:25 [v3,0/4] tools: bpftool: add net attach/detach command to attach XDP prog Daniel T. Lee
2019-08-07  2:25 ` [v3,1/4] tools: bpftool: add net attach command to attach XDP on interface Daniel T. Lee
2019-08-07 16:56   ` Y Song
2019-08-07 20:42   ` Jakub Kicinski
2019-08-07 22:15     ` Daniel T. Lee
2019-08-08 17:49       ` Jakub Kicinski
2019-08-08 19:22         ` Daniel T. Lee
2019-08-07  2:25 ` [v3,2/4] tools: bpftool: add net detach command to detach " Daniel T. Lee
2019-08-07 17:02   ` Y Song
2019-08-07 18:30     ` Maciej Fijalkowski
2019-08-07 20:12       ` Y Song
2019-08-07 20:40         ` Maciej Fijalkowski
2019-08-08 19:52           ` Y Song
2019-08-09  0:05             ` Jakub Kicinski
2019-08-07 19:14     ` Jakub Kicinski
2019-08-07  2:25 ` [v3,3/4] tools: bpftool: add bash-completion for net attach/detach Daniel T. Lee
2019-08-08 16:48   ` Quentin Monnet
2019-08-08 19:28     ` Daniel T. Lee
2019-08-07  2:25 ` [v3,4/4] tools: bpftool: add documentation " Daniel T. Lee
2019-08-08 16:48   ` Quentin Monnet
2019-08-08 20:28     ` Daniel T. Lee

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).