From patchwork Thu May 5 05:43:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12839063 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA641C433F5 for ; Thu, 5 May 2022 05:44:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243672AbiEEFrt (ORCPT ); Thu, 5 May 2022 01:47:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241070AbiEEFrs (ORCPT ); Thu, 5 May 2022 01:47:48 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2097.outbound.protection.outlook.com [40.107.236.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 885BE34B97 for ; Wed, 4 May 2022 22:44:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rs1gzJ+dAmbU3MDS07/jtt37hR+qe0ylxRSRARuT2wV21guxtSPkKYyQr01G9qQShH8Hbtf9KHPmSBAx11jBFKIa1k6JZ76rSfMLmZxReveEBjWeURyxbIYI6go7O+Qvi8rHRX1AFJKq4hRrjPtGjFuCKcS4/jPZ7Sgtb0FU8jnn6l+cwszW5i2Yziry/oVL5jyMWImDepIK54SAHpi+NYq1Rcy5wjV9Kueq2Yw2eSc1J1ChzX6Wd94J5jTpZEuEaiOgKdTJBhjlMwSkWs4tqMH5lB6XIeyUTQvTo+EAvF9oEJ2bHj7BlKzNc0Q2Qh3SeaQxpiWPD4ZY7Eg1FC9Mig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wWOm1NhYcUW3/S0DF2zhRwWgres9rcDs5+vSuGi2RmU=; b=QOYU1gQnUtUX1BYtQ31GkLNsYwouruDhZSH9cR1zlkyzZ1VyYpksbdl0+HsZKdZQ1vkXahXWfuUGV7mTEWnizvrWqSbSlwAe9ebd33APzo+9cpmy7IfbA88C3mSXk6w0Fw5dIXqWafp7478rUy9tWvpva4i4FqGpRJToCojqI0iH4A9QwAIHrumJ7uoP9OzxdKO6OXUvnH9xqXSSw7e9aG8mTEYTvKxuMRzpAeFxlmVDOqDSD+uvTonOqHXUjWCJ90OvHiuLTqzLkTV/0wXQq65CUWRyZSZBCJhBF2q5lzSmcr5Xg+jxnbWX67bpGq/VJj/KCjIwK9/ZT4HWOadEVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wWOm1NhYcUW3/S0DF2zhRwWgres9rcDs5+vSuGi2RmU=; b=hZ+50ErZNlZFJJyquljtosMNQ0OagA3HWRINXp3OZQIdnEIAaDC7yLDU+JdojuCtmCoEEzhM768eMAIJHuGFgid+70+94AbrLjti72YDufGyBvIJCd5RSK2uHI49l2LiTrDfEHxGbtS8ykNXxHPghbQUgC1fPPii7P1YKA6KObQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by DM5PR13MB1257.namprd13.prod.outlook.com (2603:10b6:3:27::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.16; Thu, 5 May 2022 05:44:06 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94%3]) with mapi id 15.20.5227.006; Thu, 5 May 2022 05:44:05 +0000 From: Simon Horman To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, oss-drivers@corigine.com Subject: [PATCH net-next 1/9] nfp: flower: add infrastructure for pre_tun rework Date: Thu, 5 May 2022 14:43:40 +0900 Message-Id: <20220505054348.269511-2-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220505054348.269511-1-simon.horman@corigine.com> References: <20220505054348.269511-1-simon.horman@corigine.com> X-ClientProxiedBy: TYAPR01CA0082.jpnprd01.prod.outlook.com (2603:1096:404:2c::22) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 164d5302-2a7e-47d6-00eb-08da2e5a444f X-MS-TrafficTypeDiagnostic: DM5PR13MB1257:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wP5Ebyh3gF8nUXBoyxLy7XPIj/ay/DW2yrfUQQorfSTuy+YdV4C9KMfEZS62+hW5WpsWFYCBp4Y37MX+kUibvDBSAFdScCnYUO3LDvv5DdaFdoVGi8GZeyqrZl4H7geWupEfuQz79jwx/hK+gVQYtbuxFzZZBsRORjs5hWk4JPT+NMguQbc2gRaOsKxZfW0QP48m0jEkpPZbC5YQKmV6M2iTVuU4dm3uZFKZmyM0xgjZg5RkazOvksZigPm7xC9M81Kgdy34vqEW712givPjndHtRGhMmnt+ac/vDjZWYB/mOtRw+XmtztD3ylj6DgLE/YIHM7z4NRA+v0qp5DlIH21qKELXyWInJ/ClmHnUa57yw69rv2Z/MZj+sJLDrZUopjzpdx4m9Ld5G3BQ1vVIn4sEJvDH6qjcS9GqVgfQIZvtIFonwzUpPFXmqa58mIDGNxdXCSca+NqRT04Nt+emxsAtTZD1fcGbMQyNotqth1wug2C7on/LjOJ/+UftuJRIuUTkjtAUkkhqkjCzqm+X87RVJq0eOuBIDo5yvlLCfPql7CyZujraYoALi41iOYFusWoFFN77uFw7JNwPJc9RconmpP1Qs2hvItfRnh10UTIg1LZv0VbfWw8muxXT51jHz2uXiGGR/i6BswQ6hgfupniyD7+ROnWt4JTy84Vw6I0yV3oWGK91tWjipNQbiP9BI2NqWdSulOimSSf3DwiZag== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(346002)(376002)(136003)(396003)(39830400003)(66556008)(66946007)(6506007)(8676002)(4326008)(5660300002)(52116002)(1076003)(186003)(6486002)(36756003)(2616005)(316002)(110136005)(83380400001)(107886003)(66476007)(6512007)(8936002)(38100700002)(38350700002)(86362001)(508600001)(26005)(6666004)(44832011)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H83qCj5jg1j7u6afXPy3/ZBszqlZQilDF+cE7/sI99KwdPlzk6huivdAs1XYvhFo+r0sQjgGlFDCW/7VL3px7G/iJJ5l37sT3pBal1ymptWUfI4Sk6NAYOa/tqtFOJMz6Uj0lT4mn+2JTQ7xm9KxcAPrkvpZZetz1UxnoOns3lv4pv6mMtoUJFYHwlnllN0w6Sd2LOc0GfjuNtbbPyJFC5YNvAywMNtpW+b/GIm21LRPRk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AZyM2e+YJzUjaHqNkKL/rJIE+aYkpTEuDkoZsFRBZnXUuawgYXH+vLS1EnKhRfth95OIWKoFgqpc56Kb9gxuf4iRXSbzJOCPqsJOM3W9CLomBaampRKqltBWiUqz7Pu7hHDMHyjErsmN50Z2y9CqZ21iuojEvDRFABHTBilT291bZv8w2TKOCoh5wVsMsf0qK84rA33wXBfi3p+GDjIQezrCUfjfH01pCsmYuwl1oRROr1a20M0xVy/c/z5mYGT5Gxx6YIr5HAfALK5QDuwqMzRIOuwBx29keckzWx5DWINEPzrzs6lgYH0rBmxLYlA44yi7Ub/OoPEaR7lQ11jXTyAkthGeXp60zPLZd62QLeCG13BzkIYCM7ACmSy+LvZ8BzzxWcTR4vMUbUoSzifcjEzigL+1hZuZes7BGO2O2raQAgeiM9TG4q15OjZMt8X+OcLH1+ufnv8J27GX1gs= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 164d5302-2a7e-47d6-00eb-08da2e5a444f X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2022 05:44:05.5871 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NFNfJYANMbFEc7L0uRvmYxTc7sZOdUEm+UoAEp6RqucvFTDu2z/TKUkSRaUtUzXC8CsCF4DqTO6YMjCgzyFsGBAFBURm9hDfkuiYRL87m9w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR13MB1257 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Louis Peens The previous implementation of using a pre_tun_table for decap has some limitations, causing flows to end up unoffloaded when in fact we are able to offload them. This is because the pre_tun_table does not have enough matching resolution. The next step is to instead make use of the neighbour table which already exists for the encap direction. This patch prepares for this by: - Moving nfp_tun_neigh/_v6 to main.h. - Creating two new "wrapping" structures, one to keep track of neighbour entries (previously they were send-and-forget), and another to keep track of pre_tun flows. - Create a new list in nfp_flower_priv to keep track of pre_tunnel flows - Create a new table in nfp_flower_priv to keep track of next neighbour entries - Initialising and destroying these new list/tables - Extending nfp_fl_payload->pre_tun_rule to save more information for future use. Signed-off-by: Louis Peens Signed-off-by: Yinjun Zhang Signed-off-by: Simon Horman --- .../net/ethernet/netronome/nfp/flower/main.h | 87 +++++++++++++++++++ .../ethernet/netronome/nfp/flower/metadata.c | 19 +++- .../netronome/nfp/flower/tunnel_conf.c | 32 ------- 3 files changed, 105 insertions(+), 33 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h index fa902ce2dd82..454fdb6ea4a5 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/main.h +++ b/drivers/net/ethernet/netronome/nfp/flower/main.h @@ -51,6 +51,7 @@ struct nfp_app; #define NFP_FL_FEATS_VLAN_QINQ BIT(8) #define NFP_FL_FEATS_QOS_PPS BIT(9) #define NFP_FL_FEATS_QOS_METER BIT(10) +#define NFP_FL_FEATS_DECAP_V2 BIT(11) #define NFP_FL_FEATS_HOST_ACK BIT(31) #define NFP_FL_ENABLE_FLOW_MERGE BIT(0) @@ -109,6 +110,80 @@ struct nfp_fl_tunnel_offloads { struct notifier_block neigh_nb; }; +/** + * struct nfp_tun_neigh - neighbour/route entry on the NFP + * @dst_ipv4: Destination IPv4 address + * @src_ipv4: Source IPv4 address + * @dst_addr: Destination MAC address + * @src_addr: Source MAC address + * @port_id: NFP port to output packet on - associated with source IPv4 + * @vlan_tpid: VLAN_TPID match field + * @vlan_tci: VLAN_TCI match field + * @host_ctx: Host context ID to be saved here + */ +struct nfp_tun_neigh { + __be32 dst_ipv4; + __be32 src_ipv4; + u8 dst_addr[ETH_ALEN]; + u8 src_addr[ETH_ALEN]; + __be32 port_id; + __be16 vlan_tpid; + __be16 vlan_tci; + __be32 host_ctx; +}; + +/** + * struct nfp_tun_neigh_v6 - neighbour/route entry on the NFP + * @dst_ipv6: Destination IPv6 address + * @src_ipv6: Source IPv6 address + * @dst_addr: Destination MAC address + * @src_addr: Source MAC address + * @port_id: NFP port to output packet on - associated with source IPv6 + * @vlan_tpid: VLAN_TPID match field + * @vlan_tci: VLAN_TCI match field + * @host_ctx: Host context ID to be saved here + */ +struct nfp_tun_neigh_v6 { + struct in6_addr dst_ipv6; + struct in6_addr src_ipv6; + u8 dst_addr[ETH_ALEN]; + u8 src_addr[ETH_ALEN]; + __be32 port_id; + __be16 vlan_tpid; + __be16 vlan_tci; + __be32 host_ctx; +}; + +/** + * struct nfp_neigh_entry + * @neigh_cookie: Cookie for hashtable lookup + * @ht_node: rhash_head entry for hashtable + * @list_head: Needed as member of linked_nn_entries list + * @payload: The neighbour info payload + * @flow: Linked flow rule + * @is_ipv6: Flag to indicate if payload is ipv6 or ipv4 + */ +struct nfp_neigh_entry { + unsigned long neigh_cookie; + struct rhash_head ht_node; + struct list_head list_head; + char *payload; + struct nfp_predt_entry *flow; + bool is_ipv6; +}; + +/** + * struct nfp_predt_entry + * @list_head: List head to attach to predt_list + * @flow_pay: Direct link to flow_payload + * @nn_list: List of linked nfp_neigh_entries + */ +struct nfp_predt_entry { + struct list_head list_head; + struct nfp_fl_payload *flow_pay; + struct list_head nn_list; +}; + /** * struct nfp_mtu_conf - manage MTU setting * @portnum: NFP port number of repr with requested MTU change @@ -202,6 +277,9 @@ struct nfp_fl_internal_ports { * @ct_zone_table: Hash table used to store the different zones * @ct_zone_wc: Special zone entry for wildcarded zone matches * @ct_map_table: Hash table used to referennce ct flows + * @predt_list: List to keep track of decap pretun flows + * @neigh_table: Table to keep track of neighbor entries + * @predt_lock: Lock to serialise predt/neigh table updates */ struct nfp_flower_priv { struct nfp_app *app; @@ -241,6 +319,9 @@ struct nfp_flower_priv { struct rhashtable ct_zone_table; struct nfp_fl_ct_zone_entry *ct_zone_wc; struct rhashtable ct_map_table; + struct list_head predt_list; + struct rhashtable neigh_table; + spinlock_t predt_lock; /* Lock to serialise predt/neigh table updates */ }; /** @@ -344,9 +425,14 @@ struct nfp_fl_payload { struct list_head linked_flows; bool in_hw; struct { + struct nfp_predt_entry *predt; struct net_device *dev; + __be16 vlan_tpid; __be16 vlan_tci; __be16 port_idx; + u8 loc_mac[ETH_ALEN]; + u8 rem_mac[ETH_ALEN]; + bool is_ipv6; } pre_tun_rule; }; @@ -369,6 +455,7 @@ struct nfp_fl_payload_link { extern const struct rhashtable_params nfp_flower_table_params; extern const struct rhashtable_params merge_table_params; +extern const struct rhashtable_params neigh_table_params; struct nfp_merge_info { u64 parent_ctx; diff --git a/drivers/net/ethernet/netronome/nfp/flower/metadata.c b/drivers/net/ethernet/netronome/nfp/flower/metadata.c index f448c5682594..74e1b279c13b 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/metadata.c +++ b/drivers/net/ethernet/netronome/nfp/flower/metadata.c @@ -502,6 +502,12 @@ const struct rhashtable_params nfp_ct_map_params = { .automatic_shrinking = true, }; +const struct rhashtable_params neigh_table_params = { + .key_offset = offsetof(struct nfp_neigh_entry, neigh_cookie), + .head_offset = offsetof(struct nfp_neigh_entry, ht_node), + .key_len = sizeof(unsigned long), +}; + int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, unsigned int host_num_mems) { @@ -530,6 +536,12 @@ int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, if (err) goto err_free_ct_zone_table; + err = rhashtable_init(&priv->neigh_table, &neigh_table_params); + if (err) + goto err_free_ct_map_table; + + INIT_LIST_HEAD(&priv->predt_list); + get_random_bytes(&priv->mask_id_seed, sizeof(priv->mask_id_seed)); /* Init ring buffer and unallocated mask_ids. */ @@ -537,7 +549,7 @@ int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, kmalloc_array(NFP_FLOWER_MASK_ENTRY_RS, NFP_FLOWER_MASK_ELEMENT_RS, GFP_KERNEL); if (!priv->mask_ids.mask_id_free_list.buf) - goto err_free_ct_map_table; + goto err_free_neigh_table; priv->mask_ids.init_unallocated = NFP_FLOWER_MASK_ENTRY_RS - 1; @@ -565,6 +577,7 @@ int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, goto err_free_ring_buf; spin_lock_init(&priv->stats_lock); + spin_lock_init(&priv->predt_lock); return 0; @@ -574,6 +587,8 @@ int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, kfree(priv->mask_ids.last_used); err_free_mask_id: kfree(priv->mask_ids.mask_id_free_list.buf); +err_free_neigh_table: + rhashtable_destroy(&priv->neigh_table); err_free_ct_map_table: rhashtable_destroy(&priv->ct_map_table); err_free_ct_zone_table: @@ -700,6 +715,8 @@ void nfp_flower_metadata_cleanup(struct nfp_app *app) rhashtable_free_and_destroy(&priv->ct_map_table, nfp_free_map_table_entry, NULL); + rhashtable_free_and_destroy(&priv->neigh_table, + nfp_check_rhashtable_empty, NULL); kvfree(priv->stats); kfree(priv->mask_ids.mask_id_free_list.buf); kfree(priv->mask_ids.last_used); diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c index c71bd555f482..f5e8ed14e517 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c @@ -76,38 +76,6 @@ struct nfp_tun_active_tuns_v6 { } tun_info[]; }; -/** - * struct nfp_tun_neigh - neighbour/route entry on the NFP - * @dst_ipv4: destination IPv4 address - * @src_ipv4: source IPv4 address - * @dst_addr: destination MAC address - * @src_addr: source MAC address - * @port_id: NFP port to output packet on - associated with source IPv4 - */ -struct nfp_tun_neigh { - __be32 dst_ipv4; - __be32 src_ipv4; - u8 dst_addr[ETH_ALEN]; - u8 src_addr[ETH_ALEN]; - __be32 port_id; -}; - -/** - * struct nfp_tun_neigh_v6 - neighbour/route entry on the NFP - * @dst_ipv6: destination IPv6 address - * @src_ipv6: source IPv6 address - * @dst_addr: destination MAC address - * @src_addr: source MAC address - * @port_id: NFP port to output packet on - associated with source IPv6 - */ -struct nfp_tun_neigh_v6 { - struct in6_addr dst_ipv6; - struct in6_addr src_ipv6; - u8 dst_addr[ETH_ALEN]; - u8 src_addr[ETH_ALEN]; - __be32 port_id; -}; - /** * struct nfp_tun_req_route_ipv4 - NFP requests a route/neighbour lookup * @ingress_port: ingress port of packet that signalled request From patchwork Thu May 5 05:43:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12839064 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B87D1C433F5 for ; Thu, 5 May 2022 05:44:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243694AbiEEFru (ORCPT ); Thu, 5 May 2022 01:47:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229684AbiEEFrs (ORCPT ); Thu, 5 May 2022 01:47:48 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2114.outbound.protection.outlook.com [40.107.101.114]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48F09344C0 for ; Wed, 4 May 2022 22:44:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VJ38AKFi2mbYWocK21OvZM7IhKMIUsduzutjHdADiz/Ipb5r3I9XgwxJaaKGMDg+tzN4+nZNduBSS08jAqG9+JVGfFJc6N6Cl6KMWu7V+PWWkcvrG53EAKOQl1osUTuayf/Cl9w6He61B+dvwYUNmxq7Zs/Rl5RPj4CCBUxe8y3H1mSFyFcP0kKQGp8B94HQEfNOm+1InAbMkGtU0RCFp4KqhV53W40KClllOZraRnzLE9RdOXZFa39+bQ9SHKdYunFTYGCIAqx98iBBWWozMNSvhFPDEtFnue3jOfrcgcQM6zTBThhdrSDBmIJVnBlQ3fX0D+o9zk57/u9I9kKTqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xFMLAh++M1W3ipVkxmsG8r596EgyR+p2J1zOTQ2tcNQ=; b=Ne1iDbeJKNNcB8x/iESbUOoDZ5iiTOpiK8mtMZcorFGWCge2s4ogX3K9hG5gzoBUXGTqBn/5DQkD862LI2UiKztG44rB4qhFsxwGPHmoOxgo1lxzlTUN1N6VknYpweWngA2bXVQIO3dUvd/PKdDdmCQKh6s7sQLBNigGsqaKWP3shrLHhseMKE3N4zkmv9A9U4ihK245IdLlluPRyBfrb+Lg2KLOMRQ08GvAEJ7qhj5lgAjjxvvimfSFhFq6bEKMz6JAgj+bhppOwBCsfNUt4zbyoPHDFOT3B0snAsH3ziEwooqgdntSy+9Cx3/pCCnr9usJeI5faS9wjpRFU7t0gg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xFMLAh++M1W3ipVkxmsG8r596EgyR+p2J1zOTQ2tcNQ=; b=XHupzFNWdc8BgUyzyjBVHVYub9DYjAL+1yZ7OmOHsHjURe90+Byv/6+XHk1qfalzYMi4v+J8iDaleNfgNrfw6uQIUS+RVBZfYfCSrArSWpX/Q6fbxLLEdDFYXVy8N9JZhn8k21BKVHEwXg4rt4BYI7bUtm2xkhSMoUU7bt96SwA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by BN8PR13MB2609.namprd13.prod.outlook.com (2603:10b6:408:82::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.14; Thu, 5 May 2022 05:44:06 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94%3]) with mapi id 15.20.5227.006; Thu, 5 May 2022 05:44:06 +0000 From: Simon Horman To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, oss-drivers@corigine.com Subject: [PATCH net-next 2/9] nfp: flower: add/remove predt_list entries Date: Thu, 5 May 2022 14:43:41 +0900 Message-Id: <20220505054348.269511-3-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220505054348.269511-1-simon.horman@corigine.com> References: <20220505054348.269511-1-simon.horman@corigine.com> X-ClientProxiedBy: TYAPR01CA0082.jpnprd01.prod.outlook.com (2603:1096:404:2c::22) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c209024-4008-4242-dc4b-08da2e5a44f3 X-MS-TrafficTypeDiagnostic: BN8PR13MB2609:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xEV2UrNjXSrh0XmmDnSGMIdDXiNsEtGIPH8Q6PJSc8+LnWfERvmS/wSkaQ9r+q4qTAiIJpsSOp2k8Fu8o4HVmjEUXbhDmy/eQQvwa4DxAoE7iIerr0OEBlB89crsm636ypIMaU/gkPwvrzQk4IZZUPVXAmlpIMyR7wcEsU96PHY8YNY/KhPHH91eVnLEspMbiZiWRvZf4/+CEvs5pnZP4JPK0P8zjXmA4CtT0bEv4lYlAfqcID1x1NYkG+M9WmC4kGvj2pSFZuWUOcBYBmJUOibZlwW9iXAJOlgJ61lxAwANMJxaq+0+greYpnaxdbG4cq+03dhrIgCoz9UvtuTlfHlCU9L7H7mJYjeIiZX46d4QXQME5BDP8RTNOAAspN33e4yfINqdJFubMgs7kMEo2nPLoyCODySq9GnmE7SqZpvQvvXa6Tc2mWNEzOwvJXGPpnGGb9tKecQGl0a6KtzbSpat5hQxBmURviSz/n59/PXePtGSiObWuPr7OgPCAD4tqHX89vz47+o/fO3/M5m9gVEDSdgFFQqWJ8OaLJRuDmID2HW2KEMk1q5Ox17PW2TvGQaSFJO8TJl8NCwZzzV8mBuCqXpbFSzTwiKiL6uxKHiNYZQLm+tPKLrWOi/aGqpE5SJ0eBtbtqFxnKfb4ZEd9a0+tIW4yPIz2RooBo2DxZ8EPB+VQhIS6E6TmRQeco/AanfZ5EOFBVH4lTEM7s9Ouw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(396003)(366004)(376002)(346002)(136003)(39830400003)(6666004)(6486002)(38100700002)(38350700002)(44832011)(5660300002)(316002)(508600001)(2906002)(36756003)(86362001)(186003)(52116002)(2616005)(6506007)(6512007)(26005)(83380400001)(8936002)(66476007)(66556008)(66946007)(8676002)(4326008)(1076003)(107886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vk3bvAU+jnRP8W7u5RmIFBe10oowsBCG7dj00nBzd4LHPWxcz3kLuZZhNj7hpcZXIMonk8XIGXqG9p8Eqtm8OJDNBlOLLNc+TMpAh9sawb/WMrLo5drN8gINTOjOkrtEbgaIjk9aAPs7xs4XpdOw3X3hvAv5HPOE4Nf7FZmPJ5FjUH+wfs/2j96O6i3zYRvhluetIo18PawyhMqDvVeQJZkT2DrfM5ug9bjBp2V2Kw/p3fSqzCiCzTNdYDKnKXdAsxr5Tf9hgitK64vCVqxYFzOX5EZ+f0y3J2JK1J1M6lUFZL+sIdDrsfexymDeP22Jmlj/HO5EIAMb9UbASNKO0M4YwQBY0XuOJBAMGj/sjwniUNPGg5IhwTxVWRZ1cXEYEKIUYA5JZ0I/7eoAlpqz+vWdAZSsR+efPivsbjEQeVHYS2sCKyAQ0bqxDSqyvGCWg4nDTm2viszFZ5LViOlfiMbWx8XzYkEkPjRfdCA0T/Nl55EV/WHpG0GPBM246dDnVETOj6HBmW5fYc2fIMSkRy5B3QmWCchqSEq26rTIzp4C+t/0900dbfpDytg7LkO32FDh1bF80ShQkP+hc6HY9qi/1hadjDbh8xo/dADWMSTOlHw0hV23BvsbCgNY6IXR40AtvEW2fAjIYv9OILfsi+RpEjZQC6neCTGY6LymooSfoMUStY90jq1ZEnee9tH0OQveC6i3Vhw9vql/h3jqPPzbtyXkfnxXd6wvgElinWvYI5F8aSrUb1eqbr/MHEF5ul8oRgTIZiUkiz0v4= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c209024-4008-4242-dc4b-08da2e5a44f3 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2022 05:44:06.6050 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zq5KvB/0BQ6nYJQymcSwrTT+35hUbDxnaaQ5VTsUEg6HOFmDdgtyQH7D92bYyrpYxAvYUTL6oRL5TSMRcWmK3nagmTic4gSN4llG0ror1Mw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR13MB2609 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Louis Peens Add calls to add and remove flows to the predt_table. This very simply just allocates and add a new pretun entry if detected as such, and removes it when encountered on a delete flow. Compatibility for older firmware is kept in place through the DECAP_V2 feature bit. Signed-off-by: Louis Peens Signed-off-by: Yinjun Zhang Signed-off-by: Simon Horman --- .../ethernet/netronome/nfp/flower/action.c | 3 +- .../ethernet/netronome/nfp/flower/offload.c | 43 ++++++++++++++++--- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/action.c b/drivers/net/ethernet/netronome/nfp/flower/action.c index 1b9421e844a9..0147de405365 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/action.c +++ b/drivers/net/ethernet/netronome/nfp/flower/action.c @@ -220,7 +220,8 @@ nfp_fl_output(struct nfp_app *app, struct nfp_fl_output *output, } output->port = cpu_to_be32(NFP_FL_LAG_OUT | gid); } else if (nfp_flower_internal_port_can_offload(app, out_dev)) { - if (!(priv->flower_ext_feats & NFP_FL_FEATS_PRE_TUN_RULES)) { + if (!(priv->flower_ext_feats & NFP_FL_FEATS_PRE_TUN_RULES) && + !(priv->flower_ext_feats & NFP_FL_FEATS_DECAP_V2)) { NL_SET_ERR_MSG_MOD(extack, "unsupported offload: pre-tunnel rules not supported in loaded firmware"); return -EOPNOTSUPP; } diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c index 92e8ade4854e..0fe018bef410 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/offload.c +++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c @@ -1362,11 +1362,29 @@ nfp_flower_add_offload(struct nfp_app *app, struct net_device *netdev, goto err_release_metadata; } - if (flow_pay->pre_tun_rule.dev) - err = nfp_flower_xmit_pre_tun_flow(app, flow_pay); - else + if (flow_pay->pre_tun_rule.dev) { + if (priv->flower_ext_feats & NFP_FL_FEATS_DECAP_V2) { + struct nfp_predt_entry *predt; + + predt = kzalloc(sizeof(*predt), GFP_KERNEL); + if (!predt) { + err = -ENOMEM; + goto err_remove_rhash; + } + predt->flow_pay = flow_pay; + INIT_LIST_HEAD(&predt->nn_list); + spin_lock_bh(&priv->predt_lock); + list_add(&predt->list_head, &priv->predt_list); + spin_unlock_bh(&priv->predt_lock); + flow_pay->pre_tun_rule.predt = predt; + } else { + err = nfp_flower_xmit_pre_tun_flow(app, flow_pay); + } + } else { err = nfp_flower_xmit_flow(app, flow_pay, NFP_FLOWER_CMSG_TYPE_FLOW_ADD); + } + if (err) goto err_remove_rhash; @@ -1538,11 +1556,24 @@ nfp_flower_del_offload(struct nfp_app *app, struct net_device *netdev, goto err_free_merge_flow; } - if (nfp_flow->pre_tun_rule.dev) - err = nfp_flower_xmit_pre_tun_del_flow(app, nfp_flow); - else + if (nfp_flow->pre_tun_rule.dev) { + if (priv->flower_ext_feats & NFP_FL_FEATS_DECAP_V2) { + struct nfp_predt_entry *predt; + + predt = nfp_flow->pre_tun_rule.predt; + if (predt) { + spin_lock_bh(&priv->predt_lock); + list_del(&predt->list_head); + spin_unlock_bh(&priv->predt_lock); + kfree(predt); + } + } else { + err = nfp_flower_xmit_pre_tun_del_flow(app, nfp_flow); + } + } else { err = nfp_flower_xmit_flow(app, nfp_flow, NFP_FLOWER_CMSG_TYPE_FLOW_DEL); + } /* Fall through on error. */ err_free_merge_flow: From patchwork Thu May 5 05:43:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12839065 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F422FC433F5 for ; Thu, 5 May 2022 05:44:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243706AbiEEFrw (ORCPT ); Thu, 5 May 2022 01:47:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243666AbiEEFrt (ORCPT ); Thu, 5 May 2022 01:47:49 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2114.outbound.protection.outlook.com [40.107.101.114]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C353B34B9D for ; Wed, 4 May 2022 22:44:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V8xnt5mPtIOf39s/eY8cHMksJzSwHL8TyOF6d55K1lV9EWdcRSB1Bznu1lZEb2XbOaL47TT9F+ajImGK4mc3EFw+/fFPMRzYeeW74LB4Lv8Z9sq6yy4OKbf4N214os6fe++h0soWPmeAGrK6V054VbWgJsQNdT7Z+hbBlZzWt+1Z8OxNFSi+rAesONuJ9MEpp0R87G2h0lIDsEdpKE7N83QwN6DMyK+RzIDSBCvuhgWiQa1B+xXgkQGm8yMDqy3g3W8zjZlqvTheW1zz0H2f7vYCQ6HWj6g+pjsM80pVsPskYZv8bByi4ZRdUicUudZE8p9fcHEjn4pfvOXQrSWilQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LFzBykFnBnIqO4caDsWIwKq7BQ6TOUi+Q6ifVvBrTGk=; b=QzzmgH8GBKhAZWPjyG5slCTAlyCBEzf1VW+6Auq2El8+Cu3Lss/5U4WX2KITCbycRrdGUxNZRz4+spRH50qdk6jivq5ff4ePw+omTN4WNkzehLv4zcpQJARe8AjeKToPWDqBNMGjYO8CFo1QGTmtWfmF7Kc0Mzmg6kxz/4pxnaHAyFGCm9CbTvEKtXswkRxouiL9BARjaL6x6TivoVyU5J4Dyy9udjP2bL83+ckbkjIWDuN6w61znXVwmkfd+OQtvGQ5QfwvIskBsbqE5K3HzsnByLCacpC8j391CWoaX2Etx6+8PX4cWdckZMrZc/1j86/drM4tYqm4jRIIMtrU+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LFzBykFnBnIqO4caDsWIwKq7BQ6TOUi+Q6ifVvBrTGk=; b=lWpHhgPqqngsP6vwDAFz27TbN/Sb/H7gojCn1eeknRrN1vkzXxhKYkPXiLZkXDrWZxrsjctPdKW0LWFz2mr11PmQNZD437v7kJB8HxOvKRtC8p33tamYVG8FQOku3jmMXiPKun4HGOC8N+xPeMRU3pC00ucOuOTccvDvolqDQX4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by BN8PR13MB2609.namprd13.prod.outlook.com (2603:10b6:408:82::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.14; Thu, 5 May 2022 05:44:07 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94%3]) with mapi id 15.20.5227.006; Thu, 5 May 2022 05:44:07 +0000 From: Simon Horman To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, oss-drivers@corigine.com Subject: [PATCH net-next 3/9] nfp: flower: enforce more strict pre_tun checks Date: Thu, 5 May 2022 14:43:42 +0900 Message-Id: <20220505054348.269511-4-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220505054348.269511-1-simon.horman@corigine.com> References: <20220505054348.269511-1-simon.horman@corigine.com> X-ClientProxiedBy: TYAPR01CA0082.jpnprd01.prod.outlook.com (2603:1096:404:2c::22) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f8f23c6c-7453-4a37-b47b-08da2e5a45a1 X-MS-TrafficTypeDiagnostic: BN8PR13MB2609:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mgVUH8Q3+V9IbSyrxXkVXoJFueSNFdfnGqFtZMGYshiJmxKzJi5UoY62a0n7yub8DyBrKtnz5wX/pPjqD/BEQvHKZXc2PapYbrc2MGfKH+t3KGSKflUasWptC+NSlSoYTJb7aiCDyrQBx5w5cJxVAEl3Ae8WkW1r2/pXqSZAAPduZUFM0y9o2RL8uswciuxDfmpPuPQVR05TgMMjrrz75zH07yB1Nw0hFZdid6UoZzetBYn6rI4hx1CEOWxOc+xp/mBUal2Ai1ik+Z7y9uTRpo32iSK43qpBXPFIdET+ykpyBHQJlqhRpBmC+p0t0XXC7jdzKru9ICuNrHNVOsR6GPhPfnBBS42k0nj0H2+wv3La4tPWWn0wGmOxoBglHTxdip8abGdvN1RItLadPfyU2joHnXBcKZyXh85vGCzIWX5ABGRs90WkAllziz3Vuga+96AiTaWpUsZK2T54PPR4+gH64zYqYb1UMN881IA2pGXEzmfarrtLVYPC22qRtpzL4xolME5gqY+WWyfmBGdF98fMOZwFi1XiQcLZfLkDOIbj6xLfWoOiZs9A7qUG+dnGW1wdirWasHo1iD32dMVnu/NlXHe1APezDZ2ZTC5Z/ok5RD6Q6KEQzdDEkT4Ol5C5h0BwhGUnOajeYx94OukrSLcJzo3YFNQb5gy6uWnd9LHUMiNrU/JAvDUW2ZF20HBAd/v1IyxJML3sbGX2zsI8Zw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(396003)(366004)(376002)(346002)(136003)(39830400003)(6666004)(6486002)(38100700002)(38350700002)(44832011)(5660300002)(316002)(508600001)(2906002)(36756003)(86362001)(186003)(52116002)(2616005)(6506007)(6512007)(26005)(83380400001)(8936002)(66476007)(66556008)(66946007)(8676002)(4326008)(1076003)(107886003)(110136005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mA/vtcaLxVQJUVdewBilwcbAMRThkTBNnFB6it/rMIQn1eBKvcs4FCAG8BUV9cCU0eiZnlMFdQx54B0FIlwofSWT4CggotOvrCUiPzOroN8rmNE6uWuv3BAPpmL90i1zL2xXfIa3N5RPl8ed+A4nebaaoDNXxrh0AJrQFuvFY0zumah20pNXEHE/ROnHEblnCnLxJm6Fd0/og8Gn6pS7fjyMJQXY7Vkx2bRnnFdyhbDmNnkn2tuPTvgS9FLYyq2iwUcy0egOBfSpPFnxlwYR7cqxMrFxE4l/4/7oC4PE2+TnXhgGTDruoYmHPQq6cpQz+1MWKDEOZJFCcQxkJT0OwmlDkVNz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llOYSdUIgE9esilmbXi+5nUYinEqJtQu7kDJE1zVkT7dYoH1Bv3Gb38oX9M8/ZsWzyXAvH7vPiSXQxoW3amAR3CkomkcS/vfkTCEpLf3xc4AquQm2jqQJhAnU0YDc6gOb4eECXb/XiTyYQ7Pzj83ANfk55z0iI9QtJL15BTxjWYjq+WKW3vG4e0KSIkglsHpnXye+EfIvs2mF/US3kTpLEJYY9SBhYtsBrlDHl29RuwtrQPStoIDsOB+OKdGye+XlBXrDvYPGD090oWuo7hHB34JGllfH0QJqCMI6ZO6h4Fej+u3xBSdAF6N1wUDacnWr2cSS5o3eWUxxZRg= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: f8f23c6c-7453-4a37-b47b-08da2e5a45a1 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2022 05:44:07.7599 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3qQlLThJHuX9HPBldFCDHjUm41Ow+PJK/MhBEK02W8EXLAuKx1JqfQCUQ37hJU/S3Mb37xEP0mqd3wDMkiKP83mu4z3Tlb376iwjx0a0/P8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR13MB2609 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Louis Peens Make sure that the rule also matches on source MAC address. On top of that also now save the src and dst MAC addresses similar to how vlan_tci is saved - this will be used in later comparisons with neighbour entries. Indicate if the flow matched on ipv4 or ipv6. Populate the vlan_tpid field that got added to the pre_run_rule struct as well. Signed-off-by: Louis Peens Signed-off-by: Yinjun Zhang Signed-off-by: Simon Horman --- .../ethernet/netronome/nfp/flower/offload.c | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c index 0fe018bef410..5fea3e3415fe 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/offload.c +++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c @@ -1170,6 +1170,11 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app, return -EOPNOTSUPP; } + if (key_layer & NFP_FLOWER_LAYER_IPV6) + flow->pre_tun_rule.is_ipv6 = true; + else + flow->pre_tun_rule.is_ipv6 = false; + /* Skip fields known to exist. */ mask += sizeof(struct nfp_flower_meta_tci); ext += sizeof(struct nfp_flower_meta_tci); @@ -1180,13 +1185,6 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app, mask += sizeof(struct nfp_flower_in_port); ext += sizeof(struct nfp_flower_in_port); - /* Ensure destination MAC address matches pre_tun_dev. */ - mac = (struct nfp_flower_mac_mpls *)ext; - if (memcmp(&mac->mac_dst[0], flow->pre_tun_rule.dev->dev_addr, 6)) { - NL_SET_ERR_MSG_MOD(extack, "unsupported pre-tunnel rule: dest MAC must match output dev MAC"); - return -EOPNOTSUPP; - } - /* Ensure destination MAC address is fully matched. */ mac = (struct nfp_flower_mac_mpls *)mask; if (!is_broadcast_ether_addr(&mac->mac_dst[0])) { @@ -1194,11 +1192,36 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app, return -EOPNOTSUPP; } + /* Ensure source MAC address is fully matched. This is only needed + * for firmware with the DECAP_V2 feature enabled. Don't do this + * for firmware without this feature to keep old behaviour. + */ + if (priv->flower_ext_feats & NFP_FL_FEATS_DECAP_V2) { + mac = (struct nfp_flower_mac_mpls *)mask; + if (!is_broadcast_ether_addr(&mac->mac_src[0])) { + NL_SET_ERR_MSG_MOD(extack, + "unsupported pre-tunnel rule: source MAC field must not be masked"); + return -EOPNOTSUPP; + } + } + if (mac->mpls_lse) { NL_SET_ERR_MSG_MOD(extack, "unsupported pre-tunnel rule: MPLS not supported"); return -EOPNOTSUPP; } + /* Ensure destination MAC address matches pre_tun_dev. */ + mac = (struct nfp_flower_mac_mpls *)ext; + if (memcmp(&mac->mac_dst[0], flow->pre_tun_rule.dev->dev_addr, 6)) { + NL_SET_ERR_MSG_MOD(extack, + "unsupported pre-tunnel rule: dest MAC must match output dev MAC"); + return -EOPNOTSUPP; + } + + /* Save mac addresses in pre_tun_rule entry for later use */ + memcpy(&flow->pre_tun_rule.loc_mac, &mac->mac_dst[0], ETH_ALEN); + memcpy(&flow->pre_tun_rule.rem_mac, &mac->mac_src[0], ETH_ALEN); + mask += sizeof(struct nfp_flower_mac_mpls); ext += sizeof(struct nfp_flower_mac_mpls); if (key_layer & NFP_FLOWER_LAYER_IPV4 || @@ -1227,17 +1250,21 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app, if ((priv->flower_ext_feats & NFP_FL_FEATS_VLAN_QINQ)) { if (key_ls->key_layer_two & NFP_FLOWER_LAYER2_QINQ) { struct nfp_flower_vlan *vlan_tags; + u16 vlan_tpid; u16 vlan_tci; vlan_tags = (struct nfp_flower_vlan *)ext; vlan_tci = be16_to_cpu(vlan_tags->outer_tci); + vlan_tpid = be16_to_cpu(vlan_tags->outer_tpid); vlan_tci &= ~NFP_FLOWER_MASK_VLAN_PRESENT; flow->pre_tun_rule.vlan_tci = cpu_to_be16(vlan_tci); + flow->pre_tun_rule.vlan_tpid = cpu_to_be16(vlan_tpid); vlan = true; } else { flow->pre_tun_rule.vlan_tci = cpu_to_be16(0xffff); + flow->pre_tun_rule.vlan_tpid = cpu_to_be16(0xffff); } } From patchwork Thu May 5 05:43:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12839067 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C79FFC433F5 for ; Thu, 5 May 2022 05:44:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243816AbiEEFsM (ORCPT ); Thu, 5 May 2022 01:48:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243701AbiEEFru (ORCPT ); Thu, 5 May 2022 01:47:50 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2097.outbound.protection.outlook.com [40.107.236.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98C0F34B97 for ; Wed, 4 May 2022 22:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LAL3PosY9LHSaO2a23n6ItTYtKDU1ERkkXCEoUKJD2eSjFDmkhYRNLMRxDtcmAbPfRUAsoxY239oHANv1pegjMuF03cklriwWLzxiFjZAHAtD9twKlkHic1nAsYOdIoc2pAOsQs8DgLzvS4Pcmwj5VV1+2cpFLGH8SS/f/Rmp8tQiwBVf5znFzSRDZuT/i9XEx06DdgpOfWme7+1kpbc/t89/WztFoeyxSC6Hz3CMNc8if31CTW9U3RD4SYQnga3NHIOv2T6VPFtDx7IhZK5Y1SPrm/Gzf3lrFmxrWCS/mY0ZN4j9XsZVzQF+51eQyqNVie3Clud8a+gRhWVhySYCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=peyrhIeKw+L9kGwHX9lh7TLDN8mFvNolTus/mNAwO9I=; b=WWEUHAR9+6VYIsmXE8P4wBT+EK6M66sKyFiLqRtwI3bEtK+rVUSSHOuLCKfsSF884d7TRkA4ilPYoYKmGx49JP0l7oTqkCODelMa8HNFnJ/rOtqU9P58SkyXVbZ+ONABX1uguIxrgVmf6uDdsP01x5/yMgArrpsK88K+5Nuh53voPnE7v2X8uMUQW2OKmqP09deDZtmL71116a8mR6eSljnvfY3/gc2bw/4IDeQP9B5Cv5YjQWFtSv3YX8f2t3p5dHpx84zXcmxvDJJ8zUb6ON6cdaBDjLVpJ9f69Zm/qcg2tTlGn1CJLiGOiQZ8L9GYsZi5HF4a6A20XKfvzExnFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=peyrhIeKw+L9kGwHX9lh7TLDN8mFvNolTus/mNAwO9I=; b=nXiJZ/IU8bAvNkE+vy7HzZ6NOvkrNywYLDIH8jhtSBPQ8mDg/rd1awQMm/mpXFnNmq/HhW58iyljBokfTqIVDky5fHGqYalNDNymMIwu1lJ0wLiUIGFqOCKzRUoBguuCJLxC/Ed/SRjeNREbxERMY5eO3Qk1eo7hCruDwbkExgk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by DM5PR13MB1257.namprd13.prod.outlook.com (2603:10b6:3:27::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.16; Thu, 5 May 2022 05:44:09 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94%3]) with mapi id 15.20.5227.006; Thu, 5 May 2022 05:44:09 +0000 From: Simon Horman To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, oss-drivers@corigine.com Subject: [PATCH net-next 4/9] nfp: flower: fixup ipv6/ipv4 route lookup for neigh events Date: Thu, 5 May 2022 14:43:43 +0900 Message-Id: <20220505054348.269511-5-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220505054348.269511-1-simon.horman@corigine.com> References: <20220505054348.269511-1-simon.horman@corigine.com> X-ClientProxiedBy: TYAPR01CA0082.jpnprd01.prod.outlook.com (2603:1096:404:2c::22) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6b5399a1-76ca-4d24-0d72-08da2e5a4657 X-MS-TrafficTypeDiagnostic: DM5PR13MB1257:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tkrQVe4KvMcHirX7/n/bj3sJQNL6DlJzsbmvB06gxhQIMuhpU9W4JSnJtbgdHODWL6lPrF8jlV4JsFgw5uJHi6JCUMv6gi7pp+t/sYoHy5j1Z8Z9VEo1IReLLqFaMcYogsEXSFucmK2+d1zYvS2Ku77zxzUMoobV8Xqib1IBieHLTThm5Dh2qnXiU0DP1BksaWhwQFJyqFxWryaQiwFYpkrQbqowa8nD1+muFjvgRSwG4+5lUkvXjyVdQHOnH+ETAjuuJclvUWDWff/oJWXc+FkekfB+AGF9FA8z0awsZPNrS13P9RMGRQCPOr0lbZZ/JgOLWDkBWJTk7HdjdsJ3D7kk571xmWnw5By6cLDqcCHjdnEi4dKLwTXAtxaKMXnR8/YzuGdcNvVXqs5kYaOlLcgPkcJjkAiuMean747ef2GSTStWi2BMTW/NS9Tmk6DwzGfkk/OSVKGVwBSMJZAuOY025pyDgz+spt2leUIXEPfn8LIQDoO9sVPCe7lFv9MEaEuDwQhErNPsHbtberFqmZkszTsjGi6kEpMRTDGS+EbFKXxhOPkBdqn5HTA5OFYK/TxqNXEmeciE4bDcsnX2Qk2rFrmAo7CthyOVWz+CYF3l61klbFBhN5JQQWQLt0zMUp73v8wup7P1aNhb9Jca/tKdK05DrM3dTqEzM1kzVa/Cggw4x9N7w1AyLFRHC0+pvG7lBO4bn0Mgo3L7qL1O6g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(346002)(376002)(136003)(396003)(39830400003)(66556008)(66946007)(6506007)(8676002)(4326008)(5660300002)(52116002)(1076003)(186003)(6486002)(36756003)(2616005)(316002)(110136005)(83380400001)(107886003)(66476007)(6512007)(8936002)(38100700002)(38350700002)(86362001)(508600001)(26005)(6666004)(44832011)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Z3HO0Xmv0lDKAAnRYOdahDPAG7avdXCUG15bOyeV+l0hXFDecPOUl0fSBiYQ0IWa2tV40MVPhxOhq405vl9piOiDrDbD8GGar6qgoKVLgw7hHsJDrI5gET3SD91UaCIReTvUvVld4qrfZJ7V1NKZ0A5UMWFHBO4eEjGZXpYbybBZBiM7cv/VdmBd/H12i5IV7GGwxnRSiia1KUYRWO6HL6APN24Lxz1w0XJXpCdOIAZA78o1ig6Mtq6Gki4s462jyWaj5lTaPXVpyWg+iP774P4r1nLMpc1wayrBI1F7tL5240jpap1/P7ZOa6UOX1NoSadEYmMRcXcJapBd57za662JOSLJVutD5VH0rGRtSfcpBkz1B0mK/DY/P5SGukGKl4IRUc2Z+1dFjzW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eQq69WStTZ9zrZb9e0M5i3Z3bloCANCx4dnwlYN9fSYnCIoIH6BdIAXR/cdAGytNc4+1HNSyBai2P8gCWlBXuMQ7NBYkMFbNTc1MEvwWmC1f1va8Mt14fykPG6lt4CBcvAXU0mZkadpWK3mJXANX7Es0kuMB9qQ43YipmjR2dtUfLJEr6115tUnuTj3W3eWc+//yGctrypLDYnc3dGjior3xLozAH/RjsybgR/qmfrR0oZAWCgLeBrrRKn9tisbtKatvbGnck581jz9wsZ9VPCGIfyE= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b5399a1-76ca-4d24-0d72-08da2e5a4657 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2022 05:44:08.9484 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6fmrPO449OIa3RSs2Mv8tp0tfSI2RMBTWXDBGr3MvbkelmJuV2RNaGpiTy2HVAcL+Aihw40f9bkItbGd227o5uXcT/6ILGmjhfssHy4YmvU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR13MB1257 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Louis Peens When a callback is received to invalidate a neighbour entry there is no need to try and populate any other flow information. Only the flowX->daddr information is needed as lookup key to delete an entry from the NFP neighbour table. Fix this by only doing the lookup if the callback is for a new entry. As part of this cleanup remove the setting of flow6.flowi6_proto, as this is not needed either, it looks to be a possible leftover from a previous implementation. Signed-off-by: Louis Peens Signed-off-by: Yinjun Zhang Signed-off-by: Simon Horman --- .../netronome/nfp/flower/tunnel_conf.c | 52 ++++++++++++------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c index f5e8ed14e517..0cb016afbab3 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c @@ -494,7 +494,7 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event, struct flowi6 flow6 = {}; struct neighbour *n; struct nfp_app *app; - struct rtable *rt; + bool neigh_invalid; bool ipv6 = false; int err; @@ -513,6 +513,8 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event, if (n->tbl->family == AF_INET6) ipv6 = true; + neigh_invalid = !(n->nud_state & NUD_VALID) || n->dead; + if (ipv6) flow6.daddr = *(struct in6_addr *)n->primary_key; else @@ -533,29 +535,41 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event, #if IS_ENABLED(CONFIG_INET) if (ipv6) { #if IS_ENABLED(CONFIG_IPV6) - struct dst_entry *dst; - - dst = ipv6_stub->ipv6_dst_lookup_flow(dev_net(n->dev), NULL, - &flow6, NULL); - if (IS_ERR(dst)) - return NOTIFY_DONE; - - dst_release(dst); - flow6.flowi6_proto = IPPROTO_UDP; + if (!neigh_invalid) { + struct dst_entry *dst; + /* Use ipv6_dst_lookup_flow to populate flow6->saddr + * and other fields. This information is only needed + * for new entries, lookup can be skipped when an entry + * gets invalidated - as only the daddr is needed for + * deleting. + */ + dst = ip6_dst_lookup_flow(dev_net(n->dev), NULL, + &flow6, NULL); + if (IS_ERR(dst)) + return NOTIFY_DONE; + + dst_release(dst); + } nfp_tun_write_neigh_v6(n->dev, app, &flow6, n, GFP_ATOMIC); #else return NOTIFY_DONE; #endif /* CONFIG_IPV6 */ } else { - /* Do a route lookup to populate flow data. */ - rt = ip_route_output_key(dev_net(n->dev), &flow4); - err = PTR_ERR_OR_ZERO(rt); - if (err) - return NOTIFY_DONE; - - ip_rt_put(rt); - - flow4.flowi4_proto = IPPROTO_UDP; + if (!neigh_invalid) { + struct rtable *rt; + /* Use ip_route_output_key to populate flow4->saddr and + * other fields. This information is only needed for + * new entries, lookup can be skipped when an entry + * gets invalidated - as only the daddr is needed for + * deleting. + */ + rt = ip_route_output_key(dev_net(n->dev), &flow4); + err = PTR_ERR_OR_ZERO(rt); + if (err) + return NOTIFY_DONE; + + ip_rt_put(rt); + } nfp_tun_write_neigh_v4(n->dev, app, &flow4, n, GFP_ATOMIC); } #else From patchwork Thu May 5 05:43:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12839068 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C14CC433EF for ; Thu, 5 May 2022 05:44:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243892AbiEEFsO (ORCPT ); Thu, 5 May 2022 01:48:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243704AbiEEFru (ORCPT ); Thu, 5 May 2022 01:47:50 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2114.outbound.protection.outlook.com [40.107.101.114]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37C8C344C0 for ; Wed, 4 May 2022 22:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dYR0ovAJSfkJ6WHr2ue6it1InBVucGFYGhHqSbApQkcyKabiEMAVBVW9euQatrT5V/swvWmCsi/X8wLAxkwK/D+G4G/9HVoo32YIG7KQaCFVYctg8AE2hcTOj7JBIZC0gFK4iwVyHqK2/g/QKq01QMoK+vTc2E0hs7Qo/kcnkv4FZI8XA+02ndbkQ9aVdc6sJrmmzIqXjAKCGiLw2GH+8vjHwny23s4ogFzD3w+uF3rJDZp2EP2FEt2v8D/GPiPubd8DpGC5TiK/cM9mx0tIBpluT3ypo+UH8QCehjmCsdoD6xhZE+Rbsv88jmGOioSp6CthCBHdzcBjIRykB/04jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=esvyNvTQ7JgPYflmCkrAwK5ZrM8BYJtSkFgDUNWbVHo=; b=inp930aLRXyaAIqTUIfYlv8UdB+snXK0eCKPkc6CjhClNAvfY+pO7zC4EZQcfaNTHtIXCVvUWLrdOV0A4Ne5WFdxZmzHhtcc2gpoltM1jACFjzbz4RV897IWImtYKyCcRSRvJQH4dlAWPfGh35rbx8RO8E2vGasGUb7jCGxDrw71eD6vH31IF08YqS2dQkGE5NKD4C5Uo9mlKadRsykMoANyUk+i+WWBH9R7GZJ0K/U3s7TQq9uiet17Wy42Wy4SDPhujJA2FqpQwP2aU+vnVYJocUCG92tBfmgk0RySjAjX0vL/DfFCW+VwIhyHKShN8U/lf2Y7PZzbfgf4N+yfiA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=esvyNvTQ7JgPYflmCkrAwK5ZrM8BYJtSkFgDUNWbVHo=; b=F/092Oe9f7QHleDE/slprnSxlTX6gb5jqvN3gFAtJtl2GzTZza1OaHrWi8xvmBcwxL0Q3gv8oywWxZeNDCDHwH1rdkCfCEKE+9DZNM3spuecMesr5irirtDibqFrOe4P1ENBrw0rogEJK6Hs+mGRumwcu7QxO23mnsQkIFhZOaM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by BN8PR13MB2609.namprd13.prod.outlook.com (2603:10b6:408:82::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.14; Thu, 5 May 2022 05:44:10 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94%3]) with mapi id 15.20.5227.006; Thu, 5 May 2022 05:44:10 +0000 From: Simon Horman To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, oss-drivers@corigine.com Subject: [PATCH net-next 5/9] nfp: flower: update nfp_tun_neigh structs Date: Thu, 5 May 2022 14:43:44 +0900 Message-Id: <20220505054348.269511-6-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220505054348.269511-1-simon.horman@corigine.com> References: <20220505054348.269511-1-simon.horman@corigine.com> X-ClientProxiedBy: TYAPR01CA0082.jpnprd01.prod.outlook.com (2603:1096:404:2c::22) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 36642cf9-00f4-44eb-880a-08da2e5a46fb X-MS-TrafficTypeDiagnostic: BN8PR13MB2609:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HNO7fcq8fP6EzlkE15lRMAE+95VqFwS9IDnLmmyhqtCVQkjWbEJnp5XaLjC9q++9bmPHeIcpA5mY9cu4fsQFArTSrdcihO6/p77eUBUYzrzB+xGfMoBSMj+ItUbMrbxruRxsgf0vgkBaWAlm3FzFtEcRDRsLJg0k39jvU6UQPkLQFmgSTxKk2pX4nl1K5iCKuDN8Sjp9q/M9e/GQogbC+76KWbUjEmx1goYJl4kVEStzBulvv54ktROVr8Ym3vNYpnLlHRiNCaCoJ614V86FLpgALCa3kPYxG2Shccy+YjHONkE66VY/2SlQT0j0eKEgFLpAnXwQ2n/ZOxtqL2Q1NvQQkzeKvS++PNY0Bx84rVDGUE87LjzN68UJzp7osbcGNaPkjndB6SZVRlftm7JPE/1JI0fPmFsvE2jcV76br/FRSEKBimQzIcsLxFPPdvgtZHAYDNY7HFz3YRs+d5jGzVhSZdP4HUPf4A9RGcmCMoaFhj3yP9CuRzN0J5cVvPRj7YI1iSDFZe6XAeYcd+DX5prgvdj5giD9Erk/q99A3p3mTsogvISDRKeggd1h1mWYlYdCkzdHcpbjBmNuSrMHZ6+gv9Fjv6mV2W1GRfruwPkUD/vWFi3/E6dX5rjcJamMWJARa0szMaSAX2PS1iTAH8AWhSZkY4QFDejgB+KB73M74L154h2XDZ3gv8E1RP8NMN8ySm7f0Gx9VowaSxIAZA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(396003)(366004)(376002)(346002)(136003)(39830400003)(6666004)(6486002)(38100700002)(38350700002)(44832011)(5660300002)(316002)(508600001)(15650500001)(2906002)(36756003)(86362001)(186003)(52116002)(2616005)(6506007)(6512007)(26005)(83380400001)(8936002)(66476007)(66556008)(66946007)(8676002)(4326008)(1076003)(107886003)(110136005);DIR:OUT;SFP:1102; X-MS-Exchange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edcePDcWq+8hnGdzLpmUcy6vqZd/Yvs5ysYAV3bR89HVqb9IzmZ0RooIKrF2pGnUQNAjMLB0odM8cD4u80w25OpzFCtz7ceUZknBUSgj0dbe8Rqz8si3ATy1T9ebSfz8NmRnnhlWv6Ydo8Z50tgWqokxc/Prvgst7YEEo7tWj9lJPQU4MqlHWK6DBpfuE0f5NC3YJry9n7v1+jpyQv20h+fIC5cvHwUAzu6TTJvFGhb5jHiqCjTXVAWYpRyFzPLVE34xtGhFI0N5shnWeTUuxOSMdMFaPVC4uMKp1Z3df/gXwKniI5susFu4rUJ50PvVpJIF7v85C7W1jQIb3Unfop0dg4UJyr9oD1L+ftQdB/T0fOtllUMDXeA7AcXQSA39FY4KgqjovgMNLcfdYHd/yhJLbNmofRsV/p78pQMNNWUFN0820EaL01tihACBwNzIrdlcEWzfCXfDwrWiAjPzdayLvZiMaBVGnB0IZe/tcPcwIgJQWzx5QlUNvJJzi4nrKkoA7q7fj5GLqwEpmNHVxDT7BgYH4SHpVQ7IvZ8qZtdiUs6jjz33wGpSsziDCYTx2sos45APRGeBCxAZDKt4Vf1j1dj+HivmcyuUaaQoERFiorkF8fOeOLd+sn1APVVxn+Mo66FocgQjtBo45JkbdivrrLKRTdMah0D8H40Lne/Ep9ElOLnpQNC4wUeA0++FoCxmNMkjh3FPyj4rAzfA2t2NruY+qx/Hi0cHiThDxOA= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 36642cf9-00f4-44eb-880a-08da2e5a46fb X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2022 05:44:10.2150 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ch/28AuJb3p/KwKLHXO3bqhGhyvoTsqtioZ5pqE5nG9zV7p2MQCoO/syFw48TQedfpvIapNkEyOULPHH76Z/mcSt1f1M2yoCWuPfiexW3U8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR13MB2609 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Louis Peens Prepare for more rework in following patches by updating the existing nfp_neigh_structs. The update allows for the same headers to be used for both old and new firmware, with a slight length adjustment when sending the control message to the firmware. Signed-off-by: Louis Peens Signed-off-by: Yinjun Zhang Signed-off-by: Simon Horman --- .../net/ethernet/netronome/nfp/flower/main.h | 50 +++++++++++-------- .../netronome/nfp/flower/tunnel_conf.c | 30 ++++++----- 2 files changed, 47 insertions(+), 33 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h index 454fdb6ea4a5..2c011d60c212 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/main.h +++ b/drivers/net/ethernet/netronome/nfp/flower/main.h @@ -111,47 +111,55 @@ struct nfp_fl_tunnel_offloads { }; /** - * struct nfp_tun_neigh - neighbour/route entry on the NFP - * @dst_ipv4: Destination IPv4 address - * @src_ipv4: Source IPv4 address + * struct nfp_tun_neigh - basic neighbour data * @dst_addr: Destination MAC address * @src_addr: Source MAC address * @port_id: NFP port to output packet on - associated with source IPv4 - * @vlan_tpid: VLAN_TPID match field - * @vlan_tci: VLAN_TCI match field - * @host_ctx: Host context ID to be saved here */ struct nfp_tun_neigh { - __be32 dst_ipv4; - __be32 src_ipv4; u8 dst_addr[ETH_ALEN]; u8 src_addr[ETH_ALEN]; __be32 port_id; +}; + +/** + * struct nfp_tun_neigh_ext - extended neighbour data + * @vlan_tpid: VLAN_TPID match field + * @vlan_tci: VLAN_TCI match field + * @host_ctx: Host context ID to be saved here + */ +struct nfp_tun_neigh_ext { __be16 vlan_tpid; __be16 vlan_tci; __be32 host_ctx; }; /** - * struct nfp_tun_neigh_v6 - neighbour/route entry on the NFP + * struct nfp_tun_neigh_v4 - neighbour/route entry on the NFP for IPv4 + * @dst_ipv4: Destination IPv4 address + * @src_ipv4: Source IPv4 address + * @common: Neighbour/route common info + * @ext: Neighbour/route extended info + */ +struct nfp_tun_neigh_v4 { + __be32 dst_ipv4; + __be32 src_ipv4; + struct nfp_tun_neigh common; + struct nfp_tun_neigh_ext ext; +}; + +/** + * struct nfp_tun_neigh_v6 - neighbour/route entry on the NFP for IPv6 * @dst_ipv6: Destination IPv6 address * @src_ipv6: Source IPv6 address - * @dst_addr: Destination MAC address - * @src_addr: Source MAC address - * @port_id: NFP port to output packet on - associated with source IPv6 - * @vlan_tpid: VLAN_TPID match field - * @vlan_tci: VLAN_TCI match field - * @host_ctx: Host context ID to be saved here + * @common: Neighbour/route common info + * @ext: Neighbour/route extended info */ struct nfp_tun_neigh_v6 { struct in6_addr dst_ipv6; struct in6_addr src_ipv6; - u8 dst_addr[ETH_ALEN]; - u8 src_addr[ETH_ALEN]; - __be32 port_id; - __be16 vlan_tpid; - __be16 vlan_tci; - __be32 host_ctx; + struct nfp_tun_neigh common; + struct nfp_tun_neigh_ext ext; }; /** diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c index 0cb016afbab3..174888272a30 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c @@ -281,9 +281,15 @@ static int nfp_flower_xmit_tun_conf(struct nfp_app *app, u8 mtype, u16 plen, void *pdata, gfp_t flag) { + struct nfp_flower_priv *priv = app->priv; struct sk_buff *skb; unsigned char *msg; + if (!(priv->flower_ext_feats & NFP_FL_FEATS_DECAP_V2) && + (mtype == NFP_FLOWER_CMSG_TYPE_TUN_NEIGH || + mtype == NFP_FLOWER_CMSG_TYPE_TUN_NEIGH_V6)) + plen -= sizeof(struct nfp_tun_neigh_ext); + skb = nfp_flower_cmsg_alloc(app, plen, mtype, flag); if (!skb) return -ENOMEM; @@ -416,14 +422,14 @@ static void nfp_tun_write_neigh_v4(struct net_device *netdev, struct nfp_app *app, struct flowi4 *flow, struct neighbour *neigh, gfp_t flag) { - struct nfp_tun_neigh payload; + struct nfp_tun_neigh_v4 payload; u32 port_id; port_id = nfp_flower_get_port_id_from_netdev(app, netdev); if (!port_id) return; - memset(&payload, 0, sizeof(struct nfp_tun_neigh)); + memset(&payload, 0, sizeof(struct nfp_tun_neigh_v4)); payload.dst_ipv4 = flow->daddr; /* If entry has expired send dst IP with all other fields 0. */ @@ -436,15 +442,15 @@ nfp_tun_write_neigh_v4(struct net_device *netdev, struct nfp_app *app, /* Have a valid neighbour so populate rest of entry. */ payload.src_ipv4 = flow->saddr; - ether_addr_copy(payload.src_addr, netdev->dev_addr); - neigh_ha_snapshot(payload.dst_addr, neigh, netdev); - payload.port_id = cpu_to_be32(port_id); + ether_addr_copy(payload.common.src_addr, netdev->dev_addr); + neigh_ha_snapshot(payload.common.dst_addr, neigh, netdev); + payload.common.port_id = cpu_to_be32(port_id); /* Add destination of new route to NFP cache. */ nfp_tun_add_route_to_cache_v4(app, &payload.dst_ipv4); send_msg: nfp_flower_xmit_tun_conf(app, NFP_FLOWER_CMSG_TYPE_TUN_NEIGH, - sizeof(struct nfp_tun_neigh), + sizeof(struct nfp_tun_neigh_v4), (unsigned char *)&payload, flag); } @@ -472,9 +478,9 @@ nfp_tun_write_neigh_v6(struct net_device *netdev, struct nfp_app *app, /* Have a valid neighbour so populate rest of entry. */ payload.src_ipv6 = flow->saddr; - ether_addr_copy(payload.src_addr, netdev->dev_addr); - neigh_ha_snapshot(payload.dst_addr, neigh, netdev); - payload.port_id = cpu_to_be32(port_id); + ether_addr_copy(payload.common.src_addr, netdev->dev_addr); + neigh_ha_snapshot(payload.common.dst_addr, neigh, netdev); + payload.common.port_id = cpu_to_be32(port_id); /* Add destination of new route to NFP cache. */ nfp_tun_add_route_to_cache_v6(app, &payload.dst_ipv6); @@ -1372,7 +1378,7 @@ void nfp_tunnel_config_stop(struct nfp_app *app) struct nfp_flower_priv *priv = app->priv; struct nfp_ipv4_addr_entry *ip_entry; struct nfp_tun_neigh_v6 ipv6_route; - struct nfp_tun_neigh ipv4_route; + struct nfp_tun_neigh_v4 ipv4_route; struct list_head *ptr, *storage; unregister_netevent_notifier(&priv->tun.neigh_nb); @@ -1398,7 +1404,7 @@ void nfp_tunnel_config_stop(struct nfp_app *app) kfree(route_entry); nfp_flower_xmit_tun_conf(app, NFP_FLOWER_CMSG_TYPE_TUN_NEIGH, - sizeof(struct nfp_tun_neigh), + sizeof(struct nfp_tun_neigh_v4), (unsigned char *)&ipv4_route, GFP_KERNEL); } @@ -1412,7 +1418,7 @@ void nfp_tunnel_config_stop(struct nfp_app *app) kfree(route_entry); nfp_flower_xmit_tun_conf(app, NFP_FLOWER_CMSG_TYPE_TUN_NEIGH_V6, - sizeof(struct nfp_tun_neigh), + sizeof(struct nfp_tun_neigh_v6), (unsigned char *)&ipv6_route, GFP_KERNEL); } From patchwork Thu May 5 05:43:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12839070 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4BF9C433FE for ; Thu, 5 May 2022 05:44:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243788AbiEEFsR (ORCPT ); Thu, 5 May 2022 01:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243707AbiEEFrw (ORCPT ); Thu, 5 May 2022 01:47:52 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2097.outbound.protection.outlook.com [40.107.236.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82C6234B9D for ; Wed, 4 May 2022 22:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VMiK3geE8bRcGhgJExO6afeTikaEbRkAxtW04IH9asEVxyM/HCrVp/rVxpcsgjBCNe5PGbMn2F5nzoKvVF+62MlK+z/+GIRaoS+DsRoQIeLbtnkymWbIpnZ7lQdHj/CcY2mId+/yQD6tnH0rgkBfCJnJKiv2h9uytUbWMcTc2HLwck7/3a8w5MNbOEOfIjAkmHRtMGkGbDAI6iX5eTPVSllsS0CecfsnYjhTG+MmOkr/WP0bLHghDfAi6MoFnEzCRjK4Z/wDXc0CnERatI4vI2Jazhje09XgmKgQ/dOsxePGQH1zxCliEwEsJj2x5xn+1yy974TEGWxtEHdjb8zUxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lORqU9Cb+qiwcWB325YwDU1pNMoYERYEOj+eKJg94o4=; b=Eevbp3NN2ErcIAnMunk/PqlrCq+bPPmSgUIA3ol9ZtaG14P5807M7WaXxLxoUQjX+Yf8TUZvWCzHAIwzhuN/kN3vBmL6NRuTPBB5gtrQ7XTPtIxDbzBirnwrwHSLuZLvXFFArz3seTGy9GBT6lNEK1WUQkzrHehKrkPlTZrkBhc+83Ve2cQkBTByxWt/z/VIF7F3gVnKByLHPyIr+IWPa5s0StpuUykLqqo1UwAMHP8Rq7pwbIUvF0M9m3tolkRQVbdtpTtHd+HLjROAXiFZzzfQPkHQGbY8I54RVM9QpVz2Is/x0VdeqX/JvEHgaD5SrEeNSKWAr5YgNn/kg76CtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lORqU9Cb+qiwcWB325YwDU1pNMoYERYEOj+eKJg94o4=; b=MALMBNHImib+Le7ZwYj5jhXsz1CwaBh8yptxgQ4+3G3a7GsZKwYeRZ9RwA9PbtOdzSSjM8Zc8wBM1DN56wRt8ftR2nqQFIQz2/e3qu7tTc/GUpz7HzdZWusWo72Pi717lFqi7HaBDVumFWtc7sfSyXRJliZZCAi8WqF3iv9Q4+o= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by DM5PR13MB1257.namprd13.prod.outlook.com (2603:10b6:3:27::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.16; Thu, 5 May 2022 05:44:12 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94%3]) with mapi id 15.20.5227.006; Thu, 5 May 2022 05:44:11 +0000 From: Simon Horman To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, oss-drivers@corigine.com Subject: [PATCH net-next 6/9] nfp: flower: rework tunnel neighbour configuration Date: Thu, 5 May 2022 14:43:45 +0900 Message-Id: <20220505054348.269511-7-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220505054348.269511-1-simon.horman@corigine.com> References: <20220505054348.269511-1-simon.horman@corigine.com> X-ClientProxiedBy: TYAPR01CA0082.jpnprd01.prod.outlook.com (2603:1096:404:2c::22) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9d7b9d9b-9614-4593-d6ab-08da2e5a480d X-MS-TrafficTypeDiagnostic: DM5PR13MB1257:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4IWp4gBuKSJVrKoH99zHD3vYt0HDnQG1z+3Q+zdHXMWT207eJ3kGhBkyZpHZrNJ2wHz4g05pwd811bV6fiT5jjWdGme3h1xJauAbeEHAter/pUaRMEJNy98+nLDIxyDTtGfQtkhyNWXmHIbf0ZvugCoEi+nnojq99BbHFBE6+DwfaUOFsjXncSvgu0QQI0HbQEKmKC/LgTix/8HnXb0+LUc/xXQ8if/1Z0aOggsWhh+nEMnORH/R3RXZu5gqibEeMmA4KQOjH6sbM8Fc7HB9ifXt1K4yKikaFw/W9E0w1pp+jkZSaFceUzUbBXQSPbwCDN0HUKBM3KH1/ZFTgtCQ9589+gDQ0Pvf8/d8moChbxMIQX0zrpf+5Wv9LUkeXDH8VK8EkVJljC8Mn0RwwSUtgoNRqjXLq5gSz9qCyf1xfAu+9GzN5ETK3Qpl1yywfUlQoexI7vClK6DXl3niCfWcDL8B1FURDwdViLbTxn4tmowvBb4gI9tWrszcnZ3dS2i3Ks679mVA1hvcivG3i47p1loj6+HJ+J7VVUivubfFOEKg/1Rx1+QP+4AIkPG4WU/wfo2s3LcN3XOmQ2vije3Rdojb6rndz1d+E1u+uwyskOVBBqckKOmJgJ+nuPQ3HpZp6E5y53MN8gscajVp4KwqKGwkdRpBM36IADSzN8F4ePc6OZ5DGdD8XNVdqFUJ8Gf4qDz+Ym0PHZhGe50iu8GmKA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(346002)(376002)(136003)(396003)(39830400003)(66556008)(66946007)(6506007)(8676002)(4326008)(5660300002)(52116002)(1076003)(186003)(6486002)(36756003)(2616005)(316002)(110136005)(83380400001)(107886003)(66476007)(6512007)(8936002)(38100700002)(38350700002)(86362001)(508600001)(26005)(6666004)(44832011)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nEJpsEadVez6DyXRuQBRl5Q+ShyVm6Yn6QXzmns7wtE6JY3Q2ikp9lVBT2hSmtqMODhgmKeDqtdGRX6hZ1KbAraa+qu0c4j/4iok8203J2NfHzGg9yA2VUBVS3qt16mUP1hzZQ9cSKooTxpqaRQ75rfTWnchAkUBPzUlk321CMOuJgZmPCVWOfOJLDUIbV4SZgbornXl1ZYwNd/V5/vBZH91NfBZIlEUtM8dz65QtKKQyzI2NzN/QaJcYQh+Xu+eIV09X9mae0a+xs+0/2yAO0mCq8jP3gdn2wrHYWHoi3VGZKPh28UFK+buiXeXj4KgBU7wVwLXa+1iSSb52aWZRYtFdxGpGBk+e1339WCvv5/mgEuaokiblhNbmM+GiwcmOkuLf+d5cy2VNzHHIdthjZhOmdEaAW7mCGbV2mM8ng0PtGbcgOD/ZRneU6IY433+s3lI0xweir3fkttDsD3rTsbANi2LUyI2l/Ub5tedzNLiBo4lUQqS+BX5KNz//DW4TIv1ReQnxyFZikvNvBT3H9hLOYUGSQcCkxsRFyJV/aylkGJZ6Fk0bX36rnN6RoaCHXeURfGJUJfcJfjB7oCxTOdcqV6vUzUig0Stbi6wiacZpdMDO6t+So6jmdQ0V5lzZl2r4dfBPszwgQJVqd/TRTF8G+wWDCXCtiixqdv19N+aDGlifrDLU+UMcZrxrz2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S-Exchange-CrossTenant-Network-Message-Id: 9d7b9d9b-9614-4593-d6ab-08da2e5a480d X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2022 05:44:11.8553 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZTgiDDzVSWJ4dA+mZ1AvTMBQgHV54TThLA+u0AniPOpXwYd7h+vNG1U0dp2iWC7VMDIYaZo74fwQvQAtt3zYnzYrvB5s8jgISRHU2nYmBrg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR13MB1257 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Louis Peens This patch updates the way in which the tunnel neighbour entries are handled. Previously they were mostly send-and-forget, with just the destination IP's cached in a list. This update changes to a scheme where the neighbour entry information is stored in a hash table. The reason for this is that the neighbour table will now also be used on the decapsulation path, whereas previously it was only used for encapsulation. We need to save more of the neighbour information in order to link them with flower flows in follow up patches. Updating of the neighbour table is now also handled by the same function, instead of separate *_write_neigh_vX functions. Signed-off-by: Louis Peens Signed-off-by: Yinjun Zhang Signed-off-by: Simon Horman --- .../netronome/nfp/flower/tunnel_conf.c | 174 ++++++++++++------ 1 file changed, 115 insertions(+), 59 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c index 174888272a30..4ca149501409 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c @@ -419,75 +419,131 @@ nfp_tun_del_route_from_cache_v6(struct nfp_app *app, struct in6_addr *ipv6_addr) } static void -nfp_tun_write_neigh_v4(struct net_device *netdev, struct nfp_app *app, - struct flowi4 *flow, struct neighbour *neigh, gfp_t flag) +nfp_tun_write_neigh(struct net_device *netdev, struct nfp_app *app, + void *flow, struct neighbour *neigh, bool is_ipv6) { - struct nfp_tun_neigh_v4 payload; + bool neigh_invalid = !(neigh->nud_state & NUD_VALID) || neigh->dead; + size_t neigh_size = is_ipv6 ? sizeof(struct nfp_tun_neigh_v6) : + sizeof(struct nfp_tun_neigh_v4); + unsigned long cookie = (unsigned long)neigh; + struct nfp_flower_priv *priv = app->priv; + struct nfp_neigh_entry *nn_entry; u32 port_id; + u8 mtype; port_id = nfp_flower_get_port_id_from_netdev(app, netdev); if (!port_id) return; - memset(&payload, 0, sizeof(struct nfp_tun_neigh_v4)); - payload.dst_ipv4 = flow->daddr; + spin_lock_bh(&priv->predt_lock); + nn_entry = rhashtable_lookup_fast(&priv->neigh_table, &cookie, + neigh_table_params); + if (!nn_entry && !neigh_invalid) { + struct nfp_tun_neigh_ext *ext; + struct nfp_tun_neigh *common; + + nn_entry = kzalloc(sizeof(*nn_entry) + neigh_size, + GFP_ATOMIC); + if (!nn_entry) + goto err; + + nn_entry->payload = (char *)&nn_entry[1]; + nn_entry->neigh_cookie = cookie; + nn_entry->is_ipv6 = is_ipv6; + nn_entry->flow = NULL; + if (is_ipv6) { + struct flowi6 *flowi6 = (struct flowi6 *)flow; + struct nfp_tun_neigh_v6 *payload; + + payload = (struct nfp_tun_neigh_v6 *)nn_entry->payload; + payload->src_ipv6 = flowi6->saddr; + payload->dst_ipv6 = flowi6->daddr; + common = &payload->common; + ext = &payload->ext; + mtype = NFP_FLOWER_CMSG_TYPE_TUN_NEIGH_V6; + } else { + struct flowi4 *flowi4 = (struct flowi4 *)flow; + struct nfp_tun_neigh_v4 *payload; + + payload = (struct nfp_tun_neigh_v4 *)nn_entry->payload; + payload->src_ipv4 = flowi4->saddr; + payload->dst_ipv4 = flowi4->daddr; + common = &payload->common; + ext = &payload->ext; + mtype = NFP_FLOWER_CMSG_TYPE_TUN_NEIGH; + } + ext->host_ctx = cpu_to_be32(U32_MAX); + ext->vlan_tpid = cpu_to_be16(U16_MAX); + ext->vlan_tci = cpu_to_be16(U16_MAX); + ether_addr_copy(common->src_addr, netdev->dev_addr); + neigh_ha_snapshot(common->dst_addr, neigh, netdev); + common->port_id = cpu_to_be32(port_id); + + if (rhashtable_insert_fast(&priv->neigh_table, + &nn_entry->ht_node, + neigh_table_params)) + goto err; + + /* Add entries to the relevant route cache */ + if (is_ipv6) { + struct nfp_tun_neigh_v6 *payload; + + payload = (struct nfp_tun_neigh_v6 *)nn_entry->payload; + nfp_tun_add_route_to_cache_v6(app, &payload->dst_ipv6); + } else { + struct nfp_tun_neigh_v4 *payload; + + payload = (struct nfp_tun_neigh_v4 *)nn_entry->payload; + nfp_tun_add_route_to_cache_v4(app, &payload->dst_ipv4); + } - /* If entry has expired send dst IP with all other fields 0. */ - if (!(neigh->nud_state & NUD_VALID) || neigh->dead) { - nfp_tun_del_route_from_cache_v4(app, &payload.dst_ipv4); + nfp_flower_xmit_tun_conf(app, mtype, neigh_size, + nn_entry->payload, + GFP_ATOMIC); + } else if (nn_entry && neigh_invalid) { + if (is_ipv6) { + struct flowi6 *flowi6 = (struct flowi6 *)flow; + struct nfp_tun_neigh_v6 *payload; + + payload = (struct nfp_tun_neigh_v6 *)nn_entry->payload; + memset(payload, 0, sizeof(struct nfp_tun_neigh_v6)); + payload->dst_ipv6 = flowi6->daddr; + mtype = NFP_FLOWER_CMSG_TYPE_TUN_NEIGH_V6; + nfp_tun_del_route_from_cache_v6(app, + &payload->dst_ipv6); + } else { + struct flowi4 *flowi4 = (struct flowi4 *)flow; + struct nfp_tun_neigh_v4 *payload; + + payload = (struct nfp_tun_neigh_v4 *)nn_entry->payload; + memset(payload, 0, sizeof(struct nfp_tun_neigh_v4)); + payload->dst_ipv4 = flowi4->daddr; + mtype = NFP_FLOWER_CMSG_TYPE_TUN_NEIGH; + nfp_tun_del_route_from_cache_v4(app, + &payload->dst_ipv4); + } /* Trigger ARP to verify invalid neighbour state. */ neigh_event_send(neigh, NULL); - goto send_msg; - } - - /* Have a valid neighbour so populate rest of entry. */ - payload.src_ipv4 = flow->saddr; - ether_addr_copy(payload.common.src_addr, netdev->dev_addr); - neigh_ha_snapshot(payload.common.dst_addr, neigh, netdev); - payload.common.port_id = cpu_to_be32(port_id); - /* Add destination of new route to NFP cache. */ - nfp_tun_add_route_to_cache_v4(app, &payload.dst_ipv4); - -send_msg: - nfp_flower_xmit_tun_conf(app, NFP_FLOWER_CMSG_TYPE_TUN_NEIGH, - sizeof(struct nfp_tun_neigh_v4), - (unsigned char *)&payload, flag); -} + rhashtable_remove_fast(&priv->neigh_table, + &nn_entry->ht_node, + neigh_table_params); -static void -nfp_tun_write_neigh_v6(struct net_device *netdev, struct nfp_app *app, - struct flowi6 *flow, struct neighbour *neigh, gfp_t flag) -{ - struct nfp_tun_neigh_v6 payload; - u32 port_id; + nfp_flower_xmit_tun_conf(app, mtype, neigh_size, + nn_entry->payload, + GFP_ATOMIC); - port_id = nfp_flower_get_port_id_from_netdev(app, netdev); - if (!port_id) - return; - - memset(&payload, 0, sizeof(struct nfp_tun_neigh_v6)); - payload.dst_ipv6 = flow->daddr; - - /* If entry has expired send dst IP with all other fields 0. */ - if (!(neigh->nud_state & NUD_VALID) || neigh->dead) { - nfp_tun_del_route_from_cache_v6(app, &payload.dst_ipv6); - /* Trigger probe to verify invalid neighbour state. */ - neigh_event_send(neigh, NULL); - goto send_msg; + if (nn_entry->flow) + list_del(&nn_entry->list_head); + kfree(nn_entry); } - /* Have a valid neighbour so populate rest of entry. */ - payload.src_ipv6 = flow->saddr; - ether_addr_copy(payload.common.src_addr, netdev->dev_addr); - neigh_ha_snapshot(payload.common.dst_addr, neigh, netdev); - payload.common.port_id = cpu_to_be32(port_id); - /* Add destination of new route to NFP cache. */ - nfp_tun_add_route_to_cache_v6(app, &payload.dst_ipv6); - -send_msg: - nfp_flower_xmit_tun_conf(app, NFP_FLOWER_CMSG_TYPE_TUN_NEIGH_V6, - sizeof(struct nfp_tun_neigh_v6), - (unsigned char *)&payload, flag); + spin_unlock_bh(&priv->predt_lock); + return; + +err: + kfree(nn_entry); + spin_unlock_bh(&priv->predt_lock); + nfp_flower_cmsg_warn(app, "Neighbour configuration failed.\n"); } static int @@ -556,7 +612,7 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event, dst_release(dst); } - nfp_tun_write_neigh_v6(n->dev, app, &flow6, n, GFP_ATOMIC); + nfp_tun_write_neigh(n->dev, app, &flow6, n, true); #else return NOTIFY_DONE; #endif /* CONFIG_IPV6 */ @@ -576,7 +632,7 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event, ip_rt_put(rt); } - nfp_tun_write_neigh_v4(n->dev, app, &flow4, n, GFP_ATOMIC); + nfp_tun_write_neigh(n->dev, app, &flow4, n, false); } #else return NOTIFY_DONE; @@ -619,7 +675,7 @@ void nfp_tunnel_request_route_v4(struct nfp_app *app, struct sk_buff *skb) ip_rt_put(rt); if (!n) goto fail_rcu_unlock; - nfp_tun_write_neigh_v4(n->dev, app, &flow, n, GFP_ATOMIC); + nfp_tun_write_neigh(n->dev, app, &flow, n, false); neigh_release(n); rcu_read_unlock(); return; @@ -661,7 +717,7 @@ void nfp_tunnel_request_route_v6(struct nfp_app *app, struct sk_buff *skb) if (!n) goto fail_rcu_unlock; - nfp_tun_write_neigh_v6(n->dev, app, &flow, n, GFP_ATOMIC); + nfp_tun_write_neigh(n->dev, app, &flow, n, true); neigh_release(n); rcu_read_unlock(); return; From patchwork Thu May 5 05:43:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12839069 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1617C433F5 for ; Thu, 5 May 2022 05:44:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243770AbiEEFsP (ORCPT ); Thu, 5 May 2022 01:48:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243711AbiEEFrx (ORCPT ); Thu, 5 May 2022 01:47:53 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2097.outbound.protection.outlook.com [40.107.236.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3289C35879 for ; Wed, 4 May 2022 22:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BwAPCmomCo6B9XZ8WJ5Vmsf0zSeYNUuzBBCpPqNTGSIKNzWxpY0ldWholUI6uVDfVPt/MuwFfTTQtu01hkcwrfMQQN6SzSbTUUlJOpGiDATUQot1bNUhgwyYWUH7zXXWbp1DovyTHgYiJ+4UWoULLJeRUZniOrPXURS85gYT9ih8s1KJXBsk0CPorDk/PoW+8IDBqNURo0zHlg8MjpUZ2n3zGW1gz31TqGms9FwUPo/iAMmtaAFgb+7mMRBK0A2tzNnVlKMAAI7cc9yS6lYJzjseXT+VE7FPHLtmb2wKXVCpoL777ZRUAJKv2aavkD66gtFWCu4gk7tFQRkYRfQPQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oO1SIZnCiwpQ0hbd/J93xvZtf9I/5IqnH1pY2GPfTU8=; b=iYFg4De7lcyvEN5yxN7i8O2ZeOlG3CXKVQiD0e7XO+C8l4kFOdc2/A1VqROj4iEXUunuH1m3IJ/H9ilpHucUB2yea0CRnaq3kOkReD1iXPbi3Zs61+AM0IRsmKzZkNuAXzNQocNDrH1Nl7L9pOBMJW5v61zoKHpkr2FpC679p3rnGjctsbitI3UDGKq8t3J9t66/UcGl61ZPiBktfwvGYoWVI1SeNMIMWoIvNPHbJnFNZGAdRdDJU8qKEb68+GS1ljDX2ukYx8xfJzXdbL4ZJPLKF9iknchBrOnAOjqxDF1nnN0YkGwmSQYgmVKO4ApchR0Zr9GX4KsOaFNWVbLi5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oO1SIZnCiwpQ0hbd/J93xvZtf9I/5IqnH1pY2GPfTU8=; b=Uj3AHnbIL/pUKyQP7bGJ87JMOrfYXEXTlhbteIGj8O+o84Ri/h5E4jfAKV8cYy+OwwuqxvmKx9rWGJ5j3W+FTcRB7+2I7POyLg9+iiaA5NvpCVbyj56lrApoMlX8NLSuq6IFY6TAvQsgy7PKBk8BK8LRhbxPq+B3PRfdMx6iERI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by DM5PR13MB1257.namprd13.prod.outlook.com (2603:10b6:3:27::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.16; Thu, 5 May 2022 05:44:13 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94%3]) with mapi id 15.20.5227.006; Thu, 5 May 2022 05:44:13 +0000 From: Simon Horman To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, oss-drivers@corigine.com Subject: [PATCH net-next 7/9] nfp: flower: link pre_tun flow rules with neigh entries Date: Thu, 5 May 2022 14:43:46 +0900 Message-Id: <20220505054348.269511-8-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220505054348.269511-1-simon.horman@corigine.com> References: <20220505054348.269511-1-simon.horman@corigine.com> X-ClientProxiedBy: TYAPR01CA0082.jpnprd01.prod.outlook.com (2603:1096:404:2c::22) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b5b0579-c89e-452e-1347-08da2e5a48d6 X-MS-TrafficTypeDiagnostic: DM5PR13MB1257:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oRIEiO+HxJF2h303enoSX67MMABr/dA2Jj5cFQbBTvz0ufXkKf0lCSkqLnJCw9VEkA+dQMsuuofvWS1r4Eawb5vEu3VJ+znyUPLW4wEAd2Y7yFUGa7dS02r5+DjlzLE2DjoUAa1lVrXI8jqin70nTMNLjyQ1llU8d7SAwcfVAuIkholoLyIWSaubLRUJKtvwIsSnmsuwOlxF4ujRZOjhYy6ZEj9nPtEEq5SVd6HSNKnjackoTZdVQBwDw/eIOmhzaTriXx85Q0QkuaS7rvJjEufWZwU0pZN7TL+seiRsRSk5tMR2EFQA6tpfm7nOkpvRjp9icl8tV7Djkcin1rsy+QB450dRbd4/s/W62TFGVxDXVJ6+3jxTWh8dcUW96QU9N/OAw1g1zcxhQtqy0B49nIe6ojIvGKc55umyit+I7oP4lbJiXXNrk3grAfD3DBP3P5YlB0IOCfjf251zWCQlwgNn+VvVbHDYnSIt6g2r4uVCDU8909IQ0IYj3j6NMeOQg5pyQvyeIIL9aMDlSU3QLM5HDc8ZSwVkWUKMyN54QKCfzXdzmWdzxs0Abhmdt8d3DRBN6ZOZC7YtioEg/5KWi7wXiH+BnJS5nWjI9EBLYXS/cixwPB5frTDbs0WQ0hwv5SC9WjUrTa641EnStMqCOkvWD+regbpDTp1D0LV/KWvmvlxiL4ePdVX/IR85Pt9RlcLuuSdK4GaOOFgAORQCeA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(346002)(376002)(136003)(396003)(39830400003)(66556008)(66946007)(6506007)(8676002)(4326008)(5660300002)(52116002)(1076003)(186003)(6486002)(36756003)(2616005)(316002)(110136005)(83380400001)(107886003)(66476007)(6512007)(8936002)(38100700002)(38350700002)(86362001)(508600001)(26005)(6666004)(44832011)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Qd3hSfhWJmO8iHw9kJMdL3ILmlJQgl6Nz40Sb00wOZBg9mGJFJvD2FXBf/ByMEu9sJlkgUTWrN/P5Mlp6F2u6Xg2PuFpsJkeIl/xQ3B/0C+jJ1QHJhh4fHTOgZQVGY+Crm7WIJnSZkaYcpfYpdi5MAPrXWOFvzNfkcgNgI9/zEvoRSyw51IrLmXM4o9wiKNm48u9nVXjci+vNro2AAeK6ghVaqUTQMGqk0MD2lpBvtjzMiXtGC/6qWZgnCA9n8KsZp4PpqS7hvn16yWinvzxkhwxnYtWy84Yhg1L34W00SLhyYxgzqnQ5tBqqiA8Te9dzp8IN1nGK2H92I3AzFGcYCETkGEcJ6RECYO1VsShmt7Ip2Ph4ct2Vk4z2f8iKh35ie7/ptMN2coYJpmorQ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By0z7pXWKxTuJznBDVKGvRL4+BsRC/IGtDT5H5EPFgDX1y8LBtJ+JRd3ZQbytrjwDho5AZovrAneDUv1SRPsfyJL4cCCMrMC7kT2a/vAFG683IDvS+C/RHhQQQx391qk7qH9oJSHPeeIwbGu5V/ft24RmNDVVMb4SJvF6A0/xdr6UMIWQK19gj0zq8UqqK1uj0XdKyKhzICGmQEDb7clCXVjGn031AW8wUUckTCEEx/GWtkDibb+7wdFY4cF5XiJr5mXx9cUD9+0FTL6aJEqJ3S0F0EZQxWSuoTVlNpT9jmtcuc= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b5b0579-c89e-452e-1347-08da2e5a48d6 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2022 05:44:13.2613 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6iqFgfh5LYBmFXXnspgeOPwX4TYwSqbo15oiNeFJB1w5xNSevFY9XIMMRHj7KQ/6wli76quAoPbz+mQH49kyJF7pwHzkL4ay+R8W5PRh4Es= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR13MB1257 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Louis Peens Add helper functions that can create links between flow rules and cached neighbour entries. Also add the relevant calls to these functions. * When a new neighbour entry gets added cycle through the saved pre_tun flow list and link any relevant matches. Update the neighbour table on the nfp with this new information. * When a new pre_tun flow rule gets added iterate through the save neighbour entries and link any relevant matches. Once again update the nfp neighbour table with any new links. * Do the inverse when deleting - remove any created links and also inform the nfp of this. Signed-off-by: Louis Peens Signed-off-by: Yinjun Zhang Signed-off-by: Simon Horman --- .../net/ethernet/netronome/nfp/flower/main.h | 4 + .../ethernet/netronome/nfp/flower/offload.c | 4 +- .../netronome/nfp/flower/tunnel_conf.c | 147 ++++++++++++++++++ 3 files changed, 154 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h index 2c011d60c212..6bc7a9cbf131 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/main.h +++ b/drivers/net/ethernet/netronome/nfp/flower/main.h @@ -675,6 +675,10 @@ void nfp_flower_non_repr_priv_put(struct nfp_app *app, struct net_device *netdev); u32 nfp_flower_get_port_id_from_netdev(struct nfp_app *app, struct net_device *netdev); +void nfp_tun_link_and_update_nn_entries(struct nfp_app *app, + struct nfp_predt_entry *predt); +void nfp_tun_unlink_and_update_nn_entries(struct nfp_app *app, + struct nfp_predt_entry *predt); int nfp_flower_xmit_pre_tun_flow(struct nfp_app *app, struct nfp_fl_payload *flow); int nfp_flower_xmit_pre_tun_del_flow(struct nfp_app *app, diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c index 5fea3e3415fe..9d65459bdba5 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/offload.c +++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c @@ -1402,8 +1402,9 @@ nfp_flower_add_offload(struct nfp_app *app, struct net_device *netdev, INIT_LIST_HEAD(&predt->nn_list); spin_lock_bh(&priv->predt_lock); list_add(&predt->list_head, &priv->predt_list); - spin_unlock_bh(&priv->predt_lock); flow_pay->pre_tun_rule.predt = predt; + nfp_tun_link_and_update_nn_entries(app, predt); + spin_unlock_bh(&priv->predt_lock); } else { err = nfp_flower_xmit_pre_tun_flow(app, flow_pay); } @@ -1590,6 +1591,7 @@ nfp_flower_del_offload(struct nfp_app *app, struct net_device *netdev, predt = nfp_flow->pre_tun_rule.predt; if (predt) { spin_lock_bh(&priv->predt_lock); + nfp_tun_unlink_and_update_nn_entries(app, predt); list_del(&predt->list_head); spin_unlock_bh(&priv->predt_lock); kfree(predt); diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c index 4ca149501409..fa9df24bec27 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c @@ -301,6 +301,150 @@ nfp_flower_xmit_tun_conf(struct nfp_app *app, u8 mtype, u16 plen, void *pdata, return 0; } +static void +nfp_tun_mutual_link(struct nfp_predt_entry *predt, + struct nfp_neigh_entry *neigh) +{ + struct nfp_fl_payload *flow_pay = predt->flow_pay; + struct nfp_tun_neigh_ext *ext; + struct nfp_tun_neigh *common; + + if (flow_pay->pre_tun_rule.is_ipv6 != neigh->is_ipv6) + return; + + /* In the case of bonding it is possible that there might already + * be a flow linked (as the MAC address gets shared). If a flow + * is already linked just return. + */ + if (neigh->flow) + return; + + common = neigh->is_ipv6 ? + &((struct nfp_tun_neigh_v6 *)neigh->payload)->common : + &((struct nfp_tun_neigh_v4 *)neigh->payload)->common; + ext = neigh->is_ipv6 ? + &((struct nfp_tun_neigh_v6 *)neigh->payload)->ext : + &((struct nfp_tun_neigh_v4 *)neigh->payload)->ext; + + if (memcmp(flow_pay->pre_tun_rule.loc_mac, + common->src_addr, ETH_ALEN) || + memcmp(flow_pay->pre_tun_rule.rem_mac, + common->dst_addr, ETH_ALEN)) + return; + + list_add(&neigh->list_head, &predt->nn_list); + neigh->flow = predt; + ext->host_ctx = flow_pay->meta.host_ctx_id; + ext->vlan_tci = flow_pay->pre_tun_rule.vlan_tci; + ext->vlan_tpid = flow_pay->pre_tun_rule.vlan_tpid; +} + +static void +nfp_tun_link_predt_entries(struct nfp_app *app, + struct nfp_neigh_entry *nn_entry) +{ + struct nfp_flower_priv *priv = app->priv; + struct nfp_predt_entry *predt, *tmp; + + list_for_each_entry_safe(predt, tmp, &priv->predt_list, list_head) { + nfp_tun_mutual_link(predt, nn_entry); + } +} + +void nfp_tun_link_and_update_nn_entries(struct nfp_app *app, + struct nfp_predt_entry *predt) +{ + struct nfp_flower_priv *priv = app->priv; + struct nfp_neigh_entry *nn_entry; + struct rhashtable_iter iter; + size_t neigh_size; + u8 type; + + rhashtable_walk_enter(&priv->neigh_table, &iter); + rhashtable_walk_start(&iter); + while ((nn_entry = rhashtable_walk_next(&iter)) != NULL) { + if (IS_ERR(nn_entry)) + continue; + nfp_tun_mutual_link(predt, nn_entry); + neigh_size = nn_entry->is_ipv6 ? + sizeof(struct nfp_tun_neigh_v6) : + sizeof(struct nfp_tun_neigh_v4); + type = nn_entry->is_ipv6 ? NFP_FLOWER_CMSG_TYPE_TUN_NEIGH_V6 : + NFP_FLOWER_CMSG_TYPE_TUN_NEIGH; + nfp_flower_xmit_tun_conf(app, type, neigh_size, + nn_entry->payload, + GFP_ATOMIC); + } + rhashtable_walk_stop(&iter); + rhashtable_walk_exit(&iter); +} + +static void nfp_tun_cleanup_nn_entries(struct nfp_app *app) +{ + struct nfp_flower_priv *priv = app->priv; + struct nfp_neigh_entry *neigh; + struct nfp_tun_neigh_ext *ext; + struct rhashtable_iter iter; + size_t neigh_size; + u8 type; + + rhashtable_walk_enter(&priv->neigh_table, &iter); + rhashtable_walk_start(&iter); + while ((neigh = rhashtable_walk_next(&iter)) != NULL) { + if (IS_ERR(neigh)) + continue; + ext = neigh->is_ipv6 ? + &((struct nfp_tun_neigh_v6 *)neigh->payload)->ext : + &((struct nfp_tun_neigh_v4 *)neigh->payload)->ext; + ext->host_ctx = cpu_to_be32(U32_MAX); + ext->vlan_tpid = cpu_to_be16(U16_MAX); + ext->vlan_tci = cpu_to_be16(U16_MAX); + + neigh_size = neigh->is_ipv6 ? + sizeof(struct nfp_tun_neigh_v6) : + sizeof(struct nfp_tun_neigh_v4); + type = neigh->is_ipv6 ? NFP_FLOWER_CMSG_TYPE_TUN_NEIGH_V6 : + NFP_FLOWER_CMSG_TYPE_TUN_NEIGH; + nfp_flower_xmit_tun_conf(app, type, neigh_size, neigh->payload, + GFP_ATOMIC); + + rhashtable_remove_fast(&priv->neigh_table, &neigh->ht_node, + neigh_table_params); + if (neigh->flow) + list_del(&neigh->list_head); + kfree(neigh); + } + rhashtable_walk_stop(&iter); + rhashtable_walk_exit(&iter); +} + +void nfp_tun_unlink_and_update_nn_entries(struct nfp_app *app, + struct nfp_predt_entry *predt) +{ + struct nfp_neigh_entry *neigh, *tmp; + struct nfp_tun_neigh_ext *ext; + size_t neigh_size; + u8 type; + + list_for_each_entry_safe(neigh, tmp, &predt->nn_list, list_head) { + ext = neigh->is_ipv6 ? + &((struct nfp_tun_neigh_v6 *)neigh->payload)->ext : + &((struct nfp_tun_neigh_v4 *)neigh->payload)->ext; + neigh->flow = NULL; + ext->host_ctx = cpu_to_be32(U32_MAX); + ext->vlan_tpid = cpu_to_be16(U16_MAX); + ext->vlan_tci = cpu_to_be16(U16_MAX); + list_del(&neigh->list_head); + neigh_size = neigh->is_ipv6 ? + sizeof(struct nfp_tun_neigh_v6) : + sizeof(struct nfp_tun_neigh_v4); + type = neigh->is_ipv6 ? NFP_FLOWER_CMSG_TYPE_TUN_NEIGH_V6 : + NFP_FLOWER_CMSG_TYPE_TUN_NEIGH; + nfp_flower_xmit_tun_conf(app, type, neigh_size, neigh->payload, + GFP_ATOMIC); + } +} + static bool __nfp_tun_has_route(struct list_head *route_list, spinlock_t *list_lock, void *add, int add_len) @@ -497,6 +641,7 @@ nfp_tun_write_neigh(struct net_device *netdev, struct nfp_app *app, nfp_tun_add_route_to_cache_v4(app, &payload->dst_ipv4); } + nfp_tun_link_predt_entries(app, nn_entry); nfp_flower_xmit_tun_conf(app, mtype, neigh_size, nn_entry->payload, GFP_ATOMIC); @@ -1482,4 +1627,6 @@ void nfp_tunnel_config_stop(struct nfp_app *app) /* Destroy rhash. Entries should be cleaned on netdev notifier unreg. */ rhashtable_free_and_destroy(&priv->tun.offloaded_macs, nfp_check_rhashtable_empty, NULL); + + nfp_tun_cleanup_nn_entries(app); } From patchwork Thu May 5 05:43:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12839072 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B05D5C433FE for ; Thu, 5 May 2022 05:44:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243838AbiEEFsV (ORCPT ); Thu, 5 May 2022 01:48:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243693AbiEEFsL (ORCPT ); Thu, 5 May 2022 01:48:11 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2132.outbound.protection.outlook.com [40.107.101.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 478E03668C for ; Wed, 4 May 2022 22:44:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wvi4uvm54966WL3aygk9FIv3RDsIndkdyzlyK9z1wsoeFzlqzh1bCMZr7Oz+b5C+zM+z0UyI1Wj64XcOG6Mh4+L7e20linRdkxV3SxNr7y0lTNpYKm4HhePVk54YUKat9Whg68fVSbQcSvURkvfNm2Mk30dtndSCxlVrtB/OaUJ7Adt1h2A+0eHV/raWeEMltJ5VSFXzopIWqG1bhXSncqe++Hl2cQI7dH2qdDFvf1UdOTNGyFYSLSvEkMneaIr3Nt3s0ZC0csdLCPYIp/lkW9KQyMzoqNaqFFJQ0kBIYberCdsdveuil3hEAAVmUyp7/hNIIf/2tXkKKCy4agc7nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=y6aVqBVuhRwfmRvLArZDnJwXNj5RM8fqRI9nPobCLao=; b=T95knBMeyqwX+GCPnuFVP7fOm2SD7k1SnuYbmHOu+wT7/yL/dq0sqXQZ+WgYYVXL2wmGMqlk7WbqifCQUxwGNVSW0tH9WlkI1mRMKUZZfzmnzkykGJi/+ocjff3o61pANp1parjBwsv5qX5G1loGWBCKP12Dc94gNQCTMiFSzZ6fckkuzy3vUXpbWYaEkFyBXrVBUs7GUEVJ13vSJfNKpuXd9MSUbGDjNDswuMRN3WKCRATJL6KUDkflfgroEPEASikR3dyGS3iOZbxWCZ9IE+fL3xCXu/EMXAu11vzw4hPxA0dIMY+09fwpZFuosPq9Pcr850uIWKbl40Lma+j5dA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y6aVqBVuhRwfmRvLArZDnJwXNj5RM8fqRI9nPobCLao=; b=kWMKVKtigYcsjp9J3j0LhdGqY+yQEzd0ESxoSkG0f9IE94WpWYljl1/Zcdx9UHd3p7uon0oVM7EClJtvKVcp+JofpsrAd7LHnPkdAFBNPIWUeohASFzoXO271eG7sRnW3De2015UL+KbKmcyM2UnQF46onVfRmHUjkOcHRXXZTM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by BN8PR13MB2609.namprd13.prod.outlook.com (2603:10b6:408:82::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.14; Thu, 5 May 2022 05:44:14 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94%3]) with mapi id 15.20.5227.006; Thu, 5 May 2022 05:44:14 +0000 From: Simon Horman To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, oss-drivers@corigine.com Subject: [PATCH net-next 8/9] nfp: flower: remove unused neighbour cache Date: Thu, 5 May 2022 14:43:47 +0900 Message-Id: <20220505054348.269511-9-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220505054348.269511-1-simon.horman@corigine.com> References: <20220505054348.269511-1-simon.horman@corigine.com> X-ClientProxiedBy: TYAPR01CA0082.jpnprd01.prod.outlook.com (2603:1096:404:2c::22) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 63c8fe05-352f-4e0c-2142-08da2e5a499c X-MS-TrafficTypeDiagnostic: BN8PR13MB2609:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vG3LFtOIPkgG6lDVYgfJzbpXe1QmKQIOnaSicFUeJd1m4GW9T1Cc1E7A95sRtoHN/LJwrrfIwyVb4OfRwp1JBsZc/l2etWx4MWU/2EuWW0+la8jIWz6yYsBUuXPRc2PNNDNA/NTcVnXFAaXJC8+wpQHQ9Lm7JYXE67RTzVyzCag/Z8HpzS0TmePdL/A7FCfrTF615crenO40enVjVBPDKKewSKz71PHDHLzjp/YJ01YX/tgVQnH2uv3jJvpiOeEGrJ5GufHg0xfR7nl1c00yewlInkMBXlcX2dHNT90HT5d9aj5UZVIi4oNgI4Z+pDzXFbHxD57JB5oXTKKPXLlqUUcDYYo2s7alxSJMQHq4cPKTvvC9KO7JuxgtNNIeyY2AZiNG7rGqB3jgjLaYcO34+lg3KLRDOTHeGzus894DSxSgwQ77K4ZSKBV1M7ifFPxEwJwdWagFz7zUB5WdF0yR7iwby8S5UWGVJrKpAO2/IlHgpdJCzDsZt9u+OQyT78GO6soIG39k8ETtBzcNPcyjI7B1mHMksrGP9i7b8uoZvYgx2JvrZ2P1McsbSUqTibGAZsdEoQkhM0lEoaV2bnrts2bXA2naXgGjSO5pxWTQsuiSJRAsK7M6x9rII3tvHYFhlAyi0RwJJYjzMsNP0tVNPXhjMN2IUI9WBUvJCHwVyQ8x4dygmbmwUR6ikw6QnZAHXW7nKb51mLIu8XUzHTShBg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(396003)(366004)(376002)(346002)(136003)(39830400003)(6666004)(6486002)(38100700002)(38350700002)(44832011)(5660300002)(316002)(508600001)(2906002)(36756003)(86362001)(186003)(52116002)(2616005)(6506007)(6512007)(26005)(83380400001)(8936002)(66476007)(66556008)(66946007)(8676002)(4326008)(1076003)(107886003)(110136005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sl4zT6eI+HbzEJGQU8N0X4Y5sy4xXyEt0P0INN9ZknnrXPBOb27fsNKSgOdyepwDe5/G+7dNgqNDPvqfxFgg6LD2LgoLnztxWN5B2QJBUdsnP9hL5icI8sTnTyHSFJyvtjOXSWr+bMvtbHaRNutmOen//eX736JWAK9hnGxPDF7Eto2YS3SKDR/bbkQURBtp83v13K5AZyS95nyJ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QimKQMilSUd1EW+RsVBQlERVskPLz3M0R9KG+lEm6ddiRtCKVoIdtI5TRLQqgcz1/h7WLw9leVlMO8ERtkC69D1yimY1Z2oqgVq7obr4y2T58Saw30JPNfc4NmpcuoCNyV3X9ATqnI1ULOMhtUOYr3pi7TFNrtuTDDDdxVk1ByAF2Xi6ZZdj/SFd1HUgiLLLaGGJ/ANEYsgwT2yRq+ntRUK7Z64spQyl52pB+79rfLnF9S+21SlF65BSyBHvp4yzCyeu06U4AeMuk5J+jXsNz1z8iitQ8/hfHYmCThRWJlHpAfbV4SogsZK1lExPC9aWMmG5sqt/EhepKeKa0HE7bt/tks/vzu5r8gmnLHe79BVOsW0aIBStY3eUOnNMdQgJ63V10bAp7H0fwu2G3qa0u23BcrH1HM1Aydo5sUriXxcqHfciWNnrN0mKYFTZVS61LfUsm12Z+VUrrvi8SI0Q3yS88kAhmixU6ZasJvm3Zfo5dAZYa5oB8t9jHhw= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 63c8fe05-352f-4e0c-2142-08da2e5a499c X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2022 05:44:14.4187 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FppAl52WoUFznMphKXmNuGHGFNu7g9DoCilrzjT7KcqtUc3V7fmLEgjLv4TQ9ahBUfxQtBNHc6LEkRQU4jZpKwZbQbyDrxerO7DbEMS6FGI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR13MB2609 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Louis Peens With the neighbour entries now stored in a dedicated table there is no use to make use of the tunnel route cache anymore, so remove this. Signed-off-by: Louis Peens Signed-off-by: Yinjun Zhang Signed-off-by: Simon Horman --- .../net/ethernet/netronome/nfp/flower/main.h | 8 - .../netronome/nfp/flower/tunnel_conf.c | 175 ------------------ 2 files changed, 183 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h index 6bc7a9cbf131..66f847414693 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/main.h +++ b/drivers/net/ethernet/netronome/nfp/flower/main.h @@ -87,12 +87,8 @@ struct nfp_fl_stats_id { * @offloaded_macs: Hashtable of the offloaded MAC addresses * @ipv4_off_list: List of IPv4 addresses to offload * @ipv6_off_list: List of IPv6 addresses to offload - * @neigh_off_list_v4: List of IPv4 neighbour offloads - * @neigh_off_list_v6: List of IPv6 neighbour offloads * @ipv4_off_lock: Lock for the IPv4 address list * @ipv6_off_lock: Lock for the IPv6 address list - * @neigh_off_lock_v4: Lock for the IPv4 neighbour address list - * @neigh_off_lock_v6: Lock for the IPv6 neighbour address list * @mac_off_ids: IDA to manage id assignment for offloaded MACs * @neigh_nb: Notifier to monitor neighbour state */ @@ -100,12 +96,8 @@ struct nfp_fl_tunnel_offloads { struct rhashtable offloaded_macs; struct list_head ipv4_off_list; struct list_head ipv6_off_list; - struct list_head neigh_off_list_v4; - struct list_head neigh_off_list_v6; struct mutex ipv4_off_lock; struct mutex ipv6_off_lock; - spinlock_t neigh_off_lock_v4; - spinlock_t neigh_off_lock_v6; struct ida mac_off_ids; struct notifier_block neigh_nb; }; diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c index fa9df24bec27..9c37ed6943d0 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c @@ -445,123 +445,6 @@ void nfp_tun_unlink_and_update_nn_entries(struct nfp_app *app, } } -static bool -__nfp_tun_has_route(struct list_head *route_list, spinlock_t *list_lock, - void *add, int add_len) -{ - struct nfp_offloaded_route *entry; - - spin_lock_bh(list_lock); - list_for_each_entry(entry, route_list, list) - if (!memcmp(entry->ip_add, add, add_len)) { - spin_unlock_bh(list_lock); - return true; - } - spin_unlock_bh(list_lock); - return false; -} - -static int -__nfp_tun_add_route_to_cache(struct list_head *route_list, - spinlock_t *list_lock, void *add, int add_len) -{ - struct nfp_offloaded_route *entry; - - spin_lock_bh(list_lock); - list_for_each_entry(entry, route_list, list) - if (!memcmp(entry->ip_add, add, add_len)) { - spin_unlock_bh(list_lock); - return 0; - } - - entry = kmalloc(struct_size(entry, ip_add, add_len), GFP_ATOMIC); - if (!entry) { - spin_unlock_bh(list_lock); - return -ENOMEM; - } - - memcpy(entry->ip_add, add, add_len); - list_add_tail(&entry->list, route_list); - spin_unlock_bh(list_lock); - - return 0; -} - -static void -__nfp_tun_del_route_from_cache(struct list_head *route_list, - spinlock_t *list_lock, void *add, int add_len) -{ - struct nfp_offloaded_route *entry; - - spin_lock_bh(list_lock); - list_for_each_entry(entry, route_list, list) - if (!memcmp(entry->ip_add, add, add_len)) { - list_del(&entry->list); - kfree(entry); - break; - } - spin_unlock_bh(list_lock); -} - -static bool nfp_tun_has_route_v4(struct nfp_app *app, __be32 *ipv4_addr) -{ - struct nfp_flower_priv *priv = app->priv; - - return __nfp_tun_has_route(&priv->tun.neigh_off_list_v4, - &priv->tun.neigh_off_lock_v4, ipv4_addr, - sizeof(*ipv4_addr)); -} - -static bool -nfp_tun_has_route_v6(struct nfp_app *app, struct in6_addr *ipv6_addr) -{ - struct nfp_flower_priv *priv = app->priv; - - return __nfp_tun_has_route(&priv->tun.neigh_off_list_v6, - &priv->tun.neigh_off_lock_v6, ipv6_addr, - sizeof(*ipv6_addr)); -} - -static void -nfp_tun_add_route_to_cache_v4(struct nfp_app *app, __be32 *ipv4_addr) -{ - struct nfp_flower_priv *priv = app->priv; - - __nfp_tun_add_route_to_cache(&priv->tun.neigh_off_list_v4, - &priv->tun.neigh_off_lock_v4, ipv4_addr, - sizeof(*ipv4_addr)); -} - -static void -nfp_tun_add_route_to_cache_v6(struct nfp_app *app, struct in6_addr *ipv6_addr) -{ - struct nfp_flower_priv *priv = app->priv; - - __nfp_tun_add_route_to_cache(&priv->tun.neigh_off_list_v6, - &priv->tun.neigh_off_lock_v6, ipv6_addr, - sizeof(*ipv6_addr)); -} - -static void -nfp_tun_del_route_from_cache_v4(struct nfp_app *app, __be32 *ipv4_addr) -{ - struct nfp_flower_priv *priv = app->priv; - - __nfp_tun_del_route_from_cache(&priv->tun.neigh_off_list_v4, - &priv->tun.neigh_off_lock_v4, ipv4_addr, - sizeof(*ipv4_addr)); -} - -static void -nfp_tun_del_route_from_cache_v6(struct nfp_app *app, struct in6_addr *ipv6_addr) -{ - struct nfp_flower_priv *priv = app->priv; - - __nfp_tun_del_route_from_cache(&priv->tun.neigh_off_list_v6, - &priv->tun.neigh_off_lock_v6, ipv6_addr, - sizeof(*ipv6_addr)); -} - static void nfp_tun_write_neigh(struct net_device *netdev, struct nfp_app *app, void *flow, struct neighbour *neigh, bool is_ipv6) @@ -628,19 +511,6 @@ nfp_tun_write_neigh(struct net_device *netdev, struct nfp_app *app, neigh_table_params)) goto err; - /* Add entries to the relevant route cache */ - if (is_ipv6) { - struct nfp_tun_neigh_v6 *payload; - - payload = (struct nfp_tun_neigh_v6 *)nn_entry->payload; - nfp_tun_add_route_to_cache_v6(app, &payload->dst_ipv6); - } else { - struct nfp_tun_neigh_v4 *payload; - - payload = (struct nfp_tun_neigh_v4 *)nn_entry->payload; - nfp_tun_add_route_to_cache_v4(app, &payload->dst_ipv4); - } - nfp_tun_link_predt_entries(app, nn_entry); nfp_flower_xmit_tun_conf(app, mtype, neigh_size, nn_entry->payload, @@ -654,8 +524,6 @@ nfp_tun_write_neigh(struct net_device *netdev, struct nfp_app *app, memset(payload, 0, sizeof(struct nfp_tun_neigh_v6)); payload->dst_ipv6 = flowi6->daddr; mtype = NFP_FLOWER_CMSG_TYPE_TUN_NEIGH_V6; - nfp_tun_del_route_from_cache_v6(app, - &payload->dst_ipv6); } else { struct flowi4 *flowi4 = (struct flowi4 *)flow; struct nfp_tun_neigh_v4 *payload; @@ -664,8 +532,6 @@ nfp_tun_write_neigh(struct net_device *netdev, struct nfp_app *app, memset(payload, 0, sizeof(struct nfp_tun_neigh_v4)); payload->dst_ipv4 = flowi4->daddr; mtype = NFP_FLOWER_CMSG_TYPE_TUN_NEIGH; - nfp_tun_del_route_from_cache_v4(app, - &payload->dst_ipv4); } /* Trigger ARP to verify invalid neighbour state. */ neigh_event_send(neigh, NULL); @@ -734,11 +600,6 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event, !nfp_flower_internal_port_can_offload(app, n->dev)) return NOTIFY_DONE; - /* Only concerned with changes to routes already added to NFP. */ - if ((ipv6 && !nfp_tun_has_route_v6(app, &flow6.daddr)) || - (!ipv6 && !nfp_tun_has_route_v4(app, &flow4.daddr))) - return NOTIFY_DONE; - #if IS_ENABLED(CONFIG_INET) if (ipv6) { #if IS_ENABLED(CONFIG_IPV6) @@ -1557,10 +1418,6 @@ int nfp_tunnel_config_start(struct nfp_app *app) INIT_LIST_HEAD(&priv->tun.ipv6_off_list); /* Initialise priv data for neighbour offloading. */ - spin_lock_init(&priv->tun.neigh_off_lock_v4); - INIT_LIST_HEAD(&priv->tun.neigh_off_list_v4); - spin_lock_init(&priv->tun.neigh_off_lock_v6); - INIT_LIST_HEAD(&priv->tun.neigh_off_list_v6); priv->tun.neigh_nb.notifier_call = nfp_tun_neigh_event_handler; err = register_netevent_notifier(&priv->tun.neigh_nb); @@ -1575,11 +1432,8 @@ int nfp_tunnel_config_start(struct nfp_app *app) void nfp_tunnel_config_stop(struct nfp_app *app) { - struct nfp_offloaded_route *route_entry, *temp; struct nfp_flower_priv *priv = app->priv; struct nfp_ipv4_addr_entry *ip_entry; - struct nfp_tun_neigh_v6 ipv6_route; - struct nfp_tun_neigh_v4 ipv4_route; struct list_head *ptr, *storage; unregister_netevent_notifier(&priv->tun.neigh_nb); @@ -1595,35 +1449,6 @@ void nfp_tunnel_config_stop(struct nfp_app *app) mutex_destroy(&priv->tun.ipv6_off_lock); - /* Free memory in the route list and remove entries from fw cache. */ - list_for_each_entry_safe(route_entry, temp, - &priv->tun.neigh_off_list_v4, list) { - memset(&ipv4_route, 0, sizeof(ipv4_route)); - memcpy(&ipv4_route.dst_ipv4, &route_entry->ip_add, - sizeof(ipv4_route.dst_ipv4)); - list_del(&route_entry->list); - kfree(route_entry); - - nfp_flower_xmit_tun_conf(app, NFP_FLOWER_CMSG_TYPE_TUN_NEIGH, - sizeof(struct nfp_tun_neigh_v4), - (unsigned char *)&ipv4_route, - GFP_KERNEL); - } - - list_for_each_entry_safe(route_entry, temp, - &priv->tun.neigh_off_list_v6, list) { - memset(&ipv6_route, 0, sizeof(ipv6_route)); - memcpy(&ipv6_route.dst_ipv6, &route_entry->ip_add, - sizeof(ipv6_route.dst_ipv6)); - list_del(&route_entry->list); - kfree(route_entry); - - nfp_flower_xmit_tun_conf(app, NFP_FLOWER_CMSG_TYPE_TUN_NEIGH_V6, - sizeof(struct nfp_tun_neigh_v6), - (unsigned char *)&ipv6_route, - GFP_KERNEL); - } - /* Destroy rhash. Entries should be cleaned on netdev notifier unreg. */ rhashtable_free_and_destroy(&priv->tun.offloaded_macs, nfp_check_rhashtable_empty, NULL); From patchwork Thu May 5 05:43:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12839071 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28D8DC433F5 for ; Thu, 5 May 2022 05:44:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243818AbiEEFsT (ORCPT ); Thu, 5 May 2022 01:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243729AbiEEFsL (ORCPT ); Thu, 5 May 2022 01:48:11 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2132.outbound.protection.outlook.com [40.107.101.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76BBC369F0 for ; Wed, 4 May 2022 22:44:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BHf+rg0gR5YpjhwZ1oczmWKjV/5TK2AHgPsujZc0yyrrNfr3duPsSb2DLNDHiqCG03gnWm5zKIiEVJ3MI/14Sc2rUwOpkv1KfQjUkxEbwQ3iLxGrB1512iKCu8jSOQr6KzVZgHRlVpIljBTtxiP+NMmJuBKfjgl6pcXYzWvjWhrqzIJA3n367um9omMS6OAWBd3TdKUiHml8jz7ajYvW1bBj5LlQVUb4jLuxp18SetWZ2Zft4DRtrTplO/wATXJjANgrg4U3nE3XJhxcOHzYL1hNeR2V60vnMm26Jcdtc6ugUzo3nY8dRVnfoy3d69qabYwMUY7NK9nmo8Q4tQoiyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lQUqytnT1r7TioqCsB2Nh/ckTb4QQUdzmxs8OgmdxdY=; b=XiY1/z+usbMJb02VtSyYGsV88ExIWgO6N9D+ZYvFjrlekx33lvH2ioJZOspWrNgeycGVLuuMMkDD88hsyPLWQK+1gHL54iVPwsKNAPySXSf8TaztfLrKB03UCoNNbxS7MQuI30LBgWPv77uioRsKCqrPXoAodZYGLhi1M6ZGDhRPqq9H/6M8Jc5ZkCOGvFn4/+xx1C/3M21pNrw2rVnikCmNMXNkDXfpsxIlWgh05NJ6M5KzngQqF+aIxtgYRExQTnSJzKcudPr2z/VpHzRZsLy+8leStFpOBm90bVDWllwPuiW58rkYS20kGmCSjg6tbqnmLe2arP9SkeUiAWq6sw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lQUqytnT1r7TioqCsB2Nh/ckTb4QQUdzmxs8OgmdxdY=; b=uuYCvjVHp8tnxP6l73BWT4jLaCcg6kP4gLAznHMZtW5UIOD+hCNTQnELPEomDdqsc/3A4doZ641tdIso3u9nptlYPKIwqwBVj0W6b4kaDH/nZLcamqCjUU8P5Xeabugtz6P7Ekk0RD+0/ogQIzI4mWmcNGtpV/SxXxOA/6EPGjI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by BN8PR13MB2609.namprd13.prod.outlook.com (2603:10b6:408:82::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.14; Thu, 5 May 2022 05:44:16 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::8808:1c60:e9cb:1f94%3]) with mapi id 15.20.5227.006; Thu, 5 May 2022 05:44:15 +0000 From: Simon Horman To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, oss-drivers@corigine.com Subject: [PATCH net-next 9/9] nfp: flower: enable decap_v2 bit Date: Thu, 5 May 2022 14:43:48 +0900 Message-Id: <20220505054348.269511-10-simon.horman@corigine.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220505054348.269511-1-simon.horman@corigine.com> References: <20220505054348.269511-1-simon.horman@corigine.com> X-ClientProxiedBy: TYAPR01CA0082.jpnprd01.prod.outlook.com (2603:1096:404:2c::22) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 54fe2472-f992-4863-7467-08da2e5a4a58 X-MS-TrafficTypeDiagnostic: BN8PR13MB2609:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gZqdPoJWxn6EGYj0nnGlAL8R1zCYjTnL8PWTCn2TPqUmtjLJpcChN6/IMj0SFO3A1phhz+Od0YD56DnANtTfSW9JThj7xZZNH3woOG8keXdwrfbdWESshIMSkbNa34/pYID2iMbpaghrwOTaSuTE2pOsRGY+6DfcFs5mXm/RapguYxpFbfesFDPPgYwo5vFYRymvcrF9id7pw9gX2MfYE+zUK7BRpOPms3lSWlO9FLUoPpE34paLJve38vmHd8ZwWknoENkVv/F6EnlA2WdUNSeiQi+zegVe/TtBa/FDnUXNv8SQcWt9wAfs7iQ5YF2BBar11bdysH+vr3jpQs65I4749yEhyuvBu7JEO41bi50cCDymkG2i+AdKsMBgK3PH3Rgb5Ztk7O7nouLlDn5RyH2e/mJWFotZAvMvsq1WaW9G5Be+rrprcGWwnhW1CzO4LFwNMLrp7MqLsy96yL8HqbHD1e4CL2NBU5dpOaCEqG5mi0dINJxodHStsaG6XY0Q7m+6B1ZBjXJ6FBqMifPTpmorgsz/+VlUEkophXldJ4nkAbL/6aFvFDZ6O1lszZAc1EgmwBdSswInHaSSUNh5V6f7z8LC5XRnfRg2AXfIjhaEknJqMWgEddKwqtPO2aesqgrn+YvFP1LN2iwYv+Z0C211oqsFjuoYsAf3wQ6uJZ5xEEnBCxDjWItt+AStJWNaMWIs1YyGPLEXKU86hiaicw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(396003)(366004)(376002)(346002)(136003)(39830400003)(6666004)(6486002)(38100700002)(38350700002)(44832011)(4744005)(5660300002)(316002)(508600001)(2906002)(36756003)(86362001)(186003)(52116002)(2616005)(6506007)(6512007)(26005)(83380400001)(8936002)(66476007)(66556008)(66946007)(8676002)(4326008)(1076003)(107886003)(110136005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uv4DVXyk0Y2reWE4S+od63JkwV9K2oBiR8/Hl2XRbPYeB9pptN1CKmbh4COk/LtJc5i27NvktkrNb+khtZJ5mWMtr9h1/QOiTkidJCKUYfVXWxOFQBq5Pysce5wZ6Sm5Yyy2Peyv5QB6SSRsIcH6HBkAnyyU75zNHa7iAY5755+9tpxeBPe3unyCFC7+/Ommz46V+3WSWK89vr7V5LhTOR2sigTxczW/enYcbqo+4RfZoYwE02AmzngWunF7nT7LbdxxRtPmSVuX5YsELT4hxkjtX4MalSUD+bUIhmY3VYL6evMfwZ71q6Fi7smIfJe05OHARlvg+A3VJcC+5X69Phag3trLvonB1UDz7mHFx9opwqAOr2qJXMQPVotJSXviEW/29eKUhNjRiqe3qAuyqyoZwNZNaEw3aCQLctmD6npmu9ftKNyV2j3tMdI+GwpX+dDnGx3gNdVlMCQhlle60eUZEMN1cjuVefpbl4eTxvwu4Cxy8bleIz6hGCw6xWePHkhn8oNCIgHRLM0uK5IABwrqDrz+iW1anSz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wpWVo2Z4OIPaDqEaFrzspFWmceHvbi/M08xk9mQ1CYfZA79OKNLv+w2lYmILHILaR5j83cN5uJIZtfq9dVbSKpEP+bOxx718WBxTFex/htwOZ7VhQWl8CgUDwDAODBjaQjd2n27bUBaikTq1Yod5DgK1a1HEU= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54fe2472-f992-4863-7467-08da2e5a4a58 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2022 05:44:15.7934 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ++VSs1GAGM6eooLiBenSvr1vMiieI3c9ik836OWuuo9NjVWw5aHenTU4CWq1YKjzhh6c1I+o1TKCzEKUzii5QpRsGgIrX+cbPN3OTJtd+7M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR13MB2609 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Louis Peens Finally enable the decap_v2 feature bit now that all the other bits are in place to configure it correctly. Signed-off-by: Louis Peens Signed-off-by: Yinjun Zhang Signed-off-by: Simon Horman --- drivers/net/ethernet/netronome/nfp/flower/main.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h index 66f847414693..cb799d18682d 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/main.h +++ b/drivers/net/ethernet/netronome/nfp/flower/main.h @@ -68,7 +68,8 @@ struct nfp_app; NFP_FL_FEATS_IPV6_TUN | \ NFP_FL_FEATS_VLAN_QINQ | \ NFP_FL_FEATS_QOS_PPS | \ - NFP_FL_FEATS_QOS_METER) + NFP_FL_FEATS_QOS_METER | \ + NFP_FL_FEATS_DECAP_V2) struct nfp_fl_mask_id { struct circ_buf mask_id_free_list;