2020-03-08 09:19:54

by Remi Pommarel

[permalink] [raw]
Subject: [PATCH v2] net: stmmac: dwmac1000: Disable ACS if enhanced descs are not used

ACS (auto PAD/FCS stripping) removes FCS off 802.3 packets (LLC) so that
there is no need to manually strip it for such packets. The enhanced DMA
descriptors allow to flag LLC packets so that the receiving callback can
use that to strip FCS manually or not. On the other hand, normal
descriptors do not support that.

Thus in order to not truncate LLC packet ACS should be disabled when
using normal DMA descriptors.

Fixes: 47dd7a540b8a0 ("net: add support for STMicroelectronics Ethernet controllers.")
Cc: [email protected]
Signed-off-by: Remi Pommarel <[email protected]>
---
Changes since v1:
- Use reverse christmas tree like declaration
- Add Fixes tag
---
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index d0356fbd1e43..542784300620 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -24,6 +24,7 @@
static void dwmac1000_core_init(struct mac_device_info *hw,
struct net_device *dev)
{
+ struct stmmac_priv *priv = netdev_priv(dev);
void __iomem *ioaddr = hw->pcsr;
u32 value = readl(ioaddr + GMAC_CONTROL);
int mtu = dev->mtu;
@@ -35,7 +36,7 @@ static void dwmac1000_core_init(struct mac_device_info *hw,
* Broadcom tags can look like invalid LLC/SNAP packets and cause the
* hardware to truncate packets on reception.
*/
- if (netdev_uses_dsa(dev))
+ if (netdev_uses_dsa(dev) || !priv->plat->enh_desc)
value &= ~GMAC_CONTROL_ACS;

if (mtu > 1500)
--
2.25.0


2020-03-09 04:30:06

by David Miller

[permalink] [raw]
Subject: Re: [PATCH v2] net: stmmac: dwmac1000: Disable ACS if enhanced descs are not used

From: Remi Pommarel <[email protected]>
Date: Sun, 8 Mar 2020 10:25:56 +0100

> ACS (auto PAD/FCS stripping) removes FCS off 802.3 packets (LLC) so that
> there is no need to manually strip it for such packets. The enhanced DMA
> descriptors allow to flag LLC packets so that the receiving callback can
> use that to strip FCS manually or not. On the other hand, normal
> descriptors do not support that.
>
> Thus in order to not truncate LLC packet ACS should be disabled when
> using normal DMA descriptors.
>
> Fixes: 47dd7a540b8a0 ("net: add support for STMicroelectronics Ethernet controllers.")
> Cc: [email protected]
> Signed-off-by: Remi Pommarel <[email protected]>

Please don't CC: stable for networking fixes as per the netdev FAQ.

Applied and queued up for -stable, thank you.