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 AAF1EA0032; Sat, 22 Oct 2022 10:26:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 955B242B9C; Sat, 22 Oct 2022 10:25:22 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2106.outbound.protection.outlook.com [40.107.244.106]) by mails.dpdk.org (Postfix) with ESMTP id 99C984069B for ; Sat, 22 Oct 2022 10:25:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gCwLa8v/tyAFPjXGsgeUf6l9imljzOiop+HEBhXto+nl7zJUgfHv5Y1z0r+8EBHPKruV5PWmstp9on+U6tBqwEnLMNS3qbMhd12SA5rrfod5h8HEKqRWXKRJmZoMXmQioF2roAMJq4SeESsZE8z1qUpld68pgBgI3CUTDNB0CRacvG+OE6wRqrooCCYSeyc+HlhfgSQgRUAmlcxHfVusAcHOYYCcza3Mq70d5GPHxpZknPSqRrQiGdHERtqXU/Hwl17kCea83U8QzHx2v1Sgc1BVmyGj1hmwyfydBW+bSQ2Kpqe2LlPaKMS0pjNYbJLq6319B4oBsTOoIujzoofHrA== 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=8FinYrn6eb3a8qt++UdJskydxg5uQHlCoIOS9hlhclM=; b=PkSLPBLD7u8g+I4+NZ9dgkSCb5ZGc/NMJPXLyeSmm3ZgaO0cnhndKC+erdqul7yLyTcElPkHN1AetdRUCYU184+qeVoTV7iutvj4nI5n2HwuiYsDunb7hnxwKy69U+HAAzhjwIV0asHOWQ3xuzQVh7913mZwor1EWB/UG/HaWlK/58qvDDQim7zpJ7phrgqdwJ+AhZhcl2tTUivHGqJaGFLBgbLHTV1oUDDIeFMraeSrZjLEhFgf+8HF9g1j/oy2iu5toNjS42pN7yl1OIddf05YqAN4yAo7ayA6+Tf3qXaqxWsrNIUsQ8ixVA2n51M/y1iJubcuHkfhCtWemQ8nqA== 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=8FinYrn6eb3a8qt++UdJskydxg5uQHlCoIOS9hlhclM=; b=PylrXydgjn5/yEaJleqv8qnZrto5qd/+TCZQlZUx2MqKlXtjG03oyo+9OO5OD/XU5AtzgwpV7LmHvdEKEgSy1fgvhU55hzxxpsupi9ud+kSP7UePMgo3c3enNAqaQRVRrgQtv70SgzhSawdWkPp8EC61qcKSeVks+et+M6YLKGQ= 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 DM6PR13MB3690.namprd13.prod.outlook.com (2603:10b6:5:24e::14) 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:16 +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:16 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v2 14/25] net/nfp: support IPv6 GENEVE flow item Date: Sat, 22 Oct 2022 16:24:18 +0800 Message-Id: <1666427069-10553-15-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_|DM6PR13MB3690:EE_ X-MS-Office365-Filtering-Correlation-Id: d500291a-53b6-47b7-52b2-08dab406f278 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tWlMkZIQWhoVJFfZ6MuVAUmChG2Y/JG4dquyOa+QLJqzYoSo2oJDKG7jlkpJXtoojSADHkqRWL9nvT3d0GsmuTi4FwXEoIxvRV6lAU1JpMRrr3qiFaXkRW6hdT1qWSVPql4xmcR71jiF54Y2MfF+a5ILO8Pj98PsTm0qBRm4y8MzCTOD+RIVKf5rxxrHr4TrWSbCQrIgFUXhBnIbc514m6X8zdIVrk918VulZOzht5u1ctVYJktN4TrDpHbmTCnnFBGHEwT4UQ1FCTWSiO8yhvs/3pW5MqGwArj+OctfLvzLySlJ6fv6P/OljO9x/lHh/RXCrotfG7jaVgi+j0NUvgTqb0qoY3dnZQJI0GRZv/qok9L+Q5ltRTH7zSkT5dpjxmTN6z7aaGNQAEZ7hUZx/VHXvgz18j65VpehvA0tYIJaERuU2G4QPb55ogT8GecPdAwCztk7mocZ6N4GL0NBUFOrCexL5TH8uXl9no9zVQHv2N1ONZCt+UgarY/1XmnY31IQftyFse08uXItOqBfRctb+WwMp0K/sSJzy6AQX2Y83/BqUh2Txk7NEb2CsSKn19jb3GTFXRLnwe95flL0SnJ/EfnwFD2KbZw6GTp+B7qupGPdFV56y2hhMO3NIulXHgCSS3c6oYdqaBO3T7V/4WH3thMS5PbJRr/ec4NMvnGVhGD9uBOcaZLLbbknEafprbiUPQDovNCB4AzkgugzlLrlXNz5PauDyouf4JtFRa+fXK85TmbvvbcEEt5WDCr0rGOTnlgwOr8OBygVRO2qBw== 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)(376002)(396003)(366004)(346002)(136003)(39830400003)(451199015)(6916009)(316002)(6506007)(66946007)(4326008)(52116002)(6486002)(8676002)(66556008)(66476007)(107886003)(478600001)(6512007)(2616005)(44832011)(41300700001)(2906002)(8936002)(186003)(26005)(5660300002)(83380400001)(36756003)(38350700002)(86362001)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eWU3c0lZd3hrTlZQWTVuYjIxK0JhODNIUE0wTkh6NWhEcytlSDZBWVlFVDdN?= =?utf-8?B?aGNVNkhzY3cvZlR1S0l6a3ByWWIrUWxFK2k2QzJuUHZZWDljL0Y2WW0ydmVI?= =?utf-8?B?aWl6cjZidVY0ZFB5Q0pkdk56N2YxZW1uRXcyaXlReHAxRFFDQXpVQ3JqTHdy?= =?utf-8?B?V2ErQ1BHdU1kNS9tS0V6NU1yODEyVEpBQ3UraVVOOC9SdWJtNFJTdlVleDdK?= =?utf-8?B?clRPUHNMSHBsV09NRW1HQllPTEwyY0ZzREpQekZ1SWE5ZUJDc2gvVWo3eFVS?= =?utf-8?B?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VXoxWkc2bjNXSFVvVUczVVNwejNEdklD?= =?utf-8?B?SmJPY3c4SXZuS1BXYTZKT0FRa3hxbERtSWpzQlJwanAzMUhsNUhJeC9xenZB?= =?utf-8?B?a1E9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: d500291a-53b6-47b7-52b2-08dab406f278 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:16.0259 (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: AQk1lT0LogH7aQjOzU2s9Ms5AkVFrljwMpVrDRNKYWZeTTRi/Al9GP5HfytHH6mFfQxCRcS3kX6Y117JpfVDb90F1WKP92UDvmAiQAJtX2Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB3690 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 a6adfa5..48a47a6 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -771,8 +771,9 @@ struct nfp_pre_tun_entry { 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 @@ struct nfp_pre_tun_entry { * 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 @@ struct nfp_pre_tun_entry { 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 @@ struct nfp_pre_tun_entry { __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 @@ struct nfp_pre_tun_entry { 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; } -- 1.8.3.1