summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorDanielle Ratson <danieller@mellanox.com>2020-07-09 16:18:20 +0300
committerDavid S. Miller <davem@davemloft.net>2020-07-09 13:15:30 -0700
commita0f49b54865273c895be3826d6d59cbc5ad725c2 (patch)
treef31fa3811a4ab42a1d6f45035e7d78473bf2b86a /net/core
parent1b604efb6c28902df306fce610fba761e9c056d2 (diff)
downloadlinux-a0f49b54865273c895be3826d6d59cbc5ad725c2.tar.gz
linux-a0f49b54865273c895be3826d6d59cbc5ad725c2.tar.bz2
linux-a0f49b54865273c895be3826d6d59cbc5ad725c2.zip
devlink: Add a new devlink port split ability attribute and pass to netlink
Add a new attribute that indicates the split ability of devlink port. Drivers are expected to set it via devlink_port_attrs_set(), before registering the port. Signed-off-by: Danielle Ratson <danieller@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/devlink.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 7f26d1054974..94c797b74378 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -534,6 +534,8 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg,
if (nla_put_u32(msg, DEVLINK_ATTR_PORT_LANES, attrs->lanes))
return -EMSGSIZE;
}
+ if (nla_put_u8(msg, DEVLINK_ATTR_PORT_SPLITTABLE, attrs->splittable))
+ return -EMSGSIZE;
if (nla_put_u16(msg, DEVLINK_ATTR_PORT_FLAVOUR, attrs->flavour))
return -EMSGSIZE;
switch (devlink_port->attrs.flavour) {
@@ -7547,6 +7549,7 @@ void devlink_port_attrs_set(struct devlink_port *devlink_port,
ret = __devlink_port_attrs_set(devlink_port, attrs->flavour);
if (ret)
return;
+ WARN_ON(attrs->splittable && attrs->split);
}
EXPORT_SYMBOL_GPL(devlink_port_attrs_set);