Lines Matching +full:ease +full:- +full:of +full:- +full:use
3 # SPDX-License-Identifier: GPL-2.0
6 # Bash-shell example on using iproute2 tools 'tc' and 'ip' to load
8 # wrappers and even long options parsing is illustrated, for ease of
9 # use.
11 # Related to sample/bpf/xdp2skb_meta_kern.c, which contains BPF-progs
19 [ -z "$TC" ] && TC=tc
20 [ -z "$IP" ] && IP=ip
24 echo "Usage: $0 [-vfh] --dev ethX"
25 echo " -d | --dev : Network device (required)"
26 echo " --flush : Cleanup flush TC and XDP progs"
27 echo " --list : (\$LIST) List TC and XDP progs"
28 echo " -v | --verbose : (\$VERBOSE) Verbose"
29 echo " --dry-run : (\$DRYRUN) Dry-run only (echo commands)"
33 ## -- General shell logging cmds --
42 if [[ -n "$VERBOSE" ]]; then
47 ## -- Helper function calls --
50 # - Will display the offending command on failure
55 if [[ -n "$VERBOSE" ]]; then
58 if [[ -n "$DRYRUN" ]]; then
79 ## --- Parse command line arguments / parameters ---
80 # Using external program "getopt" to get --long-options
81 OPTIONS=$(getopt -o vfhd: \
82 --long verbose,flush,help,list,dev:,dry-run -- "$@")
86 eval set -- "$OPTIONS"
92 -d | --dev ) # device
97 -v | --verbose)
102 --dry-run )
105 info "Dry-run mode: enable VERBOSE and don't call TC+IP" >&2
108 -f | --flush )
112 --list )
116 -- )
120 -h | --help )
132 if [[ ! -e $FILE ]]; then
136 if [[ -z $DEV ]]; then
138 err 2 "Please specify network device -- required option --dev"
141 ## -- Function calls --
156 call_ip link show dev $device | grep --color=auto xdp
183 # Re-attach clsact to clear/flush existing role
199 # Remove XDP prog in-case it's already loaded
200 # TODO: Need ip-link option to override/replace existing XDP prog
207 if [[ -n $FLUSH ]]; then
213 if [[ -n $LIST ]]; then