net/mlx4: fix Tx doorbell register unmap
[dpdk.git] / app / pdump / main.c
index 5e183ea..ae0cf28 100644 (file)
@@ -189,12 +189,12 @@ parse_rxtxdev(const char *key, const char *value, void *extra_args)
        struct pdump_tuples *pt = extra_args;
 
        if (!strcmp(key, PDUMP_RX_DEV_ARG)) {
-               snprintf(pt->rx_dev, sizeof(pt->rx_dev), "%s", value);
+               strlcpy(pt->rx_dev, value, sizeof(pt->rx_dev));
                /* identify the tx stream type for pcap vdev */
                if (if_nametoindex(pt->rx_dev))
                        pt->rx_vdev_stream_type = IFACE;
        } else if (!strcmp(key, PDUMP_TX_DEV_ARG)) {
-               snprintf(pt->tx_dev, sizeof(pt->tx_dev), "%s", value);
+               strlcpy(pt->tx_dev, value, sizeof(pt->tx_dev));
                /* identify the tx stream type for pcap vdev */
                if (if_nametoindex(pt->tx_dev))
                        pt->tx_vdev_stream_type = IFACE;
@@ -512,12 +512,19 @@ cleanup_pdump_resources(void)
                if (pt->dir & RTE_PDUMP_FLAG_TX)
                        free_ring_data(pt->tx_ring, pt->tx_vdev_id, &pt->stats);
 
-               /* Remove the vdev created */
-               rte_eth_dev_get_name_by_port(pt->rx_vdev_id, name);
-               rte_eal_hotplug_remove("vdev", name);
+               /* Remove the vdev(s) created */
+               if (pt->dir & RTE_PDUMP_FLAG_RX) {
+                       rte_eth_dev_get_name_by_port(pt->rx_vdev_id, name);
+                       rte_eal_hotplug_remove("vdev", name);
+               }
+
+               if (pt->single_pdump_dev)
+                       continue;
 
-               rte_eth_dev_get_name_by_port(pt->tx_vdev_id, name);
-               rte_eal_hotplug_remove("vdev", name);
+               if (pt->dir & RTE_PDUMP_FLAG_TX) {
+                       rte_eth_dev_get_name_by_port(pt->tx_vdev_id, name);
+                       rte_eal_hotplug_remove("vdev", name);
+               }
 
        }
        cleanup_rings();