From: Ben Greear <greearb@candelatech.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: netdev@vger.kernel.org
Subject: Re: [net-next 2/2] macvlan: Enable qdisc backoff logic.
Date: Thu, 26 Aug 2010 10:45:58 -0700 [thread overview]
Message-ID: <4C76A856.2040202@candelatech.com> (raw)
In-Reply-To: <201008261555.35250.arnd@arndb.de>
On 08/26/2010 06:55 AM, Arnd Bergmann wrote:
> On Wednesday 25 August 2010, Ben Greear wrote:
>> On 08/25/2010 12:59 PM, Arnd Bergmann wrote:
>>> On Wednesday 25 August 2010 21:27:43 Ben Greear wrote:
>>>>> I suppose we need to do something in macvtap to handle this as
>>>>> well, right? A guest trying to send a frame through qemu
>>>>> or vhost net into macvtap needs to be prevented from sending
>>>>> more when we get into this path. Right now, we just ignore
>>>>> the return value of macvlan_start_xmit.
>>>>
>>>> I have a similar, though slightly more complex, patch for 802.1q
>>>> vlans, but I haven't looked at macvtap at all.
>>>>
>>>> If these two patches are accepted, I'll post the .1q patch as well.
>>>
>>> I think one of us needs to fix macvtap in order for your patch to
>>> go in, because otherwise there is a memory leak or worse when
>>> macvtap fails to retransmit the frame.
>>
>> With no change, the try_ logic will not be called, so it should
>> be fully backwards compatible.
>
> How? The macvlan driver is used as the back-end for macvtap,
> so it calls all the same functions:
>
> macvtap_write
> -> macvtap_get_user
> -> macvlan_start_xmit
> -> macvlan->queue_xmit
> -> try_dev_queue_xmit
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.
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 4256727..5abf0c0 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -571,9 +571,15 @@ 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);
- else
+ if (vlan) {
+ /* TODO: Deal with BUSY properly by somehow re-queuing
+ * skb for later transmit and let calling logic know it
+ * needs to back off for a short time.
+ */
+ if (macvlan_start_xmit(skb, vlan->dev) == NETDEV_TX_BUSY)
+ goto free_skb;
+ } else
+free_skb:
kfree_skb(skb);
rcu_read_unlock_bh();
If this looks good, I'll do up an official patch set containing this and the other
two patches I sent previously.
Thanks,
Ben
>
> Arnd
> --
> 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
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
next prev parent reply other threads:[~2010-08-26 17:46 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 [this message]
2010-08-27 13:16 ` Arnd Bergmann
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=4C76A856.2040202@candelatech.com \
--to=greearb@candelatech.com \
--cc=arnd@arndb.de \
--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.