Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69fe98ed authored by Daniel Borkmann's avatar Daniel Borkmann
Browse files

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: default avatarDaniel Borkmann <daniel@iogearbox.net>
parents 035d808f a827a164
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)
+5 −0
Original line number Diff line number Diff line
@@ -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:
+2 −2
Original line number Diff line number Diff line
@@ -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
===========
+2 −1
Original line number Diff line number Diff line
@@ -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
+66 −6
Original line number Diff line number Diff line
@@ -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
Loading