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 EE1CC42910; Mon, 10 Apr 2023 13:01:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E54D142D0B; Mon, 10 Apr 2023 13:01:04 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2106.outbound.protection.outlook.com [40.107.243.106]) by mails.dpdk.org (Postfix) with ESMTP id F10ED42D33 for ; Mon, 10 Apr 2023 13:01:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gHeTeqLrJABfApdJ4vg0t+7Q9atn1Fp0fb7T7JTUDgtFSPkot55+7a8aV2rzlwjjctP6mtDg/TwnRNARdRKHEbtKM7wczLe5UW9SgbBPvlspXa4XP4Rq0Vd0VXdaUniqu1K1ulJz8uqpw4ffN7rg0alqU9Z4ttc7x4UMCEOhnibcd2OYDocY/Ue1EUzu4k7BXn7ZmlL2hawGCiXAKR6cLa2FUxVS/LsNt5oiqQ3crjw1GFQCT8Kqd+F+XcT442M5H67X01QKGFeRLaSFSffuDQjLWqz5vFxnhyt7xkY3x9Dba33gQhhRFL1vpp49AWxJWoeeXVmYvhN5lotBX5zWqw== 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=ba89yhBfXiXUq3bT8PMskM3geeHu0i5bTTPCnOhCAHM=; b=K0tqqQZ+HDA55qS/2EMrhf6MwHv9pxmCVvkzH/VlUBbFKhWQFuoymicFX7PxRqP+C8X9ICsv6uwn2BhZ2oEW1v8QikLKxGS7W6SVwYIamCkrlRZkEqBiKoPL/C2/4sWWTzlWkDLYiIAcI/uxBHgBfpGAMj3Q8+ca2WWrrDY00zADGEfPRYn0bRy3aVjn7vhta5o9k6/FvHgHQ56MQbetxhCVdLrz2Itr8PndDxo/9PQUjsyAOT9XKuMYkfpVkVXlLp750paHQhaSbGgbkHHdK/F+E0Vy7+E6i3t8TkGZVatNtyDQVO3YWrr7w5f/6mZxzciWNvR7xJvXs1mGFFcJ3Q== 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=ba89yhBfXiXUq3bT8PMskM3geeHu0i5bTTPCnOhCAHM=; b=G1SJ013FQqzrSCTWpV0VzgcAFRmaR2iU8T4jySVAoU3ljnFldJj4UDFOFrdHBBkyct04ETaJZPnL+SC88x4fM16p4ZaUEBqmULkD7wYG87PbWjBwHXaKmmrkHE0fsBDQA20cyBaoMWnmpA2Sds/vedl+zCh3y4b6PYcXGMdLxp0= 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 DM6PR13MB3882.namprd13.prod.outlook.com (2603:10b6:5:22a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.31; Mon, 10 Apr 2023 11:01:00 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::baa6:b49:d2f4:c60e]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::baa6:b49:d2f4:c60e%4]) with mapi id 15.20.6277.036; Mon, 10 Apr 2023 11:01:00 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH 06/13] net/nfp: remove dead code related to CPP Date: Mon, 10 Apr 2023 19:00:08 +0800 Message-Id: <20230410110015.2973660-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230410110015.2973660-1-chaoyong.he@corigine.com> References: <20230410110015.2973660-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0040.apcprd01.prod.exchangelabs.com (2603:1096:4:193::14) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DM6PR13MB3882:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b93a572-9b03-4527-39dd-08db39b2de93 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8UI3VGNpMuB5AhW+FGZVWdR5zsK0tazzXH9vW6OG4KHWrSWpflDOvxJaEMsgo4kQoPLbKcA+dg49BiZK+dC1Hn7PrXHYhBetOJVEm4QCh/WCQ+OrFMvQFpS5KM5N0IfIGJi2tl7gP2V0KhVPkhBapUizehC8Pa935GyNwuPRZ4GCa/DW7qIdpxFNSXAem4q4STtVZs/ATXVdmN6Pe4pgP/Ny1LBWqi5xwJ+4Mm/BtQAOWgShB/7wYLGcfyUKjnvITyqxZ6C29EYvnk2KeqrPMixY6pGfkzkzhwa0OsM9RpGrGVPF9fFiK1RmKC4CrqdEXMiYf5zRCLEL/0gMjxqcP0UVUahSoPvrJ9kkc3wq/tHyXnUq382T1PMgYnGsSPFwrBABkJAQIBkOY/lPoEfkQTb6r+Y1iWQx3HxicckKQiWR9mnJPtVS9fNbQVli/6vZ3j1cRM97Pb6gAgU860PuubNJfM1EgArouZdCEYo4NGMUAPGNI8WLjfQhA6tUqrAMNWATwBy2nSgT5MAu+aKRMY575PXDVXpqo6Lm0xDtDGJh20smE/hnbZ14Ll6GJu9v6OH30S9fbbmtoBsg5zR5I9mE4BGkwREAS6Wa1aU3o1Jkh/CLWMiT8l2rOcp3+n+k 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:(13230028)(4636009)(396003)(39840400004)(366004)(376002)(136003)(346002)(451199021)(316002)(86362001)(66556008)(66574015)(66476007)(478600001)(83380400001)(66946007)(38100700002)(38350700002)(36756003)(186003)(6512007)(4326008)(8676002)(2616005)(6916009)(41300700001)(2906002)(1076003)(6506007)(26005)(107886003)(8936002)(52116002)(30864003)(5660300002)(6486002)(44832011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TmZpNzBOQXduZ3RlRWtRbUlzWDBWNE54dGl1bFV1Z3g3My9Wc1A2VXFycXhG?= =?utf-8?B?VjBDNTdPOFFJRmVpNDNrZ2lWZmJuMW1Zbkg0c2orQnJqSkNHeEZuazRXenhL?= =?utf-8?B?SUdCNnlZQmlpaURWczA4WGtzN21ZNTNnTU5LN0EwUGo4N3ZxNEVPbEcvYm5K?= =?utf-8?B?QzBNVy9PdjhsODdUcHg2SElheG85NTVZakVTVjFVKzdJRGtGUmtndG1ITmRH?= =?utf-8?B?YWxubm14Z25zRHBrVHZacmgrSlFLSU5yVWd1M0NNelBKTWp0bmZuTVBBbzJR?= =?utf-8?B?blBGdGdCVkNheUUrc05TMktIYWdaWW9PTEY1R25qVDV2WCsxSlU3SUZzMHFu?= =?utf-8?B?ZUV6dzVBckdTVzJKWTM5UTRPeDVlTTlhQmVlOFE2SHpheFU4UlRqR1BwaTJk?= =?utf-8?B?TklB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ange-CrossTenant-Network-Message-Id: 0b93a572-9b03-4527-39dd-08db39b2de93 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2023 11:01:00.6588 (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: 7Xki80iYHELpn1kmZIHpgQJcEmyk+NsGLy9HB8FaqawNgf7KGTK3Ww8xTsc++yUGS7M9kv3jT28Wp7QJp9xllwNWCjpImvVLA1tQ4fmHthI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB3882 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 The header file bpf_resid.h contains function prototypes that are not implemented anywhere, as well as a few defines and macros that are not used anywhere. Move the few inline functions, defines and macros that are used into nfp_cpp.h and remove bpf_resid.h. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- .../net/nfp/nfpcore/nfp-common/nfp_resid.h | 577 ------------------ drivers/net/nfp/nfpcore/nfp_cpp.h | 97 ++- drivers/net/nfp/nfpcore/nfp_target.h | 1 - 3 files changed, 95 insertions(+), 580 deletions(-) delete mode 100644 drivers/net/nfp/nfpcore/nfp-common/nfp_resid.h diff --git a/drivers/net/nfp/nfpcore/nfp-common/nfp_resid.h b/drivers/net/nfp/nfpcore/nfp-common/nfp_resid.h deleted file mode 100644 index 5445d4dac8..0000000000 --- a/drivers/net/nfp/nfpcore/nfp-common/nfp_resid.h +++ /dev/null @@ -1,577 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2018 Netronome Systems, Inc. - * All rights reserved. - */ - -#ifndef __NFP_RESID_H__ -#define __NFP_RESID_H__ - -#if (!defined(_NFP_RESID_NO_C_FUNC) && \ - (defined(__NFP_TOOL_NFCC) || defined(__NFP_TOOL_NFAS))) -#define _NFP_RESID_NO_C_FUNC -#endif - -/* - * NFP Chip Architectures - * - * These are semi-arbitrary values to indicate an NFP architecture. - * They serve as a software view of a group of chip families, not necessarily a - * direct mapping to actual hardware design. - */ -#define NFP_CHIP_ARCH_YD 1 -#define NFP_CHIP_ARCH_TH 2 - -/* - * NFP Chip Families. - * - * These are not enums, because they need to be microcode compatible. - * They are also not maskable. - * - * Note: The NFP-4xxx family is handled as NFP-6xxx in most software - * components. - * - */ -#define NFP_CHIP_FAMILY_NFP6000 0x6000 /* ARCH_TH */ - -/* NFP Microengine/Flow Processing Core Versions */ -#define NFP_CHIP_ME_VERSION_2_7 0x0207 -#define NFP_CHIP_ME_VERSION_2_8 0x0208 -#define NFP_CHIP_ME_VERSION_2_9 0x0209 - -/* NFP Chip Base Revisions. Minor stepping can just be added to these */ -#define NFP_CHIP_REVISION_A0 0x00 -#define NFP_CHIP_REVISION_B0 0x10 -#define NFP_CHIP_REVISION_C0 0x20 -#define NFP_CHIP_REVISION_PF 0xff /* Maximum possible revision */ - -/* - * Wildcard indicating a CPP read or write action - * - * The action used will be either read or write depending on whether a read or - * write instruction/call is performed on the NFP_CPP_ID. It is recommended that - * the RW action is used even if all actions to be performed on a NFP_CPP_ID are - * known to be only reads or writes. Doing so will in many cases save NFP CPP - * internal software resources. - */ -#define NFP_CPP_ACTION_RW 32 - -#define NFP_CPP_TARGET_ID_MASK 0x1f - -/* - * NFP_CPP_ID - pack target, token, and action into a CPP ID. - * - * Create a 32-bit CPP identifier representing the access to be made. - * These identifiers are used as parameters to other NFP CPP functions. Some - * CPP devices may allow wildcard identifiers to be specified. - * - * @param[in] target NFP CPP target id - * @param[in] action NFP CPP action id - * @param[in] token NFP CPP token id - * @return NFP CPP ID - */ -#define NFP_CPP_ID(target, action, token) \ - ((((target) & 0x7f) << 24) | (((token) & 0xff) << 16) | \ - (((action) & 0xff) << 8)) - -#define NFP_CPP_ISLAND_ID(target, action, token, island) \ - ((((target) & 0x7f) << 24) | (((token) & 0xff) << 16) | \ - (((action) & 0xff) << 8) | (((island) & 0xff) << 0)) - -#ifndef _NFP_RESID_NO_C_FUNC - -/** - * Return the NFP CPP target of a NFP CPP ID - * @param[in] id NFP CPP ID - * @return NFP CPP target - */ -static inline uint8_t -NFP_CPP_ID_TARGET_of(uint32_t id) -{ - return (id >> 24) & NFP_CPP_TARGET_ID_MASK; -} - -/* - * Return the NFP CPP token of a NFP CPP ID - * @param[in] id NFP CPP ID - * @return NFP CPP token - */ -static inline uint8_t -NFP_CPP_ID_TOKEN_of(uint32_t id) -{ - return (id >> 16) & 0xff; -} - -/* - * Return the NFP CPP action of a NFP CPP ID - * @param[in] id NFP CPP ID - * @return NFP CPP action - */ -static inline uint8_t -NFP_CPP_ID_ACTION_of(uint32_t id) -{ - return (id >> 8) & 0xff; -} - -/* - * Return the NFP CPP action of a NFP CPP ID - * @param[in] id NFP CPP ID - * @return NFP CPP action - */ -static inline uint8_t -NFP_CPP_ID_ISLAND_of(uint32_t id) -{ - return (id) & 0xff; -} - -#endif /* _NFP_RESID_NO_C_FUNC */ - -/* - * Check if @p chip_family is an ARCH_TH chip. - * @param chip_family One of NFP_CHIP_FAMILY_* - */ -#define NFP_FAMILY_IS_ARCH_TH(chip_family) \ - ((int)(chip_family) == (int)NFP_CHIP_FAMILY_NFP6000) - -/* - * Get the NFP_CHIP_ARCH_* of @p chip_family. - * @param chip_family One of NFP_CHIP_FAMILY_* - */ -#define NFP_FAMILY_ARCH(x) \ - (__extension__ ({ \ - typeof(x) _x = (x); \ - (NFP_FAMILY_IS_ARCH_TH(_x) ? NFP_CHIP_ARCH_TH : \ - NFP_FAMILY_IS_ARCH_YD(_x) ? NFP_CHIP_ARCH_YD : -1) \ - })) - -/* - * Check if @p chip_family is an NFP-6xxx chip. - * @param chip_family One of NFP_CHIP_FAMILY_* - */ -#define NFP_FAMILY_IS_NFP6000(chip_family) \ - ((int)(chip_family) == (int)NFP_CHIP_FAMILY_NFP6000) - -/* - * Make microengine ID for NFP-6xxx. - * @param island_id Island ID. - * @param menum ME number, 0 based, within island. - * - * NOTE: menum should really be unsigned - MSC compiler throws error (not - * warning) if a clause is always true i.e. menum >= 0 if cluster_num is type - * unsigned int hence the cast of the menum to an int in that particular clause - */ -#define NFP6000_MEID(a, b) \ - (__extension__ ({ \ - typeof(a) _a = (a); \ - typeof(b) _b = (b); \ - (((((int)(_a) & 0x3F) == (int)(_a)) && \ - (((int)(_b) >= 0) && ((int)(_b) < 12))) ? \ - (int)(((_a) << 4) | ((_b) + 4)) : -1) \ - })) - -/* - * Do a general sanity check on the ME ID. - * The check is on the highest possible island ID for the chip family and the - * microengine number must be a master ID. - * @param meid ME ID as created by NFP6000_MEID - */ -#define NFP6000_MEID_IS_VALID(meid) \ - (__extension__ ({ \ - typeof(meid) _a = (meid); \ - ((((_a) >> 4) < 64) && (((_a) >> 4) >= 0) && \ - (((_a) & 0xF) >= 4)) \ - })) - -/* - * Extract island ID from ME ID. - * @param meid ME ID as created by NFP6000_MEID - */ -#define NFP6000_MEID_ISLAND_of(meid) (((meid) >> 4) & 0x3F) - -/* - * Extract microengine number (0 based) from ME ID. - * @param meid ME ID as created by NFP6000_MEID - */ -#define NFP6000_MEID_MENUM_of(meid) (((meid) & 0xF) - 4) - -/* - * Extract microengine group number (0 based) from ME ID. - * The group is two code-sharing microengines, so group 0 refers to MEs 0,1, - * group 1 refers to MEs 2,3 etc. - * @param meid ME ID as created by NFP6000_MEID - */ -#define NFP6000_MEID_MEGRP_of(meid) (NFP6000_MEID_MENUM_of(meid) >> 1) - -#ifndef _NFP_RESID_NO_C_FUNC - -/* - * Convert a string to an ME ID. - * - * @param s A string of format iX.meY - * @param endptr If non-NULL, *endptr will point to the trailing string - * after the ME ID part of the string, which is either - * an empty string or the first character after the separating - * period. - * @return ME ID on success, -1 on error. - */ -int nfp6000_idstr2meid(const char *s, const char **endptr); - -/* - * Extract island ID from string. - * - * Example: - * char *c; - * int val = nfp6000_idstr2island("i32.me5", &c); - * // val == 32, c == "me5" - * val = nfp6000_idstr2island("i32", &c); - * // val == 32, c == "" - * - * @param s A string of format "iX.anything" or "iX" - * @param endptr If non-NULL, *endptr will point to the trailing string - * after the island part of the string, which is either - * an empty string or the first character after the separating - * period. - * @return If successful, the island ID, -1 on error. - */ -int nfp6000_idstr2island(const char *s, const char **endptr); - -/* - * Extract microengine number from string. - * - * Example: - * char *c; - * int menum = nfp6000_idstr2menum("me5.anything", &c); - * // menum == 5, c == "anything" - * menum = nfp6000_idstr2menum("me5", &c); - * // menum == 5, c == "" - * - * @param s A string of format "meX.anything" or "meX" - * @param endptr If non-NULL, *endptr will point to the trailing string - * after the ME number part of the string, which is either - * an empty string or the first character after the separating - * period. - * @return If successful, the ME number, -1 on error. - */ -int nfp6000_idstr2menum(const char *s, const char **endptr); - -/* - * Extract context number from string. - * - * Example: - * char *c; - * int val = nfp6000_idstr2ctxnum("ctx5.anything", &c); - * // val == 5, c == "anything" - * val = nfp6000_idstr2ctxnum("ctx5", &c); - * // val == 5, c == "" - * - * @param s A string of format "ctxN.anything" or "ctxN" - * @param endptr If non-NULL, *endptr will point to the trailing string - * after the context number part of the string, which is either - * an empty string or the first character after the separating - * period. - * @return If successful, the context number, -1 on error. - */ -int nfp6000_idstr2ctxnum(const char *s, const char **endptr); - -/* - * Extract microengine group number from string. - * - * Example: - * char *c; - * int val = nfp6000_idstr2megrp("tg2.anything", &c); - * // val == 2, c == "anything" - * val = nfp6000_idstr2megrp("tg5", &c); - * // val == 2, c == "" - * - * @param s A string of format "tgX.anything" or "tgX" - * @param endptr If non-NULL, *endptr will point to the trailing string - * after the ME group part of the string, which is either - * an empty string or the first character after the separating - * period. - * @return If successful, the ME group number, -1 on error. - */ -int nfp6000_idstr2megrp(const char *s, const char **endptr); - -/* - * Create ME ID string of format "iX[.meY]". - * - * @param s Pointer to char buffer of size NFP_MEID_STR_SZ. - * The resulting string is output here. - * @param meid Microengine ID. - * @return Pointer to "s" on success, NULL on error. - */ -const char *nfp6000_meid2str(char *s, int meid); - -/* - * Create ME ID string of format "name[.meY]" or "iX[.meY]". - * - * @param s Pointer to char buffer of size NFP_MEID_STR_SZ. - * The resulting string is output here. - * @param meid Microengine ID. - * @return Pointer to "s" on success, NULL on error. - * - * Similar to nfp6000_meid2str() except use an alias instead of "iX" - * if one exists for the island. - */ -const char *nfp6000_meid2altstr(char *s, int meid); - -/* - * Create string of format "iX". - * - * @param s Pointer to char buffer of size NFP_MEID_STR_SZ. - * The resulting string is output here. - * @param island_id Island ID. - * @return Pointer to "s" on success, NULL on error. - */ -const char *nfp6000_island2str(char *s, int island_id); - -/* - * Create string of format "name", an island alias. - * - * @param s Pointer to char buffer of size NFP_MEID_STR_SZ. - * The resulting string is output here. - * @param island_id Island ID. - * @return Pointer to "s" on success, NULL on error. - */ -const char *nfp6000_island2altstr(char *s, int island_id); - -/* - * Create string of format "meY". - * - * @param s Pointer to char buffer of size NFP_MEID_STR_SZ. - * The resulting string is output here. - * @param menum Microengine number within island. - * @return Pointer to "s" on success, NULL on error. - */ -const char *nfp6000_menum2str(char *s, int menum); - -/* - * Create string of format "ctxY". - * - * @param s Pointer to char buffer of size NFP_MEID_STR_SZ. - * The resulting string is output here. - * @param ctxnum Context number within microengine. - * @return Pointer to "s" on success, NULL on error. - */ -const char *nfp6000_ctxnum2str(char *s, int ctxnum); - -/* - * Create string of format "tgY". - * - * @param s Pointer to char buffer of size NFP_MEID_STR_SZ. - * The resulting string is output here. - * @param megrp Microengine group number within cluster. - * @return Pointer to "s" on success, NULL on error. - */ -const char *nfp6000_megrp2str(char *s, int megrp); - -/* - * Convert a string to an ME ID. - * - * @param chip_family Chip family ID - * @param s A string of format iX.meY (or clX.meY) - * @param endptr If non-NULL, *endptr will point to the trailing - * string after the ME ID part of the string, which - * is either an empty string or the first character - * after the separating period. - * @return ME ID on success, -1 on error. - */ -int nfp_idstr2meid(int chip_family, const char *s, const char **endptr); - -/* - * Extract island ID from string. - * - * Example: - * char *c; - * int val = nfp_idstr2island(chip, "i32.me5", &c); - * // val == 32, c == "me5" - * val = nfp_idstr2island(chip, "i32", &c); - * // val == 32, c == "" - * - * @param chip_family Chip family ID - * @param s A string of format "iX.anything" or "iX" - * @param endptr If non-NULL, *endptr will point to the trailing - * string after the ME ID part of the string, which - * is either an empty string or the first character - * after the separating period. - * @return The island ID on succes, -1 on error. - */ -int nfp_idstr2island(int chip_family, const char *s, const char **endptr); - -/* - * Extract microengine number from string. - * - * Example: - * char *c; - * int menum = nfp_idstr2menum("me5.anything", &c); - * // menum == 5, c == "anything" - * menum = nfp_idstr2menum("me5", &c); - * // menum == 5, c == "" - * - * @param chip_family Chip family ID - * @param s A string of format "meX.anything" or "meX" - * @param endptr If non-NULL, *endptr will point to the trailing - * string after the ME ID part of the string, which - * is either an empty string or the first character - * after the separating period. - * @return The ME number on succes, -1 on error. - */ -int nfp_idstr2menum(int chip_family, const char *s, const char **endptr); - -/* - * Extract context number from string. - * - * Example: - * char *c; - * int val = nfp_idstr2ctxnum("ctx5.anything", &c); - * // val == 5, c == "anything" - * val = nfp_idstr2ctxnum("ctx5", &c); - * // val == 5, c == "" - * - * @param s A string of format "ctxN.anything" or "ctxN" - * @param endptr If non-NULL, *endptr will point to the trailing string - * after the context number part of the string, which is either - * an empty string or the first character after the separating - * period. - * @return If successful, the context number, -1 on error. - */ -int nfp_idstr2ctxnum(int chip_family, const char *s, const char **endptr); - -/* - * Extract microengine group number from string. - * - * Example: - * char *c; - * int val = nfp_idstr2megrp("tg2.anything", &c); - * // val == 2, c == "anything" - * val = nfp_idstr2megrp("tg5", &c); - * // val == 5, c == "" - * - * @param s A string of format "tgX.anything" or "tgX" - * @param endptr If non-NULL, *endptr will point to the trailing string - * after the ME group part of the string, which is either - * an empty string or the first character after the separating - * period. - * @return If successful, the ME group number, -1 on error. - */ -int nfp_idstr2megrp(int chip_family, const char *s, const char **endptr); - -/* - * Create ME ID string of format "iX[.meY]". - * - * @param chip_family Chip family ID - * @param s Pointer to char buffer of size NFP_MEID_STR_SZ. - * The resulting string is output here. - * @param meid Microengine ID. - * @return Pointer to "s" on success, NULL on error. - */ -const char *nfp_meid2str(int chip_family, char *s, int meid); - -/* - * Create ME ID string of format "name[.meY]" or "iX[.meY]". - * - * @param chip_family Chip family ID - * @param s Pointer to char buffer of size NFP_MEID_STR_SZ. - * The resulting string is output here. - * @param meid Microengine ID. - * @return Pointer to "s" on success, NULL on error. - * - * Similar to nfp_meid2str() except use an alias instead of "iX" - * if one exists for the island. - */ -const char *nfp_meid2altstr(int chip_family, char *s, int meid); - -/* - * Create string of format "iX". - * - * @param chip_family Chip family ID - * @param s Pointer to char buffer of size NFP_MEID_STR_SZ. - * The resulting string is output here. - * @param island_id Island ID. - * @return Pointer to "s" on success, NULL on error. - */ -const char *nfp_island2str(int chip_family, char *s, int island_id); - -/* - * Create string of format "name", an island alias. - * - * @param chip_family Chip family ID - * @param s Pointer to char buffer of size NFP_MEID_STR_SZ. - * The resulting string is output here. - * @param island_id Island ID. - * @return Pointer to "s" on success, NULL on error. - */ -const char *nfp_island2altstr(int chip_family, char *s, int island_id); - -/* - * Create string of format "meY". - * - * @param chip_family Chip family ID - * @param s Pointer to char buffer of size NFP_MEID_STR_SZ. - * The resulting string is output here. - * @param menum Microengine number within island. - * @return Pointer to "s" on success, NULL on error. - */ -const char *nfp_menum2str(int chip_family, char *s, int menum); - -/* - * Create string of format "ctxY". - * - * @param s Pointer to char buffer of size NFP_MEID_STR_SZ. - * The resulting string is output here. - * @param ctxnum Context number within microengine. - * @return Pointer to "s" on success, NULL on error. - */ -const char *nfp_ctxnum2str(int chip_family, char *s, int ctxnum); - -/* - * Create string of format "tgY". - * - * @param s Pointer to char buffer of size NFP_MEID_STR_SZ. - * The resulting string is output here. - * @param megrp Microengine group number within cluster. - * @return Pointer to "s" on success, NULL on error. - */ -const char *nfp_megrp2str(int chip_family, char *s, int megrp); - -/* - * Convert a two character string to revision number. - * - * Revision integer is 0x00 for A0, 0x11 for B1 etc. - * - * @param s Two character string. - * @return Revision number, -1 on error - */ -int nfp_idstr2rev(const char *s); - -/* - * Create string from revision number. - * - * String will be upper case. - * - * @param s Pointer to char buffer with size of at least 3 - * for 2 characters and string terminator. - * @param rev Revision number. - * @return Pointer to "s" on success, NULL on error. - */ -const char *nfp_rev2str(char *s, int rev); - -/* - * Get the NFP CPP address from a string - * - * String is in the format [island@]target[:[action:[token:]]address] - * - * @param chip_family Chip family ID - * @param tid Pointer to string to parse - * @param cpp_idp Pointer to CPP ID - * @param cpp_addrp Pointer to CPP address - * @return 0 on success, or -1 and errno - */ -int nfp_str2cpp(int chip_family, - const char *tid, - uint32_t *cpp_idp, - uint64_t *cpp_addrp); - - -#endif /* _NFP_RESID_NO_C_FUNC */ - -#endif /* __NFP_RESID_H__ */ diff --git a/drivers/net/nfp/nfpcore/nfp_cpp.h b/drivers/net/nfp/nfpcore/nfp_cpp.h index d657a7c164..2441012b95 100644 --- a/drivers/net/nfp/nfpcore/nfp_cpp.h +++ b/drivers/net/nfp/nfpcore/nfp_cpp.h @@ -8,8 +8,6 @@ #include -#include "nfp-common/nfp_resid.h" - struct nfp_cpp_mutex; /* @@ -113,6 +111,101 @@ struct nfp_cpp_operations { unsigned int length); }; +/* + * Wildcard indicating a CPP read or write action + * + * The action used will be either read or write depending on whether a read or + * write instruction/call is performed on the NFP_CPP_ID. It is recommended that + * the RW action is used even if all actions to be performed on a NFP_CPP_ID are + * known to be only reads or writes. Doing so will in many cases save NFP CPP + * internal software resources. + */ +#define NFP_CPP_ACTION_RW 32 + +#define NFP_CPP_TARGET_ID_MASK 0x1f + +/* + * Pack target, token, and action into a CPP ID. + * + * Create a 32-bit CPP identifier representing the access to be made. + * These identifiers are used as parameters to other NFP CPP functions. + * Some CPP devices may allow wildcard identifiers to be specified. + * + * @target NFP CPP target id + * @action NFP CPP action id + * @token NFP CPP token id + * + * @return NFP CPP ID + */ +#define NFP_CPP_ID(target, action, token) \ + ((((target) & 0x7f) << 24) | (((token) & 0xff) << 16) | \ + (((action) & 0xff) << 8)) + +/* + * Pack target, token, action, and island into a CPP ID. + * @target NFP CPP target id + * @action NFP CPP action id + * @token NFP CPP token id + * @island NFP CPP island id + * + * Create a 32-bit CPP identifier representing the access to be made. + * These identifiers are used as parameters to other NFP CPP functions. + * Some CPP devices may allow wildcard identifiers to be specified. + * + * @return NFP CPP ID + */ +#define NFP_CPP_ISLAND_ID(target, action, token, island) \ + ((((target) & 0x7f) << 24) | (((token) & 0xff) << 16) | \ + (((action) & 0xff) << 8) | (((island) & 0xff) << 0)) + +/** + * Return the NFP CPP target of a NFP CPP ID + * @id NFP CPP ID + * + * @return NFP CPP target + */ +static inline uint8_t +NFP_CPP_ID_TARGET_of(uint32_t id) +{ + return (id >> 24) & NFP_CPP_TARGET_ID_MASK; +} + +/* + * Return the NFP CPP token of a NFP CPP ID + * @id NFP CPP ID + * + * @return NFP CPP token + */ +static inline uint8_t +NFP_CPP_ID_TOKEN_of(uint32_t id) +{ + return (id >> 16) & 0xff; +} + +/* + * Return the NFP CPP action of a NFP CPP ID + * @id NFP CPP ID + * + * @return NFP CPP action + */ +static inline uint8_t +NFP_CPP_ID_ACTION_of(uint32_t id) +{ + return (id >> 8) & 0xff; +} + +/* + * Return the NFP CPP island of a NFP CPP ID + * @id NFP CPP ID + * + * @return NFP CPP island + */ +static inline uint8_t +NFP_CPP_ID_ISLAND_of(uint32_t id) +{ + return id & 0xff; +} + /* * This should be the only external function the transport * module supplies diff --git a/drivers/net/nfp/nfpcore/nfp_target.h b/drivers/net/nfp/nfpcore/nfp_target.h index accedde1f7..03908a894f 100644 --- a/drivers/net/nfp/nfpcore/nfp_target.h +++ b/drivers/net/nfp/nfpcore/nfp_target.h @@ -6,7 +6,6 @@ #ifndef NFP_TARGET_H #define NFP_TARGET_H -#include "nfp-common/nfp_resid.h" #include "nfp_cpp.h" #define P32 1 -- 2.39.1