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>
This commit is contained in:

committed by
David S. Miller

parent
c279c7261a
commit
fb77ffc6ec
@@ -664,16 +664,6 @@ static void vsc73xx_init_port(struct vsc73xx *vsc, int port)
|
|||||||
VSC73XX_MAC_CFG_TX_EN |
|
VSC73XX_MAC_CFG_TX_EN |
|
||||||
VSC73XX_MAC_CFG_RX_EN);
|
VSC73XX_MAC_CFG_RX_EN);
|
||||||
|
|
||||||
/* Max length, we can do up to 9.6 KiB, so allow that.
|
|
||||||
* According to application not "VSC7398 Jumbo Frames" setting
|
|
||||||
* up the MTU to 9.6 KB does not affect the performance on standard
|
|
||||||
* frames, so just enable it. It is clear from the application note
|
|
||||||
* that "9.6 kilobytes" == 9600 bytes.
|
|
||||||
*/
|
|
||||||
vsc73xx_write(vsc, VSC73XX_BLOCK_MAC,
|
|
||||||
port,
|
|
||||||
VSC73XX_MAXLEN, 9600);
|
|
||||||
|
|
||||||
/* Flow control for the CPU port:
|
/* Flow control for the CPU port:
|
||||||
* Use a zero delay pause frame when pause condition is left
|
* Use a zero delay pause frame when pause condition is left
|
||||||
* Obey pause control frames
|
* Obey pause control frames
|
||||||
@@ -1030,6 +1020,24 @@ static void vsc73xx_get_ethtool_stats(struct dsa_switch *ds, int port,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int vsc73xx_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
|
||||||
|
{
|
||||||
|
struct vsc73xx *vsc = ds->priv;
|
||||||
|
|
||||||
|
return vsc73xx_write(vsc, VSC73XX_BLOCK_MAC, port,
|
||||||
|
VSC73XX_MAXLEN, new_mtu);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* According to application not "VSC7398 Jumbo Frames" setting
|
||||||
|
* up the MTU to 9.6 KB does not affect the performance on standard
|
||||||
|
* frames. It is clear from the application note that
|
||||||
|
* "9.6 kilobytes" == 9600 bytes.
|
||||||
|
*/
|
||||||
|
static int vsc73xx_get_max_mtu(struct dsa_switch *ds, int port)
|
||||||
|
{
|
||||||
|
return 9600;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct dsa_switch_ops vsc73xx_ds_ops = {
|
static const struct dsa_switch_ops vsc73xx_ds_ops = {
|
||||||
.get_tag_protocol = vsc73xx_get_tag_protocol,
|
.get_tag_protocol = vsc73xx_get_tag_protocol,
|
||||||
.setup = vsc73xx_setup,
|
.setup = vsc73xx_setup,
|
||||||
@@ -1041,6 +1049,8 @@ static const struct dsa_switch_ops vsc73xx_ds_ops = {
|
|||||||
.get_sset_count = vsc73xx_get_sset_count,
|
.get_sset_count = vsc73xx_get_sset_count,
|
||||||
.port_enable = vsc73xx_port_enable,
|
.port_enable = vsc73xx_port_enable,
|
||||||
.port_disable = vsc73xx_port_disable,
|
.port_disable = vsc73xx_port_disable,
|
||||||
|
.port_change_mtu = vsc73xx_change_mtu,
|
||||||
|
.port_max_mtu = vsc73xx_get_max_mtu,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int vsc73xx_gpio_get(struct gpio_chip *chip, unsigned int offset)
|
static int vsc73xx_gpio_get(struct gpio_chip *chip, unsigned int offset)
|
||||||
|
Reference in New Issue
Block a user