From patchwork Mon Sep 18 02:46:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chaoyong He X-Patchwork-Id: 131550 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 906CD425C9; Mon, 18 Sep 2023 04:49:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 486444161A; Mon, 18 Sep 2023 04:47:46 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2136.outbound.protection.outlook.com [40.107.244.136]) by mails.dpdk.org (Postfix) with ESMTP id C5C2B410E6 for ; Mon, 18 Sep 2023 04:47:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZnEWaG1dahJy/ray2V54oVcF89XgY3Ws7zcRn3Zqvl9pnCsI74GLOoLGSUUclnDY3OmSIQA0a6TflsbagaSTGuxFnBkO3mknZa1o8xgkLR1tMv90J6bEgQINjGHWHgnTUu3D+myM95woMKEi/g5GUQZSuZULOTAzKrb9XJ5g3YT3++D+IYMhMdC32w97Ll9CgirOHjjzVQyRCbwojff0KqxJqSJ4WNpJtPdEwyn/0eb2VOuDTYMlxOrUd1nLkqIK+9GKC13eGsr0r51p35Ma8/IHPPWhlGbx2yI0G1wbHylJS/2BQ4vxu6iaYcr44AXQHKo2FTQoXACe4x+l4IR3yQ== 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=ovzO09qnU3ugkHVloS6A9tqijTDU6yrMEANCNhrdoJs=; b=d2mcIzseDyRJPHgK4O4/3lR3omrSinwnpNrLiRqpNt67iVD5zZXd5d6g+jz1lBSiVlYnQTPjXaKplXgjdZCYWd5DPC7bWdlySMrChdJqaQi/ICuEBJTTLAfbGHrzp1pdV8aXLnF/JZXLBobd/kCd55o93E6vejXb/slWGsQtU19j2kPwesXBW1lfitP8ARwR6WDJMPwrLeHds4mxfuIym9yMizD1i4n8PmP3ahA30MuQM4v/B3V1YkxML0D2rsPMlEb7LcUHlcaq9vNzscfuJCXkYm3Pf7gcUiebMuFKFLLPVNjHCy2oSNKhepzMUN5gjz3xlIiXS22exvqU6EXW1A== 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=ovzO09qnU3ugkHVloS6A9tqijTDU6yrMEANCNhrdoJs=; b=vRVPHwnr4ENhEtRbm04DgCfW7RxMyFJxgkkbF6QN/VzO3r66OsuH1u7Ap50IM6ssXeA/G1Db0ak8AWwrc4bOj0JnrdvbwiB1oFal/qjF3KsNP2PAg1CjBiH+D8Ccg6EzMPaIqBP+z0Hv7FNM44G84F3ktbo7YaGH1X4j4HD1gNk= 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 PH7PR13MB6435.namprd13.prod.outlook.com (2603:10b6:510:2ea::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.26; Mon, 18 Sep 2023 02:47:39 +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; Mon, 18 Sep 2023 02:47:39 +0000 From: Chaoyong He To: dev@dpdk.org Cc: Chaoyong He , =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH v4 16/26] net/nfp: refact the target module Date: Mon, 18 Sep 2023 10:46:02 +0800 Message-Id: <20230918024612.1600536-17-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230918024612.1600536-1-chaoyong.he@corigine.com> References: <20230915091551.1459606-1-chaoyong.he@corigine.com> <20230918024612.1600536-1-chaoyong.he@corigine.com> X-ClientProxiedBy: SE2P216CA0016.KORP216.PROD.OUTLOOK.COM (2603:1096:101:114::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_|PH7PR13MB6435:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c356d68-7f41-4518-4421-08dbb7f19f5b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PI+BCZgdJCx5xGoVCaYVv4EkoAXeLsbPk1UoFjmawpSHV03NAQGVvNgS74JNcaIIeikA9uedMKFcjF1ACZ19ilVMX4reUymiARDDcy8tm13rbYk+sZnFObOXzfeQ2LDuPjh2rhKubc7YSxRiThz5Q9RWq4j5O62ZdbngpmY3RTxk0Ql4YSZsNRsMvRT9G7MoJcvH9OyKJMbsPdRTHiBDnd96+W67KruM28dYWuYnfoNTV4U5D8zraTm4Icrp1QiQGlmlTwgfPEQwmVHRIVRugVyzKfDwSgGkqNsozh4j6zwjpY3Ym+iihcValjKf3LSX2fwVErC0Z2+UUe8oTmTRTPFufHFErsh7X3ttywllJsWo9MhpyN4/Zm9hK9Ph+OMJwLPrf41i0vUG1UoisSX4Su0UbEsAYNNyJLopMGCqrFh6reCOf9URYOBGRFGnJgvfiRLx94ka8nR2zJJcNMfnO+vD5mHqPOC469g5vmbqtIWr0fN4YUZVnX0LAOfTp++MMCLxwl2ZX/na4JZYT3OFR0hT7bfSzXCQawX3Sq07zB5tW2BiPGh0OLtpuSLYwIa5H1Cb5m18Jzv+FE6vJKbCndKYEP9R8ALuwKyUmXMuH/jo1QYm2hdqlX9CbMsBxIjENEvUy1SS31VjGgqCihvB8cTNSdRfx0Rxvn6KQ5LZE50= 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)(39830400003)(136003)(346002)(366004)(376002)(396003)(1800799009)(451199024)(186009)(54906003)(66476007)(66946007)(66574015)(41300700001)(6916009)(316002)(8676002)(4326008)(8936002)(52116002)(6506007)(6486002)(6512007)(478600001)(6666004)(83380400001)(26005)(1076003)(2616005)(107886003)(86362001)(2906002)(44832011)(38100700002)(38350700002)(5660300002)(36756003)(66556008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?wrYcEbmk/SlHPrudoB3/7SkYGnts?= =?utf-8?q?xoAVWuDpirG3FLSvaxDjdVDAm0rp+WCo70RV0iOyREvu9AyWD/4trZgKv9nYVbaOL?= =?utf-8?q?M2YDSSpzwPsAMO6iKSpR4TRCL0uAitwWy+pV7/C4ikce+mEFe03JoUPCSOnvsx4UD?= =?utf-8?q?RK0QXigHfdvCH/PJ69lc5DKDNo/PuEgeF/MG4zN1CLaY1CJVAW8i01MJjkTwdnIdt?= =?utf-8?q?63+FuOZfUOuF3Np9x3ZKLSDtAExUQiE7XaLDACog7xUcOm5RNVlKFnkUCwUE5yRkj?= =?utf-8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f-8?q?qS2zy+sI/aa3gxW94PEkBRWiZccyvM7ho0Idl95IQxLWMXTYEkXWlzWQLqwg+dJsO?= =?utf-8?q?p7JQun3WBwkEw5/ieTFDBEwWtFi9mOd6b6HD5t+BvEfj2MdbmikHdbIXcQpJ4m9kt?= =?utf-8?q?uhe3Aph0dcS/BXXDNUu9g5E0TAaLgNrA9oB3v7IUmtis3EN9LomARGmbYPc9KzGw9?= =?utf-8?q?OAEx+WoV/kQg8xj/umyCvP4sxDmvREi+CnqhbYlc14q1CrYkEMPPmzYZycfKAycHG?= =?utf-8?q?6FvytrEuimbf25TJzr2CeExcqjHJdS9R+96g2TQKwzbHjkCD/Oqnv3+u1Jo/6yPV+?= =?utf-8?q?EhQGk/gclSJi1t44PEybuNaYGQObWkBbSb0UPqi1cWl7cY0QJ/LhP46V2zu2K77Lv?= =?utf-8?q?JsLxuCQUS4Q2VyjAuVO7oBZAaDuhNBxoWA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c356d68-7f41-4518-4421-08dbb7f19f5b X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2023 02:47:39.3272 (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: cBWnYyBGDTXnPbbG103UGglCP6EjM41fBTZNjrtWJdhzp314Ju2vTxF4Ec5DiUXmkIZuf7vstZbsXP7k+qEawjP/xjdCTigwPioUU/tBgxQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB6435 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 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__ */