stable backport request for stmmac DSA tag fixes
Subsystems (4)
Hello,
I would like to request:
8cad443eacf6 ("net: stmmac: Fix reception of Broadcom switches tags") (was first included in v4.16)
and
565020aaeebf ("net: stmmac: Disable ACS Feature for GMAC >= 4") (was first included in v4.17)
to be backported to linux-stable/linux-4.14.y
Without these, packets will get stripped twice (corrupted) when using stmmac with switches that uses DSA tags.
Kind regards,
Niklas
Greg KH
maintainerQuoted 11 lines · Niklas Cassel
Hello,
I would like to request:
8cad443eacf6("net: stmmac: Fix reception of Broadcom switches tags") (was first included in v4.16)and
565020aaeebf("net: stmmac: Disable ACS Feature for GMAC >= 4") (was first included in v4.17)
This patch looks like it needs to be applied to 4.9.y as well, can you provide a backported version?
Quoted 4 lines
to be backported to linux-stable/linux-4.14.y
Without these, packets will get stripped twice (corrupted) when using stmmac with switches that uses DSA tags.
Both now queued up, thanks.
greg k-h
Niklas Cassel
Acked-by Giuseppe CavallaroQuoted 8 lines · Greg KH
Quoted 7 lines · Niklas Cassel
Hello,
I would like to request:
8cad443eacf6("net: stmmac: Fix reception of Broadcom switches tags") (was first included in v4.16)
Quoted 7 lines
Quoted 4 lines
and
565020aaeebf("net: stmmac: Disable ACS Feature for GMAC >= 4") (was first included in v4.17)This patch looks like it needs to be applied to 4.9.y as well, can you provide a backported version?
Actually, the second patch depends on the first patch, since it changes code added by the first patch, so these should be backported together.
However, there was a trivial one liner conflict in v4.9 when cherry-picking the first patch, so I attached a backport. After this, the second patch applies on v4.9 without conflicts.
Kind regards,
Niklas
Quoted 9 lines
Quoted 5 lines
to be backported to linux-stable/linux-4.14.y
Without these, packets will get stripped twice (corrupted) when using stmmac with switches that uses DSA tags.
Both now queued up, thanks.
greg k-h
From 7228f30ed3900af939fd69e807b7a35ce545efe9 Mon Sep 17 00:00:00 2001
From: Florian Fainelli <[email protected]>
Date: Thu, 18 Jan 2018 15:12:21 -0800
Subject: [PATCH] net: stmmac: Fix reception of Broadcom switches tags
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).
--- drivers/net/ethernet/stmicro/stmmac/common.h | 2 +- .../net/ethernet/stmicro/stmmac/dwmac1000_core.c | 12 +++++++++++- .../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 +- 5 files changed, 37 insertions(+), 6 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +1 -1
@@ -450,7 +450,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 and verify that the IPC module is supported */ int (*rx_ipc)(struct mac_device_info *hw);/* Dump MAC registers */
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +11 -1
@@ -29,18 +29,28 @@#include <linux/crc32.h> #include <linux/slab.h> #include <linux/ethtool.h> +#include <net/dsa.h> #include <asm/io.h> #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 )
drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c +13 -2
@@ -29,15 +29,26 @@*******************************************************************************/ #include <linux/crc32.h> +#include <net/dsa.h> #include <asm/io.h> #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 );
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +11 -1
@@ -17,16 +17,26 @@#include <linux/slab.h> #include <linux/ethtool.h> #include <linux/io.h> +#include <net/dsa.h> #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 )
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -1
@@ -1716,7 +1716,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) }/* Initialize the MAC Core */ - priv->hw->mac->core_init (priv->hw, dev->mtu); + priv->hw->mac->core_init (priv->hw, dev); ret = priv->hw->mac->rx_ipc (priv->hw);if (!ret) {
Signature · 1 line
2.20.1