[Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-523] Statistics Request API and Timer Based...
[o-du/l2.git] / src / 5gnrmac / rg_env.h
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  
21     Name:   LTE MAC layer
22  
23     Type:   H include file
24  
25     Desc:   Defines required by LTE MAC
26  
27     File:   rg_env.h
28  
29 **********************************************************************/
30  
31 #ifndef __RGENVH__
32 #define __RGENVH__
33
34 /* Number of Unserved UE's Facotr for BI value calculation */
35 /* R8 Upgrade */
36 #define RG_SCH_CMN_BI_NUMUE_FACTOR    1
37 #define RGSCH_MAX_RNTI_PER_RARNTI    10
38 /* The number of schedulers supported currently */ 
39 #ifdef RG_PHASE2_SCHED
40 #define RGSCH_NUM_SCHEDULERS    4
41 #ifdef EMTC_ENABLE
42 #define RGSCH_NUM_EMTC_SCHEDULERS    1
43 #endif
44 #define RGSCH_NUM_DLFS_SCHEDULERS    1
45 #else
46 #define RGSCH_NUM_SCHEDULERS    1
47 #ifdef EMTC_ENABLE
48 #define RGSCH_NUM_EMTC_SCHEDULERS    0
49 #endif
50 #define RGSCH_NUM_DLFS_SCHEDULERS    0
51 #endif
52 /* Added support for SPS*/
53
54 #ifdef LTEMAC_SPS
55 #define RG_SCH_NUM_SPS_OCC_AFTR_EXP_REL 6 /* Number of empty SPS Occasions
56                                              after sending explicit release after
57                                              which SPS resources of the UE shall 
58                                              be deallocated */
59 #define RGSCH_SPS_CQI_SCALE_FACTOR 1
60 #endif
61
62
63 /* List of scheduler init functions to initialise rgSchSchdInits[] array with */
64 #ifdef RG_PHASE2_SCHED
65 #define RGSCH_ULSCHED_INITS  {rgSCHSc1UlInit, rgSCHPfsUlInit, rgSCHRrUlInit, rgSCHMaxciUlInit}
66 #define RGSCH_DLSCHED_INITS  {rgSCHSc1DlInit, rgSCHPfsDlInit, rgSCHRrDlInit, rgSCHMaxciDlInit}
67 #ifdef EMTC_ENABLE
68 #define RGSCH_EMTC_ULSCHED_INITS  {rgSCHEmtcRrUlInit}
69 #define RGSCH_EMTC_DLSCHED_INITS  {rgSCHEmtcRrDlInit}
70 #endif
71 #ifdef TFU_UPGRADE
72 #define RGSCH_DLFSSCHED_INITS {rgSCHDlfsInit}
73 #endif
74 #else
75 #define RGSCH_ULSCHED_INITS  {rgSCHSc1UlInit}
76 #define RGSCH_DLSCHED_INITS  {rgSCHSc1DlInit}
77 #define RGSCH_DLFSSCHED_INITS {}
78 #ifdef EMTC_ENABLE
79 #define RGSCH_EMTC_ULSCHED_INITS  {}
80 #define RGSCH_EMTC_DLSCHED_INITS  {}
81 #endif
82 #endif
83
84
85
86 /* Common Scheduler Tunable Parameters */
87 #define RG_SCH_CMN_UE_IDLETIME_FCTR        3
88 #define RG_SCH_CMN_MAX_BITS_RATIO          16
89 #define RG_SCH_CMN_UL_COM_DENOM            16 
90 #define RG_SCH_CMN_UL_NUM_CQI              16
91 #define RG_SCH_CMN_MAX_UE_PER_UL_SF        1 /* If more than 1 is required it can be controlled from configuration*/
92 /* Fix: MUE_PERTTI_DL*/
93 #define RG_SCH_CMN_MAX_UE_PER_DL_SF       4
94 /* mapping RG_MAX_NUM_UE_PER_TTI to RGU Interface define to use it in MAC code */
95 #ifdef XEON_SPECIFIC_CHANGES
96 #define RG_MAX_NUM_UE_PER_TTI             16
97 #else
98 #define RG_MAX_NUM_UE_PER_TTI             8
99 #endif
100 /* Added configuration for maximum number of MSG3s */
101 #define RG_SCH_CMN_MAX_MSG3_PER_UL_SF      1 /* If more than 1 is required it can be controlled from configuration*/
102 #define RG_SCH_CMN_MAX_UL_BW_PER_UE        100
103 #define RG_SCH_CMN_MAX_DL_RETX_BW          100 
104 #define RG_SCH_CMN_MAX_DL_BW_PERUE         100 
105 #define RG_SCH_CMN_DEF_BCCHPCCH_CODERATE   512
106 #define RG_SCH_CMN_MAX_DL_AMBR             0xFFFFFFFF 
107 #define RG_SCH_CMN_MAX_UL_UEBR             0xFFFFFFFF 
108 #define RG_SCH_CMN_DED_MAX_HDRSIZE         3
109 #define RG_SCH_CMN_MAX_DED_SDU             5
110
111 #ifdef MAC_SCH_STATS
112 #define RG_SCH_CMN_CMNDL_DELTA             1
113 #endif /* MAC_SCH_STATS */
114
115 /* ccpu00126002 introduced buffer to track cqi allocation and RI allocation
116    for a particular UE. As the allocation is stored in UeCb, if the 
117    occasion between cqi and ri are short cqi is overwritten. To avoid that
118    this buffer is introduced.*/
119 #define MAX_CQI_RI_RPT_BUFF           (TFU_DELTA * 2)
120
121 /* GBR priorities occupy a set of contiguous priorities      */
122 /* starting always at 1.                                     */
123 /* RG_SCH_CMN_MAX_PRIO is the total number of priority queues    */
124 /* defined in the scheduler. This variable can have affect   */
125 /* on the performance of the scheduler and should be chosen  */
126 /* based on the same.                                        */
127 #define RG_SCH_CMN_MAX_PRIO              8
128
129 #ifdef RG_SC1
130 /* UL Scheduler1 tunable params */
131 #define RG_SC1_BSR_BS         4
132 #define RG_SC1_SR_BS          RG_SC1_BSR_BS
133 #define RG_SC1_UL_RATIO       14  /* UL_RATIO/COM_DENOM of bs for LCGs other than */
134                                 /* highest priority LCG used */
135
136 /* Priority 0 is used as a FIFO service where the priority   */
137 /* of UEs within the priority Q is based purely on time at   */
138 /* which the service is reported to the scheduler. This      */
139 /* priority queue is suitable for DCCH services.             */
140
141
142 /* This is the maximum known QCIs to the scheduler.          */
143 /* RG_SC1_QCI_TO_PRIO maps QCIs to respective priorities and */
144 /* there by behavior of the service                          */
145
146 /* This table is used to translate a CQI to an applicable */
147 /* aggregation level to be used for a UE when allocating  */
148 /* a PDCCH.                                               */
149 /* This table is used to translate a CQI to an applicable  */
150 /* coding rate for dedicated PDSCH allocation. The number  */
151 /* in the table represents the number of bits to allocated */
152 /* per 1024 REs.                                           */
153
154 #endif
155 //uint32_t wrSmDfltNumCells;
156 #define RGSCH_MAX_UE_PER_DL_SF 32
157 #define RGSCH_MAX_RARNTI_PER_DL_SF 4
158 #define RGSCH_MAX_INST 2
159 /*MCELL changes*/
160 #define RG_MAX_INST 4
161 #define RG_INST_START 0
162 /* Twice of difference in power levels between successive uplink
163  * CQIs (in dB) */
164 #define RG_SCH_UL_CQI_DB_STEP_2   2
165
166 #define RG_SCH_CMN_MAX_NUM_TPC_PUCCH_RNTI 100
167 #define RG_SCH_CMN_MAX_NUM_TPC_PUSCH_RNTI 100
168
169 /* [ccpu00138532]-DEL-Removed the Guard timer macro. Moved
170    it into CellCb and value is configured based the maxMsg4Tx */
171
172 /* moving rgSchCmnUlCqiTbl values here to enable customer to 
173  * fine tune these values 
174  */
175 /* Adding modulation order & efficiency hash defines for
176  * UL. This can be tuned by customer. These values are used
177  * in rgSchCmnUlCqiTbl in rg_sch_cmn.c
178  */
179
180 /* for CQI 1 */
181 #define RGSCH_CMN_QM_CQI_1      RGSCH_QM_BPSK
182 #define RGSCH_CMN_UL_EFF_CQI_1      156
183
184 /* for CQI 2 */
185 #define RGSCH_CMN_QM_CQI_2      RGSCH_QM_BPSK
186 #define RGSCH_CMN_UL_EFF_CQI_2      240 
187
188 /* for CQI 3 */
189 #define RGSCH_CMN_QM_CQI_3      RGSCH_QM_BPSK
190 #define RGSCH_CMN_UL_EFF_CQI_3      386 
191
192 /* for CQI 4 */
193 #define RGSCH_CMN_QM_CQI_4      RGSCH_QM_BPSK
194 #define RGSCH_CMN_UL_EFF_CQI_4      616
195
196 /* for CQI 5 */
197 #define RGSCH_CMN_QM_CQI_5      RGSCH_QM_BPSK
198 #define RGSCH_CMN_UL_EFF_CQI_5      898
199
200 /* for CQI 6 */
201 #define RGSCH_CMN_QM_CQI_6      RGSCH_QM_BPSK
202 #define RGSCH_CMN_UL_EFF_CQI_6      1204 
203
204 /* for CQI 7 */
205 #define RGSCH_CMN_QM_CQI_7      RGSCH_QM_QPSK
206 #define RGSCH_CMN_UL_EFF_CQI_7      1512 
207
208 /* for CQI 8 */
209 #define RGSCH_CMN_QM_CQI_8      RGSCH_QM_QPSK
210 #define RGSCH_CMN_UL_EFF_CQI_8      1960 
211
212 /* for CQI 9 */
213 #define RGSCH_CMN_QM_CQI_9      RGSCH_QM_QPSK
214 #define RGSCH_CMN_UL_EFF_CQI_9      2464 
215
216 /* for CQI 10 */
217 #define RGSCH_CMN_QM_CQI_10      RGSCH_QM_64QAM
218 #define RGSCH_CMN_UL_EFF_CQI_10      3402
219
220 /* for CQI 11 */
221 #define RGSCH_CMN_QM_CQI_11      RGSCH_QM_64QAM
222 #define RGSCH_CMN_UL_EFF_CQI_11      3996 
223
224 /* for CQI 12 */
225 #define RGSCH_CMN_QM_CQI_12      RGSCH_QM_64QAM
226 #define RGSCH_CMN_UL_EFF_CQI_12      4102 
227
228 /* for CQI 13 */
229 #define RGSCH_CMN_QM_CQI_13      RGSCH_QM_64QAM
230 #define RGSCH_CMN_UL_EFF_CQI_13      4342
231
232 /* for CQI 14 */
233 #define RGSCH_CMN_QM_CQI_14      RGSCH_QM_64QAM
234 #define RGSCH_CMN_UL_EFF_CQI_14      5238 
235
236 /* for CQI 15 */
237 #define RGSCH_CMN_QM_CQI_15      RGSCH_QM_64QAM
238 #define RGSCH_CMN_UL_EFF_CQI_15      5728 
239
240 /* Freeing up the HARQ proc blocked for
241  * indefinite time in case of Retx */
242 #define RG_SCH_MAX_RETX_ALLOC_FAIL  10 
243
244 /* Window Size within which buffering paging and Broadcast BO is done */
245 #define RGSCH_PCCHBCCH_WIN 5120
246 #define RGSCH_MAX_SUBFRM         10240
247 #define RGSCH_MAX_SUBFRM_5G      51200
248 #define RGSCH_UL_SYM_DMRS_SRS      2
249 #define RGSCH_UL_16QAM_MAX_ITBS    20
250 #ifdef LTE_TDD
251 /* Itbs Adjustment for DwPts scheduling. Only 
252  * Spl Sf cfg 7 is currently supported. The adjustment 
253  * is based on test results */
254 #define RG_SCH_DWPTS_ITBS_ADJ {0,0,0,0,0,0,0,-1,0}
255 #endif
256
257
258 /* The below MACROs are used by the BLER based LA algorithm to 
259  * maintain the iTbs delta based on the HARQ feedback. For the first 
260  * HARQ Ack received, the delta itbs value is incremented by the STEP_UP value.
261  * For the first HARQ Nack received, the delta iTbs value is decreased by
262  * the STEP_DOWN value 
263  */ 
264 #ifdef DL_LA
265 #define DL_LA_STEPDOWN           30 
266 #define DL_LA_STEPUP              3
267 #endif
268
269 #ifdef UL_LA
270 #define UL_LA_STEPDOWN           30 
271 #define UL_LA_STEPUP              3
272 #endif
273
274 #define RGSCH_CFI_TTI_MON_INTRVL        1000 /* In TTI, Max value 10240 */  
275 #define RGSCH_CFI_STEP_UP_TTI_PRCNTG    10  /* Percentage of CCE failures */
276 #define RGSCH_CFI_STEP_DOWN_TTI_PERCNTG 90  /* Percentage of TTI in which CCE usage is less than the
277                                                next lower CFI */
278 #define RGSCH_CFI_CCE_PERCNTG           90  /* Percentage of total CCE used/total CCE available 
279                                                in the next lower CFI */
280
281 /* Following tunable Macros are applied in APerCQI
282  * trigger determination */
283 #define RG_APER_CQI_ACK_WGT       25   /*Weight Associated with each HARQ ACK*/
284 #define RG_APER_CQI_NACK_WGT      125  /*Weight Associated with each HARQ ACK*/
285 #define RG_APER_CQI_THRESHOLD_WGT 1000 /*Threshold against which the accumulated
286                                          aCqiTrigWt is compared to */
287
288 #define RG_SCH_ITBS_STEP_DOWN_PCQI_RI_HQ 1   /* iTbs will be reduced by this value 
289                                               for UL with PCQIi/RI/HQ */
290 #define RG_SCH_ITBS_STEP_DOWN_ACQI       1   /* iTbs will be reduced by this value 
291                                                 for ACQI report*/
292 #define RG_SCH_PCQI_RI_HQ_EFF_TGT        930 /* Target efficeincy for 
293                                                 UL with PCQI/RI/HQ  */
294 #define RG_SCH_ACQI_EFF_TGT              530 /* Target efficeincy for UL with ACQI */ 
295
296
297 /* Following #defines are used in calculating the cqi to TBS mapping 
298  * In 36.213 table 7.1.7.1-1 defines mapping b/w Itbs and mcs and table 
299  * 7.2.3-1 defines mapping b/w CQI to mcs and code rate.
300  * The values of these tables are chosen such that average of tbs value for 
301  * different nprbs with code rate nearest to the code rate defined in table
302  * 7.2.3-1 for particular CQI value.We should also take care of the fact that 
303  * mapping defined in table 7.1.7.1-1 is not overruled.*/
304 /* ADD fix for CFI0*/
305 #define RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI0 \
306     {207, 271, 333, 431, 648, 899, 1161, 1482, 1889, 2103,\
307         2905, 3412, 3956, 4474, 4655, 5397}
308
309 /* The below tables are defined to fix the BLER issue
310    for CFI 2, 3, 4 */
311 #define RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI1 \
312     {226, 226, 226, 364, 471, 708, 983, 1411, 1833, 2299, 2612,\
313         3177, 3731, 4326, 4893, 5090}
314
315 #define RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI2 \
316     {248, 248, 248, 326, 519, 780, 1084, 1399, 1786, 2278, 2714, 3194,\
317         3810, 4442, 5069, 5398}
318
319 #define RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI3 \
320     {276, 276, 276, 276, 446, 708, 1052, 1382, 1734, 2254, 2827,\
321         3212, 3908, 4590, 4953, 5653}
322
323     
324 #ifdef EMTC_ENABLE
325 #define RG_SCH_EMTC_CMN_CQI_TO_PDSCH_EFF_CFI0 \
326     {104, 136, 271, 333, 431, 648, 899, 1161, 1973, 2111, 2240}
327
328 #define RG_SCH_EMTC_CMN_CQI_TO_PDSCH_EFF_CFI1 \
329     {115, 115, 226, 226, 364, 471, 708, 983, 2143, 2293, 2433}
330
331 #define RG_SCH_EMTC_CMN_CQI_TO_PDSCH_EFF_CFI2 \
332     {125, 125, 248, 248, 326, 519, 780, 1084, 2345, 2509, 2663}
333
334 #define RG_SCH_EMTC_CMN_CQI_TO_PDSCH_EFF_CFI3 \
335     {139, 139, 276, 276, 276, 446, 708, 1052, 2590, 2771, 2941}
336     
337 #define RG_SCH_EMTC_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI0 \
338     {95, 114, 226, 309, 366, 412, 539, 662, 859, 1052, 1293}
339
340 #define RG_SCH_EMTC_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI1 \
341     {99, 117, 232, 306, 322, 408, 450, 588, 723, 938, 1150}
342
343 #define RG_SCH_EMTC_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI2 \
344     {84, 104, 207, 233, 307, 343, 408, 422, 495, 586, 648}
345
346 #define RG_SCH_EMTC_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI3 \
347     {89, 100, 200, 221, 287, 323, 386, 433, 497, 522, 676}
348
349 #define RGSCH_MPDCCH_PDSCH_DL_DELTA 2
350
351 #endif       
352      
353 /* Number of information bits per 1024 Phy bits for PDCCH */
354 /* This is a customer tunable */
355 #define RG_SCH_CMN_CQI_TO_PDCCH_EFF \
356        {  400,  100,  150,  200,  250,  280, 340, 365,\
357          380, 400, 500, 600, 700, 800, 900, 1000}
358
359 #define RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI0 \
360     {188, 226, 309, 366, 412, 539, 662, 859, 1052, \
361         1293, 1535, 2585, 2957, 3340, 4775, 5300}
362
363 #define RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI1 \
364     {197, 232, 306, 322, 408, 450, 588, 723, 938,\
365         1150, 1413, 1679, 2826, 3233, 5222, 5796}
366
367 #define RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI2 \
368     {166, 207, 233, 307, 343, 408, 422, 495, 586,\
369         648, 797, 1035, 1268, 1558, 3117, 3567}
370
371 #define RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI3 \
372     {177, 200, 221, 287, 323, 386, 433, 497, 522, 676,\
373         722, 888, 1153, 1413, 1737, 3476}
374
375 #define RG_SCH_LAA_ITBS_THRESHOLD     20   /* Threshold iTBS for considering for scheduling
376                                             on LAA Cell*/
377 #define RG_SCH_DEFAULT_HQP_SHIFT_TIME 8    /* The Timer for the Harq Proc to be shifted to 
378                                             PCell if SCell Transmissionfail */
379
380 #endif /* __RGENVH__ */
381
382 \f
383 /**********************************************************************
384          End of file
385 **********************************************************************/