Commit 4456f61c authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

devlink: allow to fillup eswitch attrs even if mode_get op does not exist

Even when mode_get op is not present, other eswitch attrs need to be
filled-up.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1a6aa36b
...@@ -1410,12 +1410,14 @@ static int devlink_nl_eswitch_fill(struct sk_buff *msg, struct devlink *devlink, ...@@ -1410,12 +1410,14 @@ static int devlink_nl_eswitch_fill(struct sk_buff *msg, struct devlink *devlink,
if (err) if (err)
goto nla_put_failure; goto nla_put_failure;
err = ops->eswitch_mode_get(devlink, &mode); if (ops->eswitch_mode_get) {
if (err) err = ops->eswitch_mode_get(devlink, &mode);
goto nla_put_failure; if (err)
err = nla_put_u16(msg, DEVLINK_ATTR_ESWITCH_MODE, mode); goto nla_put_failure;
if (err) err = nla_put_u16(msg, DEVLINK_ATTR_ESWITCH_MODE, mode);
goto nla_put_failure; if (err)
goto nla_put_failure;
}
if (ops->eswitch_inline_mode_get) { if (ops->eswitch_inline_mode_get) {
err = ops->eswitch_inline_mode_get(devlink, &inline_mode); err = ops->eswitch_inline_mode_get(devlink, &inline_mode);
...@@ -1443,7 +1445,7 @@ static int devlink_nl_cmd_eswitch_get_doit(struct sk_buff *skb, ...@@ -1443,7 +1445,7 @@ static int devlink_nl_cmd_eswitch_get_doit(struct sk_buff *skb,
struct sk_buff *msg; struct sk_buff *msg;
int err; int err;
if (!ops || !ops->eswitch_mode_get) if (!ops)
return -EOPNOTSUPP; return -EOPNOTSUPP;
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
......
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