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 5B567A0032; Sat, 22 Oct 2022 10:27:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 11DF442BC3; Sat, 22 Oct 2022 10:25:47 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2090.outbound.protection.outlook.com [40.107.93.90]) by mails.dpdk.org (Postfix) with ESMTP id B9F2942B93 for ; Sat, 22 Oct 2022 10:25:38 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WmCCAta/iNQmQjtO+0XMsQoJDIBDruVQfQW1YLHVQo/pk/H0WzX9iZ6NBjkrKbNLy+9f+gcqSwCl7BTnB8HpnPIWIxcSrhEwe1M5DMqWsoSLzSnP/EYkZxb1vN/yCDkp9UpbuHFpTjfbbMETSclgTynFgqjaqlpeVP3GeaZsAP5KCeBmvawzUupef0t0DD2FCyzCeHEO2B8Yx4imz5ielhJbps25ehVSp+dTus6HNqIxSwwHPypbsONA4axDfmXqKQnyyuHDQrvYq9lUY7M2XjMdusjeuo++IYb2fkHT518ZAUlMfL4RW89RTtVjWPqOl838yTTYnyzKfG3Y577Xww== 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=nMtqURS0lMg/8oLT76o776zRa9NoNMKfLetH2x537Ps=; b=Z5zXEArbVObr9wfwYZPGm/8uYad+87O4GQL57gs+G2+2xfrN+IkLEX85Wmof+Mq/1a0+LVEgTYUtsX8kkzhKOHsfqCXk+YcPPvPQlviIjOOsP4rYwNfEYVMdmXby+DLUt1GKqdkT0b8OinlNnsd7br3QmRa9r7yLwGEQE6Fcdzej7HAAHveBkzanCtIqxHa9NzCxhOcTwUlwejj/IqU5fBU3NzhGj0gVeU0yHHxCi3yABMgNsdxVLVK1H2WMqryv85aU/lSJZkKmJcUD4DsWeopQ0iay2ouOlaeXeMQDR/4XhKZUG5peFnmRWAVAsminV90UlCzAs9FM9tpuf+4yjA== 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=nMtqURS0lMg/8oLT76o776zRa9NoNMKfLetH2x537Ps=; b=hgTYJD+vvwZITETo6pBH8WOazhScAsytjpDdBPGoBH81N0Kx+GsQE+Y41c2hj2yMDkm4f8/kakXQnkH2ThJepPDkbEqd/NVCp4Bug63biwYw6mAlupMSTjRU/yQLHWeyCSlm3T1+N8XsLRHJQsZnqDba8LhT1pXCdIk2DgE9qTw= 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 MW5PR13MB5535.namprd13.prod.outlook.com (2603:10b6:303:196::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Sat, 22 Oct 2022 08:25:35 +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; Sat, 22 Oct 2022 08:25:35 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v2 22/25] net/nfp: support IPv6 NVGRE flow item Date: Sat, 22 Oct 2022 16:24:26 +0800 Message-Id: <1666427069-10553-23-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666427069-10553-1-git-send-email-chaoyong.he@corigine.com> References: <1666063359-34283-1-git-send-email-chaoyong.he@corigine.com> <1666427069-10553-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR02CA0056.apcprd02.prod.outlook.com (2603:1096:4:54::20) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW5PR13MB5535:EE_ X-MS-Office365-Filtering-Correlation-Id: fbf7d4a9-6837-4a62-40cf-08dab406fdfa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xPM7DQKoFqUdZBBYe3+a2Ri3OrRheXgw8TAYkeGwnH/ZQUDD26lAKEvMRQjNCwguBAUT7KSAE84p3RBA/6wd3z35sdtcppRvSdZkFAMKH/RWz09MjXBr90lSsA44V1EFZHRD0bH7eX/AXoL5COgoTbtyvMd8Hl5+6gcLWn0+MDUve+J7MRxEiycprsQP+dtPRGOFnFRo9N7+QPJZr1MWyUvD11NfFmB2wTgBNaoPHhhP5ljrusBEUPkMSnHdik2W4rDGNZIoWg0yxk3r8mB0HfItbAxsmCaFXePfksZLCQhHXwu0ww4VcBsG7YbRs++ifni/6n+iCT1PrE9Bw6sYe1p+O1tNMfxIsbTEReng3hzNOhBdLbBkLqfSadawBIDm5BcW13p0h9H+cORLir9fwLqShZWGAF3KNO+cSGFyS0ue1QQ/OPYaaOhuU5wxutRogGogFb+6XIdHRWWIf7jjsP+eLWWd4+dHVVj0/KnbokGo7t+c7Q/TPsJx/p5+IJsi6z4Zkz1FU9mGwvsaKmjrhkqJyAPTK0MqqdNFX+ujVYAiA/oNfWHug1nWfpoHVsl7koGi0G5LqwWbDUJ/jDUj9BdRnSGktVjHEz2pWBlJ38ZiLNrNkX1KSGKXtsrPkp7AE6W6YQILONp3iSAwtXG0DgAtAiZNSVrAYsZS3SmdHUL7ypE/S1pre0+u/3e+ZQ6IBPLtoNa56LYLaTUsA4vwzftE8KUU00zx/nMKQl/nJtaxtu9CGbI7zScrDIUnPVvFUIc+1sza9HJpIgVPos0uHQ== 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)(346002)(366004)(396003)(136003)(376002)(39840400004)(451199015)(66946007)(316002)(66556008)(66476007)(6916009)(38100700002)(38350700002)(2906002)(36756003)(8936002)(41300700001)(44832011)(6666004)(4326008)(107886003)(52116002)(6506007)(8676002)(186003)(5660300002)(6512007)(26005)(478600001)(6486002)(2616005)(83380400001)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RUdQNElrTENDOVd5VzJpVFh6RVJxeHJnUEg1NXlqUW9YTmIyb1Nua1ljZ3dG?= =?utf-8?B?aTBXOVBmbDNTUlIxNGJRWHU1VnZUVGFCNUZuQzQ0RUtKaFdQR1UxeklqRWxB?= =?utf-8?B?R3lneU5NZHdHOVNFTUFyOHNTL3ZLNWNqZElWNjJMZVM1ZExmMElmM3RFZUN3?= =?utf-8?B?ZU9LbHRlekFDUHF5MG1mL0JGMThYanlGTVVIaUxlNEZLUVpMSU9CdzJOaTRy?= =?utf-8?B?L21DNTQzTm1zUmlOV0JhWUc2UXZKN0FVYmlpK1gvRFRvMGdCZk9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czkzbEt2WFVmdVBTSVZTZldPeGFLRExycjZ4YW9mUzR2Yi90?= =?utf-8?B?TzNwOHRQbDNLMklVdWhzOEhybERld3BZcFI5NEVsYmtLQ21jc0IxZ21icVpz?= =?utf-8?B?Vmc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: fbf7d4a9-6837-4a62-40cf-08dab406fdfa X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2022 08:25:35.1279 (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: rWyqKSKwcnS/UypSG8DovH1z0Gl9kz8oI5h3thvjMrH0Ir9vPtbAWo8ziGXGHqLvdY8TCFEDj8XM6lmWKZcNfl86tEuAEGKhqhy8V/Ptqcg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR13MB5535 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 0a43bf3..6f21c86 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -822,8 +822,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; @@ -835,6 +836,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: @@ -1562,38 +1574,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) { @@ -1604,12 +1637,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; } @@ -1675,7 +1719,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