net: systemport: tell RXCHK if we are using Broadcom tags
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 28 Aug 2014 22:11:03 +0000 (15:11 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Sep 2014 01:11:47 +0000 (18:11 -0700)
When Broadcom tags are enabled, e.g: when interfaced to an Ethernet
switch, make sure that we tell the RXCHK engine that it should be
expecting a 4-bytes Broadcom tag after the Ethernet MAC Source Address.

Use netdev_uses_dsa() to check for that condition since that will tell
us if a switch is attached to our network interface.

Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bcmsysport.c

index 6f4e18644bd4e5089c7485acd7417a0adff76bff..8f91de169663d1df53bd7a9b3eda900acd5a26e0 100644 (file)
@@ -139,6 +139,15 @@ static int bcm_sysport_set_rx_csum(struct net_device *dev,
        else
                reg &= ~RXCHK_SKIP_FCS;
 
+       /* If Broadcom tags are enabled (e.g: using a switch), make
+        * sure we tell the RXCHK hardware to expect a 4-bytes Broadcom
+        * tag after the Ethernet MAC Source Address.
+        */
+       if (netdev_uses_dsa(dev))
+               reg |= RXCHK_BRCM_TAG_EN;
+       else
+               reg &= ~RXCHK_BRCM_TAG_EN;
+
        rxchk_writel(priv, reg, RXCHK_CONTROL);
 
        return 0;