]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
net: ethernet: ti: cpsw: fix min eth packet size for non-switch use-cases
authorGrygorii Strashko <grygorii.strashko@ti.com>
Thu, 5 Aug 2021 14:55:11 +0000 (17:55 +0300)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 24 Sep 2021 09:56:56 +0000 (11:56 +0200)
commit3a791ad6675d2ed2ea76fe0a0688156c2d3f474b
treea5ba16dadc2a2b749b63642e9f7a74195ac478d4
parentfefd53737ec300bcefd3e8b5c06e5ec0fdc745c2
net: ethernet: ti: cpsw: fix min eth packet size for non-switch use-cases

BugLink: https://bugs.launchpad.net/bugs/1943756
commit acc68b8d2a1196c4db806947606f162dbeed2274 upstream.

The CPSW switchdev driver inherited fix from commit 9421c9015047 ("net:
ethernet: ti: cpsw: fix min eth packet size") which changes min TX packet
size to 64bytes (VLAN_ETH_ZLEN, excluding ETH_FCS). It was done to fix HW
packed drop issue when packets are sent from Host to the port with PVID and
un-tagging enabled. Unfortunately this breaks some other non-switch
specific use-cases, like:
- [1] CPSW port as DSA CPU port with DSA-tag applied at the end of the
packet
- [2] Some industrial protocols, which expects min TX packet size 60Bytes
(excluding FCS).

Fix it by configuring min TX packet size depending on driver mode
 - 60Bytes (ETH_ZLEN) for multi mac (dual-mac) mode
 - 64Bytes (VLAN_ETH_ZLEN) for switch mode
and update it during driver mode change and annotate with
READ_ONCE()/WRITE_ONCE() as it can be read by napi while writing.

[1] https://lore.kernel.org/netdev/20210531124051.GA15218@cephalopod/
[2] https://e2e.ti.com/support/arm/sitara_arm/f/791/t/701669

Cc: stable@vger.kernel.org
Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
Reported-by: Ben Hutchings <ben.hutchings@essensium.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/ti/cpsw_new.c
drivers/net/ethernet/ti/cpsw_priv.h