eal/windows: cleanup virt2phys handle
authorDmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Mon, 26 Jul 2021 21:36:32 +0000 (00:36 +0300)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 30 Jul 2021 16:56:01 +0000 (18:56 +0200)
eal_mem_virt2phys_init() opens a handle for use by rte_mem_virt2phy().
Close this handle on EAL cleanup.

Fixes: 2a5d547a4a9b ("eal/windows: implement basic memory management")
Cc: stable@dpdk.org
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Ranjit Menon <ranjit.menon@intel.com>
lib/eal/windows/eal.c
lib/eal/windows/eal_memory.c
lib/eal/windows/eal_windows.h

index 5413d4d..3d8c520 100644 (file)
@@ -261,6 +261,7 @@ rte_eal_cleanup(void)
                eal_get_internal_configuration();
 
        eal_intr_thread_cancel();
+       eal_mem_virt2iova_cleanup();
        /* after this point, any DPDK pointers will become dangling */
        rte_eal_memory_detach();
        eal_cleanup_config(internal_conf);
index 4db048c..71741fc 100644 (file)
@@ -198,6 +198,13 @@ exit:
        return ret;
 }
 
+void
+eal_mem_virt2iova_cleanup(void)
+{
+       if (virt2phys_device != INVALID_HANDLE_VALUE)
+               CloseHandle(virt2phys_device);
+}
+
 phys_addr_t
 rte_mem_virt2phy(const void *virt)
 {
index 7cc8114..23ead6d 100644 (file)
@@ -79,6 +79,11 @@ void eal_intr_thread_cancel(void);
  */
 int eal_mem_virt2iova_init(void);
 
+/**
+ * Cleanup resources used for virtual to physical address translation.
+ */
+void eal_mem_virt2iova_cleanup(void);
+
 /**
  * Locate Win32 memory management routines in system libraries.
  *