summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBalazs Nemeth <balazs.nemeth@ericsson.com>2017-11-01 15:20:47 +0000
committerBen Pfaff <blp@ovn.org>2017-11-28 16:46:19 -0800
commitc8025aee4fa6a862d142dd8da780d45aaf0a868c (patch)
treec175d9a4ffbd5a51ecf148a134423d89efdc9d49 /lib
parent99910ebbf9c40ac0d747f5f22e64d24d8a0ae334 (diff)
downloadopenvswitch-c8025aee4fa6a862d142dd8da780d45aaf0a868c.tar.gz
tunnel: Fix deletion of datapath tunnel ports in case of reconfiguration
There is an issue in OVS with tunnel deletion during the reconfiguration of OF tunnels. If the dst_port value is changed, the old tunnel map entry will not be deleted, because the tp_port argument of tnl_port_map_delete() has the new dst_port setting, hence the tunnel cannot be found in the list of tnl_port structures. The patch corrects this mechanism by adding a new argument, 'old_odp_port' to tnl_port_reconfigure(). This value is used to identify the datapath tunnel port which is being reconfigured. In connection with this fix, to unify the tunnel port map handling, odp_port value is used to search the proper port to insert and delete tunnel map entries as well. This variable can be used instead of tp_port, as it is unique for all datapath tunnel ports, and there is no need to reach dst_port from netdev_tunnel_config structure. This patch also adds a printout to check the reference counter of a tnl_port structure in tnl-port.c. Extending OVS unit test cases to have ref_cnt values in the expected dump. Adding new test cases to check if packet receiving is still working in the case of OF tunnel port deletion. Adding new test cases to check the reference counter in case of OF tunnel deletion or reconfiguration. Signed-off-by: Balazs Nemeth <balazs.nemeth@ericsson.com> Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Co-authored-by: Jan Scheurich <jan.scheurich@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/tnl-ports.c9
-rw-r--r--lib/tnl-ports.h4
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/tnl-ports.c b/lib/tnl-ports.c
index 777ed4d61..04d2b3f7c 100644
--- a/lib/tnl-ports.c
+++ b/lib/tnl-ports.c
@@ -195,7 +195,7 @@ tnl_port_map_insert(odp_port_t port, ovs_be16 tp_port,
ovs_mutex_lock(&mutex);
LIST_FOR_EACH(p, node, &port_list) {
- if (tp_port == p->tp_port && p->nw_proto == nw_proto) {
+ if (p->port == port && p->nw_proto == nw_proto) {
ovs_refcount_ref(&p->ref_cnt);
goto out;
}
@@ -255,7 +255,7 @@ ipdev_map_delete(struct ip_device *ip_dev, ovs_be16 tp_port, uint8_t nw_proto)
}
void
-tnl_port_map_delete(ovs_be16 tp_port, const char type[])
+tnl_port_map_delete(odp_port_t port, const char type[])
{
struct tnl_port *p, *next;
struct ip_device *ip_dev;
@@ -265,7 +265,7 @@ tnl_port_map_delete(ovs_be16 tp_port, const char type[])
ovs_mutex_lock(&mutex);
LIST_FOR_EACH_SAFE(p, next, node, &port_list) {
- if (p->tp_port == tp_port && p->nw_proto == nw_proto &&
+ if (p->port == port && p->nw_proto == nw_proto &&
ovs_refcount_unref_relaxed(&p->ref_cnt) == 1) {
ovs_list_remove(&p->node);
LIST_FOR_EACH(ip_dev, node, &addr_list) {
@@ -348,7 +348,8 @@ tnl_port_show(struct unixctl_conn *conn, int argc OVS_UNUSED,
}
LIST_FOR_EACH(p, node, &port_list) {
- ds_put_format(&ds, "%s (%"PRIu32")\n", p->dev_name, p->port);
+ ds_put_format(&ds, "%s (%"PRIu32") ref_cnt=%u\n", p->dev_name, p->port,
+ ovs_refcount_read(&p->ref_cnt));
}
out:
diff --git a/lib/tnl-ports.h b/lib/tnl-ports.h
index 58b048a9c..61ca0f8e2 100644
--- a/lib/tnl-ports.h
+++ b/lib/tnl-ports.h
@@ -26,10 +26,10 @@
odp_port_t tnl_port_map_lookup(struct flow *flow, struct flow_wildcards *wc);
-void tnl_port_map_insert(odp_port_t port, ovs_be16 udp_port,
+void tnl_port_map_insert(odp_port_t, ovs_be16 tp_port,
const char dev_name[], const char type[]);
-void tnl_port_map_delete(ovs_be16 udp_port, const char type[]);
+void tnl_port_map_delete(odp_port_t, const char type[]);
void tnl_port_map_insert_ipdev(const char dev[]);
void tnl_port_map_delete_ipdev(const char dev[]);
void tnl_port_map_run(void);