X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=datapath%2Fdatapath.c;h=116fd989cd51688a83225e9203fef47c3eee71ce;hb=23935e8bcb5be3e82ed2fb16333fdbea36eedfcd;hp=539859a40c908a2698d12fa9970e70f484809ac6;hpb=8cdaca99b5742489c35b1cac6e39791a47451952;p=openvswitch diff --git a/datapath/datapath.c b/datapath/datapath.c index 539859a4..116fd989 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -419,6 +419,7 @@ got_port_no: if (err) goto out_put; + set_dp_devs_mtu(dp, dev); dp_sysfs_add_if(dp->ports[port_no]); err = __put_user(port_no, &port.port); @@ -1319,6 +1320,29 @@ int dp_min_mtu(const struct datapath *dp) return mtu ? mtu : ETH_DATA_LEN; } +/* Sets the MTU of all datapath devices to the minimum of the ports. 'dev' + * is the device whose MTU may have changed. Must be called with RTNL lock + * and dp_mutex. */ +void set_dp_devs_mtu(const struct datapath *dp, struct net_device *dev) +{ + struct net_bridge_port *p; + int mtu; + + ASSERT_RTNL(); + + if (is_dp_dev(dev)) + return; + + mtu = dp_min_mtu(dp); + + list_for_each_entry_rcu (p, &dp->port_list, node) { + struct net_device *br_dev = p->dev; + + if (is_dp_dev(br_dev)) + dev_set_mtu(br_dev, mtu); + } +} + static int put_port(const struct net_bridge_port *p, struct odp_port __user *uop) {