mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-03-07 14:27:05 +07:00
selftests: forwarding: devlink_lib: Simplify deduction of DEVLINK_DEV
Use devlink -j and jq for more accurate querying. Use cut -f-2 instead of rev-cut-rev combo. Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2cca8751af
commit
8e46aee697
@ -4,9 +4,8 @@
|
||||
##############################################################################
|
||||
# Defines
|
||||
|
||||
DEVLINK_DEV=$(devlink port show | grep "${NETIFS[p1]}" | \
|
||||
grep -v "${NETIFS[p1]}[0-9]" | cut -d" " -f1 | \
|
||||
rev | cut -d"/" -f2- | rev)
|
||||
DEVLINK_DEV=$(devlink port show "${NETIFS[p1]}" -j \
|
||||
| jq -r '.port | keys[]' | cut -d/ -f-2)
|
||||
if [ -z "$DEVLINK_DEV" ]; then
|
||||
echo "SKIP: ${NETIFS[p1]} has no devlink device registered for it"
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user