summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2017-02-09 15:54:36 +0100
committerDavid S. Miller <davem@davemloft.net>2017-02-10 14:43:00 -0500
commit4456f61cfd2a589c4368fe0b9080b646b9bd470d (patch)
tree89ec0319f0c7cfa0bfcebae01f1bc04928fb1fbe /net/core
parent1a6aa36b6f92b1a2f2e6789f6785372d4d6ddca9 (diff)
downloadlinux-riscv-4456f61cfd2a589c4368fe0b9080b646b9bd470d.tar.gz
linux-riscv-4456f61cfd2a589c4368fe0b9080b646b9bd470d.tar.bz2
linux-riscv-4456f61cfd2a589c4368fe0b9080b646b9bd470d.zip
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: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/devlink.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 7f88cc879d43..e9c1e6acfb6d 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -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);
@@ -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);