summaryrefslogtreecommitdiff
path: root/net/devlink/param.c
diff options
context:
space:
mode:
authorDaniel Zahka <daniel.zahka@gmail.com>2025-11-18 18:50:31 -0800
committerJakub Kicinski <kuba@kernel.org>2025-11-20 19:01:22 -0800
commit011d133bb988f80d597a9cbdab659414ba7ff72b (patch)
treea9d089710954642808782f957641520ffc0a0a0c /net/devlink/param.c
parentb8f2b678fcc3d7fd2fcf1db5ddcbd67ef64a0234 (diff)
devlink: pass extack through to devlink_param::get()
Allow devlink_param::get() handlers to report error messages via extack. This function is called in a few different contexts, but not all of them will have an valid extack to use. When devlink_param::get() is called from param_get_doit or param_get_dumpit contexts, pass the extack through so that drivers can report errors when retrieving param values. devlink_param::get() is called from the context of devlink_param_notify(), pass NULL in for the extack. Reviewed-by: Saeed Mahameed <saeedm@nvidia.com> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com> Link: https://patch.msgid.link/20251119025038.651131-2-daniel.zahka@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/devlink/param.c')
-rw-r--r--net/devlink/param.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/net/devlink/param.c b/net/devlink/param.c
index 6b233b13b69a..3dbd023e4c36 100644
--- a/net/devlink/param.c
+++ b/net/devlink/param.c
@@ -174,11 +174,12 @@ devlink_param_cmode_is_supported(const struct devlink_param *param,
static int devlink_param_get(struct devlink *devlink,
const struct devlink_param *param,
- struct devlink_param_gset_ctx *ctx)
+ struct devlink_param_gset_ctx *ctx,
+ struct netlink_ext_ack *extack)
{
if (!param->get)
return -EOPNOTSUPP;
- return param->get(devlink, param->id, ctx);
+ return param->get(devlink, param->id, ctx, extack);
}
static int devlink_param_set(struct devlink *devlink,
@@ -250,7 +251,8 @@ static int devlink_nl_param_fill(struct sk_buff *msg, struct devlink *devlink,
unsigned int port_index,
struct devlink_param_item *param_item,
enum devlink_command cmd,
- u32 portid, u32 seq, int flags)
+ u32 portid, u32 seq, int flags,
+ struct netlink_ext_ack *extack)
{
union devlink_param_value param_value[DEVLINK_PARAM_CMODE_MAX + 1];
bool param_value_set[DEVLINK_PARAM_CMODE_MAX + 1] = {};
@@ -275,7 +277,7 @@ static int devlink_nl_param_fill(struct sk_buff *msg, struct devlink *devlink,
return -EOPNOTSUPP;
} else {
ctx.cmode = i;
- err = devlink_param_get(devlink, param, &ctx);
+ err = devlink_param_get(devlink, param, &ctx, extack);
if (err)
return err;
param_value[i] = ctx.val;
@@ -357,7 +359,7 @@ static void devlink_param_notify(struct devlink *devlink,
if (!msg)
return;
err = devlink_nl_param_fill(msg, devlink, port_index, param_item, cmd,
- 0, 0, 0);
+ 0, 0, 0, NULL);
if (err) {
nlmsg_free(msg);
return;
@@ -400,7 +402,8 @@ static int devlink_nl_param_get_dump_one(struct sk_buff *msg,
err = devlink_nl_param_fill(msg, devlink, 0, param_item,
DEVLINK_CMD_PARAM_GET,
NETLINK_CB(cb->skb).portid,
- cb->nlh->nlmsg_seq, flags);
+ cb->nlh->nlmsg_seq, flags,
+ cb->extack);
if (err == -EOPNOTSUPP) {
err = 0;
} else if (err) {
@@ -509,8 +512,8 @@ int devlink_nl_param_get_doit(struct sk_buff *skb,
return -ENOMEM;
err = devlink_nl_param_fill(msg, devlink, 0, param_item,
- DEVLINK_CMD_PARAM_GET,
- info->snd_portid, info->snd_seq, 0);
+ DEVLINK_CMD_PARAM_GET, info->snd_portid,
+ info->snd_seq, 0, info->extack);
if (err) {
nlmsg_free(msg);
return err;