Skip to content

Commit

Permalink
selftests: mlxsw: qos_pfc: Adjust the test to support 8 lanes
Browse files Browse the repository at this point in the history
[ Upstream commit b34f4de ]

'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 <shuah@kernel.org>
Fixes: bfa8047 ("selftests: mlxsw: Add a PFC test")
Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Link: https://lore.kernel.org/r/23ff11b7dff031eb04a41c0f5254a2b636cd8ebb.1705502064.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Amit Cohen authored and gregkh committed Jan 25, 2024
1 parent 7788f55 commit a991cd3
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tools/testing/selftests/drivers/net/mlxsw/qos_pfc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ h2_destroy()

switch_create()
{
local lanes_swp4
local pg1_size

# pools
# -----

Expand Down Expand Up @@ -229,7 +232,20 @@ switch_create()
dcb pfc set dev $swp4 prio-pfc all:off 1:on
# PG0 will get autoconfigured to Xoff, give PG1 arbitrarily 100K, which
# is (-2*MTU) about 80K of delay provision.
dcb buffer set dev $swp4 buffer-size all:0 1:$_100KB
pg1_size=$_100KB

setup_wait_dev_with_timeout $swp4

lanes_swp4=$(ethtool $swp4 | grep 'Lanes:')
lanes_swp4=${lanes_swp4#*"Lanes: "}

# 8-lane ports use two buffers among which the configured buffer
# is split, so double the size to get twice (20K + 80K).
if [[ $lanes_swp4 -eq 8 ]]; then
pg1_size=$((pg1_size * 2))
fi

dcb buffer set dev $swp4 buffer-size all:0 1:$pg1_size

# bridges
# -------
Expand Down

0 comments on commit a991cd3

Please sign in to comment.