From patchwork Sat Mar 13 11:37:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 12136733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF4C8C433E0 for ; Sat, 13 Mar 2021 11:38:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA84F64F15 for ; Sat, 13 Mar 2021 11:38:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230349AbhCMLhc (ORCPT ); Sat, 13 Mar 2021 06:37:32 -0500 Received: from mail-40134.protonmail.ch ([185.70.40.134]:51268 "EHLO mail-40134.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233507AbhCMLhL (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 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: kuba@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