Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp19771lqi; Wed, 6 Mar 2024 08:59:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWGXkvEihvAHVYr7EsBqlsASueLmq3QZTDUQp3wzIsLtSdEszGAdB4oL3tGFzqNDjXi5WqZ17s1zAvbQjicWwVdJY+x5mzMCzp+/0d6Tw== X-Google-Smtp-Source: AGHT+IG9pTmg/9Z5sFuVIaR/bsuukVTQJGIPIEZ2sCUTAG550weIdlHPGuswVIdn0RttDI5Bo9Wk X-Received: by 2002:a0d:d68c:0:b0:608:de16:e57d with SMTP id y134-20020a0dd68c000000b00608de16e57dmr12660039ywd.47.1709744375825; Wed, 06 Mar 2024 08:59:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709744375; cv=pass; d=google.com; s=arc-20160816; b=GxjyGOhaR0hdmMPkk7s6/1CF4bX99x5tjZJZGGwEVPw+XUCG0Lqqx9B4fmtOand5KD fyU2QglQwnbb/Da8IyYW1bCST5CjuiIXRR6cR4ISp4n9FxulAGKag1jdUj/s2LzESXGB xO3V6E6YraG9HY8RWpNe3fweK8UQC38SMfhvZtXel2tWEakKKbJoveRYmU1hZYpCh9Nf T2iSR+0zmeHFELefd4AGTqwMPQkxSZONdhZFgCFxLXWkP3tJIzZEFOiGwEBC7iLNVN1i pn8vtby5q9ym4x8Cwjt9DjaJE1Ik26VHe7OhLrz7uNTFVBr2bbWt5o7lHz6+yzA0Kcys ezpQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=us+93WWpiHlXeR1L18x7xOAurV5qk2ygFdt/UEbT1tE=; fh=H/GM0QF78Qx6X9IR7gHM7NBaq2mJ7ByoMQ4LB8ra6lM=; b=sa4+FYkrQkfTQdvN7d8VDdGnZA+loAbdFgo69Swa9cuW8nVCzOHe5qvgBcb9UpYBrC FpZTdubCHsmogzK3mA76YiBAPwdpSmEsDSBGh4QL9yVLQg0Y9SsAFJ6Bk30MCQ7wotTs OXvu/6/2I2TRPDk1zmCW1mQmzFzNC+WkoDWUqgcTsr5x+V9WgvdQyM8qaANyXpnl3NFU oxJQr8AgMPVzXp7/8S8HatjfR7g5E+ZzmryjAhP0MPQ18PL7/MlIBMw1GGhexpzaMIkF aW1M/NuXmHti5Tw7W9OUeJP9zVJsfPtVe1zsq0K9tAc3PWk/8igpHtkiL2meh/TUCHRd /C2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b=aUXi9APT; arc=pass (i=1 spf=pass spfdomain=fiberby.net dkim=pass dkdomain=fiberby.net dmarc=pass fromdomain=fiberby.net); spf=pass (google.com: domain of linux-kernel+bounces-94302-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94302-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fiberby.net Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f1-20020a05622a1a0100b0042eee0fd6basi7967980qtb.147.2024.03.06.08.59.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 08:59:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94302-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b=aUXi9APT; arc=pass (i=1 spf=pass spfdomain=fiberby.net dkim=pass dkdomain=fiberby.net dmarc=pass fromdomain=fiberby.net); spf=pass (google.com: domain of linux-kernel+bounces-94302-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94302-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fiberby.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8AFE51C20BBD for ; Wed, 6 Mar 2024 16:59:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2434F13C9C9; Wed, 6 Mar 2024 16:59:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="aUXi9APT" Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61926137921; Wed, 6 Mar 2024 16:58:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709744340; cv=none; b=nChNfiuUIBMfyi1qHHsp8VOxlKH9km7UDCbXReBAl112BNNOS2NM270yWrjYqHYN3uFHwrV89+EG1S0TttI6ofJELRoN6T3VG28zCiafplB63RFxpKK1OThyEhFIqCllX4ajamFyUM+7UPyl8O47Gs+CSijAvY1ZQwz/QlVxqzI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709744340; c=relaxed/simple; bh=7KcwAx8GomKY81dwdLlPImImGc1QY46ZYt5n12Z+btk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=anpmbO2fPD8Smsg0TQ6DQljOy5o/pXboynLzB5WV6XM2l7g5lpnm8Y14W2yuzcDQR3zVzB5IROVGeakEfVs4toRHxCzQ3YvgyIT1E3gKafukUQoFLIJ9d8eLRJ3jiT3TQUNM/chxrKx5OxQ/yDyoh94GGApQGRFji03uKLn2SKE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=aUXi9APT; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 041CC60311; Wed, 6 Mar 2024 16:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1709744335; bh=7KcwAx8GomKY81dwdLlPImImGc1QY46ZYt5n12Z+btk=; h=From:To:Cc:Subject:Date:From; b=aUXi9APTa+3aMxCc+bghaMIHksFhAiOf+0Q44BI032sdjEFsMhOAyzOH1z4mw3NYq S5AysNk3v+sJoNEH10usqETy2TYf2WRzOGfeKhKAHOIfcavZLnYdPOu22lepbIGkKg Hqxgxiq421HAiVP8SFS3mp7MZdxJxIMTdIZcsBxAUI2afGLSv2/P0Bn8ZtH6v/Q1bV Wzk18copaP/LGRTPESOt2sJ93H7vZebw3PZIR6St2IdPIOV0HRx3iD1MOVtDZ0OH5T YuIuo1DkYwjQ/e2n2ugHXqp4e5O/L/Q/TQwOx387Yel+it+goJTwNgLPVZXUpYCjCk JpCB60+05UDyA== Received: by x201s (Postfix, from userid 1000) id 7953E201D3B; Wed, 6 Mar 2024 16:58:22 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , Daniel Borkmann , Vlad Buslov , Marcelo Ricardo Leitner , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llu@fiberby.dk Subject: [PATCH net-next v3 0/3] make skip_sw actually skip software Date: Wed, 6 Mar 2024 16:58:08 +0000 Message-ID: <20240306165813.656931-1-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi, During development of flower-route[1], which I recently presented at FOSDEM[2], I noticed that CPU usage, would increase the more rules I installed into the hardware for IP forwarding offloading. Since we use TC flower offload for the hottest prefixes, and leave the long tail to the normal (non-TC) Linux network stack for slow-path IP forwarding. We therefore need both the hardware and software datapath to perform well. I found that skip_sw rules, are quite expensive in the kernel datapath, since they must be evaluated and matched upon, before the kernel checks the skip_sw flag. This patchset optimizes the case where all rules are skip_sw, by implementing a TC bypass for these cases, where TC is only used as a control plane for the hardware path. CHanges from v2: - Patch 3: - Fix source_inline - Fix build failure, when CONFIG_NET_CLS without CONFIG_NET_CLS_ACT. Changes from v1: - Patch 1: - Add Reviewed-By from Jiri Pirko - Patch 2: - Move code, to avoid forward declaration (Jiri). - Patch 3 - Refactor to use a static key. - Add performance data for trapping, or sending a packet to a non-existent chain (as suggested by Marcelo). [1] flower-route https://github.com/fiberby-dk/flower-route [2] FOSDEM talk https://fosdem.org/2024/schedule/event/fosdem-2024-3337-flying-higher-hardware-offloading-with-bird/ Asbjørn Sloth Tønnesen (3): net: sched: cls_api: add skip_sw counter net: sched: cls_api: add filter counter net: sched: make skip_sw actually skip software include/net/pkt_cls.h | 9 +++++++++ include/net/sch_generic.h | 4 ++++ net/core/dev.c | 10 ++++++++++ net/sched/cls_api.c | 41 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+) -- 2.43.0