~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/net/fq_band_pktlimit.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0
  3 #
  4 # Verify that FQ has a packet limit per band:
  5 #
  6 # 1. set the limit to 10 per band
  7 # 2. send 20 pkts on band A: verify that 10 are queued, 10 dropped
  8 # 3. send 20 pkts on band A: verify that  0 are queued, 20 dropped
  9 # 4. send 20 pkts on band B: verify that 10 are queued, 10 dropped
 10 #
 11 # Send packets with a delay to ensure that previously sent
 12 # packets are still queued when later ones are sent.
 13 # Use SO_TXTIME for this.
 14 
 15 die() {
 16         echo "$1"
 17         exit 1
 18 }
 19 
 20 # run inside private netns
 21 if [[ $# -eq 0 ]]; then
 22         ./in_netns.sh "$0" __subprocess
 23         exit
 24 fi
 25 
 26 ip link add type dummy
 27 ip link set dev dummy0 up
 28 ip -6 addr add fdaa::1/128 dev dummy0
 29 ip -6 route add fdaa::/64 dev dummy0
 30 tc qdisc replace dev dummy0 root handle 1: fq quantum 1514 initial_quantum 1514 limit 10
 31 
 32 DELAY=400000
 33 
 34 ./cmsg_sender -6 -p u -d "${DELAY}" -n 20 fdaa::2 8000
 35 OUT1="$(tc -s qdisc show dev dummy0 | grep '^\ Sent')"
 36 
 37 ./cmsg_sender -6 -p u -d "${DELAY}" -n 20 fdaa::2 8000
 38 OUT2="$(tc -s qdisc show dev dummy0 | grep '^\ Sent')"
 39 
 40 ./cmsg_sender -6 -p u -d "${DELAY}" -n 20 -P 7 fdaa::2 8000
 41 OUT3="$(tc -s qdisc show dev dummy0 | grep '^\ Sent')"
 42 
 43 # Initial stats will report zero sent, as all packets are still
 44 # queued in FQ. Sleep for at least the delay period and see that
 45 # twenty are now sent.
 46 sleep 0.6
 47 OUT4="$(tc -s qdisc show dev dummy0 | grep '^\ Sent')"
 48 
 49 # Log the output after the test
 50 echo "${OUT1}"
 51 echo "${OUT2}"
 52 echo "${OUT3}"
 53 echo "${OUT4}"
 54 
 55 # Test the output for expected values
 56 echo "${OUT1}" | grep -q '0\ pkt\ (dropped\ 10'  || die "unexpected drop count at 1"
 57 echo "${OUT2}" | grep -q '0\ pkt\ (dropped\ 30'  || die "unexpected drop count at 2"
 58 echo "${OUT3}" | grep -q '0\ pkt\ (dropped\ 40'  || die "unexpected drop count at 3"
 59 echo "${OUT4}" | grep -q '20\ pkt\ (dropped\ 40' || die "unexpected accept count at 4"

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php