Skip to content

Commit bd1f41c

Browse files
KanjiMonstergregkh
authored andcommitted
net: dsa: b53: fix max MTU for 1g switches
[ Upstream commit 680a821 ] JMS_MAX_SIZE is the ethernet frame length, not the MTU, which is payload without ethernet headers. According to the datasheets maximum supported frame length for most gigabyte swithes is 9720 bytes, so convert that to the expected MTU when using VLAN tagged frames. Fixes: 6ae5834 ("net: dsa: b53: add MTU configuration support") Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f9a966a commit bd1f41c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/phylink.h>
2828
#include <linux/etherdevice.h>
2929
#include <linux/if_bridge.h>
30+
#include <linux/if_vlan.h>
3031
#include <net/dsa.h>
3132

3233
#include "b53_regs.h"
@@ -224,6 +225,8 @@ static const struct b53_mib_desc b53_mibs_58xx[] = {
224225

225226
#define B53_MIBS_58XX_SIZE ARRAY_SIZE(b53_mibs_58xx)
226227

228+
#define B53_MAX_MTU (9720 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN)
229+
227230
static int b53_do_vlan_op(struct b53_device *dev, u8 op)
228231
{
229232
unsigned int i;
@@ -2276,7 +2279,7 @@ static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu)
22762279

22772280
static int b53_get_max_mtu(struct dsa_switch *ds, int port)
22782281
{
2279-
return JMS_MAX_SIZE;
2282+
return B53_MAX_MTU;
22802283
}
22812284

22822285
static const struct dsa_switch_ops b53_switch_ops = {

0 commit comments

Comments
 (0)