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 *******************************************************************************/
19 /**********************************************************************
25 Desc: Source code for RLC Transparent mode assembly and
26 reassembly.This file contains following functions
35 **********************************************************************/
36 static const char* RLOG_MODULE_NAME="TMM";
37 static int RLOG_MODULE_ID=2048;
38 static int RLOG_FILE_ID=201;
41 @brief RLC Transparent Mode module
44 /* header (.h) include files */
45 #include "envopt.h" /* environment options */
46 #include "envdep.h" /* environment dependent */
47 #include "envind.h" /* environment independent */
49 #include "gen.h" /* general */
50 #include "ssi.h" /* system services */
51 #include "cm5.h" /* common timer defines */
52 #include "cm_tkns.h" /* common tokens defines */
53 #include "cm_mblk.h" /* common memory allocation library defines */
54 #include "cm_llist.h" /* common link list defines */
55 #include "cm_hash.h" /* common hash list defines */
56 #include "cm_lte.h" /* common LTE defines */
57 #include "lkw.h" /* LKW defines */
58 #include "ckw.h" /* CKW defines */
59 #include "kwu.h" /* KWU defines */
60 #include "rgu.h" /* RGU defines */
61 #include "kw_env.h" /* RLC environment options */
63 #include "kw.h" /* RLC defines */
64 #include "kw_err.h" /* RLC defines */
67 /* extern (.x) include files */
68 #include "gen.x" /* general */
69 #include "ssi.x" /* system services */
71 #include "cm5.x" /* common timer library */
72 #include "cm_tkns.x" /* common tokens */
73 #include "cm_mblk.x" /* common memory allocation */
74 #include "cm_llist.x" /* common link list */
75 #include "cm_hash.x" /* common hash list */
76 #include "cm_lte.x" /* common LTE includes */
77 #include "cm_lib.x" /* common memory allocation library */
78 #include "lkw.x" /* LKW */
79 #include "ckw.x" /* CKW */
80 #include "kwu.x" /* KWU */
81 #include "rgu.x" /* RGU */
86 #if defined(PRE_DEF_UE_CTX) || defined(PRE_DEF_UE_CTX_HO)
87 #ifdef EG_GEN_LOAD_5GTF
91 EXTERN S16 PjUiPjuDatInd(Pst* pst,SuId suId,CmLtePdcpId * pdcpId,Buffer *mBuf);
93 PUBLIC Void AddUeContext
99 PUBLIC Void AddUeContext(crnti,rrcMsgType)
104 KwuDatIndInfo *datIndInfo; /* Data Indication Information */
105 U8 rrcConReq[6] ={ 0x50, 0x30, 0x30, 0x30, 0x30, 0x34 };
106 U8 rrcConSetupComplete[34] ={ 0x20, 0x00, 0x3e, 0x0e, 0x82, 0x02, 0x10, 0x12, 0x20, 0x02, 0x20, 0x64, 0xa8, 0x2c, 0x48, 0x05, 0x00, 0x80, 0x00, 0x08, 0x04, 0x03, 0xa0, 0x02, 0xa0, 0x10, 0x12, 0x20, 0x02, 0x20, 0x64, 0xa8, 0x2c, 0x48};
108 U8 rrcUeCapabilityInfo[12] ={0x38, 0x01, 0x00, 0x80, 0x1b, 0xff, 0x0c, 0x00, 0x20, 0x00, 0x80, 0x00};
110 /* U8 rrcUeCapabilityInfo[44] ={0x38,0x01,0x02,0x84,0x9b,0xff,0x0c,0x00,0x20,0x00,0x80,0x1f,0xfe,0xf4,0x4f,0xe0,0x40,0x03,0x80,0x11,0x04,0x0c,0x20,0x88,0x20,0x7f,0xff,0xff,0xff,0xf3,0xff,0x81,0xff,0xff,0xff,0xff,0x7f,0xf0,0x3f,0xff,0xff,0xff,0xe0,0x00};
112 U8 rrcUeCapabilityInfo[] =
114 0x38,0x01,0x03,0x34,0x9b,0xff,0x0c,0x00,0x20,0x00,0x80,0x1f,0xfe,0xf4,0x4f,0xe0
115 ,0x40,0x09,0x80,0x11,0x04,0x0c,0x20,0x88,0x20,0x63,0x04,0x41,0x03,0x20,0x22,0x08
116 ,0x19,0x61,0x10,0x40,0xff,0xff,0xff,0xff,0xe7,0xff,0x03,0xff,0xff,0xff,0xfe,0xff
117 ,0xe0,0x7f,0xff,0xff,0xff,0xc0,0x00
121 U8 rrcSecurityModeComplete[2] ={0x28, 0x80};
122 U8 rrcReconfigComplete[2] ={0x10, 0x80};
126 Pst ulPst1 ={100,100,217,0,215,0,PRIOR0,0,81,1,1,0,0};
127 Pst ulPst2 ={100,100,217,0,216,0,PRIOR0,0,68,0,1,0,0};
134 KwuDatIndInfo datIndInfoTmp;
135 datIndInfo = &datIndInfoTmp;
136 datIndInfo->rlcId.rbId = 5;
137 datIndInfo->rlcId.rbType = 0;
138 datIndInfo->rlcId.ueId = 0;
139 datIndInfo->rlcId.cellId = 1;
140 datIndInfo->tCrnti = crnti;
141 datIndInfo->isOutOfSeq = 16;
143 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
145 SAddPstMsgMult(rrcConReq,6,pdu);
147 RLOG1(L_INFO,"Profiling Framework Sending RRC Connection Req to RRC for UE :%d\n",crnti);
148 printf("Profiling Framework Sending RRC Connection Req to RRC for UE :%d\n",crnti);
149 KwUiKwuDatInd(&ulPst1, 1, datIndInfo, pdu);
151 else if(2 == rrcMsgType)
159 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
161 SAddPstMsgMult(rrcConSetupComplete,34,pdu);
163 RLOG1(L_INFO,"Profiling Framework: Sending RRC Connection Setup Complete to RRC for UE :%d\n",crnti);
164 printf("Profiling Framework: Sending RRC Connection Setup Complete to RRC for UE :%d\n",crnti);
165 PjUiPjuDatInd(&ulPst2, 1, &pdcpId, pdu);
168 else if(3 == rrcMsgType)
176 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
179 SAddPstMsgMult(rrcUeCapabilityInfo,12,pdu);
181 SAddPstMsgMult(rrcUeCapabilityInfo,sizeof(rrcUeCapabilityInfo),pdu);
183 RLOG1(L_INFO,"Profiling Framework: Sending RRC UE Capability Info to RRC for UE :%d\n",crnti);
184 printf("Profiling Framework: Sending RRC UE Capability Info to RRC for UE :%d\n",crnti);
185 PjUiPjuDatInd(&ulPst2, 1, &pdcpId, pdu);
187 else if(4 == rrcMsgType)
195 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
197 SAddPstMsgMult(rrcSecurityModeComplete,2,pdu);
199 RLOG1(L_INFO,"Profiling Framework: Sending RRC Security Mode Complete to RRC for UE :%d\n",crnti);
200 printf("Profiling Framework: Sending RRC Security Mode Complete to RRC for UE :%d\n",crnti);
201 PjUiPjuDatInd(&ulPst2, 1, &pdcpId, pdu);
203 else if(5 == rrcMsgType)
211 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
213 SAddPstMsgMult(rrcReconfigComplete,2,pdu);
215 RLOG1(L_INFO,"Profiling Framework: Sending RRC Reconfig Complete to RRC for UE :%d\n",crnti);
216 printf("Profiling Framework: Sending RRC Reconfig Complete to RRC for UE :%d\n",crnti);
217 PjUiPjuDatInd(&ulPst2, 1, &pdcpId, pdu);
218 #ifdef EG_GEN_LOAD_5GTF
225 /** @addtogroup tmmode */
228 #define KW_MODULE (KW_DBGMASK_TM | KW_DBGMASK_UL)
232 * Handler to process the Data Indication from the lower layer and send the
233 * SDU to upper layer.
236 * This function processes the PDU receivied from the lower layer and sends
237 * the same pdu as SDU to the upper layer.It sends CRNTI along with the SDU
240 * @param[in] gCb RLC Instance Control Block
241 * @param[in] rbCb RB control block.
242 * @param[in] tCrnti TCRNTI
251 PUBLIC Void kwTmmRcvFrmLi
259 PUBLIC Void kwTmmRcvFrmLi(gCb,rbCb, tCrnti, pdu)
267 PUBLIC Void kwTmmRcvFrmLi
274 PUBLIC Void kwTmmRcvFrmLi(gCb,rbCb, pdu)
281 KwuDatIndInfo *datIndInfo; /* Data Indication Information */
286 /* Creating static memory for KwuDatIndInfo. #else will be
287 * removed once the sanity testing is performed for all platforms */
288 KwuDatIndInfo datIndInfoTmp;
289 datIndInfo = &datIndInfoTmp;
290 #if (ERRCLASS & ERRCLS_ADD_RES)
291 if ( datIndInfo == NULLP )
293 RLOG_ARG2(L_FATAL,DBG_RBID,rbCb->rlcId.rbId,
294 "Memory Allocation failed UEID:%d CELLID:%d",
299 #endif /* ERRCLASS & ERRCLS_ADD_RES */
300 KW_MEM_CPY(&(datIndInfo->rlcId),&(rbCb->rlcId),sizeof(CmLteRlcId));
302 if ( rbCb->lch.lChType == CM_LTE_LCH_CCCH )
304 datIndInfo->tCrnti = tCrnti;
307 gCb->genSts.pdusRecv++;
308 SFndLenMsg(pdu, &msgLen);
309 gCb->genSts.bytesRecv += msgLen;
310 /* If trace flag is enabled send the trace indication */
311 if(gCb->init.trc == TRUE)
313 /* Populate the trace params */
314 kwLmmSendTrc(gCb,KWU_EVT_DAT_IND, pdu);
316 KwUiKwuDatInd( &gCb->u.ulCb->kwuUlSap->pst,
317 gCb->u.ulCb->kwuUlSap->suId,
325 * Handler to process the re-establishment request received from the upper
326 * layer. It is just a hook for future enhancement.
329 * @param[in] gCb RLC Instance Control Block
330 * @param[in] rbCb RB control block.
337 PUBLIC Void kwTmmUlReEstablish
343 PUBLIC Void kwTmmUlReEstablish(rbCb)
348 TRC2(kwUlTmmReEstablish)
350 RLOG_ARG0(L_DEBUG,DBG_RBID,rbCb->rlcId.rbId,"do nothing for TMM for ReEstablish");
358 /********************************************************************30**
360 **********************************************************************/