diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2018-07-10 14:42:58 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-07-11 22:13:33 +0200 |
commit | ba6dd679a3e81af023ec091c2fb7c82003a27316 (patch) | |
tree | 594f63980c71e8ab46b3af7eec80d9bf01abc6c6 /tools/bpf/bpftool/bash-completion | |
parent | 8d1fc3de3d9f9bda0d8ec719d8686e9c5b432573 (diff) | |
download | linux-ba6dd679a3e81af023ec091c2fb7c82003a27316.tar.bz2 |
tools: bpftool: add support for loading programs for offload
Extend the bpftool prog load command to also accept "dev"
parameter, which will allow us to load programs onto devices.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/bpf/bpftool/bash-completion')
-rw-r--r-- | tools/bpf/bpftool/bash-completion/bpftool | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool index ce0bc0cda361..238c2f80092a 100644 --- a/tools/bpf/bpftool/bash-completion/bpftool +++ b/tools/bpf/bpftool/bash-completion/bpftool @@ -99,6 +99,12 @@ _bpftool_get_prog_tags() command sed -n 's/.*"tag": "\(.*\)",$/\1/p' )" -- "$cur" ) ) } +_sysfs_get_netdevs() +{ + COMPREPLY+=( $( compgen -W "$( ls /sys/class/net 2>/dev/null )" -- \ + "$cur" ) ) +} + # For bpftool map update: retrieve type of the map to update. _bpftool_map_update_map_type() { @@ -262,8 +268,21 @@ _bpftool() return 0 ;; load) - _filedir - return 0 + if [[ ${#words[@]} -lt 6 ]]; then + _filedir + return 0 + fi + + case $prev in + dev) + _sysfs_get_netdevs + return 0 + ;; + *) + _bpftool_once_attr 'dev' + return 0 + ;; + esac ;; *) [[ $prev == $object ]] && \ |