Merge branch 'bpf-misc-nfp-bpftool-doc-fixes'
Jakub Kicinski says: ==================== First patch in this series fixes applying the relocation to immediate load instructions in the NFP JIT. The remaining patches come from Quentin. Small addition to libbpf makes sure it recognizes all standard section names. Makefile in bpftool/Documentation is improved to explicitly check for rst2man being installed on the system, otherwise we risk installing empty files. Man page for bpftool-map is corrected to include program as a potential value for map of programs. Last two patches are slightly longer, those update bash completions to include this release cycle's additions from Roman. Maybe the use of Fixes tags is slightly frivolous there, but having bash completions which don't cover all commands and options could be disruptive to work flow for users. ==================== Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
Коммит
69fe98edee
|
@ -107,7 +107,7 @@ u16 immed_get_value(u64 instr)
|
|||
if (!unreg_is_imm(reg))
|
||||
reg = FIELD_GET(OP_IMMED_B_SRC, instr);
|
||||
|
||||
return (reg & 0xff) | FIELD_GET(OP_IMMED_IMM, instr);
|
||||
return (reg & 0xff) | FIELD_GET(OP_IMMED_IMM, instr) << 8;
|
||||
}
|
||||
|
||||
void immed_set_value(u64 *instr, u16 immed)
|
||||
|
|
|
@ -23,7 +23,12 @@ DOC_MAN8 = $(addprefix $(OUTPUT),$(_DOC_MAN8))
|
|||
man: man8
|
||||
man8: $(DOC_MAN8)
|
||||
|
||||
RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
|
||||
|
||||
$(OUTPUT)%.8: %.rst
|
||||
ifndef RST2MAN_DEP
|
||||
$(error "rst2man not found, but required to generate man pages")
|
||||
endif
|
||||
$(QUIET_GEN)rst2man $< > $@
|
||||
|
||||
clean:
|
||||
|
|
|
@ -26,8 +26,8 @@ MAP COMMANDS
|
|||
| **bpftool** **cgroup help**
|
||||
|
|
||||
| *PROG* := { **id** *PROG_ID* | **pinned** *FILE* | **tag** *PROG_TAG* }
|
||||
| *ATTACH_TYPE* := { *ingress* | *egress* | *sock_create* | *sock_ops* | *device* }
|
||||
| *ATTACH_FLAGS* := { *multi* | *override* }
|
||||
| *ATTACH_TYPE* := { **ingress** | **egress** | **sock_create** | **sock_ops** | **device** }
|
||||
| *ATTACH_FLAGS* := { **multi** | **override** }
|
||||
|
||||
DESCRIPTION
|
||||
===========
|
||||
|
|
|
@ -31,7 +31,8 @@ MAP COMMANDS
|
|||
| **bpftool** **map help**
|
||||
|
|
||||
| *MAP* := { **id** *MAP_ID* | **pinned** *FILE* }
|
||||
| *VALUE* := { *BYTES* | *MAP* | *PROGRAM* }
|
||||
| *PROG* := { **id** *PROG_ID* | **pinned** *FILE* | **tag** *PROG_TAG* }
|
||||
| *VALUE* := { *BYTES* | *MAP* | *PROG* }
|
||||
| *UPDATE_FLAGS* := { **any** | **exist** | **noexist** }
|
||||
|
||||
DESCRIPTION
|
||||
|
|
|
@ -52,16 +52,24 @@ _bpftool_once_attr()
|
|||
done
|
||||
}
|
||||
|
||||
# Takes a list of words in argument; adds them all to COMPREPLY if none of them
|
||||
# is already present on the command line. Returns no value.
|
||||
_bpftool_one_of_list()
|
||||
# Takes a list of words as argument; if any of those words is present on the
|
||||
# command line, return 0. Otherwise, return 1.
|
||||
_bpftool_search_list()
|
||||
{
|
||||
local w idx
|
||||
for w in $*; do
|
||||
for (( idx=3; idx < ${#words[@]}-1; idx++ )); do
|
||||
[[ $w == ${words[idx]} ]] && return 1
|
||||
[[ $w == ${words[idx]} ]] && return 0
|
||||
done
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# Takes a list of words in argument; adds them all to COMPREPLY if none of them
|
||||
# is already present on the command line. Returns no value.
|
||||
_bpftool_one_of_list()
|
||||
{
|
||||
_bpftool_search_list $* && return 1
|
||||
COMPREPLY+=( $( compgen -W "$*" -- "$cur" ) )
|
||||
}
|
||||
|
||||
|
@ -230,10 +238,14 @@ _bpftool()
|
|||
fi
|
||||
return 0
|
||||
;;
|
||||
load)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
[[ $prev == $object ]] && \
|
||||
COMPREPLY=( $( compgen -W 'dump help pin show list' -- \
|
||||
"$cur" ) )
|
||||
COMPREPLY=( $( compgen -W 'dump help pin load \
|
||||
show list' -- "$cur" ) )
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
@ -347,6 +359,54 @@ _bpftool()
|
|||
;;
|
||||
esac
|
||||
;;
|
||||
cgroup)
|
||||
case $command in
|
||||
show|list)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
attach|detach)
|
||||
local ATTACH_TYPES='ingress egress sock_create sock_ops \
|
||||
device'
|
||||
local ATTACH_FLAGS='multi override'
|
||||
local PROG_TYPE='id pinned tag'
|
||||
case $prev in
|
||||
$command)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
ingress|egress|sock_create|sock_ops|device)
|
||||
COMPREPLY=( $( compgen -W "$PROG_TYPE" -- \
|
||||
"$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
id)
|
||||
_bpftool_get_prog_ids
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
if ! _bpftool_search_list "$ATTACH_TYPES"; then
|
||||
COMPREPLY=( $( compgen -W "$ATTACH_TYPES" -- \
|
||||
"$cur" ) )
|
||||
elif [[ "$command" == "attach" ]]; then
|
||||
# We have an attach type on the command line,
|
||||
# but it is not the previous word, or
|
||||
# "id|pinned|tag" (we already checked for
|
||||
# that). This should only leave the case when
|
||||
# we need attach flags for "attach" commamnd.
|
||||
_bpftool_one_of_list "$ATTACH_FLAGS"
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
[[ $prev == $object ]] && \
|
||||
COMPREPLY=( $( compgen -W 'help attach detach \
|
||||
show list' -- "$cur" ) )
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
} &&
|
||||
complete -F _bpftool bpftool
|
||||
|
|
|
@ -1816,12 +1816,17 @@ static const struct {
|
|||
BPF_PROG_SEC("socket", BPF_PROG_TYPE_SOCKET_FILTER),
|
||||
BPF_PROG_SEC("kprobe/", BPF_PROG_TYPE_KPROBE),
|
||||
BPF_PROG_SEC("kretprobe/", BPF_PROG_TYPE_KPROBE),
|
||||
BPF_PROG_SEC("classifier", BPF_PROG_TYPE_SCHED_CLS),
|
||||
BPF_PROG_SEC("action", BPF_PROG_TYPE_SCHED_ACT),
|
||||
BPF_PROG_SEC("tracepoint/", BPF_PROG_TYPE_TRACEPOINT),
|
||||
BPF_PROG_SEC("xdp", BPF_PROG_TYPE_XDP),
|
||||
BPF_PROG_SEC("perf_event", BPF_PROG_TYPE_PERF_EVENT),
|
||||
BPF_PROG_SEC("cgroup/skb", BPF_PROG_TYPE_CGROUP_SKB),
|
||||
BPF_PROG_SEC("cgroup/sock", BPF_PROG_TYPE_CGROUP_SOCK),
|
||||
BPF_PROG_SEC("cgroup/dev", BPF_PROG_TYPE_CGROUP_DEVICE),
|
||||
BPF_PROG_SEC("lwt_in", BPF_PROG_TYPE_LWT_IN),
|
||||
BPF_PROG_SEC("lwt_out", BPF_PROG_TYPE_LWT_OUT),
|
||||
BPF_PROG_SEC("lwt_xmit", BPF_PROG_TYPE_LWT_XMIT),
|
||||
BPF_PROG_SEC("sockops", BPF_PROG_TYPE_SOCK_OPS),
|
||||
BPF_PROG_SEC("sk_skb", BPF_PROG_TYPE_SK_SKB),
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче