// This counter is increased by worker threads that individually pick queue IDs.
SC_ATOMIC_RESET(iconf->queue_id);
SC_ATOMIC_RESET(iconf->inconsitent_numa_cnt);
+
+ // initialize LiveDev DPDK values
+ LiveDevice *ldev_instance = LiveGetDevice(iface);
+ if (ldev_instance == NULL) {
+ FatalError("Device %s is not registered as a live device", iface);
+ }
+ ldev_instance->dpdk_vars.pkt_mp = iconf->pkt_mempool;
return iconf;
}
rte_eth_dev_stop(ptv->out_port_id);
}
- if (ptv->queue_id == 0 && ptv->pkt_mempool != NULL) {
- rte_mempool_free(ptv->pkt_mempool);
- ptv->pkt_mempool = NULL;
- }
+ ptv->pkt_mempool = NULL; // MP is released when device is closed
SCFree(ptv);
SCReturnInt(TM_ECODE_OK);
#ifndef __UTIL_DEVICE_H__
#define __UTIL_DEVICE_H__
+#ifdef HAVE_DPDK
+#include <rte_mempool.h>
+#endif /* HAVE_DPDK */
+
#include "queue.h"
#define OFFLOAD_FLAG_SG (1<<0)
#define MAX_DEVNAME 10
+#ifdef HAVE_DPDK
+typedef struct {
+ struct rte_mempool *pkt_mp;
+} DPDKDeviceResources;
+#endif /* HAVE_DPDK */
+
/** storage for live device names */
typedef struct LiveDevice_ {
char *dev; /**< the device (e.g. "eth0") */
uint32_t tenant_id; /**< tenant id in multi-tenancy */
uint32_t offload_orig; /**< original offload settings to restore @exit */
+#ifdef HAVE_DPDK
+ // DPDK resources that needs to be cleaned after workers are stopped and devices closed
+ DPDKDeviceResources dpdk_vars;
+#endif
} LiveDevice;
typedef struct LiveDeviceName_ {
SCLogInfo("%s: closing device", ldev->dev);
rte_eth_dev_close(port_id);
+
+ SCLogInfo("%s: releasing packet mempool", ldev->dev);
+ rte_mempool_free(ldev->dpdk_vars.pkt_mp);
}
#endif
}