[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190708041549.56601-3-parav@mellanox.com>
Date: Sun, 7 Jul 2019 23:15:46 -0500
From: Parav Pandit <parav@...lanox.com>
To: netdev@...r.kernel.org
Cc: jiri@...lanox.com, saeedm@...lanox.com,
jakub.kicinski@...ronome.com, Parav Pandit <parav@...lanox.com>
Subject: [PATCH net-next v5 2/5] devlink: Return physical port fields only for applicable port flavours
Physical port number and split group fields are applicable only to
physical port flavours such as PHYSICAL, CPU and DSA.
Hence limit returning those values in netlink response to such port
flavours.
Signed-off-by: Parav Pandit <parav@...lanox.com>
---
net/core/devlink.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index abe50a8e25c6..3e5f8204c36f 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -515,6 +515,10 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg,
return 0;
if (nla_put_u16(msg, DEVLINK_ATTR_PORT_FLAVOUR, attrs->flavour))
return -EMSGSIZE;
+ if (devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_PHYSICAL &&
+ devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_CPU &&
+ devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_DSA)
+ return 0;
if (nla_put_u32(msg, DEVLINK_ATTR_PORT_NUMBER,
attrs->physical.port_number))
return -EMSGSIZE;
--
2.19.2
Powered by blists - more mailing lists