mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
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:
@@ -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"
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user