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

Commit 5037d532 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller
Browse files

net: dsa: add Broadcom tag RX/TX handler



Add support for the 4-bytes Broadcom tag that built-in switches such as
the Starfighter 2 might insert when receiving packets, or that we need
to insert while targetting specific switch ports. We use a fake local
EtherType value for this 4-bytes switch tag: ETH_P_BRCMTAG to make sure
we can assign DSA-specific network operations within the DSA drivers.

Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ce31b31c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -19,6 +19,11 @@
#include <linux/phy.h>
#include <linux/phy_fixed.h>

/* Not an official ethertype value, used only internally for DSA
 * demultiplexing
 */
#define ETH_P_BRCMTAG		(ETH_P_XDSA + 1)

#define DSA_MAX_SWITCHES	4
#define DSA_MAX_PORTS		12

+3 −0
Original line number Diff line number Diff line
@@ -12,6 +12,9 @@ config NET_DSA
if NET_DSA

# tagging formats
config NET_DSA_TAG_BRCM
	bool

config NET_DSA_TAG_DSA
	bool

+1 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ obj-$(CONFIG_NET_DSA) += dsa_core.o
dsa_core-y += dsa.o slave.o

# tagging formats
dsa_core-$(CONFIG_NET_DSA_TAG_BRCM) += tag_brcm.o
dsa_core-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o
dsa_core-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o
dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
+3 −0
Original line number Diff line number Diff line
@@ -57,5 +57,8 @@ extern const struct dsa_device_ops edsa_netdev_ops;
/* tag_trailer.c */
extern const struct dsa_device_ops trailer_netdev_ops;

/* tag_brcm.c */
extern const struct dsa_device_ops brcm_netdev_ops;


#endif
+5 −0
Original line number Diff line number Diff line
@@ -450,6 +450,11 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
	case htons(ETH_P_TRAILER):
		ds->dst->ops = &trailer_netdev_ops;
		break;
#endif
#ifdef CONFIG_NET_DSA_TAG_BRCM
	case htons(ETH_P_BRCMTAG):
		ds->dst->ops = &brcm_netdev_ops;
		break;
#endif
	default:
		ds->dst->ops = &notag_netdev_ops;
Loading