aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/dsa.h
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2014-09-15 13:00:19 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-15 17:24:20 -0400
commit5075314e4e4b559cc37675ad8a721a89bccd6284 (patch)
tree37d72bc57dd16717b15acbb14e5c98e7d36ced19 /include/net/dsa.h
parentMerge branch 'bonding-cleanups' (diff)
downloadlinux-dev-5075314e4e4b559cc37675ad8a721a89bccd6284.tar.xz
linux-dev-5075314e4e4b559cc37675ad8a721a89bccd6284.zip
dsa: Split ops up, and avoid assigning tag_protocol and receive separately
This change addresses several issues. First, it was possible to set tag_protocol without setting the ops pointer. To correct that I have reordered things so that rcv is now populated before we set tag_protocol. Second, it didn't make much sense to keep setting the device ops each time a new slave was registered. So by moving the receive portion out into root switch initialization that issue should be addressed. Third, I wanted to avoid sending tags if the rcv pointer was not registered so I changed the tag check to verify if the rcv function pointer is set on the root tree. If it is then we start sending DSA tagged frames. Finally I split the device ops pointer in the structures into two spots. I placed the rcv function pointer in the root switch since this makes it easiest to access from there, and I placed the xmit function pointer in the slave for the same reason. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/dsa.h')
-rw-r--r--include/net/dsa.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 8a8a5d976f97..a55c4e6a4f0f 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -77,7 +77,7 @@ struct dsa_platform_data {
struct dsa_chip_data *chip;
};
-struct dsa_device_ops;
+struct packet_type;
struct dsa_switch_tree {
/*
@@ -91,7 +91,10 @@ struct dsa_switch_tree {
* protocol to use.
*/
struct net_device *master_netdev;
- const struct dsa_device_ops *ops;
+ int (*rcv)(struct sk_buff *skb,
+ struct net_device *dev,
+ struct packet_type *pt,
+ struct net_device *orig_dev);
enum dsa_tag_protocol tag_protocol;
/*
@@ -218,7 +221,6 @@ static inline void *ds_to_priv(struct dsa_switch *ds)
static inline bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst)
{
- return dst->tag_protocol != DSA_TAG_PROTO_NONE;
+ return dst->rcv != NULL;
}
-
#endif