[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231117152139.GA164483@vergenet.net>
Date: Fri, 17 Nov 2023 15:21:39 +0000
From: Simon Horman <horms@...nel.org>
To: Petr Machata <petrm@...dia.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org, Ido Schimmel <idosch@...dia.com>,
Amit Cohen <amcohen@...dia.com>, mlxsw@...dia.com,
linux-kselftest@...r.kernel.org, Shuah Khan <shuah@...nel.org>
Subject: Re: [PATCH net-next 14/14] selftests: mlxsw: Add PCI reset test
+ linux-kselftest ML, Shuah Khan
On Wed, Nov 15, 2023 at 01:17:23PM +0100, Petr Machata wrote:
> From: Ido Schimmel <idosch@...dia.com>
>
> Test that PCI reset works correctly by verifying that only the expected
> reset methods are supported and that after issuing the reset the ifindex
> of the port changes.
>
> Signed-off-by: Ido Schimmel <idosch@...dia.com>
> Reviewed-by: Petr Machata <petrm@...dia.com>
> Signed-off-by: Petr Machata <petrm@...dia.com>
Reviewed-by: Simon Horman <horms@...nel.org>
> ---
> .../selftests/drivers/net/mlxsw/pci_reset.sh | 58 +++++++++++++++++++
> 1 file changed, 58 insertions(+)
> create mode 100755 tools/testing/selftests/drivers/net/mlxsw/pci_reset.sh
>
> diff --git a/tools/testing/selftests/drivers/net/mlxsw/pci_reset.sh b/tools/testing/selftests/drivers/net/mlxsw/pci_reset.sh
> new file mode 100755
> index 000000000000..fe0343b95e6c
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/mlxsw/pci_reset.sh
> @@ -0,0 +1,58 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Test that PCI reset works correctly by verifying that only the expected reset
> +# methods are supported and that after issuing the reset the ifindex of the
> +# port changes.
> +
> +lib_dir=$(dirname $0)/../../../net/forwarding
> +
> +ALL_TESTS="
> + pci_reset_test
> +"
> +NUM_NETIFS=1
> +source $lib_dir/lib.sh
> +source $lib_dir/devlink_lib.sh
> +
> +pci_reset_test()
> +{
> + RET=0
> +
> + local bus=$(echo $DEVLINK_DEV | cut -d '/' -f 1)
> + local bdf=$(echo $DEVLINK_DEV | cut -d '/' -f 2)
> +
> + if [ $bus != "pci" ]; then
> + check_err 1 "devlink device is not a PCI device"
> + log_test "pci reset"
> + return
> + fi
> +
> + if [ ! -f /sys/bus/pci/devices/$bdf/reset_method ]; then
> + check_err 1 "reset is not supported"
> + log_test "pci reset"
> + return
> + fi
> +
> + [[ $(cat /sys/bus/pci/devices/$bdf/reset_method) == "bus" ]]
> + check_err $? "only \"bus\" reset method should be supported"
> +
> + local ifindex_pre=$(ip -j link show dev $swp1 | jq '.[]["ifindex"]')
> +
> + echo 1 > /sys/bus/pci/devices/$bdf/reset
> + check_err $? "reset failed"
> +
> + # Wait for udev to rename newly created netdev.
> + udevadm settle
> +
> + local ifindex_post=$(ip -j link show dev $swp1 | jq '.[]["ifindex"]')
> +
> + [[ $ifindex_pre != $ifindex_post ]]
> + check_err $? "reset not performed"
> +
> + log_test "pci reset"
> +}
> +
> +swp1=${NETIFS[p1]}
> +tests_run
> +
> +exit $EXIT_STATUS
> --
> 2.41.0
>
Powered by blists - more mailing lists