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 "common_def.h"
46 #include "lkw.h" /* LKW defines */
47 #include "ckw.h" /* CKW defines */
48 #include "kwu.h" /* KWU defines */
49 #include "rgu.h" /* RGU defines */
50 #include "kw_env.h" /* RLC environment options */
52 #include "kw.h" /* RLC defines */
53 #include "kw_err.h" /* RLC defines */
56 /* extern (.x) include files */
57 #include "lkw.x" /* LKW */
58 #include "ckw.x" /* CKW */
59 #include "kwu.x" /* KWU */
60 #include "rgu.x" /* RGU */
64 #include "du_app_rlc_inf.h"
65 #include "rlc_utils.h"
66 #include "rlc_upr_inf_api.h"
68 #if defined(PRE_DEF_UE_CTX) || defined(PRE_DEF_UE_CTX_HO)
69 #ifdef EG_GEN_LOAD_5GTF
73 EXTERN S16 PjUiPjuDatInd(Pst* pst,SuId suId,CmLtePdcpId * pdcpId,Buffer *mBuf);
75 PUBLIC Void AddUeContext
81 PUBLIC Void AddUeContext(crnti,rrcMsgType)
86 KwuDatIndInfo *datIndInfo; /* Data Indication Information */
87 U8 rrcConReq[6] ={ 0x50, 0x30, 0x30, 0x30, 0x30, 0x34 };
88 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};
90 U8 rrcUeCapabilityInfo[12] ={0x38, 0x01, 0x00, 0x80, 0x1b, 0xff, 0x0c, 0x00, 0x20, 0x00, 0x80, 0x00};
92 /* 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};
94 U8 rrcUeCapabilityInfo[] =
96 0x38,0x01,0x03,0x34,0x9b,0xff,0x0c,0x00,0x20,0x00,0x80,0x1f,0xfe,0xf4,0x4f,0xe0
97 ,0x40,0x09,0x80,0x11,0x04,0x0c,0x20,0x88,0x20,0x63,0x04,0x41,0x03,0x20,0x22,0x08
98 ,0x19,0x61,0x10,0x40,0xff,0xff,0xff,0xff,0xe7,0xff,0x03,0xff,0xff,0xff,0xfe,0xff
99 ,0xe0,0x7f,0xff,0xff,0xff,0xc0,0x00
103 U8 rrcSecurityModeComplete[2] ={0x28, 0x80};
104 U8 rrcReconfigComplete[2] ={0x10, 0x80};
108 Pst ulPst1 ={100,100,217,0,215,0,PRIOR0,0,81,1,1,0,0};
110 Pst ulPst2 ={100,100,217,0,216,0,PRIOR0,0,68,0,1,0,0};
117 KwuDatIndInfo datIndInfoTmp;
118 datIndInfo = &datIndInfoTmp;
119 datIndInfo->rlcId.rbId = 5;
120 datIndInfo->rlcId.rbType = 0;
121 datIndInfo->rlcId.ueId = 0;
122 datIndInfo->rlcId.cellId = 1;
123 datIndInfo->tCrnti = crnti;
124 datIndInfo->isOutOfSeq = 16;
126 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
128 SAddPstMsgMult(rrcConReq,6,pdu);
130 RLOG1(L_INFO,"Profiling Framework Sending RRC Connection Req to RRC for UE :%d\n",crnti);
131 printf("Profiling Framework Sending RRC Connection Req to RRC for UE :%d\n",crnti);
132 KwUiKwuDatInd(&ulPst1, datIndInfo, pdu);
134 else if(2 == rrcMsgType)
143 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
145 SAddPstMsgMult(rrcConSetupComplete,34,pdu);
147 RLOG1(L_INFO,"Profiling Framework: Sending RRC Connection Setup Complete to RRC for UE :%d\n",crnti);
148 printf("Profiling Framework: Sending RRC Connection Setup Complete to RRC for UE :%d\n",crnti);
150 PjUiPjuDatInd(&ulPst2, 1, &pdcpId, pdu);
154 else if(3 == rrcMsgType)
163 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
166 SAddPstMsgMult(rrcUeCapabilityInfo,12,pdu);
168 SAddPstMsgMult(rrcUeCapabilityInfo,sizeof(rrcUeCapabilityInfo),pdu);
170 RLOG1(L_INFO,"Profiling Framework: Sending RRC UE Capability Info to RRC for UE :%d\n",crnti);
171 printf("Profiling Framework: Sending RRC UE Capability Info to RRC for UE :%d\n",crnti);
173 PjUiPjuDatInd(&ulPst2, 1, &pdcpId, pdu);
177 else if(4 == rrcMsgType)
187 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
189 SAddPstMsgMult(rrcSecurityModeComplete,2,pdu);
191 RLOG1(L_INFO,"Profiling Framework: Sending RRC Security Mode Complete to RRC for UE :%d\n",crnti);
192 printf("Profiling Framework: Sending RRC Security Mode Complete to RRC for UE :%d\n",crnti);
194 PjUiPjuDatInd(&ulPst2, 1, &pdcpId, pdu);
197 else if(5 == rrcMsgType)
207 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
209 SAddPstMsgMult(rrcReconfigComplete,2,pdu);
211 RLOG1(L_INFO,"Profiling Framework: Sending RRC Reconfig Complete to RRC for UE :%d\n",crnti);
212 printf("Profiling Framework: Sending RRC Reconfig Complete to RRC for UE :%d\n",crnti);
214 PjUiPjuDatInd(&ulPst2, 1, &pdcpId, pdu);
215 #ifdef EG_GEN_LOAD_5GTF
223 /** @addtogroup tmmode */
226 #define KW_MODULE (KW_DBGMASK_TM | KW_DBGMASK_UL)
230 * Handler to process the Data Indication from the lower layer and send the
231 * SDU to upper layer.
234 * This function processes the PDU receivied from the lower layer and sends
235 * the same pdu as SDU to the upper layer.It sends CRNTI along with the SDU
238 * @param[in] gCb RLC Instance Control Block
239 * @param[in] rbCb RB control block.
240 * @param[in] tCrnti TCRNTI
249 PUBLIC Void kwTmmRcvFrmLi
257 PUBLIC Void kwTmmRcvFrmLi(gCb,rbCb, tCrnti, pdu)
265 PUBLIC Void kwTmmRcvFrmLi
272 PUBLIC Void kwTmmRcvFrmLi(gCb,rbCb, pdu)
279 RlcUlRrcMsgInfo *ulRrcMsgInfo;
281 uint16_t copyLen; /* Number of bytes copied */
286 gCb->genSts.pdusRecv++;
287 SFndLenMsg(pdu, (MsgLen *)&msgLen);
288 gCb->genSts.bytesRecv += msgLen;
289 /* If trace flag is enabled send the trace indication */
290 if(gCb->init.trc == TRUE)
292 /* Populate the trace params */
293 kwLmmSendTrc(gCb, EVENT_UL_RRC_MSG_TRANS_TO_DU, pdu);
296 /* Filling UL RRC Message Info */
297 RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL,
298 ulRrcMsgInfo, sizeof(RlcUlRrcMsgInfo));
301 ulRrcMsgInfo->cellId = rbCb->rlcId.cellId;
302 ulRrcMsgInfo->ueIdx = rbCb->rlcId.ueId;
303 ulRrcMsgInfo->lcId = rbCb->lch.lChId;
304 RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL,
305 ulRrcMsgInfo->rrcMsg, msgLen);
306 if (ulRrcMsgInfo->rrcMsg)
308 SCpyMsgFix(pdu, 0, msgLen, ulRrcMsgInfo->rrcMsg, (MsgLen *)©Len);
309 ulRrcMsgInfo->msgLen = msgLen;
311 /* Sending UL RRC Message transfeer to DU APP */
312 memset(&pst, 0, sizeof(Pst));
313 FILL_PST_RLC_TO_DUAPP(pst, SFndProcId(), RLC_UL_INST, EVENT_UL_RRC_MSG_TRANS_TO_DU);
314 rlcSendUlRrcMsgToDu(&pst, ulRrcMsgInfo);
318 DU_LOG("\nRLC : Memory allocation failed");
323 DU_LOG("\nRLC : Memory allocation failed");
331 * Handler to process the re-establishment request received from the upper
332 * layer. It is just a hook for future enhancement.
335 * @param[in] gCb RLC Instance Control Block
336 * @param[in] rbCb RB control block.
343 PUBLIC Void kwTmmUlReEstablish
349 PUBLIC Void kwTmmUlReEstablish(rbCb)
354 TRC2(rlcUlTmmReEstablish)
356 RLOG_ARG0(L_DEBUG,DBG_RBID,rbCb->rlcId.rbId,"do nothing for TMM for ReEstablish");
364 /********************************************************************30**
366 **********************************************************************/