config/x86: fix MinGW cross build with Meson 0.49
[dpdk.git] / lib / pdump / rte_pdump.c
index 7160268..af45069 100644 (file)
@@ -74,6 +74,7 @@ static const char MZ_RTE_PDUMP_STATS[] = "rte_pdump_stats";
 static struct {
        struct rte_pdump_stats rx[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT];
        struct rte_pdump_stats tx[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT];
+       const struct rte_memzone *mz;
 } *pdump_stats;
 
 /* Create a clone of mbuf to be placed into ring. */
@@ -429,6 +430,7 @@ rte_pdump_init(void)
                return -1;
        }
        pdump_stats = mz->addr;
+       pdump_stats->mz = mz;
 
        ret = rte_mp_action_register(PDUMP_MP, pdump_server);
        if (ret && rte_errno != ENOTSUP)
@@ -441,6 +443,11 @@ rte_pdump_uninit(void)
 {
        rte_mp_action_unregister(PDUMP_MP);
 
+       if (pdump_stats != NULL) {
+               rte_memzone_free(pdump_stats->mz);
+               pdump_stats = NULL;
+       }
+
        return 0;
 }
 
@@ -631,6 +638,9 @@ pdump_enable_by_deviceid(const char *device_id, uint16_t queue,
        if (ret < 0)
                return ret;
 
+       if (snaplen == 0)
+               snaplen = UINT32_MAX;
+
        return pdump_prepare_client_request(device_id, queue, flags, snaplen,
                                            ENABLE, ring, mp, prm);
 }