All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/tap: driver closing tx interface on queue setup
@ 2017-01-29  2:12 Keith Wiles
  2017-01-30 11:00 ` Ferruh Yigit
  2017-01-30 20:54 ` [PATCH v2] net/tap: fix invalid queue file descriptor Ferruh Yigit
  0 siblings, 2 replies; 12+ messages in thread
From: Keith Wiles @ 2017-01-29  2:12 UTC (permalink / raw)
  To: dev

The tap driver setup both rx and tx file descriptors when the
rte_eth_rx_queue_setup() causing the tx to be closed when tx setup
was called.

Signed-off-by: Keith Wiles <keith.wiles@intel.com>
---
 drivers/net/tap/rte_eth_tap.c | 48 ++++++++++++++++++++++++++++++-------------
 1 file changed, 34 insertions(+), 14 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index c0afc2d..267b421 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -406,32 +406,52 @@ tap_link_update(struct rte_eth_dev *dev __rte_unused,
 }
 
 static int
-tap_setup_queue(struct rte_eth_dev *dev,
+rx_setup_queue(struct rte_eth_dev *dev,
 		struct pmd_internals *internals,
 		uint16_t qid)
 {
 	struct rx_queue *rx = &internals->rxq[qid];
-	struct tx_queue *tx = &internals->txq[qid];
 	int fd;
 
 	fd = rx->fd;
 	if (fd < 0) {
-		fd = tx->fd;
+		RTE_LOG(INFO, PMD, "Add queue to TAP %s for qid %d\n",
+			dev->data->name, qid);
+		fd = tun_alloc(dev->data->name);
 		if (fd < 0) {
-			RTE_LOG(INFO, PMD, "Add queue to TAP %s for qid %d\n",
-				dev->data->name, qid);
-			fd = tun_alloc(dev->data->name);
-			if (fd < 0) {
-				RTE_LOG(ERR, PMD, "tun_alloc(%s) failed\n",
-					dev->data->name);
-				return -1;
-			}
+			RTE_LOG(ERR, PMD, "tun_alloc(%s) failed\n",
+				dev->data->name);
+			return -1;
 		}
 	}
 	dev->data->rx_queues[qid] = rx;
-	dev->data->tx_queues[qid] = tx;
 
 	rx->fd = fd;
+
+	return fd;
+}
+
+static int
+tx_setup_queue(struct rte_eth_dev *dev,
+		struct pmd_internals *internals,
+		uint16_t qid)
+{
+	struct tx_queue *tx = &internals->txq[qid];
+	int fd;
+
+	fd = tx->fd;
+	if (fd < 0) {
+		RTE_LOG(INFO, PMD, "Add queue to TAP %s for qid %d\n",
+			dev->data->name, qid);
+		fd = tun_alloc(dev->data->name);
+		if (fd < 0) {
+			RTE_LOG(ERR, PMD, "tun_alloc(%s) failed\n",
+				dev->data->name);
+			return -1;
+		}
+	}
+	dev->data->tx_queues[qid] = tx;
+
 	tx->fd = fd;
 
 	return fd;
@@ -469,7 +489,7 @@ tap_rx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 
-	fd = tap_setup_queue(dev, internals, rx_queue_id);
+	fd = rx_setup_queue(dev, internals, rx_queue_id);
 	if (fd == -1)
 		return -1;
 
@@ -493,7 +513,7 @@ tap_tx_queue_setup(struct rte_eth_dev *dev,
 	if (tx_queue_id >= internals->nb_queues)
 		return -1;
 
-	ret = tap_setup_queue(dev, internals, tx_queue_id);
+	ret = tx_setup_queue(dev, internals, tx_queue_id);
 	if (ret == -1)
 		return -1;
 
-- 
2.8.0.GIT

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-01-30 21:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-29  2:12 [PATCH] net/tap: driver closing tx interface on queue setup Keith Wiles
2017-01-30 11:00 ` Ferruh Yigit
2017-01-30 14:34   ` Wiles, Keith
2017-01-30 17:42     ` Ferruh Yigit
2017-01-30 18:20       ` Wiles, Keith
2017-01-30 19:31         ` Ferruh Yigit
2017-01-30 14:38   ` Pascal Mazon
2017-01-30 15:04     ` Wiles, Keith
2017-01-30 17:19     ` Ferruh Yigit
2017-01-30 20:54 ` [PATCH v2] net/tap: fix invalid queue file descriptor Ferruh Yigit
2017-01-30 20:57   ` Wiles, Keith
2017-01-30 21:23     ` Ferruh Yigit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.