@@ -3545,11 +3545,10 @@ static int mv88e6xxx_get_max_mtu(struct dsa_switch *ds, int port)
{
struct mv88e6xxx_chip *chip = ds->priv;
- if (chip->info->ops->port_set_jumbo_size)
- return 10240 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN;
- else if (chip->info->ops->set_max_frame_size)
- return 1632 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN;
- return 1522 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN;
+ WARN_ON_ONCE(!chip->info->max_frame_size);
+
+ return chip->info->max_frame_size - VLAN_ETH_HLEN - EDSA_HLEN
+ - ETH_FCS_LEN;
}
static int mv88e6xxx_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
After this change the value specified in max_frame_size variable is used to provide information regarding the maximal size of frame supported in the switch. This approach replaces the current detection scheme, which extracts information about max frame size depending on set of provided callbacks. This is wrong, as some switch ICs can have max frame size equal to 1632 or 2048 and both would provide set_max_frame_size callback. Signed-off-by: Lukasz Majewski <lukma@denx.de> --- Changes for v5: - New patch --- drivers/net/dsa/mv88e6xxx/chip.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)