diff options
author | Vikas Gupta <vikas.gupta@broadcom.com> | 2022-07-27 22:27:20 +0530 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-07-28 21:56:53 -0700 |
commit | 08f588fa301bef264576fc915da6bf31b585a824 (patch) | |
tree | 50d145246f44d78fb22ac7816834bd4c867e4e51 /include/net | |
parent | 68be7b82e77f5ddf4a216f49fd965e74caf3f2e8 (diff) | |
download | lwn-08f588fa301bef264576fc915da6bf31b585a824.tar.gz lwn-08f588fa301bef264576fc915da6bf31b585a824.zip |
devlink: introduce framework for selftests
Add a framework for running selftests.
Framework exposes devlink commands and test suite(s) to the user
to execute and query the supported tests by the driver.
Below are new entries in devlink_nl_ops
devlink_nl_cmd_selftests_show_doit/dumpit: To query the supported
selftests by the drivers.
devlink_nl_cmd_selftests_run: To execute selftests. Users can
provide a test mask for executing group tests or standalone tests.
Documentation/networking/devlink/ path is already part of MAINTAINERS &
the new files come under this path. Hence no update needed to the
MAINTAINERS
Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
Reviewed-by: Andy Gospodarek <gospo@broadcom.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/devlink.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/net/devlink.h b/include/net/devlink.h index 5bd3fac12e9e..119ed1ffb988 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -1509,6 +1509,27 @@ struct devlink_ops { struct devlink_rate *parent, void *priv_child, void *priv_parent, struct netlink_ext_ack *extack); + /** + * selftests_check() - queries if selftest is supported + * @devlink: devlink instance + * @id: test index + * @extack: extack for reporting error messages + * + * Return: true if test is supported by the driver + */ + bool (*selftest_check)(struct devlink *devlink, unsigned int id, + struct netlink_ext_ack *extack); + /** + * selftest_run() - Runs a selftest + * @devlink: devlink instance + * @id: test index + * @extack: extack for reporting error messages + * + * Return: status of the test + */ + enum devlink_selftest_status + (*selftest_run)(struct devlink *devlink, unsigned int id, + struct netlink_ext_ack *extack); }; void *devlink_priv(struct devlink *devlink); |