summaryrefslogtreecommitdiffstats
path: root/include/net/dsa.h
diff options
context:
space:
mode:
authorAndrew Lunn2017-03-28 23:45:06 +0200
committerDavid S. Miller2017-03-29 07:46:04 +0200
commitc6e970a04bdceb7ef1fdbac6be3bd4cd0a0a02bd (patch)
treef7e2edac17a1e10cf21407c7cc99790d8a43e725 /include/net/dsa.h
parentMerge branch 'netconf-delnetconf' (diff)
downloadkernel-qcow2-linux-c6e970a04bdceb7ef1fdbac6be3bd4cd0a0a02bd.tar.gz
kernel-qcow2-linux-c6e970a04bdceb7ef1fdbac6be3bd4cd0a0a02bd.tar.xz
kernel-qcow2-linux-c6e970a04bdceb7ef1fdbac6be3bd4cd0a0a02bd.zip
net: break include loop netdevice.h, dsa.h, devlink.h
There is an include loop between netdevice.h, dsa.h, devlink.h because of NETDEV_ALIGN, making it impossible to use devlink structures in dsa.h. Break this loop by taking dsa.h out of netdevice.h, add a forward declaration of dsa_switch_tree and netdev_set_default_ethtool_ops() function, which is what netdevice.h requires. No longer having dsa.h in netdevice.h means the includes in dsa.h no longer get included. This breaks a few other files which depend on these includes. Add these directly in the affected file. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/dsa.h')
-rw-r--r--include/net/dsa.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index e42897fd7a96..f80e81912b83 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -468,6 +468,15 @@ static inline bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst)
return dst->rcv != NULL;
}
+static inline bool netdev_uses_dsa(struct net_device *dev)
+{
+#if IS_ENABLED(CONFIG_NET_DSA)
+ if (dev->dsa_ptr != NULL)
+ return dsa_uses_tagged_protocol(dev->dsa_ptr);
+#endif
+ return false;
+}
+
struct dsa_switch *dsa_switch_alloc(struct device *dev, size_t n);
void dsa_unregister_switch(struct dsa_switch *ds);
int dsa_register_switch(struct dsa_switch *ds, struct device *dev);