Add params for choosing other bpf object files

Default to edt_pacer02.o

Signed-off-by: Jesper Dangaard Brouer <netoptimizer@brouer.com>
This commit is contained in:
Jesper Dangaard Brouer
2020-11-08 14:52:36 +01:00
parent 42c1c99799
commit f98780e588
2 changed files with 12 additions and 3 deletions

View File

@@ -13,8 +13,11 @@ source ${basedir}/parameters.sh
export TC=/sbin/tc
# TODO: take this as input
BPF_OBJ=edt_pacer01.o
# This can be changed via --file or --obj
if [[ -z ${BPF_OBJ} ]]; then
# Fallback default
BPF_OBJ=edt_pacer02.o
fi
info "Applying TC-BPF egress setup on device: $DEV with object file: $BPF_OBJ"

View File

@@ -14,12 +14,13 @@ function usage() {
echo " --dry-run : (\$DRYRUN) Dry-run only (echo tc commands)"
echo " -s | --stats : (\$STATS_ONLY) Call TC statistics command"
echo " -l | --list : (\$LIST) List TC filter setup after setup"
echo " --file | --obj : (\$BPF_OBJ) BPF-object file to load"
echo ""
}
# Using external program "getopt" to get --long-options
OPTIONS=$(getopt -o vshd:l \
--long verbose,dry-run,remove,stats,list,help,dev: -- "$@")
--long verbose,dry-run,remove,stats,list,help,dev:,file:,obj: -- "$@")
if (( $? != 0 )); then
usage
err 2 "Error calling getopt"
@@ -34,6 +35,11 @@ while true; do
info "Device set to: DEV=$DEV" >&2
shift 2
;;
--file | --obj )
export BPF_OBJ=$2
info "BPF-object file: $BPF_OBJ" >&2
shift 2
;;
-v | --verbose)
export VERBOSE=yes
# info "Verbose mode: VERBOSE=$VERBOSE" >&2