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 D2E0445495; Wed, 19 Jun 2024 12:01:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A49AC42E6F; Wed, 19 Jun 2024 11:59:31 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2119.outbound.protection.outlook.com [40.107.243.119]) by mails.dpdk.org (Postfix) with ESMTP id DF58A42D45 for ; Wed, 19 Jun 2024 11:59:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KVHlhndaUs0eP8KC516FfNHN96p78djXCxnhnj9CKugJYEkGpbwhd2PJWZfdVLfw1i8+oTFS/bb3KVMmpXjBN2OQpkUtLe+DQrNJOvUS5Vuv9s3QzKzse+mWpKb7Ja2pr65Cyhv/FLUl1r/qSmzTcet34VA/RfQdrhH2WgwKc67wzpKdUyIbeEMxfZkkkYkuigN+1sKZxSLzlE2pFh0QAW+2PEjIy8pMXRFN1DzH4qjAd7ZquFoiptqY97POh2aU5tt6OHx19IDEtp9dx2XuW43IDViu+KxeWDIODAvWXZmJ2XHJoSte56zAKyk+59KY2FanWYK3T+Reb/Fn2lZyow== 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=jKfv9qE6luA8cRpuijqRNCc4sf95tflL7yYfmuTO5pw=; b=CVODvkdenLYVNfr/RG3VlHMIHgz9+teKIneMjl6BQUmkhbUdJ1YdcvPhoG3YwzzpgrAfKHVPcgr6JI9oC9vIXh00YQ802sJQhBbz1dbQggX1In4EE8DScaH1pTAQI2NG5jBOXoBo8rVD75a8BrfYKYTCtZ61JbF6hcggwr60RhsjOs4i/+KfGSF+5uzUdOhNloGjnDykQrXJdFgEfztWqsDjdQpVQAV+Givd4CQ22dhDXfLi9mWvnD7wTM3ZZeds4SYKwB+COSCYFeJ2Hxn9gXAmGUWT9K7JsOKZzM5rCBMhcePWwxb23+0udN5Ea43LNQVDUeVv0C1RG31paFwR6A== 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=jKfv9qE6luA8cRpuijqRNCc4sf95tflL7yYfmuTO5pw=; b=gOAxStedYQl2cywk18sxYcbcB+PZj42irmgny2TM64pHblczRSJoFLb3UB0Ohr74tyVOaCxgUrHb/L7oRZkD8DZSY7sxqlbbjSsISkwkx7LW3O8+SnMisq6rc9+VSnwZKZ4EuD9PXRY/NItqhp0G8RUhcMX+jHCVJZ0UXB9JaZE= 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:28 +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:28 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Peng Zhang , Chaoyong He , Long Wu Subject: [PATCH 20/23] net/nfp: add resource share mode of host context Date: Wed, 19 Jun 2024 17:58:27 +0800 Message-Id: <20240619095830.3479757-21-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: f927639a-ef0f-4ac3-6024-08dc904681cb 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?R3BXuWZcylL5HYJMoD5ItO0M2kT8gZSiK6UJPYWV1UHt0QE54Zug4mwW/GGq?= =?us-ascii?Q?AJgm8iSKRdCNTxLyJX4lf486gV6tKjY3e8HNGMQeuIK/GioaGGmxqpAfF2Xv?= =?us-ascii?Q?LJUj2V15ubgaZep8FEprZ3cSRtwYw1RZPu5fbdkmGySFZXkLkdnxEGkglcQL?= =?us-ascii?Q?NQvBcCdjLRMbFkkiz4GP11AHOEFPpnrgi/lU8WvK8tNhHVoBPrX4Tb4CovYg?= =?us-ascii?Q?38SSdNzEuCdKDfpopDAs2UodGRG342YPH5Uy89j1T9fZQxaSdCcHgx0w33Iw?= =?us-ascii?Q?ogeFt3sTNL34HlnLdsjahPLkNCQaK9cyl8P6VL0kdZQhvpmohvJ5P4T9x9aa?= =?us-ascii?Q?HWve9Z0BgWuSPOJpmQ/TkXCBtwkdho9YkbYhnIHV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YEFkKEeoS+mQPyUSk8dwLz7oCUuAhexKfUULAE5N1rdwc7?= =?us-ascii?Q?COsyxDcBluriqwJnudGTyJzDjbROIqHiu00XlKwVdv0MR3lPxhtDsAZwBaxl?= =?us-ascii?Q?yvsLW4w=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?UHujOYYkPUsdo+KC5KRmhLTGadL3ht+bCrTgdcZJvdSpXhcKZTh90XNu74xV?= =?us-ascii?Q?FcRYK/jVxlrPxx9Y6Ebb+5rOLpKcW4zmLdgGb5m8H83sD/mzIEkq6++3hDYg?= =?us-ascii?Q?8yDfFYViZfSzM6T/ertW8RRQ2o7TmNIyz2OjtcG6KEY08DGhsiU7Nl56h6SP?= =?us-ascii?Q?4Cr+lRiqMFSarHbCOeIRDxqa4/UyhY9bTyCdASWi7Gqsr+yxkYxJRv+D627L?= =?us-ascii?Q?VRMwaCPKMXmVjQcQ0OpE2SnSbfQvng4GyWX33DiW2gXvfWWJtCw73oq5WHiM?= =?us-ascii?Q?3+DpCAHkX3GjHjIley0tW7ezVKEwP9HqcuW8LzM0OCM+E4K4tRTAHbCQ7ajq?= =?us-ascii?Q?cTrXok27ICkOazf3PfJ5bnhnY4BfyRFPi9wpNJHfgzYRa2KMeY15DldBm9Av?= =?us-ascii?Q?Emo7rQSDgh4INI9E7Jr3FN/9m+qfdtJHO7EOIi0ivpJJMxFSXyIDH4eH5Wv0?= =?us-ascii?Q?GvnzW37qfK2+CIG+QliebXFFkYZnjbwYgpHQ7h7uP/0Q34bXxzPWnJW4rurW?= =?us-ascii?Q?G//QzKbm0MXvSs3pp9XC5+mbsR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?RuWKpEGMiYXSiMU+wzrNiSoToVPmoLyuM2ToCq5ffqKV0xwz4b9Vd+EutcCw?= =?us-ascii?Q?MjdAMgbHzh9YbxbDkUXI4+ATCUiNj7aHX8UpwIlot+Y3TeJEiqgOg72ogEEX?= =?us-ascii?Q?3Eo21v3+vwcvkoBWcdiGUtpoFuZsNizIkw2DNN0FIDz11G63/iQj+waO8dPA?= =?us-ascii?Q?jA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: f927639a-ef0f-4ac3-6024-08dc904681cb 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:28.2197 (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: LPdlMHmE5/wae3FlxbRzI6wIUmsxMre2fdGS8W3o9MubXSbwz3l8280u/ugXdeCXiBtKoJZysjrljnfwDN1OPjPObLeXJDLTWXGpVyp6nes= 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, host context resource should be shared between PFs, so change this resource allocation from driver to firmware. 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_conntrack.c | 2 +- drivers/net/nfp/flower/nfp_flower_flow.c | 89 ++++++++++++++++++++---- drivers/net/nfp/flower/nfp_flower_flow.h | 4 +- 3 files changed, 81 insertions(+), 14 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_conntrack.c b/drivers/net/nfp/flower/nfp_conntrack.c index f89003be8b..b0641b03d2 100644 --- a/drivers/net/nfp/flower/nfp_conntrack.c +++ b/drivers/net/nfp/flower/nfp_conntrack.c @@ -1020,7 +1020,7 @@ nfp_ct_offload_add(struct nfp_flower_representor *repr, return 0; flow_teardown: - nfp_flow_teardown(priv, nfp_flow, false); + nfp_flow_teardown(repr->app_fw_flower, nfp_flow, false); nfp_flow_free(nfp_flow); return ret; diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c index d8feff634a..215d655a18 100644 --- a/drivers/net/nfp/flower/nfp_flower_flow.c +++ b/drivers/net/nfp/flower/nfp_flower_flow.c @@ -487,7 +487,29 @@ nfp_flow_free(struct rte_flow *nfp_flow) } static int -nfp_stats_id_alloc(struct nfp_flow_priv *priv, uint32_t *ctx) +nfp_stats_id_alloc_from_hw(struct nfp_app_fw_flower *app_fw_flower, + uint32_t *stats_context_id) +{ + int ret; + struct nfp_net_hw_priv *hw_priv; + + hw_priv = app_fw_flower->pf_ethdev->process_private; + ret = nfp_rtsym_readl_indirect(hw_priv->pf_dev->sym_tbl, + "_FC_WC_EMU_0_HOST_CTX_RING_BASE", + "_FC_WC_HOST_CTX_RING_EMU_0", stats_context_id); + if (ret != 0) + return ret; + + /* Check if context id is an invalid value */ + if (*stats_context_id >= app_fw_flower->flow_priv->ctx_count) + return -ENOENT; + + return 0; +} + +static int +nfp_stats_id_alloc_from_driver(struct nfp_flow_priv *priv, + uint32_t *ctx) { struct circ_buf *ring; uint32_t temp_stats_id; @@ -523,7 +545,35 @@ nfp_stats_id_alloc(struct nfp_flow_priv *priv, uint32_t *ctx) } static int -nfp_stats_id_free(struct nfp_flow_priv *priv, uint32_t ctx) +nfp_stats_id_alloc(struct nfp_app_fw_flower *app_fw_flower, + uint32_t *stats_context_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_stats_id_alloc_from_hw(app_fw_flower, stats_context_id); + else + return nfp_stats_id_alloc_from_driver(app_fw_flower->flow_priv, + stats_context_id); +} + +static int +nfp_stats_id_free_to_hw(struct nfp_net_hw_priv *hw_priv, + uint32_t stats_context_id) +{ + int ret; + + ret = nfp_rtsym_writel_indirect(hw_priv->pf_dev->sym_tbl, + "_FC_WC_EMU_0_HOST_CTX_RING_BASE", + "_FC_WC_HOST_CTX_RING_EMU_0", stats_context_id); + + return ret; +} + +static int +nfp_stats_id_free_to_driver(struct nfp_flow_priv *priv, + uint32_t ctx) { struct circ_buf *ring; @@ -540,6 +590,20 @@ nfp_stats_id_free(struct nfp_flow_priv *priv, uint32_t ctx) return 0; } +static int +nfp_stats_id_free(struct nfp_app_fw_flower *app_fw_flower, + uint32_t stats_context_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_stats_id_free_to_hw(hw_priv, stats_context_id); + else + return nfp_stats_id_free_to_driver(app_fw_flower->flow_priv, + stats_context_id); +} + static int nfp_tun_add_ipv4_off(struct nfp_app_fw_flower *app_fw_flower, rte_be32_t ipv4) @@ -4570,8 +4634,7 @@ nfp_flow_process(struct nfp_flower_representor *representor, if (key_layer.port == (uint32_t)~0) key_layer.port = representor->port_id; - priv = representor->app_fw_flower->flow_priv; - ret = nfp_stats_id_alloc(priv, &stats_ctx); + ret = nfp_stats_id_alloc(representor->app_fw_flower, &stats_ctx); if (ret != 0) { PMD_DRV_LOG(ERR, "nfp stats id alloc failed."); return NULL; @@ -4586,6 +4649,7 @@ nfp_flow_process(struct nfp_flower_representor *representor, nfp_flow->install_flag = install_flag; nfp_flow->merge_flag = merge_flag; + priv = representor->app_fw_flower->flow_priv; nfp_flow_compile_metadata(priv, nfp_flow, &key_layer, stats_ctx, cookie); ret = nfp_flow_compile_items(representor, items, nfp_flow); @@ -4636,7 +4700,7 @@ nfp_flow_process(struct nfp_flower_representor *representor, free_flow: nfp_flow_free(nfp_flow); free_stats: - nfp_stats_id_free(priv, stats_ctx); + nfp_stats_id_free(representor->app_fw_flower, stats_ctx); return NULL; } @@ -4678,15 +4742,17 @@ nfp_flow_setup(struct nfp_flower_representor *representor, } int -nfp_flow_teardown(struct nfp_flow_priv *priv, +nfp_flow_teardown(struct nfp_app_fw_flower *app_fw_flower, struct rte_flow *nfp_flow, bool validate_flag) { char *mask_data; uint32_t mask_len; uint32_t stats_ctx; + struct nfp_flow_priv *priv; struct nfp_fl_rule_metadata *nfp_flow_meta; + priv = app_fw_flower->flow_priv; nfp_flow_meta = nfp_flow->payload.meta; mask_data = nfp_flow->payload.mask_data; mask_len = nfp_flow_meta->mask_len << NFP_FL_LW_SIZ; @@ -4704,7 +4770,7 @@ nfp_flow_teardown(struct nfp_flow_priv *priv, priv->flower_version++; stats_ctx = rte_be_to_cpu_32(nfp_flow_meta->host_ctx_id); - return nfp_stats_id_free(priv, stats_ctx); + return nfp_stats_id_free(app_fw_flower, stats_ctx); } static int @@ -4716,11 +4782,9 @@ nfp_flow_validate(struct rte_eth_dev *dev, { int ret; struct rte_flow *nfp_flow; - struct nfp_flow_priv *priv; struct nfp_flower_representor *representor; representor = dev->data->dev_private; - priv = representor->app_fw_flower->flow_priv; nfp_flow = nfp_flow_setup(representor, attr, items, actions, true); if (nfp_flow == NULL) { @@ -4729,7 +4793,7 @@ nfp_flow_validate(struct rte_eth_dev *dev, NULL, "This flow can not be offloaded."); } - ret = nfp_flow_teardown(priv, nfp_flow, true); + ret = nfp_flow_teardown(representor->app_fw_flower, nfp_flow, true); if (ret != 0) { return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, @@ -4799,7 +4863,7 @@ nfp_flow_create(struct rte_eth_dev *dev, return nfp_flow; flow_teardown: - nfp_flow_teardown(priv, nfp_flow, false); + nfp_flow_teardown(app_fw_flower, nfp_flow, false); nfp_flow_free(nfp_flow); return NULL; @@ -4838,7 +4902,7 @@ nfp_flow_destroy(struct rte_eth_dev *dev, } /* Update flow */ - ret = nfp_flow_teardown(priv, nfp_flow, false); + ret = nfp_flow_teardown(app_fw_flower, nfp_flow, false); if (ret != 0) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "Flow teardown failed."); @@ -5217,6 +5281,7 @@ nfp_flow_priv_init(struct nfp_pf_dev *pf_dev) priv->hash_seed = (uint32_t)rte_rand(); priv->stats_ring_size = ctx_count; 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; diff --git a/drivers/net/nfp/flower/nfp_flower_flow.h b/drivers/net/nfp/flower/nfp_flower_flow.h index 5d927edde9..5007438f67 100644 --- a/drivers/net/nfp/flower/nfp_flower_flow.h +++ b/drivers/net/nfp/flower/nfp_flower_flow.h @@ -7,6 +7,7 @@ #define __NFP_FLOWER_FLOW_H__ #include "../nfp_net_common.h" +#include "nfp_flower.h" /* The firmware expects lengths in units of long words */ #define NFP_FL_LW_SIZ 2 @@ -145,6 +146,7 @@ struct nfp_flow_priv { uint32_t active_mem_unit; /**< The size of active mem units. */ uint32_t total_mem_units; /**< The size of total mem units. */ uint32_t stats_ring_size; /**< The size of stats id ring. */ + uint32_t ctx_count; /**< Maximum number of host context. */ struct nfp_fl_stats_id stats_ids; /**< The stats id ring. */ struct nfp_fl_stats *stats; /**< Store stats of flow. */ rte_spinlock_t stats_lock; /** < Lock the update of 'stats' field. */ @@ -202,7 +204,7 @@ struct rte_flow *nfp_flow_process(struct nfp_flower_representor *representor, bool merge_flag); int nfp_flow_table_add_merge(struct nfp_flow_priv *priv, struct rte_flow *nfp_flow); -int nfp_flow_teardown(struct nfp_flow_priv *priv, +int nfp_flow_teardown(struct nfp_app_fw_flower *app_fw_flower, struct rte_flow *nfp_flow, bool validate_flag); void nfp_flow_free(struct rte_flow *nfp_flow); -- 2.39.1