net: dsa: b53: Support prepended Broadcom tags
authorFlorian Fainelli <f.fainelli@gmail.com>
Fri, 10 Nov 2017 23:22:55 +0000 (15:22 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 13 Nov 2017 01:34:54 +0000 (10:34 +0900)
On BCM58xx devices (Northstar Plus), there is an accelerator attached to
port 8 which would only work if we use prepended Broadcom tags. Resolve
that difference in our get_tag_protocol() function by setting the
appropriate tagging protocol in that case. We need to change
b53_brcm_hdr_setup() a little bit now since we can deal with two types
of Broadcom tags.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/b53/Kconfig
drivers/net/dsa/b53/b53_common.c

index b413d100c6b311642c47412939cc2464a95e480f..2f988216dab94e258ba7da41b2ac7bed80ee02fc 100644 (file)
@@ -2,6 +2,7 @@ menuconfig B53
        tristate "Broadcom BCM53xx managed switch support"
        depends on NET_DSA
        select NET_DSA_TAG_BRCM
+       select NET_DSA_TAG_BRCM_PREPEND
        help
          This driver adds support for Broadcom managed switch chips. It supports
          BCM5325E, BCM5365, BCM539x, BCM53115 and BCM53125 as well as BCM63XX
index f72aeb9ed12a878f87f19bc116661f2a0cc541ff..f5a8dd96fd75f273f6a31647087bd0c5e0b4fd47 100644 (file)
@@ -541,8 +541,8 @@ EXPORT_SYMBOL(b53_disable_port);
 
 void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
 {
-       bool tag_en = !!(ds->ops->get_tag_protocol(ds, port) ==
-                        DSA_TAG_PROTO_BRCM);
+       bool tag_en = !(ds->ops->get_tag_protocol(ds, port) ==
+                        DSA_TAG_PROTO_NONE);
        struct b53_device *dev = ds->priv;
        u8 hdr_ctl, val;
        u16 reg;
@@ -1505,8 +1505,14 @@ static enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds,
         */
        if (is5325(dev) || is5365(dev) || !b53_can_enable_brcm_tags(ds, port))
                return DSA_TAG_PROTO_NONE;
-       else
-               return DSA_TAG_PROTO_BRCM;
+
+       /* Broadcom BCM58xx chips have a flow accelerator on Port 8
+        * which requires us to use the prepended Broadcom tag type
+        */
+       if (dev->chip_id == BCM58XX_DEVICE_ID && port == B53_CPU_PORT)
+               return DSA_TAG_PROTO_BRCM_PREPEND;
+
+       return DSA_TAG_PROTO_BRCM;
 }
 
 int b53_mirror_add(struct dsa_switch *ds, int port,