From: Greg Kroah-Hartman Date: Wed, 27 Feb 2019 16:39:01 +0000 (+0100) Subject: 4.14-stable patches X-Git-Tag: v4.9.162~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c9ae0414d3aa8d032a649e690a4e2d8acdd34286;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: net-stmmac-disable-acs-feature-for-gmac-4.patch net-stmmac-fix-reception-of-broadcom-switches-tags.patch --- diff --git a/queue-4.14/net-stmmac-disable-acs-feature-for-gmac-4.patch b/queue-4.14/net-stmmac-disable-acs-feature-for-gmac-4.patch new file mode 100644 index 00000000000..6f8285485ab --- /dev/null +++ b/queue-4.14/net-stmmac-disable-acs-feature-for-gmac-4.patch @@ -0,0 +1,76 @@ +From 565020aaeebfa7c8b3ec077bee38f4c15acc9905 Mon Sep 17 00:00:00 2001 +From: Jose Abreu +Date: Wed, 18 Apr 2018 10:57:55 +0100 +Subject: net: stmmac: Disable ACS Feature for GMAC >= 4 + +From: Jose Abreu + +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 +Cc: David S. Miller +Cc: Joao Pinto +Cc: Giuseppe Cavallaro +Cc: Alexandre Torgue +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 2 +- + drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 7 ------- + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++++++- + 3 files changed, 7 insertions(+), 9 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h +@@ -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 */ +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +@@ -30,13 +30,6 @@ static void dwmac4_core_init(struct mac_ + + 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) +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -3415,8 +3415,13 @@ static int stmmac_rx(struct stmmac_priv + + /* 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)) { diff --git a/queue-4.14/net-stmmac-fix-reception-of-broadcom-switches-tags.patch b/queue-4.14/net-stmmac-fix-reception-of-broadcom-switches-tags.patch new file mode 100644 index 00000000000..d1a98d454f1 --- /dev/null +++ b/queue-4.14/net-stmmac-fix-reception-of-broadcom-switches-tags.patch @@ -0,0 +1,163 @@ +From 8cad443eacf661796a740903a75cb8944c675b4e Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Thu, 18 Jan 2018 15:12:21 -0800 +Subject: net: stmmac: Fix reception of Broadcom switches tags + +From: Florian Fainelli + +commit 8cad443eacf661796a740903a75cb8944c675b4e upstream. + +Broadcom tags inserted by Broadcom switches put a 4 byte header after +the MAC SA and before the EtherType, which may look like some sort of 0 +length LLC/SNAP packet (tcpdump and wireshark do think that way). With +ACS enabled in stmmac the packets were truncated to 8 bytes on +reception, whereas clearing this bit allowed normal reception to occur. + +In order to make that possible, we need to pass a net_device argument to +the different core_init() functions and we are dependent on the Broadcom +tagger padding packets correctly (which it now does). To be as little +invasive as possible, this is only done for gmac1000 when the network +device is DSA-enabled (netdev_uses_dsa() returns true). + +Signed-off-by: Florian Fainelli +Acked-by: Giuseppe Cavallaro +Signed-off-by: David S. Miller +Cc: Niklas Cassel +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/stmicro/stmmac/common.h | 2 +- + drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 3 ++- + drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 12 +++++++++++- + drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c | 15 +++++++++++++-- + drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 12 +++++++++++- + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- + 6 files changed, 39 insertions(+), 7 deletions(-) + +--- a/drivers/net/ethernet/stmicro/stmmac/common.h ++++ b/drivers/net/ethernet/stmicro/stmmac/common.h +@@ -475,7 +475,7 @@ struct mac_device_info; + /* Helpers to program the MAC core */ + struct stmmac_ops { + /* MAC core initialization */ +- void (*core_init)(struct mac_device_info *hw, int mtu); ++ void (*core_init)(struct mac_device_info *hw, struct net_device *dev); + /* Enable the MAC RX/TX */ + void (*set_mac)(void __iomem *ioaddr, bool enable); + /* Enable and verify that the IPC module is supported */ +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +@@ -477,7 +477,8 @@ static int sun8i_dwmac_init(struct platf + return 0; + } + +-static void sun8i_dwmac_core_init(struct mac_device_info *hw, int mtu) ++static void sun8i_dwmac_core_init(struct mac_device_info *hw, ++ struct net_device *dev) + { + void __iomem *ioaddr = hw->pcsr; + u32 v; +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +@@ -25,18 +25,28 @@ + #include + #include + #include ++#include + #include + #include "stmmac_pcs.h" + #include "dwmac1000.h" + +-static void dwmac1000_core_init(struct mac_device_info *hw, int mtu) ++static void dwmac1000_core_init(struct mac_device_info *hw, ++ struct net_device *dev) + { + void __iomem *ioaddr = hw->pcsr; + u32 value = readl(ioaddr + GMAC_CONTROL); ++ int mtu = dev->mtu; + + /* Configure GMAC core */ + 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_CONTROL_ACS; ++ + if (mtu > 1500) + value |= GMAC_CONTROL_2K; + if (mtu > 2000) +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c +@@ -25,15 +25,26 @@ + *******************************************************************************/ + + #include ++#include + #include + #include "dwmac100.h" + +-static void dwmac100_core_init(struct mac_device_info *hw, int mtu) ++static void dwmac100_core_init(struct mac_device_info *hw, ++ struct net_device *dev) + { + void __iomem *ioaddr = hw->pcsr; + u32 value = readl(ioaddr + MAC_CONTROL); + +- writel((value | MAC_CORE_INIT), ioaddr + MAC_CONTROL); ++ value |= MAC_CORE_INIT; ++ ++ /* Clear ASTP 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 &= ~MAC_CONTROL_ASTP; ++ ++ writel(value, ioaddr + MAC_CONTROL); + + #ifdef STMMAC_VLAN_TAG_USED + writel(ETH_P_8021Q, ioaddr + MAC_VLAN1); +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +@@ -17,16 +17,26 @@ + #include + #include + #include ++#include + #include "stmmac_pcs.h" + #include "dwmac4.h" + +-static void dwmac4_core_init(struct mac_device_info *hw, int mtu) ++static void dwmac4_core_init(struct mac_device_info *hw, ++ struct net_device *dev) + { + void __iomem *ioaddr = hw->pcsr; + u32 value = readl(ioaddr + GMAC_CONFIG); ++ int mtu = dev->mtu; + + 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) +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -2497,7 +2497,7 @@ static int stmmac_hw_setup(struct net_de + } + + /* Initialize the MAC Core */ +- priv->hw->mac->core_init(priv->hw, dev->mtu); ++ priv->hw->mac->core_init(priv->hw, dev); + + /* Initialize MTL*/ + if (priv->synopsys_id >= DWMAC_CORE_4_00) diff --git a/queue-4.14/series b/queue-4.14/series index c5c92cac45a..ba433ccb273 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -1,3 +1,5 @@ revert-loop-fix-double-mutex_unlock-loop_ctl_mutex-in-loop_control_ioctl.patch revert-loop-get-rid-of-loop_index_mutex.patch revert-loop-fold-__loop_release-into-loop_release.patch +net-stmmac-fix-reception-of-broadcom-switches-tags.patch +net-stmmac-disable-acs-feature-for-gmac-4.patch