Commit 8bbeed48 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Jakub Kicinski

devlink: Remove not-executed trap group notifications

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.
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 22849b5e
...@@ -10747,8 +10747,7 @@ devlink_trap_group_notify(struct devlink *devlink, ...@@ -10747,8 +10747,7 @@ devlink_trap_group_notify(struct devlink *devlink,
WARN_ON_ONCE(cmd != DEVLINK_CMD_TRAP_GROUP_NEW && WARN_ON_ONCE(cmd != DEVLINK_CMD_TRAP_GROUP_NEW &&
cmd != DEVLINK_CMD_TRAP_GROUP_DEL); cmd != DEVLINK_CMD_TRAP_GROUP_DEL);
if (!xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED)) ASSERT_DEVLINK_REGISTERED(devlink);
return;
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
if (!msg) if (!msg)
...@@ -11075,9 +11074,6 @@ devlink_trap_group_register(struct devlink *devlink, ...@@ -11075,9 +11074,6 @@ devlink_trap_group_register(struct devlink *devlink,
} }
list_add_tail(&group_item->list, &devlink->trap_group_list); list_add_tail(&group_item->list, &devlink->trap_group_list);
devlink_trap_group_notify(devlink, group_item,
DEVLINK_CMD_TRAP_GROUP_NEW);
return 0; return 0;
err_group_init: err_group_init:
...@@ -11098,8 +11094,6 @@ devlink_trap_group_unregister(struct devlink *devlink, ...@@ -11098,8 +11094,6 @@ devlink_trap_group_unregister(struct devlink *devlink,
if (WARN_ON_ONCE(!group_item)) if (WARN_ON_ONCE(!group_item))
return; return;
devlink_trap_group_notify(devlink, group_item,
DEVLINK_CMD_TRAP_GROUP_DEL);
list_del(&group_item->list); list_del(&group_item->list);
free_percpu(group_item->stats); free_percpu(group_item->stats);
kfree(group_item); kfree(group_item);
...@@ -11119,6 +11113,8 @@ int devlink_trap_groups_register(struct devlink *devlink, ...@@ -11119,6 +11113,8 @@ int devlink_trap_groups_register(struct devlink *devlink,
{ {
int i, err; int i, err;
ASSERT_DEVLINK_NOT_REGISTERED(devlink);
mutex_lock(&devlink->lock); mutex_lock(&devlink->lock);
for (i = 0; i < groups_count; i++) { for (i = 0; i < groups_count; i++) {
const struct devlink_trap_group *group = &groups[i]; const struct devlink_trap_group *group = &groups[i];
...@@ -11156,6 +11152,8 @@ void devlink_trap_groups_unregister(struct devlink *devlink, ...@@ -11156,6 +11152,8 @@ void devlink_trap_groups_unregister(struct devlink *devlink,
{ {
int i; int i;
ASSERT_DEVLINK_NOT_REGISTERED(devlink);
mutex_lock(&devlink->lock); mutex_lock(&devlink->lock);
for (i = groups_count - 1; i >= 0; i--) for (i = groups_count - 1; i >= 0; i--)
devlink_trap_group_unregister(devlink, &groups[i]); devlink_trap_group_unregister(devlink, &groups[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment