Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp451699lqs; Tue, 5 Mar 2024 06:55:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUxGGECn6IIkYYJblUtj0FmoHFkKmpJsUJ/g9l4+mWNCcwQ0Fhp6KpLP03rBCkzXjjvNOGJLqzRusFcVfIsABAKsEIBU9TeEDjrwc4aqg== X-Google-Smtp-Source: AGHT+IExcgvtxzNC1W0tJU6O24aGZjkCyKjuD3K1h4GWksDIdKV7LMuatNlSdIGTPEekVwbUaMFb X-Received: by 2002:a17:906:3559:b0:a44:df65:b7e5 with SMTP id s25-20020a170906355900b00a44df65b7e5mr6514927eja.49.1709650550409; Tue, 05 Mar 2024 06:55:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709650550; cv=pass; d=google.com; s=arc-20160816; b=sCW0D7sSzWqUgwcKE+w8vPYieh0fSZfAQkBuC2pZ1YB958kMEenY7663iCpBrPsawZ SgdZI++6ALTJWM5VaZJZyb/i/BI/ucvKFuwKpwTIJ2d77NzBP5lhEbbRU15sDIKZkZnz VQo75ATrpDPW/buspWZAj+Q+FGfwPRZ/AAjeXzOpWLsJvspuY0W5ynZXf/aYdwstB6ua UlLfdvF3Mtr5H4+V6oUhm89IBVjDvwa/cfLLOOSjm/RQr2J9HxqHliscKvtkxsrZdNgE 6iQkj6rCAn3jxFDPuIEolOKmuEOV8ZX/BxRyW46WvB4tLCpEcdpzQJljuIlF2VmKRsY2 Vwgg== 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=kgu2TQkF+qMxvwL5GHKnrd2DQ6deO3vfQ7l3KKTtOq4=; fh=H/GM0QF78Qx6X9IR7gHM7NBaq2mJ7ByoMQ4LB8ra6lM=; b=nTPGPPWqUI/T99ESnt4EUvJcm8tUYu7n6DP4dyCQHSQRva88qQGd/UGS/lDvltR12r ardo/B+v9ABZ8MN3UCn3VZt7SEKjja+kzGI0PXUVX9Mb+UeCr+kFVNLU+MpQW0jiTxzA ETVXqrMO46RSdgRIYImAcG+a/6U1o4U8B0+Muk6HLuhTEdwwOCrZoWXlTaqCysMNI368 onM/aqTsl1chMV2itnxa7Qgv7NCQvoti8GTYlGaW59r5GnJYB0vntraYoJW7TIQ7X4z1 9RU4Dmh3Cx6VAnD/+RGfBAM8A3m41AnCn64o1LtAIut3CJMDUz6DvgwTV1vO9pUJchJJ QsBA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b=PEnFEDr+; 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-92553-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92553-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fiberby.net Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qk27-20020a170906d9db00b00a3e4e20ecdcsi4953532ejb.13.2024.03.05.06.55.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 06:55:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92553-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b=PEnFEDr+; 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-92553-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92553-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1A5CB1F23EEC for ; Tue, 5 Mar 2024 14:55:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6719C1272D8; Tue, 5 Mar 2024 14:55:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="PEnFEDr+" 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 49146126F09; Tue, 5 Mar 2024 14:55:05 +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=1709650509; cv=none; b=AMvgHTxTv7ds2j9SCmg20SwAk+WBTueAqeYvWIFSnYREiBfjaJnX3/9if5z7gdSOP1Gz5unWDlEDGUEBIQNFrMVVNNmLLHyQfQ8o7/+Um65UvhEJXybuvizeYXfrThrgfCF5T076ONYrW+QoSKVhwBpaloaeWtl1YsMhQgebZAs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709650509; c=relaxed/simple; bh=Q5UUfJDjrGrdHCHpViOdOzibqAZfW1sh2Z+5l0zVKm8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=oDXWt+PGtzCHEXHSHRpnUM9u6uobDc1jVfF9GjfEdR3XorDtBSa5kKzUTzqPfH9R2OvbTCoGLVdfLmcQ+NdPB12O4PlI9HuqNbGAI36oRy6mwSY3vmSXbP8YjZNKcFEZnIBRi3Xej3e0TDXWh1+6iH4nTl971XgfzukHLLUh9rY= 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=PEnFEDr+; 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 BE13A60315; Tue, 5 Mar 2024 14:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1709650004; bh=Q5UUfJDjrGrdHCHpViOdOzibqAZfW1sh2Z+5l0zVKm8=; h=From:To:Cc:Subject:Date:From; b=PEnFEDr+lf25mwBZVHqHaRkjyBM6A2Fu/rAeege2bTJJyKLJpFDd/HJ+BBkf32WmH LpTssFyw3bXVFTkSBA/iQ/Ndyy1UF6gZ+t9YBeuzJi8K3n0fAp7D4OJz8iEs5zFsZx OiC0+kZjb/fMpsi7iwrh6Jq/ScI7W884cFjB5JBnkFnV7Saxub01L2QsIeuFLwAZeL 5ulIVlhvfK7f7HSY5tuPMXxFyORa8452Hi5mCrGqtuJY9QmWNE65dzaMWrkisDgh7Z q2HQV4pdP60Nvrn6gCoDDUJtP86wf/TWHpp+1AikW3cVfgwDXfkTF7NuWT9pu5Wzyv OH+pa719hcrpA== Received: by x201s (Postfix, from userid 1000) id 3E3F9200A5A; Tue, 5 Mar 2024 14:44:28 +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 v2 0/3] make skip_sw actually skip software Date: Tue, 5 Mar 2024 14:43:53 +0000 Message-ID: <20240305144404.569632-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 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 | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+) -- 2.43.0