Skip to content

Commit b34f4de

Browse files
Amit Cohenkuba-moo
authored andcommitted
selftests: mlxsw: qos_pfc: Adjust the test to support 8 lanes
'qos_pfc' test checks PFC behavior. The idea is to limit the traffic using a shaper somewhere in the flow of the packets. In this area, the buffer is smaller than the buffer at the beginning of the flow, so it fills up until there is no more space left. The test configures there PFC which is supposed to notice that the headroom is filling up and send PFC Xoff to indicate the transmitter to stop sending traffic for the priorities sharing this PG. The Xon/Xoff threshold is auto-configured and always equal to 2*(MTU rounded up to cell size). Even after sending the PFC Xoff packet, traffic will keep arriving until the transmitter receives and processes the PFC packet. This amount of traffic is known as the PFC delay allowance. Currently the buffer for the delay traffic is configured as 100KB. The MTU in the test is 10KB, therefore the threshold for Xoff is about 20KB. This allows 80KB extra to be stored in this buffer. 8-lane ports use two buffers among which the configured buffer is split, the Xoff threshold then applies to each buffer in parallel. The test does not take into account the behavior of 8-lane ports, when the ports are configured to 400Gbps with 8 lanes or 800Gbps with 8 lanes, packets are dropped and the test fails. Check if the relevant ports use 8 lanes, in such case double the size of the buffer, as the headroom is split half-half. Cc: Shuah Khan <[email protected]> Fixes: bfa8047 ("selftests: mlxsw: Add a PFC test") Signed-off-by: Amit Cohen <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: Petr Machata <[email protected]> Acked-by: Paolo Abeni <[email protected]> Link: https://lore.kernel.org/r/23ff11b7dff031eb04a41c0f5254a2b636cd8ebb.1705502064.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 40cc674 commit b34f4de

File tree

1 file changed

+17
-1
lines changed
  • tools/testing/selftests/drivers/net/mlxsw

1 file changed

+17
-1
lines changed

tools/testing/selftests/drivers/net/mlxsw/qos_pfc.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ h2_destroy()
119119

120120
switch_create()
121121
{
122+
local lanes_swp4
123+
local pg1_size
124+
122125
# pools
123126
# -----
124127

@@ -228,7 +231,20 @@ switch_create()
228231
dcb pfc set dev $swp4 prio-pfc all:off 1:on
229232
# PG0 will get autoconfigured to Xoff, give PG1 arbitrarily 100K, which
230233
# is (-2*MTU) about 80K of delay provision.
231-
dcb buffer set dev $swp4 buffer-size all:0 1:$_100KB
234+
pg1_size=$_100KB
235+
236+
setup_wait_dev_with_timeout $swp4
237+
238+
lanes_swp4=$(ethtool $swp4 | grep 'Lanes:')
239+
lanes_swp4=${lanes_swp4#*"Lanes: "}
240+
241+
# 8-lane ports use two buffers among which the configured buffer
242+
# is split, so double the size to get twice (20K + 80K).
243+
if [[ $lanes_swp4 -eq 8 ]]; then
244+
pg1_size=$((pg1_size * 2))
245+
fi
246+
247+
dcb buffer set dev $swp4 buffer-size all:0 1:$pg1_size
232248

233249
# bridges
234250
# -------

0 commit comments

Comments
 (0)