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 18F24A0560; Tue, 18 Oct 2022 05:24:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C8BCD42BA3; Tue, 18 Oct 2022 05:23:31 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2138.outbound.protection.outlook.com [40.107.92.138]) by mails.dpdk.org (Postfix) with ESMTP id 76D5C42B73 for ; Tue, 18 Oct 2022 05:23:28 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lavakA2L/X2zPS8KdTeHMVvLOnC17qot9Ew4Cf/fqDZ2Zy7fbcHlTPM0LxmjzdhrSwVwSeaqtO+CfaXkTq1e1oJongFa5xyxCFCsv8LAAhR69HM+32VvTxRG7C+EuDsOYXI/2T68riAXT2FP+43WjQ3z+c1eFFUsvwnplnNCfDlzHlZ+rvdFBmSQS6mW2XMYVsh24PNeUIMnoS5D05zRDg31xkWY0UTrTT1ab47j0AHNsDXtmtQySb2kNLQxrOAuSrMUWQvcCjBpb5YwQ2iZeL3o4QmXXlyrll1gIyjB0q4xoOkUo3flFYXiUJ9Y7i8SoZkKfmbz5+Yq8zaDltnwsA== 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=z9sK5XsTPEnjOQORJWm4vyy/OlxNdJCzTFy46kVOJ50=; b=jVTPxiNtA/dMp03TUJ+yvQD3qcOMZy44dEx11mI6owM1fJ5usR6HrzZ2bRw0wNGld29z4Bnqgbfw1DsAau4uLIpWm9W0/0I/qHk+Vcl4VH7eLDzWGchQ8Xxv1APAUA/Sjbiv7jJik/sN/jEe1x7aIoIhQbNo3xodTQtwHtAZgne40epXh02s9Wj7zrU48piEtUmUOgAfbaDq7aI4fC3ah8T6DhYSMBDuNIN03eQkcMcTCb0mpwvYMuQuaS1pJU6hV0XOfXX0XUeqmBkNj0A1OHPXGYidYJvS6Hqy97kbDxW31Z0OQc2bcOeDNvdk/iJznCTIHcb1rTSqUckVYeFOFA== 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=z9sK5XsTPEnjOQORJWm4vyy/OlxNdJCzTFy46kVOJ50=; b=Bf52dG5Fibp8ZrdybkP9tybflSK2hulhlcy6LMF4kOSJ/DqMneRzyKBiygDIWGfQCoXp3Q506ej2r+gHwRsLXaAkz/H73OQyf8iD5HQJmBj14iM+jMmfMHBeFBfpvjOZqU4vdPVXGTdSxoCTagdWB80eN5XIpV8i9ktf8i5CkRI= 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 BL3PR13MB5147.namprd13.prod.outlook.com (2603:10b6:208:33a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Tue, 18 Oct 2022 03:23:27 +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:27 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH 14/25] net/nfp: add the offload support of IPv6 GENEVE item Date: Tue, 18 Oct 2022 11:22:28 +0800 Message-Id: <1666063359-34283-15-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_|BL3PR13MB5147:EE_ X-MS-Office365-Filtering-Correlation-Id: 05b043cc-e826-422e-c45b-08dab0b81eea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VECpru094kK4Be+AYEjAxjNC+i304VbsYI0o0wxegVFFJAsdJtXfzEeFTnS8kCMCNhE+HI4Q2pY08wSKSWUwtfWojgzqR7U2hmGTjYqtD8VsttV3wpBZamYycI6pdKD5PwVy3/ytnzO8f6ekGP92pYMNJBuPqAYOB2iB+4kibIxgBNmBPn7QnvvLdI/OAOGcRiu1TgdUqDsci53UX20jEtGmkjKLxt4DsP953VgUXLU84tK4IfZcRW2OBB0x6KU22eqIeME9ZtC7uXAF07SdUFzdntx/qRki0kFqeZen8Px/iLfoIEPOMj9qIphVq2xbNQl+KCSMuPQu8rEnSVlekQljwU4seJO3n5tliTBcCGGi+v1oFga27vuFVox6arNnhYjyuYBxAgOD14fXV91pQLtTC66Eq2bqWSzsXfpnUkQqbj2Ac0xnO/2M5spEhnbnwEe67p4uttP7c7r9jYCao/79JPb833L1gh8pGIoGOAJxuFxHdHsWalYqH3oc3pOWgaIwP1LeQU+ITi1UXC4EYd3IFgOUe8VIPylRhQe7j4UZq5TKgD4hOiXwMQucHZF1YwUJb4PjPHUNcvustwxwAQQ6HUD2WjowzB0r2Yb+o3Fm3oRmABhQgeeGDfneRwFWPQKKXUIwY4t38NxLR1c5pR9ueIB/8Cw/4E4wSCCyVA9d3++yhONwd8wRQzS9/NY69A7XSKwgndRdtlkOlWw/08YRQPMmnFGY3bQV4ub9Dx14I/q6W6S5iqxAWL4TsOd04Y7RbVqAlU/oixBtpMrRvg== 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)(366004)(346002)(39840400004)(396003)(376002)(451199015)(36756003)(4326008)(66946007)(6916009)(316002)(5660300002)(66476007)(66556008)(38100700002)(38350700002)(86362001)(107886003)(6486002)(478600001)(26005)(6512007)(6506007)(52116002)(41300700001)(8936002)(2906002)(44832011)(8676002)(83380400001)(186003)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZHh5NVZuS1JwbkUrN1BKY01FclhqY2lpVmVOd1NKcUowSmQyMXlMeWxkL3Vo?= =?utf-8?B?WlNaMjkxMFpVcDZ2dnRDR3l5Z05rL1dhNkI5ZXRVQ1BqUExMMlZ2OTMyWDho?= =?utf-8?B?YS9FT0I3a2s2bXlvM2dVcjM3L25UZE9WVXl6dE4zNWp0amRwdUVhTzd2UUFn?= =?utf-8?B?Z1VSOW92RVdPL3ZTQTdodnpUditNUGV5aGFRQUlTMm5zZUNsMFhWcVZGRWYv?= =?utf-8?B?ZHptdFJ6NkcvakdrMHlwYjdnUnA5RVQ0eWN5UkFqOXNoNDBlK3p4cncyZVhX?= =?utf-8?B?U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ZaWS9EUjF3Z1R3MjdJNmQ0UjlC?= =?utf-8?B?VFpka3MzTDlJOWlFZzYybDBJT1ZrLzNhVjRJQnFXdTJSemNmUmlEb2tVNkJ4?= =?utf-8?B?ZVE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05b043cc-e826-422e-c45b-08dab0b81eea 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:26.8812 (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: fPua5/R4nJsEBpOSNz9c3SNAk4gXPSlW2kouR95DOhPuqykgVq50rbP2y8UNaGG1l4XEbpeQFOzGcsS7Tp/ey9VQuFiRjmYW6LEIopeVq7o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR13MB5147 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 da3ac69..36dbf27 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -783,8 +783,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; @@ -796,6 +797,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: @@ -1433,7 +1445,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, @@ -1441,9 +1453,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) { @@ -1454,12 +1473,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