Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 6ae5834

Browse files
muralipolicharla-brcmdavem330
authored andcommitted
net: dsa: b53: add MTU configuration support
It looks like the Broadcom switches supported by the b53 driver don't support precise configuration of the MTU, but just a mumbo-jumbo boolean flag. Set that. Also configure BCM583XX devices to send and receive jumbo frames when ports are configured with 10/100 Mbps speed. Signed-off-by: Murali Krishna Policharla <[email protected]> Signed-off-by: Vladimir Oltean <[email protected]> Acked-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bff33f7 commit 6ae5834

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -699,9 +699,6 @@ int b53_configure_vlan(struct dsa_switch *ds)
699699
b53_write16(dev, B53_VLAN_PAGE,
700700
B53_VLAN_PORT_DEF_TAG(i), def_vid);
701701

702-
if (!is5325(dev) && !is5365(dev))
703-
b53_set_jumbo(dev, dev->enable_jumbo, false);
704-
705702
return 0;
706703
}
707704
EXPORT_SYMBOL(b53_configure_vlan);
@@ -807,8 +804,6 @@ static int b53_phy_write16(struct dsa_switch *ds, int addr, int reg, u16 val)
807804
static int b53_reset_switch(struct b53_device *priv)
808805
{
809806
/* reset vlans */
810-
priv->enable_jumbo = false;
811-
812807
memset(priv->vlans, 0, sizeof(*priv->vlans) * priv->num_vlans);
813808
memset(priv->ports, 0, sizeof(*priv->ports) * priv->num_ports);
814809

@@ -2065,6 +2060,26 @@ int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e)
20652060
}
20662061
EXPORT_SYMBOL(b53_set_mac_eee);
20672062

2063+
static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu)
2064+
{
2065+
struct b53_device *dev = ds->priv;
2066+
bool enable_jumbo;
2067+
bool allow_10_100;
2068+
2069+
if (is5325(dev) || is5365(dev))
2070+
return -EOPNOTSUPP;
2071+
2072+
enable_jumbo = (mtu >= JMS_MIN_SIZE);
2073+
allow_10_100 = (dev->chip_id == BCM583XX_DEVICE_ID);
2074+
2075+
return b53_set_jumbo(dev, enable_jumbo, allow_10_100);
2076+
}
2077+
2078+
static int b53_get_max_mtu(struct dsa_switch *ds, int port)
2079+
{
2080+
return JMS_MAX_SIZE;
2081+
}
2082+
20682083
static const struct dsa_switch_ops b53_switch_ops = {
20692084
.get_tag_protocol = b53_get_tag_protocol,
20702085
.setup = b53_setup,
@@ -2102,6 +2117,8 @@ static const struct dsa_switch_ops b53_switch_ops = {
21022117
.port_mdb_prepare = b53_mdb_prepare,
21032118
.port_mdb_add = b53_mdb_add,
21042119
.port_mdb_del = b53_mdb_del,
2120+
.port_max_mtu = b53_get_max_mtu,
2121+
.port_change_mtu = b53_change_mtu,
21052122
};
21062123

21072124
struct b53_chip_data {

0 commit comments

Comments
 (0)