From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 625FDA0560; Tue, 18 Oct 2022 05:25:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF29142BD8; Tue, 18 Oct 2022 05:23:50 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2115.outbound.protection.outlook.com [40.107.100.115]) by mails.dpdk.org (Postfix) with ESMTP id 906EE410E8 for ; Tue, 18 Oct 2022 05:23:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gEaqORcxUYU6jaCF4M7YjPi7wv0emm9THHmx1DlNe/DiS0lI7GTNspr6MWyFyKJEdEeOxEq+3i0Wjl99qOnvFXmswANjXk7SYX3ZoE5V7uL+hmmN0Dh3a7j4xvAjFSlAlLTbRnPuruuFQP1jmpc1V1dhzzrN1fihZiN0C/E7/xA6vkfPpeXBLr3pzj6SL22rrFlJ0eC7vSgv1ubXTMFBKzqtlldHrL15qewdb7VfbENrXL9WpIiJb9S08HgPquQcvvl6ma9J/8YP2Y/R+DAQQbdXgS0CWC3IBSUgAS6Ns0L/6MGQOK/rONZX9sDbJcaP00e98Eb2lZmqe7HLz8uZqg== 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=JuNdgcWt29KnOLvRrPv66rpc1XoLw0Nd3aQodmRcmdg=; b=YwLEOrfz41HCNuWO2OlY5A0aS+DVfsURJXqoBPg3vo/PofucAUSbeszEGrDrXwh4Vx6Jneg4fJFTPFAhI6DSDZ0X4bH6wN+p10ItmIo7H4ehi2bnZ7/PKjFU6gNOIfslDS4q2jc1geCtmkBsXjs1cKSRWxZvsTtU+PCzUOpfZ6yccfSZBxFuPZJf89aJ5zOZNZ5I2VRtSOcyYahR6QZbAQZvydwJ1w7KTL4gEZfec2hnvNDsB0MULTkBirDd2UNIUFZHyOjUqxitbJZRUDRjFQZVBkQ/BqqFP3UJF9O41QEjsaiCjTik9d9dfBd7/1AhQVM4pw0AASiz87aqOMOEzg== 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=JuNdgcWt29KnOLvRrPv66rpc1XoLw0Nd3aQodmRcmdg=; b=d0b51xqgpFZWxHbZGgJ/PSixjvY5dnnM3JmnZ1RYdt/gQPlBv46e6zNKZpJcb93ScsVGv/bSo1Fm+FqCW1dHfJojra/8Rvnwv6XIT3EM4nyFr3oHlJCUJkDasZdhBh8cryT/r4NdhMkqfBU8db9nVCpjcfvWuU4lIu5vhk0sjXI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by MW3PR13MB4122.namprd13.prod.outlook.com (2603:10b6:303:5a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.8; Tue, 18 Oct 2022 03:23:43 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b%4]) with mapi id 15.20.5723.014; Tue, 18 Oct 2022 03:23:43 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH 22/25] net/nfp: add the offload support of IPv6 NVGRE item Date: Tue, 18 Oct 2022 11:22:36 +0800 Message-Id: <1666063359-34283-23-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666063359-34283-1-git-send-email-chaoyong.he@corigine.com> References: <1666063359-34283-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR01CA0184.apcprd01.prod.exchangelabs.com (2603:1096:4:189::9) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW3PR13MB4122:EE_ X-MS-Office365-Filtering-Correlation-Id: 220f2825-0285-4355-3dcf-08dab0b828bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mDgabfRRNrJ+Byg/xyJ7MZEB8jEzFIGkjLIoN+xhraf5WlZHYhaqHOQBR7yrhDaNRJV2XmHCDW89Hs0hMK6d7FILvxMI6q1SZxlA+jBLtQmnIa8Ez2w3b/ia6UfYr1NJYml/lK6luUGZwvVtxDMadiu5uSL3d5eGctQLXWxhaWGvqUzCWMgKF1h0Lwd2GK1C8JfvpsP9eh7inu4yE5E77F/CS1efgKazIaflK7mMdrkSK9vVLNuKnSf/KHZKeGsOVFGw+C4KJ+/kkRGX6aRdMMA+Kfa1dpvYRqANwGWIerTgs03AgqK2Hk4v54i38pcn3wvDAcqGaeer1FpwGrW0bCLVvZeFmUwUMxSzk8W8fCDO2hft/ihv6j+/UcHEZG0gFT0/+9LVLeZP5py12CXRNSrvVfTBS6c5GqJOSxntcl9fC0BRIKRLqZDUCQJgnTMu55QjVHH455J9wILyJV9pKTPeC+JnGr9fIVDoOhsBa+zQ99RBOPGHZOL5yLwu4zslIXPvDteoX81/m5QsqpRC8MQj7Pi0N64l19PZ9g4oqROqQsf/2O+PWdl7OFDA/gzb3J4CTPjMtxAjV9GNl87ErLtbF4T+ChGppPHabj2992z5z4/tnUiRluQqxjKbstr0WZoU5udW1jfxIQ/Z/lCpQYcyhSuYxfZLxJGNHFhglk4BHs5kzrelpzJQpudL2C/Tf2mDTk9OjgXJ+FQb1hRjg7L9uxVJtYkxCg0/PtmwKQfUDtqK8RYB4+Qh9eErR2z1avtYnUxAU52D4gwLx/tNrkfAwH0TTWJZgtoHtgihdj4BFt37NJd84U+yL0yILIEh X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(346002)(366004)(376002)(39840400004)(396003)(451199015)(38100700002)(86362001)(38350700002)(4326008)(8676002)(66556008)(66476007)(66946007)(316002)(6916009)(5660300002)(44832011)(41300700001)(8936002)(2616005)(186003)(2906002)(83380400001)(107886003)(6666004)(6486002)(478600001)(6512007)(52116002)(6506007)(26005)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Q2xKUjJ5VmRmbVdhcFdwaVYxUlJKMkluU2FnMkJrcVRCZk1LdnZrNXRDcC9P?= =?utf-8?B?TnQrMkRtQ3hFZm92TGtTYWVLUGVRL1NWUjlBYWhYUU45T3V5STFKOXc5alpU?= =?utf-8?B?cjZ3QjhUaWhHVUVTQnFpRDdTTHpFZVYwREMxbUJPSWdWOGpqWmNla3FjTG5N?= =?utf-8?B?R0tDM3prbnB2SzljTU5qUUEwSzN5Q3ZtcllNZWZPWVNGSWZjY3dzYnc3RkxL?= =?utf-8?B?eWZvTGZobmdn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4QTc1NGZs?= =?utf-8?B?ZWN4K0xTaEtEU01BWWV6Vy9KT0VqY0hDR3pFemtHMFI2UVlsUnpuOG5KYjV2?= =?utf-8?B?RUNmaExmVHJLM2tVWkJNVldUc1ZQRHVWUEZER2pWTUJxMGdPWEJFWWVzNEFX?= =?utf-8?B?U0E9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 220f2825-0285-4355-3dcf-08dab0b828bb X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 03:23:43.1583 (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: zHqDS0xmUoth5cODwizOmVWkD8+LIEshuHd2OqV4NQk8kP9Dn0M3VsGzm4y3wNlxOnJVqmNHcXx+DE1jLq4W67jc2b4742kU79JXsrn8KdA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR13MB4122 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add the corresponding logics to support the offload of IPv6 NVGRE item. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_flow.c | 73 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 14 deletions(-) diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 94d7a27..9464211 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -834,8 +834,9 @@ struct nfp_pre_tun_entry { break; case RTE_FLOW_ITEM_TYPE_GRE: PMD_DRV_LOG(DEBUG, "RTE_FLOW_ITEM_TYPE_GRE detected"); - /* Clear IPv4 bits */ + /* Clear IPv4 and IPv6 bits */ key_ls->key_layer &= ~NFP_FLOWER_LAYER_IPV4; + key_ls->key_layer &= ~NFP_FLOWER_LAYER_IPV6; key_ls->tun_type = NFP_FL_TUN_GRE; key_ls->key_layer |= NFP_FLOWER_LAYER_EXT_META; key_ls->key_layer_two |= NFP_FLOWER_LAYER2_GRE; @@ -847,6 +848,17 @@ struct nfp_pre_tun_entry { * in `struct nfp_flower_ipv4_gre_tun` */ key_ls->key_size -= sizeof(struct nfp_flower_ipv4); + } else if (outer_ip6_flag) { + key_ls->key_layer_two |= NFP_FLOWER_LAYER2_TUN_IPV6; + key_ls->key_size += sizeof(struct nfp_flower_ipv6_gre_tun); + /* + * The outer l3 layer information is + * in `struct nfp_flower_ipv6_gre_tun` + */ + key_ls->key_size -= sizeof(struct nfp_flower_ipv6); + } else { + PMD_DRV_LOG(ERR, "No outer IP layer for GRE tunnel."); + return -1; } break; case RTE_FLOW_ITEM_TYPE_GRE_KEY: @@ -1580,38 +1592,59 @@ struct nfp_pre_tun_entry { static int nfp_flow_merge_gre(__rte_unused struct nfp_app_fw_flower *app_fw_flower, - __rte_unused struct rte_flow *nfp_flow, + struct rte_flow *nfp_flow, char **mbuf_off, __rte_unused const struct rte_flow_item *item, __rte_unused const struct nfp_flow_item_proc *proc, bool is_mask, __rte_unused bool is_outer_layer) { + struct nfp_flower_meta_tci *meta_tci; + struct nfp_flower_ext_meta *ext_meta; struct nfp_flower_ipv4_gre_tun *tun4; + struct nfp_flower_ipv6_gre_tun *tun6; + + meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data; + ext_meta = (struct nfp_flower_ext_meta *)(meta_tci + 1); /* NVGRE is the only supported GRE tunnel type */ - tun4 = (struct nfp_flower_ipv4_gre_tun *)*mbuf_off; - if (is_mask) - tun4->ethertype = rte_cpu_to_be_16(~0); - else - tun4->ethertype = rte_cpu_to_be_16(0x6558); + if (rte_be_to_cpu_32(ext_meta->nfp_flow_key_layer2) & + NFP_FLOWER_LAYER2_TUN_IPV6) { + tun6 = (struct nfp_flower_ipv6_gre_tun *)*mbuf_off; + if (is_mask) + tun6->ethertype = rte_cpu_to_be_16(~0); + else + tun6->ethertype = rte_cpu_to_be_16(0x6558); + } else { + tun4 = (struct nfp_flower_ipv4_gre_tun *)*mbuf_off; + if (is_mask) + tun4->ethertype = rte_cpu_to_be_16(~0); + else + tun4->ethertype = rte_cpu_to_be_16(0x6558); + } return 0; } static int nfp_flow_merge_gre_key(__rte_unused struct nfp_app_fw_flower *app_fw_flower, - __rte_unused struct rte_flow *nfp_flow, + struct rte_flow *nfp_flow, char **mbuf_off, const struct rte_flow_item *item, - __rte_unused const struct nfp_flow_item_proc *proc, + const struct nfp_flow_item_proc *proc, bool is_mask, __rte_unused bool is_outer_layer) { rte_be32_t tun_key; const rte_be32_t *spec; const rte_be32_t *mask; + struct nfp_flower_meta_tci *meta_tci; + struct nfp_flower_ext_meta *ext_meta; struct nfp_flower_ipv4_gre_tun *tun4; + struct nfp_flower_ipv6_gre_tun *tun6; + + meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data; + ext_meta = (struct nfp_flower_ext_meta *)(meta_tci + 1); spec = item->spec; if (spec == NULL) { @@ -1622,12 +1655,23 @@ struct nfp_pre_tun_entry { mask = item->mask ? item->mask : proc->mask_default; tun_key = is_mask ? *mask : *spec; - tun4 = (struct nfp_flower_ipv4_gre_tun *)*mbuf_off; - tun4->tun_key = tun_key; - tun4->tun_flags = rte_cpu_to_be_16(NFP_FL_GRE_FLAG_KEY); + if (rte_be_to_cpu_32(ext_meta->nfp_flow_key_layer2) & + NFP_FLOWER_LAYER2_TUN_IPV6) { + tun6 = (struct nfp_flower_ipv6_gre_tun *)*mbuf_off; + tun6->tun_key = tun_key; + tun6->tun_flags = rte_cpu_to_be_16(NFP_FL_GRE_FLAG_KEY); + } else { + tun4 = (struct nfp_flower_ipv4_gre_tun *)*mbuf_off; + tun4->tun_key = tun_key; + tun4->tun_flags = rte_cpu_to_be_16(NFP_FL_GRE_FLAG_KEY); + } gre_key_end: - *mbuf_off += sizeof(struct nfp_flower_ipv4_gre_tun); + if (rte_be_to_cpu_32(ext_meta->nfp_flow_key_layer2) & + NFP_FLOWER_LAYER2_TUN_IPV6) + *mbuf_off += sizeof(struct nfp_flower_ipv6_gre_tun); + else + *mbuf_off += sizeof(struct nfp_flower_ipv4_gre_tun); return 0; } @@ -1693,7 +1737,8 @@ struct nfp_pre_tun_entry { [RTE_FLOW_ITEM_TYPE_IPV6] = { .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_TCP, RTE_FLOW_ITEM_TYPE_UDP, - RTE_FLOW_ITEM_TYPE_SCTP), + RTE_FLOW_ITEM_TYPE_SCTP, + RTE_FLOW_ITEM_TYPE_GRE), .mask_support = &(const struct rte_flow_item_ipv6){ .hdr = { .vtc_flow = RTE_BE32(0x0ff00000), -- 1.8.3.1