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 D3107A0032; Sat, 22 Oct 2022 10:25:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 452B0427FF; Sat, 22 Oct 2022 10:25:04 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2091.outbound.protection.outlook.com [40.107.93.91]) by mails.dpdk.org (Postfix) with ESMTP id 320DD40042 for ; Sat, 22 Oct 2022 10:25:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QPeHnmKTI7bbm2ajdqrn/29EfH+kXivV1hjK/4lQ4y6dfceh7lNsjHx2SEpUiVoNx6b2Fj+qqmMN2P0PboGNEqrNgqCEsIFRzha23Uw9VZ6231rXrPuGu0qeMylNcMtoN03/mT2Wc+eDzceJgQSCoz8sgU0InZQo1lcO1Y1GiZJc26ESkLsULLs+FbEKpH/jUEgbjPqLLwlYmxkhj8sWdtj0fBakaPZfIq3VdeCLb2DJXQ9INHXftE/K5X4PcXJT672yh2pvHMXgeDa0KFkvld577DvAem4uaWf1980OYT7tYhr+6qxIcemZo/jTKulL0N4n0Je5bjPr8xI07euDzg== 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=Tpc+A2Hh/i1spcwbUW1+U2QszIfRd7txPwST5nZHYm4=; b=HGQEAnO+25wlTmuHDvtAN/ZTmD6vPtcDSQLRxt+I+llmQKHyjpUBjB0GO48KDgFotA+4wKjcX5AQn4iYcVxvAzifs+ehFnDRN4JjXKr4sPhkN8wksCTogWteihcut/iLJFN6cr9N2ZqxiVnnPIuyCXijGtM6laF2u57Bzmk3Z9CyWo9G3Fy802Fqq6fqF5DNt1J5IOdZbb56omsoCNMM6xYyOkXegjgudLJQJxEA8WQDGd0DLZ1knQz0IZ21ew2cCMo6f7WPxZABB5u0vsmAsRkv4zrKGBgl5pUu2gwrpZsZaXHXUP65tQ7g67t/7VUxjajLBgiVHWrUfIAddwecUw== 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=Tpc+A2Hh/i1spcwbUW1+U2QszIfRd7txPwST5nZHYm4=; b=K8su4BcX1sEhHih8S50Zeo+3iXgqd4tR1OrTtno6RmpSNbPbkLZvgVepRoMTWZT9BRHe2G8OBAFkLQImULdGX7wgaP1yN9NrwUW/FlHtVZz6IW48TExmcXH6Gu+FDbH3knXpiHCzDj4uxp4N1aFQwzdHMHYLn/HHJ2XF+qZUrDM= 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 PH7PR13MB5454.namprd13.prod.outlook.com (2603:10b6:510:130::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.8; Sat, 22 Oct 2022 08:24:58 +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:24:58 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v2 06/25] net/nfp: support IPv6 VXLAN encap flow action Date: Sat, 22 Oct 2022 16:24:10 +0800 Message-Id: <1666427069-10553-7-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_|PH7PR13MB5454:EE_ X-MS-Office365-Filtering-Correlation-Id: 1bae8b78-7b71-4337-4e4b-08dab406e834 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jcfzqLrAZgBRYWM3ks1bTYmaGqDH5RMPpvpcvj0vTZK942GyJaQKaqWx8ifoKhWhy5ml6tSWThyUfNfw/PQbOFVEAkKo34bpRfhX6BmpNyENRMsNCjG1ImsfLgsTNl71PsDh3VcA3eE8q43pJ3hyE/picLZpFVCxxOLpOPXOFTCTLwuan8GigiCNV6n+GhoqJo+6Qd5QNkmigQ0/Bqs9JH0N7Ygm5OoLUKsgqWGVbD51+3iF+EKz5SaNoDjYV2rcVyvQs9Zfz+19uTemjBuAOSPLnSrDosGzgSffPuZ8Kurg8dcQEmCIeY/0yOnHyIripfTAhqNjVnbET5n9rkTXXu7TBdc5fYIGVrX7m9DuImSHmjAwhzKcFi245+0ZNVEdR6HDkfBuQZ9PNantLViSUGT8bqx3sLquRTY9hgB6+FBsVP0Y+mtxRelj8o+bTJb4KI4+wEYsmTcYUuPBQkhPbbSDDbJ5cvf6w6mIesYvRdDlJe36xc9urpQYthsa8bvZniU5Hcm4rqVxE0elIyA88GbdXg+ZrB2fPsbrvm9EAnti/bXANF8nMoF307L/THEGR2sWEkyAoM1qgqllNXXIKBmEY3YBGVx/PBNnKRuz1I4ZQW/+p7pwvO/N7XOFcqSiGwpRBLhVv8mdENYwTf90BLIb4CvNV+ERelwwAuZC6wVVE+VBLESDUSzYBLZl/mYqaSSgsG/EtA8PB5gc7VZ33fwTv5sOa2WO7NjWqe/LYwsuYHWR82fVcGALkAQ2rt7FET4dpR7mv5JWBSs+2H/idBYpilA7frWRO758QQTn3sYHQvNllA4ZtADpoWwslHeV 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)(376002)(39840400004)(136003)(451199015)(186003)(6916009)(316002)(83380400001)(2616005)(38350700002)(86362001)(44832011)(38100700002)(66556008)(5660300002)(41300700001)(107886003)(478600001)(6506007)(6486002)(6666004)(8676002)(26005)(6512007)(8936002)(4326008)(2906002)(52116002)(66946007)(66476007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RE1ONmR4WDZTNVBXSDUxTmhkMm1ubGY1R0xvOWFlc3g0dFcrekxuM3EvME9G?= =?utf-8?B?MWtQRTljblhBSVRoajBMQ0h1cTJYUGNRZXJoNnFReGUvVUoyZk5ZOEpzR0Q5?= =?utf-8?B?TmJUVHBWeDdXc1JLdml6NE5mQ0YvZ2kxTG5JTzNDMFVEK2xybDhnT3dVMGVz?= =?utf-8?B?WEFHRlZ6OU1TM2xuc0h4NSt3VXNwaDF0bGgwaEp6S3RaTU93L3IxNisvWFRF?= =?utf-8?B?N0hqd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aFZRQ0Yy?= =?utf-8?B?aXhGNFQ2WUl1czdieDZMZkRJNDczVytYTjd0aTRPUzJTUGlmbmdKMnFPU1F1?= =?utf-8?B?bmVvQ0p5UEtRT2xDQzlpdDlQZWFyZDhDYlIvWWFsVVVIQzhvZk1MU3IvaWFT?= =?utf-8?B?TlE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bae8b78-7b71-4337-4e4b-08dab406e834 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:24:58.7703 (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: X8Bq8v1ehvTpU/KjpSJoDM/SN11mz9/u7CZ8sf0UTdJoujfpWnCPY+YBs+g6NuRsQprQj2qMeJzgKZicwjmwLMHp5aHihIHfW6LqdElw35U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB5454 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 offload support of encap action for IPv6 VXLAN tunnel. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_flow.c | 48 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index d2e779c..9ee02b0 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -1799,7 +1799,7 @@ struct nfp_mask_id_entry { pre_tun->ipv4_dst = ipv4_dst; } -__rte_unused static void +static void nfp_flow_pre_tun_v6_process(struct nfp_fl_act_pre_tun *pre_tun, const uint8_t ipv6_dst[]) { @@ -1885,7 +1885,7 @@ struct nfp_mask_id_entry { return nfp_flower_cmsg_tun_neigh_v4_rule(app_fw_flower, &payload); } -__rte_unused static int +static int nfp_flower_add_tun_neigh_v6_encap(struct nfp_app_fw_flower *app_fw_flower, struct nfp_fl_rule_metadata *nfp_flow_meta, struct nfp_fl_tun *tun, @@ -2014,6 +2014,42 @@ struct nfp_mask_id_entry { } static int +nfp_flow_action_vxlan_encap_v6(struct nfp_app_fw_flower *app_fw_flower, + char *act_data, + char *actions, + const struct vxlan_data *vxlan_data, + struct nfp_fl_rule_metadata *nfp_flow_meta, + struct nfp_fl_tun *tun) +{ + struct nfp_fl_act_pre_tun *pre_tun; + struct nfp_fl_act_set_tun *set_tun; + const struct rte_flow_item_eth *eth; + const struct rte_flow_item_ipv6 *ipv6; + const struct rte_flow_item_vxlan *vxlan; + size_t act_pre_size = sizeof(struct nfp_fl_act_pre_tun); + size_t act_set_size = sizeof(struct nfp_fl_act_set_tun); + + eth = (const struct rte_flow_item_eth *)vxlan_data->items[0].spec; + ipv6 = (const struct rte_flow_item_ipv6 *)vxlan_data->items[1].spec; + vxlan = (const struct rte_flow_item_vxlan *)vxlan_data->items[3].spec; + + pre_tun = (struct nfp_fl_act_pre_tun *)actions; + memset(pre_tun, 0, act_pre_size); + nfp_flow_pre_tun_v6_process(pre_tun, ipv6->hdr.dst_addr); + + set_tun = (struct nfp_fl_act_set_tun *)(act_data + act_pre_size); + memset(set_tun, 0, act_set_size); + nfp_flow_set_tun_process(set_tun, NFP_FL_TUN_VXLAN, vxlan->hdr.vx_vni, + ipv6->hdr.hop_limits, + (ipv6->hdr.vtc_flow >> RTE_IPV6_HDR_TC_SHIFT) & 0xff); + set_tun->tun_flags = vxlan->hdr.vx_flags; + + /* Send the tunnel neighbor cmsg to fw */ + return nfp_flower_add_tun_neigh_v6_encap(app_fw_flower, nfp_flow_meta, + tun, ð->hdr, ipv6); +} + +static int nfp_flow_action_vxlan_encap(struct nfp_app_fw_flower *app_fw_flower, char *act_data, char *actions, @@ -2027,7 +2063,8 @@ struct nfp_mask_id_entry { vxlan_data = action->conf; if (vxlan_data->items[0].type != RTE_FLOW_ITEM_TYPE_ETH || - vxlan_data->items[1].type != RTE_FLOW_ITEM_TYPE_IPV4 || + (vxlan_data->items[1].type != RTE_FLOW_ITEM_TYPE_IPV4 && + vxlan_data->items[1].type != RTE_FLOW_ITEM_TYPE_IPV6) || vxlan_data->items[2].type != RTE_FLOW_ITEM_TYPE_UDP || vxlan_data->items[3].type != RTE_FLOW_ITEM_TYPE_VXLAN || vxlan_data->items[4].type != RTE_FLOW_ITEM_TYPE_END) { @@ -2048,8 +2085,9 @@ struct nfp_mask_id_entry { if (vxlan_data->items[1].type == RTE_FLOW_ITEM_TYPE_IPV4) return nfp_flow_action_vxlan_encap_v4(app_fw_flower, act_data, actions, vxlan_data, nfp_flow_meta, tun); - - return 0; + else + return nfp_flow_action_vxlan_encap_v6(app_fw_flower, act_data, + actions, vxlan_data, nfp_flow_meta, tun); } static int -- 1.8.3.1