Skip to content

Commit 64e47d8

Browse files
mad-jsanjuankuba-moo
authored andcommitted
net: ethernet: ti: am65-cpsw: Fix max mtu to fit ethernet frames
The value of AM65_CPSW_MAX_PACKET_SIZE represents the maximum length of a received frame. This value is written to the register AM65_CPSW_PORT_REG_RX_MAXLEN. The maximum MTU configured on the network device should then leave some room for the ethernet headers and frame check. Otherwise, if the network interface is configured to its maximum mtu possible, the frames will be larger than AM65_CPSW_MAX_PACKET_SIZE and will get dropped as oversized. The switch supports ethernet frame sizes between 64 and 2024 bytes (including VLAN) as stated in the technical reference manual, so define AM65_CPSW_MAX_PACKET_SIZE with that maximum size. Fixes: 93a7653 ("net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver") Signed-off-by: Jorge Sanjuan Garcia <jorge.sanjuangarcia@duagon.com> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com> Link: https://lore.kernel.org/r/20240105085530.14070-2-jorge.sanjuangarcia@duagon.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent e3fe8d2 commit 64e47d8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/net/ethernet/ti/am65-cpsw-nuss.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
#define AM65_CPSW_MAX_PORTS 8
5757

5858
#define AM65_CPSW_MIN_PACKET_SIZE VLAN_ETH_ZLEN
59-
#define AM65_CPSW_MAX_PACKET_SIZE (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN)
59+
#define AM65_CPSW_MAX_PACKET_SIZE 2024
6060

6161
#define AM65_CPSW_REG_CTL 0x004
6262
#define AM65_CPSW_REG_STAT_PORT_EN 0x014
@@ -2244,7 +2244,8 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx)
22442244
eth_hw_addr_set(port->ndev, port->slave.mac_addr);
22452245

22462246
port->ndev->min_mtu = AM65_CPSW_MIN_PACKET_SIZE;
2247-
port->ndev->max_mtu = AM65_CPSW_MAX_PACKET_SIZE;
2247+
port->ndev->max_mtu = AM65_CPSW_MAX_PACKET_SIZE -
2248+
(VLAN_ETH_HLEN + ETH_FCS_LEN);
22482249
port->ndev->hw_features = NETIF_F_SG |
22492250
NETIF_F_RXCSUM |
22502251
NETIF_F_HW_CSUM |

0 commit comments

Comments
 (0)