Skip to contentSkip to conversation

net: dsa: b53: support legacy tags

PATCH Applied Álvaro Fernández Rojas 2 participants 4 messages Mar 17, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover net: dsa: b53: support legacy tags

Legacy Broadcom tags are needed for older switches.

Álvaro Fernández Rojas (2):
net: dsa: tag_brcm: add support for legacy tags
net: dsa: b53: support legacy tags

 drivers/net/dsa/b53/Kconfig      |   1 +
 drivers/net/dsa/b53/b53_common.c |  12 ++--
 include/net/dsa.h                |   2 +
 net/dsa/Kconfig                  |   7 ++
 net/dsa/tag_brcm.c               | 107 ++++++++++++++++++++++++++++++-
 5 files changed, 121 insertions(+), 8 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/2 net: dsa: tag_brcm: add support for legacy tags

Add support for legacy Broadcom tags, which are similar to DSA_TAG_PROTO_BRCM. These tags are used on BCM5325, BCM5365 and BCM63xx switches.

---
v2: introduce changes requested by Florian and Vladimir.

 include/net/dsa.h  |   2 +
 net/dsa/Kconfig    |   7 +++
 net/dsa/tag_brcm.c | 107 +++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 113 insertions(+), 3 deletions(-)
include/net/dsa.h +2 -0
index 83a933e563fe..dac303edd33d 100644
@@ -49,10 +49,12 @@ struct phylink_link_state;
 #define DSA_TAG_PROTO_XRS700X_VALUE		19
 #define DSA_TAG_PROTO_OCELOT_8021Q_VALUE	20
 #define DSA_TAG_PROTO_SEVILLE_VALUE		21
+#define DSA_TAG_PROTO_BRCM_LEGACY_VALUE		22
 
 enum dsa_tag_protocol {
 	DSA_TAG_PROTO_NONE		= DSA_TAG_PROTO_NONE_VALUE,
 	DSA_TAG_PROTO_BRCM		= DSA_TAG_PROTO_BRCM_VALUE,
+	DSA_TAG_PROTO_BRCM_LEGACY	= DSA_TAG_PROTO_BRCM_LEGACY_VALUE,
 	DSA_TAG_PROTO_BRCM_PREPEND	= DSA_TAG_PROTO_BRCM_PREPEND_VALUE,
 	DSA_TAG_PROTO_DSA		= DSA_TAG_PROTO_DSA_VALUE,
 	DSA_TAG_PROTO_EDSA		= DSA_TAG_PROTO_EDSA_VALUE,
net/dsa/Kconfig +7 -0
index 58b8fc82cd3c..aaf8a452fd5b 100644
@@ -48,6 +48,13 @@ config NET_DSA_TAG_BRCM
 	  Say Y if you want to enable support for tagging frames for the
 	  Broadcom switches which place the tag after the MAC source address.
 
+config NET_DSA_TAG_BRCM_LEGACY
+	tristate "Tag driver for Broadcom legacy switches using in-frame headers"
+	select NET_DSA_TAG_BRCM_COMMON
+	help
+	  Say Y if you want to enable support for tagging frames for the
+	  Broadcom legacy switches which place the tag after the MAC source
+	  address.
 
 config NET_DSA_TAG_BRCM_PREPEND
 	tristate "Tag driver for Broadcom switches using prepended headers"
net/dsa/tag_brcm.c +104 -3

125 lines not on this page · raw message

Signature · 1 line
2.20.1
#2 lore raw

PATCH v2 2/2 net: dsa: b53: support legacy tags

In reply to Álvaro Fernández Rojas

These tags are used on BCM5325, BCM5365 and BCM63xx switches.

---
v2: remove unneeded comment and remove NET_DSA_TAG_BRCM_LEGACY from
b53_can_enable_brcm_tags() as Florian reported that legacy tag can be stacked.

 drivers/net/dsa/b53/Kconfig      |  1 +
 drivers/net/dsa/b53/b53_common.c | 12 +++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/net/dsa/b53/Kconfig +1 -0
index f9891a81c808..90b525160b71 100644
@@ -3,6 +3,7 @@ menuconfig B53
 	tristate "Broadcom BCM53xx managed switch support"
 	depends on NET_DSA
 	select NET_DSA_TAG_BRCM
+	select NET_DSA_TAG_BRCM_LEGACY
 	select NET_DSA_TAG_BRCM_PREPEND
 	help
 	  This driver adds support for Broadcom managed switch chips. It supports
drivers/net/dsa/b53/b53_common.c +7 -5
index a162499bcafc..d3e5baa1ed5f 100644
@@ -2052,15 +2052,17 @@ enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
 {
 	struct b53_device *dev = ds->priv;
 
-	/* Older models (5325, 5365) support a different tag format that we do
-	 * not support in net/dsa/tag_brcm.c yet.
-	 */
-	if (is5325(dev) || is5365(dev) ||
-	    !b53_can_enable_brcm_tags(ds, port, mprot)) {
+	if (!b53_can_enable_brcm_tags(ds, port, mprot)) {
 		dev->tag_protocol = DSA_TAG_PROTO_NONE;
 		goto out;
 	}
 
+	/* Older models require a different 6 byte tag */
+	if (is5325(dev) || is5365(dev) || is63xx(dev)) {
+		dev->tag_protocol = DSA_TAG_PROTO_BRCM_LEGACY;
+		goto out;
+	}
+
 	/* Broadcom BCM58xx chips have a flow accelerator on Port 8
 	 * which requires us to use the prepended Broadcom tag type
 	 */
Signature · 1 line
2.20.1
#3 lore raw
In reply to Álvaro Fernández Rojas
This series was applied to netdev/net-next.git (refs/heads/master):

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

Quoted 6 lines · On Wed, 17 Mar 2021 11:29:25 +0100 you wrote:

Legacy Broadcom tags are needed for older switches.

Álvaro Fernández Rojas (2):
net: dsa: tag_brcm: add support for legacy tags
net: dsa: b53: support legacy tags

Quoted 6 lines
 drivers/net/dsa/b53/Kconfig      |   1 +
 drivers/net/dsa/b53/b53_common.c |  12 ++--
 include/net/dsa.h                |   2 +
 net/dsa/Kconfig                  |   7 ++
 net/dsa/tag_brcm.c               | 107 ++++++++++++++++++++++++++++++-
 5 files changed, 121 insertions(+), 8 deletions(-)

Here is the summary with links:
- [v2,net-next,1/2] net: dsa: tag_brcm: add support for legacy tags

    https://git.kernel.org/netdev/net-next/c/964dbf186eaa
  - [v2,net-next,2/2] net: dsa: b53: support legacy tags
    https://git.kernel.org/netdev/net-next/c/46c5176c586c

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html