Re: [net-next 2/2] macvlan: Enable qdisc backoff logic.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Arnd Bergmann
Date: Friday, August 27, 2010 - 6:16 am

On Thursday 26 August 2010, Ben Greear wrote:

I think at the very least it needs to return -EAGAIN to the user, like this
(untested) fragment. I'm not sure if the poll() logic works correctly here,
will need to check that. In the worst case, the user would retransmit
immediately again.

Qemu calls poll() on the fd if it receives -EAGAIN, and macvtap waits for
the internal socket to become writable using 

        if (sock_writeable(&q->sk) ||
            (!test_and_set_bit(SOCK_ASYNC_NOSPACE, &q->sock.flags) &&
             sock_writeable(&q->sk)))
                mask |= POLLOUT | POLLWRNORM;

It seems that this code was never tested though, since we never returned
-EAGAIN before.

I'm also not sure how vhost handles -EAGAIN in the transmit path.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 3b1c54a..37bde69 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -506,8 +506,13 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q,
 
 	rcu_read_lock_bh();
 	vlan = rcu_dereference(q->vlan);
-	if (vlan)
-		macvlan_start_xmit(skb, vlan->dev);
+	if (vlan) {
+		err = macvlan_start_xmit(skb, vlan->dev);
+		if (err == NETDEV_TX_BUSY) {
+			kfree_skb(skb);
+			count = -EAGAIN;
+		}
+	}
 	else
 		kfree_skb(skb);
 	rcu_read_unlock_bh();
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[net-next 2/2] macvlan: Enable qdisc backoff logic., Ben Greear, (Wed Aug 25, 12:00 pm)
Re: [net-next 2/2] macvlan: Enable qdisc backoff logic., Arnd Bergmann, (Wed Aug 25, 12:24 pm)
Re: [net-next 2/2] macvlan: Enable qdisc backoff logic., Hagen Paul Pfeifer, (Wed Aug 25, 12:38 pm)
Re: [net-next 2/2] macvlan: Enable qdisc backoff logic., Arnd Bergmann, (Wed Aug 25, 12:59 pm)
Re: [net-next 2/2] macvlan: Enable qdisc backoff logic., Arnd Bergmann, (Thu Aug 26, 6:55 am)
Re: [net-next 2/2] macvlan: Enable qdisc backoff logic., Arnd Bergmann, (Fri Aug 27, 6:16 am)