diff options
author | Alex Wang <alexw@nicira.com> | 2014-12-05 14:02:53 -0800 |
---|---|---|
committer | Alex Wang <alexw@nicira.com> | 2014-12-05 14:02:53 -0800 |
commit | 7631e9bc5209e5b06d1d2fb3c06ee7fb343028c6 (patch) | |
tree | d195292377324c4018d4b057038a045a451d946f /ofproto/tunnel.c | |
parent | ec26264171cf866f453d7f2ab55569b36678c488 (diff) | |
download | openvswitch-7631e9bc5209e5b06d1d2fb3c06ee7fb343028c6.tar.gz |
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 <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
Diffstat (limited to 'ofproto/tunnel.c')
-rw-r--r-- | ofproto/tunnel.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c index 25df9eb2e..769f533ef 100644 --- a/ofproto/tunnel.c +++ b/ofproto/tunnel.c @@ -61,7 +61,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; @@ -158,7 +158,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; @@ -232,7 +232,7 @@ tnl_port_reconfigure(const struct ofport_dpif *ofport, changed = tnl_port_add__(ofport, netdev, odp_port, false, native_tnl, name); } 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, native_tnl, name); |