Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1339238lqe; Mon, 8 Apr 2024 06:24:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXYWpKeAnMD9gRHgVDc+mt7WMspE8MfPGt7HJlqirOtCKvjs52JvJBQxiU799DwTMEtCNf/8xG3qKHS2kRwTeB52DYk1F9sZcD/0LpWAQ== X-Google-Smtp-Source: AGHT+IGgpUCnmPwUgex1LWSCVrroahVb7deYG0OVC3x0EBOzIzpCjdSDHvUg8oHRwoT/JbsDT0p1 X-Received: by 2002:ac2:51a7:0:b0:515:cf42:117b with SMTP id f7-20020ac251a7000000b00515cf42117bmr7490438lfk.60.1712582663062; Mon, 08 Apr 2024 06:24:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712582663; cv=pass; d=google.com; s=arc-20160816; b=sbsIVHXAM5Ya6VSIGq2SBJrdTj8zMMiYAJMG+TeTsm3L8eaVTBCHalbzeAB0bISpw/ /y/y4wFAy/gKR2GRbwJ03zVACgGdEa5q5X2KRwGVnUM4FTdFlDIFBw+zMeDRYIe09wdg EK9Y7amzNauq09HwukU7hONbge+N9+cVM2iwR2Xtwm1v5g9ShqlrcYG8gc3kULvA9Nz+ 1FnsdpseTxv2Vz2N3aTX3PWSTuEVtzCxZHmaJ3/xn5/Mnul/fCu4CIIl62MDOIa3QDlD Sajyk/sSfFBxqg8XM0ygDNx0e1yBSIxXkN90mzVGGx/R2QryrqgOI40lFQajv+qAuOEG kACA== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5K7K4ZIAvkD1BOdYTnCXshntRVLsW1CIEkWrnpbaNPk=; fh=938viA9k1ccK6J5qK5wK1J5SmYAIRtzf5Iyc8Ouj03s=; b=wYTtzOtNbdewDoe2B4QMQKfVybf1onXxbfI3TLcG0VmiZb5y+vkLK6uLxvs9tOF7nY 5wUnxwDpGWLUPjGmv//h0iL1cMpzBkxK5Yz2ESw+00Be6vAC4yQOpEY2fQNtrH8gyKA/ +5Uq+dByeiNXAcTtAZhK9mgrrYV5YlmuiwtbMVho1sEPvGBKHuUIlCnH/3mWs9fhLwI6 XqId+8dYad81S2RHKZmgwAYzTYHhfNCwvTmCePpWYP8JO7a1HthmTTAK4lrw/M/cpmy8 gU2yFTIfWXik4AI+CYCrvR9cRhSlihZaBdvSie7Ic5BO+XJ7Or5o8s8HiiqophCbUr3R d7vg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b=ZGp1Wkw6; 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-135426-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135426-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ck7-20020a170906c44700b00a4720ded97dsi3588617ejb.185.2024.04.08.06.24.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 06:24:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135426-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b=ZGp1Wkw6; 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-135426-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135426-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 C52A11F2205D for ; Mon, 8 Apr 2024 13:24:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE97785924; Mon, 8 Apr 2024 13:20:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="ZGp1Wkw6" 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 1139A7B3E5; Mon, 8 Apr 2024 13:20:11 +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=1712582416; cv=none; b=rejIWid7BTrpRO9z2mGUck9wTmpdKpx/ihE5js8I/oUWdwGjwaOLJp9iRgHLNb4PcQS5tEdwekIzHRq1EOMQ9cFm+5W8jW/2RIKaJexuHiJy9iI7NPtf0lFnnyWl/StzXOydXz8y5266werlkStvCUGpfmnyj9o7iU5tO+Ndk/k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712582416; c=relaxed/simple; bh=ybDXUvRF9y6wAVfgDLw3PDAmgXBzneOlo90cnXJ4qG8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Yhb6YsR2rDwpc3VmM+3/74p2UVMlBnjkv6bC+aYKFbbMY9XHw4icfrEgNw+obgzWUIX/VqBvmsoWnZeG4MspOrViDISlQJpsSNwebx2UiAqqNOZmk1sP8rmS/8lwzz3Fjlp22CIbG7d6lI/8DOSlEZWLLj59GFG8fm2lfn5Nk/w= 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=ZGp1Wkw6; 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 9035E600B1; Mon, 8 Apr 2024 13:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1712581838; bh=ybDXUvRF9y6wAVfgDLw3PDAmgXBzneOlo90cnXJ4qG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZGp1Wkw6pyXtSdbijXOMykk4HWkte2yBaRa8+vodUcCLehD2tAFMJqgRFee3X17y5 wPG8mUMjQ2kmRhxUSXWmqrKn1fD6sVbweETvJC5htAb1RQIu3k65zKvM3k4pzmZvzE TmP3vSwfJCjLHM5Nvg84N6eVgU7y+pND2cUlhab5l6YmL5YchcnX8WLGBXNgz7e95w lFoG9+UCF3cNtqRvOZ6ktgPh/lXo2hIF4dWUoEe432IatfVdL2ZSBz+4QjW6lxHxvO fZL8Nw8Fr6SVb5Tb1PifeS0z7+By465MUAf3KWpY4crSUwR+udE6wEHE8e/YtNw2kx JOsoDa1bgsTRQ== Received: by x201s (Postfix, from userid 1000) id EE36320BDE2; Mon, 08 Apr 2024 13:09:41 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Louis Peens , Taras Chornyi , Woojung Huh , UNGLinuxDriver@microchip.com Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yanguo Li , oss-drivers@corigine.com, Andrew Lunn , Florian Fainelli , Vladimir Oltean , Edward Cree , Jamal Hadi Salim , Cong Wang , Jiri Pirko Subject: [PATCH net-next 5/6] flow_offload: add flow_rule_match_no_control_flags() Date: Mon, 8 Apr 2024 13:09:23 +0000 Message-ID: <20240408130927.78594-6-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240408130927.78594-1-ast@fiberby.net> References: <20240408130927.78594-1-ast@fiberby.net> 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 This helper can by used by drivers, that doesn't look into FLOW_DISSECTOR_KEY_CONTROL at all. This is aimed at drivers, which doesn't call flow_rule_match_control() directly, and therefore doesn't support any control flags. Only compile-tested. Signed-off-by: Asbjørn Sloth Tønnesen --- include/net/flow_offload.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index 415d225204a1f..b427b93d151a9 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -484,6 +484,26 @@ static inline bool flow_rule_no_control_flags(const u32 flags, return flow_rule_no_unsupp_control_flags(0, flags, extack); } +/** + * flow_rule_match_no_control_flags() - match and check for any control flags + * @rule: The flow_rule under evaluation. + * @extack: The netlink extended ACK for reporting errors. + * + * Returns true if no control flags are set, false otherwise. + */ +static inline bool flow_rule_match_no_control_flags(struct flow_rule *rule, + struct netlink_ext_ack *extack) +{ + struct flow_match_control match; + + if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CONTROL)) + return true; + + flow_rule_match_control(rule, &match); + + return flow_rule_no_control_flags(match.mask->flags, extack); +} + struct flow_stats { u64 pkts; u64 bytes; -- 2.43.0