[ovs-dev] [PATCH] netdev-linux: Do not log a warning if the device is down.
Daniele Di Proietto
diproiettod at vmware.com
Fri Jun 10 22:52:16 UTC 2016
In the userspace datapath we use tap devices as internal netdev. The
datapath doesn't consider whether a device is up or down before sending
to it, and so far this hasn't been a problem.
Since Linux upstream commit 1bd4978a88ac("tun: honor IFF_UP in
tun_get_user()"), included in 4.4, writing to a tap device that is not
up sets errno to EIO. This commit avoids printing a warning in this
case.
This fixes a failures in the system-userspace-testsuites.
Reported-by: Joe Stringer <joe at ovn.org>
Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
---
lib/netdev-linux.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 82813ba..fb582ac 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -1218,15 +1218,20 @@ netdev_linux_send(struct netdev *netdev_, int qid OVS_UNUSED,
}
if (retval < 0) {
- /* The Linux AF_PACKET implementation never blocks waiting for room
- * for packets, instead returning ENOBUFS. Translate this into
- * EAGAIN for the caller. */
- error = errno == ENOBUFS ? EAGAIN : errno;
- if (error == EINTR) {
- /* continue without incrementing 'i', i.e. retry this packet */
- continue;
+ /* The linux tap driver returns EIO if the device is not up. From
+ * the OVS side this is not an error, so we should ignore it. */
+ if (!(is_tap_netdev(netdev_) && errno == EIO)) {
+ /* The Linux AF_PACKET implementation never blocks waiting for
+ * room for packets, instead returning ENOBUFS. Translate this
+ * into EAGAIN for the caller. */
+ error = errno == ENOBUFS ? EAGAIN : errno;
+ if (error == EINTR) {
+ /* continue without incrementing 'i', i.e. retry this
+ * packet */
+ continue;
+ }
+ break;
}
- break;
} else if (retval != size) {
VLOG_WARN_RL(&rl, "sent partial Ethernet packet (%"PRIuSIZE" bytes"
" of %"PRIuSIZE") on %s", retval, size,
--
2.8.1
More information about the dev
mailing list