tools/testing/selftests/drivers/net/mlxsw/pci_reset.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/drivers/net/mlxsw/pci_reset.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/drivers/net/mlxsw/pci_reset.sh- Extension
.sh- Size
- 1298 bytes
- Lines
- 59
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/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
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.