#include "rlc_utils.h"
#include "rlc_mac_inf.h"
+#include "du_app_rlc_inf.h"
#include "rlc_lwr_inf_api.h"
+#include "rlc_upr_inf_api.h"
#include "ss_rbuf.h"
#include "ss_rbuf.x"
RguDatReqTb datPerTb; /* DL data info per TB */
RguLchDatReq datPerLch; /* DL data info per Lch */
RlcData *dlData; /* DL data to be sent to MAC */
+ RlcDlRrcMsgRsp *dlRrcMsgRsp;/* DL Data Msg Rsp sent to DU */
Pst pst; /* Post structure */
uint16_t pduLen; /* PDU length */
uint16_t copyLen; /* Number of bytes copied */
dlData = NULLP;
+ dlRrcMsgRsp = NULLP;
RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL,
dlData, sizeof(RlcData));
-#if (ERRCLASS & ERRCLS_ADD_RES)
if ( dlData == NULLP )
{
DU_LOG("\nRLC: rlcSendDedLcDlData: Memory allocation failed for dl data");
datReqInfo, sizeof(RguDDatReqInfo));
return RFAILED;
}
-#endif /* ERRCLASS & ERRCLS_ADD_RES */
for(ueIdx = 0; ueIdx < datReqInfo->nmbOfUeGrantPerTti; ueIdx++)
{
}/* For Data per Lch */
}/* For Data per Tb */
+ RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL,
+ dlRrcMsgRsp, sizeof(RlcDlRrcMsgRsp));
+ if( dlRrcMsgRsp == NULLP )
+ {
+ DU_LOG("\nRLC: rlcSendDedLcDlData: Memory allocation failed for dlRrcMsgRsp");
+ for(pduIdx = 0; pduIdx < dlData->numPdu; pduIdx++)
+ {
+ RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlData->pduInfo[pduIdx].pduBuf,\
+ dlData->pduInfo[pduIdx].pduLen);
+ }
+ RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlData, sizeof(RlcData));
+ RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL,
+ datReqInfo, sizeof(RguDDatReqInfo));
+ return RFAILED;
+ }
+
+ dlRrcMsgRsp->cellId = dlData->cellId;
+ dlRrcMsgRsp->crnti = dlData->rnti;
+
/* Sending DL Data per UE to MAC */
memset(&pst, 0, sizeof(Pst));
FILL_PST_RLC_TO_MAC(pst, RLC_DL_INST, EVENT_DL_DATA_TO_MAC);
dlData->pduInfo[pduIdx].pduLen);
}
RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlData, sizeof(RlcData));
+ /* Update DL RRC MSG Rsp State */
+ dlRrcMsgRsp->state = TRANSMISSION_FAILED;
+ }
+ else
+ dlRrcMsgRsp->state = TRANSMISSION_COMPLETE;
+
+ /* Send Dl RRC Msg Rsp to DU APP */
+ FILL_PST_RLC_TO_DUAPP(pst, RLC_DL_INST, EVENT_DL_RRC_MSG_RSP_TO_DU);
+ if(rlcSendDlRrcMsgRspToDu(&pst, dlRrcMsgRsp) != ROK)
+ {
+ RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlRrcMsgRsp, sizeof(RlcDlRrcMsgRsp));
}
} /* For Data per UE */
}
oduCpyFixBufToMsg(dlRrcMsgInfo->rrcMsg, mBuf, dlRrcMsgInfo->msgLen);
- rlcProcDlData(pst, datReqInfo, mBuf);
+ if(rlcProcDlData(pst, datReqInfo, mBuf) != ROK)
+ {
+ return RFAILED;
+ }
/* RRC Delivery report is only send when RRC Delivery status report is true in DL RRC Message */
if(dlRrcMsgInfo->deliveryStaRpt)
DuProcRlcRrcDeliveryReport, /* 1 - Tightly coupled */
packRrcDeliveryReportToDu /* 2 - Light weight loosely coupled */
};
+
+/* Function pointer array for DL RRC Msg Rsp Transfer */
+RlcDlRrcMsgRspToDuFunc rlcSendDlRrcMsgRspToDuOpts[] =
+{
+ packRlcDlRrcMsgRspToDu, /* 0 - Loosely coupled */
+ DuProcRlcDlRrcMsgRsp, /* 1 - Tightly coupled */
+ packRlcDlRrcMsgRspToDu /* 2 - Light weight loosely coupled */
+};
+
/*******************************************************************
*
* @brief Sends UL RRC Message Info to DU APP
{
return (*rlcSendRrcDeliveryReportToDuOpts[pst->selector])(pst, rrcDelivery);
}
+
+/*******************************************************************
+ *
+ * @brief Sends DL RRC Message Status to DU APP
+ *
+ * @details
+ *
+ * Function : rlcSendDlRrcMsgRspToDu
+ *
+ * Functionality: Sends DL RRC Message Status to DU APP
+ *
+ * @params[in] Pst structure
+ * DL RRC Msg Info
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t rlcSendDlRrcMsgRspToDu(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg)
+{
+ return (*rlcSendDlRrcMsgRspToDuOpts[pst->selector])(pst, dlRrcMsg);
+}
+
/**********************************************************************
End of file
**********************************************************************/
uint8_t rlcSendUlRrcMsgToDu(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo);
uint8_t rlcSendRrcDeliveryReportToDu(Pst *pst, RrcDeliveryReport *rrcDelivery);
+uint8_t rlcSendDlRrcMsgRspToDu(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsgRsp);
/**********************************************************************
End of file
**********************************************************************/
return RFAILED;
}
+/*******************************************************************
+ *
+ * @brief Pack and send DL RRC message Response from RLC to DU APP
+ *
+ * @details
+ *
+ * Function : packRlcDlRrcMsgRspToDu
+ *
+ * Functionality:
+ * Pack and send DL RRC message Response from RLC to DU APP
+ *
+ * @params[in] Post structure
+ * DL RRC Msg Response
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t packRlcDlRrcMsgRspToDu(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsgRsp)
+{
+ Buffer *mBuf = NULLP;
+
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
+ {
+ DU_LOG("\nRLC : Memory allocation failed at packRlcDlRrcMsgRspToDu");
+ return RFAILED;
+ }
+ /* pack the address of the structure */
+ CMCHKPK(oduPackPointer,(PTR)dlRrcMsgRsp, mBuf);
+ return ODU_POST_TASK(pst,mBuf);
+ }
+ else
+ {
+ DU_LOG("\nRLC: Only LWLC supported for packRlcDlRrcMsgRspToDu");
+ }
+ return RFAILED;
+}
+
+/*******************************************************************
+ *
+ * @brief Unpack DL RRC Msg Response received at DU APP from RLC
+ *
+ * @details
+ *
+ * Function : unpackRlcDlRrcMsgRspToDu
+ *
+ * Functionality:
+ * Unpack DL RRC Msg Response received at DU APP from RLC
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t unpackRlcDlRrcMsgRspToDu(RlcDlRrcMsgRspToDuFunc func, Pst *pst, Buffer *mBuf)
+{
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ RlcDlRrcMsgRsp *dlRrcMsgRsp;
+ /* unpack the address of the structure */
+ CMCHKUNPK(oduUnpackPointer, (PTR *)&dlRrcMsgRsp, mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
+ return (*func)(pst, dlRrcMsgRsp);
+ }
+ else
+ {
+ /* Nothing to do for other selectors */
+ DU_LOG("\nRLC: Only LWLC supported for DL RRC Message transfer ");
+ ODU_PUT_MSG_BUF(mBuf);
+ }
+ return RFAILED;
+}
/**********************************************************************
End of file
***********************************************************************/
#define EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU 214
#define EVENT_RLC_UE_RECONFIG_REQ 215
#define EVENT_RLC_UE_RECONFIG_RSP 216
+#define EVENT_DL_RRC_MSG_RSP_TO_DU 217
#define RB_ID_SRB 0
#define RB_ID_DRB 1
#define LCH_DTCH 4 /*!< DTCH Logical Channel */
#define LCH_DCCH 5 /*!< DCCH Logical Channel */
+typedef enum
+{
+ TRANSMISSION_IN_PROGRESS,
+ TRANSMISSION_COMPLETE,
+ TRANSMISSION_FAILED
+}DlMsgState;
typedef enum
{
uint8_t *rrcMsg; /* RRC Message (DL-DCCH Message) */
}RlcDlRrcMsgInfo;
+/* DL RRC Message Rsp From RLC to DU APP */
+typedef struct dlRrcMsgRsp
+{
+ uint16_t cellId; /* Cell Id */
+ uint16_t crnti; /* UE index */
+ DlMsgState state; /* Dl RRC Msg State */
+}RlcDlRrcMsgRsp;
+
/* RRC delivery message from RLC to DU APP */
typedef struct rrcDeliveryStatus
{
Pst *pst,
RlcUeCfg *ueCfg ));
+/* DL RRC Message from RLC to DU APP */
+typedef uint8_t (*RlcDlRrcMsgRspToDuFunc) ARGS((
+ Pst *pst,
+ RlcDlRrcMsgRsp *dlRrcMsgRsp));
+
/* Pack/Unpack function declarations */
uint8_t packDuRlcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
uint8_t unpackRlcUeCreateReq(DuRlcUeCreateReq func, Pst *pst, Buffer *mBuf);
uint8_t unpackRrcDeliveryReportToDu(RlcRrcDeliveryReportToDuFunc func,Pst *pst, Buffer *mBuf);
uint8_t packDuRlcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg);
uint8_t unpackRlcUeReconfigReq(DuRlcUeReconfigReq func, Pst *pst, Buffer *mBuf);
+uint8_t packRlcDlRrcMsgRspToDu(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsgRsp);
+uint8_t unpackRlcDlRrcMsgRspToDu(RlcDlRrcMsgRspToDuFunc func, Pst *pst, Buffer *mBuf);
+
/* Event Handler function declarations */
uint8_t RlcProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo);
uint8_t DuProcRlcRrcDeliveryReport(Pst *pst, RrcDeliveryReport *rrcDeliveryReport);
uint8_t RlcProcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg);
+uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg);
#endif /* RLC_INF_H */
uint8_t *pduBuf; /*!< RLC PDU buffer */
}RlcPduInfo;
-typedef struct rlcMacData
+typedef struct rlcData
{
// add slot info
- uint16_t cellId; /*!< CELL ID */
- uint16_t rnti; /*!< Temporary CRNTI */
- SlotIndInfo slotInfo; /*!< Timing info */
- uint8_t numPdu; /*!< Number of RLC PDUs */
- RlcPduInfo pduInfo[MAX_NUM_PDU];
+ uint16_t cellId; /*!< CELL ID */
+ uint16_t rnti; /*!< Temporary CRNTI */
+ SlotIndInfo slotInfo; /*!< Timing info */
+ uint8_t numPdu; /*!< Number of RLC PDUs */
+ RlcPduInfo pduInfo[MAX_NUM_PDU];
}RlcData;
/* Function pointers */
case UE_CONTEXT_SETUP_REQ:
rrcMsgType = UE_CONTEXT_SETUP_REQ;
break;
+ case SECURITY_MODE_COMPLETE:
+ rrcMsgType = SECURITY_MODE_COMPLETE;
+ break;
case RRC_RECONFIG:
rrcMsgType = RRC_RECONFIG;
break;
rrcMsgType = setDlRRCMsgType();
if(rrcMsgType == REGISTRATION_ACCEPT)
{
- DU_LOG("\nSending DL RRC MSG for RRC Registration Complete");
+ DU_LOG("\nF1AP: Sending DL RRC MSG for RRC Registration Accept");
ret = BuildAndSendDLRRCMessageTransfer(srbId, rrcMsgType);
}
if(rrcMsgType == UE_CONTEXT_SETUP_REQ)
{
- DU_LOG("\nSending Ue Context Setup Req");
+ DU_LOG("\nF1AP: Sending Ue Context Setup Req");
ret = BuildAndSendUeContextSetupReq(cuUeF1apId, duUeF1apId,\
rrcContLen, rrcContainer);
}
+ if(rrcMsgType == SECURITY_MODE_COMPLETE)
+ {
+ /* To trigger the DL RRC Msg for RRC Reconfig */
+ f1apMsgDb.dlRrcMsgCount++;
+ rrcMsgType = setDlRRCMsgType();
+ if(rrcMsgType == RRC_RECONFIG)
+ {
+ DU_LOG("\nF1AP: Sending DL RRC MSG for RRC Reconfig");
+ BuildAndSendDLRRCMessageTransfer(srbId, rrcMsgType);
+ }
+ }
}
return ret;
}
}
case SuccessfulOutcome__value_PR_UEContextSetupResponse:
{
- uint8_t rrcMsgType;
-
DU_LOG("\nF1AP : UE ContextSetupResponse received");
- f1apMsgDb.dlRrcMsgCount++;
- rrcMsgType = setDlRRCMsgType();
- if(rrcMsgType == RRC_RECONFIG)
- {
- DU_LOG("\nImplementing DL RRC MSG for RRC Reconfig Complete");
- BuildAndSendDLRRCMessageTransfer(SRB1, rrcMsgType);
- }
+ f1apMsgDb.dlRrcMsgCount++; /* keeping DL RRC Msg Count */
break;
}
default:
#define RRC_SETUP 1
#define REGISTRATION_ACCEPT 2
#define UE_CONTEXT_SETUP_REQ 3
-#define RRC_RECONFIG 4
+#define UE_CONTEXT_SETUP_RSP 4
+#define SECURITY_MODE_COMPLETE 5
+#define RRC_RECONFIG 6
typedef struct f1apDb
{
uint8_t dlRrcMsgCount;
}
freeDuUeCfg(&f1UeDb->duUeCfg);
memset(f1UeDb, 0, sizeof(F1UeContextSetupDb));
+ DU_FREE(f1UeDb, sizeof(F1UeContextSetupDb));
}
/*******************************************************************
choice.DUtoCURRCInformation.cellGroupConfig, cellGrpCfg);
/* Free UeContext Db created during Ue context Req */
freeF1UeDb(ueCb->f1UeDb);
+ ueCb->f1UeDb = NULLP;
}
}
else
ret = unpackRrcDeliveryReportToDu(DuProcRlcRrcDeliveryReport, pst, mBuf);
break;
}
+ case EVENT_DL_RRC_MSG_RSP_TO_DU:
+ {
+ ret = unpackRlcDlRrcMsgRspToDu(DuProcRlcDlRrcMsgRsp, pst, mBuf);
+ break;
+ }
default:
{
DU_LOG("\nDU_APP : Invalid event %d received at duActvTsk from ENTRLC", \
return ret;
}
+
+
/*******************************************************************
*
* @brief Builds and Send Ue Reconfig Req to RLC
return ret;
}
+/*******************************************************************
+ *
+ * @brief Build and Send Ue context setup request
+ *
+ * @details
+ *
+
+ * Function : duBuildAndSendUeContextSetupReq
+ *
+ * Functionality:
+ * Build and Send Ue context setup request
+ *
+ * @params[in] cellId, crnti, DuUeCfg pointer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ *****************************************************************/
+
+uint8_t duBuildAndSendUeContextSetupReq(uint16_t cellId, uint16_t crnti, DuUeCfg *duUeCfg)
+{
+ uint8_t ret = ROK;
+
+ DU_LOG("\nDU_APP: Processing Ue Context Setup Request for cellId [%d]", cellId);
+ /* Filling RLC Ue Reconfig */
+ ret = duBuildAndSendUeReCfgReqToRlc(cellId, crnti, duUeCfg);
+ if(ret == RFAILED)
+ DU_LOG("\nDU_APP: Failed to build ctxt setup req for RLC at duBuildAndSendUeContextSetupReq()");
+
+ /* Filling MAC Ue Reconfig */
+ ret = duBuildAndSendUeReCfgReqToMac(cellId, crnti, duUeCfg);
+ if(ret == RFAILED)
+ DU_LOG("\nDU_APP: Failed at build ctxt setup req for MAC at duBuildAndSendUeContextSetupReq()");
+
+ return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Processes DL Rsp received from RLC DL
+ *
+ * @details
+ *
+
+ * Function : DuProcRlcDlRrcMsgRsp
+ *
+ * Functionality:
+ * Processes UE Rsp received from RLC DL
+ *
+ * @params[in] Post structure
+ * Pointer to RlcCfgCfm
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ *****************************************************************/
+uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg)
+{
+ uint8_t ret = ROK, ueIdx = 0;
+ DuUeCb *ueCb = NULLP;
+
+ if(dlRrcMsg->state == TRANSMISSION_COMPLETE)
+ {
+ GET_UE_IDX(dlRrcMsg->crnti, ueIdx);
+ ueCb = &duCb.actvCellLst[dlRrcMsg->cellId -1]->ueCb[ueIdx -1];
+ if(ueCb->f1UeDb)
+ {
+ ret = duBuildAndSendUeContextSetupReq(dlRrcMsg->cellId, dlRrcMsg->crnti, &ueCb->f1UeDb->duUeCfg);
+ if(ret == RFAILED)
+ DU_LOG("\nDUAPP: Failed to process UE Context Setup Request in DuProcRlcDlRrcMsgRsp()");
+ }
+ }
+ else
+ DU_LOG("\nDUAPP: Failed to transmit DL RRC Msg");
+
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlRrcMsg, sizeof(RlcDlRrcMsgRsp));
+ return ret;
+}
/*******************************************************************
*
* @brief Process UE context setup request from CU
}
}
}
- if(ret == ROK)
+ else
{
- DU_LOG("\nDU_APP: Processing Ue Context Setup Request for cellId [%d]", cellId);
- /* Filling RLC Ue Reconfig */
- ret = duBuildAndSendUeReCfgReqToRlc(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
- if(ret == RFAILED)
- DU_LOG("\nDU_APP: Failed to build ctxt setup req for RLC at duBuildAndSendUeReCfgReqToRlc()");
-
- /* Filling MAC Ue Reconfig */
- ret = duBuildAndSendUeReCfgReqToMac(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
- if(ret == RFAILED)
- DU_LOG("\nDU_APP: Failed at build ctxt setup req for MAC at duBuildAndSendUeReCfgReqToMac()");
+ ret = duBuildAndSendUeContextSetupReq(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
+ if(ret == RFAILED)
+ {
+ DU_LOG("\nDU APP : Failed to build ue context setup Req in duProcUeContextSetupRequest()");
+ }
}
}
else
}
case MSG_TYPE_RRC_RECONFIG_COMPLETE:
{
- DU_LOG("\nPHY_STUB: Forming RRC RECONFIGURATION PDU");
+ DU_LOG("\nPHY_STUB: Forming RRC RECONFIGURATION COMPLETE PDU");
uint8_t pduLen = 14;
/* For rrc reconfig complete where RRC Container is dummy
MAC subheader format is R/F/LCId/L (2/3 bytes)