Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'mv88e6xxx-mtu-fixes'

Andrew Lunn says:

====================
mv88e6xxx: MTU fixes

These three patches fix MTU issues reported by 曹煜.

There are two different ways of configuring the MTU in the hardware.
The 6161 family is using the wrong method. Some of the marvell switch
enforce the MTU when the port is used for CPU/DSA, some don't.
Because of the extra header, the MTU needs increasing with this
overhead.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+15 -7
+10 -7
drivers/net/dsa/mv88e6xxx/chip.c
··· 2834 2834 if (err) 2835 2835 return err; 2836 2836 2837 - /* Port Control 2: don't force a good FCS, set the maximum frame size to 2838 - * 10240 bytes, disable 802.1q tags checking, don't discard tagged or 2837 + /* Port Control 2: don't force a good FCS, set the MTU size to 2838 + * 10222 bytes, disable 802.1q tags checking, don't discard tagged or 2839 2839 * untagged frames on this port, do a destination address lookup on all 2840 2840 * received packets as usual, disable ARP mirroring and don't send a 2841 2841 * copy of all transmitted/received frames on this port to the CPU. ··· 2854 2854 return err; 2855 2855 2856 2856 if (chip->info->ops->port_set_jumbo_size) { 2857 - err = chip->info->ops->port_set_jumbo_size(chip, port, 10240); 2857 + err = chip->info->ops->port_set_jumbo_size(chip, port, 10218); 2858 2858 if (err) 2859 2859 return err; 2860 2860 } ··· 2944 2944 struct mv88e6xxx_chip *chip = ds->priv; 2945 2945 2946 2946 if (chip->info->ops->port_set_jumbo_size) 2947 - return 10240; 2947 + return 10240 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; 2948 2948 else if (chip->info->ops->set_max_frame_size) 2949 - return 1632; 2950 - return 1522; 2949 + return 1632 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; 2950 + return 1522 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; 2951 2951 } 2952 2952 2953 2953 static int mv88e6xxx_change_mtu(struct dsa_switch *ds, int port, int new_mtu) 2954 2954 { 2955 2955 struct mv88e6xxx_chip *chip = ds->priv; 2956 2956 int ret = 0; 2957 + 2958 + if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port)) 2959 + new_mtu += EDSA_HLEN; 2957 2960 2958 2961 mv88e6xxx_reg_lock(chip); 2959 2962 if (chip->info->ops->port_set_jumbo_size) ··· 3728 3725 .port_set_ucast_flood = mv88e6352_port_set_ucast_flood, 3729 3726 .port_set_mcast_flood = mv88e6352_port_set_mcast_flood, 3730 3727 .port_set_ether_type = mv88e6351_port_set_ether_type, 3731 - .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, 3732 3728 .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, 3733 3729 .port_pause_limit = mv88e6097_port_pause_limit, 3734 3730 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, ··· 3752 3750 .avb_ops = &mv88e6165_avb_ops, 3753 3751 .ptp_ops = &mv88e6165_ptp_ops, 3754 3752 .phylink_validate = mv88e6185_phylink_validate, 3753 + .set_max_frame_size = mv88e6185_g1_set_max_frame_size, 3755 3754 }; 3756 3755 3757 3756 static const struct mv88e6xxx_ops mv88e6165_ops = {
+1
drivers/net/dsa/mv88e6xxx/chip.h
··· 18 18 #include <linux/timecounter.h> 19 19 #include <net/dsa.h> 20 20 21 + #define EDSA_HLEN 8 21 22 #define MV88E6XXX_N_FID 4096 22 23 23 24 /* PVT limits for 4-bit port and 5-bit switch */
+2
drivers/net/dsa/mv88e6xxx/global1.c
··· 232 232 u16 val; 233 233 int err; 234 234 235 + mtu += ETH_HLEN + ETH_FCS_LEN; 236 + 235 237 err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &val); 236 238 if (err) 237 239 return err;
+2
drivers/net/dsa/mv88e6xxx/port.c
··· 1277 1277 u16 reg; 1278 1278 int err; 1279 1279 1280 + size += VLAN_ETH_HLEN + ETH_FCS_LEN; 1281 + 1280 1282 err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_CTL2, &reg); 1281 1283 if (err) 1282 1284 return err;