Message ID | 1424723769-8762-4-git-send-email-robking@cisco.com |
---|---|
State | Superseded |
Headers | show |
On 02/23/2015 11:36 PM, Robbie King wrote: > From: Yan Sonming <yan.songming@linaro.org> > > Signed-off-by: Yan Songming <yan.songming@linaro.org> > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> > Signed-off-by: Robbie King <robking@cisco.com> > --- > platform/linux-generic/include/odp_internal.h | 1 + > platform/linux-generic/odp_init.c | 5 +++++ > platform/linux-generic/odp_packet_io.c | 18 ++++++++++++++++++ > 3 files changed, 24 insertions(+) > > diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h > index 9ae8530..e43608d 100644 > --- a/platform/linux-generic/include/odp_internal.h > +++ b/platform/linux-generic/include/odp_internal.h > @@ -41,6 +41,7 @@ int odp_shm_init_local(void); > int odp_pool_init_global(void); > > int odp_pktio_init_global(void); > +int odp_pktio_term_global(void); > int odp_pktio_init_local(void); > > int odp_classification_init_global(void); > diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c > index 645ac10..48bc9a2 100644 > --- a/platform/linux-generic/odp_init.c > +++ b/platform/linux-generic/odp_init.c > @@ -88,6 +88,11 @@ int odp_term_global(void) > rc = -1; > } > > + if (odp_pktio_term_global()) { > + ODP_ERR("ODP pktio term failed.\n"); > + rc = -1; > + } > + > return rc; > } > > diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c > index c5d0569..a405bd7 100644 > --- a/platform/linux-generic/odp_packet_io.c > +++ b/platform/linux-generic/odp_packet_io.c > @@ -79,6 +79,24 @@ int odp_pktio_init_global(void) > return 0; > } > > +int odp_pktio_term_global(void) > +{ > + pktio_entry_t *pktio_entry; > + int ret = 0; > + int id; > + > + for (id = 1; id <= ODP_CONFIG_PKTIO_ENTRIES; ++id) { > + pktio_entry = &pktio_tbl->entries[id - 1]; Missing: if (!pktio_entry) lock_entry(pktio_entry); free_pktio_entry(); close_pkt_sock_mmap(); > + odp_queue_destroy(pktio_entry->s.outq_default); you need to check return code here. 99% that Coverity will warn about that. > + } > + > + ret = odp_shm_free(odp_shm_lookup("odp_pktio_entries")); > + if (ret < 0) > + ODP_ERR("shm free failed for odp_pktio_entries"); > + > + return ret; > +} > + > int odp_pktio_init_local(void) > { > return 0;
diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index 9ae8530..e43608d 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -41,6 +41,7 @@ int odp_shm_init_local(void); int odp_pool_init_global(void); int odp_pktio_init_global(void); +int odp_pktio_term_global(void); int odp_pktio_init_local(void); int odp_classification_init_global(void); diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 645ac10..48bc9a2 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -88,6 +88,11 @@ int odp_term_global(void) rc = -1; } + if (odp_pktio_term_global()) { + ODP_ERR("ODP pktio term failed.\n"); + rc = -1; + } + return rc; } diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index c5d0569..a405bd7 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -79,6 +79,24 @@ int odp_pktio_init_global(void) return 0; } +int odp_pktio_term_global(void) +{ + pktio_entry_t *pktio_entry; + int ret = 0; + int id; + + for (id = 1; id <= ODP_CONFIG_PKTIO_ENTRIES; ++id) { + pktio_entry = &pktio_tbl->entries[id - 1]; + odp_queue_destroy(pktio_entry->s.outq_default); + } + + ret = odp_shm_free(odp_shm_lookup("odp_pktio_entries")); + if (ret < 0) + ODP_ERR("shm free failed for odp_pktio_entries"); + + return ret; +} + int odp_pktio_init_local(void) { return 0;