From patchwork Mon Mar 13 18:28:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi-Hung Wei X-Patchwork-Id: 738331 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3vhmbb0xjcz9s2P for ; Tue, 14 Mar 2017 05:28:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="WORX95o4"; dkim-atps=neutral Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 0C08FC46; Mon, 13 Mar 2017 18:28:29 +0000 (UTC) X-Original-To: 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 A30B9B44 for ; Mon, 13 Mar 2017 18:28:27 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6A6832B8 for ; Mon, 13 Mar 2017 18:28:27 +0000 (UTC) Received: by mail-pg0-f65.google.com with SMTP id g2so14433379pge.2 for ; Mon, 13 Mar 2017 11:28:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jVMKQRwzJg+gI5df3cWLIFiwzRiBuT1rybQK3Ox5Eik=; b=WORX95o4Vv/9P3mBv61pIxnInVVjWhduv9UisOxMm9ur+urC6x+ygJlWDtbAAHnpF1 BdwWkCdPZj1LGr5JOIkbLDd85Z1hdNv3W7vbzveKxSjMhcmkiKfxGRuzWXJ+oSy+txuO GvtR2e7Cnb8QOWZE3yF12JioqKdkfd95degpEk6IN8Su3oV/6QWwZCriLF5JKNAmatu1 RY2/uXXbmJ9yBdcVEVmiA0Nd8osqKfR659F5zDQ+NM2Y/nrQyQVXURVAt0Urdr6sdOqd eGWvtlE5sBJK6v+H7s0VG4lSUOA7z+UEzQ2x+4VqSb4A85rkc4Pz4cgKtH8eE06TTP6M uIQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jVMKQRwzJg+gI5df3cWLIFiwzRiBuT1rybQK3Ox5Eik=; b=O9JqvjkpnW7X6pGJW2N3IxWUIkROpUovIX8QVS9yEM9H6YQ1i6ujMOKvCJtQMFI125 m6auRJXG5RluYrIA5oR5gUPq7aOxW6e/3i3qZ+g/eR/7Nzbi/p6C0S7mj/Lh3VvuShDN 2jGjWVN+ScJPZB9O8m5RyAgWIh+UO4u/Wife2RQDvvictjIvHbOXiqrj98u0rE+CPGRI HkVYzeK2qMO5ysfJx14EzCe6MZnBx+YCR1aH3CSz/W5t7bVY7UDcLd0npdwzCKuZGKRS psfS3gCCl1ck6v8KOUAy9MeZ2Z5Iqf/Z/WN9icsZqnpjTH2N5+y9QivJ3bDcHQAE05WM sCxw== X-Gm-Message-State: AMke39k4NNNf8dHc19wyl8+rYMrrSjqTJgmPzCz/eivyyVcWCm6uxH/yFL6Ca7R7qjwmUA== X-Received: by 10.98.97.68 with SMTP id v65mr39248056pfb.124.1489429707102; Mon, 13 Mar 2017 11:28:27 -0700 (PDT) Received: from sc9-mailhost3.vmware.com ([208.91.1.34]) by smtp.gmail.com with ESMTPSA id l71sm34322335pga.7.2017.03.13.11.28.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Mar 2017 11:28:26 -0700 (PDT) From: Yi-Hung Wei To: dev@openvswitch.org, joe@ovn.org Date: Mon, 13 Mar 2017 11:28:22 -0700 Message-Id: <1489429702-68853-3-git-send-email-yihung.wei@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489429702-68853-1-git-send-email-yihung.wei@gmail.com> References: <1489429702-68853-1-git-send-email-yihung.wei@gmail.com> X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=no 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 4/4] ofproto: Move tun_table and vl_mff_map deletion. 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: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org In this patch, we move the tun_table and vl_mff_map deletion in ofproto_destory__() to be in the following order. 1. Delete all the flows. 2. Delete vl_mff_map. 3. Delete tun_table. The rationale behind this order is that a flow may use a variable length mf_field, and a variable length mf_field is defined by a TLV mapping in tun_table. Signed-off-by: Yi-Hung Wei --- ofproto/ofproto.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 32b4fe284174..79996bb412ce 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1579,14 +1579,6 @@ ofproto_destroy__(struct ofproto *ofproto) cmap_destroy(&ofproto->groups); hmap_remove(&all_ofprotos, &ofproto->hmap_node); - tun_metadata_free(ovsrcu_get_protected(struct tun_table *, - &ofproto->metadata_tab)); - - ovs_mutex_lock(&ofproto->vl_mff_map.mutex); - mf_vl_mff_map_clear(&ofproto->vl_mff_map, true); - ovs_mutex_unlock(&ofproto->vl_mff_map.mutex); - cmap_destroy(&ofproto->vl_mff_map.cmap); - ovs_mutex_destroy(&ofproto->vl_mff_map.mutex); free(ofproto->name); free(ofproto->type); @@ -1605,6 +1597,14 @@ ofproto_destroy__(struct ofproto *ofproto) } free(ofproto->tables); + ovs_mutex_lock(&ofproto->vl_mff_map.mutex); + mf_vl_mff_map_clear(&ofproto->vl_mff_map, true); + ovs_mutex_unlock(&ofproto->vl_mff_map.mutex); + cmap_destroy(&ofproto->vl_mff_map.cmap); + ovs_mutex_destroy(&ofproto->vl_mff_map.mutex); + tun_metadata_free(ovsrcu_get_protected(struct tun_table *, + &ofproto->metadata_tab)); + ovs_assert(hindex_is_empty(&ofproto->cookies)); hindex_destroy(&ofproto->cookies);