Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1530839pxf; Fri, 12 Mar 2021 11:47:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPXh+aYFNw/lv2vUumpAHAUnevDi0OHw5DkRk3JXym0V4xgxmOYZDRN4ZZXwZ9hYfQrwML X-Received: by 2002:aa7:c345:: with SMTP id j5mr15721177edr.338.1615578477060; Fri, 12 Mar 2021 11:47:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615578477; cv=none; d=google.com; s=arc-20160816; b=nK4R9QGveLIrRLSHfIWKcOZhK3uzeUudTYzlec4avNc0GrTpC63r1SOcNqbyiozh0f USygQ2p24cDVGx2JpTXloRUF9yBu7zwSRzlIzUjFb0rKnLEB+Hs1FdmXAyyBwoCWGulC PPzqQ9nzmoWgzwD5+FhL3FUWkw+AcJrp4pFcUd8QO/3WHUGWZerJ6lHVPBQKWBao5NEs iWyLK3eowcmparbAManV1zC01Pq1wIQMwjsQTZUo2zIvlpGQd+GymXQXk9aGkEmXXT35 BWJbt9vogW/8ioUoJ+c742eDscyIOHBT8KxCy1VT8uteV8V6aMmiJx+N0ZAxBfPhH3V0 wAdg== 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=FVaxpghToa5cTKlLnjzirHEfN54b3wPIDQHNtytUAGw=; b=ecLTiK+BeAxNBnn4Rq5GFo5GeRMRQ/zwBbMEdEunOog7DPOK4sfFWzn8KQpKnHbRRB cP98X41sln2d6eRnkoQGNgsulkoSfsQEyKo/z89Ew0sPZMOacHRUYHgbTMgOnrx+X0px m2ZV7hlvBBiFac/yKLCyFS9hATxmYQz3Ifk6hvSul/OYCoCI0JCMsNqsZ7UwFpBmnmkK Lm0ei8+1AIOd8ABpfh4trwExmy2bNiWaP7TdOiiTXkuUK8CHjlO52oh9Zx/AWtHdRzXf dpqSH811wST/jYa27X+PUp+T/xMIuQbravi+F0CdO8K3xSiOnc/StizFqqWa2EoGD/uR QiDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=JTChfssT; 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 jl16si4915728ejc.330.2021.03.12.11.47.33; Fri, 12 Mar 2021 11:47:57 -0800 (PST) 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=JTChfssT; 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 S234443AbhCLTqd (ORCPT + 99 others); Fri, 12 Mar 2021 14:46:33 -0500 Received: from mail2.protonmail.ch ([185.70.40.22]:15190 "EHLO mail2.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234437AbhCLTqM (ORCPT ); Fri, 12 Mar 2021 14:46:12 -0500 Date: Fri, 12 Mar 2021 19:46:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1615578370; bh=FVaxpghToa5cTKlLnjzirHEfN54b3wPIDQHNtytUAGw=; h=Date:To:From:Cc:Reply-To:Subject:From; b=JTChfssTXc1JLmDGSO7as9QzSItT2wcBqgE0ObJ1lZ/DU+W36ddX/dJKSrtHO8aIw iccb5BDBhIybn1zM6kU9M7yyi5brnLmOdnOb8DebjB3nEo161ujs2O21yWRhWVeduK ARq5lIFXPNTsN95eXP+4MfoLbQcSpqbfLcvUR0QvEOmO2C4x339NdZL2JqVYFW75Hf cspGXUdg2v0sXKlhbAlwFWOC9Waj23i3qvd1VdkAGWZv4hX5dHxrs7JdS1Rvoi5fqr yna2u0E3u/flMGEleQmSPEiASHj7a++27rdsNLX5KWICiZUrJXkrJbTtWA+AOwFBMf ecfolYA7f7kNQ== 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 net-next 0/6] skbuff: micro-optimize flow dissection Message-ID: <20210312194538.337504-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. 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