1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
20 /********************************************************************20**
22 Name: Common Memory Manager
26 Desc: Defines that are required by the Common Memory Manager.
30 *********************************************************************21*/
35 /* cm_mem_h_001.103 - Addition */
41 #ifdef XEON_MULTIPLE_CELL_CHANGES
42 #define MAX_WLS_DEVICE_NAME_LEN 16
43 #define DEFAULT_WLS_DEVICE_NAME "/dev/wls"
46 #define CMM_MINBUFSIZE (PTRALIGN(sizeof(CmHEntry)))
47 #define CMM_DATALIGN(s, msz) (((Size)(s) % msz) ? ((Size)(s) + ((msz - (Size)(s) % msz))): (Size)(s))
49 #define CMM_BUFSIZE(s, msz) ((Size)(s) < (Size) msz ? \
51 (Size) CMM_DATALIGN(s, msz))
54 /* cm_mem_h_001.103 - Addition for MEMCAL */
55 #ifndef CMM_MAX_BKT_ENT
56 #define CMM_MAX_BKT_ENT 30
58 #ifndef CMM_MAX_MAP_ENT
59 /* cm_mem_h_001.main_10: Modifications*/
60 #define CMM_MAX_MAP_ENT 512
63 /* cm_mem_h_001.main_6 - addition for SSI enhancements */
64 #if (defined(SSI_DEBUG_LEVEL1) || defined(BRDCM_SSI_MEM_LEAK_DEBUG_LEVEL1) || defined (SS_LIGHT_MEM_LEAK_STS))
66 * Memory block header signature length
67 * Customer might choose to modify this to set his desired trampling signature length
68 * Customer should choose a value between 1 byte to 4 bytes
70 #define CMM_TRAMPLING_SIGNATURE_LEN 4
73 * Maximum number of trampling allowed
74 * Customer might choose to modify this, however too big a value is not suggestible
76 #define CMM_TRAMPLING_THRESHOLD 3
79 * Hash list size to mantain the statistics of size requested & the number of attempts for allocation
80 * Customer might choose to modify this to accomodate statistics for more sizes
81 * preferably choose a prime number for better performance
83 #define CMM_STAT_HASH_TBL_LEN 211 /* prime number */
85 /* values for memFlags in CmMmBlkHdr */
86 #define CMM_FREE_FLAG 0x01
87 #define CMM_DYNAMIC_MEM_FLAG 0x04
88 #define CMM_STATIC_MEM_FLAG 0x08
91 * MACROs for setting/resetting above flags
92 * FREE state related flags
94 #define CMM_SET_FREE_FLAG(x) ((x) |= CMM_FREE_FLAG)
95 #define CMM_RESET_FREE_FLAG(x) ((x) &= (~(CMM_FREE_FLAG)))
96 #define CMM_IS_FREE(x) ((x) & CMM_FREE_FLAG)
98 /* DYNAMIC state related flags */
99 #define CMM_SET_DYNAMIC_FLAG(x) ((x) |= CMM_DYNAMIC_MEM_FLAG)
100 #define CMM_RESET_DYNAMIC_FLAG(x) ((x) &= (~(CMM_DYNAMIC_MEM_FLAG)))
101 #define CMM_IS_DYNAMIC(x) ((x) & CMM_DYNAMIC_MEM_FLAG)
103 /* STATIC state related flags */
104 #define CMM_SET_STATIC_FLAG(x) ((x) |= CMM_STATIC_MEM_FLAG)
105 #define CMM_RESET_STATIC_FLAG(x) ((x) &= (~(CMM_STATIC_MEM_FLAG)))
106 #define CMM_IS_STATIC(x) ((x) & CMM_STATIC_MEM_FLAG)
107 #endif /* SSI_DEBUG_LEVEL1 */
109 /* Valid Physical Bit */
110 #define CMM_REG_PHY_VALID 0x01
111 #define CMM_REG_OUTBOARD 0x02
112 /* cm_mem_h_001.main_7 : Additions */
113 #if (defined(SS_MEM_LEAK_STS) || defined(BRDCM_SSI_MEM_LEAK_DEBUG_LEVEL1))
114 #ifndef CM_MEM_USR_MDL
115 #define CM_MEM_USR_MDL 10
116 #ifndef CM_MAX_STACK_TRACE
117 #define CM_MAX_STACK_TRACE 20
118 #endif /* if CM_MAX_STACK_TRACE is not defined in Makefile */
120 #define MEMRAW2STR(x,y) {#x, #y}
121 #define CM_MAX_HASH_PER_TSK 4
122 #ifdef BRDCM_SSI_MEM_LEAK_DEBUG_LEVEL2
123 #define BRDCM_MEM_LEAK_BTRACE 6 /* Back trace */
125 #endif /* SS_MEM_LEAK_STS */
127 #ifdef SS_HISTOGRAM_SUPPORT
128 #define CMM_HIST_MAX_FILENAME 100
129 #define CMM_HIST_MAX_MEM_ENTRY_PER_BIN 25
130 #define CMM_HIST_MAX_MEM_BIN 25
131 #endif /* SS_HISTOGRAM_SUPPORT */
133 #ifdef SS_LOCKLESS_MEMORY
134 #define CMM_MAX_NUMBER_BKT_NODE 2
137 #ifdef SS_LIGHT_MEM_LEAK_STS
138 #define CM_MAX_ALLOC_ENTERIES 100000
140 /* cm_mem_h_001.103 */
145 #endif /* __CMMEMH_ */
147 /**********************************************************************
149 **********************************************************************/