net: stmmac: Disable ACS Feature for GMAC >= 4
authorJose Abreu <Jose.Abreu@synopsys.com>
Wed, 18 Apr 2018 09:57:55 +0000 (10:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Mar 2019 16:57:58 +0000 (17:57 +0100)
commit 565020aaeebfa7c8b3ec077bee38f4c15acc9905 upstream.

ACS Feature is currently enabled for GMAC >= 4 but the llc_snap status
is never checked in descriptor rx_status callback. This will cause
stmmac to always strip packets even that ACS feature is already
stripping them.

Lets be safe and disable the ACS feature for GMAC >= 4 and always strip
the packets for this GMAC version.

Fixes: 477286b53f55 ("stmmac: add GMAC4 core support")
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Joao Pinto <jpinto@synopsys.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/stmicro/stmmac/dwmac4.h
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index d74cedf2a397580aeb6c62737a35030e65053367..db5f2aee360b177215fe1251407f39d00ac2e30e 100644 (file)
@@ -336,7 +336,7 @@ enum power_event {
 #define MTL_RX_OVERFLOW_INT            BIT(16)
 
 /* Default operating mode of the MAC */
-#define GMAC_CORE_INIT (GMAC_CONFIG_JD | GMAC_CONFIG_PS | GMAC_CONFIG_ACS | \
+#define GMAC_CORE_INIT (GMAC_CONFIG_JD | GMAC_CONFIG_PS | \
                        GMAC_CONFIG_BE | GMAC_CONFIG_DCRS)
 
 /* To dump the core regs excluding  the Address Registers */
index f2283feb03da65ace7f3ccb01d65618726788718..55ae14a6bb8ce6fda90d35e9afe56576b90779ad 100644 (file)
@@ -30,13 +30,6 @@ static void dwmac4_core_init(struct mac_device_info *hw,
 
        value |= GMAC_CORE_INIT;
 
-       /* Clear ACS bit because Ethernet switch tagging formats such as
-        * Broadcom tags can look like invalid LLC/SNAP packets and cause the
-        * hardware to truncate packets on reception.
-        */
-       if (netdev_uses_dsa(dev))
-               value &= ~GMAC_CONFIG_ACS;
-
        if (mtu > 1500)
                value |= GMAC_CONFIG_2K;
        if (mtu > 2000)
index 11e301670b2e8d118bd7c612ae008eabcd150728..0e66a5082140b61a32e77e5cbb3892daedff90da 100644 (file)
@@ -3415,8 +3415,13 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
 
                        /* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3
                         * Type frames (LLC/LLC-SNAP)
+                        *
+                        * llc_snap is never checked in GMAC >= 4, so this ACS
+                        * feature is always disabled and packets need to be
+                        * stripped manually.
                         */
-                       if (unlikely(status != llc_snap))
+                       if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00) ||
+                           unlikely(status != llc_snap))
                                frame_len -= ETH_FCS_LEN;
 
                        if (netif_msg_rx_status(priv)) {