1 # SPDX-License-Identifier: GPL-2.0
7 for unit
in bps Kbps Mbps Gbps
; do
8 if (($
(echo "$speed < 1024" |
bc))); then
12 speed
=$
(echo "scale=1; $speed / 1024" |
bc)
22 local interval
=$1; shift
24 echo $
((8 * (t1
- t0
) / interval
))
29 local h_in
=$1; shift # Where the traffic egresses the host
34 $MZ $h_in -p 8000 -A $sip -B $dip -c 0 \
35 -a own
-b $dmac -t udp
-q &
41 # Suppress noise from killing mausezahn.
42 { kill %% && wait %%; } 2>/dev
/null
51 if ((rate
> min
)); then
55 echo "$what $(humanize $ir) < $(humanize $min)" > /dev
/stderr
61 local sw_in
=$1; shift # Where the traffic ingresses the switch
62 local host_in
=$1; shift # Where it ingresses another host
63 local counter
=$1; shift # Counter to use for measurement
70 # Dips in performance might cause momentary ingress rate to drop below
71 # 1Gbps. That wouldn't saturate egress and MC would thus get through,
72 # seemingly winning bandwidth on account of UC. Demand at least 2Gbps
73 # average ingress rate to somewhat mitigate this.
74 local min_ingress
=2147483648
77 local t0
=$
(ethtool_stats_get
$host_in $counter)
78 local u0
=$
(ethtool_stats_get
$sw_in $counter)
80 local t1
=$
(ethtool_stats_get
$host_in $counter)
81 local u1
=$
(ethtool_stats_get
$sw_in $counter)
83 local ir
=$
(rate
$u0 $u1 $interval)
84 local er
=$
(rate
$t0 $t1 $interval)
86 if check_rate
$ir $min_ingress "$what ingress rate"; then
90 # Fail the test if we can't get the throughput.