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 S16 PjUiPjuDatInd(Pst* pst,SuId suId,CmLtePdcpId * pdcpId,Buffer *mBuf);
81 Void AddUeContext(crnti,rrcMsgType)
86 KwuDatIndInfo *datIndInfo; /* Data Indication Information */
87 uint8_t rrcConReq[6] ={ 0x50, 0x30, 0x30, 0x30, 0x30, 0x34 };
88 uint8_t 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 uint8_t rrcUeCapabilityInfo[12] ={0x38, 0x01, 0x00, 0x80, 0x1b, 0xff, 0x0c, 0x00, 0x20, 0x00, 0x80, 0x00};
92 /* uint8_t 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 uint8_t 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 uint8_t rrcSecurityModeComplete[2] ={0x28, 0x80};
104 uint8_t 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};
116 KwuDatIndInfo datIndInfoTmp;
117 datIndInfo = &datIndInfoTmp;
118 datIndInfo->rlcId.rbId = 5;
119 datIndInfo->rlcId.rbType = 0;
120 datIndInfo->rlcId.ueId = 0;
121 datIndInfo->rlcId.cellId = 1;
122 datIndInfo->tCrnti = crnti;
123 datIndInfo->isOutOfSeq = 16;
125 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
127 SAddPstMsgMult(rrcConReq,6,pdu);
129 RLOG1(L_INFO,"Profiling Framework Sending RRC Connection Req to RRC for UE :%d\n",crnti);
130 printf("Profiling Framework Sending RRC Connection Req to RRC for UE :%d\n",crnti);
131 rlcSendUlDataToDu(&ulPst1, datIndInfo, pdu);
133 else if(2 == rrcMsgType)
142 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
144 SAddPstMsgMult(rrcConSetupComplete,34,pdu);
146 RLOG1(L_INFO,"Profiling Framework: Sending RRC Connection Setup Complete to RRC for UE :%d\n",crnti);
147 printf("Profiling Framework: Sending RRC Connection Setup Complete to RRC for UE :%d\n",crnti);
149 PjUiPjuDatInd(&ulPst2, 1, &pdcpId, pdu);
153 else if(3 == rrcMsgType)
162 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
165 SAddPstMsgMult(rrcUeCapabilityInfo,12,pdu);
167 SAddPstMsgMult(rrcUeCapabilityInfo,sizeof(rrcUeCapabilityInfo),pdu);
169 RLOG1(L_INFO,"Profiling Framework: Sending RRC UE Capability Info to RRC for UE :%d\n",crnti);
170 printf("Profiling Framework: Sending RRC UE Capability Info to RRC for UE :%d\n",crnti);
172 PjUiPjuDatInd(&ulPst2, 1, &pdcpId, pdu);
176 else if(4 == rrcMsgType)
186 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
188 SAddPstMsgMult(rrcSecurityModeComplete,2,pdu);
190 RLOG1(L_INFO,"Profiling Framework: Sending RRC Security Mode Complete to RRC for UE :%d\n",crnti);
191 printf("Profiling Framework: Sending RRC Security Mode Complete to RRC for UE :%d\n",crnti);
193 PjUiPjuDatInd(&ulPst2, 1, &pdcpId, pdu);
196 else if(5 == rrcMsgType)
206 SGetMsg(DFLT_REGION, DFLT_POOL, (Buffer **) &pdu);
208 SAddPstMsgMult(rrcReconfigComplete,2,pdu);
210 RLOG1(L_INFO,"Profiling Framework: Sending RRC Reconfig Complete to RRC for UE :%d\n",crnti);
211 printf("Profiling Framework: Sending RRC Reconfig Complete to RRC for UE :%d\n",crnti);
213 PjUiPjuDatInd(&ulPst2, 1, &pdcpId, pdu);
214 #ifdef EG_GEN_LOAD_5GTF
222 /** @addtogroup tmmode */
225 #define RLC_MODULE (RLC_DBGMASK_TM | RLC_DBGMASK_UL)
229 * Handler to process the Data Indication from the lower layer and send the
230 * SDU to upper layer.
233 * This function processes the PDU receivied from the lower layer and sends
234 * the same pdu as SDU to the upper layer.It sends CRNTI along with the SDU
237 * @param[in] gCb RLC Instance Control Block
238 * @param[in] rbCb RB control block.
239 * @param[in] tCrnti TCRNTI
247 void rlcTmmRcvFrmMac(RlcCb *gCb, RlcUlRbCb *rbCb, CmLteRnti tCrnti, Buffer *pdu)
249 void rlcTmmRcvFrmMac(RlcCb *gCb, RlcUlRbCb *rbCb, Buffer *pdu)
252 RlcUlRrcMsgInfo *ulRrcMsgInfo;
254 uint16_t copyLen; /* Number of bytes copied */
257 gCb->genSts.pdusRecv++;
258 ODU_GET_MSG_LEN(pdu, (MsgLen *)&msgLen);
259 gCb->genSts.bytesRecv += msgLen;
261 /* Filling UL RRC Message Info */
262 RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL,
263 ulRrcMsgInfo, sizeof(RlcUlRrcMsgInfo));
266 ulRrcMsgInfo->cellId = rbCb->rlcId.cellId;
267 ulRrcMsgInfo->ueIdx = rbCb->rlcId.ueId;
268 ulRrcMsgInfo->lcId = rbCb->lch.lChId;
269 RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL,
270 ulRrcMsgInfo->rrcMsg, msgLen);
271 if (ulRrcMsgInfo->rrcMsg)
273 ODU_COPY_MSG_TO_FIX_BUF(pdu, 0, msgLen, ulRrcMsgInfo->rrcMsg, (MsgLen *)©Len);
274 ulRrcMsgInfo->msgLen = msgLen;
276 /* Sending UL RRC Message transfeer to DU APP */
277 memset(&pst, 0, sizeof(Pst));
278 FILL_PST_RLC_TO_DUAPP(pst, RLC_UL_INST, EVENT_UL_RRC_MSG_TRANS_TO_DU);
279 rlcSendUlRrcMsgToDu(&pst, ulRrcMsgInfo);
283 DU_LOG("\nRLC : rlcTmmRcvFrmMac: Memory allocation failed for UL RRC Msg");
288 DU_LOG("\nRLC : rlcTmmRcvFrmMac: Memory allocation failed for ulRrcMsgInfo");
296 * Handler to process the re-establishment request received from the upper
297 * layer. It is just a hook for future enhancement.
300 * @param[in] gCb RLC Instance Control Block
301 * @param[in] rbCb RB control block.
308 Void rlcTmmUlReEstablish
314 Void rlcTmmUlReEstablish(rbCb)
320 RLOG_ARG0(L_DEBUG,DBG_RBID,rbCb->rlcId.rbId,"do nothing for TMM for ReEstablish");
328 /********************************************************************30**
330 **********************************************************************/