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

team: fix mtu setting

Now it is not possible to set mtu to team device which has a port
enslaved to it. The reason is that when team_change_mtu() calls
dev_set_mtu() for port device, notificator for NETDEV_PRECHANGEMTU
event is called and team_device_event() returns NOTIFY_BAD forbidding
the change. So fix this by returning NOTIFY_DONE here in case team is
changing mtu in team_change_mtu().

Introduced-by: 3d249d4c "net: introduce ethernet teaming device"
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jiri Pirko and committed by
David S. Miller
9d0d68fa 39c36094

+7 -1
+6 -1
drivers/net/team/team.c
··· 1724 1724 * to traverse list in reverse under rcu_read_lock 1725 1725 */ 1726 1726 mutex_lock(&team->lock); 1727 + team->port_mtu_change_allowed = true; 1727 1728 list_for_each_entry(port, &team->port_list, list) { 1728 1729 err = dev_set_mtu(port->dev, new_mtu); 1729 1730 if (err) { ··· 1733 1732 goto unwind; 1734 1733 } 1735 1734 } 1735 + team->port_mtu_change_allowed = false; 1736 1736 mutex_unlock(&team->lock); 1737 1737 1738 1738 dev->mtu = new_mtu; ··· 1743 1741 unwind: 1744 1742 list_for_each_entry_continue_reverse(port, &team->port_list, list) 1745 1743 dev_set_mtu(port->dev, dev->mtu); 1744 + team->port_mtu_change_allowed = false; 1746 1745 mutex_unlock(&team->lock); 1747 1746 1748 1747 return err; ··· 2854 2851 break; 2855 2852 case NETDEV_PRECHANGEMTU: 2856 2853 /* Forbid to change mtu of underlaying device */ 2857 - return NOTIFY_BAD; 2854 + if (!port->team->port_mtu_change_allowed) 2855 + return NOTIFY_BAD; 2856 + break; 2858 2857 case NETDEV_PRE_TYPE_CHANGE: 2859 2858 /* Forbid to change type of underlaying device */ 2860 2859 return NOTIFY_BAD;
+1
include/linux/if_team.h
··· 194 194 bool user_carrier_enabled; 195 195 bool queue_override_enabled; 196 196 struct list_head *qom_lists; /* array of queue override mapping lists */ 197 + bool port_mtu_change_allowed; 197 198 struct { 198 199 unsigned int count; 199 200 unsigned int interval; /* in ms */