From: Alex Wang Date: Fri, 5 Dec 2014 22:02:53 +0000 (-0800) Subject: tunnel: Recreate tunnel port only when the netdev status change. X-Git-Tag: v2.3.2~53 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=d91b1e0e53c09826b63e7c06ca5df0749ebd40fa tunnel: Recreate tunnel port only when the netdev status change. On current master, the 'struct tnl_port' in tunnel module will be recreated whenever the global connectivity sequence number changes (e.g. when adding unrelated flow). This is unnecessary and could cause drop of tunnel packet if a lookup happens between the removal and recreate. This commit fixes the above issue by only checking the netdev's own sequence number. Found by code inspection. Signed-off-by: Alex Wang Acked-by: Joe Stringer --- diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c index 2b5aa503e..dcbbfb591 100644 --- a/ofproto/tunnel.c +++ b/ofproto/tunnel.c @@ -52,7 +52,7 @@ struct tnl_port { struct hmap_node match_node; const struct ofport_dpif *ofport; - unsigned int change_seq; + uint64_t change_seq; struct netdev *netdev; struct tnl_match match; @@ -138,7 +138,7 @@ tnl_port_add__(const struct ofport_dpif *ofport, const struct netdev *netdev, tnl_port = xzalloc(sizeof *tnl_port); tnl_port->ofport = ofport; tnl_port->netdev = netdev_ref(netdev); - tnl_port->change_seq = seq_read(connectivity_seq_get()); + tnl_port->change_seq = netdev_get_change_seq(tnl_port->netdev); tnl_port->match.in_key = cfg->in_key; tnl_port->match.ip_src = cfg->ip_src; @@ -206,7 +206,7 @@ tnl_port_reconfigure(const struct ofport_dpif *ofport, changed = tnl_port_add__(ofport, netdev, odp_port, false); } else if (tnl_port->netdev != netdev || tnl_port->match.odp_port != odp_port - || tnl_port->change_seq != seq_read(connectivity_seq_get())) { + || tnl_port->change_seq != netdev_get_change_seq(tnl_port->netdev)) { VLOG_DBG("reconfiguring %s", tnl_port_get_name(tnl_port)); tnl_port_del__(ofport); tnl_port_add__(ofport, netdev, odp_port, true);