From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Soheil Hassas Yeganeh <soheil@google.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, netdev <netdev@vger.kernel.org>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Talal Ahmad <talalahmad@google.com>,
Arjun Roy <arjunroy@google.com>,
Willem de Bruijn <willemb@google.com>,
Davide Caratti <dcaratti@redhat.com>
Subject: Re: [PATCH net] tcp: add missing tcp_skb_can_collapse() test in tcp_shift_skb_data()
Date: Tue, 1 Feb 2022 12:01:23 -0800 (PST) [thread overview]
Message-ID: <62ad3eb-cbb6-a59e-f5fe-5c439d21e760@linux.intel.com> (raw)
In-Reply-To: <CACSApvZ8vXXJ_zKf_HpoVgACwWxS2UvBw9QCv1ZnPX9ZpF3D_g@mail.gmail.com>
On Tue, 1 Feb 2022, Soheil Hassas Yeganeh wrote:
> On Tue, Feb 1, 2022 at 1:46 PM Eric Dumazet <eric.dumazet@gmail.com> wrote:
>>
>> From: Eric Dumazet <edumazet@google.com>
>>
>> tcp_shift_skb_data() might collapse three packets into a larger one.
>>
>> P_A, P_B, P_C -> P_ABC
>>
>> Historically, it used a single tcp_skb_can_collapse_to(P_A) call,
>> because it was enough.
>>
>> In commit 85712484110d ("tcp: coalesce/collapse must respect MPTCP extensions"),
>> this call was replaced by a call to tcp_skb_can_collapse(P_A, P_B)
>>
>> But the now needed test over P_C has been missed.
>>
>> This probably broke MPTCP.
>>
>> Then later, commit 9b65b17db723 ("net: avoid double accounting for pure zerocopy skbs")
>> added an extra condition to tcp_skb_can_collapse(), but the missing call
>> from tcp_shift_skb_data() is also breaking TCP zerocopy, because P_A and P_C
>> might have different skb_zcopy_pure() status.
>>
>> Fixes: 85712484110d ("tcp: coalesce/collapse must respect MPTCP extensions")
>> Fixes: 9b65b17db723 ("net: avoid double accounting for pure zerocopy skbs")
>> Signed-off-by: Eric Dumazet <edumazet@google.com>
>> Cc: Paolo Abeni <pabeni@redhat.com>
>> Cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
>> Cc: Talal Ahmad <talalahmad@google.com>
>> Cc: Arjun Roy <arjunroy@google.com>
>> Cc: Soheil Hassas Yeganeh <soheil@google.com>
>> Cc: Willem de Bruijn <willemb@google.com>
>
> Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
>
> I wish there were some packetdrill tests for MPTCP. Thank you for the fix!
>
Soheil -
I have good news, there are packetdrill tests for MPTCP:
https://github.com/multipath-tcp/packetdrill
This is still in a fork. I think Davide has talked to Neal about
upstreaming the MPTCP changes before but there may be some code that needs
refactoring before that could happen.
>> ---
>> net/ipv4/tcp_input.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
>> index dc49a3d551eb919baf5ad812ef21698c5c7b9679..bfe4112e000c09ba9d7d8b64392f52337b9053e9 100644
>> --- a/net/ipv4/tcp_input.c
>> +++ b/net/ipv4/tcp_input.c
>> @@ -1660,6 +1660,8 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb,
>> (mss != tcp_skb_seglen(skb)))
>> goto out;
>>
>> + if (!tcp_skb_can_collapse(prev, skb))
>> + goto out;
>> len = skb->len;
>> pcount = tcp_skb_pcount(skb);
>> if (tcp_skb_shift(prev, skb, pcount, len))
>> --
>> 2.35.0.rc2.247.g8bbb082509-goog
>>
>
--
Mat Martineau
Intel
next prev parent reply other threads:[~2022-02-01 20:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-01 18:46 [PATCH net] tcp: add missing tcp_skb_can_collapse() test in tcp_shift_skb_data() Eric Dumazet
2022-02-01 18:47 ` Soheil Hassas Yeganeh
2022-02-01 20:01 ` Mat Martineau [this message]
2022-02-02 9:38 ` Paolo Abeni
2022-02-03 0:40 ` patchwork-bot+netdevbpf
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=62ad3eb-cbb6-a59e-f5fe-5c439d21e760@linux.intel.com \
--to=mathew.j.martineau@linux.intel.com \
--cc=arjunroy@google.com \
--cc=davem@davemloft.net \
--cc=dcaratti@redhat.com \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=soheil@google.com \
--cc=talalahmad@google.com \
--cc=willemb@google.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).