Skip to content

Commit f15b8d6

Browse files
author
Paolo Abeni
committed
Merge branch 'net-dsa-b53-assorted-jumbo-frame-fixes'
Jonas Gorski says: ==================== net: dsa: b53: assorted jumbo frame fixes While investigating the capabilities of BCM63XX's integrated switch and its DMA engine, I noticed a few issues in b53's jumbo frame code. Mostly a confusion of MTU vs frame length, but also a few missing cases for 100M switches. Tested on BCM63XX and BCM53115 with intel 1G and realtek 1G NICs, which support MTUs of 9000 or slightly above, but significantly less than the 9716/9720 supported by BCM53115, so I couldn't verify the actual maximum frame length. Signed-off-by: Jonas Gorski <[email protected]> --- ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 60ed96b + 2f3dcd0 commit f15b8d6

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 13 additions & 4 deletions
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,9 @@ 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_25 (1536 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN)
229+
#define B53_MAX_MTU (9720 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN)
230+
227231
static int b53_do_vlan_op(struct b53_device *dev, u8 op)
228232
{
229233
unsigned int i;
@@ -2254,20 +2258,25 @@ static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu)
22542258
bool allow_10_100;
22552259

22562260
if (is5325(dev) || is5365(dev))
2257-
return -EOPNOTSUPP;
2261+
return 0;
22582262

22592263
if (!dsa_is_cpu_port(ds, port))
22602264
return 0;
22612265

2262-
enable_jumbo = (mtu >= JMS_MIN_SIZE);
2263-
allow_10_100 = (dev->chip_id == BCM583XX_DEVICE_ID);
2266+
enable_jumbo = (mtu > ETH_DATA_LEN);
2267+
allow_10_100 = !is63xx(dev);
22642268

22652269
return b53_set_jumbo(dev, enable_jumbo, allow_10_100);
22662270
}
22672271

22682272
static int b53_get_max_mtu(struct dsa_switch *ds, int port)
22692273
{
2270-
return JMS_MAX_SIZE;
2274+
struct b53_device *dev = ds->priv;
2275+
2276+
if (is5325(dev) || is5365(dev))
2277+
return B53_MAX_MTU_25;
2278+
2279+
return B53_MAX_MTU;
22712280
}
22722281

22732282
static const struct phylink_mac_ops b53_phylink_mac_ops = {

0 commit comments

Comments
 (0)