dsa: add support for Trailer tagging format
Subsystems (3)
PATCH 5/6 dsa: add support for Trailer tagging format
This adds support for the Trailer switch tagging format. This is another tagging that doesn't explicitly mark tagged packets with a distinct ethertype, so that we need to add a similar hack in the receive path as for the Original DSA tagging format.
Signed-off-by Lennert Buytenhek <[email protected]>
Tested-by Byron Bradley <[email protected]>
Semi-tested-by Tim Ellis <[email protected]>
--- include/linux/if_ether.h | 1 + include/linux/netdevice.h | 10 ++++ include/net/dsa.h | 1 + net/dsa/Kconfig | 4 ++ net/dsa/Makefile | 1 + net/dsa/dsa.c | 7 +++ net/dsa/dsa_priv.h | 4 ++ net/dsa/slave.c | 5 ++ net/dsa/tag_trailer.c | 129 +++++++++++++++++++++++++++++++++++++++++++++ net/ethernet/eth.c | 2 + 10 files changed, 164 insertions(+), 0 deletions(-) create mode 100644 net/dsa/tag_trailer.c
include/linux/if_ether.h +1 -0
@@ -101,6 +101,7 @@#define ETH_P_HDLC 0x0019/* HDLC frames */ #define ETH_P_ARCNET 0x001A/* 1A for ArcNet :-) */ #define ETH_P_DSA 0x001B/* Distributed Switch Arch. */ +#define ETH_P_TRAILER 0x001C/* Trailer switch tagging */ /* * This is an Ethernet frame header.
include/linux/netdevice.h +10 -0
@@ -812,6 +812,16 @@ static inline int netdev_uses_dsa_tags(struct net_device *dev)return 0 ; } +static inline int netdev_uses_trailer_tags (struct net_device *dev) +{ +#ifdef CONFIG_NET_DSA_TAG_TRAILER +if (dev->dsa_ptr !=NULL ) +return dsa_uses_trailer_tags (dev->dsa_ptr); +#endif + +return 0 ; +} +/** * netdev_priv - access network device private data * @dev: network device
include/net/dsa.h +1 -0
@@ -21,6 +21,7 @@ struct dsa_platform_data { };int dsa_uses_dsa_tags (void *dsa_ptr); +int dsa_uses_trailer_tags (void *dsa_ptr);#endif
net/dsa/Kconfig +4 -0
@@ -18,6 +18,10 @@ config NET_DSA_TAG_EDSA bool default n +config NET_DSA_TAG_TRAILER + bool + default n + # switch drivers config NET_DSA_MV88E6XXX
net/dsa/Makefile +1 -0
@@ -1,6 +1,7 @@ # tagging formats obj-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o obj-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o +obj-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o # switch drivers obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx.o
net/dsa/dsa.c +7 -0
@@ -218,6 +218,13 @@ int dsa_uses_dsa_tags(void *dsa_ptr)return !!(ds->tag_type ==TAG_TYPE_DSA ); } +int dsa_uses_trailer_tags (void *dsa_ptr) +{ +struct dsa_switch *ds = dsa_ptr; + +return !!(ds->tag_type ==TAG_TYPE_TRAILER ); +} +/* link polling *************************************************************/ static void dsa_link_poll_work (struct work_struct *ugly)
net/dsa/dsa_priv.h +4 -0
@@ -20,6 +20,7 @@enum dsa_tag_type {TAG_TYPE_DSA ,TAG_TYPE_EDSA , +TAG_TYPE_TRAILER , };struct dsa_switch {
@@ -108,5 +109,8 @@ int dsa_xmit(struct sk_buff *skb, struct net_device *dev);/* tag_edsa.c */ int edsa_xmit (struct sk_buff *skb,struct net_device *dev); +/* tag_trailer.c */ +int trailer_xmit (struct sk_buff *skb,struct net_device *dev); +#endif
net/dsa/slave.c +5 -0
@@ -248,6 +248,11 @@ struct net_device *dsa_slave_create(struct dsa_switch *ds, int port) slave_dev->hard_start_xmit = edsa_xmit;break ;#endif +#ifdef CONFIG_NET_DSA_TAG_TRAILER +case TAG_TYPE_TRAILER : + slave_dev->hard_start_xmit = trailer_xmit; +break ; +#endif default :BUG (); }
net/dsa/tag_trailer.c new file +129 -0
129 lines not on this page · raw message
net/ethernet/eth.c +2 -0
@@ -193,6 +193,8 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)*/ if (netdev_uses_dsa_tags (dev))return htons (ETH_P_DSA ); +if (netdev_uses_trailer_tags (dev)) +return htons (ETH_P_TRAILER );if (ntohs (eth->h_proto) >=1536 )return eth->h_proto;
Signature · 1 line
1.5.6.4