Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1971463pxf; Sat, 13 Mar 2021 03:42:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKqUquO3Nj3mrmpeHp/vCOozIV/rDMQcyyASh5aAESeVesuEVE5rYYjd0r88xPs8UKyGRv X-Received: by 2002:a05:6402:3486:: with SMTP id v6mr19419630edc.109.1615635773711; Sat, 13 Mar 2021 03:42:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615635773; cv=none; d=google.com; s=arc-20160816; b=FZhJ1SCkPMT5V9ngHtgs6f1pbzWqGsL58Ju6YGFGvo+Q10IZWRrqdiWyfXdqGvLJj3 //ROgqiwNkaykeZgjUvzrTEDml3tpcO8wyB0I1/koYvAc0bRck+l0u41Xo+5vs1w4J+5 M1benKAxgQPi29mi4hygqVMlAy75rxRkLZApq+9Wr4RCJNgPNyVXFFyBP0d2RZ2BOPeM v/xezq92N8UdMaTC4PigxZ0ongbclOFfNK+dsToT4MMNmuXvI+iI4wz+2NSQmnbHyvEl ZWADSPkRhRWI+Vhmf3/HCcJVJxWZKl620hOGAaT1cqVXENo45uFGoO6pbfOjNdL0HlWW Qfhg== 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=aO0Fo1XBjYTxfkc7UFdM4I8RL3S4bf1o7JgajErXmgE=; b=a9ROj90JA6c38YQCikGFOjpiUF5SRKW5Nk0BwOMHpRJ4Hc7ioIoDg0I0Xs1Er9pmzH PaYIvHnrc3J7nwMvG4Mmx2kRJGUi4efgUNSO28n1dsZL8gLqGIpge7fYnTilN5fAn3UV xeEFSSdQ52s5lqkUWvDo+FqLsN+xJnGFqQ2K+xIJgEHX5Bv34MhrHlzXKdNzauskOCvv fhdQWnAdIZjfhkT67VaUPsg3UbWWpvWtXA8u24L3NIGGhKfCCsjJubV03VGuccAlZ83W x2EUmMDAHHvSGijYy0eO4UZYSWIXxCRj8QOeXtR4ZLVMnD8Wg9KN9rQQh33ss+4kbLdI A2Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=FC58vUCm; 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 lg14si6256327ejb.6.2021.03.13.03.42.30; Sat, 13 Mar 2021 03:42:53 -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=FC58vUCm; 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 S233629AbhCMLhd (ORCPT + 99 others); Sat, 13 Mar 2021 06:37:33 -0500 Received: from mail-40133.protonmail.ch ([185.70.40.133]:42105 "EHLO mail-40133.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233343AbhCMLhL (ORCPT ); Sat, 13 Mar 2021 06:37:11 -0500 Date: Sat, 13 Mar 2021 11:37:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1615635429; bh=aO0Fo1XBjYTxfkc7UFdM4I8RL3S4bf1o7JgajErXmgE=; h=Date:To:From:Cc:Reply-To:Subject:From; b=FC58vUCmuoG6cneXrGTB2aMDGbOFZN+GOeJJ8mU4luK0s7tv/yiy6u1Jtyr8+pHPU 7kJAkfugMx0CHM6bups8+bUSr3z2DmgUx1zR58N1by4C5w8iDwdNb4RJ3QcE2na6h3 ckstcL8p/nhVq9q0DIR9DZUYjVWk2FEJUZIkcHvR3wheX263Z5bKBFrn2fhSwkLRIl p/pCS5ZoCRO4vTMahZVVtHgS2lJ72pBndswRnSUHeBFGgZfV59KrXqxIOeW5e6LTCq Wvy3QyEYYuF8leZqUe6EsoZxkq6ycVk5WrIeu6cWM0/ZllT+BNz/89u/K5mvJL3zna +MQkq3Zm3eRjw== 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 v2 net-next 0/6] skbuff: micro-optimize flow dissection Message-ID: <20210313113645.5949-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. Since 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 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