Message ID | 20230130130047.GA7913@debian |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2170369wrn; Mon, 30 Jan 2023 05:11:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXsXK4NBghzoAiLtM7CvU5djN/Nq8d/hqUHhjYWNENh3k8MuArt4pbO5l9cRitX4BQHISzz2 X-Received: by 2002:a05:6402:43cc:b0:499:376e:6b2d with SMTP id p12-20020a05640243cc00b00499376e6b2dmr62607035edc.0.1675084318645; Mon, 30 Jan 2023 05:11:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675084318; cv=none; d=google.com; s=arc-20160816; b=IMpTL39X1O8anGo34vRmzOA2EMfllAYVrYguu9RSmINgZ9RasqHGhDcXJM59+8fiLx Pv9s7IT94NjJt2rlHnWCoC0FHyoRKYV+z81jtBsAV+1GW/Dq0K8yNPgpk0qZiA0jK/iM iQz9PvFM8SN4oDTlKu5Sdb4J2/7zcXABJjIfgV9Lo6jBr48KmMWyMdUJE08JJRm5xJds tBd+ONwbOFA69XYfV6Rf3Nm/8nTHlPecc9K80bYLCASeZQTlPMIuTiY0EDtnpjMYsWqu 5xXCizGI4zKrT7AweHphlGFuWY1Q7loZQ0GJ+p+BkQw8DeIsxexteueYDImE32aHQotF doJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :message-id:subject:to:from:date:dkim-signature; bh=gfP++trWxino2nxmOeW6QjlxbhEmTqO0/dyok6r1CGY=; b=S01Pe3vZ9LsXCeXHcK0UJrHFyoYdgZR1RfVZrOwmYJJM0VIq2qn1mGbbsKyn8F73a3 GVM4pY4JqqMYeEjCma5/ss6I+ll8/4UxRfHXn7wHqrSxBd3OHNh2yK/pWO6I5DQsvq5B D85he7IF6rbgjVd/edw0pysy+bioEIolKR/bzAn7bAgyxUgI3iBtAjhcvSiire9Ino+Q bap+l6MEwwkXOQ3CAtg5wBBvhlS+5BA/5pL38YpdYXMbZzgbRX2AJXBn3vEj8MyVZzm2 Wqpr6I8MuT2dUOnQaX9tjXqgCKQ2ILtZaGM1o8/5+gulfSYka5lkIyCT6DY6tJLtBE+c QLdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=c7ta6ATI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bq21-20020a056402215500b0049e376ac999si14002001edb.529.2023.01.30.05.11.28; Mon, 30 Jan 2023 05:11:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=c7ta6ATI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237023AbjA3NBd (ORCPT <rfc822;n2h9z4@gmail.com> + 99 others); Mon, 30 Jan 2023 08:01:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237005AbjA3NB2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 30 Jan 2023 08:01:28 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB4C9172B; Mon, 30 Jan 2023 05:01:26 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id m7so10976646wru.8; Mon, 30 Jan 2023 05:01:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=user-agent:content-disposition:mime-version:message-id:subject:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=gfP++trWxino2nxmOeW6QjlxbhEmTqO0/dyok6r1CGY=; b=c7ta6ATIyd0Tis+q3Wd5KN1qKCmvOiu05/Rg/8GDqFyKZTW3kGfXeqKCWApKiqiYPI S3AiNEZXfkFgXeM85xREiIUE5lC5teoYvDaszXlSsZQoHm/MP1AtLmvSzU4n8i8D1jQU Im+v0Zm4HghZBwUWW7LpVXaaOEgZx76UkL/525w1ohw/BAJTRBH2DqUCs+v+J9h5MaOG BHT/47scVKVM/sA0oGIoL7QBUFIXASDDVk9juaWKRSQ0cH9DBeBGts/XxkUzkJn16gpY 2A9JrZBEXd2R+UffPLqNsG52W01nZszIgHXVxMcOl2SLD2oTvv9RrpdRCLVEy1jFc4wN 1f7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:content-disposition:mime-version:message-id:subject:to :from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gfP++trWxino2nxmOeW6QjlxbhEmTqO0/dyok6r1CGY=; b=ghYhl2MIdhTAJIlnCrEHBmUVauNfiLDdyHlJ9gIJTXzls9KTxlMyJ8hPxKcjjiTZa0 Y2m6VpYqSjxJuJrS7dgCD5Aul6uyjhWoG5Mor2yaQmBGJCPkXCJ+UyAf/sfJmcyvBkla s+u66O6J0GuhsQ1COm9U1pT/1J/B0iA9ByI0vwAOw4/Qeb/E70wF3CCZg0I5BYIeMd1t Ar8f4TvodrQBHpVGFf14Od4K3i3PwxwhPRx8J3EBNqf2uQKKF+V1mIwzQJBAf517Syb0 rXxiXP3JGAQBZJcDReajTFMsRKSwy5wjdE5/9jxs5dBczGiUDGQeiDsDm7mHzSTsdcyz x4Mw== X-Gm-Message-State: AFqh2krh4yi0qOfctJLojg0K113v/OKDFarQzxETShHrA0z7FT1Hn1nh 06XyS/h5bcDCuzXhsK6S1Xlm4egzze4= X-Received: by 2002:a05:6000:1c06:b0:2bf:6f4a:3f66 with SMTP id ba6-20020a0560001c0600b002bf6f4a3f66mr35079299wrb.21.1675083685193; Mon, 30 Jan 2023 05:01:25 -0800 (PST) Received: from debian ([89.238.191.199]) by smtp.gmail.com with ESMTPSA id o6-20020adfe806000000b002bdf8dd6a8bsm11659174wrm.80.2023.01.30.05.01.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 05:01:24 -0800 (PST) Date: Mon, 30 Jan 2023 14:00:55 +0100 From: Richard Gobert <richardbgobert@gmail.com> To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, yoshfuji@linux-ipv6.org, dsahern@kernel.org, steffen.klassert@secunet.com, lixiaoyan@google.com, alexanderduyck@fb.com, leon@kernel.org, ye.xingchen@zte.com.cn, iwienand@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/2] gro: optimise redundant parsing of packets Message-ID: <20230130130047.GA7913@debian> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756453214308186278?= X-GMAIL-MSGID: =?utf-8?q?1756453214308186278?= |
Series |
gro: optimise redundant parsing of packets
|
|
Message
Richard Gobert
Jan. 30, 2023, 1 p.m. UTC
Currently, the IPv6 extension headers are parsed twice: first in ipv6_gro_receive, and then again in ipv6_gro_complete. The field NAPI_GRO_CB(skb)->proto is used by GRO to hold the layer 4 protocol type that comes after the IPv6 layer. I noticed that it is set in ipv6_gro_receive, but isn't used anywhere. By using this field, and also storing the size of the network header, we can avoid parsing extension headers a second time in ipv6_gro_complete. The first commit frees up space in the GRO CB. The second commit reduces the redundant parsing during the complete phase, using the freed CB space. I've applied this optimisation to all base protocols (IPv6, IPv4, Ethernet). Then, I benchmarked this patch on my machine, using ftrace to measure ipv6_gro_complete's performance, and there was an improvement. Richard Gobert (2): gro: decrease size of CB gro: optimise redundant parsing of packets include/net/gro.h | 32 +++++++++++++++++++++----------- net/core/gro.c | 18 +++++++++++------- net/ethernet/eth.c | 11 +++++++++-- net/ipv4/af_inet.c | 8 +++++++- net/ipv6/ip6_offload.c | 15 ++++++++++++--- 5 files changed, 60 insertions(+), 24 deletions(-)