From: Leon Romanovsky <leon@kernel.org>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: Leon Romanovsky <leonro@nvidia.com>, Jiri Pirko <jiri@nvidia.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH net-next 4/4] devlink: Clean not-executed param notifications
Date: Thu, 21 Oct 2021 17:16:16 +0300 [thread overview]
Message-ID: <69d246c5cd5367a2f48a77331a547630b4314dbe.1634825474.git.leonro@nvidia.com> (raw)
In-Reply-To: <cover.1634825474.git.leonro@nvidia.com>
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
next prev parent reply other threads:[~2021-10-21 14:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` [PATCH net-next 3/4] devlink: Remove not-executed trap group notifications Leon Romanovsky
2021-10-21 14:16 ` Leon Romanovsky [this message]
2021-10-22 23:30 ` [PATCH net-next 0/4] Delete impossible devlink notifications patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=69d246c5cd5367a2f48a77331a547630b4314dbe.1634825474.git.leonro@nvidia.com \
--to=leon@kernel.org \
--cc=davem@davemloft.net \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®