From patchwork Wed Nov 1 15:20:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balazs Nemeth X-Patchwork-Id: 832983 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.onmicrosoft.com header.i=@ericsson.onmicrosoft.com header.b="Hb3wZX3H"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yRsP52bmGz9sQl for ; Thu, 2 Nov 2017 02:20:56 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 4B2A7AAE; Wed, 1 Nov 2017 15:20:54 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id E6157A80 for ; Wed, 1 Nov 2017 15:20:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sesbmg23.ericsson.net (sesbmg23.ericsson.net [193.180.251.37]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 76AEE175 for ; Wed, 1 Nov 2017 15:20:51 +0000 (UTC) X-AuditID: c1b4fb25-debff70000000c94-25-59f9e651ae5f Received: from ESESSHC001.ericsson.se (Unknown_Domain [153.88.183.21]) by sesbmg23.ericsson.net (Symantec Mail Security) with SMTP id A9.EF.03220.156E9F95; Wed, 1 Nov 2017 16:20:49 +0100 (CET) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.21) with Microsoft SMTP Server (TLS) id 14.3.352.0; Wed, 1 Nov 2017 16:20:49 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.onmicrosoft.com; s=selector1-ericsson-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=1uG9Tqg4X0PNQv1STto8/HSNj7TGxTkPe7lQg2MbSy8=; b=Hb3wZX3HUEFZ04lhHJ1Jsu2bKyRZ9xlyJ5+tZkMCc3iR1rel8aq6e/MJ/G6GrYloFRV8TaN0oArWAo5mBoHUmvclBZSdu6UXFEW31tjAMLMeRXq6XX5IfCh1CVALf+GPhaMa1uggBp4gxzD3tDNKUQnvOvvKG6yV2z3K0hzH6SI= Received: from DB5PR07MB1496.eurprd07.prod.outlook.com (10.165.212.14) by DB5PR07MB1493.eurprd07.prod.outlook.com (10.165.212.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.4; Wed, 1 Nov 2017 15:20:47 +0000 Received: from DB5PR07MB1496.eurprd07.prod.outlook.com ([fe80::1921:92e4:a91:4c05]) by DB5PR07MB1496.eurprd07.prod.outlook.com ([fe80::1921:92e4:a91:4c05%14]) with mapi id 15.20.0197.013; Wed, 1 Nov 2017 15:20:47 +0000 From: Balazs Nemeth To: "'ovs-dev@openvswitch.org'" Thread-Topic: [PATCH v3] tunnel: Fix deletion of datapath tunnel ports in case of reconfiguration Thread-Index: AdNTJB2EWNhkePBcR2GFZX6Dx2IntQ== Date: Wed, 1 Nov 2017 15:20:47 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=balazs.nemeth@ericsson.com; x-originating-ip: [192.176.1.83] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB5PR07MB1493; 6:TXFuV5a/SB8+TLg/xluKeAPdCVD3crq3wSas4SF8fn1618JzK7w6rXsypFW9kI6iEdfXKT8MZpkokysdyHtuAM1VPdlml/gUHwNJ9n3f4KcL7005qXkYctSAuZjO4n0VorsnvPJN6/hNpyJOM2Diipqvk81yETpcmbt4wevGDVwJSJscQv10+eLsUJUfw7DmCTjp2cWQQBjifFs4BjJ4iUcoBltvICHIxR6cH2iRrBUA3UqpH3IpfO7cAV/QTttgbww1hzidiZu9/hDHaj6r4JGtPzMEfahlTqSDuMz1l85vo44NSFT5uojvdltvBUmun39hWDW/kCTaEPxkaEEbr3IAUITcC1XdXUtz5gnfxhQ=; 5:WqysnTYbw2XqlgmO8bbw9Lnx1+YpFe6BBo6yrhS0Db2M0UGyqqdQeSEbbRrsrKcZNNOy5Bgz/L0KWCG0YRC2PIRCq3XHbjCWcJnFD0qkTw9x9onpSJzLJqUwf11iWa3ZIkQSB82v4HAvj6k96Zi50jHd/IQOTXVny4Zi2zRoG0Q=; 24:/F6uJRNawboFdRbsu/KzJc9KHvenGjk438ZqqPj8ANwEl+OoEBhL0M3twrfvtbf0toTFvul/4+Yd8SeSaeipYxdjVnzoaxuEYrUkTaqdcTI=; 7:BY2HVLN4bO7eH0xSQnQOROVVbEWpnf1am2jtbbn4UEORU1G5FrDsTb5Sftwq1IfJqPQXopZa3YBIPKg+VyFWa4wLrC/CELPVyCuVhOYShGQ6rkJ9o65Wpavv7oUHLjOC0vLgCHaX7K3y1X4y/WjZZ874fHBDjOGcMythAUwGbnt5RMA+rANqn1EN7IwfvBB6E9QD/7hNini1vhWKFFyGsGv4bGqdQx46gSbr/YnGstXRzqE8nfdHLSYsGsL+XRH1 x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 461f93c2-2b32-4d19-5826-08d5213c20b0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(2017052603199); SRVR:DB5PR07MB1493; x-ms-traffictypediagnostic: DB5PR07MB1493: x-exchange-antispam-report-test: UriScan:(37575265505322); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(100000703101)(100105400095)(3231020)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123564025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB5PR07MB1493; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB5PR07MB1493; x-forefront-prvs: 0478C23FE0 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(39860400002)(199003)(189002)(53946003)(99286003)(55016002)(6506006)(66066001)(9686003)(53936002)(8936002)(8676002)(2900100001)(102836003)(3846002)(316002)(3280700002)(575784001)(86362001)(6436002)(6116002)(5250100002)(50986999)(54356999)(3660700001)(97736004)(101416001)(6916009)(25786009)(2906002)(105586002)(106356001)(33656002)(7696004)(478600001)(5660300001)(305945005)(74316002)(81166006)(7736002)(14454004)(68736007)(189998001)(81156014)(491001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR07MB1493; H:DB5PR07MB1496.eurprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 461f93c2-2b32-4d19-5826-08d5213c20b0 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Nov 2017 15:20:47.1412 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR07MB1493 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA02SbUhTYRTHeXbvtutoeVtOD1tBDSPSnJaRJSXaC/SlSCNQyXLqTYdzyr0q al9kJZZWGLhsgrpI1JkiZuK75qTCfMmmXzRTQZ2uHIWIMiNt27Ogb7/zP//nvPFQhMRByii1 NpthtSqNQiAiDbEd0qBoqyMuRPf06Jmq9RUUia5Yp3fRdRQvOpfCaNS5DBsckShK29TJs8oL 8ua6bPxCZEooQV4U0Kdg5b2ZKEEiSkIPIeh914dw8BGBtdUgdLlI+gkBY4WAE3oerJptPBws IJhbWBe4XAI6BIofP+S52Ic+C2O6Fr6L99O3oaurTYD1ZNgc6kCYlfC8ZZDAHfxh6UuL+62Y vgV/igfcHkT7wtanJrdO0H4ws1TDw3PTUNv7mcAsBdviDh/7E6DMsIawfghm9c1CzAfBUlPq Xg1osxB+3bd5TEpof2b38FUY3t0WYNZCw9dOjx4A8xtGZ2PKyeFQPeq5XTroTOU8XHOKDz97 Vj0DHYAXPQueOhV8qJ4GF0toBuqbixA+igy+TT1CZSiw8r/dMB8HY8+6AHMg1L38QVS677IP hg1LpBGRjUjKMVxSRurJUCXDqpM5LlOr1DLZb5DzQwy+/X2kE02uRZkRTSHFHvG1aUechK/K 5fIzzAgoQuEjHh91SuIUVX4Bw2beYXM0DGdGcopU+Imj+idiJXSqKptJZ5gshv2X5VFeskIk S7P3+ofuaCZSW1Xb9ceMN+8N+JlMltmZoI4iU+1IcNJpaTrXvXf5bqN324fOnMC+w+ED6tnS 8UhNecSriq0+/YO8yQvnLSEjEfHR896OMIu8NHG8yVcYwxFh7Y3L9hsbl3cnv18iq4aq9TEJ 9hGf11ndi9aY1ia7WV53sb9MQXJpqhMBBMup/gL0C6XTDAMAAA== X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v3] tunnel: Fix deletion of datapath tunnel ports in case of reconfiguration X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 Signed-off-by: Jan Scheurich Co-authored-by: Jan Scheurich Signed-off-by: Balazs Nemeth Signed-off-by: Jan Scheurich --- lib/tnl-ports.c | 9 +++++---- lib/tnl-ports.h | 4 ++-- ofproto/ofproto-dpif.c | 8 +++++--- ofproto/tunnel.c | 37 ++++++++++++++++++++----------------- ofproto/tunnel.h | 7 ++++--- tests/tunnel-push-pop-ipv6.at | 33 ++++++++++++++++++++++++++++++--- tests/tunnel-push-pop.at | 35 ++++++++++++++++++++++++++++++++--- 7 files changed, 98 insertions(+), 35 deletions(-) -- 1.9.1 diff --git a/lib/tnl-ports.c b/lib/tnl-ports.c index 777ed4d..04d2b3f 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 58b048a..61ca0f8 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); diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 43d670a..c2c2b8a 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -378,6 +378,7 @@ type_run(const char *type) HMAP_FOR_EACH (iter, up.hmap_node, &ofproto->up.ports) { char namebuf[NETDEV_VPORT_NAME_BUFSIZE]; const char *dp_port; + odp_port_t old_odp_port; if (!iter->is_tunnel) { continue; @@ -385,6 +386,7 @@ type_run(const char *type) dp_port = netdev_vport_get_dpif_port(iter->up.netdev, namebuf, sizeof namebuf); + old_odp_port = iter->odp_port; node = simap_find(&tmp_backers, dp_port); if (node) { simap_put(&backer->tnl_backers, dp_port, node->data); @@ -406,7 +408,7 @@ type_run(const char *type) iter->odp_port = node ? u32_to_odp(node->data) : ODPP_NONE; if (tnl_port_reconfigure(iter, iter->up.netdev, - iter->odp_port, + iter->odp_port, old_odp_port, ovs_native_tunneling_is_on(ofproto), dp_port)) { backer->need_revalidate = REV_RECONFIGURE; } @@ -1944,7 +1946,7 @@ port_destruct(struct ofport *port_, bool del) dpif_ipfix_del_tunnel_port(ofproto->ipfix, port->odp_port); } - tnl_port_del(port); + tnl_port_del(port, port->odp_port); sset_find_and_delete(&ofproto->ports, devname); sset_find_and_delete(&ofproto->ghost_ports, devname); bundle_remove(port_); @@ -2000,7 +2002,7 @@ port_modified(struct ofport *port_) if (port->is_tunnel) { struct ofproto_dpif *ofproto = ofproto_dpif_cast(port->up.ofproto); - if (tnl_port_reconfigure(port, netdev, port->odp_port, + if (tnl_port_reconfigure(port, netdev, port->odp_port, port->odp_port, ovs_native_tunneling_is_on(ofproto), dp_port_name)) { ofproto->backer->need_revalidate = REV_RECONFIGURE; diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c index c6856a0..1676f4d 100644 --- a/ofproto/tunnel.c +++ b/ofproto/tunnel.c @@ -126,7 +126,8 @@ static void tnl_port_mod_log(const struct tnl_port *, const char *action) OVS_REQ_RDLOCK(rwlock); static const char *tnl_port_get_name(const struct tnl_port *) OVS_REQ_RDLOCK(rwlock); -static void tnl_port_del__(const struct ofport_dpif *) OVS_REQ_WRLOCK(rwlock); +static void tnl_port_del__(const struct ofport_dpif *, odp_port_t) + OVS_REQ_WRLOCK(rwlock); void ofproto_tunnel_init(void) @@ -221,13 +222,15 @@ tnl_port_add(const struct ofport_dpif *ofport, const struct netdev *netdev, } /* Checks if the tunnel represented by 'ofport' reconfiguration due to changes - * in its netdev_tunnel_config. If it does, returns true. Otherwise, returns - * false. 'ofport' and 'odp_port' should be the same as would be passed to - * tnl_port_add(). */ + * in its netdev_tunnel_config. If it does, returns true. Otherwise, returns + * false. 'new_odp_port' should be the port number coming from 'ofport' that + * is passed to tnl_port_add__(). 'old_odp_port' should be the port number + * that is passed to tnl_port_del__(). */ bool tnl_port_reconfigure(const struct ofport_dpif *ofport, - const struct netdev *netdev, odp_port_t odp_port, - bool native_tnl, const char name[]) + const struct netdev *netdev, odp_port_t new_odp_port, + odp_port_t old_odp_port, bool native_tnl, + const char name[]) OVS_EXCLUDED(rwlock) { struct tnl_port *tnl_port; @@ -236,14 +239,14 @@ tnl_port_reconfigure(const struct ofport_dpif *ofport, fat_rwlock_wrlock(&rwlock); tnl_port = tnl_find_ofport(ofport); if (!tnl_port) { - changed = tnl_port_add__(ofport, netdev, odp_port, false, native_tnl, - name); + changed = tnl_port_add__(ofport, netdev, new_odp_port, false, + native_tnl, name); } else if (tnl_port->netdev != netdev - || tnl_port->match.odp_port != odp_port + || tnl_port->match.odp_port != new_odp_port || 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); + tnl_port_del__(ofport, old_odp_port); + tnl_port_add__(ofport, netdev, new_odp_port, true, native_tnl, name); changed = true; } fat_rwlock_unlock(&rwlock); @@ -251,7 +254,8 @@ tnl_port_reconfigure(const struct ofport_dpif *ofport, } static void -tnl_port_del__(const struct ofport_dpif *ofport) OVS_REQ_WRLOCK(rwlock) +tnl_port_del__(const struct ofport_dpif *ofport, odp_port_t odp_port) + OVS_REQ_WRLOCK(rwlock) { struct tnl_port *tnl_port; @@ -261,11 +265,9 @@ tnl_port_del__(const struct ofport_dpif *ofport) OVS_REQ_WRLOCK(rwlock) tnl_port = tnl_find_ofport(ofport); if (tnl_port) { - const struct netdev_tunnel_config *cfg = - netdev_get_tunnel_config(tnl_port->netdev); struct hmap **map; - tnl_port_map_delete(cfg->dst_port, netdev_get_type(tnl_port->netdev)); + tnl_port_map_delete(odp_port, netdev_get_type(tnl_port->netdev)); tnl_port_mod_log(tnl_port, "removing"); map = tnl_match_map(&tnl_port->match); hmap_remove(*map, &tnl_port->match_node); @@ -282,10 +284,11 @@ tnl_port_del__(const struct ofport_dpif *ofport) OVS_REQ_WRLOCK(rwlock) /* Removes 'ofport' from the module. */ void -tnl_port_del(const struct ofport_dpif *ofport) OVS_EXCLUDED(rwlock) +tnl_port_del(const struct ofport_dpif *ofport, odp_port_t odp_port) + OVS_EXCLUDED(rwlock) { fat_rwlock_wrlock(&rwlock); - tnl_port_del__(ofport); + tnl_port_del__(ofport, odp_port); fat_rwlock_unlock(&rwlock); } diff --git a/ofproto/tunnel.h b/ofproto/tunnel.h index b0ec67c..47d3dd5 100644 --- a/ofproto/tunnel.h +++ b/ofproto/tunnel.h @@ -32,11 +32,12 @@ struct netdev_tnl_build_header_params; void ofproto_tunnel_init(void); bool tnl_port_reconfigure(const struct ofport_dpif *, const struct netdev *, - odp_port_t, bool native_tnl, const char name[]); + odp_port_t new_odp_port, odp_port_t old_odp_port, + bool native_tnl, const char name[]); int tnl_port_add(const struct ofport_dpif *, const struct netdev *, - odp_port_t odp_port, bool native_tnl, const char name[]); -void tnl_port_del(const struct ofport_dpif *); + odp_port_t, bool native_tnl, const char name[]); +void tnl_port_del(const struct ofport_dpif *, odp_port_t); const struct ofport_dpif *tnl_port_receive(const struct flow *); void tnl_wc_init(struct flow *, struct flow_wildcards *); diff --git a/tests/tunnel-push-pop-ipv6.at b/tests/tunnel-push-pop-ipv6.at index 9ff7c89..8f51c06 100644 --- a/tests/tunnel-push-pop-ipv6.at +++ b/tests/tunnel-push-pop-ipv6.at @@ -66,9 +66,9 @@ AT_CHECK([ovs-appctl tnl/arp/show | tail -n+3 | sort], [0], [dnl AT_CHECK([ovs-appctl tnl/ports/show |sort], [0], [dnl Listening ports: -genev_sys_6081 (6081) -gre_sys (3) -vxlan_sys_4789 (4789) +genev_sys_6081 (6081) ref_cnt=1 +gre_sys (3) ref_cnt=2 +vxlan_sys_4789 (4789) ref_cnt=2 ]) dnl Check VXLAN tunnel pop @@ -167,5 +167,32 @@ AT_CHECK([ovs-appctl dpif/dump-flows int-br | grep 'in_port(6081)'], [0], [dnl tunnel(tun_id=0x7b,ipv6_src=2001:cafe::92,ipv6_dst=2001:cafe::88,geneve({class=0xffff,type=0x80,len=4,0xa/0xf}{class=0xffff,type=0,len=4}),flags(-df-csum+key)),recirc_id(0),in_port(6081),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:userspace(pid=0,slow_path(controller)) ]) +ovs-appctl time/warp 10000 + +AT_CHECK([ovs-vsctl del-port int-br t3 \ + -- set Interface t1 type=vxlan \ + -- set Interface t2 options:dst_port=4790 \ + ], [0]) + +dnl Check tunnel lookup entries after deleting/reconfiguring some ports +AT_CHECK([ovs-appctl tnl/ports/show |sort], [0], [dnl +Listening ports: +genev_sys_6081 (6081) ref_cnt=1 +gre_sys (3) ref_cnt=1 +vxlan_sys_4789 (4789) ref_cnt=1 +vxlan_sys_4790 (4790) ref_cnt=1 +]) + +AT_CHECK([ovs-vsctl del-port int-br t1 \ + -- del-port int-br t2 \ + -- del-port int-br t4 \ + -- del-port int-br t5 \ + ], [0]) + +dnl Check tunnel lookup entries after deleting all remaining tunnel ports +AT_CHECK([ovs-appctl tnl/ports/show |sort], [0], [dnl +Listening ports: +]) + OVS_VSWITCHD_STOP AT_CLEANUP diff --git a/tests/tunnel-push-pop.at b/tests/tunnel-push-pop.at index c376e71..5f2f172 100644 --- a/tests/tunnel-push-pop.at +++ b/tests/tunnel-push-pop.at @@ -80,9 +80,9 @@ AT_CHECK([ovs-appctl tnl/neigh/show | tail -n+3 | sort], [0], [dnl AT_CHECK([ovs-appctl tnl/ports/show |sort], [0], [dnl Listening ports: -genev_sys_6081 (6081) -gre_sys (3) -vxlan_sys_4789 (4789) +genev_sys_6081 (6081) ref_cnt=2 +gre_sys (3) ref_cnt=2 +vxlan_sys_4789 (4789) ref_cnt=3 ]) dnl Check VXLAN tunnel pop @@ -218,6 +218,35 @@ AT_CHECK([ovs-appctl dpif/dump-flows int-br | grep 'in_port(6081)'], [0], [dnl tunnel(tun_id=0x7b,src=1.1.2.92,dst=1.1.2.88,geneve({class=0xffff,type=0x80,len=4,0xa/0xf}{class=0xffff,type=0,len=4}),flags(-df-csum+key)),recirc_id(0),in_port(6081),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:userspace(pid=0,slow_path(controller)) ]) +ovs-appctl time/warp 10000 + +AT_CHECK([ovs-vsctl del-port int-br t3 \ + -- del-port int-br t5 \ + -- set Interface t1 type=vxlan \ + -- set Interface t2 options:dst_port=4790 \ + ], [0]) + +dnl Check tunnel lookup entries after deleting/reconfiguring some ports +AT_CHECK([ovs-appctl tnl/ports/show |sort], [0], [dnl +Listening ports: +genev_sys_6081 (6081) ref_cnt=1 +gre_sys (3) ref_cnt=1 +vxlan_sys_4789 (4789) ref_cnt=2 +vxlan_sys_4790 (4790) ref_cnt=1 +]) + +AT_CHECK([ovs-vsctl del-port int-br t1 \ + -- del-port int-br t2 \ + -- del-port int-br t4 \ + -- del-port int-br t6 \ + -- del-port int-br t7 \ + ], [0]) + +dnl Check tunnel lookup entries after deleting all remaining tunnel ports +AT_CHECK([ovs-appctl tnl/ports/show |sort], [0], [dnl +Listening ports: +]) + OVS_VSWITCHD_STOP AT_CLEANUP