Skip to content

Commit

Permalink
Merge branch 'devlink-fixes'
Browse files Browse the repository at this point in the history
Jakub Kicinski says:

====================
devlink: region snapshot locking fix and selftest adjustments

Minor fix for region snapshot locking and adjustments to selftests.
====================

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
davem330 committed Dec 16, 2022
2 parents 32f1002 + d1c4a34 commit 3e31d20
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions net/core/devlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -11925,8 +11925,10 @@ void devl_region_destroy(struct devlink_region *region)
devl_assert_locked(devlink);

/* Free all snapshots of region */
mutex_lock(&region->snapshot_lock);
list_for_each_entry_safe(snapshot, ts, &region->snapshot_list, list)
devlink_region_snapshot_del(region, snapshot);
mutex_unlock(&region->snapshot_lock);

list_del(&region->list);
mutex_destroy(&region->snapshot_lock);
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/drivers/net/netdevsim/devlink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@ dummy_reporter_test()

check_reporter_info dummy healthy 3 3 10 true

echo 8192> $DEBUGFS_DIR/health/binary_len
check_fail $? "Failed set dummy reporter binary len to 8192"
echo 8192 > $DEBUGFS_DIR/health/binary_len
check_err $? "Failed set dummy reporter binary len to 8192"

local dump=$(devlink health dump show $DL_HANDLE reporter dummy -j)
check_err $? "Failed show dump of dummy reporter"
Expand Down
13 changes: 13 additions & 0 deletions tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ if [ -d "${NETDEVSIM_PATH}/devices/netdevsim${DEV_ADDR}" ]; then
exit 1
fi

check_netdev_down()
{
state=$(cat /sys/class/net/${NETDEV}/flags)

if [ $((state & 1)) -ne 0 ]; then
echo "WARNING: unexpected interface UP, disable NetworkManager?"

ip link set dev $NETDEV down
fi
}

init_test()
{
RET=0
Expand Down Expand Up @@ -151,6 +162,7 @@ trap_stats_test()

RET=0

check_netdev_down
for trap_name in $(devlink_traps_get); do
devlink_trap_stats_idle_test $trap_name
check_err $? "Stats of trap $trap_name not idle when netdev down"
Expand Down Expand Up @@ -254,6 +266,7 @@ trap_group_stats_test()

RET=0

check_netdev_down
for group_name in $(devlink_trap_groups_get); do
devlink_trap_group_stats_idle_test $group_name
check_err $? "Stats of trap group $group_name not idle when netdev down"
Expand Down

0 comments on commit 3e31d20

Please sign in to comment.