From: Arnd Bergmann <arnd@arndb.de>
To: Ben Greear <greearb@candelatech.com>
Cc: netdev@vger.kernel.org, mst@redhat.com
Subject: Re: [net-next 2/2] macvlan: Enable qdisc backoff logic.
Date: Fri, 27 Aug 2010 15:16:11 +0200 [thread overview]
Message-ID: <201008271516.11295.arnd@arndb.de> (raw)
In-Reply-To: <4C76A856.2040202@candelatech.com>
On Thursday 26 August 2010, Ben Greear wrote:
> I think this will keep today's functionality. Someone that knows and uses this
> code might can figure out how to properly do backpressure to calling code
> and re-queue the skb instead of just deleting it when the underlying device
> complains of being busy.
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();
next prev parent reply other threads:[~2010-08-27 13:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-25 19:00 [net-next 1/2] qdisc: Allow qdiscs to provide backpressure up the stack Ben Greear
2010-08-25 19:00 ` [net-next 2/2] macvlan: Enable qdisc backoff logic Ben Greear
2010-08-25 19:24 ` Arnd Bergmann
2010-08-25 19:27 ` Ben Greear
2010-08-25 19:38 ` Hagen Paul Pfeifer
2010-08-25 19:49 ` Ben Greear
2010-08-25 19:59 ` Arnd Bergmann
2010-08-25 20:49 ` Ben Greear
2010-08-26 13:55 ` Arnd Bergmann
2010-08-26 15:33 ` Ben Greear
2010-08-26 17:45 ` Ben Greear
2010-08-27 13:16 ` Arnd Bergmann [this message]
2010-08-25 20:44 ` [net-next 1/2] qdisc: Allow qdiscs to provide backpressure up the stack Stephen Hemminger
2010-08-25 20:56 ` Ben Greear
2010-08-26 22:59 ` David Miller
2010-08-27 4:14 ` Ben Greear
2010-08-27 4:34 ` David Miller
2010-08-27 5:22 ` Ben Greear
2010-08-27 5:36 ` David Miller
2010-08-27 5:58 ` Ben Greear
2010-08-27 6:11 ` David Miller
2010-08-27 15:26 ` Ben Greear
2010-08-27 15:59 ` Eric Dumazet
2010-08-27 17:00 ` Ben Greear
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=201008271516.11295.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=greearb@candelatech.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.