From patchwork Fri Apr 14 09:32:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pascal Mazon X-Patchwork-Id: 23644 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 0B604567F; Fri, 14 Apr 2017 11:33:18 +0200 (CEST) Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 75B915596 for ; Fri, 14 Apr 2017 11:33:14 +0200 (CEST) Received: from 6wind.com (unknown [10.16.0.184]) by proxy.6wind.com (Postfix) with SMTP id 1F4BE290E6; Fri, 14 Apr 2017 11:33:08 +0200 (CEST) Received: by 6wind.com (sSMTP sendmail emulation); Fri, 14 Apr 2017 11:33:07 +0200 From: Pascal Mazon To: dev@dpdk.org Cc: pascal.mazon@6wind.com Date: Fri, 14 Apr 2017 11:32:44 +0200 Message-Id: X-Mailer: git-send-email 2.12.0.306.g4a9b9b3 In-Reply-To: References: Subject: [dpdk-dev] [PATCH 3/5] net/tap: drop unnecessary nested block 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: , 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 | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index c9d107c25ac2..770f08ce12f5 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -826,28 +826,24 @@ tap_setup_queue(struct rte_eth_dev *dev, struct tx_queue *tx = &internals->txq[qid]; int fd; - fd = rx->fd; - if (fd < 0) { - fd = tx->fd; + if (rx->fd == -1 || tx->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; - } - } } }