/
usr
/
src
/
linux-headers-5.15.0-190
/
tools
/
testing
/
selftests
/
net
/
forwarding
/
/usr/src/linux-headers-5.15.0-190/tools/testing/selftests/net/forwarding
mkdir
upload
Name
Size
Mode
Actions
bridge_igmp.sh
15152
0755
edit
dl
rm
bridge_mld.sh
16563
0755
edit
dl
rm
bridge_port_isolation.sh
2378
0755
edit
dl
rm
bridge_sticky_fdb.sh
1159
0755
edit
dl
rm
bridge_vlan_aware.sh
2524
0755
edit
dl
rm
bridge_vlan_unaware.sh
1248
0755
edit
dl
rm
custom_multipath_hash.sh
9993
0755
edit
dl
rm
devlink_lib.sh
13118
0644
edit
dl
rm
dual_vxlan_bridge.sh
11439
0755
edit
dl
rm
ethtool.sh
6745
0755
edit
dl
rm
ethtool_extended_state.sh
1923
0755
edit
dl
rm
ethtool_lib.sh
2815
0644
edit
dl
rm
fib_offload_lib.sh
25157
0644
edit
dl
rm
gre_custom_multipath_hash.sh
12768
0755
edit
dl
rm
gre_inner_v4_multipath.sh
7730
0755
edit
dl
rm
gre_inner_v6_multipath.sh
7843
0755
edit
dl
rm
gre_multipath.sh
6439
0755
edit
dl
rm
gre_multipath_nh.sh
9301
0755
edit
dl
rm
gre_multipath_nh_res.sh
9491
0755
edit
dl
rm
ip6gre_custom_multipath_hash.sh
13038
0755
edit
dl
rm
ip6gre_inner_v4_multipath.sh
7956
0755
edit
dl
rm
ip6gre_inner_v6_multipath.sh
8069
0755
edit
dl
rm
ip6_forward_instats_vrf.sh
3092
0755
edit
dl
rm
ipip_flat_gre.sh
838
0755
edit
dl
rm
ipip_flat_gre_key.sh
860
0755
edit
dl
rm
ipip_flat_gre_keys.sh
886
0755
edit
dl
rm
ipip_hier_gre.sh
887
0755
edit
dl
rm
ipip_hier_gre_key.sh
910
0755
edit
dl
rm
ipip_hier_gre_keys.sh
938
0755
edit
dl
rm
ipip_lib.sh
8557
0644
edit
dl
rm
lib.sh
28668
0644
edit
dl
rm
loopback.sh
1589
0755
edit
dl
rm
Makefile
1718
0644
edit
dl
rm
mirror_gre.sh
3366
0755
edit
dl
rm
mirror_gre_bound.sh
5929
0755
edit
dl
rm
mirror_gre_bridge_1d.sh
4504
0755
edit
dl
rm
mirror_gre_bridge_1d_vlan.sh
2717
0755
edit
dl
rm
mirror_gre_bridge_1q.sh
4380
0755
edit
dl
rm
mirror_gre_bridge_1q_lag.sh
7485
0755
edit
dl
rm
mirror_gre_changes.sh
5824
0755
edit
dl
rm
mirror_gre_flower.sh
2891
0755
edit
dl
rm
mirror_gre_lag_lacp.sh
7458
0755
edit
dl
rm
mirror_gre_lib.sh
2565
0644
edit
dl
rm
mirror_gre_neigh.sh
2338
0755
edit
dl
rm
mirror_gre_nh.sh
2974
0755
edit
dl
rm
mirror_gre_topo_lib.sh
3524
0644
edit
dl
rm
mirror_gre_vlan.sh
1715
0755
edit
dl
rm
mirror_gre_vlan_bridge_1q.sh
9117
0755
edit
dl
rm
mirror_lib.sh
2964
0644
edit
dl
rm
mirror_topo_lib.sh
2758
0644
edit
dl
rm
mirror_vlan.sh
2303
0755
edit
dl
rm
pedit_dsfield.sh
6789
0755
edit
dl
rm
pedit_l4port.sh
4564
0755
edit
dl
rm
q_in_vni.sh
10926
0755
edit
dl
rm
router.sh
6322
0755
edit
dl
rm
router_bridge.sh
1794
0755
edit
dl
rm
router_bridge_vlan.sh
2108
0755
edit
dl
rm
router_broadcast.sh
5142
0755
edit
dl
rm
router_mpath_nh.sh
9828
0755
edit
dl
rm
router_mpath_nh_res.sh
10223
0755
edit
dl
rm
router_multicast.sh
11597
0755
edit
dl
rm
router_multipath.sh
8449
0755
edit
dl
rm
router_nh.sh
2627
0755
edit
dl
rm
router_vid_1.sh
2153
0755
edit
dl
rm
sch_ets.sh
781
0755
edit
dl
rm
sch_ets_core.sh
7456
0644
edit
dl
rm
sch_ets_tests.sh
4044
0644
edit
dl
rm
sch_red.sh
11358
0755
edit
dl
rm
sch_tbf_core.sh
5140
0644
edit
dl
rm
sch_tbf_ets.sh
118
0755
edit
dl
rm
sch_tbf_etsprio.sh
711
0644
edit
dl
rm
sch_tbf_prio.sh
118
0755
edit
dl
rm
sch_tbf_root.sh
422
0755
edit
dl
rm
skbedit_priority.sh
3901
0755
edit
dl
rm
tc_actions.sh
6606
0755
edit
dl
rm
tc_chains.sh
4945
0755
edit
dl
rm
tc_common.sh
524
0644
edit
dl
rm
tc_flower.sh
21752
0755
edit
dl
rm
tc_flower_router.sh
3096
0755
edit
dl
rm
tc_mpls_l2vpn.sh
5146
0755
edit
dl
rm
tc_police.sh
12111
0755
edit
dl
rm
tc_shblocks.sh
2748
0755
edit
dl
rm
tc_vlan_modify.sh
3246
0755
edit
dl
rm
vxlan_asymmetric.sh
17978
0755
edit
dl
rm
vxlan_bridge_1d.sh
21064
0755
edit
dl
rm
vxlan_bridge_1d_port_8472.sh
172
0755
edit
dl
rm
vxlan_bridge_1q.sh
24053
0755
edit
dl
rm
vxlan_bridge_1q_port_8472.sh
172
0755
edit
dl
rm
vxlan_symmetric.sh
18488
0755
edit
dl
rm
Edit:
/usr/src/linux-headers-5.15.0-190/tools/testing/selftests/net/forwarding/ethtool.sh
(6745B)
#!/bin/bash # SPDX-License-Identifier: GPL-2.0 ALL_TESTS=" same_speeds_autoneg_off different_speeds_autoneg_off combination_of_neg_on_and_off advertise_subset_of_speeds check_highest_speed_is_chosen different_speeds_autoneg_on " NUM_NETIFS=2 source lib.sh source ethtool_lib.sh h1_create() { simple_if_init $h1 192.0.2.1/24 } h1_destroy() { simple_if_fini $h1 192.0.2.1/24 } h2_create() { simple_if_init $h2 192.0.2.2/24 } h2_destroy() { simple_if_fini $h2 192.0.2.2/24 } setup_prepare() { h1=${NETIFS[p1]} h2=${NETIFS[p2]} h1_create h2_create } cleanup() { pre_cleanup h2_destroy h1_destroy } same_speeds_autoneg_off() { # Check that when each of the reported speeds is forced, the links come # up and are operational. local -a speeds_arr=($(common_speeds_get $h1 $h2 0 0)) for speed in "${speeds_arr[@]}"; do RET=0 ethtool_set $h1 speed $speed autoneg off ethtool_set $h2 speed $speed autoneg off setup_wait_dev_with_timeout $h1 setup_wait_dev_with_timeout $h2 ping_do $h1 192.0.2.2 check_err $? "speed $speed autoneg off" log_test "force of same speed autoneg off" log_info "speed = $speed" done ethtool -s $h2 autoneg on ethtool -s $h1 autoneg on } different_speeds_autoneg_off() { # Test that when we force different speeds, links are not up and ping # fails. RET=0 local -a speeds_arr=($(different_speeds_get $h1 $h2 0 0)) local speed1=${speeds_arr[0]} local speed2=${speeds_arr[1]} ethtool_set $h1 speed $speed1 autoneg off ethtool_set $h2 speed $speed2 autoneg off setup_wait_dev_with_timeout $h1 setup_wait_dev_with_timeout $h2 ping_do $h1 192.0.2.2 check_fail $? "ping with different speeds" log_test "force of different speeds autoneg off" ethtool -s $h2 autoneg on ethtool -s $h1 autoneg on } combination_of_neg_on_and_off() { # Test that when one device is forced to a speed supported by both # endpoints and the other device is configured to autoneg on, the links # are up and ping passes. local -a speeds_arr=($(common_speeds_get $h1 $h2 0 1)) for speed in "${speeds_arr[@]}"; do RET=0 ethtool_set $h1 speed $speed autoneg off setup_wait_dev_with_timeout $h1 setup_wait_dev_with_timeout $h2 ping_do $h1 192.0.2.2 check_err $? "h1-speed=$speed autoneg off, h2 autoneg on" log_test "one side with autoneg off and another with autoneg on" log_info "force speed = $speed" done ethtool -s $h1 autoneg on } hex_speed_value_get() { local speed=$1; shift local shift_size=${speed_values[$speed]} speed=$((0x1 << $"shift_size")) printf "%#x" "$speed" } subset_of_common_speeds_get() { local dev1=$1; shift local dev2=$1; shift local adver=$1; shift local -a speeds_arr=($(common_speeds_get $dev1 $dev2 0 $adver)) local speed_to_advertise=0 local speed_to_remove=${speeds_arr[0]} speed_to_remove+='base' local -a speeds_mode_arr=($(common_speeds_get $dev1 $dev2 1 $adver)) for speed in ${speeds_mode_arr[@]}; do if [[ $speed != $speed_to_remove* ]]; then speed=$(hex_speed_value_get $speed) speed_to_advertise=$(($speed_to_advertise | \ $speed)) fi done # Convert to hex. printf "%#x" "$speed_to_advertise" } speed_to_advertise_get() { # The function returns the hex number that is composed by OR-ing all # the modes corresponding to the provided speed. local speed_without_mode=$1; shift local supported_speeds=("$@"); shift local speed_to_advertise=0 speed_without_mode+='base' for speed in ${supported_speeds[@]}; do if [[ $speed == $speed_without_mode* ]]; then speed=$(hex_speed_value_get $speed) speed_to_advertise=$(($speed_to_advertise | \ $speed)) fi done # Convert to hex. printf "%#x" "$speed_to_advertise" } advertise_subset_of_speeds() { # Test that when one device advertises a subset of speeds and another # advertises a specific speed (but all modes of this speed), the links # are up and ping passes. RET=0 local speed_1_to_advertise=$(subset_of_common_speeds_get $h1 $h2 1) ethtool_set $h1 advertise $speed_1_to_advertise if [ $RET != 0 ]; then log_test "advertise subset of speeds" return fi local -a speeds_arr_without_mode=($(common_speeds_get $h1 $h2 0 1)) # Check only speeds that h1 advertised. Remove the first speed. unset speeds_arr_without_mode[0] local -a speeds_arr_with_mode=($(common_speeds_get $h1 $h2 1 1)) for speed_value in ${speeds_arr_without_mode[@]}; do RET=0 local speed_2_to_advertise=$(speed_to_advertise_get $speed_value \ "${speeds_arr_with_mode[@]}") ethtool_set $h2 advertise $speed_2_to_advertise setup_wait_dev_with_timeout $h1 setup_wait_dev_with_timeout $h2 ping_do $h1 192.0.2.2 check_err $? "h1=$speed_1_to_advertise, h2=$speed_2_to_advertise ($speed_value)" log_test "advertise subset of speeds" log_info "h1=$speed_1_to_advertise, h2=$speed_2_to_advertise" done ethtool -s $h2 autoneg on ethtool -s $h1 autoneg on } check_highest_speed_is_chosen() { # Test that when one device advertises a subset of speeds, the other # chooses the highest speed. This test checks configuration without # traffic. RET=0 local max_speed local chosen_speed local speed_to_advertise=$(subset_of_common_speeds_get $h1 $h2 1) ethtool_set $h1 advertise $speed_to_advertise if [ $RET != 0 ]; then log_test "check highest speed" return fi local -a speeds_arr=($(common_speeds_get $h1 $h2 0 1)) max_speed=${speeds_arr[0]} for current in ${speeds_arr[@]}; do if [[ $current -gt $max_speed ]]; then max_speed=$current fi done setup_wait_dev_with_timeout $h1 setup_wait_dev_with_timeout $h2 chosen_speed=$(ethtool $h1 | grep 'Speed:') chosen_speed=${chosen_speed%"Mb/s"*} chosen_speed=${chosen_speed#*"Speed: "} ((chosen_speed == max_speed)) check_err $? "h1 advertise $speed_to_advertise, h2 sync to speed $chosen_speed" log_test "check highest speed" ethtool -s $h2 autoneg on ethtool -s $h1 autoneg on } different_speeds_autoneg_on() { # Test that when we configure links to advertise different speeds, # links are not up and ping fails. RET=0 local -a speeds=($(different_speeds_get $h1 $h2 1 1)) local speed1=${speeds[0]} local speed2=${speeds[1]} speed1=$(hex_speed_value_get $speed1) speed2=$(hex_speed_value_get $speed2) ethtool_set $h1 advertise $speed1 ethtool_set $h2 advertise $speed2 if (($RET)); then setup_wait_dev_with_timeout $h1 setup_wait_dev_with_timeout $h2 ping_do $h1 192.0.2.2 check_fail $? "ping with different speeds autoneg on" fi log_test "advertise different speeds autoneg on" ethtool -s $h2 autoneg on ethtool -s $h1 autoneg on } skip_on_veth trap cleanup EXIT setup_prepare setup_wait declare -gA speed_values eval "speed_values=($(speeds_arr_get))" tests_run exit $EXIT_STATUS
Save
cmd:
run