Skip to content

Commit

Permalink
devlink: allow to fillup eswitch attrs even if mode_get op does not e…
Browse files Browse the repository at this point in the history
…xist

Even when mode_get op is not present, other eswitch attrs need to be
filled-up.

Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
jpirko authored and davem330 committed Feb 10, 2017
1 parent 1a6aa36 commit 4456f61
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions net/core/devlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1410,12 +1410,14 @@ static int devlink_nl_eswitch_fill(struct sk_buff *msg, struct devlink *devlink,
if (err)
goto nla_put_failure;

err = ops->eswitch_mode_get(devlink, &mode);
if (err)
goto nla_put_failure;
err = nla_put_u16(msg, DEVLINK_ATTR_ESWITCH_MODE, mode);
if (err)
goto nla_put_failure;
if (ops->eswitch_mode_get) {
err = ops->eswitch_mode_get(devlink, &mode);
if (err)
goto nla_put_failure;
err = nla_put_u16(msg, DEVLINK_ATTR_ESWITCH_MODE, mode);
if (err)
goto nla_put_failure;
}

if (ops->eswitch_inline_mode_get) {
err = ops->eswitch_inline_mode_get(devlink, &inline_mode);
Expand Down Expand Up @@ -1443,7 +1445,7 @@ static int devlink_nl_cmd_eswitch_get_doit(struct sk_buff *skb,
struct sk_buff *msg;
int err;

if (!ops || !ops->eswitch_mode_get)
if (!ops)
return -EOPNOTSUPP;

msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
Expand Down

0 comments on commit 4456f61

Please sign in to comment.