net/mlx4: fix Tx doorbell register unmap
[dpdk.git] / app / pdump / main.c
index 9e86bf6..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;
@@ -494,6 +494,7 @@ cleanup_pdump_resources(void)
 {
        int i;
        struct pdump_tuples *pt;
+       char name[RTE_ETH_NAME_MAX_LEN];
 
        /* disable pdump and free the pdump_tuple resources */
        for (i = 0; i < num_tuples; i++) {
@@ -510,6 +511,21 @@ cleanup_pdump_resources(void)
                        free_ring_data(pt->rx_ring, pt->rx_vdev_id, &pt->stats);
                if (pt->dir & RTE_PDUMP_FLAG_TX)
                        free_ring_data(pt->tx_ring, pt->tx_vdev_id, &pt->stats);
+
+               /* 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;
+
+               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();
 }