diff mbox

[ovs-dev,v3,4/4] ofproto: Move tun_table and vl_mff_map deletion.

Message ID 1489429702-68853-3-git-send-email-yihung.wei@gmail.com
State Accepted
Headers show

Commit Message

Yi-Hung Wei March 13, 2017, 6:28 p.m. UTC
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 <yihung.wei@gmail.com>
---
 ofproto/ofproto.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Joe Stringer March 15, 2017, 10:24 p.m. UTC | #1
On 13 March 2017 at 11:28, Yi-Hung Wei <yihung.wei@gmail.com> wrote:
> 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 <yihung.wei@gmail.com>

Thanks, applied to master.
diff mbox

Patch

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);