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 CB69D42600; Tue, 19 Sep 2023 11:56:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D0FFC40E78; Tue, 19 Sep 2023 11:55:54 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2122.outbound.protection.outlook.com [40.107.96.122]) by mails.dpdk.org (Postfix) with ESMTP id A921A406BC for ; Tue, 19 Sep 2023 11:55:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nt0UESNFbjIB1XSevjOLw3TpAFfqZvB5qkyXkWnI0ldl2Dk6AFPZxUMVDCGc9nEAS7LxTC/PLQsGmqMXo4u32m9HsfcAqHfBgwLr6DOQ/7IOaug1zx104xLMQvQE+2KXkfUpKj7srlutuWEFVGWg/GcF4zx/TZosBKzkU6nHKdbcxroJP8/RSVmcr3Gaqea4jtfvEWwercMxeizOKmVRJ7M39rw9OYJ1Y6q/swPl2RA8C24RaNW42SnBSDkBI1sxlh9bySvWABcvPqwkY/BdaoODD1WjiR/908qp3VrYUK7S3QCtzO91WJxBTv8U18AxDsxmNA4XPo2Ho5CZNH8Ceg== 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=yXSTRgF8Wcy7EkAgHaTEOYXy8l9//W9YE1sBDIFEaEg=; b=ZuJ2VeexEMgCaejYlxH9hV5vimtnWuIH7g9EZw04N14G/T7qGE3FOjotdj2FJ4901tM3jXSVXGTD84b85ob/1iUBbRW6K4ujnm1giFXuTrQer4b+aBtMdcgPZcoh3hgVJ9X2mUW8atWusVlRoqTVg+EVwAg7U852YVbHJchtI5MLeBG4guYzUw+j+cD/lwNVbT1CzLhppViaeOfwOlda9VhINF+RK/jmzbVDSYvpqa2Yce1gS2UOjGWb4YyLrlcSwvXTzJznnW+WfciF6VUXvReGRKkMdtwe7inLqZNhqZ+IvkMvoLaGiEBd32fVJz1+q9PchTeeit9E6/WCIq2QPQ== 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=yXSTRgF8Wcy7EkAgHaTEOYXy8l9//W9YE1sBDIFEaEg=; b=HYw64UAjzjsLvgKKLaeFfqJ6AyIRi+bNHQcfbpOYSbYOFUjneonptd+d/mcTG/f42rtzgmyJBeacTgbBk7TjOQW6D70HX05pXEqYENHuKyoh1/GQrITcHS0NMLO0Pt8J7YMP5/q4a3PvevMUqyQVNQ+aRCBF+ijDZw4hlrg3Jsc= 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 PH7PR13MB5868.namprd13.prod.outlook.com (2603:10b6:510:15a::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.26; Tue, 19 Sep 2023 09:55:46 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7a1c:2887:348a:84bd]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7a1c:2887:348a:84bd%6]) with mapi id 15.20.6792.026; Tue, 19 Sep 2023 09:55:46 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He Subject: [PATCH v5 16/26] net/nfp: refact the target module Date: Tue, 19 Sep 2023 17:54:30 +0800 Message-Id: <20230919095440.45445-17-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230919095440.45445-1-chaoyong.he@corigine.com> References: <20230918024612.1600536-1-chaoyong.he@corigine.com> <20230919095440.45445-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BY5PR04CA0014.namprd04.prod.outlook.com (2603:10b6:a03:1d0::24) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH7PR13MB5868:EE_ X-MS-Office365-Filtering-Correlation-Id: 098a36d6-7ed8-4189-0eab-08dbb8f69874 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pd2sn+A134T6K/5/2Z1Dh3eYq03bKRylZf1sYi+ej5X+AwyB69gsaZcIaUZTpjKqGCxR90fLWwnOaUlvV1T7RtN3a3dj7cR6kocI+KYQ6em/+/h11PSJaK51YYvKymTx5B4SbV8rx5b+e1yK0YEl2nq/Y88CFOHVFBSVwSs6ulnZ9nIvUqsluScM65gSqE6iCvJuQg+lIX35Xm8UrIytbPZOpmuQYVOegnfD/Px7P36rsiCeTE9j9Lr71HyFh+1GRpgHhztfjpaxgsVzJVi0ldGr8e1VSX32VM7452hclNcBaAApnscfMwB9rvzn8YGA7MqrWot6qA73rOkqob/LtGJOcYpvABOEAWvLVnTs7YNW9GSdDOopz2sCT2/iZIIxGr2sm36Q/3+irl6KbexXVpCs2smwtNiON1ZiiAMuPZwPG6CzDSrqF+ybDbhxSo3oTPwAmE9t5Vo4pBlciC7zsTsw5oKKh+djWsA1GmoeMpq6hhRJygOYVjYrwQ0vud96k/2a+JNrWGuk8Z1ojoL4N+C9xU5XmyZ+pIBQGu3KbnXUnjuOiPhXM1noD5HgVlYP3bG6V1c9UFcs/m9pVB8IopvdHbTyPax3mCtDOY2p1bBS7zRR25XrJnQaTQf3QFCu18+xq5WbSvDh+xDtNvQq7X2m+1AkA69ihKFVxfY9K7Q= 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:(13230031)(136003)(366004)(346002)(376002)(396003)(39840400004)(1800799009)(186009)(451199024)(26005)(8936002)(2616005)(1076003)(8676002)(4326008)(107886003)(83380400001)(2906002)(36756003)(44832011)(86362001)(52116002)(6506007)(6486002)(478600001)(5660300002)(6666004)(6916009)(316002)(6512007)(38100700002)(66946007)(66476007)(41300700001)(66556008)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?OJU3LXqwfsuJZo0ZmCqZ6onAhPgbqRKfkIvzUjq9W+qqCwnNoMwjkYxDRHqj?= =?us-ascii?Q?LO7xlu3iN8LnX4pcXinH9rUciLCZFvo0hpBH2UbMCjB61VaEPim6ncn40jyC?= =?us-ascii?Q?pbj2nu1BzJZbt0ggklA54hEgtwCM+7BByQrP7kg0qzorRQBCq3Lr3N9E3bgw?= =?us-ascii?Q?afXH15DwxW/8RMkIKk5BHkkg3jsJ59kJnv4EGlqzzYgElFxBIEeEZGEVrb3Y?= =?us-ascii?Q?V8WPiN8wVG4pymY2sOpa6/HApa96PXXgsyIYyniQtsjVFiYjVLvgNrfM7BMs?= =?us-ascii?Q?/HyEwKnSrsNqL50XxrUWP9oMFf0m384/U4C91zEY9Co3g6NR58iDoI7DZJgP?= =?us-ascii?Q?eoL5IGrpyFbpatPyJmLeQGA+sZoQJRyL9MhdF6DLLgSlrLMn8Xzg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GCh3ASB2V8uZG1jNOvrRV+wFXOPr289gswDWfC1YLm2M7VPfi?= =?us-ascii?Q?B7PaB6UC4nJt4euQCrKZ2CJzXLukCJp+7/AqSsuzVvUkflC01IBrONkS00IJ?= =?us-ascii?Q?jGIE2+J/pit4pUnqYerG9Fw8lNOjPDoWMN2/Re68mvLZg3DejcsS96IB4lyc?= =?us-ascii?Q?365jS58LsT0Bg0ZqcKuat22dNge51MYbkkXFsEq21E55MPxh0xofWGX6wD+Y?= =?us-ascii?Q?eyqIjruPz29bwU6mkCpEqH3YLG8t1hKpZIL6TmpKA6atxo//N6yydOyFm6MH?= =?us-ascii?Q?fSCGGgpnJTQ5tfQ7i7Phlvz6aZ6HiUStfuMySLqlBji5LgnbfDI1iq325IJm?= =?us-ascii?Q?2g=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 098a36d6-7ed8-4189-0eab-08dbb8f69874 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 09:55:46.5404 (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: 93WPq7zVeqPPNm4PxGpkiksvb0QLr56OL0n5C1BbSuH0IXFAcYvokkb4W66j47BmCojJtjXhVywrrteby4TgrSYuPRZlpXqfrOc80E3wQ0k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB5868 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 Move the function declaration into the header file, and sync some logic from kernel driver. Signed-off-by: Chaoyong He --- drivers/net/nfp/nfpcore/nfp6000/nfp6000.h | 20 -------------------- drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 1 + drivers/net/nfp/nfpcore/nfp_cppcore.c | 1 + drivers/net/nfp/nfpcore/nfp_mutex.c | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 1 - drivers/net/nfp/nfpcore/nfp_resource.c | 2 +- drivers/net/nfp/nfpcore/nfp_rtsym.c | 1 + drivers/net/nfp/nfpcore/nfp_target.c | 7 ++++--- drivers/net/nfp/nfpcore/nfp_target.h | 22 ++++++++++++++++++++++ 9 files changed, 31 insertions(+), 26 deletions(-) diff --git a/drivers/net/nfp/nfpcore/nfp6000/nfp6000.h b/drivers/net/nfp/nfpcore/nfp6000/nfp6000.h index efaa87c0e5..4c9ac017cc 100644 --- a/drivers/net/nfp/nfpcore/nfp6000/nfp6000.h +++ b/drivers/net/nfp/nfpcore/nfp6000/nfp6000.h @@ -6,21 +6,6 @@ #ifndef __NFP_NFP6000_H__ #define __NFP_NFP6000_H__ -/* CPP Target IDs */ -#define NFP_CPP_TARGET_INVALID 0 -#define NFP_CPP_TARGET_NBI 1 -#define NFP_CPP_TARGET_QDR 2 -#define NFP_CPP_TARGET_ILA 6 -#define NFP_CPP_TARGET_MU 7 -#define NFP_CPP_TARGET_PCIE 9 -#define NFP_CPP_TARGET_ARM 10 -#define NFP_CPP_TARGET_CRYPTO 12 -#define NFP_CPP_TARGET_ISLAND_XPB 14 /* Shared with CAP */ -#define NFP_CPP_TARGET_ISLAND_CAP 14 /* Shared with XPB */ -#define NFP_CPP_TARGET_CT_XPB 14 -#define NFP_CPP_TARGET_LOCAL_SCRATCH 15 -#define NFP_CPP_TARGET_CLS NFP_CPP_TARGET_LOCAL_SCRATCH - #define NFP_ISL_EMEM0 24 #define NFP_MU_ADDR_ACCESS_TYPE_MASK 3ULL @@ -52,9 +37,4 @@ nfp_cppat_mu_locality_lsb(int mode, int addr40) } } -int nfp_target_pushpull(uint32_t cpp_id, uint64_t address); -int nfp_target_cpp(uint32_t cpp_island_id, uint64_t cpp_island_address, - uint32_t *cpp_target_id, uint64_t *cpp_target_address, - const uint32_t *imb_table); - #endif /* NFP_NFP6000_H */ diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c index db15411eb2..310cc691cd 100644 --- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c +++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c @@ -34,6 +34,7 @@ #include "nfp_cpp.h" #include "nfp_logs.h" +#include "nfp_target.h" #include "nfp6000/nfp6000.h" #include "../nfp_logs.h" diff --git a/drivers/net/nfp/nfpcore/nfp_cppcore.c b/drivers/net/nfp/nfpcore/nfp_cppcore.c index 7173b4d8a5..41485b6975 100644 --- a/drivers/net/nfp/nfpcore/nfp_cppcore.c +++ b/drivers/net/nfp/nfpcore/nfp_cppcore.c @@ -16,6 +16,7 @@ #include "nfp_cpp.h" #include "nfp_logs.h" +#include "nfp_target.h" #include "nfp6000/nfp6000.h" #include "nfp6000/nfp_xpb.h" #include "nfp_nffw.h" diff --git a/drivers/net/nfp/nfpcore/nfp_mutex.c b/drivers/net/nfp/nfpcore/nfp_mutex.c index 82598be7a1..96ba60697c 100644 --- a/drivers/net/nfp/nfpcore/nfp_mutex.c +++ b/drivers/net/nfp/nfpcore/nfp_mutex.c @@ -9,7 +9,7 @@ #include "nfp_cpp.h" #include "nfp_logs.h" -#include "nfp6000/nfp6000.h" +#include "nfp_target.h" #define MUTEX_LOCKED(interface) ((((uint32_t)(interface)) << 16) | 0x000f) #define MUTEX_UNLOCK(interface) (0 | 0x0000) diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c index 32c1838a40..36bd49d659 100644 --- a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c +++ b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c @@ -9,7 +9,6 @@ #include "nfp_cpp.h" #include "nfp_logs.h" #include "nfp_nsp.h" -#include "nfp6000/nfp6000.h" #define NSP_ETH_NBI_PORT_COUNT 24 #define NSP_ETH_MAX_COUNT (2 * NSP_ETH_NBI_PORT_COUNT) diff --git a/drivers/net/nfp/nfpcore/nfp_resource.c b/drivers/net/nfp/nfpcore/nfp_resource.c index c0afdbfdd2..539eb69680 100644 --- a/drivers/net/nfp/nfpcore/nfp_resource.c +++ b/drivers/net/nfp/nfpcore/nfp_resource.c @@ -7,7 +7,7 @@ #include "nfp_crc.h" #include "nfp_logs.h" -#include "nfp6000/nfp6000.h" +#include "nfp_target.h" #define NFP_RESOURCE_TBL_TARGET NFP_CPP_TARGET_MU #define NFP_RESOURCE_TBL_BASE 0x8100000000ULL diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c index 2d4100dda2..022753f98a 100644 --- a/drivers/net/nfp/nfpcore/nfp_rtsym.c +++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c @@ -14,6 +14,7 @@ #include "nfp_logs.h" #include "nfp_mip.h" +#include "nfp_target.h" #include "nfp6000/nfp6000.h" enum nfp_rtsym_type { diff --git a/drivers/net/nfp/nfpcore/nfp_target.c b/drivers/net/nfp/nfpcore/nfp_target.c index 540b242a43..ecb45f7928 100644 --- a/drivers/net/nfp/nfpcore/nfp_target.c +++ b/drivers/net/nfp/nfpcore/nfp_target.c @@ -3,6 +3,8 @@ * All rights reserved. */ +#include "nfp_target.h" + #include "nfp_cpp.h" #include "nfp6000/nfp6000.h" @@ -315,8 +317,7 @@ nfp6000_mu(uint32_t cpp_id, } else if (island == 1 || (island >= 4 && island <= 7) || (island >= 12 && island <= 13) || - (island >= 32 && island <= 47) || - (island >= 48 && island <= 51)) { + (island >= 32 && island <= 51)) { pp = nfp6000_mu_ctm(cpp_id); } else { pp = -EINVAL; @@ -510,7 +511,7 @@ nfp_target_pushpull(uint32_t cpp_id, return nfp6000_cap_xpb(cpp_id); case NFP_CPP_TARGET_CLS: return nfp6000_cls(cpp_id); - case 0: + case NFP_CPP_TARGET_INVALID: return target_rw(cpp_id, P32, 4, 4); default: return -EINVAL; diff --git a/drivers/net/nfp/nfpcore/nfp_target.h b/drivers/net/nfp/nfpcore/nfp_target.h index 2a2f083914..47527b4040 100644 --- a/drivers/net/nfp/nfpcore/nfp_target.h +++ b/drivers/net/nfp/nfpcore/nfp_target.h @@ -6,4 +6,26 @@ #ifndef __NFP_TARGET_H__ #define __NFP_TARGET_H__ +#include + +/* CPP Target IDs */ +#define NFP_CPP_TARGET_INVALID 0 +#define NFP_CPP_TARGET_NBI 1 +#define NFP_CPP_TARGET_QDR 2 +#define NFP_CPP_TARGET_ILA 6 +#define NFP_CPP_TARGET_MU 7 +#define NFP_CPP_TARGET_PCIE 9 +#define NFP_CPP_TARGET_ARM 10 +#define NFP_CPP_TARGET_CRYPTO 12 +#define NFP_CPP_TARGET_ISLAND_XPB 14 /* Shared with CAP */ +#define NFP_CPP_TARGET_ISLAND_CAP 14 /* Shared with XPB */ +#define NFP_CPP_TARGET_CT_XPB 14 +#define NFP_CPP_TARGET_LOCAL_SCRATCH 15 +#define NFP_CPP_TARGET_CLS NFP_CPP_TARGET_LOCAL_SCRATCH + +int nfp_target_pushpull(uint32_t cpp_id, uint64_t address); +int nfp_target_cpp(uint32_t cpp_island_id, uint64_t cpp_island_address, + uint32_t *cpp_target_id, uint64_t *cpp_target_address, + const uint32_t *imb_table); + #endif /* __NFP_TARGET_H__ */ -- 2.39.1