From: Jon Maloy <jon.maloy@ericsson.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Erik Hugne <erik.hugne@ericsson.com>, <netdev@vger.kernel.org>
Subject: Re: skb_try_coalesce bug?
Date: Tue, 22 Apr 2014 17:28:57 -0400 [thread overview]
Message-ID: <5356DF19.8050709@ericsson.com> (raw)
In-Reply-To: <5356D2AF.7030401@ericsson.com>
On 04/22/2014 04:35 PM, Jon Maloy wrote:
> On 04/22/2014 04:05 PM, Eric Dumazet wrote:
>> On Tue, 2014-04-22 at 15:38 -0400, Jon Maloy wrote:
>>
>>>
>>> In the case I encountered, our head buffer is linear (skb->data_len == 0),
>>> so it is the real tailroom value that is returned. An alas, that one is big
>>> enough to contain the last (small) fragment of the message.
>>
>>
>> Whole point of skb_try_coalesce() is to coalesce as much as possible,
>> without guarantee of keeping some sort of 'segments'
>>
>> skb_try_coalesce - try to merge skb to prior one
>>
>> If you do not want this to happen, (you seem to want nothing else in
>> your head buffer skb->head), you need to add some logic.
>
> Ok. I should have given a little background.
>
> 1: We send a message of 3041 bytes, inclusive TIPC header, via loopback interface.
>
> 2: This one gets chopped up in three fragments: 1420, 1420,and 201 bytes.
> (The mtu was of course wrong, but this is how I discovered the problem).
>
> 3: First fragment is received, uncloned, and serves as head.
>
> 4; Second fragment (a clone) is received. skb_try_coalesce() fails at
> the skb_head_is_locked() test, because the buffer is a clone.
> Because of this, we add the buffer to skb_shinfo(head)->frag_list
> instead.
>
> 5: Third fragment (also a clone) is received. Now, since we
i.e., skb_try_coalesce(head, frag)
check for
> space in tailroom of header before we do anything else, it slips
> in there, and bypasses the already chained-up second segment.
More background: our reassembly code is based on the one found in
ip_fragment.c::ip_frag_reasm(), which always first try to coalecse
a buffer with head. That is a bad idea, I guess, but I wonder why
they don't see this problem in ipv4.
>
> Regards
> ///jon
>
>
>>
>> A helper temporarily setting head->tail = head->end would do it I guess.
That would work. Or just check skb_has_frag_list(head) first, and make
the call to skb_try_coalesce() conditional to the the result.
It just feels a little unnecessary, since that test is done inside
skb_try_coalesce() anyway.
///jon
>>
>>
>
> --
> 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
>
next prev parent reply other threads:[~2014-04-22 21:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-22 12:01 skb_try_coalesce bug? Erik Hugne
2014-04-22 13:11 ` Eric Dumazet
2014-04-22 19:38 ` Jon Maloy
2014-04-22 20:05 ` Eric Dumazet
2014-04-22 20:35 ` Jon Maloy
2014-04-22 21:28 ` Jon Maloy [this message]
2014-04-22 21:29 ` Eric Dumazet
2014-04-22 21:31 ` Jon Maloy
2014-04-22 21:37 ` Eric Dumazet
2014-04-23 16:56 ` Jon Maloy
2014-04-23 17:33 ` David Miller
2014-04-23 17:54 ` Jon Maloy
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=5356DF19.8050709@ericsson.com \
--to=jon.maloy@ericsson.com \
--cc=eric.dumazet@gmail.com \
--cc=erik.hugne@ericsson.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 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).