When rte_eal_cleanup is called the interrupt thread and
associated resources should be cleaned up.

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 lib/librte_eal/common/eal_private.h       | 10 ++++++++++
 lib/librte_eal/linux/eal/eal.c            |  1 +
 lib/librte_eal/linux/eal/eal_interrupts.c |  9 +++++++++
 3 files changed, 20 insertions(+)

diff --git a/lib/librte_eal/common/eal_private.h 
b/lib/librte_eal/common/eal_private.h
index 38682e79827c..c62f35d3ac0f 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -191,6 +191,16 @@ int rte_eal_tailqs_init(void);
  */
 int rte_eal_intr_init(void);
 
+/**
+ * Cleanup interrupt handling.
+ *
+ * This function is private to EAL.
+ *
+ * @return
+ *  0 on success, negative on error
+ */
+void rte_eal_intr_cleanup(void);
+
 /**
  * Init alarm mechanism. This is to allow a callback be called after
  * specific time.
diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index d98a2afe85da..eb95f4f0c317 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -1338,6 +1338,7 @@ rte_eal_cleanup(void)
        }
 
        rte_service_finalize();
+       rte_eal_intr_cleanup();
        rte_eal_alarm_cleanup();
        rte_mp_channel_cleanup();
        eal_cleanup_config(&internal_config);
diff --git a/lib/librte_eal/linux/eal/eal_interrupts.c 
b/lib/librte_eal/linux/eal/eal_interrupts.c
index 14ebb108cee9..fa08ac4171bd 100644
--- a/lib/librte_eal/linux/eal/eal_interrupts.c
+++ b/lib/librte_eal/linux/eal/eal_interrupts.c
@@ -1137,6 +1137,15 @@ rte_eal_intr_init(void)
        return ret;
 }
 
+void
+rte_eal_intr_cleanup(void)
+{
+       pthread_cancel(intr_thread);
+       pthread_join(intr_thread, NULL);
+       close(intr_pipe.readfd);
+       close(intr_pipe.writefd);
+}
+
 static void
 eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle)
 {
-- 
2.20.1

Reply via email to