.. | .. |
---|
1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
---|
2 | 1 | /* |
---|
3 | 2 | * Memory pools library, Public interface |
---|
4 | 3 | * |
---|
.. | .. |
---|
36 | 35 | * and instrumentation on top of the heap, without modifying the heap |
---|
37 | 36 | * allocation implementation. |
---|
38 | 37 | * |
---|
39 | | - * Copyright (C) 1999-2019, Broadcom Corporation |
---|
40 | | - * |
---|
| 38 | + * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation |
---|
| 39 | + * |
---|
| 40 | + * Copyright (C) 1999-2017, Broadcom Corporation |
---|
| 41 | + * |
---|
41 | 42 | * Unless you and Broadcom execute a separate written software license |
---|
42 | 43 | * agreement governing use of this software, this software is licensed to you |
---|
43 | 44 | * under the terms of the GNU General Public License version 2 (the "GPL"), |
---|
44 | 45 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the |
---|
45 | 46 | * following added to such license: |
---|
46 | | - * |
---|
| 47 | + * |
---|
47 | 48 | * As a special exception, the copyright holders of this software give you |
---|
48 | 49 | * permission to link this software with independent modules, and to copy and |
---|
49 | 50 | * distribute the resulting executable under terms of your choice, provided that |
---|
.. | .. |
---|
51 | 52 | * the license of that module. An independent module is a module which is not |
---|
52 | 53 | * derived from this software. The special exception does not apply to any |
---|
53 | 54 | * modifications of the software. |
---|
54 | | - * |
---|
| 55 | + * |
---|
55 | 56 | * Notwithstanding the above, under no circumstances may you combine this |
---|
56 | 57 | * software in any way with any other Broadcom software provided under a license |
---|
57 | 58 | * other than the GPL, without Broadcom's express prior written consent. |
---|
.. | .. |
---|
59 | 60 | * |
---|
60 | 61 | * <<Broadcom-WL-IPTag/Open:>> |
---|
61 | 62 | * |
---|
62 | | - * $Id: bcm_mpool_pub.h 514727 2014-11-12 03:02:48Z $ |
---|
| 63 | + * $Id: bcm_mpool_pub.h 535090 2015-02-17 04:49:01Z $ |
---|
63 | 64 | */ |
---|
64 | 65 | |
---|
65 | 66 | #ifndef _BCM_MPOOL_PUB_H |
---|
66 | 67 | #define _BCM_MPOOL_PUB_H 1 |
---|
67 | 68 | |
---|
68 | 69 | #include <typedefs.h> /* needed for uint16 */ |
---|
69 | | - |
---|
70 | 70 | |
---|
71 | 71 | /* |
---|
72 | 72 | ************************************************************************** |
---|
.. | .. |
---|
98 | 98 | struct bcm_mp_pool; |
---|
99 | 99 | typedef struct bcm_mp_pool *bcm_mp_pool_h; |
---|
100 | 100 | |
---|
101 | | - |
---|
102 | 101 | /* |
---|
103 | 102 | * To make instrumentation more readable, every memory |
---|
104 | 103 | * pool must have a readable name. Pool names are up to |
---|
105 | 104 | * 8 bytes including '\0' termination. (7 printable characters.) |
---|
106 | 105 | */ |
---|
107 | 106 | #define BCM_MP_NAMELEN 8 |
---|
108 | | - |
---|
109 | 107 | |
---|
110 | 108 | /* |
---|
111 | 109 | * Type definition for pool statistics. |
---|
.. | .. |
---|
118 | 116 | uint16 high_water; /* Max number of allocated objects. */ |
---|
119 | 117 | uint16 failed_alloc; /* Failed allocations. */ |
---|
120 | 118 | } bcm_mp_stats_t; |
---|
121 | | - |
---|
122 | 119 | |
---|
123 | 120 | /* |
---|
124 | 121 | ************************************************************************** |
---|
.. | .. |
---|
141 | 138 | * BCME_NOMEM Initialization failed due to no memory. Object must not be used. |
---|
142 | 139 | */ |
---|
143 | 140 | int bcm_mpm_init(struct osl_info *osh, int max_pools, bcm_mpm_mgr_h *mgrp); |
---|
144 | | - |
---|
145 | 141 | |
---|
146 | 142 | /* |
---|
147 | 143 | * bcm_mpm_deinit() - de-initialize the whole memory pool system. |
---|
.. | .. |
---|
187 | 183 | const char poolname[BCM_MP_NAMELEN], |
---|
188 | 184 | bcm_mp_pool_h *newp); |
---|
189 | 185 | |
---|
190 | | - |
---|
191 | 186 | /* |
---|
192 | 187 | * bcm_mpm_delete_prealloc_pool() - Delete a memory pool. This should only be called after |
---|
193 | 188 | * all memory objects have been freed back to the pool. |
---|
.. | .. |
---|
226 | 221 | const char poolname[BCM_MP_NAMELEN], |
---|
227 | 222 | bcm_mp_pool_h *newp); |
---|
228 | 223 | |
---|
229 | | - |
---|
230 | 224 | /* |
---|
231 | 225 | * bcm_mpm_delete_heap_pool() - Delete a memory pool. This should only be called after |
---|
232 | 226 | * all memory objects have been freed back to the pool. |
---|
.. | .. |
---|
241 | 235 | * |
---|
242 | 236 | */ |
---|
243 | 237 | int bcm_mpm_delete_heap_pool(bcm_mpm_mgr_h mgr, bcm_mp_pool_h *poolp); |
---|
244 | | - |
---|
245 | 238 | |
---|
246 | 239 | /* |
---|
247 | 240 | * bcm_mpm_stats() - Return stats for all pools |
---|
.. | .. |
---|
259 | 252 | */ |
---|
260 | 253 | int bcm_mpm_stats(bcm_mpm_mgr_h mgr, bcm_mp_stats_t *stats, int *nentries); |
---|
261 | 254 | |
---|
262 | | - |
---|
263 | 255 | /* |
---|
264 | 256 | * bcm_mpm_dump() - Display statistics on all pools |
---|
265 | 257 | * |
---|
.. | .. |
---|
273 | 265 | * |
---|
274 | 266 | */ |
---|
275 | 267 | int bcm_mpm_dump(bcm_mpm_mgr_h mgr, struct bcmstrbuf *b); |
---|
276 | | - |
---|
277 | 268 | |
---|
278 | 269 | /* |
---|
279 | 270 | * bcm_mpm_get_obj_size() - The size of memory objects may need to be padded to |
---|
.. | .. |
---|
296 | 287 | */ |
---|
297 | 288 | int bcm_mpm_get_obj_size(bcm_mpm_mgr_h mgr, unsigned int obj_sz, unsigned int *padded_obj_sz); |
---|
298 | 289 | |
---|
299 | | - |
---|
300 | 290 | /* |
---|
301 | 291 | *************************************************************************** |
---|
302 | 292 | * |
---|
.. | .. |
---|
304 | 294 | * |
---|
305 | 295 | *************************************************************************** |
---|
306 | 296 | */ |
---|
307 | | - |
---|
308 | 297 | |
---|
309 | 298 | /* |
---|
310 | 299 | * bcm_mp_alloc() - Allocate a memory pool object. |
---|
.. | .. |
---|
344 | 333 | * other Error getting statistics. |
---|
345 | 334 | * |
---|
346 | 335 | */ |
---|
347 | | -int bcm_mp_stats(bcm_mp_pool_h pool, bcm_mp_stats_t *stats); |
---|
348 | | - |
---|
| 336 | +void bcm_mp_stats(bcm_mp_pool_h pool, bcm_mp_stats_t *stats); |
---|
349 | 337 | |
---|
350 | 338 | /* |
---|
351 | 339 | * bcm_mp_dump() - Dump a pool |
---|
.. | .. |
---|
360 | 348 | * |
---|
361 | 349 | */ |
---|
362 | 350 | int bcm_mp_dump(bcm_mp_pool_h pool, struct bcmstrbuf *b); |
---|
363 | | - |
---|
364 | 351 | |
---|
365 | 352 | #endif /* _BCM_MPOOL_PUB_H */ |
---|