netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Petr Machata <petrm@nvidia.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, Ido Schimmel <idosch@nvidia.com>,
	Amit Cohen <amcohen@nvidia.com>,
	mlxsw@nvidia.com, linux-kselftest@vger.kernel.org,
	Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH net-next 14/14] selftests: mlxsw: Add PCI reset test
Date: Fri, 17 Nov 2023 15:21:39 +0000	[thread overview]
Message-ID: <20231117152139.GA164483@vergenet.net> (raw)
In-Reply-To: <f0dea3a59ae1e8eb73be5cb1269383bf1bcc922c.1700047319.git.petrm@nvidia.com>

+ linux-kselftest ML, Shuah Khan

On Wed, Nov 15, 2023 at 01:17:23PM +0100, Petr Machata wrote:
> From: Ido Schimmel <idosch@nvidia.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@nvidia.com>
> Reviewed-by: Petr Machata <petrm@nvidia.com>
> Signed-off-by: Petr Machata <petrm@nvidia.com>

Reviewed-by: Simon Horman <horms@kernel.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
> 

  reply	other threads:[~2023-11-17 15:21 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 12:17 [PATCH net-next 00/14] mlxsw: Add support for new reset flow Petr Machata
2023-11-15 12:17 ` [PATCH net-next 01/14] devlink: Move private netlink flags to C file Petr Machata
2023-11-17 15:24   ` Simon Horman
2023-11-15 12:17 ` [PATCH net-next 02/14] devlink: Acquire device lock during netns dismantle Petr Machata
2023-11-17 15:49   ` Simon Horman
2023-11-15 12:17 ` [PATCH net-next 03/14] devlink: Enable the use of private flags in post_doit operations Petr Machata
2023-11-17 15:49   ` Simon Horman
2023-11-15 12:17 ` [PATCH net-next 04/14] devlink: Allow taking device lock in pre_doit operations Petr Machata
2023-11-17 15:23   ` Simon Horman
2023-11-15 12:17 ` [PATCH net-next 05/14] devlink: Acquire device lock during reload command Petr Machata
2023-11-17 15:51   ` Simon Horman
2023-11-15 12:17 ` [PATCH net-next 06/14] devlink: Add device lock assert in reload operation Petr Machata
2023-11-17 15:51   ` Simon Horman
2023-11-15 12:17 ` [PATCH net-next 07/14] PCI: Add no PM reset quirk for NVIDIA Spectrum devices Petr Machata
2023-11-17 15:21   ` Simon Horman
2023-11-15 12:17 ` [PATCH net-next 08/14] PCI: Add debug print for device ready delay Petr Machata
2023-11-17 15:23   ` Simon Horman
2023-11-15 12:17 ` [PATCH net-next 09/14] mlxsw: Extend MRSR pack() function to support new commands Petr Machata
2023-11-17 15:51   ` Simon Horman
2023-11-15 12:17 ` [PATCH net-next 10/14] mlxsw: pci: Rename mlxsw_pci_sw_reset() Petr Machata
2023-11-17 15:53   ` Simon Horman
2023-11-15 12:17 ` [PATCH net-next 11/14] mlxsw: pci: Move software reset code to a separate function Petr Machata
2023-11-17 15:53   ` Simon Horman
2023-11-15 12:17 ` [PATCH net-next 12/14] mlxsw: pci: Add support for new reset flow Petr Machata
2023-11-17 15:53   ` Simon Horman
2023-11-15 12:17 ` [PATCH net-next 13/14] mlxsw: pci: Implement PCI reset handlers Petr Machata
2023-11-17 15:54   ` Simon Horman
2023-11-15 12:17 ` [PATCH net-next 14/14] selftests: mlxsw: Add PCI reset test Petr Machata
2023-11-17 15:21   ` Simon Horman [this message]
2023-11-18 17:40 ` [PATCH net-next 00/14] mlxsw: Add support for new reset flow patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231117152139.GA164483@vergenet.net \
    --to=horms@kernel.org \
    --cc=amcohen@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).