From: Pascal Mazon <pascal.mazon@6wind.com>
To: dev@dpdk.org
Cc: pascal.mazon@6wind.com
Subject: [dpdk-dev] [PATCH v2 1/5] net/tap: add debug messages
Date: Tue, 18 Apr 2017 10:17:53 +0200 [thread overview]
Message-ID: <b9a90a2db88f0cf428a8d94215c97b3cf206c2cb.1492503445.git.pascal.mazon@6wind.com> (raw)
In-Reply-To: <cover.1492503445.git.pascal.mazon@6wind.com>
Print a detailed debug message inside tap_ioctl() directly. The caller
now only needs to check for return value.
Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
---
drivers/net/tap/rte_eth_tap.c | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index b75663838844..0c89b63a2357 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -40,6 +40,7 @@
#include <rte_vdev.h>
#include <rte_kvargs.h>
#include <rte_net.h>
+#include <rte_debug.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -444,6 +445,24 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
return num_tx;
}
+static const char *
+tap_ioctl_req2str(unsigned long request)
+{
+ switch (request) {
+ case SIOCSIFFLAGS:
+ return "SIOCSIFFLAGS";
+ case SIOCGIFFLAGS:
+ return "SIOCGIFFLAGS";
+ case SIOCGIFHWADDR:
+ return "SIOCGIFHWADDR";
+ case SIOCSIFHWADDR:
+ return "SIOCSIFHWADDR";
+ case SIOCSIFMTU:
+ return "SIOCSIFMTU";
+ }
+ return "UNKNOWN";
+}
+
static int
tap_ioctl(struct pmd_internals *pmd, unsigned long request,
struct ifreq *ifr, int set, enum ioctl_mode mode)
@@ -479,9 +498,7 @@ tap_ioctl(struct pmd_internals *pmd, unsigned long request,
case SIOCSIFMTU:
break;
default:
- RTE_LOG(WARNING, PMD, "%s: ioctl() called with wrong arg\n",
- pmd->name);
- return -EINVAL;
+ RTE_ASSERT(!"unsupported request type: must not happen");
}
if (ioctl(pmd->ioctl_sock, request, ifr) < 0)
goto error;
@@ -490,8 +507,8 @@ tap_ioctl(struct pmd_internals *pmd, unsigned long request,
return 0;
error:
- RTE_LOG(ERR, PMD, "%s: ioctl(%lu) failed with error: %s\n",
- ifr->ifr_name, request, strerror(errno));
+ RTE_LOG(DEBUG, PMD, "%s: %s(%s) failed: %s(%d)\n", ifr->ifr_name,
+ __func__, tap_ioctl_req2str(request), strerror(errno), errno);
return -errno;
}
@@ -773,12 +790,8 @@ tap_mac_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
return;
}
/* Check the actual current MAC address on the tap netdevice */
- if (tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, LOCAL_ONLY) != 0) {
- RTE_LOG(ERR, PMD,
- "%s: couldn't check current tap MAC address\n",
- dev->data->name);
+ if (tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, LOCAL_ONLY) != 0)
return;
- }
if (is_same_ether_addr((struct ether_addr *)&ifr.ifr_hwaddr.sa_data,
mac_addr))
return;
@@ -1238,10 +1251,8 @@ eth_dev_tap_create(const char *name, char *tap_name, char *remote_iface,
remote_iface);
return 0;
}
- if (tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, REMOTE_ONLY) < 0) {
- RTE_LOG(ERR, PMD, "Could not get remote MAC address\n");
+ if (tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, REMOTE_ONLY) < 0)
goto error_exit;
- }
rte_memcpy(&pmd->eth_addr, ifr.ifr_hwaddr.sa_data,
ETHER_ADDR_LEN);
}
--
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 ` Pascal Mazon [this message]
2017-04-18 8:17 ` [dpdk-dev] [PATCH v2 2/5] net/tap: remove unnecessary functions Pascal Mazon
2017-04-18 8:17 ` [dpdk-dev] [PATCH v2 3/5] net/tap: drop unnecessary nested block Pascal Mazon
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=b9a90a2db88f0cf428a8d94215c97b3cf206c2cb.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).