@@ -25,6 +25,7 @@ STATEFILE=
2525CMD=
2626NS=
2727XDP_LOADER=./xdp_loader
28+ XDP_STATS=./xdp_stats
2829LEGACY_IP=0
2930USE_VLAN=0
3031RUN_ON_INNER=0
@@ -413,6 +414,14 @@ xdp_unload()
413414 $XDP_LOADER --dev " $NS " --unload " $@ "
414415}
415416
417+ xdp_stats ()
418+ {
419+ get_nsname && ensure_nsname
420+
421+ [ -x " $XDP_STATS " ] || die " Stats tool '$XDP_STATS ' is not executable"
422+ $XDP_STATS --dev " $NS " " $@ "
423+ }
424+
416425usage ()
417426{
418427 local FULL=${1:- }
@@ -452,6 +461,11 @@ usage()
452461 echo " command line options passed after --."
453462 echo " Default: '$XDP_LOADER '"
454463 echo " "
464+ echo " -s, --stats <prog> Specify program to use for getting statistics."
465+ echo " Device name will be passed to it, along with any additional"
466+ echo " command line options passed after --."
467+ echo " Default: '$XDP_STATS '"
468+ echo " "
455469 echo " --legacy-ip Enable legacy IP (IPv4) support."
456470 echo " For setup and reset commands this enables configuration of legacy"
457471 echo " IP addresses on the interface, for the ping command it switches to"
@@ -470,8 +484,8 @@ usage()
470484}
471485
472486
473- OPTS=" hn:gl:"
474- LONGOPTS=" help,name:,gen-new,loader:,legacy-ip,vlan,inner"
487+ OPTS=" hn:gl:s: "
488+ LONGOPTS=" help,name:,gen-new,loader:,stats:, legacy-ip,vlan,inner"
475489
476490OPTIONS=$( getopt -o " $OPTS " --long " $LONGOPTS " -- " $@ " )
477491[ " $? " -ne " 0" ] && usage >&2 || true
@@ -495,6 +509,10 @@ while true; do
495509 XDP_LOADER=" $1 "
496510 shift
497511 ;;
512+ -s | --stats)
513+ XDP_STATS=" $1 "
514+ shift
515+ ;;
498516 -g | --gen-new)
499517 GENERATE_NEW=1
500518 ;;
@@ -522,7 +540,7 @@ case "$1" in
522540 setup|teardown|reset|enter)
523541 CMD=" $1 "
524542 ;;
525- load|unload)
543+ load|unload|stats )
526544 CMD=" xdp_$1 "
527545 ;;
528546 " exec" )
0 commit comments