From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pascal Mazon Subject: [PATCH v2 3/5] net/tap: drop unnecessary nested block Date: Tue, 18 Apr 2017 10:17:55 +0200 Message-ID: References: Cc: pascal.mazon@6wind.com To: dev@dpdk.org Return-path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 496D82C6E for ; Tue, 18 Apr 2017 10:18:22 +0200 (CEST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This is cosmetic; the code is functionally equivalent. Signed-off-by: Pascal Mazon --- drivers/net/tap/rte_eth_tap.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index c9d107c25ac2..403aca9f7307 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -824,30 +824,26 @@ tap_setup_queue(struct rte_eth_dev *dev, struct pmd_internals *pmd = dev->data->dev_private; struct rx_queue *rx = &internals->rxq[qid]; struct tx_queue *tx = &internals->txq[qid]; - int fd; + int fd = rx->fd == -1 ? tx->fd : rx->fd; - fd = rx->fd; - if (fd < 0) { - fd = tx->fd; + if (fd == -1) { + RTE_LOG(INFO, PMD, "Add queue to TAP %s for qid %d\n", + pmd->name, qid); + fd = tun_alloc(pmd, qid); if (fd < 0) { - RTE_LOG(INFO, PMD, "Add queue to TAP %s for qid %d\n", + RTE_LOG(ERR, PMD, "tun_alloc(%s, %d) failed\n", pmd->name, qid); - fd = tun_alloc(pmd, qid); - if (fd < 0) { - RTE_LOG(ERR, PMD, "tun_alloc(%s, %d) failed\n", - pmd->name, qid); + return -1; + } + if (qid == 0) { + struct ifreq ifr; + + ifr.ifr_mtu = dev->data->mtu; + if (tap_ioctl(pmd, SIOCSIFMTU, &ifr, 1, + LOCAL_AND_REMOTE) < 0) { + close(fd); return -1; } - if (qid == 0) { - struct ifreq ifr; - - ifr.ifr_mtu = dev->data->mtu; - if (tap_ioctl(pmd, SIOCSIFMTU, &ifr, 1, - LOCAL_AND_REMOTE) < 0) { - close(fd); - return -1; - } - } } } -- 2.12.0.306.g4a9b9b3