Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63E17C6FD1F for ; Mon, 13 Mar 2023 16:52:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230222AbjCMQw1 (ORCPT ); Mon, 13 Mar 2023 12:52:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230139AbjCMQwX (ORCPT ); Mon, 13 Mar 2023 12:52:23 -0400 Received: from mail-yw1-x112c.google.com (mail-yw1-x112c.google.com [IPv6:2607:f8b0:4864:20::112c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBF275BBA for ; Mon, 13 Mar 2023 09:51:51 -0700 (PDT) Received: by mail-yw1-x112c.google.com with SMTP id 00721157ae682-5416698e889so132173337b3.2 for ; Mon, 13 Mar 2023 09:51:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1678726311; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=KZ05Z67fmkeCIKN3rlGn8s6ITfRrSiu2jOUyiAMkfsI=; b=e0afJLHUAo9zc1qU6RM2W6pR23dnpzrc9FFdh3E34g+t7L1p9uzVurHddguodajSjO l1vYUOtKTd3VYkINB/h6ZMUUnMMW/Nnej42pSlpm+MNklBe09vIQKc3OwGVYOIv/pdl3 XiWTFERJfgNUfWnSm6Zd50EpQY9Inf022Z0VDDdOFhfoykGxJhFfi6BZBqmuv9SrB/85 q5rEPHKwm5DnWn19rKcTt1ayqNDWgnE7s+k6PKJjguKNxMIir7Bq9ZjWWbI+eogUwMwh d+qzpOw2bPuxvNjGkXR49W/qhva4SdiC4jmRxR0xc/DVb5feUzJwyxB8qz4HITGK7cU8 lW+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678726311; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KZ05Z67fmkeCIKN3rlGn8s6ITfRrSiu2jOUyiAMkfsI=; b=sUZ7H4IW/Tb0HBrDh5a57JEsD0e8b3mpHBpXb76sKti/Gd8R1bZLPofncFo53aIlm/ 0/jCG018LcZybpIRywmMTMHs7Xgmn7e6sPL6gmeiiDek/bNkSgwh4bdMHxm29eQz9siC LLrmo7/FiEEHbFo92CEzMpI0Y1Mda8k3yA1t1htKFj5Lvbjaprxoouiwt5Bn//tq2JdX ihgK6rF3uFGyH0rF/pmxXRp3eD0ZRwdw4LSK6Gn5WUj9zZ6zIH3+f2MXMCfqqLkhDKQ+ 2wDAuSpdRDcg+bQQ8WsaNjuP/0yfpL4mjwTztT/Zr+e9xSC4KOc1Hf06erUggxYASEFm ACbQ== X-Gm-Message-State: AO0yUKXrMgDFvowi0P7pBWpqg7HMd/8Fg5uCVjZwiPgU8hNAKhV5NADg BP7D5rx1oR+3HDW74ctrsauBDatg2iei7itI/mXdyQ== X-Google-Smtp-Source: AK7set+tp9t9wsLUMP6VoJYyrtoWRA0Md183jAXL9mKimO4GfbxxA8nQLNGIbkZnfWsdV5u5WHhul7aFx/n+hnSAz14= X-Received: by 2002:a81:a9c8:0:b0:533:9c5b:7278 with SMTP id g191-20020a81a9c8000000b005339c5b7278mr22629557ywh.0.1678726310872; Mon, 13 Mar 2023 09:51:50 -0700 (PDT) MIME-Version: 1.0 References: <20230313162520.GA17199@debian> <20230313164541.GA17394@debian> In-Reply-To: <20230313164541.GA17394@debian> From: Eric Dumazet Date: Mon, 13 Mar 2023 09:51:39 -0700 Message-ID: Subject: Re: [PATCH v3 2/2] gro: optimise redundant parsing of packets To: Richard Gobert Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, dsahern@kernel.org, alexanderduyck@fb.com, lucien.xin@gmail.com, lixiaoyan@google.com, iwienand@redhat.com, leon@kernel.org, ye.xingchen@zte.com.cn, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 13, 2023 at 9:46=E2=80=AFAM Richard Gobert wrote: > > Currently the IPv6 extension headers are parsed twice: first in > ipv6_gro_receive, and then again in ipv6_gro_complete. > > By using the new ->transport_proto field, and also storing the size of th= e > network header, we can avoid parsing extension headers a second time in > ipv6_gro_complete (which saves multiple memory dereferences and condition= al > checks inside ipv6_exthdrs_len for a varying amount of extension headers = in > IPv6 packets). > > The implementation had to handle both inner and outer layers in case of > encapsulation (as they can't use the same field). I've applied a similar > optimisation to Ethernet. > > Performance tests for TCP stream over IPv6 with a varying amount of > extension headers demonstrate throughput improvement of ~0.7%. > > In addition, I fixed a potential future problem: I would remove all this block. We fix current problems, not future hypothetical ones. > - The call to skb_set_inner_network_header at the beginning of > ipv6_gro_complete calculates inner_network_header based on skb->data b= y > calling skb_set_inner_network_header, and setting it to point to the > beginning of the ip header. > - If a packet is going to be handled by BIG TCP, the following code bloc= k > is going to shift the packet header, and skb->data is going to be > changed as well. > > When the two flows are combined, inner_network_header will point to the > wrong place - which might happen if encapsulation of BIG TCP will be > supported in the future. > > The fix is to place the whole encapsulation branch after the BIG TCP code > block. This way, if encapsulation of BIG TCP will be supported, > inner_network_header will still be calculated with the correct value of > skb->data. We do not support encapsulated BIG TCP yet. We will do this later, and whoever does it will make sure to also support G= RO. > Also, by arranging the code that way, the optimisation does not > add an additional branch. > > Signed-off-by: Richard Gobert > --- > Can you give us a good explanation of why extension headers are used exactl= y ? I am not sure we want to add code to GRO for something that 99.99% of us do not use.