From patchwork Thu Feb 15 16:04:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 20446 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp506451dyb; Thu, 15 Feb 2024 08:13:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUCgJt5Hnkli9P7IOITnKiBDTqV7Rrv5tA4tB4tlqNQYwkH7T8stoQuk3Bcva0QdV/KhB6n58sWbKDfuuSdeHuiJj3Cbg== X-Google-Smtp-Source: AGHT+IE4QKNMnBZrDOwJIt1GWZAZTkEYWrMA733oEHj83jPEnJfvBVTExk7TcuR9dXu+nRVvvJ0/ X-Received: by 2002:a05:620a:199b:b0:785:ce6e:28a2 with SMTP id bm27-20020a05620a199b00b00785ce6e28a2mr3231371qkb.15.1708013610443; Thu, 15 Feb 2024 08:13:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708013610; cv=pass; d=google.com; s=arc-20160816; b=owyVzH9hD7wVevnw4dYf+zTK/9vvrGsieDOCr+35Ix19qIBBul9Ze237I+QNzGdvD+ NLebsDP4OyuzVDnwpa0sYC8w9zA1eOEQ3LgFtmq8vZcrmyE8gz/o9ioneNLxnuU1O9bw ou94H1WZAgxgeWELUpeV6YynR649fa0R5BsBinJPvnHDEPeDWHmGFaieRbDGeelYjbta xDTEYvYaSRa9PeFOPG7PFg+n6C8UrpccV4l/wtjBcU1KE+nEZmacwfXHY4o7TwVuNiD+ YapcIiXuSqYv+p1evuEbee79lL3boGQOLI/xoV2GJ/nE0zyvdsGmpaXXwYQoTS1FQ12D 9MOA== 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=g1IcuG5+8qZbvhtww1BgoWrYIb+WOtKcrZG1hZhNyqQ=; fh=qwn0ZN7d/LlgLhwKKJFblL2+CYxSTOyA+LLcZtnY3QM=; b=khvSmYgiMgAQeyUghSoJVIGQL+SrYSGnkLpI8Lyb6FN2FQlN0Q7upGfOCGke2VTB7t Mp0DyTwPVglxAvVKngVts6sP1Hj/SPxSPk0z07nLVHpJEsFpLY/MyNrqZY0GfeVfnMiA +Pf6/YOcXlI8ZsXZRayusia1a8mQ+7DuafJcJJmKJaQSh6/YZilOHFWpOUiR2SJQQjO7 ZTrSyqv27zIvLpxFCZRSftvt7qx9T+uSXaTdXQtYeo+ouej/TNcGZJjvlDbz7bvum/6Z vz4QjNzCJnCnXylIlGp5mOCBlZey6d55AUIwKAihmZPDke5A4sekv/so5hv40Uk0YA7U EBkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b=AHg9AR2O; 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-67282-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67282-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fiberby.net Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s8-20020a05620a29c800b00783ff745819si1967859qkp.531.2024.02.15.08.13.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 08:13:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67282-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b=AHg9AR2O; 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-67282-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67282-ouuuleilei=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 3D5E41C238F1 for ; Thu, 15 Feb 2024 16:13:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14D91135A46; Thu, 15 Feb 2024 16:06:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="AHg9AR2O" 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 48CE713343F; Thu, 15 Feb 2024 16:06:39 +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=1708013203; cv=none; b=TmkRnGdCO37fJ9h7Qy7dXtx/P1x3+tN4PugsQHpmqwIDoDutDeeNhtqIxaIxV0Qzse87nAZPuGMih9u02rN6q+JNt36wED+aOCgzxiyVca8kbQtDiJR3bz5SkZ2YTlrdvkv8WI6qlG0wx0O09vjLIDzL3ZXTgZJv4glZN5Ylvas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708013203; c=relaxed/simple; bh=a/rV8SSxM9OUnBiZhdQjgb607ZE0A5Lcd/T5aUn9od0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=uM8N8IgKPihOAOPm8HAN53Dl6tt08Xy7USwtIIN4lZMIeKnV0HcxkNj42Mp/SIaa/0vXmQedBVcK9pMXtadExbLMjD3PMO3BM9sR7ZNIuQjRM5X+Bis1gMc8MV+tgV+wez4RpEB0oXEOLsk8tSCfL5+ifCX/Pg3Ky0WTkRWzTVI= 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=AHg9AR2O; 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 125FB6030A; Thu, 15 Feb 2024 16:06:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1708013196; bh=a/rV8SSxM9OUnBiZhdQjgb607ZE0A5Lcd/T5aUn9od0=; h=From:To:Cc:Subject:Date:From; b=AHg9AR2O05BEXVIq48uAoumuULMkas0wiJJSGSU+hDvjyrtlrZbby1Wgq0LHKktpW 5ZWAc3yerXcj88vSkPCpysgp//RIpg4BfEskDDkOADxto5ZoBr/WFwmyWNzE1k4QVE e1e2DSEr1yHiqjoxJT/bbMR7sz3GHj6XIcAdfbQB2oBP4IZeB/yHZPIY6trFVipqce /iQmoM3NS3KqkS+VeblIOwhxtIKgepO9zjNNc+nMjCuBK+IcfQu7p2l4FfhRXuKy4f QZtgDZWzfFDuM0NJbaogBBH36mVmLKfNgaAxnYAPj1mhiA+TLMDJ7WZTUsqoG/bG7f J8eSMAIZ+H+7A== Received: by x201s (Postfix, from userid 1000) id ADA5D2004F9; Thu, 15 Feb 2024 16:05:24 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , Daniel Borkmann , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llu@fiberby.dk Subject: [PATCH net-next 0/3] make skip_sw actually skip software Date: Thu, 15 Feb 2024 16:04:41 +0000 Message-ID: <20240215160458.1727237-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790982079521521187 X-GMAIL-MSGID: 1790982079521521187 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 Linux / the CPU. 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, sice 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. [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 | 5 +++++ include/net/sch_generic.h | 3 +++ net/core/dev.c | 3 +++ net/sched/cls_api.c | 24 ++++++++++++++++++++++++ 4 files changed, 35 insertions(+)