From: David Woodhouse <dwmw2@infradead.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Benjamin LaHaise <bcrl@kvack.org>,
Vijay Subramanian <subramanian.vijay@gmail.com>,
David Miller <davem@davemloft.net>,
saku@ytti.fi, rick.jones2@hp.com, netdev@vger.kernel.org
Subject: Re: TCP and reordering
Date: Sun, 02 Dec 2012 01:30:40 +0000 [thread overview]
Message-ID: <1354411840.21562.373.camel@shinybook.infradead.org> (raw)
In-Reply-To: <1354122996.14302.427.camel@edumazet-glaptop>
[-- Attachment #1: Type: text/plain, Size: 2958 bytes --]
On Wed, 2012-11-28 at 09:16 -0800, Eric Dumazet wrote:
> On Wed, 2012-11-28 at 16:41 +0000, David Woodhouse wrote:
>
> > Another fun issue with tunnelling protocols and BQL... packets tend to
> > *grow* as they get encapsulated. So you might end up calling
> > netdev_sent_queue() with a given size, then netdev_completed_queue()
> > with a bigger packet later...
>
> Its the driver responsibility to maintain the coherent 'bytes' value for
> each transmitted/completed packet.
>
> If a driver calls an external entity, it cannot possibly use BQL, unless
> doing an approximation (bytes becomes a fixed value)
>
> BQL was really something to control/limit queueing on ethernet links,
> not for stacked devices, as stacked devices normally have no queue.
Oh, of *course*... this is why my kernel would panic if I attempted to
add BQL to BR2684. The ATM low-level driver was pushing a header onto
the skb, and I ended up calling netdev_completed_queue() with a larger
'bytes' value than the one I'd called netdev_sent_queue() with. Which
leads to a BUG(), which immediately results in a panic. A moderately
suboptimal failure mode, when a nasty warning and disabling BQL on this
interface might have been nicer.
However, *perhaps* it isn't so hard to get a consistent 'bytes' value.
This version appears to work... can we use something along these lines
in the general case? What if skb_is_nonlinear()?
This probably doesn't work for L2TP where it's going to be passed down
the whole stack and get a new network header and everything. But for
BR2684 is this at least a salvageable approach?
--- net/atm/br2684.c~ 2012-12-01 16:35:49.000000000 +0000
+++ net/atm/br2684.c 2012-12-02 01:18:35.216607088 +0000
@@ -180,6 +180,11 @@ static struct notifier_block atm_dev_not
.notifier_call = atm_dev_event,
};
+static unsigned int skb_acct_len(struct sk_buff *skb)
+{
+ return skb_tail_pointer(skb) - skb_network_header(skb);
+}
+
/* chained vcc->pop function. Check if we should wake the netif_queue */
static void br2684_pop(struct atm_vcc *vcc, struct sk_buff *skb)
{
@@ -191,6 +196,8 @@ static void br2684_pop(struct atm_vcc *v
/* If the queue space just went up from zero, wake */
if (atomic_inc_return(&brvcc->qspace) == 1)
netif_wake_queue(brvcc->device);
+
+ netdev_completed_queue(brvcc->device, 1, skb_acct_len(skb));
}
/*
@@ -265,6 +272,7 @@ static int br2684_xmit_vcc(struct sk_buf
netif_wake_queue(brvcc->device);
}
+ netdev_sent_queue(brvcc->device, skb_acct_len(skb));
/* If this fails immediately, the skb will be freed and br2684_pop()
will wake the queue if appropriate. Just return an error so that
the stats are updated correctly */
@@ -710,6 +718,7 @@ static int br2684_create(void __user *ar
return err;
}
+ netdev_reset_queue(netdev);
write_lock_irq(&devs_lock);
brdev->payload = payload;
--
dwmw2
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]
next prev parent reply other threads:[~2012-12-02 1:30 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-27 9:32 TCP and reordering Saku Ytti
2012-11-27 17:05 ` Rick Jones
2012-11-27 17:15 ` Saku Ytti
2012-11-27 18:00 ` Rick Jones
2012-11-28 2:06 ` David Miller
2012-11-28 7:26 ` Saku Ytti
2012-11-28 8:35 ` Vijay Subramanian
2012-11-28 8:54 ` Saku Ytti
2012-11-28 18:24 ` Rick Jones
2012-11-28 18:33 ` Eric Dumazet
2012-11-28 18:52 ` Vijay Subramanian
2012-11-28 18:44 ` Saku Ytti
2012-11-28 7:59 ` David Woodhouse
2012-11-28 8:21 ` Christoph Paasch
2012-11-28 8:22 ` Vijay Subramanian
2012-11-28 9:08 ` David Woodhouse
2012-11-28 11:02 ` Eric Dumazet
2012-11-28 11:49 ` David Woodhouse
2012-11-28 12:26 ` Eric Dumazet
2012-11-28 12:39 ` David Woodhouse
2012-11-28 12:52 ` Eric Dumazet
2012-11-28 15:47 ` David Woodhouse
2012-11-28 16:09 ` Eric Dumazet
2012-11-28 16:21 ` David Woodhouse
2012-11-28 16:19 ` Benjamin LaHaise
2012-11-28 16:41 ` David Woodhouse
2012-11-28 17:08 ` Benjamin LaHaise
2012-11-28 17:16 ` Eric Dumazet
2012-11-28 18:01 ` David Woodhouse
2012-11-29 15:10 ` Noel Grandin
2012-12-02 1:30 ` David Woodhouse [this message]
2012-12-02 2:40 ` Eric Dumazet
2012-12-02 9:31 ` David Woodhouse
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=1354411840.21562.373.camel@shinybook.infradead.org \
--to=dwmw2@infradead.org \
--cc=bcrl@kvack.org \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=rick.jones2@hp.com \
--cc=saku@ytti.fi \
--cc=subramanian.vijay@gmail.com \
/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).