From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keith Wiles Subject: [PATCH] net/tap: driver closing tx interface on queue setup Date: Sat, 28 Jan 2017 20:12:05 -0600 Message-ID: <20170129021205.36860-1-keith.wiles@intel.com> To: dev@dpdk.org Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 1FFFF28FD for ; Sun, 29 Jan 2017 03:12:09 +0100 (CET) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "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 --- 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