diff options
author | Nicolas Morey-Chaisemartin <nmorey@kalray.eu> | 2015-10-13 19:05:06 +0200 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-10-16 15:11:04 +0300 |
commit | c95401d3d3ee3d46e70ec2cfc7f7e272e966ac14 (patch) | |
tree | a344e0e79ab2dc5354bd5dfb99b15d89cecd898e /platform/linux-generic | |
parent | 3aab5b8e91b8fa6a9a89fd79adbbc558049a8247 (diff) |
linux-generic: pktio: close all pktio when term is called
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 <nmorey@kalray.eu>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform/linux-generic')
-rw-r--r-- | platform/linux-generic/odp_packet_io.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index fa0817a20..f262cb61c 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"); |