net/tap: move closing file descriptors to close function
authorKeith Wiles <keith.wiles@intel.com>
Mon, 6 Feb 2017 19:40:38 +0000 (13:40 -0600)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 10 Feb 2017 11:25:49 +0000 (12:25 +0100)
Remove closing fds code from pmd stop routine.

Signed-off-by: Keith Wiles <keith.wiles@intel.com>
Acked-by: Pascal Mazon <pascal.mazon@6wind.com>
drivers/net/tap/rte_eth_tap.c

index d1149ff..efc4426 100644 (file)
@@ -350,14 +350,7 @@ tap_dev_start(struct rte_eth_dev *dev)
 static void
 tap_dev_stop(struct rte_eth_dev *dev)
 {
-       int i;
-       struct pmd_internals *internals = dev->data->dev_private;
-
        tap_link_set_down(dev);
-
-       for (i = 0; i < internals->nb_queues; i++)
-               if (internals->rxq[i].fd != -1)
-                       close(internals->rxq[i].fd);
 }
 
 static int
@@ -431,6 +424,17 @@ tap_stats_reset(struct rte_eth_dev *dev)
 static void
 tap_dev_close(struct rte_eth_dev *dev __rte_unused)
 {
+       int i;
+       struct pmd_internals *internals = dev->data->dev_private;
+
+       tap_link_set_down(dev);
+
+       for (i = 0; i < internals->nb_queues; i++) {
+               if (internals->rxq[i].fd != -1)
+                       close(internals->rxq[i].fd);
+               internals->rxq[i].fd = -1;
+               internals->txq[i].fd = -1;
+       }
 }
 
 static void