Skip to content

Commit 69fe98e

Browse files
committed
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 <[email protected]>
2 parents 035d808 + a827a16 commit 69fe98e

File tree

6 files changed

+81
-10
lines changed

6 files changed

+81
-10
lines changed

drivers/net/ethernet/netronome/nfp/nfp_asm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ u16 immed_get_value(u64 instr)
107107
if (!unreg_is_imm(reg))
108108
reg = FIELD_GET(OP_IMMED_B_SRC, instr);
109109

110-
return (reg & 0xff) | FIELD_GET(OP_IMMED_IMM, instr);
110+
return (reg & 0xff) | FIELD_GET(OP_IMMED_IMM, instr) << 8;
111111
}
112112

113113
void immed_set_value(u64 *instr, u16 immed)

tools/bpf/bpftool/Documentation/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ DOC_MAN8 = $(addprefix $(OUTPUT),$(_DOC_MAN8))
2323
man: man8
2424
man8: $(DOC_MAN8)
2525

26+
RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
27+
2628
$(OUTPUT)%.8: %.rst
29+
ifndef RST2MAN_DEP
30+
$(error "rst2man not found, but required to generate man pages")
31+
endif
2732
$(QUIET_GEN)rst2man $< > $@
2833

2934
clean:

tools/bpf/bpftool/Documentation/bpftool-cgroup.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ MAP COMMANDS
2626
| **bpftool** **cgroup help**
2727
|
2828
| *PROG* := { **id** *PROG_ID* | **pinned** *FILE* | **tag** *PROG_TAG* }
29-
| *ATTACH_TYPE* := { *ingress* | *egress* | *sock_create* | *sock_ops* | *device* }
30-
| *ATTACH_FLAGS* := { *multi* | *override* }
29+
| *ATTACH_TYPE* := { **ingress** | **egress** | **sock_create** | **sock_ops** | **device** }
30+
| *ATTACH_FLAGS* := { **multi** | **override** }
3131
3232
DESCRIPTION
3333
===========

tools/bpf/bpftool/Documentation/bpftool-map.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ MAP COMMANDS
3131
| **bpftool** **map help**
3232
|
3333
| *MAP* := { **id** *MAP_ID* | **pinned** *FILE* }
34-
| *VALUE* := { *BYTES* | *MAP* | *PROGRAM* }
34+
| *PROG* := { **id** *PROG_ID* | **pinned** *FILE* | **tag** *PROG_TAG* }
35+
| *VALUE* := { *BYTES* | *MAP* | *PROG* }
3536
| *UPDATE_FLAGS* := { **any** | **exist** | **noexist** }
3637
3738
DESCRIPTION

tools/bpf/bpftool/bash-completion/bpftool

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,24 @@ _bpftool_once_attr()
5252
done
5353
}
5454

