Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'selftests-mlxsw-add-few-fixes-for-sharedbuffer-test'

Petr Machata says:

====================
selftests: mlxsw: Add few fixes for sharedbuffer test

Danielle Ratson writes:

Currently, the sharedbuffer test fails sometimes because it is reading a
maximum occupancy that is larger than expected on some different cases.

This is happening because the test assumes that the packet it is sending
is the only packet being passed to the device.

In addition, some duplications on one hand, and redundant test cases on
the other hand, were found in the test.

Add egress filters on h1 and h2 that will guarantee that the packets in
the buffer are sent in the test, and remove the redundant test cases.
====================

Link: https://patch.msgid.link/cover.1733414773.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+40 -15
+40 -15
tools/testing/selftests/drivers/net/mlxsw/sharedbuffer.sh
··· 22 22 h1_create() 23 23 { 24 24 simple_if_init $h1 192.0.1.1/24 25 + tc qdisc add dev $h1 clsact 26 + 27 + # Add egress filter on $h1 that will guarantee that the packet sent, 28 + # will be the only packet being passed to the device. 29 + tc filter add dev $h1 egress pref 2 handle 102 matchall action drop 25 30 } 26 31 27 32 h1_destroy() 28 33 { 34 + tc filter del dev $h1 egress pref 2 handle 102 matchall action drop 35 + tc qdisc del dev $h1 clsact 29 36 simple_if_fini $h1 192.0.1.1/24 30 37 } 31 38 32 39 h2_create() 33 40 { 34 41 simple_if_init $h2 192.0.1.2/24 42 + tc qdisc add dev $h2 clsact 43 + 44 + # Add egress filter on $h2 that will guarantee that the packet sent, 45 + # will be the only packet being passed to the device. 46 + tc filter add dev $h2 egress pref 1 handle 101 matchall action drop 35 47 } 36 48 37 49 h2_destroy() 38 50 { 51 + tc filter del dev $h2 egress pref 1 handle 101 matchall action drop 52 + tc qdisc del dev $h2 clsact 39 53 simple_if_fini $h2 192.0.1.2/24 40 54 } 41 55 ··· 115 101 local exp_max_occ=$(devlink_cell_size_get) 116 102 local max_occ 117 103 104 + tc filter add dev $h1 egress protocol ip pref 1 handle 101 flower \ 105 + src_mac $h1mac dst_mac $h2mac \ 106 + src_ip 192.0.1.1 dst_ip 192.0.1.2 \ 107 + action pass 108 + 118 109 devlink sb occupancy clearmax $DEVLINK_DEV 119 110 120 111 $MZ $h1 -c 1 -p 10 -a $h1mac -b $h2mac -A 192.0.1.1 -B 192.0.1.2 \ 121 112 -t ip -q 122 113 123 114 devlink sb occupancy snapshot $DEVLINK_DEV 124 - 125 - RET=0 126 - max_occ=$(sb_occ_pool_check $dl_port1 $SB_POOL_ING $exp_max_occ) 127 - check_err $? "Expected iPool($SB_POOL_ING) max occupancy to be $exp_max_occ, but got $max_occ" 128 - log_test "physical port's($h1) ingress pool" 129 115 130 116 RET=0 131 117 max_occ=$(sb_occ_pool_check $dl_port2 $SB_POOL_ING $exp_max_occ) ··· 136 122 max_occ=$(sb_occ_pool_check $cpu_dl_port $SB_POOL_EGR_CPU $exp_max_occ) 137 123 check_err $? "Expected ePool($SB_POOL_EGR_CPU) max occupancy to be $exp_max_occ, but got $max_occ" 138 124 log_test "CPU port's egress pool" 125 + 126 + tc filter del dev $h1 egress protocol ip pref 1 handle 101 flower \ 127 + src_mac $h1mac dst_mac $h2mac \ 128 + src_ip 192.0.1.1 dst_ip 192.0.1.2 \ 129 + action pass 139 130 } 140 131 141 132 port_tc_ip_test() 142 133 { 143 134 local exp_max_occ=$(devlink_cell_size_get) 144 135 local max_occ 136 + 137 + tc filter add dev $h1 egress protocol ip pref 1 handle 101 flower \ 138 + src_mac $h1mac dst_mac $h2mac \ 139 + src_ip 192.0.1.1 dst_ip 192.0.1.2 \ 140 + action pass 145 141 146 142 devlink sb occupancy clearmax $DEVLINK_DEV 147 143 ··· 163 139 RET=0 164 140 max_occ=$(sb_occ_itc_check $dl_port2 $SB_ITC $exp_max_occ) 165 141 check_err $? "Expected ingress TC($SB_ITC) max occupancy to be $exp_max_occ, but got $max_occ" 166 - log_test "physical port's($h1) ingress TC - IP packet" 167 - 168 - RET=0 169 - max_occ=$(sb_occ_itc_check $dl_port2 $SB_ITC $exp_max_occ) 170 - check_err $? "Expected ingress TC($SB_ITC) max occupancy to be $exp_max_occ, but got $max_occ" 171 142 log_test "physical port's($h2) ingress TC - IP packet" 172 143 173 144 RET=0 174 145 max_occ=$(sb_occ_etc_check $cpu_dl_port $SB_ITC_CPU_IP $exp_max_occ) 175 146 check_err $? "Expected egress TC($SB_ITC_CPU_IP) max occupancy to be $exp_max_occ, but got $max_occ" 176 147 log_test "CPU port's egress TC - IP packet" 148 + 149 + tc filter del dev $h1 egress protocol ip pref 1 handle 101 flower \ 150 + src_mac $h1mac dst_mac $h2mac \ 151 + src_ip 192.0.1.1 dst_ip 192.0.1.2 \ 152 + action pass 177 153 } 178 154 179 155 port_tc_arp_test() 180 156 { 181 157 local exp_max_occ=$(devlink_cell_size_get) 182 158 local max_occ 159 + 160 + tc filter add dev $h1 egress protocol arp pref 1 handle 101 flower \ 161 + src_mac $h1mac action pass 183 162 184 163 devlink sb occupancy clearmax $DEVLINK_DEV 185 164 ··· 193 166 RET=0 194 167 max_occ=$(sb_occ_itc_check $dl_port2 $SB_ITC $exp_max_occ) 195 168 check_err $? "Expected ingress TC($SB_ITC) max occupancy to be $exp_max_occ, but got $max_occ" 196 - log_test "physical port's($h1) ingress TC - ARP packet" 197 - 198 - RET=0 199 - max_occ=$(sb_occ_itc_check $dl_port2 $SB_ITC $exp_max_occ) 200 - check_err $? "Expected ingress TC($SB_ITC) max occupancy to be $exp_max_occ, but got $max_occ" 201 169 log_test "physical port's($h2) ingress TC - ARP packet" 202 170 203 171 RET=0 204 172 max_occ=$(sb_occ_etc_check $cpu_dl_port $SB_ITC_CPU_ARP $exp_max_occ) 205 173 check_err $? "Expected egress TC($SB_ITC_IP2ME) max occupancy to be $exp_max_occ, but got $max_occ" 206 174 log_test "CPU port's egress TC - ARP packet" 175 + 176 + tc filter del dev $h1 egress protocol arp pref 1 handle 101 flower \ 177 + src_mac $h1mac action pass 207 178 } 208 179 209 180 setup_prepare()