From: Pascal Mazon <pascal.mazon@6wind.com>
To: dev@dpdk.org
Cc: pascal.mazon@6wind.com
Subject: [dpdk-dev] [PATCH v2 3/5] net/tap: drop unnecessary nested block
Date: Tue, 18 Apr 2017 10:17:55 +0200 [thread overview]
Message-ID: <d5d513242ca2ffbd0acdf9d6d64f2bd878fc42b7.1492503445.git.pascal.mazon@6wind.com> (raw)
In-Reply-To: <cover.1492503445.git.pascal.mazon@6wind.com>
This is cosmetic; the code is functionally equivalent.
Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
---
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
next prev parent reply other threads:[~2017-04-18 8:18 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-14 9:32 [dpdk-dev] [PATCH 0/5] improve tap behavior Pascal Mazon
2017-04-14 9:32 ` [dpdk-dev] [PATCH 1/5] net/tap: add debug messages Pascal Mazon
2017-04-14 9:32 ` [dpdk-dev] [PATCH 2/5] net/tap: remove unnecessary functions Pascal Mazon
2017-04-14 9:32 ` [dpdk-dev] [PATCH 3/5] net/tap: drop unnecessary nested block Pascal Mazon
2017-04-14 9:32 ` [dpdk-dev] [PATCH 4/5] net/tap: create netdevice during probing Pascal Mazon
2017-04-14 9:32 ` [dpdk-dev] [PATCH 5/5] net/tap: do not set remote MAC if not necessary Pascal Mazon
2017-04-14 9:45 ` [dpdk-dev] [PATCH 0/5] improve tap behavior Ferruh Yigit
2017-04-18 8:17 ` Pascal Mazon
2017-04-18 8:17 ` [dpdk-dev] [PATCH v2 1/5] net/tap: add debug messages Pascal Mazon
2017-04-18 8:17 ` [dpdk-dev] [PATCH v2 2/5] net/tap: remove unnecessary functions Pascal Mazon
2017-04-18 8:17 ` Pascal Mazon [this message]
2017-04-18 8:17 ` [dpdk-dev] [PATCH v2 4/5] net/tap: create netdevice during probing Pascal Mazon
2017-04-18 8:17 ` [dpdk-dev] [PATCH v2 5/5] net/tap: do not set remote MAC if not necessary Pascal Mazon
2017-05-12 12:29 ` [dpdk-dev] [PATCH 0/5] improve tap behavior Ferruh Yigit
2017-05-12 13:01 ` [dpdk-dev] [PATCH v3 " Pascal Mazon
2017-05-12 13:01 ` [dpdk-dev] [PATCH v3 1/5] net/tap: add debug messages Pascal Mazon
2017-05-12 13:01 ` [dpdk-dev] [PATCH v3 2/5] net/tap: remove unnecessary functions Pascal Mazon
2017-05-12 13:01 ` [dpdk-dev] [PATCH v3 3/5] net/tap: drop unnecessary nested block Pascal Mazon
2017-05-12 13:01 ` [dpdk-dev] [PATCH v3 4/5] net/tap: create netdevice during probing Pascal Mazon
2017-05-12 13:01 ` [dpdk-dev] [PATCH v3 5/5] net/tap: do not set remote MAC if not necessary Pascal Mazon
2017-05-12 14:04 ` [dpdk-dev] [PATCH v3 0/5] improve tap behavior Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d5d513242ca2ffbd0acdf9d6d64f2bd878fc42b7.1492503445.git.pascal.mazon@6wind.com \
--to=pascal.mazon@6wind.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).