Commit 9fb74734 authored by Shalom Toledo's avatar Shalom Toledo Committed by David S. Miller

selftests: devlink_lib: Add devlink port helpers

Add two devlink port helpers:
 * devlink port get by netdev
 * devlink cpu port get
Signed-off-by: default avatarShalom Toledo <shalomt@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 552ec3d9
...@@ -419,3 +419,19 @@ devlink_trap_drop_cleanup() ...@@ -419,3 +419,19 @@ devlink_trap_drop_cleanup()
kill $mz_pid && wait $mz_pid &> /dev/null kill $mz_pid && wait $mz_pid &> /dev/null
tc filter del dev $dev egress protocol $proto pref $pref handle $handle flower tc filter del dev $dev egress protocol $proto pref $pref handle $handle flower
} }
devlink_port_by_netdev()
{
local if_name=$1
devlink -j port show $if_name | jq -e '.[] | keys' | jq -r '.[]'
}
devlink_cpu_port_get()
{
local cpu_dl_port_num=$(devlink port list | grep "$DEVLINK_DEV" |
grep cpu | cut -d/ -f3 | cut -d: -f1 |
sed -n '1p')
echo "$DEVLINK_DEV/$cpu_dl_port_num"
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment