From c95401d3d3ee3d46e70ec2cfc7f7e272e966ac14 Mon Sep 17 00:00:00 2001 From: Nicolas Morey-Chaisemartin Date: Tue, 13 Oct 2015 19:05:06 +0200 Subject: 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 Signed-off-by: Maxim Uvarov --- platform/linux-generic/odp_packet_io.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'platform/linux-generic/odp_packet_io.c') 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"); -- cgit v1.2.3