55-
# Takes a list of words in argument; adds them all to COMPREPLY if none of them
56-
# is already present on the command line. Returns no value.
57-
_bpftool_one_of_list()
55+
# Takes a list of words as argument; if any of those words is present on the
56+
# command line, return 0. Otherwise, return 1.
57+
_bpftool_search_list()
5858
{
5959
local w idx
6060
for w in $*; do
6161
for (( idx=3; idx < ${#words[@]}-1; idx++ )); do
62-
[[ $w == ${words[idx]} ]] && return 1
62+
[[ $w == ${words[idx]} ]] && return 0
6363
done
6464
done
65+
return 1
66+
}
67+
68+
# Takes a list of words in argument; adds them all to COMPREPLY if none of them
69+
# is already present on the command line. Returns no value.
70+
_bpftool_one_of_list()
71+
{
72+
_bpftool_search_list $* && return 1
6573
COMPREPLY+=( $( compgen -W "$*" -- "$cur" ) )
6674
}
6775

@@ -230,10 +238,14 @@ _bpftool()
230238
fi
231239
return 0
232240
;;
241+
load)
242+
_filedir
243+
return 0
244+
;;
233245
*)
234246
[[ $prev == $object ]] && \
235-
COMPREPLY=( $( compgen -W 'dump help pin show list' -- \
236-
"$cur" ) )
247+
COMPREPLY=( $( compgen -W 'dump help pin load \
248+
show list' -- "$cur" ) )
237249
;;
238250
esac
239251
;;
@@ -347,6 +359,54 @@ _bpftool()
347359
;;
348360
esac
349361
;;
362+
cgroup)
363+
case $command in
364+
show|list)
365+
_filedir
366+
return 0
367+
;;
368+
attach|detach)
369+
local ATTACH_TYPES='ingress egress sock_create sock_ops \
370+
device'
371+
local ATTACH_FLAGS='multi override'
372+
local PROG_TYPE='id pinned tag'
373+
case $prev in
374+
$command)
375+
_filedir
376+
return 0
377+
;;
378+
ingress|egress|sock_create|sock_ops|device)
379+
COMPREPLY=( $( compgen -W "$PROG_TYPE" -- \
380+
"$cur" ) )
381+
return 0
382+
;;
383+
id)
384+
_bpftool_get_prog_ids
385+
return 0
386+
;;
387+
*)
388+
if ! _bpftool_search_list "$ATTACH_TYPES"; then
389+
COMPREPLY=( $( compgen -W "$ATTACH_TYPES" -- \
390+
"$cur" ) )
391+
elif [[ "$command" == "attach" ]]; then
392+
# We have an attach type on the command line,
393+
# but it is not the previous word, or
394+
# "id|pinned|tag" (we already checked for
395+
# that). This should only leave the case when
396+
# we need attach flags for "attach" commamnd.
397+
_bpftool_one_of_list "$ATTACH_FLAGS"
398+
fi
399+
return 0
400+
;;
401+
esac
402+
;;
403+
*)
404+
[[ $prev == $object ]] && \
405+
COMPREPLY=( $( compgen -W 'help attach detach \
406+
show list' -- "$cur" ) )
407+
;;
408+
esac
409+
;;
350410
esac
351411
} &&
352412
complete -F _bpftool bpftool

tools/lib/bpf/libbpf.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,12 +1816,17 @@ static const struct {
18161816
BPF_PROG_SEC("socket", BPF_PROG_TYPE_SOCKET_FILTER),
18171817
BPF_PROG_SEC("kprobe/", BPF_PROG_TYPE_KPROBE),
18181818
BPF_PROG_SEC("kretprobe/", BPF_PROG_TYPE_KPROBE),
1819+
BPF_PROG_SEC("classifier", BPF_PROG_TYPE_SCHED_CLS),
1820+
BPF_PROG_SEC("action", BPF_PROG_TYPE_SCHED_ACT),
18191821
BPF_PROG_SEC("tracepoint/", BPF_PROG_TYPE_TRACEPOINT),
18201822
BPF_PROG_SEC("xdp", BPF_PROG_TYPE_XDP),
18211823
BPF_PROG_SEC("perf_event", BPF_PROG_TYPE_PERF_EVENT),
18221824
BPF_PROG_SEC("cgroup/skb", BPF_PROG_TYPE_CGROUP_SKB),
18231825
BPF_PROG_SEC("cgroup/sock", BPF_PROG_TYPE_CGROUP_SOCK),
18241826
BPF_PROG_SEC("cgroup/dev", BPF_PROG_TYPE_CGROUP_DEVICE),
1827+
BPF_PROG_SEC("lwt_in", BPF_PROG_TYPE_LWT_IN),
1828+
BPF_PROG_SEC("lwt_out", BPF_PROG_TYPE_LWT_OUT),
1829+
BPF_PROG_SEC("lwt_xmit", BPF_PROG_TYPE_LWT_XMIT),
18251830
BPF_PROG_SEC("sockops", BPF_PROG_TYPE_SOCK_OPS),
18261831
BPF_PROG_SEC("sk_skb", BPF_PROG_TYPE_SK_SKB),
18271832
};

0 commit comments

Comments
 (0)