summaryrefslogtreecommitdiff
path: root/include/net/devlink.h
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2019-04-03 15:24:17 +0300
committerDavid S. Miller <davem@davemloft.net>2019-04-05 03:42:36 +0300
commit7e1146e8c10c00f859843817da8ecc5d902ea409 (patch)
tree822a020b5a501b08faa86b25488bc07c46af7db7 /include/net/devlink.h
parentbec5267cded268acdf679b651778c300d204e9f2 (diff)
downloadlinux-7e1146e8c10c00f859843817da8ecc5d902ea409.tar.xz
net: devlink: introduce devlink_compat_switch_id_get() helper
Introduce devlink_compat_switch_id_get() helper which fills up switch_id according to passed netdev pointer. Call it directly from dev_get_port_parent_id() as a fallback when ndo_get_port_parent_id is not defined for given netdev. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/devlink.h')
-rw-r--r--include/net/devlink.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 0f7968761204..70c7d1ac8344 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -743,6 +743,8 @@ void devlink_compat_running_version(struct net_device *dev,
int devlink_compat_flash_update(struct net_device *dev, const char *file_name);
int devlink_compat_phys_port_name_get(struct net_device *dev,
char *name, size_t len);
+int devlink_compat_switch_id_get(struct net_device *dev,
+ struct netdev_phys_item_id *ppid);
#else
@@ -764,6 +766,13 @@ devlink_compat_phys_port_name_get(struct net_device *dev,
return -EOPNOTSUPP;
}
+static inline int
+devlink_compat_switch_id_get(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
+{
+ return -EOPNOTSUPP;
+}
+
#endif
#endif /* _NET_DEVLINK_H_ */