Internal device mtu does not influence mtu of other internal devices. So skip MTU setting completely when internal device mtu is changed.
Signed-off-by: Pravin B Shelar <pshe...@nicira.com> --- ofproto/ofproto.c | 40 +++++++++++++++++++++------------------- 1 files changed, 21 insertions(+), 19 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index d03bd9b..e8058df 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -196,7 +196,7 @@ static enum ofperr handle_flow_mod__(struct ofproto *, struct ofconn *, static uint64_t pick_datapath_id(const struct ofproto *); static uint64_t pick_fallback_dpid(void); static void ofproto_destroy__(struct ofproto *); -static void set_internal_devs_mtu(struct ofproto *); +static void set_internal_devs_mtu(struct ofproto *, struct ofport *); /* unixctl. */ static void ofproto_unixctl_init(void); @@ -1457,7 +1457,6 @@ ofport_install(struct ofproto *p, { const char *netdev_name = netdev_get_name(netdev); struct ofport *ofport; - int dev_mtu; int error; /* Create ofport. */ @@ -1476,12 +1475,7 @@ ofport_install(struct ofproto *p, hmap_insert(&p->ports, &ofport->hmap_node, hash_int(ofport->ofp_port, 0)); shash_add(&p->port_by_name, netdev_name, ofport); - if (!netdev_get_mtu(netdev, &dev_mtu)) { - set_internal_devs_mtu(p); - ofport->mtu = dev_mtu; - } else { - ofport->mtu = 0; - } + set_internal_devs_mtu(p, ofport); /* Let the ofproto_class initialize its private data. */ error = p->ofproto_class->port_construct(ofport); @@ -1643,21 +1637,13 @@ update_port(struct ofproto *ofproto, const char *name) port = ofproto_get_port(ofproto, ofproto_port.ofp_port); if (port && !strcmp(netdev_get_name(port->netdev), name)) { struct netdev *old_netdev = port->netdev; - int dev_mtu; /* 'name' hasn't changed location. Any properties changed? */ if (!ofport_equal(&port->pp, &pp)) { ofport_modified(port, &pp); } - /* If this is a non-internal port and the MTU changed, check - * if the datapath's MTU needs to be updated. */ - if (strcmp(netdev_get_type(netdev), "internal") - && !netdev_get_mtu(netdev, &dev_mtu) - && port->mtu != dev_mtu) { - set_internal_devs_mtu(ofproto); - port->mtu = dev_mtu; - } + set_internal_devs_mtu(ofproto, port); /* Install the newly opened netdev in case it has changed. * Don't close the old netdev yet in case port_modified has to @@ -1747,11 +1733,27 @@ find_min_mtu(struct ofproto *p) /* Set the MTU of all datapath devices on 'p' to the minimum of the * non-datapath ports. */ static void -set_internal_devs_mtu(struct ofproto *p) +set_internal_devs_mtu(struct ofproto *p, struct ofport *new_port) { struct ofport *ofport; - int mtu = find_min_mtu(p); + struct netdev *netdev = new_port->netdev; + int mtu, dev_mtu; + + if (!netdev_get_mtu(netdev, &dev_mtu)) { + if (new_port->mtu == dev_mtu) { + return; + } + new_port->mtu = dev_mtu; + } else { + new_port->mtu = 0; + return; + } + + if (!strcmp(netdev_get_type(netdev), "internal")) { + return; + } + mtu = find_min_mtu(p); HMAP_FOR_EACH (ofport, hmap_node, &p->ports) { struct netdev *netdev = ofport->netdev; -- 1.7.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev