From patchwork Fri Sep 15 09:15:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chaoyong He X-Patchwork-Id: 131492 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4817A425A3; Fri, 15 Sep 2023 11:18:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E68B41109; Fri, 15 Sep 2023 11:16:52 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2090.outbound.protection.outlook.com [40.107.223.90]) by mails.dpdk.org (Postfix) with ESMTP id E05DE41109 for ; Fri, 15 Sep 2023 11:16:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ly7UfoIUJt/oH5W+3CYOKfBDmk16gpgFXOztjeXhpl6JmpYtl0/Dai+NPRd+/Qn46LfSmUjvvjsYopBr/9baqvmUXEG6KLZwJFh/qhuZkr9wCPK/eZvcrVoI/GJAka6yRAdfhFzyGysP8VdQIbNYh0lu28TwBsEf051yFWrqut95LsvKhlppOeJhzA3t9ubBfhPl9vUh8QulHAWvdI48FjGqnfFu28x1xeGfqphAfDzfD+Eb3qNIgRszo3CyEHTf5oKa0oxxhYcANSCouj5Vpw7ySJ6ng1GEADURzLfjhC9WXUzm/ZclQeQlowQltLffAvoiv5OeazKxbTYhZHmwkg== 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=ZvzfA0mMpS/MLb37C8xF4KSMhtvvTvq5ICf91NBqI+w=; b=npUef1FUOcIjw7TTl5OiwjDuOYq5QMVx8DKEQMLBeq/usqQFhLq4qVAT0Ci3zr9rB7NZPSWfPRO9O//yCjeD/ubAIv2Q3HAyH09fi4wGnqWs58awpFuRWvRCJCBHG1sA3lJ9Y0cENcYyqQyH5gqQHXitPn6EgtGdk9U5wvf9evQJFdIIR2/IE/R29iqAvNikQdUHjhs7HSkcUcirlSg55B8jhsamfTDWgFAfLHgnBojOs/IL0K7vS3Zvf1vVenUk99exPaZclYWcTfCQuooJMyw5CvjPzgWa+96eXx9S3WbinxSMTPCY7P+2+wGJtTbh1mOE7k0lwAF3JNcEDlSEIg== 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=ZvzfA0mMpS/MLb37C8xF4KSMhtvvTvq5ICf91NBqI+w=; b=oa94iz/0JiIIUXFzsDWV973aYQrP2BMsDCwA5FFGgk7KUWU4VynQcq7eQzxuAVerHXTSqRhDfkqOhI0I1AKdgP/a7pejJVm5LFjLn5elYC/lJrdauRcoka+9IwkSQe8ZZih1ev0DtTSsPfTR9sLf6jXFGMkUYQisP5vSVNcT374= 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 CO1PR13MB4773.namprd13.prod.outlook.com (2603:10b6:303:fb::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21; Fri, 15 Sep 2023 09:16:48 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::c05c:6915:1628:70c4]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::c05c:6915:1628:70c4%7]) with mapi id 15.20.6768.029; Fri, 15 Sep 2023 09:16:48 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH v3 17/27] net/nfp: refact the target module Date: Fri, 15 Sep 2023 17:15:41 +0800 Message-Id: <20230915091551.1459606-18-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230915091551.1459606-1-chaoyong.he@corigine.com> References: <20230830021457.2064750-1-chaoyong.he@corigine.com> <20230915091551.1459606-1-chaoyong.he@corigine.com> X-ClientProxiedBy: PH7PR10CA0017.namprd10.prod.outlook.com (2603:10b6:510:23d::10) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CO1PR13MB4773:EE_ X-MS-Office365-Filtering-Correlation-Id: 81f75f21-fbfc-4016-a7d1-08dbb5cc7d4e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CR52s6VWzbOBhB8ON4QhIBIyCDHHv5ebzyYCNhyYbzP1Y7spPjSBNr/dFTaGW7ySH7Cw3CNv6nGO1cXF3cDSrMARinifgpsqaDoFsD+Ma6wrLA4NHcA7VYSmyD1qcrbQykXANYLVJp3RAvFDSX8A+gVcwCE8sKjwHUleznIpLrRf47X8hByA1E1C+nM+WmvnXNT9btXEvB87dKKKvppPiHdMkX+jPRxFHYFFB5dO5PWbNZ9tbUPK/xbMgLF6uaR+368/nLiXf/rDl7h9OkoDkU4NCukKB8WwQy6ecFMN9bjHEPhEJ0tfLnztFuKmI3s8TE81uQVH8coe5c+FPstiosFGErYKmTNalGlu4jjYQApxmmYE6Iod6JND2b4j95sNTW6fYcJNUOeBdpK+ZVw/V2oNAKE8gxYHoSmKXTXlAy9F8IRFW7oB9gEnp8wt5DOdx1unsxtlgSwKqQ0UNMuBBfwKLKPo0q6VPWcz/VBW7c9Wnx1rflGGnKR06f0q+KmOuhVQ4XyOEowtmnaTUlle6K3u78+EmL/W/5w3Q+DUcgux5bJp/o0WvecH3YoDWgTipnyT70couclt8KoGk5kCFWsFiL/J2lsrjzNCyRQrD/lvf68qXjJhSkAagDdYmDlxEJ681Fv+SOcwJxiVlE6Xm9zAJaC/W3GRmMKmvwPAafY= 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)(39840400004)(346002)(136003)(376002)(396003)(366004)(451199024)(186009)(1800799009)(6512007)(107886003)(1076003)(2616005)(6666004)(52116002)(6506007)(6486002)(66946007)(26005)(316002)(41300700001)(66476007)(66556008)(6916009)(54906003)(5660300002)(4326008)(8676002)(38350700002)(8936002)(38100700002)(478600001)(66574015)(83380400001)(36756003)(44832011)(86362001)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Hve6lkYi73uWV3kWfOTiy7DZCbek?= =?utf-8?q?ZTMoCbGzrTY0IcmEVsRRhh/GErhBDxqytZVentNB0OAdxI9q5GYY6U7F9hiciURbA?= =?utf-8?q?ZvLawYBhS304j+jg/JUkfQFlMv6ratqPpQ2kA2Px2Dcfy7sTctsJDNros1sDC8OgM?= =?utf-8?q?qvoNlZur0A2dOUT6hRVLuI13RIc5Rc7hgH0dJWk5jEIwK9tGysBtf4Fl6QHxaXeq2?= =?utf-8?q?YC6limqa5y+AGNyAKwFcTZZvsRqCaMu87Mj2pMBvN7a3jZ6SryqazSXWkiOhWt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m2+INfugpC9i?= =?utf-8?q?HR/jhty1L+rLmHG3IqPa2FT3ftfzDvt5ZcctfG6GamIKX5fyZ4h3XHr4qu9Fh9jyH?= =?utf-8?q?S0boPc1lZL7g+4c9xC7v61oRnJLaHpm+UTfcic3lcKYyc60WwOhwxqXFUV5+lAQSy?= =?utf-8?q?o5TJeQSw/KEunhO2fs4Fsa+tNJh69yqEjm08xAsG/wIkdz6ve/UiIecyz6me0cP7K?= =?utf-8?q?0Jxx0eICznWC3z8YW7bus1yauljIjINGTffQqPUNxzJ9J082Nv5zDhqi25B3zQDUw?= =?utf-8?q?sUWfgqPkVjv7s/bK6xO2D1za+jIIoImCcOzX7QYQ+qiO2cro3tj53xTpibKXS6Ns/?= =?utf-8?q?U/+jp6RhxOREdKsBW7aAu7D32FNyvvbvBycU6SJnrCCF/km4Zdo9KfXORh2SbEMLE?= =?utf-8?q?hB2yVaKrSljktQn6EN4YxK+TdtOiMuIpWg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81f75f21-fbfc-4016-a7d1-08dbb5cc7d4e X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 09:16:48.6315 (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: KXkgm5mgWyH7wVefZH/iYNBZgjdXHeJrHaspDMzJZ5Xt/QMmem+5GoRQXrD7ZlO1JvaGkqLUNQ/+Yhj4gDDNgEEndMjurN7w7B9a6p8CBaY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR13MB4773 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 Reviewed-by: Niklas Söderlund --- 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 0f68c5d667..b7eb53697f 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 85c33502ca..87a9351ff9 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 fba7a1dc12..7d8d35e3dd 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 e4a3a42eea..ee987c4438 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__ */