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 D113445495; Wed, 19 Jun 2024 12:01:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 603AB42E54; Wed, 19 Jun 2024 11:59:42 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2127.outbound.protection.outlook.com [40.107.243.127]) by mails.dpdk.org (Postfix) with ESMTP id C8A9F42E7C for ; Wed, 19 Jun 2024 11:59:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CSluTikxTanRfrNmhfUtViuWIlymZMMrrpfNbL9EYC5+4kvDrwEaBdfnA6Svm3er/EBFvvizO3pfrdGiJ0AX4y2PKbJdshBgBoPqAiJVPwjuMgcjNCwQMZpWZXQmtJBSQKdbhR/62z4PHJNxed8JLBm+gOBBSgQn+8TXM58JGssITjJqtKwG/V+IdwqwcWPCg85Oj0czmAri83MexhrPqbifamxJJxZoUAMKLcA/q/jo7B0xHrIIclS4jzz5dMz4446bRzjTbcDBGno5IFraU/i9rHhNve3bDOo7bIFNFABYO8+b2A26o3SEVd0+sx5hYw/A+QXtP0Nv7pLaRiuKUQ== 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=vaOVEFZUjKvVuh9eEEPvHmbT+fGi1+mE3eFagZTj3W4=; b=DNOSgL/gAiJmqUDsSMn+tOpHcm9b3T/LwZEEK6JC3dGt6dMS8OXLKTYf7XpTm2wEMVZSP4x2LeHvaIWKCsBx1528SHQiPNAoofSvCJQR0boY7f2CsQEWzJOtbBZEZQm4r4FCfx2GCGfeFlszZ5HWoCCwtiALe9K0zWTxeoWm7kRkZ0NFke6AeS5ryusd+W6eLvzXK3nzrb4TayDR+tDWoVi+znxR7CAv5xX7gw/YFIYENuqsmJ1d7wSlntDMSlXiLOn9eAt8DXWi9usLmF8VeUxlwr6ckH+QNcguu8F3sRGMH9CwLMnexQsqZfk+t7h2xUnTF/nQ6PDsyde/o78fog== 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=vaOVEFZUjKvVuh9eEEPvHmbT+fGi1+mE3eFagZTj3W4=; b=FLu/nLv7wlYf65roFHqPeQIfTK1/oxAH4nEwxn0ss7uDq1qB2NSlQ3uhClD735BUwcIuwjscABsztLNPJ+l1LnhZw5CCI9FyuSQM//Xor2iKJ/mEe9X+btflMNKYLeJ3HsAKqbAv91bjm6oijWMARs0z9/iXSxy538f/d2CxMHk= 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 MN2PR13MB3912.namprd13.prod.outlook.com (2603:10b6:208:263::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Wed, 19 Jun 2024 09:59:30 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%4]) with mapi id 15.20.7677.030; Wed, 19 Jun 2024 09:59:30 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Peng Zhang , Chaoyong He , Long Wu Subject: [PATCH 21/23] net/nfp: add resource share mode of mask ID Date: Wed, 19 Jun 2024 17:58:28 +0800 Message-Id: <20240619095830.3479757-22-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240619095830.3479757-1-chaoyong.he@corigine.com> References: <20240619095830.3479757-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR13CA0057.namprd13.prod.outlook.com (2603:10b6:a03:2c2::32) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MN2PR13MB3912:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d8864c8-1228-4b43-5897-08dc904682f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|366013|376011|52116011|1800799021|38350700011; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?LdPjmXhvLrzPRr87Gval3pFunw1v28er4xC/XUBDkLwFHhK4Xo+j5Dyd9w5o?= =?us-ascii?Q?Ik90QY45jiNm0RUpiFUI/gb+86Lcsqp81aRINaYQfgtOGBS2M/tumLItv6Ec?= =?us-ascii?Q?H6eBbeyXXE2VgYUPjNx6JkcwOwgVFtwV9s/fsmanrsUmFxaZF+uZ1jPkMvTw?= =?us-ascii?Q?j2shbNBZjV1PTa/KK3QyMFIfGWM+8yeh3DJ+O+8zMCS9EKHKp7jw+sFaDq5I?= =?us-ascii?Q?aUvlaPNjQyKf5K6nUNE8CkpJ+j6kJmelRmf+7alWheUQttznLqKA1f+0Chyu?= =?us-ascii?Q?NoXeQaS/Ff3HU83qE1n0wijwYFlaN/bUrG1tY+DrB6fLxPhPM+S/bbazdr7Y?= =?us-ascii?Q?s+iIrQGR2MGkjQZkLTRisdZKm6EannUc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Q?RB4aiaRzF1WNAiZKa77ZZ7a8EBb+6tclrkBZ5UHDG11sfeYjSq+UuJSayxDb?= =?us-ascii?Q?1jYbbzlNajaih1eHzwdO1juTqoi7GagC1zBswhq4DY0+KIMXzXRhIcpUFiQ5?= =?us-ascii?Q?V79W3zc=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230037)(366013)(376011)(52116011)(1800799021)(38350700011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?HVfrMAt8rSF2OoVJsgo2cbtFebnvWb/nRy+qLcFvNPdJgoKqVRqDpx94mkZf?= =?us-ascii?Q?VxbQSA+vfOgLPt0GIQnvxIDn+fEDCasI+hobB3O3jZd1VpZpBXGGcHOT4my3?= =?us-ascii?Q?rVQ9nqkXQ1RRNWX9sya58PZIdwkRa/Yo2AiixAjT4bawIGx5Cx4+XMsrkMIl?= =?us-ascii?Q?NGAOQDTI085Qp6QLkZuN5rJ92QHqRuBX408WTZ3c1kY+V7XzD56ctg2Wnh1Z?= =?us-ascii?Q?A1Jz7fC6U/NE80Ldwu4zuI/s8CNHz2tIIx8tocdQxR5aMwt5C9NI4xim6p7f?= =?us-ascii?Q?N4xooj28EcvPM/NymOgHcjD1gTdes4IfBQ03vjx+FIpuuCVSkqzp1tl+j1zy?= =?us-ascii?Q?wlzf+FvCVS0fuLsyhkAIvqiTE/rR+aDHOGfxqkIpMM4JlQH1ZONOAYPrccci?= =?us-ascii?Q?/tbaEnNUNVPZHVQii/Uu/BlJWzY41y2qhtZkqBsYw+kQ2cjXVf3q3u0bDQeX?= =?us-ascii?Q?0DPXWDEgsanWocF+awBQbblwhDQQCpwwy9xUqOjnfK54Lnd2mc2QTz7Q9y/l?= =?us-ascii?Q?64WLYp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HtZPM5/gWj?= =?us-ascii?Q?TeLs7OrtbvWQZpYNez5vA1Lh8aYo59i9RyiEvlIAWqKwlnQbJQw3HbhvWykF?= =?us-ascii?Q?xTm8tmj+iCv7IHtdoYWgFQ8Y9Oa+U/YlSv1SvXb1ZGG65bx2j1H0nQZjGcjc?= =?us-ascii?Q?g+D5aait+Oaa8r9ajzPQOuOkDixyjMvjqSfp3Cj8oW0Rrf8rU86imHAj8x/9?= =?us-ascii?Q?tA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d8864c8-1228-4b43-5897-08dc904682f1 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 09:59:30.1274 (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: HXNAgJuzLSMiA7L7yhTydnSuXy7hOvKNsR/LmW57uCc8f+i7bDoPIr8X8aifQD+gn4T8Y07KMFwbrD9JZCxgYYBo7JchvbhjAxk2ef5zKz8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3912 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 From: Peng Zhang For multiple PFs flower firmware, mask ID resource should be shared between PFs, so change this resource allocation from driver to hardware. In application start stage, the resource initialization is not necessary anymore since PMD will allocate resource from hardware for multiple PFs flower firmware. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- drivers/net/nfp/flower/nfp_flower_flow.c | 142 ++++++++++++++++++----- 1 file changed, 111 insertions(+), 31 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c index 215d655a18..0fb63013d3 100644 --- a/drivers/net/nfp/flower/nfp_flower_flow.c +++ b/drivers/net/nfp/flower/nfp_flower_flow.c @@ -161,7 +161,51 @@ nfp_flow_dev_to_priv(struct rte_eth_dev *dev) } static int -nfp_mask_id_alloc(struct nfp_flow_priv *priv, +nfp_mask_id_alloc_from_hw(struct nfp_net_hw_priv *hw_priv, + uint8_t *mask_id) +{ + int ret; + uint8_t freed_id; + uint32_t mask = 0; + + /* Checking if buffer is empty. */ + freed_id = NFP_FLOWER_MASK_ENTRY_RS - 1; + + ret = nfp_rtsym_readl_indirect(hw_priv->pf_dev->sym_tbl, + "_FC_WC_EMU_0_MASK_ID_RING_BASE", + "_FC_WC_MASK_ID_RING_EMU_0", &mask); + if (ret != 0) { + *mask_id = freed_id; + return ret; + } + + /* 0 is an invalid value */ + if (mask == 0 || mask >= NFP_FLOWER_MASK_ENTRY_RS) { + *mask_id = freed_id; + return -ENOENT; + } + + *mask_id = (uint8_t)mask; + + return 0; +} + +static int +nfp_mask_id_free_from_hw(struct nfp_net_hw_priv *hw_priv, + uint8_t mask_id) +{ + int ret; + uint32_t mask = mask_id; + + ret = nfp_rtsym_writel_indirect(hw_priv->pf_dev->sym_tbl, + "_FC_WC_EMU_0_MASK_ID_RING_BASE", + "_FC_WC_MASK_ID_RING_EMU_0", mask); + + return ret; +} + +static int +nfp_mask_id_alloc_from_driver(struct nfp_flow_priv *priv, uint8_t *mask_id) { uint8_t temp_id; @@ -194,7 +238,7 @@ nfp_mask_id_alloc(struct nfp_flow_priv *priv, } static int -nfp_mask_id_free(struct nfp_flow_priv *priv, +nfp_mask_id_free_from_driver(struct nfp_flow_priv *priv, uint8_t mask_id) { struct circ_buf *ring; @@ -213,7 +257,33 @@ nfp_mask_id_free(struct nfp_flow_priv *priv, } static int -nfp_mask_table_add(struct nfp_flow_priv *priv, +nfp_mask_id_alloc(struct nfp_app_fw_flower *app_fw_flower, + uint8_t *mask_id) +{ + struct nfp_net_hw_priv *hw_priv; + + hw_priv = app_fw_flower->pf_ethdev->process_private; + if (hw_priv->pf_dev->multi_pf.enabled) + return nfp_mask_id_alloc_from_hw(hw_priv, mask_id); + else + return nfp_mask_id_alloc_from_driver(app_fw_flower->flow_priv, mask_id); +} + +static int +nfp_mask_id_free(struct nfp_app_fw_flower *app_fw_flower, + uint8_t mask_id) +{ + struct nfp_net_hw_priv *hw_priv; + + hw_priv = app_fw_flower->pf_ethdev->process_private; + if (hw_priv->pf_dev->multi_pf.enabled) + return nfp_mask_id_free_from_hw(hw_priv, mask_id); + else + return nfp_mask_id_free_from_driver(app_fw_flower->flow_priv, mask_id); +} + +static int +nfp_mask_table_add(struct nfp_app_fw_flower *app_fw_flower, char *mask_data, uint32_t mask_len, uint8_t *id) @@ -221,6 +291,7 @@ nfp_mask_table_add(struct nfp_flow_priv *priv, int ret; uint8_t mask_id; uint32_t hash_key; + struct nfp_flow_priv *priv; struct nfp_mask_id_entry *mask_entry; mask_entry = rte_zmalloc("mask_entry", sizeof(struct nfp_mask_id_entry), 0); @@ -229,10 +300,11 @@ nfp_mask_table_add(struct nfp_flow_priv *priv, goto exit; } - ret = nfp_mask_id_alloc(priv, &mask_id); + ret = nfp_mask_id_alloc(app_fw_flower, &mask_id); if (ret != 0) goto mask_entry_free; + priv = app_fw_flower->flow_priv; hash_key = rte_jhash(mask_data, mask_len, priv->hash_seed); mask_entry->mask_id = mask_id; mask_entry->hash_key = hash_key; @@ -250,7 +322,7 @@ nfp_mask_table_add(struct nfp_flow_priv *priv, return 0; mask_id_free: - nfp_mask_id_free(priv, mask_id); + nfp_mask_id_free(app_fw_flower, mask_id); mask_entry_free: rte_free(mask_entry); exit: @@ -258,14 +330,16 @@ nfp_mask_table_add(struct nfp_flow_priv *priv, } static int -nfp_mask_table_del(struct nfp_flow_priv *priv, +nfp_mask_table_del(struct nfp_app_fw_flower *app_fw_flower, char *mask_data, uint32_t mask_len, uint8_t id) { int ret; uint32_t hash_key; + struct nfp_flow_priv *priv; + priv = app_fw_flower->flow_priv; hash_key = rte_jhash(mask_data, mask_len, priv->hash_seed); ret = rte_hash_del_key(priv->mask_table, &hash_key); if (ret < 0) { @@ -273,7 +347,7 @@ nfp_mask_table_del(struct nfp_flow_priv *priv, return ret; } - ret = nfp_mask_id_free(priv, id); + ret = nfp_mask_id_free(app_fw_flower, id); if (ret != 0) { PMD_DRV_LOG(ERR, "Free mask id failed."); return ret; @@ -302,19 +376,21 @@ nfp_mask_table_search(struct nfp_flow_priv *priv, } static bool -nfp_check_mask_add(struct nfp_flow_priv *priv, +nfp_check_mask_add(struct nfp_app_fw_flower *app_fw_flower, char *mask_data, uint32_t mask_len, uint8_t *meta_flags, uint8_t *mask_id) { int ret; + struct nfp_flow_priv *priv; struct nfp_mask_id_entry *mask_entry; + priv = app_fw_flower->flow_priv; mask_entry = nfp_mask_table_search(priv, mask_data, mask_len); if (mask_entry == NULL) { /* Mask entry does not exist, let's create one */ - ret = nfp_mask_table_add(priv, mask_data, mask_len, mask_id); + ret = nfp_mask_table_add(app_fw_flower, mask_data, mask_len, mask_id); if (ret != 0) return false; @@ -329,21 +405,23 @@ nfp_check_mask_add(struct nfp_flow_priv *priv, } static bool -nfp_check_mask_remove(struct nfp_flow_priv *priv, +nfp_check_mask_remove(struct nfp_app_fw_flower *app_fw_flower, char *mask_data, uint32_t mask_len, uint8_t *meta_flags) { int ret; + struct nfp_flow_priv *priv; struct nfp_mask_id_entry *mask_entry; + priv = app_fw_flower->flow_priv; mask_entry = nfp_mask_table_search(priv, mask_data, mask_len); if (mask_entry == NULL) return false; mask_entry->ref_cnt--; if (mask_entry->ref_cnt == 0) { - ret = nfp_mask_table_del(priv, mask_data, mask_len, + ret = nfp_mask_table_del(app_fw_flower, mask_data, mask_len, mask_entry->mask_id); if (ret != 0) return false; @@ -4667,7 +4745,7 @@ nfp_flow_process(struct nfp_flower_representor *representor, nfp_flow_meta = nfp_flow->payload.meta; mask_data = nfp_flow->payload.mask_data; mask_len = key_layer.key_size; - if (!nfp_check_mask_add(priv, mask_data, mask_len, + if (!nfp_check_mask_add(representor->app_fw_flower, mask_data, mask_len, &nfp_flow_meta->flags, &new_mask_id)) { PMD_DRV_LOG(ERR, "nfp mask add check failed."); goto free_flow; @@ -4684,7 +4762,7 @@ nfp_flow_process(struct nfp_flower_representor *representor, flow_find = nfp_flow_table_search(priv, nfp_flow); if (flow_find != NULL && !nfp_flow->merge_flag && !flow_find->merge_flag) { PMD_DRV_LOG(ERR, "This flow is already exist."); - if (!nfp_check_mask_remove(priv, mask_data, mask_len, + if (!nfp_check_mask_remove(representor->app_fw_flower, mask_data, mask_len, &nfp_flow_meta->flags)) { PMD_DRV_LOG(ERR, "nfp mask del check failed."); } @@ -4757,7 +4835,7 @@ nfp_flow_teardown(struct nfp_app_fw_flower *app_fw_flower, mask_data = nfp_flow->payload.mask_data; mask_len = nfp_flow_meta->mask_len << NFP_FL_LW_SIZ; nfp_flow_meta->flags &= ~NFP_FL_META_FLAG_MANAGE_MASK; - if (!nfp_check_mask_remove(priv, mask_data, mask_len, + if (!nfp_check_mask_remove(app_fw_flower, mask_data, mask_len, &nfp_flow_meta->flags)) { PMD_DRV_LOG(ERR, "nfp mask del check failed."); return -EINVAL; @@ -5283,24 +5361,26 @@ nfp_flow_priv_init(struct nfp_pf_dev *pf_dev) priv->total_mem_units = ctx_split; priv->ctx_count = ctx_count; - /* Init ring buffer and unallocated mask_ids. */ - priv->mask_ids.init_unallocated = NFP_FLOWER_MASK_ENTRY_RS - 1; - priv->mask_ids.free_list.buf = rte_zmalloc("nfp_app_mask_ids", - NFP_FLOWER_MASK_ENTRY_RS * NFP_FLOWER_MASK_ELEMENT_RS, 0); - if (priv->mask_ids.free_list.buf == NULL) { - PMD_INIT_LOG(ERR, "mask id free list creation failed"); - ret = -ENOMEM; - goto free_priv; - } + if (!pf_dev->multi_pf.enabled) { + /* Init ring buffer and unallocated mask_ids. */ + priv->mask_ids.init_unallocated = NFP_FLOWER_MASK_ENTRY_RS - 1; + priv->mask_ids.free_list.buf = rte_zmalloc("nfp_app_mask_ids", + NFP_FLOWER_MASK_ENTRY_RS * NFP_FLOWER_MASK_ELEMENT_RS, 0); + if (priv->mask_ids.free_list.buf == NULL) { + PMD_INIT_LOG(ERR, "mask id free list creation failed"); + ret = -ENOMEM; + goto free_priv; + } - /* Init ring buffer and unallocated stats_ids. */ - priv->stats_ids.init_unallocated = ctx_count / ctx_split; - priv->stats_ids.free_list.buf = rte_zmalloc("nfp_app_stats_ids", - priv->stats_ring_size * NFP_FL_STATS_ELEM_RS, 0); - if (priv->stats_ids.free_list.buf == NULL) { - PMD_INIT_LOG(ERR, "stats id free list creation failed"); - ret = -ENOMEM; - goto free_mask_id; + /* Init ring buffer and unallocated stats_ids. */ + priv->stats_ids.init_unallocated = ctx_count / ctx_split; + priv->stats_ids.free_list.buf = rte_zmalloc("nfp_app_stats_ids", + priv->stats_ring_size * NFP_FL_STATS_ELEM_RS, 0); + if (priv->stats_ids.free_list.buf == NULL) { + PMD_INIT_LOG(ERR, "stats id free list creation failed"); + ret = -ENOMEM; + goto free_mask_id; + } } /* Flow stats */ -- 2.39.1