All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Wiles <keith.wiles@intel.com>
To: dev@dpdk.org
Subject: [PATCH] net/tap: driver closing tx interface on queue setup
Date: Sat, 28 Jan 2017 20:12:05 -0600	[thread overview]
Message-ID: <20170129021205.36860-1-keith.wiles@intel.com> (raw)

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

             reply	other threads:[~2017-01-29  2:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-29  2:12 Keith Wiles [this message]
2017-01-30 11:00 ` [PATCH] net/tap: driver closing tx interface on queue setup 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170129021205.36860-1-keith.wiles@intel.com \
    --to=keith.wiles@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.