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 76188A0543; Tue, 25 Oct 2022 10:03:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9DBD642BCC; Tue, 25 Oct 2022 10:00:58 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2133.outbound.protection.outlook.com [40.107.237.133]) by mails.dpdk.org (Postfix) with ESMTP id 155A542C38 for ; Tue, 25 Oct 2022 10:00:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cIssGBdUoIxxNV05V0JpI1oGZtmWlL8xiU+TmF5JlKp5H2516ez1R3JfXt+1RQH1teSZcgyMhTzVW2aFg2GFHbsRabQbWDaSDoGgERx147R0LQtATjT9SflSLal6hHcy+3FARwOLTahrgG1HKNkV6fwUVFUIhZq8EZ10hoLZ+EA8CotxCj1lCycaJKHTtIT5AFoDdCg3VOpArV2/eaG7QH+gdgrSxR+r5dwxrqmchlJ7RQroWwyNMZYZmeI6In3TyViemmXEwHfiI2Z1WflMgugQiQKgyukeqAD8mFS+KT5+6PLGxbVAyzzvpj9gSRRaCC4kY0Jk8RHyrJhZu7Aurg== 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=FN58zPKDXJhPyvMGG435DykaEsSBSU1oiMebGo9JBIo=; b=kqe8PSCMXlJ7GooOzseoPp4yHVMQ1Hiy7Wk9q/VicHsekHtsVEivnX/9vqKis8ZBBFEjKXoAZj0E51ZUs2cpwqHR8rkIGrCwrzE3Qn5P3AcIVrMNQxzQLgVCH6BfnAhE9Waz4+4fQQkUE7QHdnk1sRx+QLNa5J43JxRcvtHms/MHiyheecPTjFfAJDrbz/6gb6JXWUOg5N3iAkGp77NxGfthVh6wHsGxvmus8Lwxp200v6ecmFtRW2VJjuMSGST4wOln/bNukDBwlVTj5u3Xz2IMizZ8XMtGMflOQXrvlF/yj3DvJg7O5mkVB/OPpWiF5VHgntI88z6KC/QKVf9b5A== 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=FN58zPKDXJhPyvMGG435DykaEsSBSU1oiMebGo9JBIo=; b=dIurtDhXdUm/n1+ru/tNvtQjshDZI0Rea5hlBGu/YLEzvXG/eRRKzHN7CCj36cnTHdz4AOmwZuQFMKjHRDomCEO0TcjwgeDaIn6gx98KlaHDQyu4Dgmv3YW5W+UbQTAql/gNZ6WqtQSzk+h+BcSHlLLs5QHtMWbjUd5QtxfEMrU= 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 BLAPR13MB4739.namprd13.prod.outlook.com (2603:10b6:208:306::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.25; Tue, 25 Oct 2022 08:00:38 +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:38 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v3 23/26] net/nfp: support IPv6 NVGRE flow item Date: Tue, 25 Oct 2022 15:59:15 +0800 Message-Id: <20221025075918.7778-24-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_|BLAPR13MB4739:EE_ X-MS-Office365-Filtering-Correlation-Id: 71ae4d29-7e0a-462a-fe6c-08dab65f010f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TfxbrTU3Cq8/nEO2Ig3X02KrYOCjqHyr+9703bUg3uVZxlzpbOyPQf4mLC877K5NgCk9AAhitkmzM6YBgDcHq4MW6Qj2T7+bLUM2P6b2OPgzMHNZNzRiminqKsHc8fXKnfor0SQIgDD0MwcVaUurnrJuMd2RzYGqB1wXIsuz4QENDflpujFXDEVgrRZEaxQnznzscD0DWtysYH7NU4Dc24DabBdlBxXiyx8Z17Jmv0gYy28Ex88H+WEQCrdt1ePvbletaJjC47agqEiWfJge9txxNn5uy7tE5/6g9SXsO5kvGxDZ9XT17hJmRKllTET5nttPnMgCiyznhkiDBTiK0J199QDwbCrEU40kRJyF6OAemt7VNwMs/vxcfghzFjlQgn8QtPwihiwBRVsF3iS+sXR4ebaX/aU6Ff7feMNaMgv4fE5YrU8rysUlKtUFzqBhuTXGII0jkpk2MiHqnrvf+gkBl4CbiV6j32n7Z5k0Lr88oNNFLvS6juwbR09ZCKQRnYk06l8Pbtp8mjH852Nzg5U+SLvtJfhnECe9g5XnBGJgt7nzI5IYBfeh70o5z3LcPauAa2nRCSWWsi+gAYgAaj5l6yETX/OIZ9YceZEWf3Wd5cqRg3YNbzqgWl6cVOLlRYd7aecxiiJNoYBD5PC5x/4OPJG0C6quRYWf7poqJIsrS1VqH1amkf2V9Pe84tUE5O57sBXa+VwAQ667GHk9bD6Th3Z2+Rgb32jQhkmgFX8xlRm7NdqsAYIKWf8VTgXNQbIH4IpbEywXwoFl2mQ7kA== 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)(366004)(396003)(136003)(39850400004)(346002)(451199015)(36756003)(38350700002)(86362001)(38100700002)(41300700001)(83380400001)(66946007)(1076003)(2906002)(6512007)(6666004)(26005)(186003)(6916009)(6506007)(52116002)(107886003)(478600001)(44832011)(66556008)(5660300002)(8936002)(2616005)(6486002)(8676002)(316002)(66476007)(4326008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RjB6dkM3Q3BDYTQ5R3JhbURVYmYyNEFUdi80eXJWV0UwSm5CRzNOalNoZ2N0?= =?utf-8?B?VXJEWnoyVmErVFRNM2dYenN0OWtaRE84ZFBtenVuWmZ6dTJ0QTJDelNRdFJj?= =?utf-8?B?Q2M5RFdKbEFFSE9nb05lYnpZb25HNHZzYnloMXBua0RVS2lHREQ5ZTRNSmNi?= =?utf-8?B?N01mQU1GRkxZSjVSMExsdW5wZnFsMng5a0lKYWZiRDZFWTEvWGVBN21lMk0r?= =?utf-8?B?U2l2T3pONU9xMER0OU9JeS9KQ1IzV3FtdjdWOElndERadE5RRDBXUVpKd2RG?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ySU1GQnF2YTdESGVXdGptSzJ0Ym10L2xM?= =?utf-8?B?WUdlZ1hJVFhJVXpYdmRuTVBOYkZob09vODA4VGlTNStDTU94YlU0UzI4ZHNq?= =?utf-8?B?dFE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71ae4d29-7e0a-462a-fe6c-08dab65f010f 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:38.4975 (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: 4UZxCcvWVdXtRMcGZXrUZsiITNqGAsqQnr3yFY7/Hm7rajMGBhV6YaVnK4m38npdBPeVjIWUTdQ9YOayx6DSr4mfhJOLMrvvf+7HUnG58Ts= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR13MB4739 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 226fc7d590..78af7bcf0c 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -822,8 +822,9 @@ nfp_flow_key_layers_calculate_items(const struct rte_flow_item items[], 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 @@ nfp_flow_key_layers_calculate_items(const struct rte_flow_item items[], * 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 @@ nfp_flow_merge_geneve(struct nfp_app_fw_flower *app_fw_flower, 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 @@ nfp_flow_merge_gre_key(__rte_unused struct nfp_app_fw_flower *app_fw_flower, 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 @@ static const struct nfp_flow_item_proc nfp_flow_item_proc_list[] = { [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), -- 2.29.3