__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ 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
ALL_TESTS="
test_defaults
test_dcb_ets
test_mtu
test_pfc
test_int_buf
test_tc_priomap
test_tc_mtu
test_tc_sizes
test_tc_int_buf
"
lib_dir=$(dirname $0)/../../../net/forwarding
NUM_NETIFS=0
source $lib_dir/lib.sh
source $lib_dir/devlink_lib.sh
swp=$NETIF_NO_CABLE
cleanup()
{
pre_cleanup
}
get_prio_pg()
{
# Produces a string of numbers "<B0> <B1> ... <B7> ", where BX is number
# of buffer that priority X is mapped to.
dcb -j buffer show dev $swp |
jq -r '[.prio_buffer | .[] | tostring + " "] | add'
}
get_prio_pfc()
{
# Produces a string of numbers "<P0> <P1> ... <P7> ", where PX denotes
# whether priority X has PFC enabled (the value is 1) or disabled (0).
dcb -j pfc show dev $swp |
jq -r '[.prio_pfc | .[] | if . then "1 " else "0 " end] | add'
}
get_prio_tc()
{
# Produces a string of numbers "<T0> <T1> ... <T7> ", where TC is number
# of TC that priority X is mapped to.
dcb -j ets show dev $swp |
jq -r '[.prio_tc | .[] | tostring + " "] | add'
}
get_buf_size()
{
local idx=$1; shift
dcb -j buffer show dev $swp | jq ".buffer_size[$idx]"
}
get_tot_size()
{
dcb -j buffer show dev $swp | jq '.total_size'
}
check_prio_pg()
{
local expect=$1; shift
local current=$(get_prio_pg)
test "$current" = "$expect"
check_err $? "prio2buffer is '$current', expected '$expect'"
}
check_prio_pfc()
{
local expect=$1; shift
local current=$(get_prio_pfc)
test "$current" = "$expect"
check_err $? "prio PFC is '$current', expected '$expect'"
}
check_prio_tc()
{
local expect=$1; shift
local current=$(get_prio_tc)
test "$current" = "$expect"
check_err $? "prio_tc is '$current', expected '$expect'"
}
__check_buf_size()
{
local idx=$1; shift
local expr=$1; shift
local what=$1; shift
local current=$(get_buf_size $idx)
((current $expr))
check_err $? "${what}buffer $idx size is '$current', expected '$expr'"
echo $current
}
check_buf_size()
{
__check_buf_size "$@" > /dev/null
}
test_defaults()
{
RET=0
check_prio_pg "0 0 0 0 0 0 0 0 "
check_prio_tc "0 0 0 0 0 0 0 0 "
check_prio_pfc "0 0 0 0 0 0 0 0 "
log_test "Default headroom configuration"
}
test_dcb_ets()
{
RET=0
dcb ets set dev $swp prio-tc 0:0 1:2 2:4 3:6 4:1 5:3 6:5 7:7
check_prio_pg "0 2 4 6 1 3 5 7 "
check_prio_tc "0 2 4 6 1 3 5 7 "
check_prio_pfc "0 0 0 0 0 0 0 0 "
dcb ets set dev $swp prio-tc all:0
check_prio_pg "0 0 0 0 0 0 0 0 "
check_prio_tc "0 0 0 0 0 0 0 0 "
dcb buffer set dev $swp prio-buffer 0:1 1:3 2:5 3:7 4:0 5:2 6:4 7:6 2>/dev/null
check_fail $? "prio2buffer accepted in DCB mode"
log_test "Configuring headroom through ETS"
}
test_mtu()
{
local what=$1; shift
local buf0size_2
local buf0size
RET=0
buf0size=$(__check_buf_size 0 "> 0")
mtu_set $swp 3000
buf0size_2=$(__check_buf_size 0 "> $buf0size" "MTU 3000: ")
mtu_restore $swp
mtu_set $swp 6000
check_buf_size 0 "> $buf0size_2" "MTU 6000: "
mtu_restore $swp
check_buf_size 0 "== $buf0size"
log_test "${what}MTU impacts buffer size"
}
test_tc_mtu()
{
# In TC mode, MTU still impacts the threshold below which a buffer is
# not permitted to go.
tc qdisc replace dev $swp root handle 1: bfifo limit 1.5M
test_mtu "TC: "
tc qdisc delete dev $swp root
}
test_pfc()
{
RET=0
dcb ets set dev $swp prio-tc all:0 5:1 6:2 7:3
local buf0size=$(get_buf_size 0)
local buf1size=$(get_buf_size 1)
local buf2size=$(get_buf_size 2)
local buf3size=$(get_buf_size 3)
check_buf_size 0 "> 0"
check_buf_size 1 "> 0"
check_buf_size 2 "> 0"
check_buf_size 3 "> 0"
check_buf_size 4 "== 0"
check_buf_size 5 "== 0"
check_buf_size 6 "== 0"
check_buf_size 7 "== 0"
log_test "Buffer size sans PFC"
RET=0
dcb pfc set dev $swp prio-pfc all:off 5:on 6:on 7:on delay 0
check_prio_pg "0 0 0 0 0 1 2 3 "
check_prio_pfc "0 0 0 0 0 1 1 1 "
check_buf_size 0 "== $buf0size"
check_buf_size 1 "> $buf1size"
check_buf_size 2 "> $buf2size"
check_buf_size 3 "> $buf3size"
local buf1size=$(get_buf_size 1)
check_buf_size 2 "== $buf1size"
check_buf_size 3 "== $buf1size"
log_test "PFC: Cable length 0"
RET=0
dcb pfc set dev $swp delay 1000
check_buf_size 0 "== $buf0size"
check_buf_size 1 "> $buf1size"
check_buf_size 2 "> $buf1size"
check_buf_size 3 "> $buf1size"
log_test "PFC: Cable length 1000"
RET=0
dcb pfc set dev $swp prio-pfc all:off delay 0
dcb ets set dev $swp prio-tc all:0
check_prio_pg "0 0 0 0 0 0 0 0 "
check_prio_tc "0 0 0 0 0 0 0 0 "
check_buf_size 0 "> 0"
check_buf_size 1 "== 0"
check_buf_size 2 "== 0"
check_buf_size 3 "== 0"
check_buf_size 4 "== 0"
check_buf_size 5 "== 0"
check_buf_size 6 "== 0"
check_buf_size 7 "== 0"
log_test "PFC: Restore defaults"
}
test_tc_priomap()
{
RET=0
dcb ets set dev $swp prio-tc 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7
check_prio_pg "0 1 2 3 4 5 6 7 "
tc qdisc replace dev $swp root handle 1: bfifo limit 1.5M
check_prio_pg "0 0 0 0 0 0 0 0 "
dcb buffer set dev $swp prio-buffer 0:1 1:3 2:5 3:7 4:0 5:2 6:4 7:6
check_prio_pg "1 3 5 7 0 2 4 6 "
tc qdisc delete dev $swp root
check_prio_pg "0 1 2 3 4 5 6 7 "
# Clean up.
tc qdisc replace dev $swp root handle 1: bfifo limit 1.5M
dcb buffer set dev $swp prio-buffer all:0
tc qdisc delete dev $swp root
dcb ets set dev $swp prio-tc all:0
log_test "TC: priomap"
}
test_tc_sizes()
{
local cell_size=$(devlink_cell_size_get)
local size=$((cell_size * 1000))
RET=0
dcb buffer set dev $swp buffer-size all:0 0:$size 2>/dev/null
check_fail $? "buffer_size should fail before qdisc is added"
tc qdisc replace dev $swp root handle 1: bfifo limit 1.5M
dcb buffer set dev $swp buffer-size all:0 0:$size
check_err $? "buffer_size should pass after qdisc is added"
check_buf_size 0 "== $size" "set size: "
mtu_set $swp 6000
check_buf_size 0 "== $size" "set MTU: "
mtu_restore $swp
dcb buffer set dev $swp buffer-size all:0
# After replacing the qdisc for the same kind, buffer_size still has to
# work.
tc qdisc replace dev $swp root handle 1: bfifo limit 1M
dcb buffer set dev $swp buffer-size all:0 0:$size
check_buf_size 0 "== $size" "post replace, set size: "
dcb buffer set dev $swp buffer-size all:0
# Likewise after replacing for a different kind.
tc qdisc replace dev $swp root handle 2: prio bands 8
dcb buffer set dev $swp buffer-size all:0 0:$size
check_buf_size 0 "== $size" "post replace different kind, set size: "
tc qdisc delete dev $swp root
dcb buffer set dev $swp buffer-size all:0 0:$size 2>/dev/null
check_fail $? "buffer_size should fail after qdisc is deleted"
log_test "TC: buffer size"
}
test_int_buf()
{
local what=$1; shift
RET=0
local buf0size=$(get_buf_size 0)
local tot_size=$(get_tot_size)
# Size of internal buffer and buffer 9.
local dsize=$((tot_size - buf0size))
tc qdisc add dev $swp clsact
tc filter add dev $swp egress matchall skip_sw action mirred egress mirror dev $swp
local buf0size_2=$(get_buf_size 0)
local tot_size_2=$(get_tot_size)
local dsize_2=$((tot_size_2 - buf0size_2))
# Egress SPAN should have added to the "invisible" buffer configuration.
((dsize_2 > dsize))
check_err $? "Invisible buffers account for '$dsize_2', expected '> $dsize'"
mtu_set $swp 3000
local buf0size_3=$(get_buf_size 0)
local tot_size_3=$(get_tot_size)
local dsize_3=$((tot_size_3 - buf0size_3))
# MTU change might change buffer 0, which will show at total, but the
# hidden buffers should stay the same size.
((dsize_3 == dsize_2))
check_err $? "MTU change: Invisible buffers account for '$dsize_3', expected '== $dsize_2'"
mtu_restore $swp
tc qdisc del dev $swp clsact
# After SPAN removal, hidden buffers should be back to the original sizes.
local buf0size_4=$(get_buf_size 0)
local tot_size_4=$(get_tot_size)
local dsize_4=$((tot_size_4 - buf0size_4))
((dsize_4 == dsize))
check_err $? "SPAN removed: Invisible buffers account for '$dsize_4', expected '== $dsize'"
log_test "${what}internal buffer size"
}
test_tc_int_buf()
{
local cell_size=$(devlink_cell_size_get)
local size=$((cell_size * 1000))
tc qdisc replace dev $swp root handle 1: bfifo limit 1.5M
test_int_buf "TC: "
dcb buffer set dev $swp buffer-size all:0 0:$size
test_int_buf "TC+buffsize: "
dcb buffer set dev $swp buffer-size all:0
tc qdisc delete dev $swp root
}
bail_on_lldpad "configure DCB" "configure Qdiscs"
trap cleanup EXIT
setup_wait
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 |
|