summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/net/forwarding/devlink_lib.sh
AgeCommit message (Collapse)Author
2019-11-07selftests: forwarding: devlink: Add functionality for trap exceptions testAmit Cohen
Add common part of all the tests - check devlink status to ensure that packets were trapped. Signed-off-by: Amit Cohen <amitc@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-11-07selftests: devlink: Make devlink_trap_cleanup() more genericAmit Cohen
Add proto parameter in order to enable the use of devlink_trap_cleanup() in tests that use IPv6 protocol. Signed-off-by: Amit Cohen <amitc@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-11-07selftests: devlink: Export functions to devlink libraryAmit Cohen
l2_drops_test() is used to check that drop traps are functioning as intended. Currently it is only used in the layer 2 test, but it is also useful for the layer 3 test introduced in the subsequent patch. l2_drops_cleanup() is used to clean configurations and kill mausezahn proccess. Export the functions to the common devlink library to allow it to be re-used by future tests. Signed-off-by: Amit Cohen <amitc@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-17selftests: forwarding: devlink_lib: Add devlink-trap helpersIdo Schimmel
Add helpers to interact with devlink-trap, such as setting the action of a trap and retrieving statistics. Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-17selftests: forwarding: devlink_lib: Allow tests to define devlink deviceIdo Schimmel
For tests that create their network interfaces dynamically or do not use interfaces at all (as with netdevsim) it is useful to define their own devlink device instead of deriving it from the first network interface. Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-28selftests: forwarding: devlink_lib: Add shared buffer helpersPetr Machata
Add helpers to obtain, set, and restore a pool size, and a port-pool and tc-pool threshold. 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>
2019-03-28selftests: forwarding: devlink_lib: Simplify deduction of DEVLINK_DEVPetr Machata
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>
2019-03-28selftests: forwarding: devlink_lib: Avoid double sourcing of lib.shPetr Machata
Don't source lib.sh twice and make the script work with ifnames passed on the command line. 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>
2019-01-28selftests: net: forwarding: change devlink resource support checkingJiri Pirko
As for the others, check help message output to find out if devlink supports "resource" object. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-06-30selftests: forwarding: Add devlink_lib.shPetr Machata
This helper library contains wrappers to devlink functionality agnostic to the underlying device. Signed-off-by: Yuval Mintz <yuvalm@mellanox.com> [petrm@mellanox.com: Split this out from another patch.] Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>