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: Defines required by LTE MAC
27 File: rlc_dl_ul_inf_ul.c
29 **********************************************************************/
31 /** @file rlc_dl_ul_inf_ul.c
32 @brief UDX Uplink Module
35 /* header include files (.h) */
36 #include "common_def.h"
37 #include "lkw.h" /* LKW defines */
38 #include "ckw.h" /* CKW defines */
39 #include "kwu.h" /* KWU defines */
40 #include "rgu.h" /* RGU defines */
41 #include "rlc_err.h" /* Err defines */
42 #include "rlc_env.h" /* RLC environment options */
44 /* extern (.x) include files */
45 #include "lkw.x" /* LKW */
46 #include "ckw.x" /* CKW */
47 #include "kwu.x" /* KWU */
48 #include "rgu.x" /* RGU */
50 #include "rlc_utils.h" /* RLC defines */
51 #include "rlc_dl_ul_inf.h"
54 #include "du_app_rlc_inf.h"
57 #define RLC_MODULE RLC_DBGMASK_UDX
62 /* forward references */
64 /* public variable declarations */
65 S16 rlcHdlCrlcUlCfgReq ARGS((RlcCb *gCb,RlcUlCfgTmpData *cfgTmpData,
66 RlcCfgCfmInfo *cfmInfo, RlcCfgCfmInfo *cfgCfm));
74 * Handler for bind confirmation from DL.
77 * This function handles the bind confirmation received
80 * @param[in] pst Post structure
81 * @param[in] suId Service User ID
82 * @param[in] status Status of confirmation
98 RlcUdxUlSapCb *udxSap; /* RGU SAP Control Block */
101 #if (ERRCLASS & ERRCLS_INT_PAR)
102 if (pst->dstInst >= MAX_RLC_INSTANCES)
107 tRlcCb = RLC_GET_RLCCB(pst->dstInst);
109 RLCDBGP_BRIEF(tRlcCb, "rlcUlUdxBndCfm(post, suId(%d), status(%d)\n",
112 #if (ERRCLASS & ERRCLS_INT_PAR)
113 if (tRlcCb->init.cfgDone != TRUE)
115 DU_LOG("\nERROR --> RLC_UL : General configuration not done");
116 RLC_SEND_SAPID_ALARM(tRlcCb,suId,
117 LKW_EVENT_LI_BND_CFM, LCM_CAUSE_INV_STATE);
124 DU_LOG("\nERROR --> RLC_UL : Invalid suId");
125 RLC_SEND_SAPID_ALARM(tRlcCb,suId,
126 LKW_EVENT_LI_BND_CFM, LCM_CAUSE_INV_SUID);
130 #endif /* ERRCLASS & ERRCLS_INT_PAR */
132 udxSap = tRlcCb->u.ulCb->udxUlSap + suId;
134 RLCDBGP_DETAIL(tRlcCb, "RlcLiRguBndCfm: For RGU SAP state=%d\n",
137 /* Check rguSap state */
138 switch (udxSap->state)
140 case RLC_SAP_BINDING:
142 if(TRUE == rlcChkTmr(tRlcCb,(PTR)udxSap,EVENT_RLC_WAIT_BNDCFM))
144 rlcStopTmr (tRlcCb,(PTR)udxSap, EVENT_RLC_WAIT_BNDCFM);
146 udxSap->retryCnt = 0;
148 if (status == CM_BND_OK)
150 udxSap->state = RLC_SAP_BND;
151 event = LCM_EVENT_BND_OK;
152 cause = LKW_CAUSE_SAP_BNDENB;
156 udxSap->state = RLC_SAP_CFG;
157 event = LCM_EVENT_BND_FAIL;
158 cause = LKW_CAUSE_UNKNOWN;
164 event = LKW_EVENT_RGU_BND_CFM;
165 cause = LCM_CAUSE_INV_STATE;
168 /* Send an alarm with proper event and cause */
169 RLC_SEND_SAPID_ALARM(tRlcCb,suId, event, cause);
176 * Handles UDX Configuration Confirm
179 * This function handles the UDX configuration Confirm from DL Instance
181 * @param[in] pst Post structure
182 * @param[in] suId Service User ID
183 * @param[in] cfmInfo Confirm Information
193 RlcCfgCfmInfo *cfmInfo
198 RlcCfgCfmInfo *cfgCfm;
199 RlcUlCfgTmpData *cfgTmpData;
201 memset(&rspPst, 0, sizeof(Pst));
203 #if (ERRCLASS & ERRCLS_INT_PAR)
204 if (pst->dstInst >= MAX_RLC_INSTANCES)
206 RLC_FREE_SHRABL_BUF(pst->region,
209 sizeof(RlcCfgCfmInfo));
213 tRlcCb = RLC_GET_RLCCB(pst->dstInst);
214 RLCDBGP_BRIEF(tRlcCb, " suId(%d)\n", suId);
216 #if (ERRCLASS & ERRCLS_INT_PAR)
219 DU_LOG("\nERROR --> RLC_UL : Invalid suId");
220 RLC_SEND_SAPID_ALARM(tRlcCb,suId,
221 LKW_EVENT_LI_BND_CFM, LCM_CAUSE_INV_SUID);
222 RLC_FREE_SHRABL_BUF(pst->region,
225 sizeof(RlcCfgCfmInfo));
228 #endif /* ERRCLASS & ERRCLS_INT_PAR */
230 if(ROK != rlcDbmFindUlTransaction(tRlcCb,cfmInfo->transId, &cfgTmpData))
232 DU_LOG("\nERROR --> RLC_UL : Invalid transId");
233 RLC_FREE_SHRABL_BUF(pst->region,
236 sizeof(RlcCfgCfmInfo));
240 if(ROK != rlcDbmDelUlTransaction(tRlcCb, cfgTmpData))
242 RLC_FREE_SHRABL_BUF(pst->region,
245 sizeof(RlcCfgCfmInfo));
248 /* Allocate memory and memset to 0 for cfmInfo */
249 RLC_ALLOC(tRlcCb,cfgCfm, sizeof(RlcCfgCfmInfo));
250 #if (ERRCLASS & ERRCLS_ADD_RES)
253 DU_LOG("\nERROR --> RLC_UL : Memory Allocation failed.");
254 RLC_FREE_SHRABL_BUF(pst->region,
257 sizeof(RlcCfgCfmInfo));
260 #endif /* ERRCLASS & ERRCLS_ADD_RES */
261 rlcHdlCrlcUlCfgReq(tRlcCb,cfgTmpData, cfmInfo, cfgCfm);
262 if(tRlcCb->u.ulCb->rlcUlUdxEventType == EVENT_RLC_UE_CREATE_REQ)
264 FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_CREATE_RSP);
265 SendRlcUeCfgRspToDu(&rspPst, cfgCfm);
267 else if(tRlcCb->u.ulCb->rlcUlUdxEventType == EVENT_RLC_UE_RECONFIG_REQ)
269 FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_RECONFIG_RSP);
270 SendRlcUeCfgRspToDu(&rspPst, cfgCfm);
272 else if (tRlcCb->u.ulCb->rlcUlUdxEventType == EVENT_RLC_UE_DELETE_REQ)
274 FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_DELETE_RSP);
275 if(sendRlcUeDeleteRspToDu(cfgCfm->cellId, cfgCfm->ueId, SUCCESSFUL) != ROK)
277 DU_LOG("ERROR --> RLC_UL: rlcUlUdxCfgCfm(): Failed to send UE delete response ");
278 RLC_FREE(tRlcCb, cfgCfm, sizeof(RlcCfgCfmInfo));
281 RLC_FREE(tRlcCb, cfgCfm, sizeof(RlcCfgCfmInfo));
284 /* free the memory from DL */
285 RLC_FREE_SHRABL_BUF(pst->region, pst->pool, cfmInfo, sizeof(RlcCfgCfmInfo));
287 /* free the cfgInfo that came from LM */
288 for(cfgIdx=0; cfgIdx<cfgTmpData->cfgInfo->numEnt; cfgIdx++)
290 RLC_FREE(tRlcCb, cfgTmpData->cfgInfo->entCfg[cfgIdx].snssai, sizeof(Snssai));
292 RLC_FREE(tRlcCb, cfgTmpData->cfgInfo, sizeof(RlcCfgInfo));
293 RLC_FREE(tRlcCb,cfgTmpData,sizeof(RlcUlCfgTmpData));
300 * Handler for UeId change confirm
303 * This function handles the UeId Change Confirm from DL Instance
305 * @param[in] pst Post structure
306 * @param[in] suId Service User ID
307 * @param[in] transId Transaction Id
308 * @param[in] status Status of confirmation
314 S16 rlcUlUdxUeIdChgCfm
323 RlcUlCfgTmpData *cfgTmpData;
325 #if (ERRCLASS & ERRCLS_INT_PAR)
326 if (pst->dstInst >= MAX_RLC_INSTANCES)
331 tRlcCb = RLC_GET_RLCCB(pst->dstInst);
333 RLCDBGP_BRIEF(tRlcCb, " suId(%d) \n", suId);
335 #if (ERRCLASS & ERRCLS_INT_PAR)
338 DU_LOG("\nERROR --> RLC_UL : Invalid suId");
341 #endif /* ERRCLASS & ERRCLS_INT_PAR */
343 if(ROK != rlcDbmFindUlTransaction(tRlcCb, transId, &cfgTmpData))
345 DU_LOG("\nERROR --> RLC_UL : Invalid transId");
349 if(ROK != rlcDbmDelUlTransaction(tRlcCb, cfgTmpData))
354 if(status.status == CKW_CFG_CFM_OK)
356 if(cfgTmpData->ueCb != NULLP)
358 rlcCfgApplyUlUeIdChng(tRlcCb, cfgTmpData->ueInfo, cfgTmpData->newUeInfo, cfgTmpData);
361 RlcUiCkwUeIdChgCfm(&(tRlcCb->u.ulCb->ckwSap.pst),
362 tRlcCb->u.ulCb->ckwSap.suId,
363 transId,cfgTmpData->ueInfo,status);
364 /* only newUeInfo needs to be freed here, ueInfo would be freed at the
365 interface or by he receipient in case of tight coupling */
366 RLC_PST_FREE(pst->region, pst->pool, cfgTmpData->newUeInfo, sizeof(CkwUeInfo));
367 RLC_FREE(tRlcCb, cfgTmpData, sizeof (RlcUlCfgTmpData));
373 * Udx Status Prohibit Timer Start
375 * @param[in] pst Post structure
376 * @param[in] suId Service User ID
377 * @param[in] rlcId rlc Id
382 S16 rlcUlUdxStaProhTmrStart
389 RlcCb *tRlcCb= NULLP;
392 #if (ERRCLASS & ERRCLS_INT_PAR)
393 if (pst->dstInst >= MAX_RLC_INSTANCES)
398 tRlcCb = RLC_GET_RLCCB(pst->dstInst);
400 rlcDbmFetchUlRbCbByRbId(tRlcCb, rlcId, &rbCb);
403 DU_LOG("\nERROR --> RLC_UL : CellId [%u]:RbId[%d] not found",
404 rlcId->cellId,rlcId->rbId);
408 /* Start staProhTmr */
409 rlcStartTmr(tRlcCb,(PTR)rbCb, EVENT_RLC_AMUL_STA_PROH_TMR);
416 * Handler for configuration confirm from DL.
418 * @param[in] gCb - RLC Instance Control Block
419 * @param[in] cfgTmpData - Configuration Temporary Data
420 * @param[in] cfmInfo - DL Configuration Confirm Info
421 * @param[out] cfgCfm - Configuration Confirm to be sent to RRC
427 S16 rlcHdlCrlcUlCfgReq
430 RlcUlCfgTmpData *cfgTmpData,
431 RlcCfgCfmInfo *cfmInfo,
432 RlcCfgCfmInfo *cfgCfm
439 cfg = cfgTmpData->cfgInfo;
440 maxEnt = (cfg->numEnt < CKW_MAX_ENT_CFG)? cfg->numEnt:CKW_MAX_ENT_CFG;
442 for (idx = 0; idx < maxEnt; idx++)
444 RlcEntCfgCfmInfo *entCfgCfm;
445 RlcEntCfgCfmInfo *entDlCfgCfm;
446 RlcEntCfgInfo *entCfg;
448 entCfg = &(cfg->entCfg[idx]);
449 entCfgCfm = &(cfgCfm->entCfgCfm[idx]);
450 entDlCfgCfm = &(cfmInfo->entCfgCfm[idx]);
451 switch (entCfg->cfgType)
457 if (entCfg->dir == RLC_DIR_UL)
459 RLC_MEM_CPY(entCfgCfm,
460 &cfgTmpData->cfgEntData[idx].entUlCfgCfm,
461 sizeof(RlcEntCfgCfmInfo));
463 else if (entCfg->dir == RLC_DIR_DL)
465 RLC_MEM_CPY(entCfgCfm, entDlCfgCfm, sizeof(RlcEntCfgCfmInfo));
467 else if(entCfg->dir == RLC_DIR_BOTH)
469 if (entDlCfgCfm->status.status != CKW_CFG_CFM_OK)
471 rlcCfgRollBackUlRb(gCb,
474 &cfgTmpData->cfgEntData[idx]);
480 &cfgTmpData->cfgEntData[idx],
483 RLC_MEM_CPY(entCfgCfm, entDlCfgCfm, sizeof(RlcEntCfgCfmInfo));
487 RLC_CFG_FILL_CFG_CFM(entCfgCfm, entCfg->rbId, entCfg->rbType,
488 CKW_CFG_CFM_NOK, CKW_CFG_REAS_INVALID_DIR);
489 DU_LOG("\nDEBUG --> RLC_UL : RBID[%d] direction[%d] is invalid",
490 entCfg->rbId,entCfg->dir);
495 case CKW_CFG_REESTABLISH:
497 if (entCfg->dir == RLC_DIR_UL)
499 RLC_MEM_CPY(entCfgCfm,
500 &cfgTmpData->cfgEntData[idx].entUlCfgCfm,
501 sizeof(RlcEntCfgCfmInfo));
503 else if (entCfg->dir == RLC_DIR_DL)
505 RLC_MEM_CPY(entCfgCfm, entDlCfgCfm, sizeof(RlcEntCfgCfmInfo));
509 if (entCfg->dir & RLC_DIR_UL)
511 /* Reestablish indication is sent from UL Instance only*/
512 if (entDlCfgCfm->status.status == CKW_CFG_CFM_OK)
514 rlcCfgApplyReEstUlRb (gCb, cfg->ueId,
516 &cfgTmpData->cfgEntData[idx]);
518 RLC_MEM_CPY(entCfgCfm, entDlCfgCfm, sizeof(RlcEntCfgCfmInfo));
523 case CKW_CFG_DELETE_UE:
525 if (cfgTmpData->cfgEntData[idx].entUlCfgCfm.status.status == CKW_CFG_CFM_OK)
527 rlcCfgApplyDelUlUe(gCb, cfgTmpData);
528 RLC_MEM_CPY(entCfgCfm,
529 &cfgTmpData->cfgEntData[idx].entUlCfgCfm,
530 sizeof(RlcEntCfgCfmInfo));
534 RLC_MEM_CPY(entCfgCfm, entDlCfgCfm,
535 sizeof(RlcEntCfgCfmInfo));
539 case CKW_CFG_DELETE_CELL:
541 if (cfgTmpData->cfgEntData[idx].entUlCfgCfm.status.status == CKW_CFG_CFM_OK)
543 rlcCfgApplyDelUlCell(gCb, cfgTmpData);
544 RLC_MEM_CPY(entCfgCfm,
545 &cfgTmpData->cfgEntData[idx].entUlCfgCfm,
546 sizeof(RlcEntCfgCfmInfo));
550 RLC_MEM_CPY(entCfgCfm, entDlCfgCfm,
551 sizeof(RlcEntCfgCfmInfo));
557 RLC_CFG_FILL_CFG_CFM(entCfgCfm, entCfg->rbId, entCfg->rbType,
558 CKW_CFG_CFM_NOK, CKW_CFG_REAS_INVALID_CFG);
560 DU_LOG("\nERROR --> RLC_UL : Invalid configuration type");
565 /* Assign number of entity configurations and suId */
566 cfgCfm->transId = cfgTmpData->uprLyrTransId;
567 cfgCfm->ueId = cfg->ueId;
568 cfgCfm->cellId = cfg->cellId;
569 cfgCfm->numEnt = cfg->numEnt;
575 #endif /* __cplusplus */
578 /**********************************************************************
580 **********************************************************************/