selftests: devlink_lib: Add devlink port helpers
Add two devlink port helpers: * devlink port get by netdev * devlink cpu port get Signed-off-by: Shalom Toledo <shalomt@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
552ec3d9d2
commit
9fb74734f4
|
@ -419,3 +419,19 @@ devlink_trap_drop_cleanup()
|
|||
kill $mz_pid && wait $mz_pid &> /dev/null
|
||||
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"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue