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 8472FA0560; Tue, 18 Oct 2022 05:24:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A2ED242B75; Tue, 18 Oct 2022 05:23:21 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id 752D24281C for ; Tue, 18 Oct 2022 05:23:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l8yeXG7NAqVIwwe5elGgAhqnqCHbt7gegUb/Rrpy6gpO/sg4mWZx0o2lwegd/L6uZntq4BBRPOjRKj6D5Rp+IDmimt6hYIuaQ0vLB+CZnQxpM3pJmDkXRITi1iZGQWCKTTTKg5uzG/nSws1lcFHopXnfnJS2T2xrfR2OelPfwxXzcGFVjAE56jpkNZkN0VvUovb40xw++o3+JMz4hxgejttoQkYoVrVVM5E9Yi1iRniNKaeOZ1bdZ2N7+9KsPZ5953txL2hobCq1KAl+u8JmRn0ZeObjywCC+SHShi9Z7vtMG0iI/h1fF25ROb0f52skqkaKvP9TioSQK6cpeqJHgQ== 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=Q1RctE7RW6zm49k0fiVkf3fCeerSHSPl2pQ3kKYyz64=; b=VvPyarKfggNoC6nJuYKAEixEXbtq0iVtOaxSnkyv3ctONRrgLdFU7lKPwoZoIa5w6xb61GeQcbpQsnnYN0LQCpt/p+pme8Rsd4AazY+VB0mZdzw/5vxwTqOoDzf+JSUHaGGjZWmKC41uowArrBYVHbWkf39b9lB3MGdzf1TSv6Nhs7erp1OhfMT4IxLtvd0fQgzVuFsqtqlxxjwA2RJTeVW9E7QF4fHekS/rqr+SsImYKFynxHQccKsnvttKhZ1PtCJaJc1O2bTNbWDhOg//84flVfplrA+2t9Zhjg/GjsthijVZjEsDEBI7o+aG9aFLRBpjTEaOlFf1zC/6QuYEjw== 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=Q1RctE7RW6zm49k0fiVkf3fCeerSHSPl2pQ3kKYyz64=; b=p/gEe6P/BgijmSfgzwdbfPFgTbqjuUHmrBlnVcwKTKlS4fqnNMreQFlV3/oNwzLg3BpjF25Ecj3QGFZLyUnjRyNivmFTwlFb6zv3goirqm0Pmz2CS1tPnXp1Fa1XOt//T3kN7rUapTP5bhFmjNLFSsnSfBim4ARdF6xZilmf63Y= 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: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; Tue, 18 Oct 2022 03:23:16 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH 09/25] net/nfp: add the offload support of IPv4 VXLAN decap action Date: Tue, 18 Oct 2022 11:22:23 +0800 Message-Id: <1666063359-34283-10-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: fbe321a9-738c-4bc5-1aad-08dab0b81905 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E+0aQEsLDmpwJY6+gflCiWIdsIM32ykFHuVGG0TOnVVcdrHWxMvCcdsWCIrwykPM0sl47SK2yCfguwIAX3d1Bmfe/OMKgXutciBzw66AcuXis1yz7SCuR9vw1GnzZZf1/he8axejTl0XwcWbsrFIuR7QiqusPjajNL3KtFyC9zqGLC4beQ800VFu2W74yUTO++VB+l0qvvHdDY1GE4DBnKNPLsF/xSsLgjB/wTcnxwqy6iU7JGs5DVJm8kA7pfGsfDg+RNMAv4eXzoXIpFLWxyrQkuaXxJu1RhzxsRRFQyIsAYk2lRxb2kZCNUebIpK40lifEk6CfXRB2sKirn/0Trw3h+X5S4Wn95D0hUujxueRcYWERFbylvhIvfB2pLq+u54XWLjXF+fdB0bx3+ZkezM+5KpsKhKAhx1iGbJsZ/4QnyTLaMpH0Rcski+PWFPRSnPNyqB/XOlrCJkGHn/wjStEggEenVKunrth4adiBg+P0SgpXGDapXzk/5I4MoZEN5OHWFXctw0dQeaqhYlTax0S0CqqctJa86SkwZE48UouplFQt3LmNCe/QR+docL3TQIeznY0B8kBUrsiitzb0c8i1cnVzqN9M1hITMO2KUzSncadQIyif2y94aWm1na2WzziHpRiaccD4HHRuo8/SRYO5Znj6bwqG+fHI/shM710Nd6jf0sk+dryFjprbmCnIzkbwEomBGA0HH/NhfG8n64lXW2cXNlqF1X/1mOVuEMfg8rup0C1TwUFoVL6sVuov4ce5iL3KX2qNrDO04HPeA== 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)(6666004)(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?b1hTRm5ScnpQQ2tLRG9iMTI0Y3U5V1lRaU81TWdDaG5Wbm1URCtDSXU3aXYv?= =?utf-8?B?NzE4WXptZXVJYWlsNFVNbXcyL1NFTVZTTXFBazVDbEY1SjRMdUtVSnRVWDB6?= =?utf-8?B?cGJWNkp0Sm0wSENBdjRMZ21pNmFkaGs0R2hmNjh4UjZzWlJyVEhzdWdabVRy?= =?utf-8?B?L0YyOXBsR1JjTWhYaUlOd3hJK0JOY3pqb000RlNXc3YvbkwwVmVHb3JDU2VM?= =?utf-8?B?bmJhUFRxUnZGSlRNYWpvamZKODVpS3RqSUJLM2V2MWtoMEMyL1JicVNwdnVy?= =?utf-8?B?cUFjaE5PQnNkUnNkTERHMj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V0p0K0JTc0hY?= =?utf-8?B?Z2pzb2c4UHl5eXd6bXQwYzlkUW5JUEdadnRwRDhXbUViTU51d2MxUktZWk1m?= =?utf-8?B?ekE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: fbe321a9-738c-4bc5-1aad-08dab0b81905 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:16.7832 (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: v/LBujSluObeIEcXLtGzSPOS84M7sBDoHIhW2pkAwgG0AFUdPAnzsvvHZSQTYjoOb9BdcLH4ddV8xTntMRhFaK33rRZEnNeEyzkzv3baaiY= 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 offload support of decap action for IPv4 VXLAN tunnel. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- doc/guides/nics/features/nfp.ini | 1 + drivers/net/nfp/nfp_flow.c | 75 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index fbfd5ba..3b5b052 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -58,4 +58,5 @@ set_mac_src = Y set_tp_dst = Y set_tp_src = Y set_ttl = Y +vxlan_decap = Y vxlan_encap = Y diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index cc63aa5..0578679 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -424,7 +424,7 @@ struct nfp_pre_tun_entry { return 0; } -__rte_unused static int +static int nfp_tun_add_ipv4_off(struct nfp_app_fw_flower *app_fw_flower, rte_be32_t ipv4) { @@ -926,6 +926,9 @@ struct nfp_pre_tun_entry { key_ls->act_size += sizeof(struct nfp_fl_act_pre_tun); key_ls->act_size += sizeof(struct nfp_fl_act_set_tun); break; + case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_VXLAN_DECAP detected"); + break; default: PMD_DRV_LOG(ERR, "Action type %d not supported.", action->type); return -ENOTSUP; @@ -1333,7 +1336,7 @@ struct nfp_pre_tun_entry { } static int -nfp_flow_merge_vxlan(__rte_unused struct nfp_app_fw_flower *app_fw_flower, +nfp_flow_merge_vxlan(struct nfp_app_fw_flower *app_fw_flower, struct rte_flow *nfp_flow, char **mbuf_off, const struct rte_flow_item *item, @@ -1341,6 +1344,7 @@ struct nfp_pre_tun_entry { bool is_mask, __rte_unused bool is_outer_layer) { + int ret = 0; const struct rte_vxlan_hdr *hdr; struct nfp_flower_ipv4_udp_tun *tun4; struct nfp_flower_ipv6_udp_tun *tun6; @@ -1369,6 +1373,8 @@ struct nfp_pre_tun_entry { } else { tun4 = (struct nfp_flower_ipv4_udp_tun *)*mbuf_off; tun4->tun_id = hdr->vx_vni; + if (!is_mask) + ret = nfp_tun_add_ipv4_off(app_fw_flower, tun4->ipv4.dst); } vxlan_end: @@ -1378,7 +1384,7 @@ struct nfp_pre_tun_entry { else *mbuf_off += sizeof(struct nfp_flower_ipv4_udp_tun); - return 0; + return ret; } /* Graph of supported items and associated process function */ @@ -2067,7 +2073,7 @@ struct nfp_pre_tun_entry { return nfp_flower_cmsg_tun_neigh_v4_rule(app_fw_flower, &payload); } -__rte_unused static int +static int nfp_flower_add_tun_neigh_v4_decap(struct nfp_app_fw_flower *app_fw_flower, struct rte_flow *nfp_flow) { @@ -2445,7 +2451,7 @@ struct nfp_pre_tun_entry { return true; } -__rte_unused static int +static int nfp_pre_tun_table_check_add(struct nfp_flower_representor *repr, uint16_t *index) { @@ -2588,6 +2594,49 @@ struct nfp_pre_tun_entry { } static int +nfp_flow_action_tunnel_decap(struct nfp_flower_representor *repr, + __rte_unused const struct rte_flow_action *action, + struct nfp_fl_rule_metadata *nfp_flow_meta, + struct rte_flow *nfp_flow) +{ + int ret; + uint16_t nfp_mac_idx = 0; + struct nfp_flower_meta_tci *meta_tci; + struct nfp_app_fw_flower *app_fw_flower; + + ret = nfp_pre_tun_table_check_add(repr, &nfp_mac_idx); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Pre tunnel table add failed"); + return -EINVAL; + } + + nfp_mac_idx = (nfp_mac_idx << 8) | + NFP_FLOWER_CMSG_PORT_TYPE_OTHER_PORT | + NFP_TUN_PRE_TUN_IDX_BIT; + + app_fw_flower = repr->app_fw_flower; + ret = nfp_flower_cmsg_tun_mac_rule(app_fw_flower, &repr->mac_addr, + nfp_mac_idx, false); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Send tunnel mac rule failed"); + return -EINVAL; + } + + ret = nfp_flower_cmsg_pre_tunnel_rule(app_fw_flower, nfp_flow_meta, + nfp_mac_idx, false); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Send pre tunnel rule failed"); + return -EINVAL; + } + + meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data; + if (meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV4) + return nfp_flower_add_tun_neigh_v4_decap(app_fw_flower, nfp_flow); + else + return -ENOTSUP; +} + +static int nfp_flow_compile_action(struct nfp_flower_representor *representor, const struct rte_flow_action actions[], struct rte_flow *nfp_flow) @@ -2768,6 +2817,17 @@ struct nfp_pre_tun_entry { position += sizeof(struct nfp_fl_act_set_tun); nfp_flow->type = NFP_FLOW_ENCAP; break; + case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP: + PMD_DRV_LOG(DEBUG, "process RTE_FLOW_ACTION_TYPE_TUNNEL_DECAP"); + ret = nfp_flow_action_tunnel_decap(representor, action, + nfp_flow_meta, nfp_flow); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed when process tunnel decap"); + return ret; + } + nfp_flow->type = NFP_FLOW_DECAP; + nfp_flow->install_flag = false; + break; default: PMD_DRV_LOG(ERR, "Unsupported action type: %d", action->type); return -ENOTSUP; @@ -3218,6 +3278,11 @@ struct nfp_pre_tun_entry { } switch (tunnel->type) { + case RTE_FLOW_ITEM_TYPE_VXLAN: + nfp_action->type = RTE_FLOW_ACTION_TYPE_VXLAN_DECAP; + *pmd_actions = nfp_action; + *num_of_actions = 1; + break; default: *pmd_actions = NULL; *num_of_actions = 0; -- 1.8.3.1