[dpdk-dev] [PATCH] net/tap: driver closing tx interface on queue setup
Keith Wiles
keith.wiles at intel.com
Sun Jan 29 03:12:05 CET 2017
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 at 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
More information about the dev
mailing list