summaryrefslogtreecommitdiff
path: root/include/net/devlink.h
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@nvidia.com>2021-10-12 16:15:24 +0300
committerJakub Kicinski <kuba@kernel.org>2021-10-13 02:29:17 +0300
commitbd032e35c568ff7cfa347aa4ddd6491e2453f00c (patch)
treeb9a808354fc8d0554fb51a658c3e6adaac07ecb6 /include/net/devlink.h
parentb88f7b1203bf481af58291c28957aaab09503f43 (diff)
downloadlinux-bd032e35c568ff7cfa347aa4ddd6491e2453f00c.tar.xz
devlink: Allow control devlink ops behavior through feature mask
Introduce new devlink call to set feature mask to control devlink behavior during device initialization phase after devlink_alloc() is already called. This allows us to set reload ops based on device property which is not known at the beginning of driver initialization. For the sake of simplicity, this API lacks any type of locking and needs to be called before devlink_register() to make sure that no parallel access to the ops is possible at this stage. Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net/devlink.h')
-rw-r--r--include/net/devlink.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 7f44ad14e5ed..287f18b88293 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -1186,6 +1186,11 @@ enum devlink_trap_group_generic_id {
.min_burst = _min_burst, \
}
+enum {
+ /* device supports reload operations */
+ DEVLINK_F_RELOAD = 1UL << 0,
+};
+
struct devlink_ops {
/**
* @supported_flash_update_params:
@@ -1503,6 +1508,7 @@ static inline struct devlink *devlink_alloc(const struct devlink_ops *ops,
{
return devlink_alloc_ns(ops, priv_size, &init_net, dev);
}
+void devlink_set_features(struct devlink *devlink, u64 features);
void devlink_register(struct devlink *devlink);
void devlink_unregister(struct devlink *devlink);
void devlink_reload_enable(struct devlink *devlink);