From patchwork Fri Nov 11 13:05:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 18730 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp728447wru; Fri, 11 Nov 2022 05:07:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf5B9Gn25yzH5mgn1ykv3kHnJuJVfnk2sgm72UCVzqCdDMsMneQQDfSkDF/FPbrcfslygN7d X-Received: by 2002:a17:906:458:b0:78d:98a7:2e7 with SMTP id e24-20020a170906045800b0078d98a702e7mr1615680eja.535.1668172036196; Fri, 11 Nov 2022 05:07:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668172036; cv=none; d=google.com; s=arc-20160816; b=jJoki0HvimaKeAH9JdhSjmq8rJhsuv0XvxaqGkt07MUEBmSU/9MVMNGYtKy45yg4R/ MdMYzC4U+GOF465RhePCAcsvzjgpmSwFW03nguk6JyBnIAMXByOGFvzS2R7a32zQfh0M 7BogL9vPCF6ERxfiod9fE1Ktzn16OGcLRVq7NqJ3bspbyxtD1SKAlm4qeFm0/lO7sRd3 v7MEBCqOp8rrpdnOyHjsbFJNl7D3s+ciBCR8vC6Ie4H3F4w1cPlk24zw6Eqv/CIjDeDo JOkWT3Y8az84HNK3pVwZAp7OyuzWdgC20SolsJMbmlBZG91VO9Y2yXDS84R6RcCxpWdH B43g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GI/5JObsmtz/1MC+vfmb4QM9rYKNMh3pQOw86HcV/Mw=; b=U9BtuG3FdmEYXl8Y6zMOPn9W7F37CJPpRhfqLZvG/ZU7g5YTQVqMaXd2RyUtp1hRX3 8u5+eQocaP0AQq1w/emckHPD9s5Tc89PssGySbWa4yy3zqv/+03JODpr/HZO2NiaIB84 t75RX6x4vWiWWAwM7iZDs+wHtHnVumAOnsxoZ0wwQuEq7IY0fPWH9PP1nSUUMpKkjYGd bxJVeJFxfnNpKJL5+Q9N+B650KH/Mc1FjnvtqsEhtEBgHiZ2VB1DhecOxmLvHa+FeYu4 x/zC0GXGSIuCi5z25vJ1o0xbUS9P5vGt+GqoVV4AmvUgVLtpr/LbDT4f4ngS9ZMNGO/A 5CJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=ZojA2esy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w21-20020a170906185500b007ae6076db43si1480335eje.312.2022.11.11.05.06.47; Fri, 11 Nov 2022 05:07:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=ZojA2esy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233805AbiKKNFp (ORCPT + 99 others); Fri, 11 Nov 2022 08:05:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233801AbiKKNFl (ORCPT ); Fri, 11 Nov 2022 08:05:41 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 455F16DCE3; Fri, 11 Nov 2022 05:05:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1668171938; x=1699707938; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AR+nmO2jQEhSBw5v3+UnruUyhkqnIBsLZ30bfGwKdWA=; b=ZojA2esy/GsQl/ZpPl6SiQSgbK7vqetcAxG2OJgF1fYHBaWxoV26MNAG sunciPA41HVrX/gKhvRPlhVwivRwD6gXzEBjfNiRopVESI/VbFVcfGwlF Kj8qkY+Zd74/GimNxWnIt82l4WH/qz5aPTNDW1QrPj70h1XXasnVm7Wbs 0+YqiGxR10rJ2t9YlwvaS+8BTFT04NDxLmnvMeeMeraI+tf3XAuaDPyOf SCp2EWC0+PgCsWlA3S/5CbrazLNGo7ivOvybTN12FSFuA40unHr400iSa kDo/x79DxI9aaaVoFqOaXR3cTKQHCnqnMHsp7oueHJIkzgQvmbBN4EwTe g==; X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="123000911" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Nov 2022 06:05:37 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 11 Nov 2022 06:05:33 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 11 Nov 2022 06:05:29 -0700 From: Steen Hegelund To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: Steen Hegelund , , Randy Dunlap , "Casper Andersson" , Russell King , Wan Jiabing , "Nathan Huckleberry" , , , , "Steen Hegelund" , Daniel Machon , Horatiu Vultur , Lars Povlsen , Simon Horman , Louis Peens , "Wojciech Drewek" , Baowen Zheng , Maksym Glubokiy , Pablo Neira Ayuso Subject: [PATCH net-next 1/6] net: flow_offload: add support for ARP frame matching Date: Fri, 11 Nov 2022 14:05:14 +0100 Message-ID: <20221111130519.1459549-2-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221111130519.1459549-1-steen.hegelund@microchip.com> References: <20221111130519.1459549-1-steen.hegelund@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749205161371925253?= X-GMAIL-MSGID: =?utf-8?q?1749205161371925253?= This adds a new flow_rule_match_arp function that allows drivers to be able to dissect ARP frames. Signed-off-by: Steen Hegelund --- include/net/flow_offload.h | 6 ++++++ net/core/flow_offload.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index 7a60bc6d72c9..0400a0ac8a29 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -32,6 +32,10 @@ struct flow_match_vlan { struct flow_dissector_key_vlan *key, *mask; }; +struct flow_match_arp { + struct flow_dissector_key_arp *key, *mask; +}; + struct flow_match_ipv4_addrs { struct flow_dissector_key_ipv4_addrs *key, *mask; }; @@ -98,6 +102,8 @@ void flow_rule_match_vlan(const struct flow_rule *rule, struct flow_match_vlan *out); void flow_rule_match_cvlan(const struct flow_rule *rule, struct flow_match_vlan *out); +void flow_rule_match_arp(const struct flow_rule *rule, + struct flow_match_arp *out); void flow_rule_match_ipv4_addrs(const struct flow_rule *rule, struct flow_match_ipv4_addrs *out); void flow_rule_match_ipv6_addrs(const struct flow_rule *rule, diff --git a/net/core/flow_offload.c b/net/core/flow_offload.c index abe423fd5736..acfc1f88ea79 100644 --- a/net/core/flow_offload.c +++ b/net/core/flow_offload.c @@ -97,6 +97,13 @@ void flow_rule_match_cvlan(const struct flow_rule *rule, } EXPORT_SYMBOL(flow_rule_match_cvlan); +void flow_rule_match_arp(const struct flow_rule *rule, + struct flow_match_arp *out) +{ + FLOW_DISSECTOR_MATCH(rule, FLOW_DISSECTOR_KEY_ARP, out); +} +EXPORT_SYMBOL(flow_rule_match_arp); + void flow_rule_match_ipv4_addrs(const struct flow_rule *rule, struct flow_match_ipv4_addrs *out) {