* [PATCH net-next 1/4] devlink: Delete obsolete parameters publish API
2021-10-21 14:16 [PATCH net-next 0/4] Delete impossible devlink notifications Leon Romanovsky
@ 2021-10-21 14:16 ` Leon Romanovsky
2021-10-21 14:16 ` [PATCH net-next 2/4] devlink: Remove not-executed trap policer notifications Leon Romanovsky
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2021-10-21 14:16 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski
Cc: Leon Romanovsky, Jiri Pirko, linux-kernel, netdev
From: Leon Romanovsky <leonro@nvidia.com>
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>
---
include/net/devlink.h | 3 ---
net/core/devlink.c | 57 ++++++-------------------------------------
2 files changed, 8 insertions(+), 52 deletions(-)
diff --git a/include/net/devlink.h b/include/net/devlink.h
index da3ceeb8b87b..1b1317d378de 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -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,
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 3464854015a2..e9802421ed50 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -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
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH net-next 2/4] devlink: Remove not-executed trap policer notifications
2021-10-21 14:16 [PATCH net-next 0/4] Delete impossible devlink notifications Leon Romanovsky
2021-10-21 14:16 ` [PATCH net-next 1/4] devlink: Delete obsolete parameters publish API Leon Romanovsky
@ 2021-10-21 14:16 ` Leon Romanovsky
2021-10-21 14:16 ` [PATCH net-next 3/4] devlink: Remove not-executed trap group notifications Leon Romanovsky
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2021-10-21 14:16 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski
Cc: Leon Romanovsky, Jiri Pirko, linux-kernel, netdev
From: Leon Romanovsky <leonro@nvidia.com>
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.
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
net/core/devlink.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index e9802421ed50..bc93d894b4c6 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -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]);
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH net-next 3/4] devlink: Remove not-executed trap group notifications
2021-10-21 14:16 [PATCH net-next 0/4] Delete impossible devlink notifications Leon Romanovsky
2021-10-21 14:16 ` [PATCH net-next 1/4] devlink: Delete obsolete parameters publish API Leon Romanovsky
2021-10-21 14:16 ` [PATCH net-next 2/4] devlink: Remove not-executed trap policer notifications Leon Romanovsky
@ 2021-10-21 14:16 ` Leon Romanovsky
2021-10-21 14:16 ` [PATCH net-next 4/4] devlink: Clean not-executed param notifications Leon Romanovsky
2021-10-22 23:30 ` [PATCH net-next 0/4] Delete impossible devlink notifications patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2021-10-21 14:16 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski
Cc: Leon Romanovsky, Jiri Pirko, linux-kernel, netdev
From: Leon Romanovsky <leonro@nvidia.com>
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: Leon Romanovsky <leonro@nvidia.com>
---
net/core/devlink.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index bc93d894b4c6..10e953abad89 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -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]);
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH net-next 4/4] devlink: Clean not-executed param notifications
2021-10-21 14:16 [PATCH net-next 0/4] Delete impossible devlink notifications Leon Romanovsky
` (2 preceding siblings ...)
2021-10-21 14:16 ` [PATCH net-next 3/4] devlink: Remove not-executed trap group notifications Leon Romanovsky
@ 2021-10-21 14:16 ` Leon Romanovsky
2021-10-22 23:30 ` [PATCH net-next 0/4] Delete impossible devlink notifications patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2021-10-21 14:16 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski
Cc: Leon Romanovsky, Jiri Pirko, linux-kernel, netdev
From: Leon Romanovsky <leonro@nvidia.com>
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.
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
net/core/devlink.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 10e953abad89..f38ef4b26f70 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -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);
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH net-next 0/4] Delete impossible devlink notifications
2021-10-21 14:16 [PATCH net-next 0/4] Delete impossible devlink notifications Leon Romanovsky
` (3 preceding siblings ...)
2021-10-21 14:16 ` [PATCH net-next 4/4] devlink: Clean not-executed param notifications Leon Romanovsky
@ 2021-10-22 23:30 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-22 23:30 UTC (permalink / raw)
To: Leon Romanovsky; +Cc: davem, kuba, leonro, jiri, linux-kernel, netdev
Hello:
This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 21 Oct 2021 17:16:12 +0300 you wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
>
> 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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread