History log of /linux-master/tools/testing/selftests/drivers/net/mlxsw/tc_sample.sh
Revision Date Author Comments
# b8bfafe4 24-Oct-2021 Petr Machata <petrm@nvidia.com>

selftests: mlxsw: Add helpers for skipping selftests

A number of mlxsw-specific selftests currently detect whether they are run
on a compatible machine, and bail out silently when not. These tests are
however done in a somewhat impenetrable manner by directly comparing PCI
IDs against a blacklist or a whitelist, and bailing out silently if the
machine is not compatible.

Instead, add a helper, mlxsw_only_on_spectrum(), which allows specifying
the supported machines in a human-readable manner. If the current machine
is incompatible, the helper emits a SKIP message and returns an error code,
based on which the caller can gracefully bail out in a suitable way. This
allows a more readable conditions such as:

mlxsw_only_on_spectrum 2+ || return

Convert all existing open-coded guards to the new helper. Also add two new
guards to do_mark_test() and do_drop_test(), which are supported only on
Spectrum-2+, but the corresponding check was not there.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 16355c0b 17-May-2021 Ido Schimmel <idosch@OSS.NVIDIA.COM>

selftests: mlxsw: Make sampling test more robust

The test sometimes fails with an error message such as:

TEST: tc sample (w/ flower) rate (egress) [FAIL]
Expected 100 packets, got 70 packets, which is -30% off. Required accuracy is +-25%

Make the test more robust by generating more packets, therefore
increasing the number of expected samples. Decrease the transmission
delay in order not to needlessly prolong the test.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 7ede22e6 29-Mar-2021 Ido Schimmel <idosch@nvidia.com>

selftests: mlxsw: Test vetoing of double sampling

Test that two sampling rules cannot be configured on the same port with
the same trigger.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f0b692c4 16-Mar-2021 Ido Schimmel <idosch@nvidia.com>

selftests: mlxsw: Add tc sample tests for new triggers

Test that packets are sampled when tc-sample is used with matchall
egress binding and flower classifier. Verify that when performing
sampling on egress the end-to-end latency is reported as metadata.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# bb24d592 14-Mar-2021 Ido Schimmel <idosch@nvidia.com>

selftests: mlxsw: Add tc sample tests

Test that packets are sampled when tc-sample is used and that reported
metadata is correct. Two sets of hosts (with and without LAG) are used,
since metadata extraction in mlxsw is a bit different when LAG is
involved.

# ./tc_sample.sh
TEST: tc sample rate (forward) [ OK ]
TEST: tc sample rate (local receive) [ OK ]
TEST: tc sample maximum rate [ OK ]
TEST: tc sample group conflict test [ OK ]
TEST: tc sample iif [ OK ]
TEST: tc sample lag iif [ OK ]
TEST: tc sample oif [ OK ]
TEST: tc sample lag oif [ OK ]
TEST: tc sample out-tc [ OK ]
TEST: tc sample out-tc-occ [ OK ]

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>