Delete impossible devlink notifications
Subsystems (3)
cover Delete impossible devlink notifications
From: Leon Romanovsky <[email protected]>
This series is a followup to the delayed devlink notification scheme.
I removed the impossible notifications together with attempt to annotate various calls in order to mark them as pre/post devlink)register().
Other notifications are called before and after delvink_register() so they weren't changed in this pathcset.
Thanks
Leon Romanovsky (4):
devlink: Delete obsolete parameters publish API
devlink: Remove not-executed trap policer notifications
devlink: Remove not-executed trap group notifications
devlink: Clean not-executed param notifications
include/net/devlink.h | 3 -- net/core/devlink.c | 96 +++++++++++++------------------------------ 2 files changed, 29 insertions(+), 70 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/4 devlink: Delete obsolete parameters publish API
From: Leon Romanovsky <[email protected]>
The change of devlink_register() to be last devlink command together with delayed notification logic made the publish API to be obsolete.
--- include/net/devlink.h | 3 --- net/core/devlink.c | 57 ++++++------------------------------------- 2 files changed, 8 insertions(+), 52 deletions(-)
include/net/devlink.h +0 -3
@@ -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,
net/core/devlink.c +8 -49
92 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH 2/4 devlink: Remove not-executed trap policer notifications
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The trap policer logic is registered before devlink_register() and all the notifications are delayed. This patch removes not-possible notifications along with addition of code annotation logic.
--- net/core/devlink.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
net/core/devlink.c +5 -7
@@ -11173,8 +11173,7 @@ devlink_trap_policer_notify(struct devlink *devlink,WARN_ON_ONCE (cmd !=DEVLINK_CMD_TRAP_POLICER_NEW && cmd !=DEVLINK_CMD_TRAP_POLICER_DEL ); -if (!xa_get_mark (&devlinks, devlink->index,DEVLINK_REGISTERED )) -return ; +ASSERT_DEVLINK_REGISTERED (devlink); msg =nlmsg_new (NLMSG_DEFAULT_SIZE ,GFP_KERNEL );if (!msg)
@@ -11216,9 +11215,6 @@ devlink_trap_policer_register(struct devlink *devlink, }list_add_tail (&policer_item->list, &devlink->trap_policer_list); -devlink_trap_policer_notify (devlink, policer_item, -DEVLINK_CMD_TRAP_POLICER_NEW ); -return 0 ; err_policer_init:
@@ -11236,8 +11232,6 @@ devlink_trap_policer_unregister(struct devlink *devlink,if (WARN_ON_ONCE (!policer_item))return ; -devlink_trap_policer_notify (devlink, policer_item, -DEVLINK_CMD_TRAP_POLICER_DEL );list_del (&policer_item->list);if (devlink->ops->trap_policer_fini) devlink->ops->trap_policer_fini (devlink, policer);
@@ -11259,6 +11253,8 @@ devlink_trap_policers_register(struct devlink *devlink, {int i, err; +ASSERT_DEVLINK_NOT_REGISTERED (devlink); +mutex_lock (&devlink->lock);for (i =0 ; i < policers_count; i++) {const struct devlink_trap_policer *policer = &policers[i];
@@ -11300,6 +11296,8 @@ devlink_trap_policers_unregister(struct devlink *devlink, {int i; +ASSERT_DEVLINK_NOT_REGISTERED (devlink); +mutex_lock (&devlink->lock);for (i = policers_count -1 ; i >=0 ; i--)devlink_trap_policer_unregister (devlink, &policers[i]);
Signature · 1 line
2.31.1
PATCH 3/4 devlink: Remove not-executed trap group notifications
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The trap logic is registered before devlink_register() and all the notifications are delayed. This patch removes not-possible trap group notifications along with addition of code annotation logic.
--- net/core/devlink.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
net/core/devlink.c +5 -7
@@ -10747,8 +10747,7 @@ devlink_trap_group_notify(struct devlink *devlink,WARN_ON_ONCE (cmd !=DEVLINK_CMD_TRAP_GROUP_NEW && cmd !=DEVLINK_CMD_TRAP_GROUP_DEL ); -if (!xa_get_mark (&devlinks, devlink->index,DEVLINK_REGISTERED )) -return ; +ASSERT_DEVLINK_REGISTERED (devlink); msg =nlmsg_new (NLMSG_DEFAULT_SIZE ,GFP_KERNEL );if (!msg)
@@ -11075,9 +11074,6 @@ devlink_trap_group_register(struct devlink *devlink, }list_add_tail (&group_item->list, &devlink->trap_group_list); -devlink_trap_group_notify (devlink, group_item, -DEVLINK_CMD_TRAP_GROUP_NEW ); -return 0 ; err_group_init:
@@ -11098,8 +11094,6 @@ devlink_trap_group_unregister(struct devlink *devlink,if (WARN_ON_ONCE (!group_item))return ; -devlink_trap_group_notify (devlink, group_item, -DEVLINK_CMD_TRAP_GROUP_DEL );list_del (&group_item->list);free_percpu (group_item->stats);kfree (group_item);
@@ -11119,6 +11113,8 @@ int devlink_trap_groups_register(struct devlink *devlink, {int i, err; +ASSERT_DEVLINK_NOT_REGISTERED (devlink); +mutex_lock (&devlink->lock);for (i =0 ; i < groups_count; i++) {const struct devlink_trap_group *group = &groups[i];
@@ -11156,6 +11152,8 @@ void devlink_trap_groups_unregister(struct devlink *devlink, {int i; +ASSERT_DEVLINK_NOT_REGISTERED (devlink); +mutex_lock (&devlink->lock);for (i = groups_count -1 ; i >=0 ; i--)devlink_trap_group_unregister (devlink, &groups[i]);
Signature · 1 line
2.31.1
PATCH 4/4 devlink: Clean not-executed param notifications
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The parameters are registered before devlink_register() and all the notifications are delayed. This patch removes not-possible parameters notifications along with addition of code annotation logic.
--- net/core/devlink.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
net/core/devlink.c +11 -4
@@ -4675,6 +4675,7 @@ static void devlink_param_notify(struct devlink *devlink,WARN_ON (cmd !=DEVLINK_CMD_PARAM_NEW && cmd !=DEVLINK_CMD_PARAM_DEL && cmd !=DEVLINK_CMD_PORT_PARAM_NEW && cmd !=DEVLINK_CMD_PORT_PARAM_DEL ); +ASSERT_DEVLINK_REGISTERED (devlink); msg =nlmsg_new (NLMSG_DEFAULT_SIZE ,GFP_KERNEL );if (!msg)
@@ -4946,7 +4947,6 @@ static int devlink_param_register_one(struct devlink *devlink, param_item->param = param;list_add_tail (¶m_item->list, param_list); -devlink_param_notify (devlink, port_index, param_item, cmd);return 0 ; }
@@ -4960,7 +4960,6 @@ static void devlink_param_unregister_one(struct devlink *devlink, param_item =devlink_param_find_by_name (param_list, param->name);WARN_ON (!param_item); -devlink_param_notify (devlink, port_index, param_item, cmd);list_del (¶m_item->list);kfree (param_item); }
@@ -10173,6 +10172,8 @@ int devlink_params_register(struct devlink *devlink,const struct devlink_param *params, size_t params_count) { +ASSERT_DEVLINK_NOT_REGISTERED (devlink ); + return __devlink_params_register(devlink, 0, &devlink->param_list, params, params_count, DEVLINK_CMD_PARAM_NEW,
@@ -10190,6 +10191,8 @@ void devlink_params_unregister(struct devlink *devlink,const struct devlink_param *params, size_t params_count) { +ASSERT_DEVLINK_NOT_REGISTERED (devlink ); +return __devlink_params_unregister (devlink,0 , &devlink->param_list, params, params_count,DEVLINK_CMD_PARAM_DEL );
@@ -10210,6 +10213,8 @@ int devlink_param_register(struct devlink *devlink, {int err; +ASSERT_DEVLINK_NOT_REGISTERED (devlink); +mutex_lock (&devlink->lock); err =__devlink_param_register_one (devlink,0 , &devlink->param_list, param,DEVLINK_CMD_PARAM_NEW );
@@ -10226,6 +10231,8 @@ EXPORT_SYMBOL_GPL(devlink_param_register);void devlink_param_unregister (struct devlink *devlink,const struct devlink_param *param) { +ASSERT_DEVLINK_NOT_REGISTERED (devlink); +mutex_lock (&devlink->lock);devlink_param_unregister_one (devlink,0 , &devlink->param_list, param,DEVLINK_CMD_PARAM_DEL );
@@ -10287,6 +10294,8 @@ int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id, {struct devlink_param_item *param_item; +ASSERT_DEVLINK_NOT_REGISTERED (devlink); + param_item =devlink_param_find_by_id (&devlink->param_list, param_id);if (!param_item)return -EINVAL ;
@@ -10300,8 +10309,6 @@ int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,else param_item->driverinit_value = init_val; param_item->driverinit_value_valid = true; - -devlink_param_notify (devlink,0 , param_item,DEVLINK_CMD_PARAM_NEW );return 0 ; }EXPORT_SYMBOL_GPL (devlink_param_driverinit_value_set);
Signature · 1 line
2.31.1
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Thu, 21 Oct 2021 17:16:12 +0300 you wrote:
From: Leon Romanovsky <[email protected]>
This series is a followup to the delayed devlink notification scheme.
I removed the impossible notifications together with attempt to annotate various calls in order to mark them as pre/post devlink)register().
[...]
Here is the summary with links:
- [net-next,1/4] devlink: Delete obsolete parameters publish API
https://git.kernel.org/netdev/net-next/c/99ad92eff764 - [net-next,2/4] devlink: Remove not-executed trap policer notifications https://git.kernel.org/netdev/net-next/c/22849b5ea595 - [net-next,3/4] devlink: Remove not-executed trap group notifications https://git.kernel.org/netdev/net-next/c/8bbeed485823 - [net-next,4/4] devlink: Clean not-executed param notifications https://git.kernel.org/netdev/net-next/c/7a690ad499e7
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html