Initial commit
[o-du/l2.git] / src / cm / cm_lte.x
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 *******************************************************************************/
18
19 /********************************************************************20**
20   
21         Name:    Common LTE
22     
23         Type:    C include file
24   
25         Desc:    This file Contains the Data structures for Common LTE
26  
27         File:    cm_lte.x
28
29         Sid:      cm_lte.x@@/main/2 - Fri Nov 13 14:09:17 2009
30   
31         Prg:     chakrapani
32   
33 *********************************************************************21*/
34
35 #ifndef __CM_LTE_X__
36 #define __CM_LTE_X__
37
38 #include <cm_lte.h>
39 /* Packing Defines */
40 #define cmPkLteRbId              SPkU8
41 #define cmPkLteRnti              SPkU16
42 #define cmPkLteCellId            SPkU16
43 #define cmPkLteRlcMode           SPkU8
44 #define cmPkLteLcId              SPkU8
45 #define cmPkLteLcType            SPkU8
46 #define cmPkLteAggrLvl           SPkU32
47
48 /* Unpacking Defines */
49 #define cmUnpkLteRbId            SUnpkU8
50 #define cmUnpkLteRnti            SUnpkU16
51 #define cmUnpkLteCellId          SUnpkU16
52 #define cmUnpkLteRlcMode         SUnpkU8
53 #define cmUnpkLteLcId            SUnpkU8
54 #define cmUnpkLteLcType          SUnpkU8
55 #define cmUnpkLteAggrLvl         SUnpkU32
56
57 #define MAX_POOL_SIZE        6      /*!< Maximum pool size */
58 #define MAX_REGION_SIZE      5      /*!< Maximum Region size */
59 #ifdef PACK_STRUCT
60 #define CM_PACK_STRUCT __attribute__((packed))
61 #else
62 #define CM_PACK_STRUCT
63 #endif
64
65
66
67
68 #ifdef __cplusplus
69 EXTERN "C" {
70 #endif  /*__cplusplus*/
71
72 /** @file cm_lte.x
73     @brief CM_LTE Interface File (cm_lte.x)
74 */
75  
76 /* definitions for Common LTE */
77
78 /** @brief Radio Bearer ID */
79 typedef U8    CmLteRbId;
80
81 /** @brief Cell ID */
82 typedef U16   CmLteCellId;
83
84 /** @brief RNTI */
85 typedef U16   CmLteRnti;
86
87 /** @brief Mode Type TM/UM/AM */
88 typedef U8    CmLteRlcMode;
89
90 /** @brief Logical Channel ID */
91 typedef U8    CmLteLcId;         
92
93 /** @brief Logical Channel Type */
94 typedef U8    CmLteLcType;         
95
96 /** @brief Transport Channel Type */
97 typedef U8    CmLteTrchType;         
98
99 /** @brief Contention Resolution ID */
100 typedef U8 CmLteContResId[6];
101
102 /** @brief RLC ID */
103 typedef struct cmLteRlcId
104 {
105   CmLteRbId     rbId;   /*!< Radio Bearer ID */
106   U8            rbType; /*!< RB Type */
107   CmLteRnti     ueId;   /*!< UE ID */
108   CmLteCellId   cellId; /*!< Cell ID */
109 }CmLteRlcId;
110
111 /** @brief LTE Timing Info */
112 typedef struct cmLteTimingInfo
113 {
114    U16 hSfn;                 /*!< Hyper System Frame Number */
115    U16 sfn;                  /*!< System Frame Number */
116    U8  subframe;             /*!< Subframe number */
117 } CmLteTimingInfo;
118
119 /** @brief PDCP ID */
120 typedef struct cmLtePdcpId
121 {
122    CmLteCellId   cellId;      /*!< Cell ID */
123    CmLteRnti     ueId;        /*!< UE ID */
124    CmLteRbId     rbId;        /*!< PDCP Instance ID */
125    U8            rbType;      /*!< RB type */
126 } CmLtePdcpId;
127
128 /* Defining structures for Memory Information for L2-MEAS */
129 typedef struct cmLtePoolInfo
130 {
131    U32   poolSize;
132    U32   totAvailable;
133    U32   crntUsed;
134    U32   maxUsed;
135 } CmLtePoolInfo;
136
137 typedef struct cmLteRegionInfo
138 {
139    U8   regionType; /* 0-SSI 1-Shared */
140    U8   regionId;
141    U8   numPools;
142    U8   isGenMemInfoUpdated;
143    CmLtePoolInfo poolInfo[MAX_POOL_SIZE];
144 }CmLteRegionInfo;
145
146 typedef struct cmLteMemInfo
147 {
148    U8           numRegions;
149    U8           idx;
150    CmLteRegionInfo   regInfo[MAX_REGION_SIZE];
151 }CmLteMemInfo;
152
153 /** @brief CPU Utilization INFO */
154 typedef struct cmLteCpuUtilInfo
155 {
156    U32      avgCpuUtil; /*!< average cpu utilization */
157    U32      maxCpuUtil; /*!< Max cpu utilization */
158 }CmLteCpuUtilInfo;
159
160 /** @brief CPU INFO */
161 typedef struct cmLteCpuInfo
162 {
163    U8       numCores;        /*!< number of cores*/
164    CmLteCpuUtilInfo cpuUtil[CM_MAX_CPU_CORES]; /*!< cpu measurement info*/
165 }CmLteCpuInfo;
166 /** @brief CPU Utilization INFO */
167 typedef struct cmCpuUtilStatsInfo
168 {
169    U32      numSamples;
170    U32      maxCpuUtil; /*!< Max cpu utilization */
171    U32      totCpuUtil; /*!< Total cpu utilization */
172 }CmCpuUtilStatsInfo;
173
174 /** @brief CPU INFO */
175 typedef struct cmCpuStatsInfo
176 {
177    U8       numCores;        /*!< number of cores*/
178    CmCpuUtilStatsInfo cpuUtil[CM_MAX_CPU_CORES]; /*!< cpu measurement info*/
179 }CmCpuStatsInfo;
180
181
182
183
184 /** @brief Counter Statistics */
185 typedef U32  CntrSts;
186
187 /** @brief Aggregation Level */
188 typedef enum cmLteAggrLvl
189 {
190    CM_LTE_AGGR_LVL2 = 2,  /*!< Aggregation level 2 */
191    CM_LTE_AGGR_LVL4 = 4,  /*!< Aggregation level 4 */
192    CM_LTE_AGGR_LVL8 = 8,  /*!< Aggregation level 8 */
193    CM_LTE_AGGR_LVL16= 16   /*!< Aggregation level 16 */
194 } CmLteAggrLvl;
195
196 /** @brief UE Category */
197 typedef enum cmLteUeCategory
198 {
199    CM_LTE_UE_CAT_1 = 1,
200    CM_LTE_UE_CAT_2,
201    CM_LTE_UE_CAT_3,
202    CM_LTE_UE_CAT_4,
203    CM_LTE_UE_CAT_5,
204    CM_LTE_UE_CAT_6,
205    CM_LTE_UE_CAT_7, /* RRC-REL10-Upgrade */
206    CM_LTE_UE_CAT_8
207 } CmLteUeCategory;
208
209 /****************************************************************************
210  *                         PACK/UNPACK Functions
211  ***************************************************************************/
212
213 EXTERN PUBLIC S16 cmUpdateSsiMemInfo(CmLteMemInfo *mInfo);
214
215 EXTERN PUBLIC S16 cmFillMemUtilizationMeas(CmLteMemInfo *memoryInfo,CmLteMemInfo *memInfo);
216
217 EXTERN PUBLIC S16 cmClearMemUtilizationCounter(CmLteMemInfo *memInfo);
218 EXTERN PUBLIC S16 UpdateSocMemInfo(U8 area , CmLteMemInfo *mInfo);
219
220 EXTERN S16 cmFillCpuUtilizationMeas(CmLteCpuInfo *cpuMeasInfo,CmCpuStatsInfo *cpuInfo);
221
222 EXTERN S16 cmClearCpuUtilizationCounter(CmCpuStatsInfo *cpuInfo);
223 EXTERN PUBLIC Void UpdateSocCpuInfo(CmCpuStatsInfo *cpuInfo,U8 Idx);
224
225 EXTERN PUBLIC S16 SGetRegPoolInfo(U8* numRegion, U8* numPool);
226
227 /* Packing Functions */
228 EXTERN S16 cmPkLteRlcId ARGS ((
229 CmLteRlcId *param,
230 Buffer *mBuf
231 ));
232
233 EXTERN S16 cmPkLteTimingInfo ARGS ((
234 CmLteTimingInfo *param,
235 Buffer *mBuf
236 ));
237
238 EXTERN S16 cmPkLtePdcpId ARGS ((
239 CmLtePdcpId *param,
240 Buffer *mBuf
241 ));
242
243 /* Unpack Function */
244 EXTERN S16 cmUnpkLteRlcId ARGS ((
245 CmLteRlcId *param,
246 Buffer *mBuf
247 ));
248
249 EXTERN S16 cmUnpkLteTimingInfo ARGS ((
250 CmLteTimingInfo *param,
251 Buffer *mBuf
252 ));
253
254 EXTERN S16 cmUnpkLtePdcpId ARGS ((
255 CmLtePdcpId *param,
256 Buffer *mBuf
257 ));
258
259 #ifdef TENB_TTI_PERF
260
261 typedef struct cmTtiProc 
262 {
263         U32 totTtiProcessingTime;
264         U32 numOfTti;
265         U32 maxTtiProcessingTime;
266         U32 ttiStretchCount;
267         U32 ttiThresholdExceedCount;
268         /* this count is added to compare phy reported tti stretch and calculated tti stretch */
269         U32 phyReptTtiStretchCount;
270 }CmTtiProc;
271
272 EXTERN CmTtiProc ttiProc;
273
274 EXTERN Void cmUpdateTtiCounters(U32 ttiProcessingTime);
275 EXTERN Void cmResetTtiCounters(Void); 
276 #endif
277
278 #ifdef __cplusplus
279 }
280 #endif /* __cplusplus */
281 #endif /* __CM_LTE_X__ */
282
283 /********************************************************************30**
284   
285          End of file
286 **********************************************************************/