From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP; 28 Jan 2017 18:12:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,304,1477983600"; d="scan'208";a="58430301" Received: from akshetty-mobl.amr.corp.intel.com ([10.252.137.159]) by orsmga005.jf.intel.com with ESMTP; 28 Jan 2017 18:12:08 -0800 From: Keith Wiles To: dev@dpdk.org Date: Sat, 28 Jan 2017 20:12:05 -0600 Message-Id: <20170129021205.36860-1-keith.wiles@intel.com> X-Mailer: git-send-email 2.10.1 Subject: [dpdk-dev] [PATCH] net/tap: driver closing tx interface on queue setup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2017 02:12:10 -0000 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