diff options
Diffstat (limited to 'ofproto')
-rw-r--r-- | ofproto/ofproto-dpif.c | 11 | ||||
-rw-r--r-- | ofproto/ofproto-provider.h | 2 | ||||
-rw-r--r-- | ofproto/ofproto.c | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index bd45be5ac..9c3a5673c 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -645,7 +645,7 @@ dealloc(struct ofproto *ofproto_) } static void -close_dpif_backer(struct dpif_backer *backer) +close_dpif_backer(struct dpif_backer *backer, bool del) { ovs_assert(backer->refcount > 0); @@ -661,6 +661,9 @@ close_dpif_backer(struct dpif_backer *backer) shash_find_and_delete(&all_dpif_backers, backer->type); free(backer->type); free(backer->dp_version_string); + if (del) { + dpif_delete(backer->dpif); + } dpif_close(backer->dpif); id_pool_destroy(backer->meter_ids); free(backer); @@ -773,7 +776,7 @@ open_dpif_backer(const char *type, struct dpif_backer **backerp) if (error) { VLOG_ERR("failed to listen on datapath of type %s: %s", type, ovs_strerror(error)); - close_dpif_backer(backer); + close_dpif_backer(backer, false); return error; } @@ -1525,7 +1528,7 @@ add_internal_flows(struct ofproto_dpif *ofproto) } static void -destruct(struct ofproto *ofproto_) +destruct(struct ofproto *ofproto_, bool del) { struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_); struct ofproto_async_msg *am; @@ -1578,7 +1581,7 @@ destruct(struct ofproto *ofproto_) seq_destroy(ofproto->ams_seq); - close_dpif_backer(ofproto->backer); + close_dpif_backer(ofproto->backer, del); } static int diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index 688a9e5d3..9dc73c482 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -829,7 +829,7 @@ struct ofproto_class { */ struct ofproto *(*alloc)(void); int (*construct)(struct ofproto *ofproto); - void (*destruct)(struct ofproto *ofproto); + void (*destruct)(struct ofproto *ofproto, bool del); void (*dealloc)(struct ofproto *ofproto); /* Performs any periodic activity required by 'ofproto'. It should: diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 32b5b303b..d5410fd1b 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1649,7 +1649,7 @@ ofproto_destroy(struct ofproto *p, bool del) free(usage); } - p->ofproto_class->destruct(p); + p->ofproto_class->destruct(p, del); /* We should not postpone this because it involves deleting a listening * socket which we may want to reopen soon. 'connmgr' may be used by other |