Right now, pktio_term calls term on all pktio type but
some pktio might still be be opened. Although the user should
probably close its pktio before termintating the application,
it is safer to iterate on all pktio and close them in the
pktio_term function.

Signed-off-by: Nicolas Morey-Chaisemartin <nmo...@kalray.eu>
---
 platform/linux-generic/odp_packet_io.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index fa0817a..f262cb6 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -91,6 +91,12 @@ int odp_pktio_term_global(void)
        int id;
        int pktio_if;
 
+       for (id = 1; id <= ODP_CONFIG_PKTIO_ENTRIES; ++id) {
+               pktio_entry = &pktio_tbl->entries[id - 1];
+               odp_pktio_close(pktio_entry->s.handle);
+               odp_queue_destroy(pktio_entry->s.outq_default);
+       }
+
        for (pktio_if = 0; pktio_if_ops[pktio_if]; ++pktio_if) {
                if (pktio_if_ops[pktio_if]->term)
                        if (pktio_if_ops[pktio_if]->term())
@@ -98,11 +104,6 @@ int odp_pktio_term_global(void)
                                        pktio_if);
        }
 
-       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");
-- 
2.6.1.3.g8d02103

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to