diff options
author | Shalom Toledo <shalomt@mellanox.com> | 2020-02-27 10:50:16 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-02-27 22:10:15 +0300 |
commit | 9fb74734f4f896c03e1ce31278b2d4f8fe2ac033 (patch) | |
tree | 514277f62a78df2b2ee5b4f9451335ec76283e77 /tools | |
parent | 552ec3d9d2aa81681ac27d510bd11d29a5522840 (diff) | |
download | linux-9fb74734f4f896c03e1ce31278b2d4f8fe2ac033.tar.xz |
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/net/forwarding/devlink_lib.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/forwarding/devlink_lib.sh b/tools/testing/selftests/net/forwarding/devlink_lib.sh index 07e360e2f275..0df6d8942721 100644 --- a/tools/testing/selftests/net/forwarding/devlink_lib.sh +++ b/tools/testing/selftests/net/forwarding/devlink_lib.sh @@ -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" +} |