* [patch net-next] net: devlink: stub port params cmds for they are unused internally
@ 2022-08-25 8:26 Jiri Pirko
2022-08-26 1:11 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Pirko @ 2022-08-25 8:26 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, pabeni, edumazet
From: Jiri Pirko <jiri@nvidia.com>
Follow-up the removal of unused internal api of port params made by
commit 42ded61aa75e ("devlink: Delete not used port parameters APIs")
and stub the commands and add extack message to tell the user what is
going on.
If later on port params are needed, could be easily re-introduced,
but until then it is a dead code.
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
include/net/devlink.h | 1 -
net/core/devlink.c | 77 +++----------------------------------------
2 files changed, 4 insertions(+), 74 deletions(-)
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 119ed1ffb988..0b45d44a3348 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -118,7 +118,6 @@ struct devlink_rate {
struct devlink_port {
struct list_head list;
- struct list_head param_list;
struct list_head region_list;
struct devlink *devlink;
unsigned int index;
diff --git a/net/core/devlink.c b/net/core/devlink.c
index b50bcc18b8d9..6854f574e3ae 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -5574,89 +5574,21 @@ static int devlink_nl_cmd_param_set_doit(struct sk_buff *skb,
static int devlink_nl_cmd_port_param_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
- struct devlink_param_item *param_item;
- struct devlink_port *devlink_port;
- struct devlink *devlink;
- int start = cb->args[0];
- unsigned long index;
- int idx = 0;
- int err = 0;
-
- devlinks_xa_for_each_registered_get(sock_net(msg->sk), index, devlink) {
- devl_lock(devlink);
- list_for_each_entry(devlink_port, &devlink->port_list, list) {
- list_for_each_entry(param_item,
- &devlink_port->param_list, list) {
- if (idx < start) {
- idx++;
- continue;
- }
- err = devlink_nl_param_fill(msg,
- devlink_port->devlink,
- devlink_port->index, param_item,
- DEVLINK_CMD_PORT_PARAM_GET,
- NETLINK_CB(cb->skb).portid,
- cb->nlh->nlmsg_seq,
- NLM_F_MULTI);
- if (err == -EOPNOTSUPP) {
- err = 0;
- } else if (err) {
- devl_unlock(devlink);
- devlink_put(devlink);
- goto out;
- }
- idx++;
- }
- }
- devl_unlock(devlink);
- devlink_put(devlink);
- }
-out:
- if (err != -EMSGSIZE)
- return err;
-
- cb->args[0] = idx;
return msg->len;
}
static int devlink_nl_cmd_port_param_get_doit(struct sk_buff *skb,
struct genl_info *info)
{
- struct devlink_port *devlink_port = info->user_ptr[1];
- struct devlink_param_item *param_item;
- struct sk_buff *msg;
- int err;
-
- param_item = devlink_param_get_from_info(&devlink_port->param_list,
- info);
- if (!param_item)
- return -EINVAL;
-
- msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
- if (!msg)
- return -ENOMEM;
-
- err = devlink_nl_param_fill(msg, devlink_port->devlink,
- devlink_port->index, param_item,
- DEVLINK_CMD_PORT_PARAM_GET,
- info->snd_portid, info->snd_seq, 0);
- if (err) {
- nlmsg_free(msg);
- return err;
- }
-
- return genlmsg_reply(msg, info);
+ NL_SET_ERR_MSG_MOD(info->extack, "Port params are not supported");
+ return -EINVAL;
}
static int devlink_nl_cmd_port_param_set_doit(struct sk_buff *skb,
struct genl_info *info)
{
- struct devlink_port *devlink_port = info->user_ptr[1];
-
- return __devlink_nl_cmd_param_set_doit(devlink_port->devlink,
- devlink_port->index,
- &devlink_port->param_list, info,
- DEVLINK_CMD_PORT_PARAM_NEW);
+ NL_SET_ERR_MSG_MOD(info->extack, "Port params are not supported");
+ return -EINVAL;
}
static int devlink_nl_region_snapshot_id_put(struct sk_buff *msg,
@@ -9846,7 +9778,6 @@ int devl_port_register(struct devlink *devlink,
INIT_LIST_HEAD(&devlink_port->reporter_list);
mutex_init(&devlink_port->reporters_lock);
list_add_tail(&devlink_port->list, &devlink->port_list);
- INIT_LIST_HEAD(&devlink_port->param_list);
INIT_LIST_HEAD(&devlink_port->region_list);
INIT_DELAYED_WORK(&devlink_port->type_warn_dw, &devlink_port_type_warn);
--
2.37.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch net-next] net: devlink: stub port params cmds for they are unused internally
2022-08-25 8:26 [patch net-next] net: devlink: stub port params cmds for they are unused internally Jiri Pirko
@ 2022-08-26 1:11 ` Jakub Kicinski
2022-08-26 8:16 ` Jiri Pirko
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2022-08-26 1:11 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, davem, pabeni, edumazet
On Thu, 25 Aug 2022 10:26:28 +0200 Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
>
> Follow-up the removal of unused internal api of port params made by
> commit 42ded61aa75e ("devlink: Delete not used port parameters APIs")
> and stub the commands and add extack message to tell the user what is
> going on.
>
> If later on port params are needed, could be easily re-introduced,
> but until then it is a dead code.
>
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Why no extack on the dump, tho? Wouldn't iproute2 do dumps mostly?
With that answered/addressed:
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch net-next] net: devlink: stub port params cmds for they are unused internally
2022-08-26 1:11 ` Jakub Kicinski
@ 2022-08-26 8:16 ` Jiri Pirko
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2022-08-26 8:16 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: netdev, davem, pabeni, edumazet
Fri, Aug 26, 2022 at 03:11:37AM CEST, kuba@kernel.org wrote:
>On Thu, 25 Aug 2022 10:26:28 +0200 Jiri Pirko wrote:
>> From: Jiri Pirko <jiri@nvidia.com>
>>
>> Follow-up the removal of unused internal api of port params made by
>> commit 42ded61aa75e ("devlink: Delete not used port parameters APIs")
>> and stub the commands and add extack message to tell the user what is
>> going on.
>>
>> If later on port params are needed, could be easily re-introduced,
>> but until then it is a dead code.
>>
>> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>
>Why no extack on the dump, tho? Wouldn't iproute2 do dumps mostly?
Okay, will add that.
>
>With that answered/addressed:
>
>Reviewed-by: Jakub Kicinski <kuba@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-26 8:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-25 8:26 [patch net-next] net: devlink: stub port params cmds for they are unused internally Jiri Pirko
2022-08-26 1:11 ` Jakub Kicinski
2022-08-26 8:16 ` Jiri Pirko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).