@@ -450,6 +450,7 @@ void unregister_switch_driver(struct dsa_switch_driver *type);
struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev);
struct net_device *dsa_dev_to_net_device(struct device *dev);
+struct dsa_port *dsa_net_device_to_dsa_port(struct net_device *dev);
/* Keep inline for faster access in hot path */
static inline bool netdev_uses_dsa(struct net_device *dev)
@@ -209,6 +209,16 @@ static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
return -EOPNOTSUPP;
}
+struct dsa_port *dsa_net_device_to_dsa_port(struct net_device *dev)
+{
+ struct dsa_slave_priv *p = netdev_priv(dev);
+
+ if (!dsa_slave_dev_check(dev))
+ return NULL;
+ return p->dp;
+}
+EXPORT_SYMBOL_GPL(dsa_net_device_to_dsa_port);
+
static int dsa_slave_port_attr_set(struct net_device *dev,
const struct switchdev_attr *attr,
struct switchdev_trans *trans)
Allowing dsa drivers to attach sysfs nodes. Signed-off-by: Egil Hjelmeland <egil.hjelmeland@zenitel.com> --- include/net/dsa.h | 1 + net/dsa/slave.c | 10 ++++++++++ 2 files changed, 11 insertions(+)