--- zzzz-none-000/linux-4.9.279/net/bridge/br_if.c 2021-08-08 06:38:54.000000000 +0000 +++ puma7-atom-6591-750/linux-4.9.279/net/bridge/br_if.c 2023-02-08 11:43:43.000000000 +0000 @@ -11,6 +11,10 @@ * 2 of the License, or (at your option) any later version. */ +/* + * Includes Intel Corporation's changes/modifications dated: 2017, 2018. + * Changed/modified portions - Copyright (c) 2017-2018, Intel Corporation + */ #include #include #include @@ -262,6 +266,9 @@ struct net_bridge *br = p->br; struct net_device *dev = p->dev; +#ifdef CONFIG_LTQ_MCAST_SNOOPING + br_mcast_port_cleanup(p); +#endif sysfs_remove_link(br->ifobj, p->dev->name); nbp_delete_promisc(p); @@ -362,8 +369,12 @@ p->path_cost = port_cost(dev); p->priority = 0x8000 >> BR_PORT_BITS; p->port_no = index; - p->flags = BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD; + p->flags = BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD | BR_BCAST_FLOOD; br_init_port(p); +#ifdef CONFIG_LTQ_MCAST_SNOOPING + br_mcast_port_init(p); + spin_lock_init(&p->mghash_lock); +#endif br_set_state(p, BR_STATE_DISABLED); br_stp_port_timer_init(p); err = br_multicast_add_port(p); @@ -424,22 +435,31 @@ } /* MTU of the bridge pseudo-device: ETH_DATA_LEN or the minimum of the ports */ -int br_min_mtu(const struct net_bridge *br) +static int br_mtu_min(const struct net_bridge *br) { const struct net_bridge_port *p; - int mtu = 0; + int ret_mtu = 0; + + list_for_each_entry(p, &br->port_list, list) + if (!ret_mtu || ret_mtu > p->dev->mtu) + ret_mtu = p->dev->mtu; + + return ret_mtu ? ret_mtu : ETH_DATA_LEN; +} +void br_mtu_auto_adjust(struct net_bridge *br) +{ ASSERT_RTNL(); - if (list_empty(&br->port_list)) - mtu = ETH_DATA_LEN; - else { - list_for_each_entry(p, &br->port_list, list) { - if (!mtu || p->dev->mtu < mtu) - mtu = p->dev->mtu; - } - } - return mtu; + /* if the bridge MTU was manually configured don't mess with it */ + if (br->mtu_set_by_user) + return; + + /* change to the minimum MTU and clear the flag which was set by + * the bridge ndo_change_mtu callback + */ + dev_set_mtu(br->dev, br_mtu_min(br)); + br->mtu_set_by_user = false; } static void br_set_gso_limits(struct net_bridge *br) @@ -601,11 +621,14 @@ if (changed_addr) call_netdevice_notifiers(NETDEV_CHANGEADDR, br->dev); - dev_set_mtu(br->dev, br_min_mtu(br)); + br_mtu_auto_adjust(br); br_set_gso_limits(br); kobject_uevent(&p->kobj, KOBJ_ADD); +#ifdef CONFIG_LTQ_MCAST_SNOOPING + br_ifinfo_notify(RTM_NEWLINK, p); +#endif return 0; err7: @@ -647,7 +670,7 @@ */ del_nbp(p); - dev_set_mtu(br->dev, br_min_mtu(br)); + br_mtu_auto_adjust(br); br_set_gso_limits(br); spin_lock_bh(&br->lock);