]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
devlink: Delete obsolete parameters publish API
authorLeon Romanovsky <leonro@nvidia.com>
Thu, 21 Oct 2021 14:16:13 +0000 (17:16 +0300)
committerJakub Kicinski <kuba@kernel.org>
Fri, 22 Oct 2021 23:15:41 +0000 (16:15 -0700)
The change of devlink_register() to be last devlink command together
with delayed notification logic made the publish API to be obsolete.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/devlink.h
net/core/devlink.c

index da3ceeb8b87bf2648764d5e95af6b9067ba2d44e..1b1317d378ded152a8e9cf8379ccdfa6dae43ed3 100644 (file)
@@ -468,7 +468,6 @@ struct devlink_param_item {
        const struct devlink_param *param;
        union devlink_param_value driverinit_value;
        bool driverinit_value_valid;
-       bool published;
 };
 
 enum devlink_param_generic_id {
@@ -1592,8 +1591,6 @@ int devlink_param_register(struct devlink *devlink,
                           const struct devlink_param *param);
 void devlink_param_unregister(struct devlink *devlink,
                              const struct devlink_param *param);
-void devlink_params_publish(struct devlink *devlink);
-void devlink_params_unpublish(struct devlink *devlink);
 int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
                                       union devlink_param_value *init_val);
 int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
index 3464854015a29ba76d43c8994c7bff09fc39ed0f..e9802421ed50b48092bcbe959ffd9b41d17e0e4c 100644 (file)
@@ -4600,8 +4600,6 @@ static int devlink_nl_param_fill(struct sk_buff *msg, struct devlink *devlink,
                                return -EOPNOTSUPP;
                        param_value[i] = param_item->driverinit_value;
                } else {
-                       if (!param_item->published)
-                               continue;
                        ctx.cmode = i;
                        err = devlink_param_get(devlink, param, &ctx);
                        if (err)
@@ -9076,6 +9074,7 @@ static void devlink_notify_register(struct devlink *devlink)
 {
        struct devlink_trap_policer_item *policer_item;
        struct devlink_trap_group_item *group_item;
+       struct devlink_param_item *param_item;
        struct devlink_trap_item *trap_item;
        struct devlink_port *devlink_port;
        struct devlink_rate *rate_node;
@@ -9102,19 +9101,24 @@ static void devlink_notify_register(struct devlink *devlink)
        list_for_each_entry(region, &devlink->region_list, list)
                devlink_nl_region_notify(region, NULL, DEVLINK_CMD_REGION_NEW);
 
-       devlink_params_publish(devlink);
+       list_for_each_entry(param_item, &devlink->param_list, list)
+               devlink_param_notify(devlink, 0, param_item,
+                                    DEVLINK_CMD_PARAM_NEW);
 }
 
 static void devlink_notify_unregister(struct devlink *devlink)
 {
        struct devlink_trap_policer_item *policer_item;
        struct devlink_trap_group_item *group_item;
+       struct devlink_param_item *param_item;
        struct devlink_trap_item *trap_item;
        struct devlink_port *devlink_port;
        struct devlink_rate *rate_node;
        struct devlink_region *region;
 
-       devlink_params_unpublish(devlink);
+       list_for_each_entry_reverse(param_item, &devlink->param_list, list)
+               devlink_param_notify(devlink, 0, param_item,
+                                    DEVLINK_CMD_PARAM_DEL);
 
        list_for_each_entry_reverse(region, &devlink->region_list, list)
                devlink_nl_region_notify(region, NULL, DEVLINK_CMD_REGION_DEL);
@@ -10229,51 +10233,6 @@ void devlink_param_unregister(struct devlink *devlink,
 }
 EXPORT_SYMBOL_GPL(devlink_param_unregister);
 
-/**
- *     devlink_params_publish - publish configuration parameters
- *
- *     @devlink: devlink
- *
- *     Publish previously registered configuration parameters.
- */
-void devlink_params_publish(struct devlink *devlink)
-{
-       struct devlink_param_item *param_item;
-
-       if (!xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED))
-               return;
-
-       list_for_each_entry(param_item, &devlink->param_list, list) {
-               if (param_item->published)
-                       continue;
-               param_item->published = true;
-               devlink_param_notify(devlink, 0, param_item,
-                                    DEVLINK_CMD_PARAM_NEW);
-       }
-}
-EXPORT_SYMBOL_GPL(devlink_params_publish);
-
-/**
- *     devlink_params_unpublish - unpublish configuration parameters
- *
- *     @devlink: devlink
- *
- *     Unpublish previously registered configuration parameters.
- */
-void devlink_params_unpublish(struct devlink *devlink)
-{
-       struct devlink_param_item *param_item;
-
-       list_for_each_entry(param_item, &devlink->param_list, list) {
-               if (!param_item->published)
-                       continue;
-               param_item->published = false;
-               devlink_param_notify(devlink, 0, param_item,
-                                    DEVLINK_CMD_PARAM_DEL);
-       }
-}
-EXPORT_SYMBOL_GPL(devlink_params_unpublish);
-
 /**
  *     devlink_param_driverinit_value_get - get configuration parameter
  *                                          value for driver initializing