Skip to content

Commit fb77ffc

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: vsc73xx: make the MTU configurable
Instead of hardcoding the MTU to the maximum value allowed by the hardware, obey the value known by the operating system. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c279c72 commit fb77ffc

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

drivers/net/dsa/vitesse-vsc73xx-core.c

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -664,16 +664,6 @@ static void vsc73xx_init_port(struct vsc73xx *vsc, int port)
664664
VSC73XX_MAC_CFG_TX_EN |
665665
VSC73XX_MAC_CFG_RX_EN);
666666

667-
/* Max length, we can do up to 9.6 KiB, so allow that.
668-
* According to application not "VSC7398 Jumbo Frames" setting
669-
* up the MTU to 9.6 KB does not affect the performance on standard
670-
* frames, so just enable it. It is clear from the application note
671-
* that "9.6 kilobytes" == 9600 bytes.
672-
*/
673-
vsc73xx_write(vsc, VSC73XX_BLOCK_MAC,
674-
port,
675-
VSC73XX_MAXLEN, 9600);
676-
677667
/* Flow control for the CPU port:
678668
* Use a zero delay pause frame when pause condition is left
679669
* Obey pause control frames
@@ -1030,6 +1020,24 @@ static void vsc73xx_get_ethtool_stats(struct dsa_switch *ds, int port,
10301020
}
10311021
}
10321022

1023+
static int vsc73xx_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
1024+
{
1025+
struct vsc73xx *vsc = ds->priv;
1026+
1027+
return vsc73xx_write(vsc, VSC73XX_BLOCK_MAC, port,
1028+
VSC73XX_MAXLEN, new_mtu);
1029+
}
1030+
1031+
/* According to application not "VSC7398 Jumbo Frames" setting
1032+
* up the MTU to 9.6 KB does not affect the performance on standard
1033+
* frames. It is clear from the application note that
1034+
* "9.6 kilobytes" == 9600 bytes.
1035+
*/
1036+
static int vsc73xx_get_max_mtu(struct dsa_switch *ds, int port)
1037+
{
1038+
return 9600;
1039+
}
1040+
10331041
static const struct dsa_switch_ops vsc73xx_ds_ops = {
10341042
.get_tag_protocol = vsc73xx_get_tag_protocol,
10351043
.setup = vsc73xx_setup,
@@ -1041,6 +1049,8 @@ static const struct dsa_switch_ops vsc73xx_ds_ops = {
10411049
.get_sset_count = vsc73xx_get_sset_count,
10421050
.port_enable = vsc73xx_port_enable,
10431051
.port_disable = vsc73xx_port_disable,
1052+
.port_change_mtu = vsc73xx_change_mtu,
1053+
.port_max_mtu = vsc73xx_get_max_mtu,
10441054
};
10451055

10461056
static int vsc73xx_gpio_get(struct gpio_chip *chip, unsigned int offset)

0 commit comments

Comments
 (0)