__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Test qdisc offload indication
ALL_TESTS="
test_root
test_port_tbf
test_etsprio
test_etsprio_port_tbf
"
NUM_NETIFS=1
lib_dir=$(dirname $0)/../../../net/forwarding
source $lib_dir/lib.sh
check_not_offloaded()
{
local handle=$1; shift
local h
local offloaded
h=$(qdisc_stats_get $h1 "$handle" .handle)
[[ $h == '"'$handle'"' ]]
check_err $? "Qdisc with handle $handle does not exist"
offloaded=$(qdisc_stats_get $h1 "$handle" .offloaded)
[[ $offloaded == true ]]
check_fail $? "Qdisc with handle $handle offloaded, but should not be"
}
check_all_offloaded()
{
local handle=$1; shift
if [[ ! -z $handle ]]; then
local offloaded=$(qdisc_stats_get $h1 "$handle" .offloaded)
[[ $offloaded == true ]]
check_err $? "Qdisc with handle $handle not offloaded"
fi
local unoffloaded=$(tc q sh dev $h1 invisible |
grep -v offloaded |
sed s/root/parent\ root/ |
cut -d' ' -f 5)
[[ -z $unoffloaded ]]
check_err $? "Qdiscs with following parents not offloaded: $unoffloaded"
pre_cleanup
}
with_ets()
{
local handle=$1; shift
local locus=$1; shift
tc qdisc add dev $h1 $locus handle $handle \
ets bands 8 priomap 7 6 5 4 3 2 1 0
"$@"
tc qdisc del dev $h1 $locus
}
with_prio()
{
local handle=$1; shift
local locus=$1; shift
tc qdisc add dev $h1 $locus handle $handle \
prio bands 8 priomap 7 6 5 4 3 2 1 0
"$@"
tc qdisc del dev $h1 $locus
}
with_red()
{
local handle=$1; shift
local locus=$1; shift
tc qdisc add dev $h1 $locus handle $handle \
red limit 1000000 min 200000 max 300000 probability 0.5 avpkt 1500
"$@"
tc qdisc del dev $h1 $locus
}
with_tbf()
{
local handle=$1; shift
local locus=$1; shift
tc qdisc add dev $h1 $locus handle $handle \
tbf rate 400Mbit burst 128K limit 1M
"$@"
tc qdisc del dev $h1 $locus
}
with_pfifo()
{
local handle=$1; shift
local locus=$1; shift
tc qdisc add dev $h1 $locus handle $handle pfifo limit 100K
"$@"
tc qdisc del dev $h1 $locus
}
with_bfifo()
{
local handle=$1; shift
local locus=$1; shift
tc qdisc add dev $h1 $locus handle $handle bfifo limit 100K
"$@"
tc qdisc del dev $h1 $locus
}
with_drr()
{
local handle=$1; shift
local locus=$1; shift
tc qdisc add dev $h1 $locus handle $handle drr
"$@"
tc qdisc del dev $h1 $locus
}
with_qdiscs()
{
local handle=$1; shift
local parent=$1; shift
local kind=$1; shift
local next_handle=$((handle * 2))
local locus;
if [[ $kind == "--" ]]; then
local cmd=$1; shift
$cmd $(printf %x: $parent) "$@"
else
if ((parent == 0)); then
locus=root
else
locus=$(printf "parent %x:1" $parent)
fi
with_$kind $(printf %x: $handle) "$locus" \
with_qdiscs $next_handle $handle "$@"
fi
}
get_name()
{
local parent=$1; shift
local name=$(echo "" "${@^^}" | tr ' ' -)
if ((parent != 0)); then
kind=$(qdisc_stats_get $h1 $parent: .kind)
kind=${kind%\"}
kind=${kind#\"}
name="-${kind^^}$name"
fi
echo root$name
}
do_test_offloaded()
{
local handle=$1; shift
local parent=$1; shift
RET=0
with_qdiscs $handle $parent "$@" -- check_all_offloaded
log_test $(get_name $parent "$@")" offloaded"
}
do_test_nooffload()
{
local handle=$1; shift
local parent=$1; shift
local name=$(echo "${@^^}" | tr ' ' -)
local kind
RET=0
with_qdiscs $handle $parent "$@" -- check_not_offloaded
log_test $(get_name $parent "$@")" not offloaded"
}
do_test_combinations()
{
local handle=$1; shift
local parent=$1; shift
local cont
local leaf
local fifo
for cont in "" ets prio; do
for leaf in "" red tbf "red tbf" "tbf red"; do
for fifo in "" pfifo bfifo; do
if [[ -z "$cont$leaf$fifo" ]]; then
continue
fi
do_test_offloaded $handle $parent \
$cont $leaf $fifo
done
done
done
for cont in ets prio; do
for leaf in red tbf; do
do_test_nooffload $handle $parent $cont red tbf $leaf
do_test_nooffload $handle $parent $cont tbf red $leaf
done
for leaf in "red red" "tbf tbf"; do
do_test_nooffload $handle $parent $cont $leaf
done
done
do_test_nooffload $handle $parent drr
}
test_root()
{
do_test_combinations 1 0
}
test_port_tbf()
{
with_tbf 1: root \
do_test_combinations 8 1
}
do_test_etsprio()
{
local parent=$1; shift
local tbfpfx=$1; shift
local cont
for cont in ets prio; do
RET=0
with_$cont 8: "$parent" \
with_red 11: "parent 8:1" \
with_red 12: "parent 8:2" \
with_tbf 13: "parent 8:3" \
with_tbf 14: "parent 8:4" \
check_all_offloaded
log_test "root$tbfpfx-ETS-{RED,TBF} offloaded"
RET=0
with_$cont 8: "$parent" \
with_red 81: "parent 8:1" \
with_tbf 811: "parent 81:1" \
with_tbf 84: "parent 8:4" \
with_red 841: "parent 84:1" \
check_all_offloaded
log_test "root$tbfpfx-ETS-{RED-TBF,TBF-RED} offloaded"
RET=0
with_$cont 8: "$parent" \
with_red 81: "parent 8:1" \
with_tbf 811: "parent 81:1" \
with_bfifo 8111: "parent 811:1" \
with_tbf 82: "parent 8:2" \
with_red 821: "parent 82:1" \
with_bfifo 8211: "parent 821:1" \
check_all_offloaded
log_test "root$tbfpfx-ETS-{RED-TBF-bFIFO,TBF-RED-bFIFO} offloaded"
done
}
test_etsprio()
{
do_test_etsprio root ""
}
test_etsprio_port_tbf()
{
with_tbf 1: root \
do_test_etsprio "parent 1:1" "-TBF"
}
cleanup()
{
tc qdisc del dev $h1 root &>/dev/null
}
trap cleanup EXIT
h1=${NETIFS[p1]}
tests_run
exit $EXIT_STATUS
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| spectrum | Folder | 0755 |
|
|
| spectrum-2 | Folder | 0755 |
|
|
| blackhole_routes.sh | File | 4.96 KB | 0755 |
|
| devlink_linecard.sh | File | 7.5 KB | 0755 |
|
| devlink_trap.sh | File | 1.86 KB | 0755 |
|
| devlink_trap_acl_drops.sh | File | 2.4 KB | 0755 |
|
| devlink_trap_control.sh | File | 18.22 KB | 0755 |
|
| devlink_trap_l2_drops.sh | File | 12.87 KB | 0755 |
|
| devlink_trap_l3_drops.sh | File | 16.38 KB | 0755 |
|
| devlink_trap_l3_exceptions.sh | File | 13.64 KB | 0755 |
|
| devlink_trap_policer.sh | File | 9.75 KB | 0755 |
|
| devlink_trap_tunnel_ipip.sh | File | 5.24 KB | 0755 |
|
| devlink_trap_tunnel_ipip6.sh | File | 5.31 KB | 0755 |
|
| devlink_trap_tunnel_vxlan.sh | File | 8.84 KB | 0755 |
|
| devlink_trap_tunnel_vxlan_ipv6.sh | File | 9.32 KB | 0755 |
|
| egress_vid_classification.sh | File | 6.55 KB | 0755 |
|
| ethtool_lanes.sh | File | 4.02 KB | 0755 |
|
| extack.sh | File | 3.74 KB | 0755 |
|
| fib.sh | File | 5.43 KB | 0755 |
|
| fib_offload.sh | File | 9.93 KB | 0755 |
|
| hw_stats_l3.sh | File | 410 B | 0755 |
|
| ingress_rif_conf_1d.sh | File | 6.15 KB | 0755 |
|
| ingress_rif_conf_1q.sh | File | 6.23 KB | 0755 |
|
| ingress_rif_conf_vxlan.sh | File | 8.44 KB | 0755 |
|
| mirror_gre.sh | File | 3.78 KB | 0755 |
|
| mirror_gre_scale.sh | File | 5.43 KB | 0644 |
|
| mlxsw_lib.sh | File | 1.43 KB | 0644 |
|
| one_armed_router.sh | File | 6.82 KB | 0755 |
|
| pci_reset.sh | File | 1.27 KB | 0755 |
|
| port_range_occ.sh | File | 2.33 KB | 0755 |
|
| port_range_scale.sh | File | 1.51 KB | 0644 |
|
| port_scale.sh | File | 1.36 KB | 0644 |
|
| q_in_q_veto.sh | File | 8.06 KB | 0755 |
|
| qos_defprio.sh | File | 2.33 KB | 0755 |
|
| qos_dscp_bridge.sh | File | 4.14 KB | 0755 |
|
| qos_dscp_router.sh | File | 6.43 KB | 0755 |
|
| qos_ets_strict.sh | File | 9.09 KB | 0755 |
|
| qos_headroom.sh | File | 8.19 KB | 0755 |
|
| qos_lib.sh | File | 1.27 KB | 0644 |
|
| qos_max_descriptors.sh | File | 6.14 KB | 0755 |
|
| qos_mc_aware.sh | File | 9.54 KB | 0755 |
|
| qos_pfc.sh | File | 11.36 KB | 0755 |
|
| rif_bridge.sh | File | 4.12 KB | 0755 |
|
| rif_counter_scale.sh | File | 1.71 KB | 0644 |
|
| rif_lag.sh | File | 2.98 KB | 0755 |
|
| rif_lag_vlan.sh | File | 3.24 KB | 0755 |
|
| rif_mac_profile_scale.sh | File | 1.64 KB | 0644 |
|
| rif_mac_profiles.sh | File | 4.65 KB | 0755 |
|
| rif_mac_profiles_occ.sh | File | 2.87 KB | 0755 |
|
| router_bridge_lag.sh | File | 786 B | 0755 |
|
| router_scale.sh | File | 2.09 KB | 0644 |
|
| rtnetlink.sh | File | 26.93 KB | 0755 |
|
| sch_ets.sh | File | 2.3 KB | 0755 |
|
| sch_offload.sh | File | 5.25 KB | 0755 |
|
| sch_red_core.sh | File | 20.75 KB | 0644 |
|
| sch_red_ets.sh | File | 3.12 KB | 0755 |
|
| sch_red_prio.sh | File | 81 B | 0755 |
|
| sch_red_root.sh | File | 1.25 KB | 0755 |
|
| sch_tbf_ets.sh | File | 216 B | 0755 |
|
| sch_tbf_prio.sh | File | 217 B | 0755 |
|
| sch_tbf_root.sh | File | 217 B | 0755 |
|
| sharedbuffer.sh | File | 5.24 KB | 0755 |
|
| tc_action_hw_stats.sh | File | 2.24 KB | 0755 |
|
| tc_flower_scale.sh | File | 2.81 KB | 0644 |
|
| tc_police_occ.sh | File | 2.07 KB | 0755 |
|
| tc_police_scale.sh | File | 1.62 KB | 0644 |
|
| tc_restrictions.sh | File | 11.58 KB | 0755 |
|
| tc_sample.sh | File | 17.38 KB | 0755 |
|
| vxlan.sh | File | 30.19 KB | 0755 |
|
| vxlan_fdb_veto.sh | File | 3.11 KB | 0755 |
|
| vxlan_fdb_veto_ipv6.sh | File | 250 B | 0755 |
|
| vxlan_flooding.sh | File | 8.64 KB | 0755 |
|
| vxlan_ipv6.sh | File | 1.39 KB | 0755 |
|