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 757BFA0032; Sat, 22 Oct 2022 10:26:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9F3A442B6D; Sat, 22 Oct 2022 10:25:12 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2101.outbound.protection.outlook.com [40.107.244.101]) by mails.dpdk.org (Postfix) with ESMTP id 46EFC41614 for ; Sat, 22 Oct 2022 10:25:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=im1hesUWMkWaEY3mkzxPotu02ot60UBrVp1YpaJwiodf25VqyI44qQiLE+XEfrB364++BJWQz6cAUEfobZCyoyS+HzMY5OssN3Y3bJhyt2090pgUNFAKQZD6cWecAF2NnJJOY7+McCc+SZ0HmiOmOKMFxbhT+dEjKbTq08LSXRiH6q20CT5qqjFUeJ+L1j5cX6mO2FLUM2ezm5XQ5adIRHbdHl5UC821gLmdSNT37HPpiLDiPU9DUkMnN8pfXcX63Jgoa16m7I84rfU9mRzb0mEF1i/X9n4fhlPoJmnoJRc9zJOve8VUzcTxmBmbIy7Sz+9usIhHvcdUV2WMuz83ow== 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=e+nQPvgGP+rvYoCSgT6M/1QAlJk3WZllnLaQ7KjytzU=; b=C5tdySx7lxFurK9D1mycwvtfUiA37dIATQMsDvcaXDIFiq9eFc3rCWauRNfdt5rBkFkf22M46txIiQHeF/tE8wBfKUiUCA5N5AuEA97vcPBgFM7J2uAqE4Sme8PuP69vdhGSWceEQoH8/QFEhxBUUawv/8PYwxh2AJguEVMZGjrWmFO35K5zirtxgu67MEz7XeCOora5GmPMLxxRa0TszHkdq8cf9Ey9l72ia87rHEYK0OM5lixapCqeoOAbBhnQZcxylbjZFvmEwXlWhkStJ6Ecg2GPk96s2jJRU9PgKAtGoEjsOIoVdEyBEyCnu8Bt/d48QRg3CL+oJOsYygfeEw== 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=e+nQPvgGP+rvYoCSgT6M/1QAlJk3WZllnLaQ7KjytzU=; b=VM+RS0NJAb4rTXUBscM4IWe6vY2/KuYYaJwtd8x/9+871mUAp/DQztA7vMhWQwaGkI4/8EXGZ6f3bWNzMoZMkj3XrTwn4e61b0uC2i+E6AJ7TrB6KUZmfFEdScVE1bQOO05jOEqF9us2k41mUj+sIkKjwasXmpCKW7chp4hohDs= 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:05 +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:05 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v2 09/25] net/nfp: support IPv4 VXLAN decap flow action Date: Sat, 22 Oct 2022 16:24:13 +0800 Message-Id: <1666427069-10553-10-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: dbce8bc5-0b9f-4024-06ef-08dab406ec25 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XsX9DwJC0BMEAX6HAGpRURiofx/S72gqvdu2YQePc6oZJ0aEv7N2fwiLxJ7GvfCOXBd5Qvw2/m33WLk20DfR/zh83HlscIyedBv81R5sjFvbwRRGm10LSIk4hC3YVw6mllBo4glFPVOyjAlVb6LqvnM8M23ip0aBKE7rw6xWw0zTEw6wnMB4U91NFINZ8TYQrIuIOY2XZ1DkCH6dpbDKAIDbth1tXA0H9hwpHNkTgMK0qoxVrMRqRnv6FpV7Q+YoMH3vyZkYUiqSk6+Tmod02PpEyviY9sLoXZlhd/b6MbVzp7Yt40i3aGll0SpeON1nILjAY76ms2mtLiIv3fBbSlz4YMfdQjPQwtFFhUCc28FXYLtPMqhJ2PXFRrfu3xSd7tbeHRLuXrSiSdJTTQk4a2EZG4E1dpShUD9vpSvthYmzC5IDrjkovh4j0kL7mQuM4nB2i3kFxr5EsEGn+1wWoLPwvR97l8DL5hLphOY9JV+PBOUN8BrVhXWpOjBHDCv7L7LjBXFqAW++lSloTfr0+L6rli25dm5CXVOA+I2wyYiUh8iVABzxGyAFTGPnDZjJX2t4L2ICPpc9lnMWUKJ/WeBuRUs9WW6hZOrf88xlzWTAbQzlfccn9OtdW+HGE9YO6MSANlyRVjvfPYn8yJhpz69n9IFu77AbJB9zwcXDc4yeXxrGaMkHZqkmI0AospOaUlvlh2p0Nhb0lCwGC9CD+UQx17G+OkVNQCNm3LZuJQXj+/nJA4oQFvqtTjc/dltc+jvm0AErT2TXyFear4Wujg== 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)(6666004)(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?NUJQbU5SRVUxR2Vza0dPTkZWanYvYTNFYytYUmNZZHNWemtLUFFpWmJuVms3?= =?utf-8?B?bVM4K0pHNDdxcGlJU0RxeHBaWDBZR2c0Z3RLSDBZc2svL2pBUSsrRFdma2Zk?= =?utf-8?B?ZGJDUm1BaUZpUkhaOWVNakF3eXJDb3BCYlFzaFhyWkVPZmM3bkZ2K1N2cnM3?= =?utf-8?B?SUZlblpMQ2JXZEYrdUp3SVdjSjBOeHRqTW16WXNSWms0aCs1YThmZ09wU051?= =?utf-8?B?bzA1NFlrUHo2R2xMaVprRnk2TlNTNEY5Y0ZyWjE2d2R0TGZ4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Y5VmFKY1BEaDdX?= =?utf-8?B?T2MvVEt4R1p0SmVEZVkwWUo3MG5LbzhXYUJrYjNwZEhQVjlWUTV2emJpa1hE?= =?utf-8?B?a2c9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbce8bc5-0b9f-4024-06ef-08dab406ec25 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:05.2093 (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: aXMxplZtCuj8qe1PppLreS3gnkFlgIrCHh9rKbvpbFJ6XIFCq0SMOoE9fWea4OHbD6X+Q86iLOBzx3C03BMMMUKFBlcDK5BRgQRBsvsA+SU= 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 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 ff97787..6788520 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -56,4 +56,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 ad484b9..ce61446 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -413,7 +413,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) { @@ -908,6 +908,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; @@ -1315,7 +1318,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, @@ -1323,6 +1326,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; @@ -1351,6 +1355,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: @@ -1360,7 +1366,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 */ @@ -2049,7 +2055,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) { @@ -2427,7 +2433,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) { @@ -2570,6 +2576,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) @@ -2744,6 +2793,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; @@ -3214,6 +3274,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