Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf85d08f authored by Lennert Buytenhek's avatar Lennert Buytenhek Committed by David S. Miller
Browse files

dsa: add support for original DSA tagging format



Most of the DSA switches currently in the field do not support the
Ethertype DSA tagging format that one of the previous patches added
support for, but only the original DSA tagging format.

The original DSA tagging format carries the same information as the
Ethertype DSA tagging format, but with the difference that it does not
have an ethertype field.  In other words, when receiving a packet that
is tagged with an original DSA tag, there is no way of telling in
eth_type_trans() that this packet is in fact a DSA-tagged packet.

This patch adds a hook into eth_type_trans() which is only compiled in
if support for a switch chip that doesn't support Ethertype DSA is
selected, and which checks whether there is a DSA switch driver
instance attached to this network device which uses the old tag format.
If so, it sets the protocol field to ETH_P_DSA without looking at the
packet, so that the packet ends up in the right place.

Signed-off-by: default avatarLennert Buytenhek <buytenh@marvell.com>
Tested-by: default avatarNicolas Pitre <nico@marvell.com>
Tested-by: default avatarPeter van Valderen <linux@ddcrew.com>
Tested-by: default avatarDirk Teurlings <dirk@upexia.nl>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 91da11f8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@
#define ETH_P_ECONET	0x0018		/* Acorn Econet			*/
#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_PHONET	0x00F5		/* Nokia Phonet frames          */

/*
+11 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@
#include <linux/workqueue.h>

#include <net/net_namespace.h>
#include <net/dsa.h>

struct vlan_group;
struct ethtool_ops;
@@ -801,6 +802,16 @@ void dev_net_set(struct net_device *dev, struct net *net)
#endif
}

static inline bool netdev_uses_dsa_tags(struct net_device *dev)
{
#ifdef CONFIG_NET_DSA_TAG_DSA
	if (dev->dsa_ptr != NULL)
		return dsa_uses_dsa_tags(dev->dsa_ptr);
#endif

	return 0;
}

/**
 *	netdev_priv - access network device private data
 *	@dev: network device
+2 −0
Original line number Diff line number Diff line
@@ -30,5 +30,7 @@ struct dsa_platform_data {
	char		*port_names[DSA_MAX_PORTS];
};

extern bool dsa_uses_dsa_tags(void *dsa_ptr);


#endif
+4 −0
Original line number Diff line number Diff line
@@ -10,6 +10,10 @@ menuconfig NET_DSA
if NET_DSA

# tagging formats
config NET_DSA_TAG_DSA
	bool
	default n

config NET_DSA_TAG_EDSA
	bool
	default n
+1 −0
Original line number Diff line number Diff line
# tagging formats
obj-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o
obj-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o

# switch drivers
Loading