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 69789A0543; Tue, 25 Oct 2022 10:02:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A212842836; Tue, 25 Oct 2022 10:00:37 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2090.outbound.protection.outlook.com [40.107.223.90]) by mails.dpdk.org (Postfix) with ESMTP id BB16D42670 for ; Tue, 25 Oct 2022 10:00:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FSv8fNE2Kn7lJnfjhy8yLsLsfBOiLZS2vDM0UAHtvIn4FJYrWX6MOVwZC7/5yFyLlGp/c1/mfwRHEpAvwix7Wdc4FrcsM/xJJXo/fvKH5CUmg3/v9ICIiEBuSPj00KRH4iX+jHYXo2JS2uOeDsy6AiQQKALxG5MsEbAVtyIIpYF2ZANg4UnfMaQV9vNdesAPT2dqQAzCW9XT2R6RBJN13TV+xgpt60KssgoSx5yvsigAa6Cu5L0Xku7ZbouedSMiZvT7pVJRvOtMoBqHG1JaDeShsORkckjBI+9RlSf5/qaMBqLVAKcyJ24bx9yEKG/ZWigEya/k6BTXGT6G+4+nLg== 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=J+z84flUIiETRKz6AVXPxJnwjC2qJLMgZiW7g6zR7O8=; b=CjN6vPXyoY8jGuL1Ev8Zh9x/Y2h08n/uWpVOQFFvjuh4Lqd210QVPT4c6OVbfRjxxKjBtSmsQwIf9fOR8LZFtrR+Zo01KqS7Ff6RdPlWWdPffrdb/BPzrjn8XnUvBaKaJwWyxReEn89xqnD+gL1N6Mv4/2UYl6cBJZL7OqqwBKy6DA6gO+LRDbQwd7i4BSizvTjYX3n+zX8fQho9PTtbkzU0pxKrCvYjGs9bUJs0IQuSbUk40ynWUrfoAQ/YTvWjKdEqaeMDSJohwo8Of7EQgoLqZ816Y9maTInq8tUVfIfT6xS1tQWC0yWEJ7RF6MZY3fUJLzWOkpFNnIuO7o6djQ== 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=J+z84flUIiETRKz6AVXPxJnwjC2qJLMgZiW7g6zR7O8=; b=CRfJTUlqaZfpQJxGDYetw0I/9SLBNJ71XPqoN4DdXOSGIbLbdyhtP9IS38S5OSFQaWfOn0V2xWnWwwXH3QlnRSPmEzWEha84r1LHjwsn+5Cx2IzaIbAykUgXPOpPUAnlc5has0CLLjn4Il6NM/0ZGw/LinzLkeyMAI4kEu4F+ro= 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 MW5PR13MB5439.namprd13.prod.outlook.com (2603:10b6:303:196::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Tue, 25 Oct 2022 08:00:22 +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, 25 Oct 2022 08:00:22 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v3 15/26] net/nfp: support IPv6 GENEVE flow item Date: Tue, 25 Oct 2022 15:59:07 +0800 Message-Id: <20221025075918.7778-16-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20221025075918.7778-1-chaoyong.he@corigine.com> References: <1666427069-10553-1-git-send-email-chaoyong.he@corigine.com> <20221025075918.7778-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR01CA0142.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::22) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW5PR13MB5439:EE_ X-MS-Office365-Filtering-Correlation-Id: 9116965e-ca8a-401a-cf48-08dab65ef75c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m3P0bgEizBRiPEYhrhpN4m3cuVG4hC+CFVDp/ohjB3So+6c3vbhbGPF3he1K9rAXR20E/EMSSNZgsITvcOWw8Z4S2BaI3X0AHG6SkDBiiUtW2/s6jufdpGpH0OOMFf8cE0bwdkSBN5vZiL5NLADzWuD7l4zWIDBxyFztsva9ag1d0ZusSxOkb/3nibxIAZ4Xc+5+jYyv0SWgegv2HptwmInajKKZsKlNsL6brVGM3DJvN1qK7uY8gZ0D13vnozObS4o9Dy72+BR1hk/dBSEzq9q7Bk6gxHc6WWEmhEJELYLXVRSqtyggat0XQI9Y9xDsdcasKGwaZ2PenTXQqC8iWnX9kx+Wd+pusoFlb9v2X19bs9uPKlEMYMHdcHEabDUHXiPlMBzJjf4D1jmGQIp/C83Mq2t9gRG4fm0r+niPVhv+8jFyRhblX3cyLGBLViPXduShfFF9Tjbw/mGXndTbf+EQcJnyHFc9Y35ONt/t88XyOPJ2XnK8c1lpHxRyKLDH2N0Q8+3FP3pWB4U9BmN2cwc4/LV7/rwtLjW2tFrYV/Ul/vo9LLq+q/vpW7Gdv7ph9kKm8JGGZ2vpqBTil+v8QdO0dfSaCks7ujcMVs4y8DloNV/qR7EAdX2vg/5JBdpyYUgV9XgFQIS/8NPMDpmbxk/fPHsSLg71z9fVJw4iplsIwbqjsiJUM+BMRjqiyvdKnuo89/bwl0zIqsilKaD4gB/6vrNvhtRc0qrIiZW/F3ab92gssTUkIH2s3hpHQDJ425pnwtkVQzDR7OunfWHHvg== 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)(39850400004)(366004)(396003)(346002)(376002)(136003)(451199015)(83380400001)(6506007)(478600001)(316002)(38100700002)(52116002)(38350700002)(2906002)(41300700001)(5660300002)(6486002)(44832011)(66946007)(66476007)(4326008)(66556008)(8676002)(6916009)(1076003)(8936002)(6512007)(86362001)(2616005)(26005)(107886003)(6666004)(36756003)(186003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aXhEUGg4SkVQSUZUMFd6R1ZNY1RsLzlCYmNiSDh5Y2F6eFVBRlNxNW8wSE93?= =?utf-8?B?OFIxVytEeWVhK3VSMWFhOWJ0MysrSFpHTFdxUFJOMm1WazdTeVIrNmZWQk92?= =?utf-8?B?elNSakh0UHJFTnQ4ekZUcmZHdEk4dmJzK0xweDBXL1l0Y0hFaDV4UHFBR2FS?= =?utf-8?B?aFZoc0lQY2RXQW5FR3dnRm1MbzRXcmZOaVMvTEVMK25OUm1Ed3gzbGh3UVdw?= =?utf-8?B?ZTdyN0o4SjhQUFBQdjZhbVh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?= =?utf-8?B?NVh4all5cmlQc2ozRWN6SlJ1MkUwR3FzUGlTL09BM2FyV3FpaHRrWVR6RDM3?= =?utf-8?B?RXlIcUdpNXYrZ1JlNFFxVlVWSVBadFVRNWVKRkZXd0NYamhGTGdaK1o1d2Ir?= =?utf-8?B?NEE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9116965e-ca8a-401a-cf48-08dab65ef75c X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 08:00:22.1470 (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: dchp02Dva3cz83yfp9X897pG47j3Mnc2+1reHLTbMAyb5k/sumedlSWLbaztjXdV/M11LX4l/OxgF34nCp0GH7EgoSoJtjGkbmOYRpFgxDQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR13MB5439 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 GENEVE item. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_flow.c | 43 ++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 39ed279778..50e5131f54 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -771,8 +771,9 @@ nfp_flow_key_layers_calculate_items(const struct rte_flow_item items[], break; case RTE_FLOW_ITEM_TYPE_GENEVE: PMD_DRV_LOG(DEBUG, "RTE_FLOW_ITEM_TYPE_GENEVE 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_GENEVE; key_ls->key_layer |= NFP_FLOWER_LAYER_EXT_META; key_ls->key_layer_two |= NFP_FLOWER_LAYER2_GENEVE; @@ -784,6 +785,17 @@ nfp_flow_key_layers_calculate_items(const struct rte_flow_item items[], * in `struct nfp_flower_ipv4_udp_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_udp_tun); + /* + * The outer l3 layer information is + * in `struct nfp_flower_ipv6_udp_tun` + */ + key_ls->key_size -= sizeof(struct nfp_flower_ipv6); + } else { + PMD_DRV_LOG(ERR, "No outer IP layer for GENEVE tunnel."); + return -EINVAL; } break; default: @@ -1415,7 +1427,7 @@ nfp_flow_merge_vxlan(struct nfp_app_fw_flower *app_fw_flower, static int nfp_flow_merge_geneve(__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, const struct nfp_flow_item_proc *proc, @@ -1423,9 +1435,16 @@ nfp_flow_merge_geneve(__rte_unused struct nfp_app_fw_flower *app_fw_flower, __rte_unused bool is_outer_layer) { struct nfp_flower_ipv4_udp_tun *tun4; + struct nfp_flower_ipv6_udp_tun *tun6; + struct nfp_flower_meta_tci *meta_tci; const struct rte_flow_item_geneve *spec; const struct rte_flow_item_geneve *mask; const struct rte_flow_item_geneve *geneve; + struct nfp_flower_ext_meta *ext_meta = NULL; + + meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data; + if (meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_EXT_META) + ext_meta = (struct nfp_flower_ext_meta *)(meta_tci + 1); spec = item->spec; if (spec == NULL) { @@ -1436,12 +1455,24 @@ nfp_flow_merge_geneve(__rte_unused struct nfp_app_fw_flower *app_fw_flower, mask = item->mask ? item->mask : proc->mask_default; geneve = is_mask ? mask : spec; - tun4 = (struct nfp_flower_ipv4_udp_tun *)*mbuf_off; - tun4->tun_id = rte_cpu_to_be_32((geneve->vni[0] << 16) | - (geneve->vni[1] << 8) | (geneve->vni[2])); + if (ext_meta && (rte_be_to_cpu_32(ext_meta->nfp_flow_key_layer2) & + NFP_FLOWER_LAYER2_TUN_IPV6)) { + tun6 = (struct nfp_flower_ipv6_udp_tun *)*mbuf_off; + tun6->tun_id = rte_cpu_to_be_32((geneve->vni[0] << 16) | + (geneve->vni[1] << 8) | (geneve->vni[2])); + } else { + tun4 = (struct nfp_flower_ipv4_udp_tun *)*mbuf_off; + tun4->tun_id = rte_cpu_to_be_32((geneve->vni[0] << 16) | + (geneve->vni[1] << 8) | (geneve->vni[2])); + } geneve_end: - *mbuf_off += sizeof(struct nfp_flower_ipv4_udp_tun); + if (ext_meta && (rte_be_to_cpu_32(ext_meta->nfp_flow_key_layer2) & + NFP_FLOWER_LAYER2_TUN_IPV6)) { + *mbuf_off += sizeof(struct nfp_flower_ipv6_udp_tun); + } else { + *mbuf_off += sizeof(struct nfp_flower_ipv4_udp_tun); + } return 0; } -- 2.29.3