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 5C51442600; Tue, 19 Sep 2023 11:56:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C4A7A40DF5; Tue, 19 Sep 2023 11:55:52 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2125.outbound.protection.outlook.com [40.107.96.125]) by mails.dpdk.org (Postfix) with ESMTP id D3D8040A70 for ; Tue, 19 Sep 2023 11:55:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WDzgBdcrpwYIoAKz7Ywb2Yw3LPeVHXk6ayLtlZOnch2MHJ2SB26ptgo3c8k4mNvkct/AubKJSyeNZ8n7KaH37Kxzz1A/MFB4fTLNdR3MHhc/l5UyNf1CJNCBBUija14JlKHYDRCyAgiW2mqFeYwAwzQgRgV2AyLp1b+Q7qnlopvzDrY9fuTFIvAPH1XZon4jlgYRfHGifOEKx708UUFNArJiW43NtzoHBC23GsfvVILMO8/ImHawWrNbMZxd4vseIFhTtDGP4KK7HwJSY7Fp6ZiWlpFyR5eBhklp3zYj9aWi/VAIQWBkXGVcwocsZkC/UxBhPWiZtIwu1dNCRC8dTA== 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=HF0GUxvjlslgtUIiqHwpYGxh+gnPiXMzvdgW14P4c+s=; b=WA5pLdQC4v+hcv4S0fMWwoVLdwIX97HC9oLRDoDKqENPkb86YwMO6w1f+Jw5shQYJLZ7+lD5ylwQIRnxBA3do+CgyFDxJ63mtdd2eGOI86iUAqzk7QqKwXhglE48MmMSJrvSNY2GQRSNhhNkr5vUuUETrkszdmm5bmIXhrscDnaJ7DZMpRs1b9cZCy5Sv6Euxo88lNZsBeLx9iKLNo95Dj2fV0jcIrgaRU+iak9hWKK8PmDVeuO8rzhXP5YydwzmB9w2Lr3xSjkCANHZzmwbtLzMA17IPZpWLrj5/aYjMWcctuwGVuNGfx+cBJ9pwD2BpukVLi++TgZqWWRthy7ISA== 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=HF0GUxvjlslgtUIiqHwpYGxh+gnPiXMzvdgW14P4c+s=; b=RPz7amQpmuWR3aqQPSoU2M4FmeHIIi/lMtMN5gx2QU1LPINt+yWu61XIRdOY/BjbY7KmZ1fEow/35wVu0VBK/ig5p5SFeMfIXN/czdKg5AJF4ZfOHDYCDIhtwYqew4vtztq7vo96+jLhi5R8eKmLbaRRus6ZB7g9hd5iGR3FDt0= 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:25 +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:24 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He Subject: [PATCH v5 02/26] net/nfp: unify the indent coding style Date: Tue, 19 Sep 2023 17:54:16 +0800 Message-Id: <20230919095440.45445-3-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: 07ef281e-7590-4f72-79c4-08dbb8f68a5d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zE1LgziUTLBTDBTaebRkS2C216/BqWdSmyij3GjQuBZ0jHyv+Z+VZUo0Qi5zFBSJfGt1KsIaunvGwztDalTnxy01LjVcIr/PUI6vUSvv6O0nEqyuJpojtDSo4gXfQgEnH7nZn9mKON36yPi5keqzwsc3umWe/wAgAHw/kjl8BzWGkgYy5g1h+nelP/snWFEntpIoSugt3mnr3EnY0R1lwK2RH9hNJZAHCCXJRbCkE2xBwx5yO38E7SrBG0B4AyAPExvjdzvx8dp1/ytjClcVvHrvYtaSh4UEBj03a+B4DsL8mGKvSi6bsoWFvtqNBMANilU/6ZvJd9rf3Y/98eBtCPKU8XWSYiL3uWMa4aKxvZ86TgBB8V8s/WBGszhrcpR3R2Oo+TFtulk85Rdvhcf6voiT0QR3wv9H6vvIckjgB3rkLTpMhGv17htLCJF3Yjq8zr9yBWueOQpTme9MQ+/PNx2/961VwwkanbVc740zgyP1lds++qYw2LRlBbaONf/sx8MBAB4n17uclzgqLQnYDYXP8AoYukTN7T4nuARyrhjEJ6lcetuUcHslXKgXM9w1SYnObFRV5yGesqiJMpTFWfkandFkDFGm1qfzZFQGbUJ+pmNqcXydZKxMfTZyVS0rjICYVndh5d6vxvvL8jA0AJRWizlJ4xFFjRnr7/zZ6Zk0HoBG/6pK3vK99E3bu5CD 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)(39830400003)(366004)(346002)(376002)(396003)(1800799009)(186009)(451199024)(26005)(8936002)(2616005)(1076003)(8676002)(4326008)(107886003)(83380400001)(2906002)(30864003)(36756003)(44832011)(86362001)(52116002)(6506007)(6486002)(478600001)(5660300002)(6666004)(6916009)(316002)(6512007)(38100700002)(66946007)(66476007)(41300700001)(66556008)(38350700002)(559001)(579004)(309714004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?/cUxrK7xsLdWTgGnooCGfN59GNwZGPLuG+uoZ9dSvdKWNlYHYzwvM4TPxI+7?= =?us-ascii?Q?lxRvKNA5PqRmncup3uwAPrcHmuzBvryYNw/MPNsNUXLeXOnnJgjpNTsmuyrt?= =?us-ascii?Q?AQb+wVuithkLaGglVKwwfAbR3GtDZYMCNKMsurzZnFWhpGxsCayhy9KVU9WM?= =?us-ascii?Q?S7ALClNQuwfHQeFVirW0QDoCei2oPxvNTMA4aA2iYOed3g7MSsv3qJCYLvXS?= =?us-ascii?Q?eBZagwE3Ilw8+/2h1tcfMiwN4B1NFk80p5aT52MfunmDmCYU2zjzVd2vamlS?= =?us-ascii?Q?2czPTjMg1pe4tYlAnwrLCD+xfeHyakVfJBLCygm9Ol33CEbQk4Wj15zN9sZ8?= =?us-ascii?Q?eub+mUMS2Zr0y2vBW73tKuGofigaJmo1U7i+TejGb7hOzvhdH7JwDVQjBNuT?= =?us-ascii?Q?H1/GZkLoapvWPDqa2Z+yb7H635NBOfXi5ygQTBEIRMW3is4Bq6G0Ta6EiZJi?= =?us-ascii?Q?iE7d9UiatZnFRjgJL7ljbiVkG9EO05gtBq99ADLGisYXcGc35N/ej9KaFCpv?= =?us-ascii?Q?zJdbHy9VktYTVt//5DMLxiBe56pDsc9PiSukdkp3IcHLTNwuT8vkMaOlsmW8?= =?us-ascii?Q?vwMKCuF34VHBbDNbcOeMjok22201/pr467CauWT5t+wGMEE8nOEDz/VFgk7r?= =?us-ascii?Q?V4SiXaHjYeTD59gSrzzjKSZITlQi+1jsU0PrRQL4ITmBM5CKOwhrLDIiXXhy?= =?us-ascii?Q?FMRMWZ1QFOQOF/SkN9Nah6moli+NXZPSufLQdIH+Hfgh87VudFdCVXNSWMIS?= =?us-ascii?Q?uVo5RXbpIHouVqBOaB4WlMiPqwqKsDlMghC8tZfMLeFoG8Iq0Mku4Sq6sMCC?= =?us-ascii?Q?QY+Rue0iDuUvq07IFj1yMKL6qQQuQ0L/Ts6bRAWrc79R3YKYJc9E4GMn+AN+?= =?us-ascii?Q?rVpgopBBo0iG1qqhACWQHcQuTZbufK0q+cF7FRovAJaoQVzQ5lKM11SXBU1r?= =?us-ascii?Q?RvCxAfpS1Sne89ne/brEBh4gB1CEW6kg4RESFbbdnBmvM4oJMWot6CtHvyrn?= =?us-ascii?Q?+RVq3pLiCA0avGMEDeO7NWKCiOHZuZMdGrKg6g8SidSZyOfHvAWEuFK7hERH?= =?us-ascii?Q?Z/Mziat1Pg3Vc9HvNQzK356Wj8E8gcafsMPNHIB/0MTc/YW5yflbiFVt8s7W?= =?us-ascii?Q?x0b+lrP1N679rnlgSRg13pPkdJeasgPLUy8/iLREsB0CUn6oEtEOqzVnfwXT?= =?us-ascii?Q?pYkVwanMmcMrIMJRmAnzspoyBKWgyjT93fgRolm5zLCGtWMvUPcidP5+SiGr?= =?us-ascii?Q?UrHcIc+i8t/l4yeZobao6NVjTfA1SMtRTt0XRunufzlEJPQpgoupm8TltESg?= =?us-ascii?Q?J3uwJ6pjBIGBr0nWPoe4DKyytfQG4nWPe1648nTENSge1Fo/Vy/qaTCtesc7?= =?us-ascii?Q?bYJ5ET1TpUg4hXDh6v3i0NW1AWoO0s1W87+F5IhHt6skdqfPhMv6pGkoRpwz?= =?us-ascii?Q?NMvLJszo57ckvhsgn0CUwJy9v7Oz6foQs5NaUlV8Hfg7GyY/OJ/qgiKPLnqA?= =?us-ascii?Q?zFri0nQmMiYhhvrJn+Hf3eNHjPCE/HfRy1uvbtLPkcU2LGTMycyrDXhOu4o9?= =?us-ascii?Q?wH4M5KlxnH/hnTIw01C3vcDe7G9SJsAXGk7067VXqFuKgzCluMD/wfStVe88?= =?us-ascii?Q?nQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 07ef281e-7590-4f72-79c4-08dbb8f68a5d 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:24.7901 (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: T+CxfCHyEYaDZ0ThgKgrl5QZA3eOxq4cKhIqkEWTUxJiAIChQDgclOSGmMl+qQgCQ4s8jT0gVXJvQ0UmTy0um9bOT0PcQkWYC5zVwkkwtQY= 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 Each parameter of function should occupy one line, and indent two TAB character. All the statement which span multi line should indent two TAB character. Signed-off-by: Chaoyong He --- drivers/net/nfp/nfpcore/nfp_cpp.h | 80 +++++----- drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 152 ++++++++++-------- drivers/net/nfp/nfpcore/nfp_cppcore.c | 173 +++++++++++++-------- drivers/net/nfp/nfpcore/nfp_crc.c | 19 ++- drivers/net/nfp/nfpcore/nfp_hwinfo.c | 23 +-- drivers/net/nfp/nfpcore/nfp_mip.c | 21 ++- drivers/net/nfp/nfpcore/nfp_mip.h | 2 +- drivers/net/nfp/nfpcore/nfp_mutex.c | 25 +-- drivers/net/nfp/nfpcore/nfp_nffw.c | 12 +- drivers/net/nfp/nfpcore/nfp_nsp.c | 108 +++++++------ drivers/net/nfp/nfpcore/nfp_nsp.h | 19 +-- drivers/net/nfp/nfpcore/nfp_nsp_cmds.c | 4 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 72 +++++---- drivers/net/nfp/nfpcore/nfp_resource.c | 29 ++-- drivers/net/nfp/nfpcore/nfp_resource.h | 2 +- drivers/net/nfp/nfpcore/nfp_rtsym.c | 38 +++-- drivers/net/nfp/nfpcore/nfp_rtsym.h | 15 +- 17 files changed, 463 insertions(+), 331 deletions(-) diff --git a/drivers/net/nfp/nfpcore/nfp_cpp.h b/drivers/net/nfp/nfpcore/nfp_cpp.h index 8f87c09327..54bef3cb6b 100644 --- a/drivers/net/nfp/nfpcore/nfp_cpp.h +++ b/drivers/net/nfp/nfpcore/nfp_cpp.h @@ -56,7 +56,8 @@ struct nfp_cpp_operations { size_t area_priv_size; /* Instance an NFP CPP */ - int (*init)(struct nfp_cpp *cpp, struct rte_pci_device *dev); + int (*init)(struct nfp_cpp *cpp, + struct rte_pci_device *dev); /* * Free the bus. @@ -69,9 +70,9 @@ struct nfp_cpp_operations { * NOTE: This is _not_ serialized */ int (*area_init)(struct nfp_cpp_area *area, - uint32_t dest, - unsigned long long address, - unsigned long size); + uint32_t dest, + unsigned long long address, + unsigned long size); /* * Clean up a NFP CPP area before it is freed * NOTE: This is _not_ serialized @@ -101,17 +102,17 @@ struct nfp_cpp_operations { * Serialized */ int (*area_read)(struct nfp_cpp_area *area, - void *kernel_vaddr, - unsigned long offset, - unsigned int length); + void *kernel_vaddr, + unsigned long offset, + unsigned int length); /* * Perform a write to a NFP CPP area * Serialized */ int (*area_write)(struct nfp_cpp_area *area, - const void *kernel_vaddr, - unsigned long offset, - unsigned int length); + const void *kernel_vaddr, + unsigned long offset, + unsigned int length); }; /* @@ -239,7 +240,7 @@ void nfp_cpp_interface_set(struct nfp_cpp *cpp, uint32_t interface); * @param len Length of the serial byte array */ int nfp_cpp_serial_set(struct nfp_cpp *cpp, const uint8_t *serial, - size_t serial_len); + size_t serial_len); /* * Set the private data of the nfp_cpp instance @@ -279,7 +280,7 @@ uint32_t __nfp_cpp_model_autodetect(struct nfp_cpp *cpp, uint32_t *model); * @return NFP CPP handle, or NULL on failure. */ struct nfp_cpp *nfp_cpp_from_device_name(struct rte_pci_device *dev, - int driver_lock_needed); + int driver_lock_needed); /* * Free a NFP CPP handle @@ -397,8 +398,7 @@ int nfp_cpp_serial(struct nfp_cpp *cpp, const uint8_t **serial); * @return NFP CPP handle, or NULL on failure. */ struct nfp_cpp_area *nfp_cpp_area_alloc(struct nfp_cpp *cpp, uint32_t cpp_id, - unsigned long long address, - unsigned long size); + unsigned long long address, unsigned long size); /* * Allocate a NFP CPP area handle, as an offset into a CPP ID, by a named owner @@ -411,10 +411,8 @@ struct nfp_cpp_area *nfp_cpp_area_alloc(struct nfp_cpp *cpp, uint32_t cpp_id, * @return NFP CPP handle, or NULL on failure. */ struct nfp_cpp_area *nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp, - uint32_t cpp_id, - const char *name, - unsigned long long address, - unsigned long size); + uint32_t cpp_id, const char *name, unsigned long long address, + unsigned long size); /* * Free an allocated NFP CPP area handle @@ -448,9 +446,7 @@ void nfp_cpp_area_release(struct nfp_cpp_area *area); * @return NFP CPP handle, or NULL on failure. */ struct nfp_cpp_area *nfp_cpp_area_alloc_acquire(struct nfp_cpp *cpp, - uint32_t cpp_id, - unsigned long long address, - unsigned long size); + uint32_t cpp_id, unsigned long long address, unsigned long size); /* * Release the resources, then free the NFP CPP area handle @@ -459,8 +455,7 @@ struct nfp_cpp_area *nfp_cpp_area_alloc_acquire(struct nfp_cpp *cpp, void nfp_cpp_area_release_free(struct nfp_cpp_area *area); uint8_t *nfp_cpp_map_area(struct nfp_cpp *cpp, uint32_t cpp_id, - uint64_t addr, unsigned long size, - struct nfp_cpp_area **area); + uint64_t addr, unsigned long size, struct nfp_cpp_area **area); /* * Return an IO pointer to the beginning of the NFP CPP area handle. The area * must be acquired with 'nfp_cpp_area_acquire()' before calling this operation. @@ -484,7 +479,7 @@ void *nfp_cpp_area_mapped(struct nfp_cpp_area *area); * */ int nfp_cpp_area_read(struct nfp_cpp_area *area, unsigned long offset, - void *buffer, size_t length); + void *buffer, size_t length); /* * Write to a NFP CPP area handle from a buffer. The area must be acquired with @@ -498,7 +493,7 @@ int nfp_cpp_area_read(struct nfp_cpp_area *area, unsigned long offset, * @return bytes written on success, negative value on failure. */ int nfp_cpp_area_write(struct nfp_cpp_area *area, unsigned long offset, - const void *buffer, size_t length); + const void *buffer, size_t length); /* * nfp_cpp_area_iomem() - get IOMEM region for CPP area @@ -522,7 +517,7 @@ void *nfp_cpp_area_iomem(struct nfp_cpp_area *area); * @return 0 on success, negative value on failure. */ int nfp_cpp_area_check_range(struct nfp_cpp_area *area, - unsigned long long offset, unsigned long size); + unsigned long long offset, unsigned long size); /* * Get the NFP CPP handle that is the parent of a NFP CPP area handle @@ -552,7 +547,7 @@ const char *nfp_cpp_area_name(struct nfp_cpp_area *cpp_area); * @return bytes read on success, -1 on failure. */ int nfp_cpp_read(struct nfp_cpp *cpp, uint32_t cpp_id, - unsigned long long address, void *kernel_vaddr, size_t length); + unsigned long long address, void *kernel_vaddr, size_t length); /* * Write a block of data to a NFP CPP ID @@ -566,8 +561,8 @@ int nfp_cpp_read(struct nfp_cpp *cpp, uint32_t cpp_id, * @return bytes written on success, -1 on failure. */ int nfp_cpp_write(struct nfp_cpp *cpp, uint32_t cpp_id, - unsigned long long address, const void *kernel_vaddr, - size_t length); + unsigned long long address, const void *kernel_vaddr, + size_t length); @@ -582,7 +577,7 @@ int nfp_cpp_write(struct nfp_cpp *cpp, uint32_t cpp_id, * @return bytes written on success, negative value on failure. */ int nfp_cpp_area_fill(struct nfp_cpp_area *area, unsigned long offset, - uint32_t value, size_t length); + uint32_t value, size_t length); /* * Read a single 32-bit value from a NFP CPP area handle @@ -599,7 +594,7 @@ int nfp_cpp_area_fill(struct nfp_cpp_area *area, unsigned long offset, * @return 0 on success, or -1 on error. */ int nfp_cpp_area_readl(struct nfp_cpp_area *area, unsigned long offset, - uint32_t *value); + uint32_t *value); /* * Write a single 32-bit value to a NFP CPP area handle @@ -616,7 +611,7 @@ int nfp_cpp_area_readl(struct nfp_cpp_area *area, unsigned long offset, * @return 0 on success, or -1 on error. */ int nfp_cpp_area_writel(struct nfp_cpp_area *area, unsigned long offset, - uint32_t value); + uint32_t value); /* * Read a single 64-bit value from a NFP CPP area handle @@ -633,7 +628,7 @@ int nfp_cpp_area_writel(struct nfp_cpp_area *area, unsigned long offset, * @return 0 on success, or -1 on error. */ int nfp_cpp_area_readq(struct nfp_cpp_area *area, unsigned long offset, - uint64_t *value); + uint64_t *value); /* * Write a single 64-bit value to a NFP CPP area handle @@ -650,7 +645,7 @@ int nfp_cpp_area_readq(struct nfp_cpp_area *area, unsigned long offset, * @return 0 on success, or -1 on error. */ int nfp_cpp_area_writeq(struct nfp_cpp_area *area, unsigned long offset, - uint64_t value); + uint64_t value); /* * Write a single 32-bit value on the XPB bus @@ -685,7 +680,7 @@ int nfp_xpb_readl(struct nfp_cpp *cpp, uint32_t xpb_tgt, uint32_t *value); * @return 0 on success, or -1 on failure. */ int nfp_xpb_writelm(struct nfp_cpp *cpp, uint32_t xpb_tgt, uint32_t mask, - uint32_t value); + uint32_t value); /* * Modify bits of a 32-bit value from the XPB bus @@ -699,7 +694,7 @@ int nfp_xpb_writelm(struct nfp_cpp *cpp, uint32_t xpb_tgt, uint32_t mask, * @return >= 0 on success, negative value on failure. */ int nfp_xpb_waitlm(struct nfp_cpp *cpp, uint32_t xpb_tgt, uint32_t mask, - uint32_t value, int timeout_us); + uint32_t value, int timeout_us); /* * Read a 32-bit word from a NFP CPP ID @@ -712,7 +707,7 @@ int nfp_xpb_waitlm(struct nfp_cpp *cpp, uint32_t xpb_tgt, uint32_t mask, * @return 0 on success, or -1 on failure. */ int nfp_cpp_readl(struct nfp_cpp *cpp, uint32_t cpp_id, - unsigned long long address, uint32_t *value); + unsigned long long address, uint32_t *value); /* * Write a 32-bit value to a NFP CPP ID @@ -726,7 +721,7 @@ int nfp_cpp_readl(struct nfp_cpp *cpp, uint32_t cpp_id, * */ int nfp_cpp_writel(struct nfp_cpp *cpp, uint32_t cpp_id, - unsigned long long address, uint32_t value); + unsigned long long address, uint32_t value); /* * Read a 64-bit work from a NFP CPP ID @@ -739,7 +734,7 @@ int nfp_cpp_writel(struct nfp_cpp *cpp, uint32_t cpp_id, * @return 0 on success, or -1 on failure. */ int nfp_cpp_readq(struct nfp_cpp *cpp, uint32_t cpp_id, - unsigned long long address, uint64_t *value); + unsigned long long address, uint64_t *value); /* * Write a 64-bit value to a NFP CPP ID @@ -752,7 +747,7 @@ int nfp_cpp_readq(struct nfp_cpp *cpp, uint32_t cpp_id, * @return 0 on success, or -1 on failure. */ int nfp_cpp_writeq(struct nfp_cpp *cpp, uint32_t cpp_id, - unsigned long long address, uint64_t value); + unsigned long long address, uint64_t value); /* * Initialize a mutex location @@ -773,7 +768,7 @@ int nfp_cpp_writeq(struct nfp_cpp *cpp, uint32_t cpp_id, * @return 0 on success, negative value on failure. */ int nfp_cpp_mutex_init(struct nfp_cpp *cpp, int target, - unsigned long long address, uint32_t key_id); + unsigned long long address, uint32_t key_id); /* * Create a mutex handle from an address controlled by a MU Atomic engine @@ -793,8 +788,7 @@ int nfp_cpp_mutex_init(struct nfp_cpp *cpp, int target, * failure. */ struct nfp_cpp_mutex *nfp_cpp_mutex_alloc(struct nfp_cpp *cpp, int target, - unsigned long long address, - uint32_t key_id); + unsigned long long address, uint32_t key_id); /* * Get the NFP CPP handle the mutex was created with diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c index 2ee60eefc3..884cc84eaa 100644 --- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c +++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c @@ -130,9 +130,15 @@ nfp_bar_maptype(struct nfp_bar *bar) #define TARGET_WIDTH_64 8 static int -nfp_compute_bar(const struct nfp_bar *bar, uint32_t *bar_config, - uint64_t *bar_base, int tgt, int act, int tok, - uint64_t offset, size_t size, int width) +nfp_compute_bar(const struct nfp_bar *bar, + uint32_t *bar_config, + uint64_t *bar_base, + int tgt, + int act, + int tok, + uint64_t offset, + size_t size, + int width) { uint32_t bitsize; uint32_t newcfg; @@ -143,19 +149,16 @@ nfp_compute_bar(const struct nfp_bar *bar, uint32_t *bar_config, switch (width) { case 8: - newcfg = - NFP_PCIE_BAR_PCIE2CPP_LENGTHSELECT - (NFP_PCIE_BAR_PCIE2CPP_LENGTHSELECT_64BIT); + newcfg = NFP_PCIE_BAR_PCIE2CPP_LENGTHSELECT + (NFP_PCIE_BAR_PCIE2CPP_LENGTHSELECT_64BIT); break; case 4: - newcfg = - NFP_PCIE_BAR_PCIE2CPP_LENGTHSELECT - (NFP_PCIE_BAR_PCIE2CPP_LENGTHSELECT_32BIT); + newcfg = NFP_PCIE_BAR_PCIE2CPP_LENGTHSELECT + (NFP_PCIE_BAR_PCIE2CPP_LENGTHSELECT_32BIT); break; case 0: - newcfg = - NFP_PCIE_BAR_PCIE2CPP_LENGTHSELECT - (NFP_PCIE_BAR_PCIE2CPP_LENGTHSELECT_0BYTE); + newcfg = NFP_PCIE_BAR_PCIE2CPP_LENGTHSELECT + (NFP_PCIE_BAR_PCIE2CPP_LENGTHSELECT_0BYTE); break; default: return -EINVAL; @@ -165,60 +168,58 @@ nfp_compute_bar(const struct nfp_bar *bar, uint32_t *bar_config, /* Fixed CPP mapping with specific action */ mask = ~(NFP_PCIE_P2C_FIXED_SIZE(bar) - 1); - newcfg |= - NFP_PCIE_BAR_PCIE2CPP_MAPTYPE - (NFP_PCIE_BAR_PCIE2CPP_MAPTYPE_FIXED); + newcfg |= NFP_PCIE_BAR_PCIE2CPP_MAPTYPE + (NFP_PCIE_BAR_PCIE2CPP_MAPTYPE_FIXED); newcfg |= NFP_PCIE_BAR_PCIE2CPP_TARGET_BASEADDRESS(tgt); newcfg |= NFP_PCIE_BAR_PCIE2CPP_ACTION_BASEADDRESS(act); newcfg |= NFP_PCIE_BAR_PCIE2CPP_TOKEN_BASEADDRESS(tok); if ((offset & mask) != ((offset + size - 1) & mask)) { PMD_DRV_LOG(ERR, "BAR%d: Won't use for Fixed mapping <%#llx,%#llx>, action=%d BAR too small (0x%llx)", - bar->index, (unsigned long long)offset, - (unsigned long long)(offset + size), act, - (unsigned long long)mask); + bar->index, (unsigned long long)offset, + (unsigned long long)(offset + size), act, + (unsigned long long)mask); return -EINVAL; } offset &= mask; PMD_DRV_LOG(DEBUG, "BAR%d: Created Fixed mapping %d:%d:%d:0x%#llx-0x%#llx>", - bar->index, tgt, act, tok, (unsigned long long)offset, - (unsigned long long)(offset + mask)); + bar->index, tgt, act, tok, (unsigned long long)offset, + (unsigned long long)(offset + mask)); bitsize = 40 - 16; } else { mask = ~(NFP_PCIE_P2C_BULK_SIZE(bar) - 1); /* Bulk mapping */ - newcfg |= - NFP_PCIE_BAR_PCIE2CPP_MAPTYPE - (NFP_PCIE_BAR_PCIE2CPP_MAPTYPE_BULK); + newcfg |= NFP_PCIE_BAR_PCIE2CPP_MAPTYPE + (NFP_PCIE_BAR_PCIE2CPP_MAPTYPE_BULK); newcfg |= NFP_PCIE_BAR_PCIE2CPP_TARGET_BASEADDRESS(tgt); newcfg |= NFP_PCIE_BAR_PCIE2CPP_TOKEN_BASEADDRESS(tok); if ((offset & mask) != ((offset + size - 1) & mask)) { PMD_DRV_LOG(ERR, "BAR%d: Won't use for bulk mapping <%#llx,%#llx> target=%d, token=%d BAR too small (%#llx) - (%#llx != %#llx).", - bar->index, (unsigned long long)offset, - (unsigned long long)(offset + size), - tgt, tok, (unsigned long long)mask, - (unsigned long long)(offset & mask), - (unsigned long long)(offset + size - 1) & mask); + bar->index, (unsigned long long)offset, + (unsigned long long)(offset + size), + tgt, tok, (unsigned long long)mask, + (unsigned long long)(offset & mask), + (unsigned long long)(offset + size - 1) & mask); return -EINVAL; } offset &= mask; PMD_DRV_LOG(DEBUG, "BAR%d: Created bulk mapping %d:x:%d:%#llx-%#llx", - bar->index, tgt, tok, (unsigned long long)offset, - (unsigned long long)(offset + ~mask)); + bar->index, tgt, tok, (unsigned long long)offset, + (unsigned long long)(offset + ~mask)); bitsize = 40 - 21; } if (bar->bitsize < bitsize) { PMD_DRV_LOG(ERR, "BAR%d: Too small for %d:%d:%d", bar->index, - tgt, tok, act); + tgt, tok, act); return -EINVAL; } @@ -234,8 +235,9 @@ nfp_compute_bar(const struct nfp_bar *bar, uint32_t *bar_config, } static int -nfp_bar_write(struct nfp_pcie_user *nfp, struct nfp_bar *bar, - uint32_t newcfg) +nfp_bar_write(struct nfp_pcie_user *nfp, + struct nfp_bar *bar, + uint32_t newcfg) { int base, slot; @@ -246,7 +248,7 @@ nfp_bar_write(struct nfp_pcie_user *nfp, struct nfp_bar *bar, return (-ENOMEM); bar->csr = nfp->cfg + - NFP_PCIE_CFG_BAR_PCIETOCPPEXPBAR(nfp->dev_id, base, slot); + NFP_PCIE_CFG_BAR_PCIETOCPPEXPBAR(nfp->dev_id, base, slot); *(uint32_t *)(bar->csr) = newcfg; @@ -257,15 +259,21 @@ nfp_bar_write(struct nfp_pcie_user *nfp, struct nfp_bar *bar, } static int -nfp_reconfigure_bar(struct nfp_pcie_user *nfp, struct nfp_bar *bar, int tgt, - int act, int tok, uint64_t offset, size_t size, int width) +nfp_reconfigure_bar(struct nfp_pcie_user *nfp, + struct nfp_bar *bar, + int tgt, + int act, + int tok, + uint64_t offset, + size_t size, + int width) { uint64_t newbase; uint32_t newcfg; int err; err = nfp_compute_bar(bar, &newcfg, &newbase, tgt, act, tok, offset, - size, width); + size, width); if (err != 0) return err; @@ -390,8 +398,10 @@ struct nfp6000_area_priv { }; static int -nfp6000_area_init(struct nfp_cpp_area *area, uint32_t dest, - unsigned long long address, unsigned long size) +nfp6000_area_init(struct nfp_cpp_area *area, + uint32_t dest, + unsigned long long address, + unsigned long size) { struct nfp_pcie_user *nfp = nfp_cpp_priv(nfp_cpp_area_cpp(area)); struct nfp6000_area_priv *priv = nfp_cpp_area_priv(area); @@ -400,8 +410,7 @@ nfp6000_area_init(struct nfp_cpp_area *area, uint32_t dest, uint32_t token = NFP_CPP_ID_TOKEN_of(dest); int pp, ret = 0; - pp = nfp_target_pushpull(NFP_CPP_ID(target, action, token), - address); + pp = nfp_target_pushpull(NFP_CPP_ID(target, action, token), address); if (pp < 0) return pp; @@ -409,7 +418,8 @@ nfp6000_area_init(struct nfp_cpp_area *area, uint32_t dest, priv->width.write = PULL_WIDTH(pp); if (priv->width.read > 0 && - priv->width.write > 0 && priv->width.read != priv->width.write) + priv->width.write > 0 && + priv->width.read != priv->width.write) return -EINVAL; if (priv->width.read > 0) @@ -428,8 +438,8 @@ nfp6000_area_init(struct nfp_cpp_area *area, uint32_t dest, priv->size = size; ret = nfp_reconfigure_bar(nfp, priv->bar, priv->target, priv->action, - priv->token, priv->offset, priv->size, - priv->width.bar); + priv->token, priv->offset, priv->size, + priv->width.bar); return ret; } @@ -441,14 +451,13 @@ nfp6000_area_acquire(struct nfp_cpp_area *area) /* Calculate offset into BAR. */ if (nfp_bar_maptype(priv->bar) == - NFP_PCIE_BAR_PCIE2CPP_MAPTYPE_GENERAL) { + NFP_PCIE_BAR_PCIE2CPP_MAPTYPE_GENERAL) { priv->bar_offset = priv->offset & - (NFP_PCIE_P2C_GENERAL_SIZE(priv->bar) - 1); - priv->bar_offset += - NFP_PCIE_P2C_GENERAL_TARGET_OFFSET(priv->bar, - priv->target); - priv->bar_offset += - NFP_PCIE_P2C_GENERAL_TOKEN_OFFSET(priv->bar, priv->token); + (NFP_PCIE_P2C_GENERAL_SIZE(priv->bar) - 1); + priv->bar_offset += NFP_PCIE_P2C_GENERAL_TARGET_OFFSET(priv->bar, + priv->target); + priv->bar_offset += NFP_PCIE_P2C_GENERAL_TOKEN_OFFSET(priv->bar, + priv->token); } else { priv->bar_offset = priv->offset & priv->bar->mask; } @@ -490,8 +499,10 @@ nfp6000_area_iomem(struct nfp_cpp_area *area) } static int -nfp6000_area_read(struct nfp_cpp_area *area, void *kernel_vaddr, - unsigned long offset, unsigned int length) +nfp6000_area_read(struct nfp_cpp_area *area, + void *kernel_vaddr, + unsigned long offset, + unsigned int length) { uint64_t *wrptr64 = kernel_vaddr; const volatile uint64_t *rdptr64; @@ -524,17 +535,17 @@ nfp6000_area_read(struct nfp_cpp_area *area, void *kernel_vaddr, /* MU reads via a PCIe2CPP BAR supports 32bit (and other) lengths */ if (priv->target == (NFP_CPP_TARGET_ID_MASK & NFP_CPP_TARGET_MU) && - priv->action == NFP_CPP_ACTION_RW) { + priv->action == NFP_CPP_ACTION_RW) { is_64 = false; } if (is_64) { if (offset % sizeof(uint64_t) != 0 || - length % sizeof(uint64_t) != 0) + length % sizeof(uint64_t) != 0) return -EINVAL; } else { if (offset % sizeof(uint32_t) != 0 || - length % sizeof(uint32_t) != 0) + length % sizeof(uint32_t) != 0) return -EINVAL; } @@ -558,8 +569,10 @@ nfp6000_area_read(struct nfp_cpp_area *area, void *kernel_vaddr, } static int -nfp6000_area_write(struct nfp_cpp_area *area, const void *kernel_vaddr, - unsigned long offset, unsigned int length) +nfp6000_area_write(struct nfp_cpp_area *area, + const void *kernel_vaddr, + unsigned long offset, + unsigned int length) { const uint64_t *rdptr64 = kernel_vaddr; uint64_t *wrptr64; @@ -590,16 +603,16 @@ nfp6000_area_write(struct nfp_cpp_area *area, const void *kernel_vaddr, /* MU writes via a PCIe2CPP BAR supports 32bit (and other) lengths */ if (priv->target == (NFP_CPP_TARGET_ID_MASK & NFP_CPP_TARGET_MU) && - priv->action == NFP_CPP_ACTION_RW) + priv->action == NFP_CPP_ACTION_RW) is_64 = false; if (is_64) { if (offset % sizeof(uint64_t) != 0 || - length % sizeof(uint64_t) != 0) + length % sizeof(uint64_t) != 0) return -EINVAL; } else { if (offset % sizeof(uint32_t) != 0 || - length % sizeof(uint32_t) != 0) + length % sizeof(uint32_t) != 0) return -EINVAL; } @@ -655,7 +668,8 @@ nfp_acquire_process_lock(struct nfp_pcie_user *desc) } static int -nfp6000_set_model(struct rte_pci_device *dev, struct nfp_cpp *cpp) +nfp6000_set_model(struct rte_pci_device *dev, + struct nfp_cpp *cpp) { uint32_t model; @@ -671,7 +685,8 @@ nfp6000_set_model(struct rte_pci_device *dev, struct nfp_cpp *cpp) } static int -nfp6000_set_interface(struct rte_pci_device *dev, struct nfp_cpp *cpp) +nfp6000_set_interface(struct rte_pci_device *dev, + struct nfp_cpp *cpp) { uint16_t interface; @@ -686,7 +701,8 @@ nfp6000_set_interface(struct rte_pci_device *dev, struct nfp_cpp *cpp) } static int -nfp6000_set_serial(struct rte_pci_device *dev, struct nfp_cpp *cpp) +nfp6000_set_serial(struct rte_pci_device *dev, + struct nfp_cpp *cpp) { uint16_t tmp; uint8_t serial[6]; @@ -733,7 +749,8 @@ nfp6000_set_serial(struct rte_pci_device *dev, struct nfp_cpp *cpp) } static int -nfp6000_set_barsz(struct rte_pci_device *dev, struct nfp_pcie_user *desc) +nfp6000_set_barsz(struct rte_pci_device *dev, + struct nfp_pcie_user *desc) { unsigned long tmp; int i = 0; @@ -748,7 +765,8 @@ nfp6000_set_barsz(struct rte_pci_device *dev, struct nfp_pcie_user *desc) } static int -nfp6000_init(struct nfp_cpp *cpp, struct rte_pci_device *dev) +nfp6000_init(struct nfp_cpp *cpp, + struct rte_pci_device *dev) { int ret = 0; struct nfp_pcie_user *desc; @@ -762,7 +780,7 @@ nfp6000_init(struct nfp_cpp *cpp, struct rte_pci_device *dev) strlcpy(desc->busdev, dev->device.name, sizeof(desc->busdev)); if (rte_eal_process_type() == RTE_PROC_PRIMARY && - cpp->driver_lock_needed) { + cpp->driver_lock_needed) { ret = nfp_acquire_process_lock(desc); if (ret != 0) goto error; diff --git a/drivers/net/nfp/nfpcore/nfp_cppcore.c b/drivers/net/nfp/nfpcore/nfp_cppcore.c index 31338e0047..f764208a9a 100644 --- a/drivers/net/nfp/nfpcore/nfp_cppcore.c +++ b/drivers/net/nfp/nfpcore/nfp_cppcore.c @@ -27,7 +27,8 @@ NFP_PL_DEVICE_ID_MASK) void -nfp_cpp_priv_set(struct nfp_cpp *cpp, void *priv) +nfp_cpp_priv_set(struct nfp_cpp *cpp, + void *priv) { cpp->priv = priv; } @@ -39,7 +40,8 @@ nfp_cpp_priv(struct nfp_cpp *cpp) } void -nfp_cpp_model_set(struct nfp_cpp *cpp, uint32_t model) +nfp_cpp_model_set(struct nfp_cpp *cpp, + uint32_t model) { cpp->model = model; } @@ -62,21 +64,24 @@ nfp_cpp_model(struct nfp_cpp *cpp) } void -nfp_cpp_interface_set(struct nfp_cpp *cpp, uint32_t interface) +nfp_cpp_interface_set(struct nfp_cpp *cpp, + uint32_t interface) { cpp->interface = interface; } int -nfp_cpp_serial(struct nfp_cpp *cpp, const uint8_t **serial) +nfp_cpp_serial(struct nfp_cpp *cpp, + const uint8_t **serial) { *serial = cpp->serial; return cpp->serial_len; } int -nfp_cpp_serial_set(struct nfp_cpp *cpp, const uint8_t *serial, - size_t serial_len) +nfp_cpp_serial_set(struct nfp_cpp *cpp, + const uint8_t *serial, + size_t serial_len) { if (cpp->serial_len) free(cpp->serial); @@ -161,9 +166,11 @@ nfp_cpp_mu_locality_lsb(struct nfp_cpp *cpp) * NOTE: @address and @size must be 32-bit aligned values. */ struct nfp_cpp_area * -nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp, uint32_t dest, - const char *name, unsigned long long address, - unsigned long size) +nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp, + uint32_t dest, + const char *name, + unsigned long long address, + unsigned long size) { struct nfp_cpp_area *area; uint64_t tmp64 = (uint64_t)address; @@ -183,7 +190,7 @@ nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp, uint32_t dest, name = ""; area = calloc(1, sizeof(*area) + cpp->op->area_priv_size + - strlen(name) + 1); + strlen(name) + 1); if (area == NULL) return NULL; @@ -204,8 +211,10 @@ nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp, uint32_t dest, } struct nfp_cpp_area * -nfp_cpp_area_alloc(struct nfp_cpp *cpp, uint32_t dest, - unsigned long long address, unsigned long size) +nfp_cpp_area_alloc(struct nfp_cpp *cpp, + uint32_t dest, + unsigned long long address, + unsigned long size) { return nfp_cpp_area_alloc_with_name(cpp, dest, NULL, address, size); } @@ -226,8 +235,10 @@ nfp_cpp_area_alloc(struct nfp_cpp *cpp, uint32_t dest, * NOTE: The area must also be 'released' when the structure is freed. */ struct nfp_cpp_area * -nfp_cpp_area_alloc_acquire(struct nfp_cpp *cpp, uint32_t destination, - unsigned long long address, unsigned long size) +nfp_cpp_area_alloc_acquire(struct nfp_cpp *cpp, + uint32_t destination, + unsigned long long address, + unsigned long size) { struct nfp_cpp_area *area; @@ -340,8 +351,10 @@ nfp_cpp_area_iomem(struct nfp_cpp_area *area) * NOTE: Area must have been locked down with an 'acquire'. */ int -nfp_cpp_area_read(struct nfp_cpp_area *area, unsigned long offset, - void *kernel_vaddr, size_t length) +nfp_cpp_area_read(struct nfp_cpp_area *area, + unsigned long offset, + void *kernel_vaddr, + size_t length) { if ((offset + length) > area->size) return -EFAULT; @@ -364,8 +377,10 @@ nfp_cpp_area_read(struct nfp_cpp_area *area, unsigned long offset, * NOTE: Area must have been locked down with an 'acquire'. */ int -nfp_cpp_area_write(struct nfp_cpp_area *area, unsigned long offset, - const void *kernel_vaddr, size_t length) +nfp_cpp_area_write(struct nfp_cpp_area *area, + unsigned long offset, + const void *kernel_vaddr, + size_t length) { if ((offset + length) > area->size) return -EFAULT; @@ -392,8 +407,9 @@ nfp_cpp_area_mapped(struct nfp_cpp_area *area) * or negative value on error. */ int -nfp_cpp_area_check_range(struct nfp_cpp_area *area, unsigned long long offset, - unsigned long length) +nfp_cpp_area_check_range(struct nfp_cpp_area *area, + unsigned long long offset, + unsigned long length) { if (((offset + length) > area->size)) return -EFAULT; @@ -406,7 +422,8 @@ nfp_cpp_area_check_range(struct nfp_cpp_area *area, unsigned long long offset, * based upon NFP model. */ static uint32_t -nfp_xpb_to_cpp(struct nfp_cpp *cpp, uint32_t *xpb_addr) +nfp_xpb_to_cpp(struct nfp_cpp *cpp, + uint32_t *xpb_addr) { uint32_t xpb; int island; @@ -433,7 +450,7 @@ nfp_xpb_to_cpp(struct nfp_cpp *cpp, uint32_t *xpb_addr) else /* And only non-ARM interfaces use island id = 1 */ if (NFP_CPP_INTERFACE_TYPE_of(nfp_cpp_interface(cpp)) != - NFP_CPP_INTERFACE_TYPE_ARM) + NFP_CPP_INTERFACE_TYPE_ARM) *xpb_addr |= (1 << 24); } else { (*xpb_addr) |= (1 << 30); @@ -443,8 +460,9 @@ nfp_xpb_to_cpp(struct nfp_cpp *cpp, uint32_t *xpb_addr) } int -nfp_cpp_area_readl(struct nfp_cpp_area *area, unsigned long offset, - uint32_t *value) +nfp_cpp_area_readl(struct nfp_cpp_area *area, + unsigned long offset, + uint32_t *value) { int sz; uint32_t tmp = 0; @@ -456,8 +474,9 @@ nfp_cpp_area_readl(struct nfp_cpp_area *area, unsigned long offset, } int -nfp_cpp_area_writel(struct nfp_cpp_area *area, unsigned long offset, - uint32_t value) +nfp_cpp_area_writel(struct nfp_cpp_area *area, + unsigned long offset, + uint32_t value) { int sz; @@ -467,8 +486,9 @@ nfp_cpp_area_writel(struct nfp_cpp_area *area, unsigned long offset, } int -nfp_cpp_area_readq(struct nfp_cpp_area *area, unsigned long offset, - uint64_t *value) +nfp_cpp_area_readq(struct nfp_cpp_area *area, + unsigned long offset, + uint64_t *value) { int sz; uint64_t tmp = 0; @@ -480,8 +500,9 @@ nfp_cpp_area_readq(struct nfp_cpp_area *area, unsigned long offset, } int -nfp_cpp_area_writeq(struct nfp_cpp_area *area, unsigned long offset, - uint64_t value) +nfp_cpp_area_writeq(struct nfp_cpp_area *area, + unsigned long offset, + uint64_t value) { int sz; @@ -492,8 +513,10 @@ nfp_cpp_area_writeq(struct nfp_cpp_area *area, unsigned long offset, } int -nfp_cpp_readl(struct nfp_cpp *cpp, uint32_t cpp_id, unsigned long long address, - uint32_t *value) +nfp_cpp_readl(struct nfp_cpp *cpp, + uint32_t cpp_id, + unsigned long long address, + uint32_t *value) { int sz; uint32_t tmp; @@ -505,8 +528,10 @@ nfp_cpp_readl(struct nfp_cpp *cpp, uint32_t cpp_id, unsigned long long address, } int -nfp_cpp_writel(struct nfp_cpp *cpp, uint32_t cpp_id, unsigned long long address, - uint32_t value) +nfp_cpp_writel(struct nfp_cpp *cpp, + uint32_t cpp_id, + unsigned long long address, + uint32_t value) { int sz; @@ -517,8 +542,10 @@ nfp_cpp_writel(struct nfp_cpp *cpp, uint32_t cpp_id, unsigned long long address, } int -nfp_cpp_readq(struct nfp_cpp *cpp, uint32_t cpp_id, unsigned long long address, - uint64_t *value) +nfp_cpp_readq(struct nfp_cpp *cpp, + uint32_t cpp_id, + unsigned long long address, + uint64_t *value) { int sz; uint64_t tmp; @@ -530,8 +557,10 @@ nfp_cpp_readq(struct nfp_cpp *cpp, uint32_t cpp_id, unsigned long long address, } int -nfp_cpp_writeq(struct nfp_cpp *cpp, uint32_t cpp_id, unsigned long long address, - uint64_t value) +nfp_cpp_writeq(struct nfp_cpp *cpp, + uint32_t cpp_id, + unsigned long long address, + uint64_t value) { int sz; @@ -542,7 +571,9 @@ nfp_cpp_writeq(struct nfp_cpp *cpp, uint32_t cpp_id, unsigned long long address, } int -nfp_xpb_writel(struct nfp_cpp *cpp, uint32_t xpb_addr, uint32_t value) +nfp_xpb_writel(struct nfp_cpp *cpp, + uint32_t xpb_addr, + uint32_t value) { uint32_t cpp_dest; @@ -552,7 +583,9 @@ nfp_xpb_writel(struct nfp_cpp *cpp, uint32_t xpb_addr, uint32_t value) } int -nfp_xpb_readl(struct nfp_cpp *cpp, uint32_t xpb_addr, uint32_t *value) +nfp_xpb_readl(struct nfp_cpp *cpp, + uint32_t xpb_addr, + uint32_t *value) { uint32_t cpp_dest; @@ -562,7 +595,8 @@ nfp_xpb_readl(struct nfp_cpp *cpp, uint32_t xpb_addr, uint32_t *value) } static struct nfp_cpp * -nfp_cpp_alloc(struct rte_pci_device *dev, int driver_lock_needed) +nfp_cpp_alloc(struct rte_pci_device *dev, + int driver_lock_needed) { const struct nfp_cpp_operations *ops; struct nfp_cpp *cpp; @@ -596,7 +630,7 @@ nfp_cpp_alloc(struct rte_pci_device *dev, int driver_lock_needed) /* Hardcoded XPB IMB Base, island 0 */ xpbaddr = 0x000a0000 + (tgt * 4); err = nfp_xpb_readl(cpp, xpbaddr, - (uint32_t *)&cpp->imb_cat_table[tgt]); + (uint32_t *)&cpp->imb_cat_table[tgt]); if (err < 0) { free(cpp); return NULL; @@ -631,7 +665,8 @@ nfp_cpp_free(struct nfp_cpp *cpp) } struct nfp_cpp * -nfp_cpp_from_device_name(struct rte_pci_device *dev, int driver_lock_needed) +nfp_cpp_from_device_name(struct rte_pci_device *dev, + int driver_lock_needed) { return nfp_cpp_alloc(dev, driver_lock_needed); } @@ -647,7 +682,9 @@ nfp_cpp_from_device_name(struct rte_pci_device *dev, int driver_lock_needed) * @return 0 on success, or -1 on failure. */ int -nfp_xpb_writelm(struct nfp_cpp *cpp, uint32_t xpb_tgt, uint32_t mask, +nfp_xpb_writelm(struct nfp_cpp *cpp, + uint32_t xpb_tgt, + uint32_t mask, uint32_t value) { int err; @@ -674,8 +711,11 @@ nfp_xpb_writelm(struct nfp_cpp *cpp, uint32_t xpb_tgt, uint32_t mask, * @return >= 0 on success, or negative value on failure. */ int -nfp_xpb_waitlm(struct nfp_cpp *cpp, uint32_t xpb_tgt, uint32_t mask, - uint32_t value, int timeout_us) +nfp_xpb_waitlm(struct nfp_cpp *cpp, + uint32_t xpb_tgt, + uint32_t mask, + uint32_t value, + int timeout_us) { uint32_t tmp; int err; @@ -716,8 +756,11 @@ nfp_xpb_waitlm(struct nfp_cpp *cpp, uint32_t xpb_tgt, uint32_t mask, * @length: number of bytes to read */ int -nfp_cpp_read(struct nfp_cpp *cpp, uint32_t destination, - unsigned long long address, void *kernel_vaddr, size_t length) +nfp_cpp_read(struct nfp_cpp *cpp, + uint32_t destination, + unsigned long long address, + void *kernel_vaddr, + size_t length) { struct nfp_cpp_area *area; int err; @@ -743,9 +786,11 @@ nfp_cpp_read(struct nfp_cpp *cpp, uint32_t destination, * @length: number of bytes to write */ int -nfp_cpp_write(struct nfp_cpp *cpp, uint32_t destination, - unsigned long long address, const void *kernel_vaddr, - size_t length) +nfp_cpp_write(struct nfp_cpp *cpp, + uint32_t destination, + unsigned long long address, + const void *kernel_vaddr, + size_t length) { struct nfp_cpp_area *area; int err; @@ -768,8 +813,10 @@ nfp_cpp_write(struct nfp_cpp *cpp, uint32_t destination, * @length: length of area to fill */ int -nfp_cpp_area_fill(struct nfp_cpp_area *area, unsigned long offset, - uint32_t value, size_t length) +nfp_cpp_area_fill(struct nfp_cpp_area *area, + unsigned long offset, + uint32_t value, + size_t length) { int err; size_t i; @@ -795,9 +842,8 @@ nfp_cpp_area_fill(struct nfp_cpp_area *area, unsigned long offset, } for (i = 0; (i + sizeof(value)) < length; i += sizeof(value64)) { - err = - nfp_cpp_area_write(area, offset + i, &value64, - sizeof(value64)); + err = nfp_cpp_area_write(area, offset + i, &value64, + sizeof(value64)); if (err < 0) return err; if (err != sizeof(value64)) @@ -805,8 +851,7 @@ nfp_cpp_area_fill(struct nfp_cpp_area *area, unsigned long offset, } if ((i + sizeof(value)) <= length) { - err = - nfp_cpp_area_write(area, offset + i, &value, sizeof(value)); + err = nfp_cpp_area_write(area, offset + i, &value, sizeof(value)); if (err < 0) return err; if (err != sizeof(value)) @@ -822,13 +867,14 @@ nfp_cpp_area_fill(struct nfp_cpp_area *area, unsigned long offset, * as those are model-specific */ uint32_t -__nfp_cpp_model_autodetect(struct nfp_cpp *cpp, uint32_t *model) +__nfp_cpp_model_autodetect(struct nfp_cpp *cpp, + uint32_t *model) { uint32_t reg; int err; err = nfp_xpb_readl(cpp, NFP_XPB_DEVICE(1, 1, 16) + NFP_PL_DEVICE_ID, - ®); + ®); if (err < 0) return err; @@ -853,8 +899,11 @@ __nfp_cpp_model_autodetect(struct nfp_cpp *cpp, uint32_t *model) * Return: Pointer to memory mapped area or NULL */ uint8_t * -nfp_cpp_map_area(struct nfp_cpp *cpp, uint32_t cpp_id, uint64_t addr, - unsigned long size, struct nfp_cpp_area **area) +nfp_cpp_map_area(struct nfp_cpp *cpp, + uint32_t cpp_id, + uint64_t addr, + unsigned long size, + struct nfp_cpp_area **area) { uint8_t *res; diff --git a/drivers/net/nfp/nfpcore/nfp_crc.c b/drivers/net/nfp/nfpcore/nfp_crc.c index 20431bf845..2cd8866253 100644 --- a/drivers/net/nfp/nfpcore/nfp_crc.c +++ b/drivers/net/nfp/nfpcore/nfp_crc.c @@ -9,27 +9,31 @@ #include "nfp_crc.h" static inline uint32_t -nfp_crc32_be_generic(uint32_t crc, unsigned char const *p, size_t len, - uint32_t polynomial) +nfp_crc32_be_generic(uint32_t crc, + unsigned char const *p, + size_t len, + uint32_t polynomial) { int i; while (len--) { crc ^= *p++ << 24; for (i = 0; i < 8; i++) - crc = (crc << 1) ^ ((crc & 0x80000000) ? polynomial : - 0); + crc = (crc << 1) ^ ((crc & 0x80000000) ? polynomial : 0); } return crc; } static inline uint32_t -nfp_crc32_be(uint32_t crc, unsigned char const *p, size_t len) +nfp_crc32_be(uint32_t crc, + unsigned char const *p, + size_t len) { return nfp_crc32_be_generic(crc, p, len, CRCPOLY_BE); } static uint32_t -nfp_crc32_posix_end(uint32_t crc, size_t total_len) +nfp_crc32_posix_end(uint32_t crc, + size_t total_len) { /* Extend with the length of the string. */ while (total_len != 0) { @@ -43,7 +47,8 @@ nfp_crc32_posix_end(uint32_t crc, size_t total_len) } uint32_t -nfp_crc32_posix(const void *buff, size_t len) +nfp_crc32_posix(const void *buff, + size_t len) { return nfp_crc32_posix_end(nfp_crc32_be(0, buff, len), len); } diff --git a/drivers/net/nfp/nfpcore/nfp_hwinfo.c b/drivers/net/nfp/nfpcore/nfp_hwinfo.c index a9d166c4dc..ea4c7d6a9e 100644 --- a/drivers/net/nfp/nfpcore/nfp_hwinfo.c +++ b/drivers/net/nfp/nfpcore/nfp_hwinfo.c @@ -33,12 +33,13 @@ nfp_hwinfo_is_updating(struct nfp_hwinfo *hwinfo) } static int -nfp_hwinfo_db_walk(struct nfp_hwinfo *hwinfo, uint32_t size) +nfp_hwinfo_db_walk(struct nfp_hwinfo *hwinfo, + uint32_t size) { const char *key, *val, *end = hwinfo->data + size; for (key = hwinfo->data; *key != 0 && key < end; - key = val + strlen(val) + 1) { + key = val + strlen(val) + 1) { val = key + strlen(key) + 1; if (val >= end) { PMD_DRV_LOG(ERR, "Bad HWINFO - overflowing value"); @@ -54,7 +55,8 @@ nfp_hwinfo_db_walk(struct nfp_hwinfo *hwinfo, uint32_t size) } static int -nfp_hwinfo_db_validate(struct nfp_hwinfo *db, uint32_t len) +nfp_hwinfo_db_validate(struct nfp_hwinfo *db, + uint32_t len) { uint32_t size, new_crc, *crc; @@ -69,7 +71,7 @@ nfp_hwinfo_db_validate(struct nfp_hwinfo *db, uint32_t len) crc = (uint32_t *)(db->start + size); if (new_crc != *crc) { PMD_DRV_LOG(ERR, "Corrupt hwinfo table (CRC mismatch) calculated 0x%x, expected 0x%x", - new_crc, *crc); + new_crc, *crc); return -EINVAL; } @@ -77,7 +79,8 @@ nfp_hwinfo_db_validate(struct nfp_hwinfo *db, uint32_t len) } static struct nfp_hwinfo * -nfp_hwinfo_try_fetch(struct nfp_cpp *cpp, size_t *cpp_size) +nfp_hwinfo_try_fetch(struct nfp_cpp *cpp, + size_t *cpp_size) { struct nfp_hwinfo *header; void *res; @@ -115,7 +118,7 @@ nfp_hwinfo_try_fetch(struct nfp_cpp *cpp, size_t *cpp_size) if (header->version != NFP_HWINFO_VERSION_2) { PMD_DRV_LOG(DEBUG, "Unknown HWInfo version: 0x%08x", - header->version); + header->version); goto exit_free; } @@ -129,7 +132,8 @@ nfp_hwinfo_try_fetch(struct nfp_cpp *cpp, size_t *cpp_size) } static struct nfp_hwinfo * -nfp_hwinfo_fetch(struct nfp_cpp *cpp, size_t *hwdb_size) +nfp_hwinfo_fetch(struct nfp_cpp *cpp, + size_t *hwdb_size) { struct timespec wait; struct nfp_hwinfo *db; @@ -179,7 +183,8 @@ nfp_hwinfo_read(struct nfp_cpp *cpp) * Return: Value of the HWInfo name, or NULL */ const char * -nfp_hwinfo_lookup(struct nfp_hwinfo *hwinfo, const char *lookup) +nfp_hwinfo_lookup(struct nfp_hwinfo *hwinfo, + const char *lookup) { const char *key, *val, *end; @@ -189,7 +194,7 @@ nfp_hwinfo_lookup(struct nfp_hwinfo *hwinfo, const char *lookup) end = hwinfo->data + hwinfo->size - sizeof(uint32_t); for (key = hwinfo->data; *key != 0 && key < end; - key = val + strlen(val) + 1) { + key = val + strlen(val) + 1) { val = key + strlen(key) + 1; if (strcmp(key, lookup) == 0) diff --git a/drivers/net/nfp/nfpcore/nfp_mip.c b/drivers/net/nfp/nfpcore/nfp_mip.c index f9723dd136..0071d3fc37 100644 --- a/drivers/net/nfp/nfpcore/nfp_mip.c +++ b/drivers/net/nfp/nfpcore/nfp_mip.c @@ -37,8 +37,10 @@ struct nfp_mip { /* Read memory and check if it could be a valid MIP */ static int -nfp_mip_try_read(struct nfp_cpp *cpp, uint32_t cpp_id, uint64_t addr, - struct nfp_mip *mip) +nfp_mip_try_read(struct nfp_cpp *cpp, + uint32_t cpp_id, + uint64_t addr, + struct nfp_mip *mip) { int ret; @@ -49,12 +51,12 @@ nfp_mip_try_read(struct nfp_cpp *cpp, uint32_t cpp_id, uint64_t addr, } if (mip->signature != NFP_MIP_SIGNATURE) { PMD_DRV_LOG(ERR, "Incorrect MIP signature (0x%08x)", - rte_le_to_cpu_32(mip->signature)); + rte_le_to_cpu_32(mip->signature)); return -EINVAL; } if (mip->mip_version != NFP_MIP_VERSION) { PMD_DRV_LOG(ERR, "Unsupported MIP version (%d)", - rte_le_to_cpu_32(mip->mip_version)); + rte_le_to_cpu_32(mip->mip_version)); return -EINVAL; } @@ -63,7 +65,8 @@ nfp_mip_try_read(struct nfp_cpp *cpp, uint32_t cpp_id, uint64_t addr, /* Try to locate MIP using the resource table */ static int -nfp_mip_read_resource(struct nfp_cpp *cpp, struct nfp_mip *mip) +nfp_mip_read_resource(struct nfp_cpp *cpp, + struct nfp_mip *mip) { struct nfp_nffw_info *nffw_info; uint32_t cpp_id; @@ -134,7 +137,9 @@ nfp_mip_name(const struct nfp_mip *mip) * @size: Location for size of MIP symbol table */ void -nfp_mip_symtab(const struct nfp_mip *mip, uint32_t *addr, uint32_t *size) +nfp_mip_symtab(const struct nfp_mip *mip, + uint32_t *addr, + uint32_t *size) { *addr = rte_le_to_cpu_32(mip->symtab_addr); *size = rte_le_to_cpu_32(mip->symtab_size); @@ -147,7 +152,9 @@ nfp_mip_symtab(const struct nfp_mip *mip, uint32_t *addr, uint32_t *size) * @size: Location for size of MIP symbol name table */ void -nfp_mip_strtab(const struct nfp_mip *mip, uint32_t *addr, uint32_t *size) +nfp_mip_strtab(const struct nfp_mip *mip, + uint32_t *addr, + uint32_t *size) { *addr = rte_le_to_cpu_32(mip->strtab_addr); *size = rte_le_to_cpu_32(mip->strtab_size); diff --git a/drivers/net/nfp/nfpcore/nfp_mip.h b/drivers/net/nfp/nfpcore/nfp_mip.h index d0919b58fe..980abc2517 100644 --- a/drivers/net/nfp/nfpcore/nfp_mip.h +++ b/drivers/net/nfp/nfpcore/nfp_mip.h @@ -17,5 +17,5 @@ const char *nfp_mip_name(const struct nfp_mip *mip); void nfp_mip_symtab(const struct nfp_mip *mip, uint32_t *addr, uint32_t *size); void nfp_mip_strtab(const struct nfp_mip *mip, uint32_t *addr, uint32_t *size); int nfp_nffw_info_mip_first(struct nfp_nffw_info *state, uint32_t *cpp_id, - uint64_t *off); + uint64_t *off); #endif diff --git a/drivers/net/nfp/nfpcore/nfp_mutex.c b/drivers/net/nfp/nfpcore/nfp_mutex.c index 0410a00856..047e755416 100644 --- a/drivers/net/nfp/nfpcore/nfp_mutex.c +++ b/drivers/net/nfp/nfpcore/nfp_mutex.c @@ -35,7 +35,9 @@ struct nfp_cpp_mutex { }; static int -_nfp_cpp_mutex_validate(uint32_t model, int *target, unsigned long long address) +_nfp_cpp_mutex_validate(uint32_t model, + int *target, + unsigned long long address) { /* Address must be 64-bit aligned */ if ((address & 7) != 0) @@ -72,8 +74,10 @@ _nfp_cpp_mutex_validate(uint32_t model, int *target, unsigned long long address) * @return 0 on success, or negative value on failure. */ int -nfp_cpp_mutex_init(struct nfp_cpp *cpp, int target, unsigned long long address, - uint32_t key) +nfp_cpp_mutex_init(struct nfp_cpp *cpp, + int target, + unsigned long long address, + uint32_t key) { uint32_t model = nfp_cpp_model(cpp); uint32_t muw = NFP_CPP_ID(target, 4, 0); /* atomic_write */ @@ -87,9 +91,8 @@ nfp_cpp_mutex_init(struct nfp_cpp *cpp, int target, unsigned long long address, if (err < 0) return err; - err = - nfp_cpp_writel(cpp, muw, address + 0, - MUTEX_LOCKED(nfp_cpp_interface(cpp))); + err = nfp_cpp_writel(cpp, muw, address + 0, + MUTEX_LOCKED(nfp_cpp_interface(cpp))); if (err < 0) return err; @@ -114,8 +117,10 @@ nfp_cpp_mutex_init(struct nfp_cpp *cpp, int target, unsigned long long address, * @return A non-NULL struct nfp_cpp_mutex * on success, NULL on failure. */ struct nfp_cpp_mutex * -nfp_cpp_mutex_alloc(struct nfp_cpp *cpp, int target, - unsigned long long address, uint32_t key) +nfp_cpp_mutex_alloc(struct nfp_cpp *cpp, + int target, + unsigned long long address, + uint32_t key) { uint32_t model = nfp_cpp_model(cpp); struct nfp_cpp_mutex *mutex; @@ -265,8 +270,8 @@ nfp_cpp_mutex_lock(struct nfp_cpp_mutex *mutex) return err; if (time(NULL) >= warn_at) { PMD_DRV_LOG(ERR, "Warning: waiting for NFP mutex usage:%u depth:%hd] target:%d addr:%llx key:%08x]", - mutex->usage, mutex->depth, mutex->target, - mutex->address, mutex->key); + mutex->usage, mutex->depth, mutex->target, + mutex->address, mutex->key); warn_at = time(NULL) + 60; } sched_yield(); diff --git a/drivers/net/nfp/nfpcore/nfp_nffw.c b/drivers/net/nfp/nfpcore/nfp_nffw.c index 433780a5e7..fa65956baa 100644 --- a/drivers/net/nfp/nfpcore/nfp_nffw.c +++ b/drivers/net/nfp/nfpcore/nfp_nffw.c @@ -85,7 +85,8 @@ nfp_mip_mu_locality_lsb(struct nfp_cpp *cpp) } static unsigned int -nffw_res_fwinfos(struct nfp_nffw_info_data *fwinf, struct nffw_fwinfo **arr) +nffw_res_fwinfos(struct nfp_nffw_info_data *fwinf, + struct nffw_fwinfo **arr) { /* * For the this code, version 0 is most likely to be version 1 in this @@ -138,8 +139,8 @@ nfp_nffw_info_open(struct nfp_cpp *cpp) goto err_release; err = nfp_cpp_read(cpp, nfp_resource_cpp_id(state->res), - nfp_resource_address(state->res), - fwinf, sizeof(*fwinf)); + nfp_resource_address(state->res), + fwinf, sizeof(*fwinf)); if (err < (int)sizeof(*fwinf)) goto err_release; @@ -205,8 +206,9 @@ nfp_nffw_info_fwid_first(struct nfp_nffw_info *state) * Return: 0, or -ERRNO */ int -nfp_nffw_info_mip_first(struct nfp_nffw_info *state, uint32_t *cpp_id, - uint64_t *off) +nfp_nffw_info_mip_first(struct nfp_nffw_info *state, + uint32_t *cpp_id, + uint64_t *off) { struct nffw_fwinfo *fwinfo; diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.c b/drivers/net/nfp/nfpcore/nfp_nsp.c index 6474abf0c2..4f476f6f2b 100644 --- a/drivers/net/nfp/nfpcore/nfp_nsp.c +++ b/drivers/net/nfp/nfpcore/nfp_nsp.c @@ -22,7 +22,8 @@ nfp_nsp_config_modified(struct nfp_nsp *state) } void -nfp_nsp_config_set_modified(struct nfp_nsp *state, int modified) +nfp_nsp_config_set_modified(struct nfp_nsp *state, + int modified) { state->modified = modified; } @@ -40,7 +41,9 @@ nfp_nsp_config_idx(struct nfp_nsp *state) } void -nfp_nsp_config_set_state(struct nfp_nsp *state, void *entries, unsigned int idx) +nfp_nsp_config_set_state(struct nfp_nsp *state, + void *entries, + unsigned int idx) { state->entries = entries; state->idx = idx; @@ -91,7 +94,7 @@ nfp_nsp_check(struct nfp_nsp *state) if (state->ver.major != NSP_MAJOR || state->ver.minor < NSP_MINOR) { PMD_DRV_LOG(ERR, "Unsupported ABI %hu.%hu", state->ver.major, - state->ver.minor); + state->ver.minor); return -EINVAL; } @@ -160,8 +163,12 @@ nfp_nsp_get_abi_ver_minor(struct nfp_nsp *state) } static int -nfp_nsp_wait_reg(struct nfp_cpp *cpp, uint64_t *reg, uint32_t nsp_cpp, - uint64_t addr, uint64_t mask, uint64_t val) +nfp_nsp_wait_reg(struct nfp_cpp *cpp, + uint64_t *reg, + uint32_t nsp_cpp, + uint64_t addr, + uint64_t mask, + uint64_t val) { struct timespec wait; int count; @@ -204,8 +211,11 @@ nfp_nsp_wait_reg(struct nfp_cpp *cpp, uint64_t *reg, uint32_t nsp_cpp, * -ETIMEDOUT if the NSP took longer than 30 seconds to complete */ static int -nfp_nsp_command(struct nfp_nsp *state, uint16_t code, uint32_t option, - uint32_t buff_cpp, uint64_t buff_addr) +nfp_nsp_command(struct nfp_nsp *state, + uint16_t code, + uint32_t option, + uint32_t buff_cpp, + uint64_t buff_addr) { uint64_t reg, ret_val, nsp_base, nsp_buffer, nsp_status, nsp_command; struct nfp_cpp *cpp = state->cpp; @@ -223,40 +233,40 @@ nfp_nsp_command(struct nfp_nsp *state, uint16_t code, uint32_t option, return err; if (!FIELD_FIT(NSP_BUFFER_CPP, buff_cpp >> 8) || - !FIELD_FIT(NSP_BUFFER_ADDRESS, buff_addr)) { + !FIELD_FIT(NSP_BUFFER_ADDRESS, buff_addr)) { PMD_DRV_LOG(ERR, "Host buffer out of reach %08x %" PRIx64, - buff_cpp, buff_addr); + buff_cpp, buff_addr); return -EINVAL; } err = nfp_cpp_writeq(cpp, nsp_cpp, nsp_buffer, - FIELD_PREP(NSP_BUFFER_CPP, buff_cpp >> 8) | - FIELD_PREP(NSP_BUFFER_ADDRESS, buff_addr)); + FIELD_PREP(NSP_BUFFER_CPP, buff_cpp >> 8) | + FIELD_PREP(NSP_BUFFER_ADDRESS, buff_addr)); if (err < 0) return err; err = nfp_cpp_writeq(cpp, nsp_cpp, nsp_command, - FIELD_PREP(NSP_COMMAND_OPTION, option) | - FIELD_PREP(NSP_COMMAND_CODE, code) | - FIELD_PREP(NSP_COMMAND_START, 1)); + FIELD_PREP(NSP_COMMAND_OPTION, option) | + FIELD_PREP(NSP_COMMAND_CODE, code) | + FIELD_PREP(NSP_COMMAND_START, 1)); if (err < 0) return err; /* Wait for NSP_COMMAND_START to go to 0 */ err = nfp_nsp_wait_reg(cpp, ®, nsp_cpp, nsp_command, - NSP_COMMAND_START, 0); + NSP_COMMAND_START, 0); if (err != 0) { PMD_DRV_LOG(ERR, "Error %d waiting for code 0x%04x to start", - err, code); + err, code); return err; } /* Wait for NSP_STATUS_BUSY to go to 0 */ - err = nfp_nsp_wait_reg(cpp, ®, nsp_cpp, nsp_status, NSP_STATUS_BUSY, - 0); + err = nfp_nsp_wait_reg(cpp, ®, nsp_cpp, nsp_status, + NSP_STATUS_BUSY, 0); if (err != 0) { PMD_DRV_LOG(ERR, "Error %d waiting for code 0x%04x to start", - err, code); + err, code); return err; } @@ -268,7 +278,7 @@ nfp_nsp_command(struct nfp_nsp *state, uint16_t code, uint32_t option, err = FIELD_GET(NSP_STATUS_RESULT, reg); if (err != 0) { PMD_DRV_LOG(ERR, "Result (error) code set: %d (%d) command: %d", - -err, (int)ret_val, code); + -err, (int)ret_val, code); nfp_nsp_print_extended_error(ret_val); return -err; } @@ -279,9 +289,12 @@ nfp_nsp_command(struct nfp_nsp *state, uint16_t code, uint32_t option, #define SZ_1M 0x00100000 static int -nfp_nsp_command_buf(struct nfp_nsp *nsp, uint16_t code, uint32_t option, - const void *in_buf, unsigned int in_size, void *out_buf, - unsigned int out_size) +nfp_nsp_command_buf(struct nfp_nsp *nsp, + uint16_t code, uint32_t option, + const void *in_buf, + unsigned int in_size, + void *out_buf, + unsigned int out_size) { struct nfp_cpp *cpp = nsp->cpp; unsigned int max_size; @@ -291,28 +304,26 @@ nfp_nsp_command_buf(struct nfp_nsp *nsp, uint16_t code, uint32_t option, if (nsp->ver.minor < 13) { PMD_DRV_LOG(ERR, "NSP: Code 0x%04x with buffer not supported ABI %hu.%hu)", - code, nsp->ver.major, nsp->ver.minor); + code, nsp->ver.major, nsp->ver.minor); return -EOPNOTSUPP; } err = nfp_cpp_readq(cpp, nfp_resource_cpp_id(nsp->res), - nfp_resource_address(nsp->res) + - NSP_DFLT_BUFFER_CONFIG, - ®); + nfp_resource_address(nsp->res) + NSP_DFLT_BUFFER_CONFIG, + ®); if (err < 0) return err; max_size = RTE_MAX(in_size, out_size); if (FIELD_GET(NSP_DFLT_BUFFER_SIZE_MB, reg) * SZ_1M < max_size) { PMD_DRV_LOG(ERR, "NSP: default buffer too small for command 0x%04x (%llu < %u)", - code, FIELD_GET(NSP_DFLT_BUFFER_SIZE_MB, reg) * SZ_1M, max_size); + code, FIELD_GET(NSP_DFLT_BUFFER_SIZE_MB, reg) * SZ_1M, max_size); return -EINVAL; } err = nfp_cpp_readq(cpp, nfp_resource_cpp_id(nsp->res), - nfp_resource_address(nsp->res) + - NSP_DFLT_BUFFER, - ®); + nfp_resource_address(nsp->res) + NSP_DFLT_BUFFER, + ®); if (err < 0) return err; @@ -328,7 +339,7 @@ nfp_nsp_command_buf(struct nfp_nsp *nsp, uint16_t code, uint32_t option, if (out_buf != NULL && out_size > 0 && out_size > in_size) { memset(out_buf, 0, out_size - in_size); err = nfp_cpp_write(cpp, cpp_id, cpp_buf + in_size, out_buf, - out_size - in_size); + out_size - in_size); if (err < 0) return err; } @@ -388,38 +399,47 @@ nfp_nsp_mac_reinit(struct nfp_nsp *state) } int -nfp_nsp_load_fw(struct nfp_nsp *state, void *buf, unsigned int size) +nfp_nsp_load_fw(struct nfp_nsp *state, + void *buf, + unsigned int size) { return nfp_nsp_command_buf(state, SPCODE_FW_LOAD, size, buf, size, - NULL, 0); + NULL, 0); } int -nfp_nsp_read_eth_table(struct nfp_nsp *state, void *buf, unsigned int size) +nfp_nsp_read_eth_table(struct nfp_nsp *state, + void *buf, + unsigned int size) { return nfp_nsp_command_buf(state, SPCODE_ETH_RESCAN, size, NULL, 0, - buf, size); + buf, size); } int -nfp_nsp_write_eth_table(struct nfp_nsp *state, const void *buf, - unsigned int size) +nfp_nsp_write_eth_table(struct nfp_nsp *state, + const void *buf, + unsigned int size) { return nfp_nsp_command_buf(state, SPCODE_ETH_CONTROL, size, buf, size, - NULL, 0); + NULL, 0); } int -nfp_nsp_read_identify(struct nfp_nsp *state, void *buf, unsigned int size) +nfp_nsp_read_identify(struct nfp_nsp *state, + void *buf, + unsigned int size) { return nfp_nsp_command_buf(state, SPCODE_NSP_IDENTIFY, size, NULL, 0, - buf, size); + buf, size); } int -nfp_nsp_read_sensors(struct nfp_nsp *state, unsigned int sensor_mask, void *buf, - unsigned int size) +nfp_nsp_read_sensors(struct nfp_nsp *state, + unsigned int sensor_mask, + void *buf, + unsigned int size) { return nfp_nsp_command_buf(state, SPCODE_NSP_SENSORS, sensor_mask, NULL, - 0, buf, size); + 0, buf, size); } diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.h b/drivers/net/nfp/nfpcore/nfp_nsp.h index 9905b2d3d3..1e2deaabb4 100644 --- a/drivers/net/nfp/nfpcore/nfp_nsp.h +++ b/drivers/net/nfp/nfpcore/nfp_nsp.h @@ -114,9 +114,10 @@ int nfp_nsp_load_fw(struct nfp_nsp *state, void *buf, unsigned int size); int nfp_nsp_mac_reinit(struct nfp_nsp *state); int nfp_nsp_read_identify(struct nfp_nsp *state, void *buf, unsigned int size); int nfp_nsp_read_sensors(struct nfp_nsp *state, unsigned int sensor_mask, - void *buf, unsigned int size); + void *buf, unsigned int size); -static inline int nfp_nsp_has_mac_reinit(struct nfp_nsp *state) +static inline int +nfp_nsp_has_mac_reinit(struct nfp_nsp *state) { return nfp_nsp_get_abi_ver_minor(state) > 20; } @@ -229,22 +230,22 @@ struct nfp_eth_table *nfp_eth_read_ports(struct nfp_cpp *cpp); int nfp_eth_set_mod_enable(struct nfp_cpp *cpp, unsigned int idx, int enable); int nfp_eth_set_configured(struct nfp_cpp *cpp, unsigned int idx, - int configed); -int -nfp_eth_set_fec(struct nfp_cpp *cpp, unsigned int idx, enum nfp_eth_fec mode); + int configed); +int nfp_eth_set_fec(struct nfp_cpp *cpp, unsigned int idx, enum nfp_eth_fec mode); int nfp_nsp_read_eth_table(struct nfp_nsp *state, void *buf, unsigned int size); int nfp_nsp_write_eth_table(struct nfp_nsp *state, const void *buf, - unsigned int size); + unsigned int size); void nfp_nsp_config_set_state(struct nfp_nsp *state, void *entries, - unsigned int idx); + unsigned int idx); void nfp_nsp_config_clear_state(struct nfp_nsp *state); void nfp_nsp_config_set_modified(struct nfp_nsp *state, int modified); void *nfp_nsp_config_entries(struct nfp_nsp *state); int nfp_nsp_config_modified(struct nfp_nsp *state); unsigned int nfp_nsp_config_idx(struct nfp_nsp *state); -static inline int nfp_eth_can_support_fec(struct nfp_eth_table_port *eth_port) +static inline int +nfp_eth_can_support_fec(struct nfp_eth_table_port *eth_port) { return !!eth_port->fec_modes_supported; } @@ -297,6 +298,6 @@ enum nfp_nsp_sensor_id { }; int nfp_hwmon_read_sensor(struct nfp_cpp *cpp, enum nfp_nsp_sensor_id id, - long *val); + long *val); #endif diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c b/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c index 21b338461e..28dba27124 100644 --- a/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c +++ b/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c @@ -73,7 +73,9 @@ struct nfp_sensors { }; int -nfp_hwmon_read_sensor(struct nfp_cpp *cpp, enum nfp_nsp_sensor_id id, long *val) +nfp_hwmon_read_sensor(struct nfp_cpp *cpp, + enum nfp_nsp_sensor_id id, + long *val) { struct nfp_sensors s; struct nfp_nsp *nsp; diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c index 825a84a8cd..51bd57033e 100644 --- a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c +++ b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c @@ -159,7 +159,8 @@ nfp_eth_speed2rate(unsigned int speed) } static void -nfp_eth_copy_mac_reverse(uint8_t *dst, const uint8_t *src) +nfp_eth_copy_mac_reverse(uint8_t *dst, + const uint8_t *src) { int i; @@ -168,8 +169,10 @@ nfp_eth_copy_mac_reverse(uint8_t *dst, const uint8_t *src) } static void -nfp_eth_port_translate(struct nfp_nsp *nsp, const union eth_table_entry *src, - unsigned int index, struct nfp_eth_table_port *dst) +nfp_eth_port_translate(struct nfp_nsp *nsp, + const union eth_table_entry *src, + unsigned int index, + struct nfp_eth_table_port *dst) { unsigned int rate; unsigned int fec; @@ -225,21 +228,21 @@ nfp_eth_calc_port_geometry(struct nfp_eth_table *table) for (i = 0; i < table->count; i++) { table->max_index = RTE_MAX(table->max_index, - table->ports[i].index); + table->ports[i].index); for (j = 0; j < table->count; j++) { if (table->ports[i].label_port != - table->ports[j].label_port) + table->ports[j].label_port) continue; table->ports[i].port_lanes += table->ports[j].lanes; if (i == j) continue; if (table->ports[i].label_subport == - table->ports[j].label_subport) + table->ports[j].label_subport) PMD_DRV_LOG(DEBUG, "Port %d subport %d is a duplicate", - table->ports[i].label_port, - table->ports[i].label_subport); + table->ports[i].label_port, + table->ports[i].label_subport); table->ports[i].is_split = 1; } @@ -296,7 +299,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp) */ if (ret != 0 && ret != cnt) { PMD_DRV_LOG(ERR, "table entry count (%d) unmatch entries present (%d)", - ret, cnt); + ret, cnt); goto err; } @@ -354,7 +357,8 @@ nfp_eth_read_ports(struct nfp_cpp *cpp) } struct nfp_nsp * -nfp_eth_config_start(struct nfp_cpp *cpp, unsigned int idx) +nfp_eth_config_start(struct nfp_cpp *cpp, + unsigned int idx) { union eth_table_entry *entries; struct nfp_nsp *nsp; @@ -447,7 +451,9 @@ nfp_eth_config_commit_end(struct nfp_nsp *nsp) * -ERRNO - configuration failed. */ int -nfp_eth_set_mod_enable(struct nfp_cpp *cpp, unsigned int idx, int enable) +nfp_eth_set_mod_enable(struct nfp_cpp *cpp, + unsigned int idx, + int enable) { union eth_table_entry *entries; struct nfp_nsp *nsp; @@ -487,7 +493,9 @@ nfp_eth_set_mod_enable(struct nfp_cpp *cpp, unsigned int idx, int enable) * -ERRNO - configuration failed. */ int -nfp_eth_set_configured(struct nfp_cpp *cpp, unsigned int idx, int configed) +nfp_eth_set_configured(struct nfp_cpp *cpp, + unsigned int idx, + int configed) { union eth_table_entry *entries; struct nfp_nsp *nsp; @@ -523,9 +531,12 @@ nfp_eth_set_configured(struct nfp_cpp *cpp, unsigned int idx, int configed) } static int -nfp_eth_set_bit_config(struct nfp_nsp *nsp, unsigned int raw_idx, - const uint64_t mask, const unsigned int shift, - unsigned int val, const uint64_t ctrl_bit) +nfp_eth_set_bit_config(struct nfp_nsp *nsp, + unsigned int raw_idx, + const uint64_t mask, + const unsigned int shift, + unsigned int val, + const uint64_t ctrl_bit) { union eth_table_entry *entries = nfp_nsp_config_entries(nsp); unsigned int idx = nfp_nsp_config_idx(nsp); @@ -560,7 +571,7 @@ nfp_eth_set_bit_config(struct nfp_nsp *nsp, unsigned int raw_idx, (__extension__ ({ \ typeof(mask) _x = (mask); \ nfp_eth_set_bit_config(nsp, raw_idx, _x, __bf_shf(_x), \ - val, ctrl_bit); \ + val, ctrl_bit); \ })) /* @@ -574,11 +585,11 @@ nfp_eth_set_bit_config(struct nfp_nsp *nsp, unsigned int raw_idx, * Return: 0 or -ERRNO. */ int -__nfp_eth_set_aneg(struct nfp_nsp *nsp, enum nfp_eth_aneg mode) +__nfp_eth_set_aneg(struct nfp_nsp *nsp, + enum nfp_eth_aneg mode) { return NFP_ETH_SET_BIT_CONFIG(nsp, NSP_ETH_RAW_STATE, - NSP_ETH_STATE_ANEG, mode, - NSP_ETH_CTRL_SET_ANEG); + NSP_ETH_STATE_ANEG, mode, NSP_ETH_CTRL_SET_ANEG); } /* @@ -592,11 +603,11 @@ __nfp_eth_set_aneg(struct nfp_nsp *nsp, enum nfp_eth_aneg mode) * Return: 0 or -ERRNO. */ static int -__nfp_eth_set_fec(struct nfp_nsp *nsp, enum nfp_eth_fec mode) +__nfp_eth_set_fec(struct nfp_nsp *nsp, + enum nfp_eth_fec mode) { return NFP_ETH_SET_BIT_CONFIG(nsp, NSP_ETH_RAW_STATE, - NSP_ETH_STATE_FEC, mode, - NSP_ETH_CTRL_SET_FEC); + NSP_ETH_STATE_FEC, mode, NSP_ETH_CTRL_SET_FEC); } /* @@ -611,7 +622,9 @@ __nfp_eth_set_fec(struct nfp_nsp *nsp, enum nfp_eth_fec mode) * -ERRNO - configuration failed. */ int -nfp_eth_set_fec(struct nfp_cpp *cpp, unsigned int idx, enum nfp_eth_fec mode) +nfp_eth_set_fec(struct nfp_cpp *cpp, + unsigned int idx, + enum nfp_eth_fec mode) { struct nfp_nsp *nsp; int err; @@ -642,7 +655,8 @@ nfp_eth_set_fec(struct nfp_cpp *cpp, unsigned int idx, enum nfp_eth_fec mode) * Return: 0 or -ERRNO. */ int -__nfp_eth_set_speed(struct nfp_nsp *nsp, unsigned int speed) +__nfp_eth_set_speed(struct nfp_nsp *nsp, + unsigned int speed) { enum nfp_eth_rate rate; @@ -653,8 +667,7 @@ __nfp_eth_set_speed(struct nfp_nsp *nsp, unsigned int speed) } return NFP_ETH_SET_BIT_CONFIG(nsp, NSP_ETH_RAW_STATE, - NSP_ETH_STATE_RATE, rate, - NSP_ETH_CTRL_SET_RATE); + NSP_ETH_STATE_RATE, rate, NSP_ETH_CTRL_SET_RATE); } /* @@ -668,8 +681,9 @@ __nfp_eth_set_speed(struct nfp_nsp *nsp, unsigned int speed) * Return: 0 or -ERRNO. */ int -__nfp_eth_set_split(struct nfp_nsp *nsp, unsigned int lanes) +__nfp_eth_set_split(struct nfp_nsp *nsp, + unsigned int lanes) { - return NFP_ETH_SET_BIT_CONFIG(nsp, NSP_ETH_RAW_PORT, NSP_ETH_PORT_LANES, - lanes, NSP_ETH_CTRL_SET_LANES); + return NFP_ETH_SET_BIT_CONFIG(nsp, NSP_ETH_RAW_PORT, + NSP_ETH_PORT_LANES, lanes, NSP_ETH_CTRL_SET_LANES); } diff --git a/drivers/net/nfp/nfpcore/nfp_resource.c b/drivers/net/nfp/nfpcore/nfp_resource.c index 838cd6e0ef..57089c770f 100644 --- a/drivers/net/nfp/nfpcore/nfp_resource.c +++ b/drivers/net/nfp/nfpcore/nfp_resource.c @@ -64,7 +64,8 @@ struct nfp_resource { }; static int -nfp_cpp_resource_find(struct nfp_cpp *cpp, struct nfp_resource *res) +nfp_cpp_resource_find(struct nfp_cpp *cpp, + struct nfp_resource *res) { char name_pad[NFP_RESOURCE_ENTRY_NAME_SZ + 2]; struct nfp_resource_entry entry; @@ -85,7 +86,7 @@ nfp_cpp_resource_find(struct nfp_cpp *cpp, struct nfp_resource *res) for (i = 0; i < NFP_RESOURCE_TBL_ENTRIES; i++) { uint64_t addr = NFP_RESOURCE_TBL_BASE + - sizeof(struct nfp_resource_entry) * i; + sizeof(struct nfp_resource_entry) * i; ret = nfp_cpp_read(cpp, cpp_id, addr, &entry, sizeof(entry)); if (ret != sizeof(entry)) @@ -95,12 +96,11 @@ nfp_cpp_resource_find(struct nfp_cpp *cpp, struct nfp_resource *res) continue; /* Found key! */ - res->mutex = - nfp_cpp_mutex_alloc(cpp, - NFP_RESOURCE_TBL_TARGET, addr, key); + res->mutex = nfp_cpp_mutex_alloc(cpp, NFP_RESOURCE_TBL_TARGET, + addr, key); res->cpp_id = NFP_CPP_ID(entry.region.cpp_target, - entry.region.cpp_action, - entry.region.cpp_token); + entry.region.cpp_action, + entry.region.cpp_token); res->addr = ((uint64_t)entry.region.page_offset) << 8; res->size = (uint64_t)entry.region.page_size << 8; return 0; @@ -110,8 +110,9 @@ nfp_cpp_resource_find(struct nfp_cpp *cpp, struct nfp_resource *res) } static int -nfp_resource_try_acquire(struct nfp_cpp *cpp, struct nfp_resource *res, - struct nfp_cpp_mutex *dev_mutex) +nfp_resource_try_acquire(struct nfp_cpp *cpp, + struct nfp_resource *res, + struct nfp_cpp_mutex *dev_mutex) { int err; @@ -148,7 +149,8 @@ nfp_resource_try_acquire(struct nfp_cpp *cpp, struct nfp_resource *res, * Return: NFP Resource handle, or NULL */ struct nfp_resource * -nfp_resource_acquire(struct nfp_cpp *cpp, const char *name) +nfp_resource_acquire(struct nfp_cpp *cpp, + const char *name) { struct nfp_cpp_mutex *dev_mutex; struct nfp_resource *res; @@ -165,8 +167,7 @@ nfp_resource_acquire(struct nfp_cpp *cpp, const char *name) strncpy(res->name, name, NFP_RESOURCE_ENTRY_NAME_SZ); dev_mutex = nfp_cpp_mutex_alloc(cpp, NFP_RESOURCE_TBL_TARGET, - NFP_RESOURCE_TBL_BASE, - NFP_RESOURCE_TBL_KEY); + NFP_RESOURCE_TBL_BASE, NFP_RESOURCE_TBL_KEY); if (dev_mutex == NULL) { free(res); return NULL; @@ -234,8 +235,8 @@ nfp_resource_cpp_id(const struct nfp_resource *res) * * Return: const char pointer to the name of the resource */ -const char -*nfp_resource_name(const struct nfp_resource *res) +const char * +nfp_resource_name(const struct nfp_resource *res) { return res->name; } diff --git a/drivers/net/nfp/nfpcore/nfp_resource.h b/drivers/net/nfp/nfpcore/nfp_resource.h index 06cc6f74f4..009b7359a4 100644 --- a/drivers/net/nfp/nfpcore/nfp_resource.h +++ b/drivers/net/nfp/nfpcore/nfp_resource.h @@ -18,7 +18,7 @@ struct nfp_resource; struct nfp_resource *nfp_resource_acquire(struct nfp_cpp *cpp, - const char *name); + const char *name); /** * Release a NFP Resource, and free the handle diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c index 4c45aec5c1..aa3b7a483e 100644 --- a/drivers/net/nfp/nfpcore/nfp_rtsym.c +++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c @@ -40,22 +40,25 @@ struct nfp_rtsym_table { }; static int -nfp_meid(uint8_t island_id, uint8_t menum) +nfp_meid(uint8_t island_id, + uint8_t menum) { return (island_id & 0x3F) == island_id && menum < 12 ? (island_id << 4) | (menum + 4) : -1; } static void -nfp_rtsym_sw_entry_init(struct nfp_rtsym_table *cache, uint32_t strtab_size, - struct nfp_rtsym *sw, struct nfp_rtsym_entry *fw) +nfp_rtsym_sw_entry_init(struct nfp_rtsym_table *cache, + uint32_t strtab_size, + struct nfp_rtsym *sw, + struct nfp_rtsym_entry *fw) { sw->type = fw->type; sw->name = cache->strtab + rte_le_to_cpu_16(fw->name) % strtab_size; sw->addr = ((uint64_t)fw->addr_hi << 32) | - rte_le_to_cpu_32(fw->addr_lo); + rte_le_to_cpu_32(fw->addr_lo); sw->size = ((uint64_t)fw->size_hi << 32) | - rte_le_to_cpu_32(fw->size_lo); + rte_le_to_cpu_32(fw->size_lo); PMD_INIT_LOG(DEBUG, "rtsym_entry_init name=%s, addr=%" PRIx64 ", size=%" PRIu64 ", target=%d", sw->name, sw->addr, sw->size, sw->target); @@ -93,7 +96,8 @@ nfp_rtsym_table_read(struct nfp_cpp *cpp) } struct nfp_rtsym_table * -__nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip) +__nfp_rtsym_table_read(struct nfp_cpp *cpp, + const struct nfp_mip *mip) { uint32_t strtab_addr, symtab_addr, strtab_size, symtab_size; struct nfp_rtsym_entry *rtsymtab; @@ -142,7 +146,7 @@ __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip) for (n = 0; n < cache->num; n++) nfp_rtsym_sw_entry_init(cache, strtab_size, - &cache->symtab[n], &rtsymtab[n]); + &cache->symtab[n], &rtsymtab[n]); free(rtsymtab); @@ -178,7 +182,8 @@ nfp_rtsym_count(struct nfp_rtsym_table *rtbl) * Return: const pointer to a struct nfp_rtsym descriptor, or NULL */ const struct nfp_rtsym * -nfp_rtsym_get(struct nfp_rtsym_table *rtbl, int idx) +nfp_rtsym_get(struct nfp_rtsym_table *rtbl, + int idx) { if (rtbl == NULL) return NULL; @@ -197,7 +202,8 @@ nfp_rtsym_get(struct nfp_rtsym_table *rtbl, int idx) * Return: const pointer to a struct nfp_rtsym descriptor, or NULL */ const struct nfp_rtsym * -nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, const char *name) +nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, + const char *name) { int n; @@ -331,7 +337,9 @@ nfp_rtsym_readq(struct nfp_cpp *cpp, * Return: value read, on error sets the error and returns ~0ULL. */ uint64_t -nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, int *error) +nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, + const char *name, + int *error) { const struct nfp_rtsym *sym; uint32_t val32; @@ -354,7 +362,7 @@ nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, int *error) break; default: PMD_DRV_LOG(ERR, "rtsym '%s' unsupported size: %" PRId64, - name, sym->size); + name, sym->size); err = -EINVAL; break; } @@ -372,8 +380,10 @@ nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, int *error) } uint8_t * -nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, - unsigned int min_size, struct nfp_cpp_area **area) +nfp_rtsym_map(struct nfp_rtsym_table *rtbl, + const char *name, + unsigned int min_size, + struct nfp_cpp_area **area) { int ret; uint8_t *mem; @@ -397,7 +407,7 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, if (sym->size < min_size) { PMD_DRV_LOG(ERR, "Symbol %s too small (%" PRIu64 " < %u)", name, - sym->size, min_size); + sym->size, min_size); return NULL; } diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.h b/drivers/net/nfp/nfpcore/nfp_rtsym.h index 8b494211bc..30768f1ccf 100644 --- a/drivers/net/nfp/nfpcore/nfp_rtsym.h +++ b/drivers/net/nfp/nfpcore/nfp_rtsym.h @@ -43,19 +43,18 @@ struct nfp_rtsym_table; struct nfp_rtsym_table *nfp_rtsym_table_read(struct nfp_cpp *cpp); -struct nfp_rtsym_table * -__nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip); +struct nfp_rtsym_table *__nfp_rtsym_table_read(struct nfp_cpp *cpp, + const struct nfp_mip *mip); int nfp_rtsym_count(struct nfp_rtsym_table *rtbl); const struct nfp_rtsym *nfp_rtsym_get(struct nfp_rtsym_table *rtbl, int idx); -const struct nfp_rtsym * -nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, const char *name); +const struct nfp_rtsym *nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, + const char *name); uint64_t nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, - int *error); -uint8_t * -nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, - unsigned int min_size, struct nfp_cpp_area **area); + int *error); +uint8_t *nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, + unsigned int min_size, struct nfp_cpp_area **area); #endif -- 2.39.1