Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2567350pxf; Sun, 14 Mar 2021 04:12:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIwEnk86XeY+YYD/VtkUBFxDtUb0Fo5347dv//tqkI6EzepsIthauIgE7TAZ9OZU5Wqpp1 X-Received: by 2002:aa7:c957:: with SMTP id h23mr19567749edt.301.1615720372708; Sun, 14 Mar 2021 04:12:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615720372; cv=none; d=google.com; s=arc-20160816; b=sEGbwZSASJKXY522SkRvNMqnM4ayECuPjh1xp/7GSFVzs8mMyIFhFJbxtwI3Alzmhv /5dF2SFaCF8eYtDYqFbsjZvY5fQ8q//WiZtX7Jk7ozS92t4bcMwTq1KRaTaUqV5RWCs0 kiywPHdUuknpqDq8A3pC8jlrwROCmOImVtw6SGyNyF6jSyMhPS80iGG6ZnYDq7qMyau0 8pGG+hyJCL9W9mbElWbYl//wbJwWw1LBz9bT93zSop3YToiipmmBFTkz32gCcsaL6CNl hpPpENvr5A2yFfsXPMxHU2CcyuqJfpvGMZjqe6ikdqebYQR7nm/6AKsd6ieo3xbJsKVh zJmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:subject:reply-to:cc:from:to:dkim-signature:date; bh=8pljKco6S41xC6hA1KN72x2WWC8GcMpq0scMzGiuX40=; b=Fzet2S9DGAMnmijY9iOi4b9eT2bEcI3Vv8WOlg6uzEmE77B7S1aGypmSTcWBkM0ZVJ Feaz+SuBg/hFtf5vBCbX622pjT8ewGQ40ALzMRoeY6mefwOiQFIeIO2Ekm4BKMtCmjeh hbvxeI/HkJUI+c/f9y818qDvWkeKIGzXcruLKnWOg8znWBEaK87pAJBH5CHcogKDLKyU P05hbzQw6Ewsd0qiTzVcKtKDsBdkcVlX26deZ15QiCKcjbMUtzC8KJQuud+3gPSdVsBN rmHqxgNaB7BpdAtxmvWzyFX8nWAngmPyNGbOegq5VFmdgQ3RkviQ0do2w1w2Bhfb4u/2 +SKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=HYkJKo65; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si9443789eda.350.2021.03.14.04.12.30; Sun, 14 Mar 2021 04:12:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=HYkJKo65; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235216AbhCNLL2 (ORCPT + 99 others); Sun, 14 Mar 2021 07:11:28 -0400 Received: from mail1.protonmail.ch ([185.70.40.18]:11791 "EHLO mail1.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234904AbhCNLLA (ORCPT ); Sun, 14 Mar 2021 07:11:00 -0400 Date: Sun, 14 Mar 2021 11:10:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1615720257; bh=8pljKco6S41xC6hA1KN72x2WWC8GcMpq0scMzGiuX40=; h=Date:To:From:Cc:Reply-To:Subject:From; b=HYkJKo65cP0jCYvfrRvkUzRvVskjy8BBls/otbbBiOFEUnKYmV5O9CtcJEbdpJ6y6 +3Df0LiBqx4VKoLPkgTeMSiTU6tefwCx4d93Cm19JpGofDjhiT3NDqmDxUwRN0srzu qbDaDtIrGP2KPuO2Xd1SwrJ9dJieNcbacpInw/NgQ4pS+1CEenAH9iVwwXE2Cnjx5k XOwgylygpo8aZHyScxotXbodEpnXzx7D9T5HczNU/wlOHLOtRKUXCIlbctKzZrflpg VZhA8ByrreRkzG584KiYUvDIpVKXDut3xEW3XNmMF1xjLTwMJcqh5TUMiCeV5eEK9v zxw9WkQ7KHWFA== To: "David S. Miller" , Jakub Kicinski From: Alexander Lobakin Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Jonathan Lemon , Alexander Lobakin , Eric Dumazet , Willem de Bruijn , Kevin Hao , Pablo Neira Ayuso , Jakub Sitnicki , Marco Elver , Dexuan Cui , Vladimir Oltean , Ariel Levkovich , Wang Qing , Davide Caratti , Guillaume Nault , Eran Ben Elisha , Mauro Carvalho Chehab , Kirill Tkhai , Bartosz Golaszewski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH v3 net-next 0/6] skbuff: micro-optimize flow dissection Message-ID: <20210314111027.7657-1-alobakin@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This little number makes all of the flow dissection functions take raw input data pointer as const (1-5) and shuffles the branches in __skb_header_pointer() according to their hit probability. The result is +20 Mbps per flow/core with one Flow Dissector pass per packet. This affects RPS (with software hashing), drivers that use eth_get_headlen() on their Rx path and so on. From v2 [1]: - reword some commit messages as a potential fix for NIPA; - no functional changes. From v1 [0]: - rebase on top of the latest net-next. This was super-weird, but I double-checked that the series applies with no conflicts, and then on Patchwork it didn't; - no other changes. [0] https://lore.kernel.org/netdev/20210312194538.337504-1-alobakin@pm.me [1] https://lore.kernel.org/netdev/20210313113645.5949-1-alobakin@pm.me Alexander Lobakin (6): flow_dissector: constify bpf_flow_dissector's data pointers skbuff: make __skb_header_pointer()'s data argument const flow_dissector: constify raw input data argument linux/etherdevice.h: misc trailing whitespace cleanup ethernet: constify eth_get_headlen()'s data argument skbuff: micro-optimize {,__}skb_header_pointer() include/linux/etherdevice.h | 4 ++-- include/linux/skbuff.h | 26 +++++++++++------------ include/net/flow_dissector.h | 6 +++--- net/core/flow_dissector.c | 41 +++++++++++++++++++----------------- net/ethernet/eth.c | 2 +- 5 files changed, 40 insertions(+), 39 deletions(-) -- 2.30.2