Deleted the rlog folder
[o-du/l2.git] / src / 5gnrrlc / kw_ul_ex_ms.c
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:    NR RLC Layer - System Services Interface Functions
22     
23         Type:    C file
24   
25         Desc:    C source code for the interface to System Services
26                   of NR RLC
27  
28         File:    kw_ul_ex_ms.c
29   
30 *********************************************************************21*/
31
32 /** @file kw_ul_ex_ms.c
33 @brief RLC System Services Interface
34 */
35
36 \f
37 /* header (.h) include files */
38 #include "common_def.h"
39 #include "lkw.h"           /* LKW defines */
40 #include "ckw.h"           /* CKW defines */
41 #include "kwu.h"           /* KWU defines */
42 #include "rgu.h"           /* RGU defines */
43 #include "kw_err.h"        /* Err defines */
44 #include "kw_env.h"        /* RLC environment options */
45 #include "kw.h"            /* RLC defines */
46 #include "kw_ul.h"
47 #include "kw_udx.h"
48
49 /* extern (.x) include files */
50 #include "lkw.x"           /* LKW */
51 #include "ckw.x"           /* CKW */
52 #include "kwu.x"           /* KWU */
53 #include "rgu.x"           /* RGU */
54 #include "kw.x"
55 #include "kw_ul.x"
56 #include "kw_udx.x"
57
58 #include "rlc_mac_inf.h"
59 #include "du_app_rlc_inf.h"
60
61 #ifdef TENB_STATS 
62 #include "l2_tenb_stats.x"   
63 #endif
64
65 S16 rlcUlInitExt ARGS (( Void ));
66 \f
67 /**
68  *
69  * @brief
70  *
71  *  <b> Initialize External </b>
72  *
73  *  @b Description:
74  *  Initializes variables used to interface with Upper/Lower Layer  
75  *
76  *  @return  S16
77  *      -# ROK 
78  *
79 */
80   
81 S16 rlcUlInitExt()
82 {
83
84    return ROK;
85 } /* kwInitExt */
86
87
88 \f
89 /***********************************************************************
90                       System Service Interface Functions
91  ***********************************************************************/
92 /**
93  *
94  * @brief
95  *
96  *    <b> Activates Initialization </b>
97  *
98  *    @b Description:
99  *    This function is invoked by system services to initialize the NR RLC
100  *    layer. This is an entry point used by LTE_RLC layer to initialize its
101  *    global variables, before becoming operational.
102  *
103  *    Allowable values for parameters are specified in ssi.h.
104  *
105  *    @param[in] ent    - Specify the entity id of the NR RLC task.
106  *    @param[in] inst   - Specify the entity id of the NR RLC task.
107  *    @param[in] region - Specifies the memory region from which
108  *                         NR RLC should allocate structures and buffers.
109  *    @param[in] reason - Specifies the reason for calling this
110  *                         initialization function.
111  *
112  *  @return  S16
113  *      -# ROK 
114  *
115  */
116 S16 rlcUlActvInit
117 (
118 Ent    ent,                 /* entity */
119 Inst   inst,                /* instance */
120 Region region,              /* region */
121 Reason reason               /* reason */
122 )
123 {
124    RlcCb    *tRlcCb;
125
126    if (inst >= MAX_RLC_INSTANCES)
127    {
128        /* intance greater than MAX instances */ 
129        return RFAILED; 
130    }
131
132    if (rlcCb[inst] != NULLP)
133    {
134        return  (RFAILED);
135    }
136   
137    if (SGetSBuf(region, 0, (Data **)&tRlcCb,
138                 (Size)sizeof (RlcCb)) != ROK)    
139    {                     
140       return RFAILED;
141    }
142
143    /* Initialize rlcCb */
144    RLC_MEM_SET(tRlcCb, 0, sizeof(RlcCb));
145
146    /* Initialize task configuration parameters */
147    tRlcCb->init.ent     = ent;           /* entity */
148    tRlcCb->init.inst    = inst;          /* instance */
149    tRlcCb->init.region  = region;        /* static region */
150    tRlcCb->init.pool    = 0;             /* static pool */
151    tRlcCb->init.reason  = reason;        /* reason */
152    tRlcCb->init.cfgDone = FALSE;         /* configuration done */
153    tRlcCb->init.acnt    = TRUE;          /* enable accounting */
154    tRlcCb->init.usta    = TRUE;          /* enable unsolicited status */
155    tRlcCb->init.trc     = FALSE;         /* enable trace */
156    tRlcCb->init.procId  = ODU_GET_PROCID();
157
158    rlcCb[inst] = tRlcCb;
159
160    /* call external function for intialization */
161    /*
162    kwInitExt();
163    */
164 #ifdef TENB_STATS 
165    TSL2AllocStatsMem(tRlcCb->init.region, tRlcCb->init.pool); 
166 #endif
167
168    return ROK;
169 } /* rlcUlActvInit */
170
171 \f
172 /**
173  *
174  * @brief
175  *
176  *  <b> Activation Task </b>
177  *
178  *  @b Description:
179  *  Processes events received for NR RLC layer via System Services from
180  *  other layers.
181  *
182  *  @param[in] pst   - Pst Structure
183  *  @param[in] mBuf  - Message Buffer
184  *
185  *  @return  S16
186  *      -# ROK 
187  *
188  */
189 S16 rlcUlActvTsk
190 (
191 Pst *pst,              /* pst structure */
192 Buffer *mBuf            /* message buffer */
193 )
194 {
195    S16 ret = ROK;
196
197
198    switch(pst->srcEnt)
199    {
200       case ENTDUAPP:
201          {
202             switch(pst->event)
203             {
204 #ifdef LCLKW
205                case LKW_EVT_CFG_REQ:
206                   {
207                      ret = unpackRlcConfigReq(RlcMiRlcConfigReq, pst, mBuf);
208                      break;
209                   }
210
211                case LKW_EVT_CNTRL_REQ:
212                   {
213                      ret = cmUnpkLkwCntrlReq(RlcMiLkwCntrlReq, pst, mBuf);
214                      break;
215                   }
216                
217                case EVENT_RLC_UE_CREATE_REQ:        /* UE Create Request */
218                   {
219                      ret = unpackRlcUeCreateReq(RlcProcUeCreateReq, pst, mBuf);
220                      break;
221                   }
222               case EVENT_RLC_UE_RECONFIG_REQ:      /* UE Reconfig Request */
223                   {
224                      ret = unpackRlcUeReconfigReq(RlcProcUeReconfigReq, pst, mBuf);
225                      break;
226                   }
227
228                case LKW_EVT_STS_REQ:
229                   {
230                      ret = cmUnpkLkwStsReq(RlcMiLkwStsReq, pst, mBuf);
231                      break;
232                   }
233
234                case LKW_EVT_STA_REQ:
235                   {
236                      ret = cmUnpkLkwStaReq(RlcMiLkwStaReq, pst, mBuf);
237                      break;
238                   }
239                   /* kw005.201 added support for L2 Measurement */
240 #ifdef LTE_L2_MEAS
241                case LKW_EVT_L2MEAS_REQ:
242                   {
243                      ret = cmUnpkLkwL2MeasReq(RlcMiLkwL2MeasReq, pst, mBuf);
244                      break;
245                   }
246                case LKW_EVT_L2MEAS_SEND_REQ:
247                  {
248
249                     ret = cmUnpkLkwL2MeasSendReq(RlcMiLkwL2MeasSendReq, pst, mBuf); 
250   
251                      break;
252                  }
253                case LKW_EVT_L2MEAS_STOP_REQ:
254                  {
255                      ret = cmUnpkLkwL2MeasStopReq(RlcMiLkwL2MeasStopReq, pst, mBuf);
256                      break;
257                  }
258 #endif
259 #endif  /* LCLKW */
260                default:
261                   ODU_PUT_MSG_BUF(mBuf);
262                   if (pst->dstInst < MAX_RLC_INSTANCES)
263                   {
264                      DU_LOG("\nERROR  -->  RLC_UL : Received Invalid Event[%d] from SM",
265                             pst->event);
266                   }
267                   ret = RFAILED;
268                   break;
269
270             }
271             break;
272          }
273
274       case ENTRLC:
275          {
276             switch(pst->event)
277             {
278 #ifdef LCUDX
279                case UDX_EVT_BND_CFM:              /* Bind request */
280                   {
281                      ret = cmUnpkUdxBndCfm(rlcUlUdxBndCfm, pst, mBuf );
282                      break;
283                   }
284
285                case UDX_EVT_CFG_CFM:             /* Unbind request */
286                   {
287                      ret = cmUnpkUdxCfgCfm(rlcUlUdxCfgCfm, pst, mBuf );
288                      break;
289                   }
290
291                case UDX_EVT_UEIDCHG_CFM:              /* Configuration request */
292                   {
293                      ret = cmUnpkUdxUeIdChgCfm(rlcUlUdxUeIdChgCfm, pst, mBuf);
294                      break;
295                   }
296                
297                case UDX_EVT_STA_PHBT_TMR_START:              /* Status Prohibit Timer Start */
298                   {
299                      ret = cmUnpkUdxStaProhTmrStart(rlcUlUdxStaProhTmrStart, pst, mBuf);
300                      break;
301                   }               
302
303 #endif  /* LCCKW */
304
305                default:
306                   ODU_PUT_MSG_BUF(mBuf);
307                   if (pst->dstInst < MAX_RLC_INSTANCES)
308                   {
309                       DU_LOG("\nERROR  -->  RLC_UL : Received Invalid Event[%d] from RLC UL",
310                             pst->event);
311                   }
312                   ret = RFAILED;
313                   break;
314
315             }
316             break;
317          }
318
319       case ENTNH:
320          {
321             switch(pst->event)
322             {
323 #ifdef LCCKW
324                case CKW_EVT_BND_REQ:              /* Bind request */
325                   {
326                      ret = cmUnpkCkwBndReq(RlcUiCkwBndReq, pst, mBuf );
327                      break;
328                   }
329
330                case CKW_EVT_UBND_REQ:             /* Unbind request */
331                   {
332                      ret = cmUnpkCkwUbndReq(RlcUiCkwUbndReq, pst, mBuf );
333                      break;
334                   }
335
336                case CKW_EVT_UEIDCHG_REQ:              /* Configuration request */
337                   {
338                      ret = cmUnpkCkwUeIdChgReq(RlcUiCkwUeIdChgReq, pst, mBuf);
339                      break;
340                   }
341
342 #endif  /* LCCKW */
343
344 #ifdef LCKWU
345                case KWU_EVT_BND_REQ:              /* Bind request */
346                   {
347                      ret = cmUnpkKwuBndReq(RlcUiKwuBndReq, pst, mBuf );
348                      break;
349                   }
350
351                case KWU_EVT_UBND_REQ:             /* Unbind request */
352                   {
353                      ret = cmUnpkKwuUbndReq(RlcUiKwuUbndReq, pst, mBuf );
354                      break;
355                   }
356 #endif  /* LCKWU */
357                default:
358                   ODU_PUT_MSG_BUF(mBuf);
359                   if (pst->dstInst < MAX_RLC_INSTANCES)
360                   {
361                       DU_LOG("\nERROR  -->  RLC_UL : Received Invalid Event[%d] from RRC", 
362                             pst->event);
363                   }
364                   ret = RFAILED;
365                   break;
366
367             }
368             break;
369          }
370
371       case ENTPJ:
372          {
373             switch(pst->event)
374             {
375 #ifdef LCKWU
376                case KWU_EVT_BND_REQ:              /* Bind request */
377                   {
378                      ret = cmUnpkKwuBndReq(RlcUiKwuBndReq, pst, mBuf );
379                      break;
380                   }
381
382                case KWU_EVT_UBND_REQ:             /* Unbind request */
383                   {
384                      ret = cmUnpkKwuUbndReq(RlcUiKwuUbndReq, pst, mBuf );
385                      break;
386                   }
387
388                default:
389                   ODU_PUT_MSG_BUF(mBuf);
390                   if (pst->dstInst < MAX_RLC_INSTANCES)
391                   {
392                       DU_LOG("\nERROR  -->  RLC_UL : Received Invalid Event[%d] from PDCP", 
393                             pst->event);
394                   }
395                   ret = RFAILED;
396                   break;
397 #endif  /* LCKWU */
398                }
399             break;
400          }
401
402       case ENTMAC:
403          {
404             switch(pst->event)
405             {
406 #ifdef LCRGU
407                case EVTRGUBNDCFM:     /* Bind request */
408                   {
409                      ret = cmUnpkRguBndCfm(RlcLiRguBndCfm, pst, mBuf );
410                      break;
411                   }
412
413                case EVENT_UL_DATA_TO_RLC:    /* UL Data request */
414                   {
415                      ret = unpackRlcUlData(RlcProcUlData, pst, mBuf);
416                      break;
417                   }
418
419 #endif  /* LCRGU */
420
421                default:
422                   ODU_PUT_MSG_BUF(mBuf);
423                   if (pst->dstInst < MAX_RLC_INSTANCES)
424                   {
425                       DU_LOG("\nERROR  -->  RLC_UL : Received Invalid Event[%d] from MAC",
426                             pst->event);
427                   }
428                   ret = RFAILED;
429                   break;
430             }
431             break;
432          }
433 #if defined(L2_L3_SPLIT) && defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined (MAC_RLC_UL_RBUF)
434       case ENTYS:
435          {
436             switch(pst->event)
437             {
438                case KWU_EVT_TTI_IND:
439                   {
440                      rlcUlBatchProc();
441                      ODU_PUT_MSG_BUF(mBuf);
442                      break;
443                   }
444             }
445             break;
446          }
447 #endif/* End for TENB_T2K3K_SPECIFIC_CHANGES and L2_L3_SPLIT */
448 #ifndef UL_RLC_NET_CLUSTER
449 #ifdef TENB_STATS
450       case ENTLWRMAC:
451          {
452             switch(pst->event)
453             {
454                case TENBSTATSINIT:
455                {
456                   
457                   RlcCb *tRlcCb;
458                   tRlcCb = RLC_GET_RLCCB(pst->dstInst);
459
460                   TSL2SendStatsToApp(&(tRlcCb->genCfg.lmPst), 0);
461                   ODU_PUT_MSG_BUF(mBuf);
462                   break;
463                }
464                default:
465                {
466                   DU_LOG("\nERROR  -->  RLC_UL : Invalid Event[%d] from CL to PDCPUL\n", 
467                          pst->event);
468                   ODU_PUT_MSG_BUF(mBuf);
469                   break;
470                }
471             }
472             break;
473          }
474 #endif
475 #endif
476       default:
477          {
478           if (pst->dstInst < MAX_RLC_INSTANCES)
479            {
480               DU_LOG("\nERROR  -->  RLC_UL : Received Invalid Source Entity[%d]",pst->event);
481            }
482             ODU_PUT_MSG_BUF(mBuf);
483             ret = RFAILED;
484             break;
485          }
486     }
487    ODU_EXIT_TASK();
488
489    return (ret);
490 } /* kwActvTsk */
491
492
493 \f  
494 /********************************************************************30**
495          End of file
496 **********************************************************************/