Commit 32e0d42a authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'RTL8366RB-tagging-support'



Linus Walleij says:

====================
RTL8366RB tagging support

This patch set adds DSA tagging support to the RTL8366RB
DSA driver.

There is a minor performance improvement in the tag parser
compared to the previous patch set and the review tags
have been collected.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 12fdafb8 a20fafb9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ config NET_DSA_QCA8K
config NET_DSA_REALTEK_SMI
	tristate "Realtek SMI Ethernet switch family support"
	depends on NET_DSA
	select NET_DSA_TAG_RTL4_A
	select FIXED_PHY
	select IRQ_DOMAIN
	select REALTEK_PHY
+8 −23
Original line number Diff line number Diff line
@@ -109,8 +109,8 @@
/* CPU port control reg */
#define RTL8368RB_CPU_CTRL_REG		0x0061
#define RTL8368RB_CPU_PORTS_MSK		0x00FF
/* Enables inserting custom tag length/type 0x8899 */
#define RTL8368RB_CPU_INSTAG		BIT(15)
/* Disables inserting custom tag length/type 0x8899 */
#define RTL8368RB_CPU_NO_TAG		BIT(15)

#define RTL8366RB_SMAR0			0x0070 /* bits 0..15 */
#define RTL8366RB_SMAR1			0x0071 /* bits 16..31 */
@@ -844,16 +844,14 @@ static int rtl8366rb_setup(struct dsa_switch *ds)
	if (ret)
		return ret;

	/* Enable CPU port and enable inserting CPU tag
	/* Enable CPU port with custom DSA tag 8899.
	 *
	 * Disabling RTL8368RB_CPU_INSTAG here will change the behaviour
	 * of the switch totally and it will start talking Realtek RRCP
	 * internally. It is probably possible to experiment with this,
	 * but then the kernel needs to understand and handle RRCP first.
	 * If you set RTL8368RB_CPU_NO_TAG (bit 15) in this registers
	 * the custom tag is turned off.
	 */
	ret = regmap_update_bits(smi->map, RTL8368RB_CPU_CTRL_REG,
				 0xFFFF,
				 RTL8368RB_CPU_INSTAG | BIT(smi->cpu_port));
				 BIT(smi->cpu_port));
	if (ret)
		return ret;

@@ -967,21 +965,8 @@ static enum dsa_tag_protocol rtl8366_get_tag_protocol(struct dsa_switch *ds,
						      int port,
						      enum dsa_tag_protocol mp)
{
	/* For now, the RTL switches are handled without any custom tags.
	 *
	 * It is possible to turn on "custom tags" by removing the
	 * RTL8368RB_CPU_INSTAG flag when enabling the port but what it
	 * does is unfamiliar to DSA: ethernet frames of type 8899, the Realtek
	 * Remote Control Protocol (RRCP) start to appear on the CPU port of
	 * the device. So this is not the ordinary few extra bytes in the
	 * frame. Instead it appears that the switch starts to talk Realtek
	 * RRCP internally which means a pretty complex RRCP implementation
	 * decoding and responding the RRCP protocol is needed to exploit this.
	 *
	 * The OpenRRCP project (dormant since 2009) have reverse-egineered
	 * parts of the protocol.
	 */
	return DSA_TAG_PROTO_NONE;
	/* This switch uses the 4 byte protocol A Realtek DSA tag */
	return DSA_TAG_PROTO_RTL4_A;
}

static void rtl8366rb_adjust_link(struct dsa_switch *ds, int port,
+2 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ struct phylink_link_state;
#define DSA_TAG_PROTO_KSZ8795_VALUE		14
#define DSA_TAG_PROTO_OCELOT_VALUE		15
#define DSA_TAG_PROTO_AR9331_VALUE		16
#define DSA_TAG_PROTO_RTL4_A_VALUE		17

enum dsa_tag_protocol {
	DSA_TAG_PROTO_NONE		= DSA_TAG_PROTO_NONE_VALUE,
@@ -63,6 +64,7 @@ enum dsa_tag_protocol {
	DSA_TAG_PROTO_KSZ8795		= DSA_TAG_PROTO_KSZ8795_VALUE,
	DSA_TAG_PROTO_OCELOT		= DSA_TAG_PROTO_OCELOT_VALUE,
	DSA_TAG_PROTO_AR9331		= DSA_TAG_PROTO_AR9331_VALUE,
	DSA_TAG_PROTO_RTL4_A		= DSA_TAG_PROTO_RTL4_A_VALUE,
};

struct packet_type;
+7 −0
Original line number Diff line number Diff line
@@ -86,6 +86,13 @@ config NET_DSA_TAG_KSZ
	  Say Y if you want to enable support for tagging frames for the
	  Microchip 8795/9477/9893 families of switches.

config NET_DSA_TAG_RTL4_A
	tristate "Tag driver for Realtek 4 byte protocol A tags"
	help
	  Say Y or M if you want to enable support for tagging frames for the
	  Realtek switches with 4 byte protocol A tags, sich as found in
	  the Realtek RTL8366RB.

config NET_DSA_TAG_OCELOT
	tristate "Tag driver for Ocelot family of switches"
	select PACKING
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ obj-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o
obj-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o
obj-$(CONFIG_NET_DSA_TAG_GSWIP) += tag_gswip.o
obj-$(CONFIG_NET_DSA_TAG_KSZ) += tag_ksz.o
obj-$(CONFIG_NET_DSA_TAG_RTL4_A) += tag_rtl4_a.o
obj-$(CONFIG_NET_DSA_TAG_LAN9303) += tag_lan9303.o
obj-$(CONFIG_NET_DSA_TAG_MTK) += tag_mtk.o
obj-$(CONFIG_NET_DSA_TAG_OCELOT) += tag_ocelot.o
Loading