From patchwork Fri Nov 4 12:33: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: 15499 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp376795wru; Fri, 4 Nov 2022 05:44:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LjXK7R86gXEEn6IExJM62pImRC34kqQ5EAG8iZC8BfUp1CXbq5P7wQeusndy7Iwh72+/3 X-Received: by 2002:a17:906:2bc7:b0:72f:dc70:a3c6 with SMTP id n7-20020a1709062bc700b0072fdc70a3c6mr35002344ejg.645.1667565883364; Fri, 04 Nov 2022 05:44:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667565883; cv=none; d=google.com; s=arc-20160816; b=SdhiRRWl6BeoSRfKk6qrIw7g/FClTS1LP/43OEKcMGVMJ0mWu4vWnJIMxTrI5AoH+i ZRNA263dJ+ul2b3vhkZ3f/xnQ84Q9Pnv10UhawsFXPWmgA/1GNDgDpH7lAA07z0cZ62i rHjT4EjHKKzJgcQ5hPi38aHsxeBM1pkXvg3eglYohW5D4f9hbF5PS06jY/zndZiHRp7r yzGL3C6UjIPxVCG+hNvBiMP0hX6/INzEnn7XjICaYlVrm/S7fTqGdo2KWwdS3ZtQ8I5u WUh/eDDy2mTeBLOR9ENQMOqb4a77hvbaRdM8IKEnbVCXd7YdDzM1u8WlIt38jIz3gij4 mU0w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=JcKeaXNACpRL9T4GoRcnWnHtoKvZArLeYXgvty/5GPw=; b=hy/H7OlKMffwJJhbDLXe+NIIPHBeuxDJoI3DZnOru6cdX2UUMiHzypOc5dBW2ugWkm YARTuk34k8VkMNhiBUPhIr7xCOiSLBUJ/Ix6qkDR93Na8SiwTUGT3+krb4e2AhXNF2/k 20vBRDmZD3yyj0OqaNexk+4dD2lUpGJnANBFg/CFhru4qlWE+dyBhnzYcsxAzQ9yKTZJ 2olALWusq6rHhLuRQfCkraWXqUses0901khjqryFgQRJ12GR6IT2p7QB3eADHEmpIaM8 CWXyWxNk6aSnoEbmJgRRhZiI3lTCjOJkB8U+PCINGQWennwPl83HJmLbp+uWmDkVEtJ5 iPUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=e55PERic; 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 ga19-20020a1709070c1300b0078d1e08f1e5si5057248ejc.919.2022.11.04.05.44.20; Fri, 04 Nov 2022 05:44:43 -0700 (PDT) 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=e55PERic; 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 S231496AbiKDMda (ORCPT + 99 others); Fri, 4 Nov 2022 08:33:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230132AbiKDMd1 (ORCPT ); Fri, 4 Nov 2022 08:33:27 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 768721583F; Fri, 4 Nov 2022 05:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1667565207; x=1699101207; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=B2aH17D9PQ7GFN8pFlZ5kWL8Bi2LgoVEvlSNCoRVYJQ=; b=e55PERic6ywE4LAH/N9NYhGNSGHmQTtlNb5+y5YrrjMksvmtsHq5zKHe SypWYosl3FqeTv2WCA6rn/LFdA+gF/HzArwVjB1v0fZy4V2Ns9o/OHzMr w9BcOASNAy+HsUAr/h/tUuJ3tXHzPRZ+fABvMRYJDuGYBp+Q80Cp1EdhU 7PzTbpcF7200Y4W4/d55PXm5Ky3Leeyr2suVX0SANh3LN8O5WV1Hq6kaV cQWULuNk5Vi9b3mx2vGoIhyBzuJVsNNmzWeZVSsIP/s6vREraovoLRjkS W405v7V2uRqKtmFvXE4i/R2iEfDhfpZNdwb3MVTHpoI3QoBRbqoUxBGOM A==; X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="181950097" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Nov 2022 05:33:26 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 4 Nov 2022 05:33:24 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 4 Nov 2022 05:33:21 -0700 From: Steen Hegelund To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: Steen Hegelund , Louis Peens , Baowen Zheng , "Simon Horman" , Tony Nguyen , Wojciech Drewek , Maksym Glubokiy , Pablo Neira Ayuso , , , , Horatiu Vultur Subject: [PATCH net-next] net: flow_offload: add support for ARP frame matching Date: Fri, 4 Nov 2022 13:33:14 +0100 Message-ID: <20221104123314.1349814-1-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-5.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?1748568890644430480?= X-GMAIL-MSGID: =?utf-8?q?1748569563568257257?= This adds a new flow_rule_match_arp function that allows drivers to be able to dissect APR frames. Signed-off-by: Steen Hegelund Reviewed-by: Wojciech Drewek --- 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) {