From: Balaji Shankaran Date: Wed, 23 Sep 2020 10:03:08 +0000 (+0530) Subject: RLC BO, BO response and DL Data handlingi [Issue-ID: ODUHIGH-181] X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F80%2F4780%2F5;p=o-du%2Fl2.git RLC BO, BO response and DL Data handlingi [Issue-ID: ODUHIGH-181] Change-Id: Id82e815c89a404682d18cf3bf73a874489b90f62 Signed-off-by: Balaji Shankaran Signed-off-by: balajihands --- diff --git a/docs/README b/docs/README index 3a0bf8a2c..c8ba9eb11 100644 --- a/docs/README +++ b/docs/README @@ -24,7 +24,10 @@ Pre-requisite for Compilation : 2. GCC version 4.6.3 and above 3. Install LKSCTP a. On Ubuntu : sudo apt-get install -y libsctp-dev - b. On CentOS : yum install lksctp-tools + b. On CentOS : yum install lksctp-tools-devel +4. Install PCAP: + a. On ubuntu : sudo apt-get install -y libpcap-dev + b. On CentOS : yum install libpcap-devel How to Clean and Build: diff --git a/src/5gnrmac/lwr_mac_fsm.c b/src/5gnrmac/lwr_mac_fsm.c index 175119005..9b17c836d 100644 --- a/src/5gnrmac/lwr_mac_fsm.c +++ b/src/5gnrmac/lwr_mac_fsm.c @@ -2523,7 +2523,7 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo) * ******************************************************************/ void fillMsg4DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *msg4PdcchInfo,\ - Msg4Info *msg4Info) + DlMsgInfo *msg4Info) { if(dlDciPtr != NULLP) { @@ -2678,6 +2678,178 @@ void fillMsg4DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *msg4PdcchInfo,\ } } /* fillMsg4DlDciPdu */ +/******************************************************************* + * + * @brief fills msg4 Dl DCI PDU required for DL TTI info in MAC + * + * @details + * + * Function : fillMsg4DlDciPdu + * + * Functionality: + * -Fills the Msg4 Dl DCI PDU + * + * @params[in] Pointer to fapi_dl_dci_t + * Pointer to PdcchCfg + * @return ROK + * + ******************************************************************/ +void fillDlDedMsgDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *dedMsgPdcchInfo,\ + DlMsgInfo *dedMsgInfo) +{ + if(dlDciPtr != NULLP) + { + uint8_t numBytes; + uint8_t bytePos; + uint8_t bitPos; + + uint16_t coresetSize = 0; + uint16_t rbStart = 0; + uint16_t rbLen = 0; + uint8_t dciFormatId; + uint32_t freqDomResAssign; + uint8_t timeDomResAssign; + uint8_t VRB2PRBMap; + uint8_t modNCodScheme; + uint8_t ndi = 0; + uint8_t redundancyVer = 0; + uint8_t harqProcessNum = 0; + uint8_t dlAssignmentIdx = 0; + uint8_t pucchTpc = 0; + uint8_t pucchResoInd = 0; + uint8_t harqFeedbackInd = 0; + + /* Size(in bits) of each field in DCI format 1_0 */ + uint8_t dciFormatIdSize = 1; + uint8_t freqDomResAssignSize; + uint8_t timeDomResAssignSize = 4; + uint8_t VRB2PRBMapSize = 1; + uint8_t modNCodSchemeSize = 5; + uint8_t ndiSize = 1; + uint8_t redundancyVerSize = 2; + uint8_t harqProcessNumSize = 4; + uint8_t dlAssignmentIdxSize = 2; + uint8_t pucchTpcSize = 2; + uint8_t pucchResoIndSize = 3; + uint8_t harqFeedbackIndSize = 3; + + dlDciPtr->rnti = dedMsgPdcchInfo->dci.rnti; + dlDciPtr->scramblingId = dedMsgPdcchInfo->dci.scramblingId; + dlDciPtr->scramblingRnti = dedMsgPdcchInfo->dci.scramblingRnti; + dlDciPtr->cceIndex = dedMsgPdcchInfo->dci.cceIndex; + dlDciPtr->aggregationLevel = dedMsgPdcchInfo->dci.aggregLevel; + dlDciPtr->pc_and_bform.numPrgs = dedMsgPdcchInfo->dci.beamPdcchInfo.numPrgs; + dlDciPtr->pc_and_bform.prgSize = dedMsgPdcchInfo->dci.beamPdcchInfo.prgSize; + dlDciPtr->pc_and_bform.digBfInterfaces = dedMsgPdcchInfo->dci.beamPdcchInfo.digBfInterfaces; + dlDciPtr->pc_and_bform.pmi_bfi[0].pmIdx = dedMsgPdcchInfo->dci.beamPdcchInfo.prg[0].pmIdx; + dlDciPtr->pc_and_bform.pmi_bfi[0].beamIdx[0].beamidx = dedMsgPdcchInfo->dci.beamPdcchInfo.prg[0].beamIdx[0]; + dlDciPtr->beta_pdcch_1_0 = dedMsgPdcchInfo->dci.txPdcchPower.powerValue; + dlDciPtr->powerControlOfssetSS = dedMsgPdcchInfo->dci.txPdcchPower.powerControlOffsetSS; + + /* Calculating freq domain resource allocation field value and size + * coreset0Size = Size of coreset 0 + * RBStart = Starting Virtual Rsource block + * RBLen = length of contiguously allocted RBs + * Spec 38.214 Sec 5.1.2.2.2 + */ + + /* TODO: Fill values of coresetSize, rbStart and rbLen */ + coresetSize = dedMsgPdcchInfo->coreset0Cfg.coreSetSize; + rbStart = dedMsgPdcchInfo->dci.pdschCfg->pdschFreqAlloc.freqAlloc.startPrb; + rbLen = dedMsgPdcchInfo->dci.pdschCfg->pdschFreqAlloc.freqAlloc.numPrb; + + if((rbLen >=1) && (rbLen <= coresetSize - rbStart)) + { + if((rbLen - 1) <= floor(coresetSize / 2)) + freqDomResAssign = (coresetSize * (rbLen-1)) + rbStart; + else + freqDomResAssign = (coresetSize * (coresetSize - rbLen + 1)) \ + + (coresetSize - 1 - rbStart); + + freqDomResAssignSize = ceil(log2(coresetSize * (coresetSize + 1) / 2)); + } + + /* Fetching DCI field values */ + dciFormatId = dedMsgInfo->dciFormatId;; /* Always set to 1 for DL */ + timeDomResAssign = dedMsgPdcchInfo->dci.pdschCfg->pdschTimeAlloc.rowIndex -1; + VRB2PRBMap = dedMsgPdcchInfo->dci.pdschCfg->pdschFreqAlloc.vrbPrbMapping; + modNCodScheme = dedMsgPdcchInfo->dci.pdschCfg->codeword[0].mcsIndex; + ndi = dedMsgInfo->ndi; + redundancyVer = dedMsgPdcchInfo->dci.pdschCfg->codeword[0].rvIndex; + harqProcessNum = dedMsgInfo->harqProcNum; + dlAssignmentIdx = dedMsgInfo->dlAssignIdx; + pucchTpc = dedMsgInfo->pucchTpc; + pucchResoInd = dedMsgInfo->pucchResInd; + harqFeedbackInd = dedMsgInfo->harqFeedbackInd; + + /* Reversing bits in each DCI field */ + dciFormatId = reverseBits(dciFormatId, dciFormatIdSize); + freqDomResAssign = reverseBits(freqDomResAssign, freqDomResAssignSize); + timeDomResAssign = reverseBits(timeDomResAssign, timeDomResAssignSize); + VRB2PRBMap = reverseBits(VRB2PRBMap, VRB2PRBMapSize); + modNCodScheme = reverseBits(modNCodScheme, modNCodSchemeSize); + ndi = reverseBits(ndi, ndiSize); + redundancyVer = reverseBits(redundancyVer, redundancyVerSize); + harqProcessNum = reverseBits(harqProcessNum, harqProcessNumSize); + dlAssignmentIdx = reverseBits(dlAssignmentIdx , dlAssignmentIdxSize); + pucchTpc = reverseBits(pucchTpc, pucchTpcSize); + pucchResoInd = reverseBits(pucchResoInd, pucchResoIndSize); + harqFeedbackInd = reverseBits(harqFeedbackInd, harqFeedbackIndSize); + + + /* Calulating total number of bytes in buffer */ + dlDciPtr->payloadSizeBits = (dciFormatIdSize + freqDomResAssignSize\ + + timeDomResAssignSize + VRB2PRBMapSize + modNCodSchemeSize\ + + ndiSize + redundancyVerSize + harqProcessNumSize + dlAssignmentIdxSize\ + + pucchTpcSize + pucchResoIndSize + harqFeedbackIndSize); + + numBytes = dlDciPtr->payloadSizeBits / 8; + if(dlDciPtr->payloadSizeBits % 8) + numBytes += 1; + + if(numBytes > FAPI_DCI_PAYLOAD_BYTE_LEN) + { + DU_LOG("\nLWR_MAC : Total bytes for DCI is more than expected"); + return; + } + + /* Initialize buffer */ + for(bytePos = 0; bytePos < numBytes; bytePos++) + dlDciPtr->payload[bytePos] = 0; + + bytePos = numBytes - 1; + bitPos = 0; + + /* Packing DCI format fields */ + fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + dciFormatId, dciFormatIdSize); + fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + freqDomResAssign, freqDomResAssignSize); + fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + timeDomResAssign, timeDomResAssignSize); + fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + VRB2PRBMap, VRB2PRBMapSize); + fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + modNCodScheme, modNCodSchemeSize); + fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + ndi, ndiSize); + fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + redundancyVer, redundancyVerSize); + fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + redundancyVer, redundancyVerSize); + fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + harqProcessNum, harqProcessNumSize); + fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + dlAssignmentIdx, dlAssignmentIdxSize); + fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + pucchTpc, pucchTpcSize); + fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + pucchResoInd, pucchResoIndSize); + fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + harqFeedbackInd, harqFeedbackIndSize); + } +} + /******************************************************************* * * @brief fills PDCCH PDU required for DL TTI info in MAC @@ -2723,6 +2895,13 @@ uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlSchedInfo *dlInfo, \ fillMsg4DlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo,\ &dlInfo->msg4Alloc->msg4Info); } + else if(rntiType == C_RNTI_TYPE) + { + pdcchInfo = &dlInfo->dlMsgAlloc->dlMsgPdcchCfg; + bwp = &dlInfo->dlMsgAlloc->bwp; + fillDlDedMsgDlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo,\ + &dlInfo->dlMsgAlloc->dedMsgInfo); + } else { DU_LOG("\nLWR_MAC: Failed filling PDCCH Pdu"); @@ -2877,7 +3056,11 @@ uint8_t calcDlTtiReqPduCount(DlSchedInfo *dlInfo) /* PDCCH and PDSCH PDU is filled */ count += 2; } - + if(dlInfo->dlMsgAlloc != NULLP) + { + /* PDCCH and PDSCH PDU is filled */ + count += 2; + } return count; } @@ -2912,7 +3095,10 @@ uint8_t calcTxDataReqPduCount(DlSchedInfo *dlInfo) { count++; } - + if(dlInfo->dlMsgAlloc != NULLP) + { + count++; + } return count; } /*********************************************************************** @@ -3033,13 +3219,13 @@ uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, RarInfo *rarInfo, * - fills the Msg4 TX-DATA request message * * @params[in] fapi_tx_pdu_desc_t *pduDesc - * @params[in] Msg4Info *msg4Info + * @params[in] DlMsgInfo *msg4Info * @params[in] uint32_t *msgLen * @params[in] uint16_t pduIndex * @return ROK * * ********************************************************************/ -uint8_t fillMsg4TxDataReq(fapi_tx_pdu_desc_t *pduDesc, Msg4Info *msg4Info, +uint8_t fillMsg4TxDataReq(fapi_tx_pdu_desc_t *pduDesc, DlMsgInfo *msg4Info, uint16_t pduIndex) { uint32_t pduLen = 0; @@ -3051,13 +3237,13 @@ uint8_t fillMsg4TxDataReq(fapi_tx_pdu_desc_t *pduDesc, Msg4Info *msg4Info, /* fill the TLV */ /* as of now, memory is allocated from SSI, later WLS memory needs to be taken */ pduDesc[pduIndex].tlvs[0].tl.tag = 1; /* pointer to be sent */ - pduDesc[pduIndex].tlvs[0].tl.length = msg4Info->msg4PduLen; - LWR_MAC_ALLOC(msg4TxDataValue, msg4Info->msg4PduLen); + pduDesc[pduIndex].tlvs[0].tl.length = msg4Info->dlMsgPduLen; + LWR_MAC_ALLOC(msg4TxDataValue, msg4Info->dlMsgPduLen); if(msg4TxDataValue == NULLP) { return RFAILED; } - memcpy(msg4TxDataValue, msg4Info->msg4Pdu, msg4Info->msg4PduLen); + memcpy(msg4TxDataValue, msg4Info->dlMsgPdu, msg4Info->dlMsgPduLen); pduDesc[pduIndex].tlvs[0].value = msg4TxDataValue; /* The total length of the PDU description and PDU data */ @@ -3069,12 +3255,67 @@ uint8_t fillMsg4TxDataReq(fapi_tx_pdu_desc_t *pduDesc, Msg4Info *msg4Info, * But since we did not implement WLS, this has to be done here */ #ifndef INTEL_WLS - MAC_FREE(msg4TxDataValue, msg4Info->msg4PduLen); + MAC_FREE(msg4TxDataValue, msg4Info->dlMsgPduLen); #endif return ROK; } +/*********************************************************************** + * + * @brief fills the DL dedicated Msg TX-DATA request message + * + * @details + * + * Function : fillDlDedMsgTxDataReq + * + * Functionality: + * - fills the Dl Dedicated Msg TX-DATA request message + * + * @params[in] fapi_tx_pdu_desc_t *pduDesc + * @params[in] DlMsgInfo *dedMsgInfo + * @params[in] uint32_t *msgLen + * @params[in] uint16_t pduIndex + * @return ROK + * + * ********************************************************************/ +uint8_t fillDlDedMsgTxDataReq(fapi_tx_pdu_desc_t *pduDesc, DlMsgInfo *dedMsgInfo, + uint16_t pduIndex) +{ + uint32_t pduLen = 0; + uint8_t *dedMsgTxDataValue = NULLP; + + pduDesc[pduIndex].pdu_index = pduIndex; + pduDesc[pduIndex].num_tlvs = 1; + + /* fill the TLV */ + /* as of now, memory is allocated from SSI, later WLS memory needs to be taken */ + pduDesc[pduIndex].tlvs[0].tl.tag = 1; /* pointer to be sent */ + pduDesc[pduIndex].tlvs[0].tl.length = dedMsgInfo->dlMsgPduLen; + LWR_MAC_ALLOC(dedMsgTxDataValue, dedMsgInfo->dlMsgPduLen); + if(dedMsgTxDataValue == NULLP) + { + return RFAILED; + } + memcpy(dedMsgTxDataValue, dedMsgInfo->dlMsgPdu, dedMsgInfo->dlMsgPduLen); + pduDesc[pduIndex].tlvs[0].value = dedMsgTxDataValue; + + /* The total length of the PDU description and PDU data */ + pduLen += 8; /* size of PDU length 2 bytes, PDU index 2 bytes, numTLV 4 bytes */ + pduLen += sizeof(fapi_uint8_ptr_tlv_t); /* only 1 TLV is present */ + pduDesc[pduIndex].pdu_length = pduLen; + + /* TODO: The pointer value which was stored, needs to be free-ed at PHY * + * But since we did not implement WLS, this has to be done here + */ +#ifndef INTEL_WLS + MAC_FREE(dedMsgTxDataValue, dedMsgInfo->dlMsgPduLen); +#endif + + return ROK; +} + + #endif /* FAPI */ /******************************************************************* * @@ -3190,6 +3431,8 @@ uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo) } if(currDlSlot->dlInfo.msg4Alloc != NULLP) { + DU_LOG("\nLWR_MAC: Current slot %d, Msg4 slot %d ********", currTimingInfo.slot, + dlTtiReqTimingInfo.slot); /* Filling Msg4 param */ rntiType = TC_RNTI_TYPE; fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \ @@ -3206,6 +3449,27 @@ uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo) DU_LOG("\nLWR_MAC: MSG4 sent..."); printf("\033[0m"); } + + if(currDlSlot->dlInfo.dlMsgAlloc != NULLP) + { + DU_LOG("\nLWR_MAC: Current slot %d, DL MSG slot %d ********", currTimingInfo.slot, + dlTtiReqTimingInfo.slot); + /* Filling DL Dedicated message info */ + rntiType = C_RNTI_TYPE; + fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \ + &currDlSlot->dlInfo, rntiType, CORESET_TYPE1); + numPduEncoded++; + fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], + &currDlSlot->dlInfo.dlMsgAlloc->dlMsgPdschCfg, + currDlSlot->dlInfo.dlMsgAlloc->bwp, + pduIndex); + numPduEncoded++; + pduIndex++; + + printf("\033[1;32m"); + DU_LOG("\nLWR_MAC: DL DED MSG sent..."); + printf("\033[0m"); + } msgLen = sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t); fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen); LwrMacSendToPhy(dlTtiReq->header.msg_id, sizeof(fapi_dl_tti_req_t), \ @@ -3282,7 +3546,11 @@ uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo) } if(dlInfo->msg4Alloc != NULLP) { - txDataReqMsgSize += dlInfo->msg4Alloc->msg4Info.msg4PduLen; + txDataReqMsgSize += dlInfo->msg4Alloc->msg4Info.dlMsgPduLen; + } + if(dlInfo->dlMsgAlloc != NULLP) + { + txDataReqMsgSize += dlInfo->dlMsgAlloc->dedMsgInfo.dlMsgPduLen; } LWR_MAC_ALLOC(txDataReq, txDataReqMsgSize); @@ -3311,19 +3579,33 @@ uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo) MAC_FREE(dlInfo->rarAlloc,sizeof(RarAlloc)); dlInfo->rarAlloc = NULLP; } - if(dlInfo->msg4Alloc != NULLP && dlInfo->msg4Alloc->msg4Info.msg4Pdu != NULLP) + if(dlInfo->msg4Alloc != NULLP && dlInfo->msg4Alloc->msg4Info.dlMsgPdu != NULLP) { fillMsg4TxDataReq(txDataReq->pdu_desc, &dlInfo->msg4Alloc->\ msg4Info, pduIndex); pduIndex++; txDataReq->num_pdus++; - MAC_FREE(dlInfo->msg4Alloc->msg4Info.msg4Pdu,\ - dlInfo->msg4Alloc->msg4Info.msg4PduLen); - dlInfo->msg4Alloc->msg4Info.msg4Pdu = NULLP; + MAC_FREE(dlInfo->msg4Alloc->msg4Info.dlMsgPdu,\ + dlInfo->msg4Alloc->msg4Info.dlMsgPduLen); + dlInfo->msg4Alloc->msg4Info.dlMsgPdu = NULLP; MAC_FREE(dlInfo->msg4Alloc,sizeof(Msg4Alloc)); dlInfo->msg4Alloc = NULLP; } + if(dlInfo->dlMsgAlloc != NULLP && dlInfo->dlMsgAlloc->dedMsgInfo.dlMsgPdu != NULLP) + { + fillDlDedMsgTxDataReq(txDataReq->pdu_desc, \ + &dlInfo->dlMsgAlloc->dedMsgInfo, pduIndex); + pduIndex++; + txDataReq->num_pdus++; + + MAC_FREE(dlInfo->dlMsgAlloc->dedMsgInfo.dlMsgPdu,\ + dlInfo->dlMsgAlloc->dedMsgInfo.dlMsgPduLen); + dlInfo->dlMsgAlloc->dedMsgInfo.dlMsgPdu = NULLP; + MAC_FREE(dlInfo->dlMsgAlloc, sizeof(DlMsgAlloc)); + dlInfo->dlMsgAlloc = NULLP; + } + msgLen = txDataReqMsgSize - sizeof(fapi_msg_t); fillMsgHeader(&txDataReq->header, FAPI_TX_DATA_REQUEST, msgLen); LwrMacSendToPhy(txDataReq->header.msg_id, txDataReqMsgSize, \ diff --git a/src/5gnrmac/lwr_mac_fsm.h b/src/5gnrmac/lwr_mac_fsm.h index 14aa322ec..43a91ce84 100644 --- a/src/5gnrmac/lwr_mac_fsm.h +++ b/src/5gnrmac/lwr_mac_fsm.h @@ -32,7 +32,8 @@ typedef enum{ SI_RNTI_TYPE, RA_RNTI_TYPE, - TC_RNTI_TYPE + TC_RNTI_TYPE, + C_RNTI_TYPE }RntiType; uint8_t lwr_mac_procInvalidEvt(void *msg); diff --git a/src/5gnrmac/mac.h b/src/5gnrmac/mac.h index 88eeb8725..54a9a3033 100644 --- a/src/5gnrmac/mac.h +++ b/src/5gnrmac/mac.h @@ -95,9 +95,9 @@ typedef enum typedef enum { - LC_STATE_INACTIVE, - LC_STATE_ACTIVE -}LcState; + MAC_LC_STATE_INACTIVE, + MAC_LC_STATE_ACTIVE +}MacLcState; typedef struct macDlSlot { @@ -164,14 +164,14 @@ typedef struct ulLcCb { uint8_t lcId; /* Logical Channel Id */ uint8_t lcGrpId; /* Logical Channel group */ - LcState lcActive; /* Is LC active ? */ + MacLcState lcActive; /* Is LC active ? */ }UlLcCb; /* Downlink dedicated logical channel info */ typedef struct dlLcCb { uint8_t lcId; /* Logical channel Id */ - LcState lcState; /* Is LC active ? */ + MacLcState lcState; /* Is LC active ? */ }DlLcCb; /* BSR Information */ @@ -232,9 +232,11 @@ typedef struct macCb /* global variable */ MacCb macCb; + +/* Function declarations */ void fillRarPdu(RarInfo *rarInfo); -void createMacRaCb(uint16_t cellId, uint16_t crnti); -void fillMsg4DlData(uint16_t cellId, MacDlData *dlData, uint8_t *msg4Pdu); +void createMacRaCb(RachIndInfo *rachIndInfo); +void fillMsg4DlData(MacDlData *dlData, uint16_t msg4PduLen, uint8_t *msg4Pdu); void fillMacCe(MacCeInfo *macCeData, uint8_t *msg3Pdu); void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *msg4TxPdu, uint16_t tbSize); uint8_t unpackRxData(uint16_t cellId, SlotIndInfo slotInfo, RxDataIndPdu *rxDataIndPdu); @@ -244,6 +246,7 @@ uint8_t macProcUlCcchInd(uint16_t cellId, uint16_t crnti, uint16_t rrcContSize, uint8_t macProcShortBsr(uint16_t cellId, uint16_t crnti, uint8_t lcgId, uint32_t bufferSize); uint8_t macProcUlData(uint16_t cellId, uint16_t rnti, SlotIndInfo slotInfo, \ uint8_t lcId, uint16_t pduLen, uint8_t *pdu); +uint8_t sendSchedResultRptToRlc(DlSchedInfo dlInfo, SlotIndInfo slotInfo); #endif /********************************************************************** End of file diff --git a/src/5gnrmac/mac_cfg_hdl.c b/src/5gnrmac/mac_cfg_hdl.c index d03bbdd89..bb72bcaf2 100644 --- a/src/5gnrmac/mac_cfg_hdl.c +++ b/src/5gnrmac/mac_cfg_hdl.c @@ -20,17 +20,17 @@ #include "common_def.h" #include "lrg.h" #include "lrg.x" -#include "rgu.h" -#include "rgu.x" #include "du_app_mac_inf.h" #include "mac_sch_interface.h" #include "lwr_mac_upr_inf.h" #include "mac.h" +#include "rlc_mac_inf.h" #include "mac_upr_inf_api.h" #include "lwr_mac.h" #include "lwr_mac_fsm.h" #include "mac_utils.h" +extern uint16_t gCrntiCount; uint8_t MacSchCellCfgReq(Pst *pst, MacCellCfg *macCellCfg); packMacCellCfgConfirm packMacCellCfmOpts[] = @@ -147,6 +147,9 @@ uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg) memcpy(macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1Pdu, macCellCfg->sib1Cfg.sib1Pdu, \ macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1PduLen); + /* Initializing global variable */ + gCrntiCount = ODU_START_CRNTI; + /* Send cell cfg to scheduler */ ret = MacSchCellCfgReq(pst, macCellCfg); if(ret != ROK) diff --git a/src/5gnrmac/mac_demux.c b/src/5gnrmac/mac_demux.c index fe6198bbd..4c26eb457 100644 --- a/src/5gnrmac/mac_demux.c +++ b/src/5gnrmac/mac_demux.c @@ -47,6 +47,7 @@ extern uint32_t shortBsrBytesTable[MAX_SHORT_BSR_TABLE_ENTRIES]; * ****************************************************************/ uint8_t unpackRxData(uint16_t cellId, SlotIndInfo slotInfo, RxDataIndPdu *rxDataIndPdu) { + uint8_t ueIdx; /* Iterator for UE list */ uint8_t lcId; /* LC ID of a sub pdu */ uint8_t fBit = 0; /* Value of F Bit in MAC sub-header */ uint8_t idx = 0; /* Iterator for received PDU */ @@ -92,7 +93,8 @@ uint8_t unpackRxData(uint16_t cellId, SlotIndInfo slotInfo, RxDataIndPdu *rxData idx = idx + length; /* store msg3 pdu in macRaCb for CRI value */ - memcpy(macCb.macCell[cellIdx]->macRaCb[0].msg3Pdu, pdu, length); + GET_UE_IDX(rxDataIndPdu->rnti, ueIdx); + memcpy(macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg3Pdu, pdu, length); /* Send UL-CCCH Indication to DU APP */ ret = macProcUlCcchInd(macCb.macCell[cellIdx]->cellId, rxDataIndPdu->rnti, length, pdu); diff --git a/src/5gnrmac/mac_msg_hdl.c b/src/5gnrmac/mac_msg_hdl.c index 821088002..3de60e3f4 100644 --- a/src/5gnrmac/mac_msg_hdl.c +++ b/src/5gnrmac/mac_msg_hdl.c @@ -19,11 +19,10 @@ /* header include files -- defines (.h) */ #include "common_def.h" #include "lrg.h" -#include "rgu.h" #include "lrg.x" -#include "rgu.x" #include "du_app_mac_inf.h" #include "mac_sch_interface.h" +#include "rlc_mac_inf.h" #include "mac_upr_inf_api.h" #include "lwr_mac.h" #ifdef INTEL_FAPI @@ -39,7 +38,10 @@ extern MacCb macCb; extern void sendToLowerMac(uint16_t msgType, uint32_t msgLen, void *msg); -uint16_t buildMacPdu(RlcMacData *dlData); +uint16_t buildMacPdu(RlcData *dlData); +#ifdef EGTP_TEST +void macStubBuildUlData(Buffer *mBuf); +#endif /* Function pointer for sending crc ind from MAC to SCH */ MacSchCrcIndFunc macSchCrcIndOpts[]= @@ -89,7 +91,7 @@ MacSchSrUciIndFunc macSchSrUciIndOpts[]= * RFAILED - failure * ****************************************************************/ -uint8_t sendDlRlcBoInfoMacToSch(DlRlcBOInfo *dlBoInfo) +uint8_t sendDlRlcBoInfoMacToSch(DlRlcBoInfo *dlBoInfo) { Pst pst; @@ -196,7 +198,7 @@ uint8_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd) * * @details * - * Function : MacRlcProcDlData + * Function : MacProcRlcDlData * * Functionality: * Processes DL data from RLC @@ -207,8 +209,41 @@ uint8_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd) * RFAILED - failure * * ****************************************************************/ -uint16_t MacRlcProcDlData(Pst* pst, SpId spId, RlcMacData *dlData) +uint8_t MacProcRlcDlData(Pst* pstInfo, RlcData *dlData) { + uint8_t pduIdx; + MacDlSlot *currDlSlot = NULLP; + + DU_LOG("\nMAC: Received DL data for sfn %d slot %d", \ + dlData->slotInfo.sfn, dlData->slotInfo.slot); + + /* Store DL data in the scheduled slot */ + currDlSlot = &macCb.macCell[dlData->cellId -1]->dlSlot[dlData->slotInfo.slot]; + if(currDlSlot) + { + currDlSlot->dlInfo.dlMsgAlloc->dedMsgInfo.dlMsgPduLen = dlData->pduInfo[0].pduLen; + MAC_ALLOC(currDlSlot->dlInfo.dlMsgAlloc->dedMsgInfo.dlMsgPdu, \ + dlData->pduInfo[0].pduLen); + if(!currDlSlot->dlInfo.dlMsgAlloc->dedMsgInfo.dlMsgPdu) + { + DU_LOG("\nMAC : Memory allocation failed in MacProcRlcDlData"); + return RFAILED; + } + memcpy(currDlSlot->dlInfo.dlMsgAlloc->dedMsgInfo.dlMsgPdu, dlData->pduInfo[0].pduBuf,\ + dlData->pduInfo[0].pduLen); + } + + /* Free memory */ + for(pduIdx = 0; pduIdx < dlData->numPdu; pduIdx++) + { + MAC_FREE_SHRABL_BUF(pstInfo->region, pstInfo->pool, dlData->pduInfo[pduIdx].pduBuf,\ + dlData->pduInfo[pduIdx].pduLen); + } + if(pstInfo->selector == ODU_SELECTOR_LWLC) + { + MAC_FREE_SHRABL_BUF(pstInfo->region, pstInfo->pool, dlData, sizeof(RlcData)); + } + return ROK; } @@ -236,16 +271,16 @@ uint8_t macProcUlData(uint16_t cellId, uint16_t rnti, SlotIndInfo slotInfo, \ uint8_t lcId, uint16_t pduLen, uint8_t *pdu) { Pst pst; - RlcMacData *ulData; + RlcData *ulData; /* Filling RLC Ul Data*/ - MAC_ALLOC_SHRABL_BUF(ulData, sizeof(RlcMacData)); + MAC_ALLOC_SHRABL_BUF(ulData, sizeof(RlcData)); if(!ulData) { DU_LOG("\nMAC : Memory allocation failed while sending UL data to RLC"); return RFAILED; } - memset(ulData, 0, sizeof(RlcMacData)); + memset(ulData, 0, sizeof(RlcData)); ulData->cellId = cellId; ulData->rnti = rnti; memcpy(&ulData->slotInfo, &slotInfo, sizeof(SlotIndInfo)); @@ -263,7 +298,7 @@ uint8_t lcId, uint16_t pduLen, uint8_t *pdu) /* Filling Post and send to RLC */ memset(&pst, 0, sizeof(Pst)); - FILL_PST_MAC_TO_RLC(pst, 0, EVTRLCULDAT); + FILL_PST_MAC_TO_RLC(pst, 0, EVENT_UL_DATA_TO_RLC); MacSendUlDataToRlc(&pst, ulData); return ROK; @@ -276,7 +311,7 @@ uint8_t lcId, uint16_t pduLen, uint8_t *pdu) * * @details * - * Function : MacRlcProcBOStatus + * Function : MacProcRlcBOStatus * * Functionality: * Processes BO status from RLC @@ -287,11 +322,78 @@ uint8_t lcId, uint16_t pduLen, uint8_t *pdu) * RFAILED - failure * * ****************************************************************/ -uint16_t MacRlcProcBOStatus(Pst* pst, SpId spId, RlcMacBOStatus* boStatus) +uint8_t MacProcRlcBoStatus(Pst* pst, RlcBoStatus* boStatus) { + DlRlcBoInfo dlBoInfo; + + dlBoInfo.cellId = boStatus->cellId; + GET_CRNTI(dlBoInfo.crnti, boStatus->ueIdx); + dlBoInfo.lcId = boStatus->lcId; + dlBoInfo.dataVolume = boStatus->bo; + + sendDlRlcBoInfoMacToSch(&dlBoInfo); + + if(pst->selector == ODU_SELECTOR_LWLC) + { + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, boStatus, sizeof(RlcBoStatus)); + } + return ROK; } +/******************************************************************* + * + * @brief Send LC schedule result report to RLC + * + * @details + * + * Function : sendSchResultRepToRlc + * + * Functionality: Send LC schedule result report to RLC + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t sendSchedResultRptToRlc(DlSchedInfo dlInfo, SlotIndInfo slotInfo) +{ + Pst pst; + uint8_t lcIdx; + RlcSchedResultRpt *schedRpt = NULLP; + + MAC_ALLOC_SHRABL_BUF(schedRpt, sizeof(RlcSchedResultRpt)); + if(!schedRpt) + { + DU_LOG("\nMAC: Memory allocation failure in sendSchResultRepToRlc"); + return RFAILED; + } + DU_LOG("\n MAC : Send sched result rep for sfn %d slot %d", slotInfo.sfn, slotInfo.slot); + + schedRpt->cellId = dlInfo.cellId; + schedRpt->rnti = dlInfo.dlMsgAlloc->crnti; + schedRpt->numLc = dlInfo.dlMsgAlloc->numLc; + schedRpt->slotInfo.sfn = slotInfo.sfn; + schedRpt->slotInfo.slot = slotInfo.slot; + + for(lcIdx = 0; lcIdx < schedRpt->numLc; lcIdx++) + { + schedRpt->lcSch[lcIdx].lcId = dlInfo.dlMsgAlloc->lcSchInfo[lcIdx].lcId; + schedRpt->lcSch[lcIdx].bufSize = dlInfo.dlMsgAlloc->lcSchInfo[lcIdx].schBytes; + schedRpt->lcSch[lcIdx].commCh = false; + } + + /* Fill Pst */ + FILL_PST_MAC_TO_RLC(pst, RLC_DL_INST, EVENT_SCHED_RESULT_TO_RLC); + if(MacSendSchedResultRptToRlc(&pst, schedRpt) != ROK) + { + DU_LOG("\nMAC: Failed to send Schedule result report to RLC"); + MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, schedRpt, sizeof(RlcSchedResultRpt)); + return RFAILED; + } + + return ROK; +} /******************************************************************* * @@ -370,10 +472,11 @@ uint8_t MacProcCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo) * ****************************************************************/ uint8_t MacProcDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo) { + uint8_t ueIdx = 0; uint16_t cellIdx; uint16_t idx; - DlRlcBOInfo dlBoInfo; - memset(&dlBoInfo, 0, sizeof(DlRlcBOInfo)); + DlRlcBoInfo dlBoInfo; + memset(&dlBoInfo, 0, sizeof(DlRlcBoInfo)); DU_LOG("\nMAC : Handling DL CCCH IND"); @@ -381,26 +484,24 @@ uint8_t MacProcDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo) dlBoInfo.cellId = dlCcchIndInfo->cellId; dlBoInfo.crnti = dlCcchIndInfo->crnti; - dlBoInfo.numLc = 0; if(dlCcchIndInfo->msgType == RRC_SETUP) { - dlBoInfo.boInfo[dlBoInfo.numLc].lcId = SRB_ID_0; // SRB ID 0 for msg4 - dlBoInfo.boInfo[SRB_ID_0].dataVolume = \ - dlCcchIndInfo->dlCcchMsgLen; - dlBoInfo.numLc++; + dlBoInfo.lcId = SRB_ID_0; // SRB ID 0 for msg4 + dlBoInfo.dataVolume = dlCcchIndInfo->dlCcchMsgLen; /* storing Msg4 Pdu in raCb */ - if(macCb.macCell[cellIdx]->macRaCb[0].crnti == dlCcchIndInfo->crnti) + GET_UE_IDX(dlBoInfo.crnti, ueIdx); + if(macCb.macCell[cellIdx]->macRaCb[ueIdx -1].crnti == dlCcchIndInfo->crnti) { - macCb.macCell[cellIdx]->macRaCb[0].msg4PduLen = dlCcchIndInfo->dlCcchMsgLen; - MAC_ALLOC(macCb.macCell[cellIdx]->macRaCb[0].msg4Pdu, \ - macCb.macCell[cellIdx]->macRaCb[0].msg4PduLen); - if(macCb.macCell[cellIdx]->macRaCb[0].msg4Pdu) + macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4PduLen = dlCcchIndInfo->dlCcchMsgLen; + MAC_ALLOC(macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4Pdu, \ + macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4PduLen); + if(macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4Pdu) { for(idx = 0; idx < dlCcchIndInfo->dlCcchMsgLen; idx++) { - macCb.macCell[cellIdx]->macRaCb[0].msg4Pdu[idx] =\ + macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4Pdu[idx] =\ dlCcchIndInfo->dlCcchMsg[idx]; } } diff --git a/src/5gnrmac/mac_mux.c b/src/5gnrmac/mac_mux.c index e20d8bb42..adb1d5fd7 100644 --- a/src/5gnrmac/mac_mux.c +++ b/src/5gnrmac/mac_mux.c @@ -26,6 +26,8 @@ #include "lwr_mac_upr_inf.h" #include "mac.h" +extern uint16_t gCrntiCount; + /******************************************************************* * * @brief pack the bits @@ -190,15 +192,22 @@ void fillRarPdu(RarInfo *rarInfo) * @return void * * ****************************************************************/ -void createMacRaCb(uint16_t cellId, uint16_t crnti) +void createMacRaCb(RachIndInfo *rachIndInfo) { - uint8_t idx = 0; /* supporting 1 UE */ - uint16_t cellIdx; + uint8_t ueIdx = 0; + uint16_t crnti = 0; + uint16_t cellIdx = 0; + + GET_NEW_CRNTI(crnti); + GET_UE_IDX(crnti, ueIdx); + GET_CELL_IDX(rachIndInfo->cellId, cellIdx); - GET_CELL_IDX(cellId, cellIdx); + /* store in rach ind structure */ + rachIndInfo->crnti = crnti; - macCb.macCell[cellIdx]->macRaCb[idx].cellId = cellId; - macCb.macCell[cellIdx]->macRaCb[idx].crnti = crnti; + /* store in raCb */ + macCb.macCell[cellIdx]->macRaCb[ueIdx-1].cellId = rachIndInfo->cellId; + macCb.macCell[cellIdx]->macRaCb[ueIdx-1].crnti = crnti; } /************************************************* @@ -214,17 +223,14 @@ void createMacRaCb(uint16_t cellId, uint16_t crnti) * msg4Pdu pointer ************************************************/ -void fillMsg4DlData(uint16_t cellId, MacDlData *dlData, uint8_t *msg4Pdu) +void fillMsg4DlData(MacDlData *dlData, uint16_t msg4PduLen, uint8_t *msg4Pdu) { uint8_t idx = 0; uint16_t idx2; - uint16_t cellIdx; - - GET_CELL_IDX(cellId, cellIdx); dlData->numPdu = 1; dlData->pduInfo[idx].lcId = MAC_LCID_CCCH; - dlData->pduInfo[idx].pduLen = macCb.macCell[cellIdx]->macRaCb[idx].msg4PduLen; + dlData->pduInfo[idx].pduLen = msg4PduLen; for(idx2 = 0; idx2 < dlData->pduInfo[idx].pduLen; idx2++) { dlData->pduInfo[idx].dlPdu[idx2] = msg4Pdu[idx2]; diff --git a/src/5gnrmac/mac_rach.c b/src/5gnrmac/mac_rach.c index d153018cb..a34642d96 100644 --- a/src/5gnrmac/mac_rach.c +++ b/src/5gnrmac/mac_rach.c @@ -85,9 +85,7 @@ uint8_t fapiMacRachInd(Pst *pst, RachInd *rachInd) pduIdx = 0; preambleIdx = 0; - rachIndInfo.cellId = rachInd->rachPdu[pduIdx].pci; - /* TODO : A.ocate unique crnti for each ue */ - rachIndInfo.crnti = 100; + rachIndInfo.cellId = rachInd->cellId; rachIndInfo.timingInfo.sfn = rachInd->timingInfo.sfn; rachIndInfo.timingInfo.slot = rachInd->timingInfo.slot; rachIndInfo.slotIdx = rachInd->rachPdu[pduIdx].slotIdx; @@ -99,7 +97,7 @@ uint8_t fapiMacRachInd(Pst *pst, RachInd *rachInd) rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].timingAdv; /* storing the value in macRaCb */ - createMacRaCb(rachIndInfo.cellId, rachIndInfo.crnti); + createMacRaCb(&rachIndInfo); return(sendRachIndMacToSch(&rachIndInfo)); } diff --git a/src/5gnrmac/mac_slot_ind.c b/src/5gnrmac/mac_slot_ind.c index 6b70ebbf3..fad683b47 100644 --- a/src/5gnrmac/mac_slot_ind.c +++ b/src/5gnrmac/mac_slot_ind.c @@ -19,11 +19,10 @@ #include "common_def.h" #include "lrg.h" #include "lrg.x" -#include "rgu.h" -#include "rgu.x" #include "du_app_mac_inf.h" #include "mac_sch_interface.h" #include "lwr_mac_upr_inf.h" +#include "rlc_mac_inf.h" #include "mac.h" #include "mac_upr_inf_api.h" #include "lwr_mac_fsm.h" @@ -91,13 +90,27 @@ uint8_t MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo) currDlSlot->dlInfo.msg4Alloc = dlSchedInfo->msg4Alloc; /* copy msg4 alloc pointer in MAC slot info */ msg4Alloc = dlSchedInfo->msg4Alloc; macCb.macCell[cellIdx]->macRaCb[0].msg4TbSize = msg4Alloc->msg4PdschCfg.codeword[0].tbSize; + DU_LOG("\nMAC: MSG4 Added at time slot [%d] *********", dlSchedInfo->schSlotValue.msg4Time.slot); } + if(dlSchedInfo->ulGrant != NULLP) { currDlSlot = &macCb.macCell[cellIdx]->\ dlSlot[dlSchedInfo->schSlotValue.ulDciTime.slot]; currDlSlot->dlInfo.ulGrant = dlSchedInfo->ulGrant; } + + if(dlSchedInfo->dlMsgAlloc != NULLP) + { + currDlSlot = &macCb.macCell[cellIdx]->\ + dlSlot[dlSchedInfo->schSlotValue.dlMsgTime.slot]; + currDlSlot->dlInfo.cellId = dlSchedInfo->cellId; + memcpy(&currDlSlot->dlInfo.schSlotValue, &dlSchedInfo->schSlotValue, sizeof(SchSlotValue)); + currDlSlot->dlInfo.dlMsgAlloc = dlSchedInfo->dlMsgAlloc; + DU_LOG("\nMAC: DL MSG Added at time slot [%d] *********", dlSchedInfo->schSlotValue.dlMsgTime.slot); + /* Send LC schedule result to RLC */ + sendSchedResultRptToRlc(currDlSlot->dlInfo, dlSchedInfo->schSlotValue.dlMsgTime); + } } return ROK; } @@ -115,6 +128,7 @@ uint8_t MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo) **/ void fillMsg4Pdu(uint16_t cellId, Msg4Alloc *msg4Alloc) { + uint8_t ueIdx; uint16_t cellIdx; MacDlData msg4DlData; MacCeInfo macCeData; @@ -124,24 +138,26 @@ void fillMsg4Pdu(uint16_t cellId, Msg4Alloc *msg4Alloc) memset(&msg4DlData, 0, sizeof(MacDlData)); memset(&macCeData, 0, sizeof(MacCeInfo)); - if(macCb.macCell[cellIdx]->macRaCb[0].msg4Pdu != NULLP) + GET_UE_IDX(msg4Alloc->msg4Info.crnti, ueIdx); + if(macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4Pdu != NULLP) { - MAC_ALLOC(msg4DlData.pduInfo[0].dlPdu, \ - macCb.macCell[cellIdx]->macRaCb[0].msg4PduLen); - if(msg4DlData.pduInfo[0].dlPdu != NULLP) + MAC_ALLOC(msg4DlData.pduInfo[ueIdx -1].dlPdu, \ + macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4PduLen); + if(msg4DlData.pduInfo[ueIdx -1].dlPdu != NULLP) { - fillMsg4DlData(cellId, &msg4DlData, macCb.macCell[cellIdx]->macRaCb[0].msg4Pdu); - fillMacCe(&macCeData, macCb.macCell[cellIdx]->macRaCb[0].msg3Pdu); + fillMsg4DlData(&msg4DlData, macCb.macCell[cellIdx]->macRaCb[ueIdx-1].msg4PduLen,\ + macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4Pdu); + fillMacCe(&macCeData, macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg3Pdu); /* Forming Mux Pdu */ - macCb.macCell[cellIdx]->macRaCb[0].msg4TxPdu = NULLP; - MAC_ALLOC(macCb.macCell[cellIdx]->macRaCb[0].msg4TxPdu, \ - macCb.macCell[cellIdx]->macRaCb[0].msg4TbSize); - if(macCb.macCell[cellIdx]->macRaCb[0].msg4TxPdu != NULLP) + macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4TxPdu = NULLP; + MAC_ALLOC(macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4TxPdu, \ + macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4TbSize); + if(macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4TxPdu != NULLP) { - memset(macCb.macCell[cellIdx]->macRaCb[0].msg4TxPdu, 0, \ - macCb.macCell[cellIdx]->macRaCb[0].msg4TbSize); - macMuxPdu(&msg4DlData, &macCeData, macCb.macCell[cellIdx]->macRaCb[0].msg4TxPdu,\ - macCb.macCell[cellIdx]->macRaCb[0].msg4TbSize); + memset(macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4TxPdu, 0, \ + macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4TbSize); + macMuxPdu(&msg4DlData, &macCeData, macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4TxPdu,\ + macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4TbSize); } else @@ -149,19 +165,19 @@ void fillMsg4Pdu(uint16_t cellId, Msg4Alloc *msg4Alloc) DU_LOG("\nMAC: Failed allocating memory for msg4TxPdu"); } /* Free memory allocated */ - MAC_FREE(msg4DlData.pduInfo[0].dlPdu, macCb.macCell[cellIdx]->macRaCb[0].msg4PduLen); + MAC_FREE(msg4DlData.pduInfo[0].dlPdu, macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4PduLen); } } /* storing msg4 Pdu in macDlSlot */ - if(macCb.macCell[cellIdx]->macRaCb[0].msg4TxPdu) + if(macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4TxPdu) { - msg4Alloc->msg4Info.msg4PduLen = macCb.macCell[cellIdx]->macRaCb[0].msg4TbSize; - MAC_ALLOC(msg4Alloc->msg4Info.msg4Pdu, msg4Alloc->msg4Info.msg4PduLen); - if(msg4Alloc->msg4Info.msg4Pdu != NULLP) + msg4Alloc->msg4Info.dlMsgPduLen = macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4TbSize; + MAC_ALLOC(msg4Alloc->msg4Info.dlMsgPdu, msg4Alloc->msg4Info.dlMsgPduLen); + if(msg4Alloc->msg4Info.dlMsgPdu != NULLP) { - memcpy(msg4Alloc->msg4Info.msg4Pdu, macCb.macCell[cellIdx]->macRaCb[0].msg4TxPdu, \ - msg4Alloc->msg4Info.msg4PduLen); + memcpy(msg4Alloc->msg4Info.dlMsgPdu, macCb.macCell[cellIdx]->macRaCb[ueIdx -1].msg4TxPdu, \ + msg4Alloc->msg4Info.dlMsgPduLen); } } else diff --git a/src/5gnrmac/mac_stop_ind.c b/src/5gnrmac/mac_stop_ind.c index 1718c386a..124565f4d 100644 --- a/src/5gnrmac/mac_stop_ind.c +++ b/src/5gnrmac/mac_stop_ind.c @@ -19,11 +19,10 @@ #include "common_def.h" #include "lrg.h" #include "lrg.x" -#include "rgu.h" -#include "rgu.x" #include "du_app_mac_inf.h" #include "mac_sch_interface.h" #include "lwr_mac_upr_inf.h" +#include "rlc_mac_inf.h" #include "mac.h" #include "mac_upr_inf_api.h" #include "mac_utils.h" diff --git a/src/5gnrmac/mac_ue_mgr.c b/src/5gnrmac/mac_ue_mgr.c index 2ab31c104..ebcd2bfe5 100644 --- a/src/5gnrmac/mac_ue_mgr.c +++ b/src/5gnrmac/mac_ue_mgr.c @@ -872,16 +872,16 @@ uint8_t createUeCb(MacUeCfg *ueCfg) for(lcIdx = 0; lcIdx < ueCfg->numLcs; lcIdx++) { ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].lcId = ueCfg->lcCfgList[lcIdx].lcId; - ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].lcState = LC_STATE_ACTIVE; + ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].lcState = MAC_LC_STATE_ACTIVE; ueCb->dlInfo.numDlLc++; } /* Copy RA Cb */ for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++) { - if(macCb.macCell[cellIdx]->macRaCb[ueIdx].crnti == ueCb->crnti) + if(macCb.macCell[cellIdx]->macRaCb[ueIdx -1].crnti == ueCb->crnti) { - ueCb->raCb = &macCb.macCell[cellIdx]->macRaCb[ueIdx]; + ueCb->raCb = &macCb.macCell[cellIdx]->macRaCb[ueIdx -1]; break; } } diff --git a/src/5gnrmac/mac_upr_inf_api.c b/src/5gnrmac/mac_upr_inf_api.c index be8c36d03..6992add6c 100644 --- a/src/5gnrmac/mac_upr_inf_api.c +++ b/src/5gnrmac/mac_upr_inf_api.c @@ -19,9 +19,8 @@ /* This file contains the definitions for Upper Interface APIs that are * invoked from MAC */ #include "common_def.h" -#include "rgu.h" -#include "rgu.x" #include "du_app_mac_inf.h" +#include "rlc_mac_inf.h" #include "mac_upr_inf_api.h" /* Funtion pointer options for slot indication */ @@ -55,6 +54,15 @@ RlcMacUlDataFunc rlcMacSendUlDataOpts[] = packRlcUlData }; +/* Funtion pointer options for schedule result reporting */ +RlcMacSchedResultRptFunc rlcMacSchedResultRptOpts[] = +{ + packRlcSchedResultRpt, + RlcProcSchedResultRpt, + packRlcSchedResultRpt +}; + + /******************************************************************* * * @brief Send slot indication to MAC @@ -137,11 +145,31 @@ uint8_t MacDuAppUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo) * RFAILED - failure * * ****************************************************************/ -uint8_t MacSendUlDataToRlc(Pst *pst, RlcMacData *ulData) +uint8_t MacSendUlDataToRlc(Pst *pst, RlcData *ulData) { return (*rlcMacSendUlDataOpts[pst->selector])(pst, ulData); } +/******************************************************************* + * + * @brief Send Schedule result report to RLC + * + * @details + * + * Function : MacSendSchedResultRptToRlc + * + * Functionality: Send Schedule result report to RLC + * + * @params[in] Post structure + * Schedule result report + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t MacSendSchedResultRptToRlc(Pst *pst, RlcSchedResultRpt *schedRpt) +{ + return (*rlcMacSchedResultRptOpts[pst->selector])(pst, schedRpt); +} /********************************************************************** End of file diff --git a/src/5gnrmac/mac_upr_inf_api.h b/src/5gnrmac/mac_upr_inf_api.h index 7bda9d473..bc7216c2f 100644 --- a/src/5gnrmac/mac_upr_inf_api.h +++ b/src/5gnrmac/mac_upr_inf_api.h @@ -22,7 +22,8 @@ uint8_t MacDuAppSlotInd(Pst *pst, SlotIndInfo *slotInfo); uint8_t MacDuAppStopInd(Pst *pst, MacCellStopInfo *cellStopId); uint8_t MacDuAppUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo); -uint8_t MacSendUlDataToRlc(Pst *pst, RlcMacData *ulData); +uint8_t MacSendUlDataToRlc(Pst *pst, RlcData *ulData); +uint8_t MacSendSchedResultRptToRlc(Pst *pst, RlcSchedResultRpt *schedRpt); /********************************************************************** End of file diff --git a/src/5gnrmac/rg_ex_ms.c b/src/5gnrmac/rg_ex_ms.c index 6fded6309..a1da9971b 100755 --- a/src/5gnrmac/rg_ex_ms.c +++ b/src/5gnrmac/rg_ex_ms.c @@ -56,6 +56,7 @@ registered with SSI during the LTE MAC Task initialization. #include "rg_prg.x" /*PRG interface includes*/ #include "du_app_mac_inf.h" #include "rg.x" /* typedefs for MAC */ +#include "rlc_mac_inf.h" /** * @brief Task Activation callback function Entity SM. @@ -220,11 +221,11 @@ Buffer *mBuf; /* message buffer */ case EVTRGUUBNDREQ: cmUnpkRguUbndReq(RgUiRguUbndReq, pst, mBuf); break; - case EVTRLCDLDAT: - unpackDlData(MacRlcProcDlData, pst, mBuf); + case EVENT_DL_DATA_TO_MAC: + unpackRlcDlData(MacProcRlcDlData, pst, mBuf); break; - case EVTRLCBOSTA: - unpackBOStatus(MacRlcProcBOStatus, pst, mBuf); + case EVENT_BO_STATUS_TO_MAC: + unpackRlcBoStatus(MacProcRlcBoStatus, pst, mBuf); break; #ifdef LTE_L2_MEAS diff --git a/src/5gnrmac/rg_ptmi.c b/src/5gnrmac/rg_ptmi.c index cec067c88..87419c341 100755 --- a/src/5gnrmac/rg_ptmi.c +++ b/src/5gnrmac/rg_ptmi.c @@ -99,7 +99,7 @@ PRIVATE CONSTANT LrgCfgCfm RgMiLrgCfgCfmMt[RG_MAX_LRG_USR] = #ifdef SM SmMiLrgCfgCfm, /* 1 - Tightly coupled SM */ #else - PtMiLrgCfgCfm, /* 1 - Tightly coupled SM */ + //PtMiLrgCfgCfm, /* 1 - Tightly coupled SM */ #endif }; @@ -114,7 +114,7 @@ PRIVATE CONSTANT LrgSchCfgCfm RgMiLrgSchCfgCfmMt[RG_MAX_LRG_USR] = #ifdef SM SmMiLrgSchCfgCfm, /* 1 - Tightly coupled SM */ #else - PtMiLrgSchCfgCfm, /* 1 - Tightly coupled SM */ + //PtMiLrgSchCfgCfm, /* 1 - Tightly coupled SM */ #endif }; diff --git a/src/5gnrmac/rg_ptui.c b/src/5gnrmac/rg_ptui.c index 24a449e34..224442c4b 100755 --- a/src/5gnrmac/rg_ptui.c +++ b/src/5gnrmac/rg_ptui.c @@ -325,7 +325,7 @@ PRIVATE CONSTANT RguCDatInd RgUiRguCDatIndMt[RG_MAX_RGU_USR] = PtUiRguCDatInd, #endif #ifdef KW - RlcLiRguCDatInd, + RlcProcCommLcUlData, #else PtUiRguCDatInd, #endif @@ -346,7 +346,7 @@ PRIVATE CONSTANT RguDDatInd RgUiRguDDatIndMt[RG_MAX_RGU_USR] = PtUiRguDDatInd, #endif #ifdef KW - RlcLiRguDDatInd, + RlcProcDedLcUlData, #else PtUiRguDDatInd, #endif diff --git a/src/5gnrrlc/kw_amm_dl.c b/src/5gnrrlc/kw_amm_dl.c index 33f9f21f3..39b6d5a1b 100755 --- a/src/5gnrrlc/kw_amm_dl.c +++ b/src/5gnrrlc/kw_amm_dl.c @@ -252,14 +252,14 @@ KwuDatCfmInfo **datCfm * @return Void */ #ifdef ANSI -Void rlcAmmSendDStaRsp +Void rlcAmmSendDedLcBoSta ( RlcCb *gCb, RlcDlRbCb *rbCb, RlcAmDl *amDl ) #else -Void rlcAmmSendDStaRsp(gCb, rbCb, amDl) +Void rlcAmmSendDedLcBoSta(gCb, rbCb, amDl) RlcCb *gCb; RlcDlRbCb *rbCb; RlcAmDl *amDl; @@ -269,7 +269,7 @@ RlcAmDl *amDl; if(bo) { - rlcUtlSndDStaRsp(gCb, rbCb, bo, amDl->estHdrSz, amDl->cntrlBo ?TRUE:FALSE,amDl->cntrlBo); + rlcUtlSendDedLcBoSta(gCb, rbCb, bo, amDl->estHdrSz, amDl->cntrlBo ?TRUE:FALSE,amDl->cntrlBo); } RETVOID; @@ -1001,7 +1001,7 @@ RlcUdxStaPdu *pStaPdu; canged inside the above called functions */ if (oldRetxBo != AMDL.retxBo) { - rlcAmmSendDStaRsp(gCb, rbCb, &AMDL); + rlcAmmSendDedLcBoSta(gCb, rbCb, &AMDL); } RETVOID; @@ -1199,7 +1199,7 @@ dlrate_kwu += sdu->sduSz; if(!rlcDlUtlIsReestInProgress(rbCb)) { - rlcAmmSendDStaRsp(gCb, rbCb, &AMDL); + rlcAmmSendDedLcBoSta(gCb, rbCb, &AMDL); } RETVOID; @@ -2575,7 +2575,7 @@ RlcRetx *retx; rbCb->m.amDl.cntrlBo = 0; rbCb->m.amDl.retxBo = 0; /* Sending BO update to SCH */ - rlcUtlSndDStaRsp(gCb, rbCb, 0,0,0,0); + rlcUtlSendDedLcBoSta(gCb, rbCb, 0,0,0,0); rlcAmmSndStaInd(gCb, rbCb, retx); gRlcStats.amRlcStats.numDLMaxRetx++; } @@ -3074,7 +3074,7 @@ RlcDlRbCb *rbCb; AMDL.nxtRetx = retx; } - rlcAmmSendDStaRsp(gCb, rbCb, &AMDL); + rlcAmmSendDedLcBoSta(gCb, rbCb, &AMDL); RETVOID; } /* Get the last node in retxLst */ @@ -3084,7 +3084,7 @@ RlcDlRbCb *rbCb; if (retx != NULLP) { rlcAmmDlMarkPduForReTx(gCb, rbCb, retx); - rlcAmmSendDStaRsp(gCb, rbCb, &AMDL); + rlcAmmSendDedLcBoSta(gCb, rbCb, &AMDL); } } diff --git a/src/5gnrrlc/kw_amm_ul.c b/src/5gnrrlc/kw_amm_ul.c index 59c337c13..4b39d4853 100755 --- a/src/5gnrrlc/kw_amm_ul.c +++ b/src/5gnrrlc/kw_amm_ul.c @@ -1716,7 +1716,7 @@ Buffer *pdu; if (pdu != NULLP) { AMUL.partialSdu = NULLP; - rlcUtlSndDatInd(gCb,rbCb, pdu); + rlcUtlSendUlDataToDu(gCb,rbCb, pdu); } RETVOID; diff --git a/src/5gnrrlc/kw_dl.x b/src/5gnrrlc/kw_dl.x index 00c2a1300..2c133b13b 100755 --- a/src/5gnrrlc/kw_dl.x +++ b/src/5gnrrlc/kw_dl.x @@ -644,7 +644,7 @@ EXTERN Void rlcTmmQSdu ARGS ((RlcCb *gCb, RlcDlRbCb *rbCb, KwuDatReqInfo *datReqInfo, Buffer *mBuf)); -EXTERN Void rlcTmmSndToLi ARGS ((RlcCb *gCb, +EXTERN Void rlcTmmSendToMac ARGS ((RlcCb *gCb, SuId suId, RlcDlRbCb *rbCb, RguCStaIndInfo *staInd)); @@ -676,7 +676,7 @@ EXTERN Void rlcUmmFreeDlRbCb ARGS ((RlcCb *gCb, RlcDlRbCb *rbCb)); EXTERN S32 rlcAmmCalculateBo ARGS ((RlcAmDl *amDl)); -EXTERN Void rlcAmmSendDStaRsp ARGS ((RlcCb *gCb, RlcDlRbCb *rbCb, RlcAmDl *amDl)); +EXTERN Void rlcAmmSendDedLcBoSta ARGS ((RlcCb *gCb, RlcDlRbCb *rbCb, RlcAmDl *amDl)); EXTERN Void rlcAmmQSdu ARGS((RlcCb *gCb, RlcDlRbCb *rbCb, @@ -722,7 +722,7 @@ EXTERN Void rlcUtlRemovTxBuf ARGS ((CmLListCp *txBufLst, RlcCb *gCb )); -EXTERN S16 rlcUtlSndDStaRsp ARGS ((RlcCb *gCb, +EXTERN S16 rlcUtlSendDedLcBoSta ARGS ((RlcCb *gCb, RlcDlRbCb *rbCb, S32 bo, S32 estHdrSz, @@ -740,7 +740,7 @@ EXTERN Void rlcUtlCalcLiForSdu ARGS ((RlcCb *gCb, MsgLen msgLen, S16 *pduSz)); -EXTERN S16 rlcUtlSndToLi ARGS ((RlcCb *gCb, SuId suId, KwDStaIndInfo *staIndInfo)); +EXTERN S16 rlcUtlSendToMac ARGS ((RlcCb *gCb, SuId suId, KwDStaIndInfo *staIndInfo)); EXTERN Void rlcUtlIncrementKwuStsSduTx ARGS((RlcKwuSapCb *rlckwuSap)); diff --git a/src/5gnrrlc/kw_dl_ex_ms.c b/src/5gnrrlc/kw_dl_ex_ms.c index ea4fc8fa0..220083fca 100755 --- a/src/5gnrrlc/kw_dl_ex_ms.c +++ b/src/5gnrrlc/kw_dl_ex_ms.c @@ -59,6 +59,7 @@ static int RLOG_FILE_ID=195; #include "kw_udx.x" #include "kw_dl.x" #include "du_app_rlc_inf.h" +#include "rlc_mac_inf.h" #include "ctf.h" S16 rlcUtlDlBatchProcPkts(Void); @@ -284,7 +285,7 @@ Buffer *mBuf; /* message buffer */ #ifdef LCKWU case KWU_EVT_DAT_REQ: /* Data request */ { - ret = cmUnpkKwuDatReq(RlcUiKwuDatReq, pst, mBuf); + ret = cmUnpkKwuDatReq(RlcProcDlData, pst, mBuf); break; } #endif /* LCKWU */ @@ -409,13 +410,13 @@ Buffer *mBuf; /* message buffer */ #ifdef L2_L3_SPLIT case KWU_EVT_CPLANE_DAT_REQ: /* C-Plane Data request */ { - ret = cmUnpkKwuDatReq(RlcUiKwuDatReq, pst, mBuf); + ret = cmUnpkKwuDatReq(RlcProcDlData, pst, mBuf); break; } #else case KWU_EVT_DAT_REQ: /* Data request */ { - ret = cmUnpkKwuDatReq(RlcUiKwuDatReq, pst, mBuf); + ret = cmUnpkKwuDatReq(RlcProcDlData, pst, mBuf); break; } #endif @@ -460,13 +461,13 @@ Buffer *mBuf; /* message buffer */ case KWU_EVT_CPLANE_DAT_REQ: /* C-Plane Data request */ case KWU_EVT_UPLANE_DAT_REQ: /* U-Plane Data request */ { - ret = cmUnpkKwuDatReq(RlcUiKwuDatReq, pst, mBuf); + ret = cmUnpkKwuDatReq(RlcProcDlData, pst, mBuf); break; } #else case KWU_EVT_DAT_REQ: /* Data request */ { - ret = cmUnpkKwuDatReq(RlcUiKwuDatReq, pst, mBuf); + ret = cmUnpkKwuDatReq(RlcProcDlData, pst, mBuf); break; } #endif @@ -500,9 +501,9 @@ Buffer *mBuf; /* message buffer */ ret = cmUnpkRguBndCfm(RlcLiRguBndCfm, pst, mBuf ); break; } - case EVTSCHREP: /* Dedicated Channel Status Response */ + case EVENT_SCHED_RESULT_TO_RLC: { - ret = unpackSchedRep(RlcMacProcSchedRep, pst, mBuf); + ret = unpackSchedResultRpt(RlcProcSchedResultRpt, pst, mBuf); break; } /* kw005.201 added support for L2 Measurement */ diff --git a/src/5gnrrlc/kw_lim.c b/src/5gnrrlc/kw_lim.c index 10b467f4f..623bb1d4b 100755 --- a/src/5gnrrlc/kw_lim.c +++ b/src/5gnrrlc/kw_lim.c @@ -26,10 +26,10 @@ This file contains following functions --RlcLiRguBndCfm - --RlcLiRguCDatInd - --RlcLiRguDDatInd - --RlcLiRguCStaInd - --RlcLiRguDStaInd + --RlcProcCommLcUlData + --RlcProcDedLcUlData + --RlcProcCommLcSchedRpt + --RlcProcDedLcSchedRpt --RlcLiRguHqStaInd File: kw_lim.c @@ -72,6 +72,7 @@ static int RLOG_FILE_ID=196; #include "kw_dl.x" #include "kw_ul.x" #include "rlc_utils.h" +#include "rlc_mac_inf.h" #ifdef __cplusplus EXTERN "C" { @@ -189,108 +190,6 @@ U8 status; return (ROK); } /* RlcLiRguBndCfm */ -/** - * @brief Handler to process PDU received from MAC - * - * @details - * This function receives the PDU from MAC. - * seggregates common and dedicated logical channel - * PDU and call respective handler. - * - * @param[in] pst Post structure - * @param[in] suId Service User ID - * @param[in] datInd Data Indication Information - * - * @return S16 - * -# ROK - * -# RFAILED - * -*/ - -uint8_t RlcProcUlData(Pst *pst, RlcMacData *ulData) -{ - U8 idx; - U8 lcId; /* Logical Channel */ - U8 numDLch = 0; /* Number of dedicated logical channel */ - Bool dLchPduPres; /* PDU received on dedicated logical channel */ - RguLchDatInd dLchData[RGU_MAX_LC]; /* PDU info on dedicated logical channel */ - RguDDatIndInfo *dLchUlDat; /* UL data on dedicated logical channel */ - RguCDatIndInfo *cLchUlDat; /* UL data on common logical channel */ - uint16_t copyLen; - - /* Initializing dedicated logical channel Database */ - for(idx = 0; idx < RGU_MAX_LC; idx++) - { - dLchData[idx].lcId = idx; - dLchData[idx].pdu.numPdu = 0; - } - - dLchPduPres = FALSE; - - /* Seggregate PDUs received on common and dedicated channels - * and call common channel's handler */ - for(idx = 0; idx< ulData->numPdu; idx++) - { - if(ulData->pduInfo[idx].commCh) - { - RLC_SHRABL_STATIC_BUF_ALLOC(pst->region, pst->pool, cLchUlDat, sizeof(RguCDatIndInfo)); - cmMemset((U8*)cLchUlDat, (U8)0, sizeof(RguCDatIndInfo)); - - cLchUlDat->cellId = ulData->cellId; - GET_UE_IDX(ulData->rnti, cLchUlDat->rnti); - cLchUlDat->lcId = ulData->pduInfo[idx].lcId; - - /* Copy fixed buffer to message */ - if(SGetMsg(RLC_MEM_REGION_UL, RLC_POOL, &cLchUlDat->pdu) != ROK) - { - DU_LOG("\nRLC : Memory allocation failed at RlcProcUlData"); - return RFAILED; - } - reverseFixBuf(ulData->pduInfo[idx].pduBuf, ulData->pduInfo[idx].pduLen); - SCpyFixMsg(ulData->pduInfo[idx].pduBuf, cLchUlDat->pdu, 0, \ - ulData->pduInfo[idx].pduLen, (MsgLen *)©Len); - - RlcLiRguCDatInd(pst, 0, cLchUlDat); - } - else - { - if(!dLchPduPres) - { - RLC_SHRABL_STATIC_BUF_ALLOC(pst->region, pst->pool, dLchUlDat, sizeof(RguDDatIndInfo)); - dLchPduPres = TRUE; - } - - lcId = ulData->pduInfo[idx].lcId; - dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu] = ulData->pduInfo[idx].pduBuf; - dLchData[lcId].pdu.numPdu++; - } - } - - /* If any PDU received on dedicated logical channel, copy into RguDDatIndInfo - * and call its handler */ - if(dLchPduPres) - { - dLchUlDat->cellId = ulData->cellId; - dLchUlDat->rnti = ulData->rnti; - - for(idx = 0; idx < RGU_MAX_LC; idx++) - { - if(dLchData[idx].pdu.numPdu) - { - cmMemcpy((U8 *)&dLchUlDat->lchData[numDLch], (U8 *)&dLchData[idx], sizeof(RguLchDatInd)); - numDLch++; - } - } - dLchUlDat->numLch = numDLch; - RlcLiRguDDatInd(pst, 0, dLchUlDat); - } - - - RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ulData, sizeof(RlcMacData)); - return ROK; - -}/* End of RlcProcUlData */ - int rlcDDatIndRcvd; int rlcCDatIndRcvd; /** @@ -310,14 +209,14 @@ int rlcCDatIndRcvd; * */ #ifdef ANSI -S16 RlcLiRguCDatInd +S16 RlcProcCommLcUlData ( Pst *pst, SuId suId, RguCDatIndInfo *datInd ) #else -S16 RlcLiRguCDatInd(pst,suId,datInd) +S16 RlcProcCommLcUlData(pst,suId,datInd) Pst *pst; SuId suId; RguCDatIndInfo *datInd; @@ -327,12 +226,12 @@ RguCDatIndInfo *datInd; RlcCb *tRlcCb; rlcCDatIndRcvd++; - TRC3(RlcLiRguCDatInd) + TRC3(RlcProcCommLcUlData) #if (ERRCLASS & ERRCLS_INT_PAR) if (pst->dstInst >= MAX_RLC_INSTANCES) { - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, datInd, sizeof(RguCDatIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, datInd, sizeof(RguCDatIndInfo)); return (RFAILED); } #endif @@ -343,7 +242,7 @@ RguCDatIndInfo *datInd; #if (ERRCLASS & ERRCLS_DEBUG) if (tRlcCb->genCfg.rlcMode == LKW_RLC_MODE_DL) { - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, datInd, sizeof(RguCDatIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, datInd, sizeof(RguCDatIndInfo)); return RFAILED; } #endif @@ -354,7 +253,7 @@ RguCDatIndInfo *datInd; { RLOG_ARG1(L_ERROR,DBG_LCID,datInd->lcId, "Invalid LcId, Max is [%d]", RLC_MAX_LCH_PER_CELL); - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, datInd, sizeof(RguCDatIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, datInd, sizeof(RguCDatIndInfo)); return RFAILED; } #endif /* (ERRCLASS & ERRCLS_DEBUG) */ @@ -365,21 +264,21 @@ RguCDatIndInfo *datInd; { RLOG_ARG1(L_ERROR, DBG_CELLID,datInd->cellId, "LcId [%d] not found", datInd->lcId); - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, datInd, sizeof(RguCDatIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, datInd, sizeof(RguCDatIndInfo)); return RFAILED; } /* Dispatch to TM Module */ #ifdef CCPU_OPT - rlcTmmRcvFrmLi(tRlcCb, rbCb, datInd->rnti, datInd->pdu); + rlcTmmRcvFrmMac(tRlcCb, rbCb, datInd->rnti, datInd->pdu); #else /* CCPU_OPT */ - rlcTmmRcvFrmLi(tRlcCb, rbCb, datInd->pdu); + rlcTmmRcvFrmMac(tRlcCb, rbCb, datInd->pdu); #endif /* CCPU_OPT */ - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, datInd, sizeof(RguCDatIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, datInd, sizeof(RguCDatIndInfo)); return (ROK); -} /* RlcLiRguCDatInd */ +} /* RlcProcCommLcUlData */ /** * @brief Handler to process PDU received from MAC for @@ -400,26 +299,26 @@ RguCDatIndInfo *datInd; */ #ifdef ANSI -S16 RlcLiRguDDatInd +S16 RlcProcDedLcUlData ( Pst *pst, SuId suId, RguDDatIndInfo *datInd ) #else -S16 RlcLiRguDDatInd(pst, suId, datInd) +S16 RlcProcDedLcUlData(pst, suId, datInd) Pst *pst; SuId suId; RguDDatIndInfo *datInd; #endif { - TRC3(RlcLiRguDDatInd) + TRC3(RlcProcDedLcUlData) rlcDDatIndRcvd++; #if (ERRCLASS & ERRCLS_INT_PAR) if (pst->dstInst >= MAX_RLC_INSTANCES) { - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, datInd, sizeof(RguDDatIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, datInd, sizeof(RguDDatIndInfo)); return (RFAILED); } #endif @@ -427,103 +326,22 @@ RguDDatIndInfo *datInd; #if (ERRCLASS & ERRCLS_DEBUG) if (((RlcCb*)RLC_GET_RLCCB(pst->dstInst))->genCfg.rlcMode == LKW_RLC_MODE_DL) { - RLOG1(L_DEBUG,"RlcLiRguDDatInd(pst, suId(%d))recieved in DL Inst",suId); - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, datInd, sizeof(RguDDatIndInfo)); + RLOG1(L_DEBUG,"RlcProcDedLcUlData(pst, suId(%d))recieved in DL Inst",suId); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, datInd, sizeof(RguDDatIndInfo)); return RFAILED; } #endif - rlcUtlRcvFrmLi(RLC_GET_RLCCB(pst->dstInst),datInd); + rlcUtlRcvFrmMac(RLC_GET_RLCCB(pst->dstInst),datInd); #ifndef SS_RBUF #ifdef SS_LOCKLESS_MEMORY - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, datInd, sizeof(RguDDatIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, datInd, sizeof(RguDDatIndInfo)); #else - RLC_PST_FREE(pst->region, pst->pool, datInd, sizeof(RguDDatIndInfo)); + RLC_PST_FREE(RLC_MEM_REGION_UL, RLC_POOL, datInd, sizeof(RguDDatIndInfo)); #endif #endif return (ROK); -} /* RlcLiRguDDatInd */ - - -/******************************************************************* - * - * @brief Handler for extracting common and dedicated channel - * Scheduling result report. - * - * @details - * - * Function : RlcMacProcSchedRep - * - * Functionality: - * Handler for extracting common and dedicated channel - * Scheduling result report - * - * @params[in] - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -uint16_t RlcMacProcSchedRep(Pst *pst, SuId suId, RlcMacSchedRepInfo *schRep) -{ - U8 idx; /* Iterator */ - U8 nmbDLch = 0; /* Number of dedicated logical channles */ - RguCStaIndInfo *cLchSchInfo; /* Common logical channel scheduling result */ - RguDStaIndInfo *dLchSchInfo; /* Dedicated logical channel scheduling result */ - - DU_LOG("\nRLC : Received scheduling report from MAC"); - - for(idx=0; idx < schRep->nmbLch; idx++) - { - /* If it is common channel, fill status indication information - * and trigger the handler for each common lch separately */ - if(schRep->lchSta[idx].commCh) - { - RLC_SHRABL_STATIC_BUF_ALLOC(pst->region, pst->pool, cLchSchInfo, sizeof(RguCStaIndInfo)); - cmMemset((U8*)cLchSchInfo, (U8)0, sizeof(RguCStaIndInfo)); - - cLchSchInfo->cellId = schRep->cellId; - cLchSchInfo->lcId = schRep->lchSta[idx].lchStaInd.lcId; - //cLchSchInfo->transId = schRep->timeToTx; /* TODO : fill transId suing timeToTx */ - cLchSchInfo->rnti = schRep->rnti; - - RlcLiRguCStaInd(pst, suId, cLchSchInfo); - - } - else - { - /* Fill status info structure if at least one dedicated channel - * scheduling report is received */ - if(nmbDLch == 0) - { - RLC_SHRABL_STATIC_BUF_ALLOC(pst->region, pst->pool, dLchSchInfo, sizeof(RguDStaIndInfo)); - - dLchSchInfo->cellId = schRep->cellId; - dLchSchInfo->nmbOfUeGrantPerTti = 1; - dLchSchInfo->staInd[0].rnti = schRep->rnti; - //dLchSchInfo->staInd[0].transId = schRep->timeToTx; /* TODO : fill transId suing timeToTx */ - dLchSchInfo->staInd[0].nmbOfTbs = 1; - //dLchSchInfo->staInd[0].fillCrlPdu = /* TODO : Check the value needed to be filled */ - } - - /* Fill logical channel scheduling info */ - cmMemcpy((U8 *)&dLchSchInfo->staInd[0].staIndTb[0].lchStaInd[nmbDLch], (U8 *)&schRep->lchSta[idx].lchStaInd, sizeof(RguLchStaInd)); - nmbDLch++; - - } - - } - - /* Calling handler for all dedicated channels scheduling*/ - if(nmbDLch) - { - dLchSchInfo->staInd[0].staIndTb[0].nmbLch = nmbDLch; - RlcLiRguDStaInd(pst, suId, dLchSchInfo); - } - - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, schRep, sizeof(RlcMacSchedRepInfo)); - - return ROK; -} +} /* RlcProcDedLcUlData */ /** * @brief Handler for trigerring the data transfer from RLC to MAC @@ -544,14 +362,14 @@ uint16_t RlcMacProcSchedRep(Pst *pst, SuId suId, RlcMacSchedRepInfo *schRep) * */ #ifdef ANSI -S16 RlcLiRguCStaInd +S16 RlcProcCommLcSchedRpt ( Pst *pst, SuId suId, RguCStaIndInfo *staInd ) #else -S16 RlcLiRguCStaInd(pst,suId,staInd) +S16 RlcProcCommLcSchedRpt(pst,suId,staInd) Pst *pst; SuId suId; RguCStaIndInfo *staInd; @@ -560,12 +378,12 @@ RguCStaIndInfo *staInd; RlcDlRbCb *rbCb; RlcCb *tRlcCb; - TRC3(RlcLiRguCStaInd) + TRC3(RlcProcCommLcSchedRpt) #if (ERRCLASS & ERRCLS_INT_PAR) if (pst->dstInst >= MAX_RLC_INSTANCES) { - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, staInd, sizeof(RguCStaIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, staInd, sizeof(RguCStaIndInfo)); return (RFAILED); } #endif @@ -580,7 +398,7 @@ RguCStaIndInfo *staInd; ERRCLS_INT_PAR, EKW040, (ErrVal) suId, - "RlcLiRguCStaInd: Invalid RGU suId\n"); + "RlcProcCommLcSchedRpt: Invalid RGU suId\n"); return (RFAILED); } if (tRlcCb->genCfg.rlcMode == LKW_RLC_MODE_UL) @@ -588,7 +406,7 @@ RguCStaIndInfo *staInd; RLOG_ARG1(L_ERROR,DBG_LCID,staInd->lcId, "Received in RLC UL CELLID:%d", staInd->cellId); - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, staInd, sizeof(RguCStaIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, staInd, sizeof(RguCStaIndInfo)); return RFAILED; } #endif @@ -603,7 +421,7 @@ RguCStaIndInfo *staInd; "Invalid LcId, Max is [%d] CELLID:%d", RLC_MAX_LCH_PER_CELL, staInd->cellId); - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, staInd, sizeof(RguCStaIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, staInd, sizeof(RguCStaIndInfo)); return RFAILED; } #endif /* (ERRCLASS & ERRCLS_DEBUG) */ @@ -614,7 +432,7 @@ RguCStaIndInfo *staInd; RLOG_ARG1(L_ERROR, DBG_CELLID,staInd->cellId, "LcId [%d] not found CELLID:%d", staInd->lcId); - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, staInd, sizeof(RguCStaIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, staInd, sizeof(RguCStaIndInfo)); return RFAILED; } @@ -627,18 +445,18 @@ RguCStaIndInfo *staInd; /* Populate the trace params */ rlcLmmSendTrc(tRlcCb,EVTRGUCSTAIND, NULLP); } - rlcTmmSndToLi(tRlcCb, suId, rbCb, staInd); + rlcTmmSendToMac(tRlcCb, suId, rbCb, staInd); #ifndef SS_RBUF #ifdef SS_LOCKLESS_MEMORY - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, staInd, sizeof(RguCStaIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, staInd, sizeof(RguCStaIndInfo)); #else - RLC_PST_FREE(pst->region, pst->pool, staInd, sizeof(RguCStaIndInfo)); + RLC_PST_FREE(RLC_MEM_REGION_DL, RLC_POOL, staInd, sizeof(RguCStaIndInfo)); #endif #else - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, staInd, sizeof(RguCStaIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, staInd, sizeof(RguCStaIndInfo)); #endif return (ROK); -} /* RlcLiRguCStaInd */ +} /* RlcProcCommLcSchedRpt */ /** * @brief Handler for trigerring the data transfer from RLC to MAC @@ -660,26 +478,26 @@ RguCStaIndInfo *staInd; * */ #ifdef ANSI -S16 RlcLiRguDStaInd +S16 RlcProcDedLcSchedRpt ( Pst *pst, SuId suId, RguDStaIndInfo *staInd ) #else -S16 RlcLiRguDStaInd(pst, suId, staInd) +S16 RlcProcDedLcSchedRpt(pst, suId, staInd) Pst *pst; SuId suId; RguDStaIndInfo *staInd; #endif { RlcCb *gCb; - TRC3(RlcLiRguDStaInd) + TRC3(RlcProcDedLcSchedRpt) #if (ERRCLASS & ERRCLS_INT_PAR) if (pst->dstInst >= MAX_RLC_INSTANCES) { - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, staInd, sizeof(RguDStaIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, staInd, sizeof(RguDStaIndInfo)); return (RFAILED); } #endif @@ -690,7 +508,7 @@ RguDStaIndInfo *staInd; if (((RlcCb*)RLC_GET_RLCCB(pst->dstInst))->genCfg.rlcMode == LKW_RLC_MODE_UL) { RLOG_ARG0(L_ERROR,DBG_CELLID,staInd->cellId,"Received in RLC UL "); - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, staInd, sizeof(RguDStaIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, staInd, sizeof(RguDStaIndInfo)); return RFAILED; } if ((suId >= gCb->genCfg.maxRguSaps) || (suId < 0)) @@ -699,16 +517,16 @@ RguDStaIndInfo *staInd; ERRCLS_INT_PAR, EKW040, (ErrVal) suId, - "RlcLiRguDStaInd: Invalid RGU suId\n"); + "RlcProcDedLcSchedRpt: Invalid RGU suId\n"); return (RFAILED); } #endif - rlcUtlSndToLi(gCb, suId, staInd); + rlcUtlSendToMac(gCb, suId, staInd); /* kw002.201 :Freeing from proper region */ - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, staInd, sizeof(RguDStaIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, staInd, sizeof(RguDStaIndInfo)); return (ROK); -} /* RlcLiRguDStaInd */ +} /* RlcProcDedLcSchedRpt */ /** * @brief Handler for handling the flow cntrl Ind from MAC diff --git a/src/5gnrrlc/kw_lmm.c b/src/5gnrrlc/kw_lmm.c index 5ffe0506e..2772e4107 100755 --- a/src/5gnrrlc/kw_lmm.c +++ b/src/5gnrrlc/kw_lmm.c @@ -566,13 +566,13 @@ Header *hdr; */ #ifdef ANSI -S16 RlcMiRlcConfigReq +uint8_t RlcMiRlcConfigReq ( Pst *pst, RlcMngmt *cfg ) #else -S16 RlcMiRlcConfigReq (pst, cfg) +uint8_t RlcMiRlcConfigReq (pst, cfg) Pst *pst; RlcMngmt *cfg; #endif @@ -722,13 +722,13 @@ RlcMngmt *cfg; * -# RFAILED */ #ifdef ANSI -S16 RlcMiLkwCntrlReq +uint8_t RlcMiLkwCntrlReq ( Pst *pst, RlcMngmt *cntrl ) #else -S16 RlcMiLkwCntrlReq(pst, cntrl) +uint8_t RlcMiLkwCntrlReq(pst, cntrl) Pst *pst; RlcMngmt *cntrl; #endif diff --git a/src/5gnrrlc/kw_ptli.c b/src/5gnrrlc/kw_ptli.c index c41ca381d..558bc7788 100755 --- a/src/5gnrrlc/kw_ptli.c +++ b/src/5gnrrlc/kw_ptli.c @@ -62,10 +62,6 @@ #include "ss_rbuf.h" #include "ss_rbuf.x" -#ifdef EGTP_TEST -#include "mac_stub.h" -#endif /* EGTP_TEST */ - #ifndef LCKWLIRGU #define PTKWRGU #endif @@ -126,49 +122,6 @@ RguBndReq kwLiRguUbndReqMt[] = #endif /* LCRGUIRGU */ }; -/* RGU Dedicated Channel Data Request primitive */ - -RlcMacDlData rlcMacSendDlDataOpts[] = -{ -#ifdef EGTP_TEST - macStubSendDlData, - macStubSendDlData, - macStubSendDlData, -#else /* EGTP_TEST */ -#ifdef LCKWLIRGU - packDlData, /* 0 - loosely coupled */ -#endif /* LCRGUIRGU */ -#ifdef RG - MacRlcProcDlData, /* 1 - tightly coupled, MAC */ -#endif /* RG */ -#ifdef LCKWLIRGU - packDlData, /* 0 - loosely coupled */ -#endif /* LCRGUIRGU */ -#endif /* EGTP_TEST */ -}; - - -/* RLC logical Channel Status primitive */ - -RlcMacBoStatus rlcMacSendBOStatusOpts[] = -{ -#ifdef EGTP_TEST - macStubBOStatus, - macStubBOStatus, - macStubBOStatus, -#else /* EGTP_TEST */ -#ifdef LCKWLIRGU - packBOStatus, /* 0 - loosely coupled */ -#endif /* LCRGUIRGU */ -#ifdef RG - MacRlcProcBOStatus, /* 1 - tightly coupled, MAC */ -#endif /* RG */ -#ifdef LCKWLIRGU - packBOStatus, /* 0 - LWLC loosely coupled */ -#endif /* LCRGUIRGU */ -#endif /* EGTP_TEST */ -}; - /* kw005.201 added support for L2 Measurement */ #ifdef LTE_L2_MEAS #ifdef LTE_RLC_R9 @@ -276,113 +229,6 @@ Reason reason; } /* end of RlcLiRguUbndReq */ - -/** - * - * @brief - * - * Handler for sending PDU(s) from RLC to MAC for dedicated logical channels. - * - * @b Description: - * - * This function sends PDU(s) to MAC via one or more dedicated - * logical channels along with the Buffer Occupancy of these - * channels. - * - * @param[in] post Post structure - * @param[in] spId Service Provider ID - * @param[in] datIndInfo Data Request Information - * - * @return S16 - * -# ROK - * -# RFAILED - * - */ -#ifdef ANSI -S16 RlcMacSendDlData -( -Pst *post, -SpId spId, -RlcMacData *dlData -) -#else -S16 RlcMacSendDlData(post, spId, dlData) -Pst *post; -SpId spId; -RlcMacData *dlData; -#endif -{ - TRC3(RlcMacSendDlData) -#ifdef RLC_MAC_DAT_REQ_RBUF - post->event=EVTRGUDDATREQ; - if((rlcLiRguDatReqRbuf(post, spId, datReq)) != ROK) - { - - SPutStaticBuffer(post->region, post->pool, - (Data *) datReq, sizeof(RguDDatReqInfo), 0); - return RFAILED; - } -#else - /* jump to specific primitive depending on configured selector */ - (*rlcMacSendDlDataOpts[post->selector])(post, spId, dlData); -#endif - return ROK; - -} /* end of RlcLiRguDDatReq */ - - - -/** - * - * @brief - * - * Handler for reporting the Buffer Occupancy to MAC - * for logical channels. - * - * @b Description: - * - * This function reports the Buffer Occupancy of one or more - * logical channels to MAC. - * - * @param[in] post Post structure - * @param[in] spId Service Provider ID - * @param[in] boSta BO Status Information - * - * @return S16 - * -# ROK - * -# RFAILED - * - */ -#ifdef ANSI -S16 RlcMacSendBOStatus -( -Pst *post, -SpId spId, -RlcMacBOStatus *boSta -) -#else -S16 RlcMacSendBOStatus(post, spId, staRsp) -Pst *post; -SpId spId; -RlcMacBOStatus *boSta; -#endif -{ - TRC3(RlcMacSendBOStatus) -#if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF) - post->event= EVTRGUDSTARSP; - if((rlcLiRguStaRspRbuf(post, spId, staRsp)) != ROK) - { - return RFAILED; - } -#endif - /* jump to specific primitive depending on configured selector */ - (*rlcMacSendBOStatusOpts[post->selector])(post, spId, boSta); - - return ROK; - -} /* end of RlcMacSendBOStatus */ - - /* kw005.201 added support for L2 Measurement */ #ifdef LTE_L2_MEAS #ifdef LTE_RLC_R9 @@ -467,7 +313,7 @@ Void; SsRngInfoTbl[SS_RNG_BUF_ULMAC_TO_ULRLC].nPktProc++;;//Number of pkt processed in tti if(datInd != NULLP) { - RlcLiRguDDatInd(&rlcUlRbfuPst, 0, datInd); + RlcProcDedLcUlData(&rlcUlRbfuPst, 0, datInd); } else { @@ -491,7 +337,7 @@ Void; while(NULLP != elmIndx) { datInd = (RguDDatIndInfo *)elmIndx; - RlcLiRguDDatInd(&rlcUlRbfuPst, 0, datInd); + RlcProcDedLcUlData(&rlcUlRbfuPst, 0, datInd); elmIndx = NULLP; datInd = NULLP; diff --git a/src/5gnrrlc/kw_ptmi.c b/src/5gnrrlc/kw_ptmi.c index cf3889202..396fdf6f1 100755 --- a/src/5gnrrlc/kw_ptmi.c +++ b/src/5gnrrlc/kw_ptmi.c @@ -71,8 +71,6 @@ #ifdef PTKWLKW /* portable functions */ -PRIVATE S16 PtMiRlcConfigCfm ARGS((Pst *pst, RlcMngmt *cfm)); -PRIVATE S16 PtMiLkwCntrlCfm ARGS((Pst *pst, RlcMngmt *cfm)); PRIVATE S16 PtMiLkwStaInd ARGS((Pst *pst, RlcMngmt *usta)); PRIVATE S16 PtMiLkwStaCfm ARGS((Pst *pst, RlcMngmt *cfm)); @@ -98,12 +96,12 @@ PRIVATE RlcConfigCfm rlcMiRlcConfigCfmMt[MAXKWMI] = #ifdef LCKWMILKW packRlcConfigCfm, /* 0 - loosely coupled - fc */ #else - PtMiRlcConfigCfm, /* 0 - tightly coupled portable */ + //PtMiRlcConfigCfm, /* 0 - tightly coupled portable */ #endif /* LCRLMILKW */ #ifdef SM SmMiRlcConfigCfm, /* 1 - tightly coupled layer management*/ #else - PtMiRlcConfigCfm, /* 1 - tightly coupled portable */ + //PtMiRlcConfigCfm, /* 1 - tightly coupled portable */ #endif /* SM */ }; @@ -114,12 +112,12 @@ PRIVATE LkwCntrlCfm kwMiLkwCntrlCfmMt[MAXKWMI] = #ifdef LCKWMILKW cmPkLkwCntrlCfm, /* 0 - loosely coupled - fc */ #else - PtMiLkwCntrlCfm, /* 0 - tightly coupled portable */ + //PtMiLkwCntrlCfm, /* 0 - tightly coupled portable */ #endif /* LCRLMILKW */ #ifdef SM SmMiLkwCntrlCfm, /* 1 - tightly coupled layer management*/ #else - PtMiLkwCntrlCfm, /* 1 - tightly coupled portable */ + //PtMiLkwCntrlCfm, /* 1 - tightly coupled portable */ #endif /* SM */ }; @@ -501,81 +499,6 @@ U8 status; /************************************************************************* * Porting Functions ************************************************************************/ -/* - * - * Fun: configuration Confirm - * - * Desc: This function is used to confirm the receipt of configuration - * request from layer management. - * - * Ret: ROK - ok - * - * Notes: None - * - * File: kw_ptmi.c - * - */ - -#ifdef ANSI -S16 PtMiRlcConfigCfm -( -Pst *pst, /* post structure */ -RlcMngmt *cfm /* Layer Management structure */ -) -#else -S16 PtMiRlcConfigCfm(pst, cfm) -Pst *pst; /* post structure */ -RlcMngmt *cfm; /* Layer Management structure */ -#endif -{ - TRC3(PtMiRlcConfigCfm) - - UNUSED(pst); - UNUSED(cfm); - - TRC2(PtMiRlcConfigCfm() : function is not implemented) - - return ROK; -} /* end of PtMiRlcConfigCfm */ - -/* - * - * Fun: Control Confirmation - * - * Desc: This function is the portable version of used to - * confirm the receipt of configuration request from - * layer management. - * - * Ret: ROK - ok - * - * Notes: None - * - * File: kw_ptmi.c - * - */ - -#ifdef ANSI -PRIVATE S16 PtMiLkwCntrlCfm -( -Pst *pst, /* Post structure */ -RlcMngmt *cfm /* Layer Management structure */ -) -#else -PRIVATE S16 PtMiLkwCntrlCfm(pst, cfm) -Pst *pst; /* Post structure */ -RlcMngmt *cfm; /* Layer Management structure */ -#endif -{ - TRC3(PtMiLkwCntrlCfm); - - UNUSED(pst); - UNUSED(cfm); - - TRC2(PtMiLkwCntrlCfm() : function is not implemented) - - return ROK; -} /* end of PtMiLkwCntrlCfm */ - /* * diff --git a/src/5gnrrlc/kw_ptui.c b/src/5gnrrlc/kw_ptui.c index 7b2028cd8..fdcd043ca 100755 --- a/src/5gnrrlc/kw_ptui.c +++ b/src/5gnrrlc/kw_ptui.c @@ -317,27 +317,27 @@ U8 status; /* Status */ * -# RFAILED */ #ifdef ANSI -S16 RlcUiKwuDatInd +S16 rlcSendUlDataToDu ( Pst *pst, KwuDatIndInfo *datInd, Buffer *mBuf ) #else -S16 RlcUiKwuDatInd(pst, datInd, mBuf) +S16 rlcSendUlDataToDu(pst, datInd, mBuf) Pst *pst; KwuDatIndInfo *datInd; Buffer *mBuf; #endif { - TRC3(RlcUiKwuDatInd) + TRC3(rlcSendUlDataToDu) /* jump to specific primitive depending on configured selector */ (*kwUiKwuDatIndMt[pst->selector])(pst, datInd, mBuf); return ROK; -} /* end of RlcUiKwuDatInd */ +} /* end of rlcSendUlDataToDu */ int rlcDatCfmsSent = 0; @@ -835,13 +835,13 @@ Void; datReq = (RxmBufReq *)elmIndx; if(datReq->mBuf != NULLP) { - cmUnpkKwuDatReq(RlcUiKwuDatReq, &datReq->pst, datReq->mBuf); + cmUnpkKwuDatReq(RlcProcDlData, &datReq->pst, datReq->mBuf); } else { RLOG0(L_ERROR, "mBuf is NULL"); if(datReq->mBuf) - cmUnpkKwuDatReq(RlcUiKwuDatReq, &datReq->pst, datReq->mBuf); + cmUnpkKwuDatReq(RlcProcDlData, &datReq->pst, datReq->mBuf); } SsRngInfoTbl[SS_RNG_BUF_RX_TO_DLRLC].nPktProc++;//Number of pkt processed in tti @@ -926,7 +926,7 @@ Void; SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].nPktProc++;;//Number of pkt processed in tti if(kwuDatReqDetl->mBuf != NULLP) { - RlcUiKwuDatReq(&rlcDlRbfuPst, kwuDatReqDetl->spId, &datReq, kwuDatReqDetl->mBuf); + RlcProcDlData(&rlcDlRbfuPst, kwuDatReqDetl->spId, &datReq, kwuDatReqDetl->mBuf); } SRngIncrRIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC); rngBufDeqIndx++; diff --git a/src/5gnrrlc/kw_tmm_dl.c b/src/5gnrrlc/kw_tmm_dl.c index 26c5a3c03..cb1954988 100755 --- a/src/5gnrrlc/kw_tmm_dl.c +++ b/src/5gnrrlc/kw_tmm_dl.c @@ -26,8 +26,8 @@ reassembly.This file contains following functions --rlcTmmQSdu - --rlcTmmSndToLi - --rlcTmmRcvFrmLi + --rlcTmmSendToMac + --rlcTmmRcvFrmMac --kwTmmReEstablish File: kw_tmm_dl.c @@ -63,10 +63,13 @@ static int RLOG_FILE_ID=200; #include "kw.x" #include "kw_udx.x" #include "kw_dl.x" +#include "rlc_utils.h" +#include "rlc_mac_inf.h" +#include "rlc_lwr_inf_api.h" #define RLC_MODULE (RLC_DBGMASK_TM | RLC_DBGMASK_DL) -PRIVATE Void rlcTmmSndStaRsp ARGS((RlcCb *gCb, RlcDlRbCb *rbCb, +PRIVATE Void rlcTmmSendBoSta ARGS((RlcCb *gCb, RlcDlRbCb *rbCb, MsgLen bo, KwuDatReqInfo *datReqInfo)); extern U32 rgMacGT ; /** @addtogroup tmmode */ @@ -147,7 +150,7 @@ Buffer *mBuf; cmLListAdd2Tail(&(rbCb->m.tm.sduQ), &(sdu->lstEnt)); sdu->lstEnt.node = (PTR)sdu; - rlcTmmSndStaRsp(gCb, rbCb, sdu->sduSz, datReqInfo); + rlcTmmSendBoSta(gCb, rbCb, sdu->sduSz, datReqInfo); RETVOID; } @@ -168,7 +171,7 @@ Buffer *mBuf; * -# RFAILED */ #ifdef ANSI -Void rlcTmmSndToLi +Void rlcTmmSendToMac ( RlcCb *gCb, SuId suId, @@ -176,20 +179,23 @@ RlcDlRbCb *rbCb, RguCStaIndInfo *staInd ) #else -Void rlcTmmSndToLi(gCb, suId, rbCb, staInd) +Void rlcTmmSendToMac(gCb, suId, rbCb, staInd) RlcCb *gCb; SuId suId; RlcDlRbCb *rbCb; RguCStaIndInfo *staInd; #endif { + Pst pst; CmLList *node; /* Current Link List Node */ - RlcSdu *sdu; /* SDU */ - RlcMacData *dlData; + RlcSdu *sdu; /* SDU */ + RlcData *dlData; + uint16_t pduLen; + uint16_t copyLen; S16 timeDiff = 0; Ticks curTime = 0; - TRC2(rlcTmmSndToLi) + TRC2(rlcTmmSendToMac) CM_LLIST_FIRST_NODE(&(rbCb->m.tm.sduQ), @@ -353,9 +359,8 @@ RguCStaIndInfo *staInd; } sdu = (RlcSdu *)node->node; - RLC_ALLOC_SHRABL_BUF(gCb->u.dlCb->rguDlSap[suId].pst.region, - gCb->u.dlCb->rguDlSap[suId].pst.pool, - dlData,(Size)sizeof(RlcMacData)); + RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL, + dlData,(Size)sizeof(RlcData)); #if (ERRCLASS & ERRCLS_ADD_RES) if ( dlData == NULLP ) { @@ -374,7 +379,22 @@ RguCStaIndInfo *staInd; dlData->numPdu = 1; dlData->pduInfo[0].commCh = TRUE; dlData->pduInfo[0].lcId = rbCb->lch.lChId; - dlData->pduInfo[0].pduBuf = sdu->mBuf; + + /* Copy Message to fixed buffer to send */ + ODU_FIND_MSG_LEN(sdu->mBuf, (MsgLen *)&pduLen); + RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL, + dlData->pduInfo[0].pduBuf, pduLen); + if (dlData->pduInfo[0].pduBuf == NULLP ) + { + DU_LOG("Memory allocation failed"); + RETVOID; + } + ODU_COPY_MSG_TO_FIX_BUF(sdu->mBuf, 0, pduLen, \ + dlData->pduInfo[0].pduBuf, (MsgLen *)©Len); + dlData->pduInfo[0].pduLen = pduLen; + + /* Free message */ + ODU_PUT_MSG_BUF(sdu->mBuf); /* kw005.201 ccpu00117318, updating the statistics */ gCb->genSts.bytesSent += sdu->sduSz; @@ -392,12 +412,22 @@ RguCStaIndInfo *staInd; if(gCb->init.trc == TRUE) { /* Populate the trace params */ - rlcLmmSendTrc(gCb,EVTRLCDLDAT, NULLP); + rlcLmmSendTrc(gCb, EVENT_DL_DATA_TO_MAC, NULLP); } - - RlcMacSendDlData(&(gCb->u.dlCb->rguDlSap[suId].pst), - gCb->u.dlCb->rguDlSap[suId].spId, - dlData); + + /* Fill Pst structure. Copying rguSap->pst to pst to avoid any + * changes in rguSap->pst */ + memset(&pst, 0, sizeof(Pst)); + FILL_PST_RLC_TO_MAC(pst, gCb->u.dlCb->rguDlSap[suId].pst.dstProcId, \ + RLC_DL_INST, EVENT_DL_DATA_TO_MAC); + + if(RlcSendDlDataToMac(&pst, dlData) != ROK) + { + RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlData->pduInfo[0].pduBuf, \ + dlData->pduInfo[0].pduLen); + RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlData, sizeof(RlcData)); + } + RETVOID; } @@ -459,7 +489,7 @@ RlcDlRbCb *rbCb; */ #ifdef ANSI -PRIVATE Void rlcTmmSndStaRsp +PRIVATE Void rlcTmmSendBoSta ( RlcCb *gCb, RlcDlRbCb *rbCb, @@ -467,25 +497,24 @@ MsgLen bo, KwuDatReqInfo *datReqInfo ) #else -PRIVATE Void rlcTmmSndStaRsp(rbCb,bo,datReqInfo) +PRIVATE Void rlcTmmSendBoSta(rbCb,bo,datReqInfo) RlcCb *gCb; RlcDlRbCb *rbCb; MsgLen bo; KwuDatReqInfo *datReqInfo; #endif { -// RguCStaRspInfo *staRspInfo; /* Status Response Information */ - RlcMacBOStatus *boStatus; /* Buffer occupancy status information */ - RlcRguSapCb *rguSap; /* SAP Information */ + Pst pst; /* Post structure */ + RlcBoStatus *boStatus; /* Buffer occupancy status information */ + RlcRguSapCb *rguSap; /* SAP Information */ - TRC3(rlcTmmSndStaRsp) + TRC3(rlcTmmSendBoSta) rguSap = &(gCb->u.dlCb->rguDlSap[rbCb->rguSapId]); - RLC_ALLOC_SHRABL_BUF(gCb->u.dlCb->rguDlSap[rbCb->rguSapId].pst.region, - gCb->u.dlCb->rguDlSap[rbCb->rguSapId].pst.pool, - boStatus, sizeof(RguCStaRspInfo)); + RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL, + boStatus, sizeof(RlcBoStatus)); #if (ERRCLASS & ERRCLS_ADD_RES) if ( boStatus == NULLP ) { @@ -498,7 +527,7 @@ KwuDatReqInfo *datReqInfo; #endif /* ERRCLASS & ERRCLS_ADD_RES */ boStatus->cellId = rbCb->rlcId.cellId; - boStatus->rnti = rbCb->rlcId.ueId; + boStatus->ueIdx = rbCb->rlcId.ueId; boStatus->commCh = TRUE; boStatus->lcId = rbCb->lch.lChId; boStatus->bo = bo; @@ -507,10 +536,19 @@ KwuDatReqInfo *datReqInfo; if(gCb->init.trc == TRUE) { /* Populate the trace params */ - rlcLmmSendTrc(gCb, EVTRLCBOSTA, NULLP); + rlcLmmSendTrc(gCb, EVENT_BO_STATUS_TO_MAC, NULLP); } - RlcMacSendBOStatus(&rguSap->pst, rguSap->spId, boStatus); + /* Fill Pst structure. Copying rguSap->pst to pst to avoid any + * changes in rguSap->pst */ + memset(&pst, 0, sizeof(Pst)); + FILL_PST_RLC_TO_MAC(pst, rguSap->pst.dstProcId, \ + RLC_DL_INST, EVENT_DL_DATA_TO_MAC); + + if(RlcSendBoStatusToMac(&pst, boStatus) != ROK) + { + RLC_FREE_SHRABL_BUF(pst.region, pst.pool, boStatus, sizeof(RlcBoStatus)); + } RETVOID; } diff --git a/src/5gnrrlc/kw_tmm_ul.c b/src/5gnrrlc/kw_tmm_ul.c index 6777cdf93..641fb5e8d 100755 --- a/src/5gnrrlc/kw_tmm_ul.c +++ b/src/5gnrrlc/kw_tmm_ul.c @@ -26,8 +26,8 @@ reassembly.This file contains following functions --rlcTmmQSdu - --rlcTmmSndToLi - --rlcTmmRcvFrmLi + --rlcTmmSendToMac + --rlcTmmRcvFrmMac --kwTmmReEstablish File: kw_tmm_ul.c @@ -109,7 +109,7 @@ U8 rrcUeCapabilityInfo[] = #ifdef PJ Pst ulPst2 ={100,100,217,0,216,0,PRIOR0,0,68,0,1,0,0}; #endif - TRC2(rlcTmmRcvFrmLi) + TRC2(rlcTmmRcvFrmMac) if(1 == rrcMsgType) { @@ -129,7 +129,7 @@ U8 rrcUeCapabilityInfo[] = RLOG1(L_INFO,"Profiling Framework Sending RRC Connection Req to RRC for UE :%d\n",crnti); printf("Profiling Framework Sending RRC Connection Req to RRC for UE :%d\n",crnti); - RlcUiKwuDatInd(&ulPst1, datIndInfo, pdu); + rlcSendUlDataToDu(&ulPst1, datIndInfo, pdu); } else if(2 == rrcMsgType) { @@ -246,7 +246,7 @@ U8 rrcUeCapabilityInfo[] = */ #ifdef CCPU_OPT #ifdef ANSI -Void rlcTmmRcvFrmLi +Void rlcTmmRcvFrmMac ( RlcCb *gCb, RlcUlRbCb *rbCb, @@ -254,7 +254,7 @@ CmLteRnti tCrnti, Buffer *pdu ) #else -Void rlcTmmRcvFrmLi(gCb,rbCb, tCrnti, pdu) +Void rlcTmmRcvFrmMac(gCb,rbCb, tCrnti, pdu) RlcCb *gCb; RlcUlRbCb *rbCb; CmLteRnti tCrnti; @@ -262,14 +262,14 @@ Buffer *pdu; #endif #else #ifdef ANSI -Void rlcTmmRcvFrmLi +Void rlcTmmRcvFrmMac ( RlcCb *gCb, RlcUlRbCb *rbCb, Buffer *pdu ) #else -Void rlcTmmRcvFrmLi(gCb,rbCb, pdu) +Void rlcTmmRcvFrmMac(gCb,rbCb, pdu) RlcCb *gCb; RlcUlRbCb *rbCb; Buffer *pdu; @@ -281,10 +281,10 @@ Buffer *pdu; uint16_t copyLen; /* Number of bytes copied */ Pst pst; - TRC2(rlcTmmRcvFrmLi) + TRC2(rlcTmmRcvFrmMac) gCb->genSts.pdusRecv++; - SFndLenMsg(pdu, (MsgLen *)&msgLen); + ODU_FIND_MSG_LEN(pdu, (MsgLen *)&msgLen); gCb->genSts.bytesRecv += msgLen; /* If trace flag is enabled send the trace indication */ if(gCb->init.trc == TRUE) @@ -305,7 +305,7 @@ Buffer *pdu; ulRrcMsgInfo->rrcMsg, msgLen); if (ulRrcMsgInfo->rrcMsg) { - SCpyMsgFix(pdu, 0, msgLen, ulRrcMsgInfo->rrcMsg, (MsgLen *)©Len); + ODU_COPY_MSG_TO_FIX_BUF(pdu, 0, msgLen, ulRrcMsgInfo->rrcMsg, (MsgLen *)©Len); ulRrcMsgInfo->msgLen = msgLen; /* Sending UL RRC Message transfeer to DU APP */ diff --git a/src/5gnrrlc/kw_udx_dl.c b/src/5gnrrlc/kw_udx_dl.c index 1155b9dbd..0d16fe72b 100755 --- a/src/5gnrrlc/kw_udx_dl.c +++ b/src/5gnrrlc/kw_udx_dl.c @@ -546,7 +546,7 @@ RlcUdxDlStaPdu *pStaPdu; } AMDL.pStaPdu = pStaPdu; - rlcAmmSendDStaRsp(tRlcCb, rbCb, &AMDL); + rlcAmmSendDedLcBoSta(tRlcCb, rbCb, &AMDL); return (ROK); } diff --git a/src/5gnrrlc/kw_udx_ul.c b/src/5gnrrlc/kw_udx_ul.c index ac6dc9877..6e474660f 100755 --- a/src/5gnrrlc/kw_udx_ul.c +++ b/src/5gnrrlc/kw_udx_ul.c @@ -60,9 +60,9 @@ static int RLOG_FILE_ID=204; #include "kw_dl.x" #include "kw_ul.x" -#include "rlc_utils.h" #include "du_app_rlc_inf.h" #include "rlc_mgr.h" +#include "rlc_utils.h" #define RLC_MODULE RLC_DBGMASK_UDX /* local defines */ diff --git a/src/5gnrrlc/kw_uim.c b/src/5gnrrlc/kw_uim.c index 0bb8e3623..f3e3ea25e 100755 --- a/src/5gnrrlc/kw_uim.c +++ b/src/5gnrrlc/kw_uim.c @@ -31,7 +31,7 @@ --RlcUiKwuBndReq --RlcUiKwuUbndReq - --RlcUiKwuDatReq + --RlcProcDlData --RlcUiKwuDiscSduReq File: kw_uim.c @@ -786,14 +786,14 @@ Reason reason; * -# RFAILED */ #ifdef ANSI -S16 RlcUiKwuDatReq +S16 RlcProcDlData ( Pst *pst, KwuDatReqInfo *datReq, Buffer *mBuf ) #else -S16 RlcUiKwuDatReq(pst, datReq, mBuf) +S16 RlcProcDlData(pst, datReq, mBuf) Pst *pst; KwuDatReqInfo *datReq; Buffer *mBuf; @@ -803,7 +803,7 @@ Buffer *mBuf; RlcDlRbCb *rbCb; /* RB Control Block */ RlcCb *tRlcCb; - TRC3(RlcUiKwuDatReq) + TRC3(RlcProcDlData) DU_LOG("\nRLC : Received DL Data"); diff --git a/src/5gnrrlc/kw_ul.x b/src/5gnrrlc/kw_ul.x index 4474eb22d..cfeab4664 100755 --- a/src/5gnrrlc/kw_ul.x +++ b/src/5gnrrlc/kw_ul.x @@ -477,12 +477,12 @@ EXTERN Void rlcDbmUlShutdown ARGS ((RlcCb *gCb)); * Transparent Mode Functions ***************************************************************************/ #ifdef CCPU_OPT -EXTERN Void rlcTmmRcvFrmLi ARGS ((RlcCb *gCb, +EXTERN Void rlcTmmRcvFrmMac ARGS ((RlcCb *gCb, RlcUlRbCb *rbCb, CmLteRnti tCrnti, Buffer *pdu)); #else /* CCPU_OPT */ -EXTERN Void rlcTmmRcvFrmLi ARGS ((RlcCb *gCb, +EXTERN Void rlcTmmRcvFrmMac ARGS ((RlcCb *gCb, RlcUlRbCb *rbCb, Buffer *pdu)); #endif /* CCPU_OPT */ @@ -550,9 +550,9 @@ EXTERN Void rlcUtlDelRecBuf ARGS ((CmLListCp *recBufLst, RlcCb *gCb )); -EXTERN S16 rlcUtlRcvFrmLi ARGS ((RlcCb *gCb, KwDatIndInfo *datIndInfo)); +EXTERN S16 rlcUtlRcvFrmMac ARGS ((RlcCb *gCb, KwDatIndInfo *datIndInfo)); -EXTERN S16 rlcUtlSndDatInd ARGS ((RlcCb *gCb,RlcUlRbCb *rbCb, Buffer *sdu)); +EXTERN S16 rlcUtlSendUlDataToDu ARGS ((RlcCb *gCb,RlcUlRbCb *rbCb, Buffer *sdu)); #ifdef LTE_L2_MEAS EXTERN S16 rlcUtlHdlL2TmrExp ARGS (( RlcCb *gCb, RlcL2MeasEvtCb *measEvtCb)); diff --git a/src/5gnrrlc/kw_ul_ex_ms.c b/src/5gnrrlc/kw_ul_ex_ms.c index 8f9218d88..2cc4217b4 100755 --- a/src/5gnrrlc/kw_ul_ex_ms.c +++ b/src/5gnrrlc/kw_ul_ex_ms.c @@ -58,6 +58,7 @@ static int RLOG_FILE_ID=206; #include "kw_ul.x" #include "kw_udx.x" +#include "rlc_mac_inf.h" #include "du_app_rlc_inf.h" #ifdef TENB_STATS @@ -430,9 +431,9 @@ Buffer *mBuf; /* message buffer */ break; } - case EVTRLCULDAT: /* Dedicated Channel Data request */ + case EVENT_UL_DATA_TO_RLC: /* UL Data request */ { - ret = unpackRcvdUlData(RlcProcUlData, pst, mBuf); + ret = unpackRlcUlData(RlcProcUlData, pst, mBuf); break; } diff --git a/src/5gnrrlc/kw_umm_dl.c b/src/5gnrrlc/kw_umm_dl.c index 739d39b31..c6c43601c 100755 --- a/src/5gnrrlc/kw_umm_dl.c +++ b/src/5gnrrlc/kw_umm_dl.c @@ -170,7 +170,7 @@ Buffer *mBuf; if(!rlcDlUtlIsReestInProgress(rbCb)) { - rlcUtlSndDStaRsp(gCb,rbCb,rbCb->m.umDl.bo,rbCb->m.umDl.estHdrSz,FALSE,0); + rlcUtlSendDedLcBoSta(gCb,rbCb,rbCb->m.umDl.bo,rbCb->m.umDl.estHdrSz,FALSE,0); } /* kw005.201 added support for L2 Measurement */ diff --git a/src/5gnrrlc/kw_umm_ul.c b/src/5gnrrlc/kw_umm_ul.c index 8c4f89770..94848188e 100755 --- a/src/5gnrrlc/kw_umm_ul.c +++ b/src/5gnrrlc/kw_umm_ul.c @@ -497,7 +497,7 @@ RlcUmRecBuf *umRecBuf; RLC_FREE_BUF(sdu); if (liCount > 0 || !(fi & 1)) { - rlcUtlSndDatInd(gCb,rbCb,*partialSdu); + rlcUtlSendUlDataToDu(gCb,rbCb,*partialSdu); *partialSdu = NULLP; } } @@ -524,7 +524,7 @@ RlcUmRecBuf *umRecBuf; if (liCount > 0 || !( fi & 1)) { - rlcUtlSndDatInd(gCb,rbCb,sdu); + rlcUtlSendUlDataToDu(gCb,rbCb,sdu); } else { @@ -545,7 +545,7 @@ RlcUmRecBuf *umRecBuf; } else { - rlcUtlSndDatInd(gCb, rbCb, sdu); + rlcUtlSendUlDataToDu(gCb, rbCb, sdu); } } /* @@ -553,7 +553,7 @@ RlcUmRecBuf *umRecBuf; just send the SDU to the upper layer */ else { - rlcUtlSndDatInd(gCb, rbCb, sdu); + rlcUtlSendUlDataToDu(gCb, rbCb, sdu); } } rbCb->m.umUl.sn = sn; diff --git a/src/5gnrrlc/kw_utl_dl.c b/src/5gnrrlc/kw_utl_dl.c index 1d1c3fb19..867649ed5 100755 --- a/src/5gnrrlc/kw_utl_dl.c +++ b/src/5gnrrlc/kw_utl_dl.c @@ -25,11 +25,11 @@ Desc: Source code for RLC Utility Module This file contains following functions - --rlcUtlSndToLi - --rlcUtlRcvFrmLi + --rlcUtlSendToMac + --rlcUtlRcvFrmMac --rlcUtlEmptySduQ - --rlcUtlSndDStaRsp - --rlcUtlSndDatInd + --rlcUtlSendDedLcBoSta + --rlcUtlSendUlDataToDu --kwUtlShutDown File: kw_utl_dl.c @@ -71,6 +71,10 @@ static int RLOG_FILE_ID=209; #include "kw_udx.x" /* UDX interface includes */ #include "kw_dl.x" /* RLC downlink includes */ +#include "rlc_utils.h" +#include "rlc_mac_inf.h" +#include "rlc_lwr_inf_api.h" + #include "ss_rbuf.h" #include "ss_rbuf.x" @@ -209,7 +213,7 @@ Void PrintRLCStats(Void) * This function stores DL PDU info for all logical channels * of per UE grant per TTI and sends to MAC * - * Function : RlcLiRguDDatReq + * Function : rlcSendDedLcDlData * * @params[in] * @return ROK - success @@ -217,14 +221,14 @@ Void PrintRLCStats(Void) * * ****************************************************************/ #ifdef ANSI -S16 RlcLiRguDDatReq +S16 rlcSendDedLcDlData ( Pst *post, SpId spId, RguDDatReqInfo *datReqInfo ) #else -S16 RlcLiRguDDatReq(post, spId, datReqInfo) +S16 rlcSendDedLcDlData(post, spId, datReqInfo) Pst *post; SpId spId; RguDDatReqInfo *datReqInfo; @@ -237,15 +241,18 @@ RguDDatReqInfo *datReqInfo; RguDDatReqPerUe datPerUe; /* DL data info per UE */ RguDatReqTb datPerTb; /* DL data info per TB */ RguLchDatReq datPerLch; /* DL data info per Lch */ - RlcMacData *dlData; /* DL data to be sent to MAC */ + RlcData *dlData; /* DL data to be sent to MAC */ + Pst pst; /* Post structure */ + uint16_t pduLen; /* PDU length */ + uint16_t copyLen; /* Number of bytes copied */ - TRC3(RlcLiRguDDatReq) + TRC3(rlcSendDedLcDlData) dlData = NULLP; - RLC_ALLOC_SHRABL_BUF(post->region, post->pool, - dlData, sizeof(RlcMacData)); + RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL, + dlData, sizeof(RlcData)); #if (ERRCLASS & ERRCLS_ADD_RES) - if ( datReqInfo == NULLP ) + if ( dlData == NULLP ) { RLOG0(L_FATAL,"Memory allocation failed"); return RFAILED; @@ -256,11 +263,12 @@ RguDDatReqInfo *datReqInfo; { datPerUe = datReqInfo->datReq[ueIdx]; - cmMemset((U8 *)dlData, 0, sizeof(RlcMacData)); + memset((U8 *)dlData, 0, sizeof(RlcData)); dlData->cellId = datReqInfo->cellId; dlData->rnti = datPerUe.rnti; - //dlData->timeToTx = datPerUe.transId; /* Derive timing info from transId */ + dlData->slotInfo.sfn = datPerUe.transId >> 16; + dlData->slotInfo.slot = datPerUe.transId & 0xffff; dlData->numPdu = 0; for(tbIdx = 0; tbIdx < datPerUe.nmbOfTbs; tbIdx++) @@ -273,22 +281,47 @@ RguDDatReqInfo *datReqInfo; { dlData->pduInfo[dlData->numPdu].commCh = FALSE; dlData->pduInfo[dlData->numPdu].lcId = datPerLch.lcId; - dlData->pduInfo[dlData->numPdu].pduBuf = datPerLch.pdu.mBuf[pduIdx]; + + /* Copy Message to fixed buffer to send */ + ODU_FIND_MSG_LEN(datPerLch.pdu.mBuf[pduIdx], (MsgLen *)&pduLen); + RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL, + dlData->pduInfo[dlData->numPdu].pduBuf, pduLen); + if (dlData->pduInfo[dlData->numPdu].pduBuf == NULLP ) + { + DU_LOG("Memory allocation failed"); + RETVALUE(RFAILED); + } + ODU_COPY_MSG_TO_FIX_BUF(datPerLch.pdu.mBuf[pduIdx], 0, pduLen, \ + dlData->pduInfo[dlData->numPdu].pduBuf, (MsgLen *)©Len); + dlData->pduInfo[dlData->numPdu].pduLen = pduLen; + + /* Free message */ + ODU_PUT_MSG_BUF(datPerLch.pdu.mBuf[pduIdx]); + dlData->numPdu++; }/* For per PDU */ }/* For Data per Lch */ }/* For Data per Tb */ - RlcMacSendDlData(post, spId, dlData); + + /* Sending DL Data per UE to MAC */ + memset(&pst, 0, sizeof(Pst)); + FILL_PST_RLC_TO_MAC(pst, post->dstProcId, RLC_DL_INST, EVENT_DL_DATA_TO_MAC); + if(RlcSendDlDataToMac(&pst, dlData) != ROK) + { + 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)); + } } /* For Data per UE */ - /* Check if to be freed here */ - - RLC_FREE_SHRABL_BUF(post->region, - post->pool, + RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(RguDDatReqInfo)); return ROK; -}/* End of RlcLiRguDDatReq */ +}/* End of rlcSendDedLcDlData */ /** * @@ -311,19 +344,20 @@ RguDDatReqInfo *datReqInfo; * */ #ifdef ANSI -S16 rlcUtlSndToLi +S16 rlcUtlSendToMac ( RlcCb *gCb, SuId suId, KwDStaIndInfo *staIndInfo ) #else -S16 rlcUtlSndToLi(gCb, suId, staIndInfo) +S16 rlcUtlSendToMac(gCb, suId, staIndInfo) RlcCb *gCb; SuId suId; KwDStaIndInfo *staIndInfo; #endif { + uint16_t ueIdx; RlcDlUeCb *ueCb; /* UE control block */ U32 count; /* Loop Counter */ U32 numTb; /* Number of Tbs */ @@ -347,12 +381,11 @@ KwDStaIndInfo *staIndInfo; //Debug U32 staIndSz=0,datIndSz = 0; - TRC2(rlcUtlSndToLi) + TRC2(rlcUtlSendToMac) datReqInfo = NULLP; - RLC_ALLOC_SHRABL_BUF(gCb->u.dlCb->rguDlSap->pst.region, - gCb->u.dlCb->rguDlSap->pst.pool, + RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo,sizeof(RguDDatReqInfo)); #if (ERRCLASS & ERRCLS_ADD_RES) if ( datReqInfo == NULLP ) @@ -366,7 +399,8 @@ KwDStaIndInfo *staIndInfo; { staInd = &staIndInfo->staInd[idx]; /* Fetch Ue control block */ - if(ROK != rlcDbmFetchDlUeCb(gCb,staInd->rnti,staIndInfo->cellId,&ueCb)) + GET_UE_IDX(staInd->rnti, ueIdx); + if(ROK != rlcDbmFetchDlUeCb(gCb, ueIdx, staIndInfo->cellId,&ueCb)) { /* Fetch UeCb failed */ RLOG_ARG1(L_ERROR, DBG_CELLID,staIndInfo->cellId, @@ -543,12 +577,12 @@ KwDStaIndInfo *staIndInfo; if(TRUE == gCb->init.trc ) { /* Populate the trace params */ - rlcLmmSendTrc(gCb,EVTRGUDDATREQ, NULLP); + rlcLmmSendTrc(gCb, EVENT_BO_STATUS_TO_MAC, NULLP); } rguSap = &(gCb->u.dlCb->rguDlSap[suId]); //Debug - RlcLiRguDDatReq(&rguSap->pst,rguSap->spId,datReqInfo); + rlcSendDedLcDlData(&rguSap->pst,rguSap->spId,datReqInfo); return ROK; } @@ -573,7 +607,7 @@ KwDStaIndInfo *staIndInfo; * -# RFAILED */ #ifdef ANSI -S16 rlcUtlSndDStaRsp +S16 rlcUtlSendDedLcBoSta ( RlcCb *gCb, RlcDlRbCb *rbCb, @@ -583,7 +617,7 @@ Bool staPduPrsnt, U32 staPduBo ) #else -S16 rlcUtlSndDStaRsp(gCb,rbCb,bo,estHdrSz,staPduPrsnt,staPduBo) +S16 rlcUtlSendDedLcBoSta(gCb,rbCb,bo,estHdrSz,staPduPrsnt,staPduBo) RlcCb *gCb; RlcDlRbCb *rbCb; S32 bo; @@ -592,9 +626,11 @@ Bool staPduPrsnt; U32 staPduBo; #endif { - RlcMacBOStatus boStatus; /* Buffer occupancy status information */ - RlcRguSapCb *rguSap; /* MAC SAP Information */ - TRC3(rlcUtlSndDStaRsp) + Pst pst; /* Post info */ + RlcBoStatus *boStatus; /* Buffer occupancy status information */ + RlcRguSapCb *rguSap; /* MAC SAP Information */ + + TRC3(rlcUtlSendDedLcBoSta) #ifndef TENB_ACC if ((rbCb->lastRprtdBoToMac > (U32)8000) && (rbCb->boUnRprtdCnt < (U32)5) && (!staPduPrsnt) && ((CM_LTE_MODE_AM == rbCb->mode ) && (AMDL.nxtRetx == NULLP))) @@ -609,21 +645,28 @@ U32 staPduBo; rbCb->boUnRprtdCnt = (U32)0; rbCb->lastRprtdBoToMac = (U32)bo; - boStatus.cellId = rbCb->rlcId.cellId; - boStatus.rnti = rbCb->rlcId.ueId; - boStatus.commCh = FALSE; - boStatus.lcId = rbCb->lch.lChId; - boStatus.bo = bo; + RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL, \ + boStatus, sizeof(RlcBoStatus)); + + boStatus->cellId = rbCb->rlcId.cellId; + boStatus->ueIdx = rbCb->rlcId.ueId; + boStatus->commCh = FALSE; + boStatus->lcId = rbCb->lch.lChId; + boStatus->bo = bo; /* If trace flag is enabled send the trace indication */ if(gCb->init.trc == TRUE) { /* Populate the trace params */ - rlcLmmSendTrc(gCb, EVTRLCBOSTA, NULLP); + rlcLmmSendTrc(gCb, EVENT_BO_STATUS_TO_MAC, NULLP); } - /* Send Status Response to MAC layer */ - RlcMacSendBOStatus(&rguSap->pst,rguSap->spId,&boStatus); + FILL_PST_RLC_TO_MAC(pst, rguSap->pst.dstProcId, RLC_DL_INST, EVENT_BO_STATUS_TO_MAC); + /* Send Status Response to MAC layer */ + if(RlcSendBoStatusToMac(&pst, boStatus) != ROK) + { + RLC_FREE_SHRABL_BUF(pst.region, pst.pool, boStatus, sizeof(RlcBoStatus)); + } return ROK; } @@ -803,7 +846,7 @@ RlcDlRbCb *rbCb; rbCb->m.umDl.estHdrSz= 0; } - rlcUtlSndDStaRsp(gCb, rbCb, 0, 0, FALSE,0); + rlcUtlSendDedLcBoSta(gCb, rbCb, 0, 0, FALSE,0); RETVOID; } diff --git a/src/5gnrrlc/kw_utl_ul.c b/src/5gnrrlc/kw_utl_ul.c index 1b70dcec6..0bf138877 100755 --- a/src/5gnrrlc/kw_utl_ul.c +++ b/src/5gnrrlc/kw_utl_ul.c @@ -25,10 +25,10 @@ Desc: Source code for RLC Utility Module This file contains following functions - --rlcUtlSndToLi - --rlcUtlRcvFrmLi + --rlcUtlSendToMac + --rlcUtlRcvFrmMac --rlcUtlEmptySduQ - --rlcUtlSndDatInd + --rlcUtlSendUlDataToDu --kwUtlShutDown File: kw_utl_ul.c @@ -69,6 +69,10 @@ static int RLOG_FILE_ID=210; #include "kw_ul.x" /* RLC uplink includes */ #include "ss_rbuf.h" #include "ss_rbuf.x" +#include "rlc_utils.h" +#include "du_app_rlc_inf.h" +#include "rlc_upr_inf_api.h" + #ifdef SS_RBUF S16 SMrkUlPkt(Buffer *mbuf); #endif @@ -96,13 +100,13 @@ RlcAmRecBuf* rlcUtlGetRecBuf(CmLListCp *recBufLst, RlcSn sn); * */ #ifdef ANSI -S16 rlcUtlRcvFrmLi +S16 rlcUtlRcvFrmMac ( RlcCb *gCb, KwDatIndInfo *datIndInfo ) #else -S16 rlcUtlRcvFrmLi(gCb,datIndInfo) +S16 rlcUtlRcvFrmMac(gCb,datIndInfo) RlcCb *gCb; KwDatIndInfo *datIndInfo; #endif @@ -113,7 +117,7 @@ KwDatIndInfo *datIndInfo; RlcUlUeCb *ueCb; /* UE Control Block */ /* kw005.201 added support for L2 Measurement */ - TRC2(rlcUtlRcvFrmLi) + TRC2(rlcUtlRcvFrmMac) ueCb = NULLP; @@ -215,14 +219,14 @@ KwDatIndInfo *datIndInfo; * -# ROK */ #ifdef ANSI -S16 rlcUtlSndDatInd +S16 rlcUtlSendUlDataToDu ( RlcCb *gCb, RlcUlRbCb *rbCb, Buffer *sdu ) #else -S16 rlcUtlSndDatInd(gCb,rbCb,sdu) +S16 rlcUtlSendUlDataToDu(gCb,rbCb,sdu) RlcCb *gCb; RlcUlRbCb *rbCb; Buffer *sdu; @@ -232,8 +236,11 @@ Buffer *sdu; KwuDatIndInfo *datIndInfo; /* Data Indication Information */ KwuDatIndInfo datIndInfoTmp; #endif + RlcUlRrcMsgInfo *ulRrcMsgInfo; + uint16_t msgLen, copyLen; + Pst pst; - TRC3(rlcUtlSndDatInd) + TRC3(rlcUtlSendUlDataToDu) #ifndef KW_PDCP @@ -263,14 +270,44 @@ Buffer *sdu; if(gCb->init.trc == TRUE) { /* Populate the trace params */ - rlcLmmSendTrc(gCb,KWU_EVT_DAT_IND, sdu); + rlcLmmSendTrc(gCb, EVENT_UL_RRC_MSG_TRANS_TO_DU, sdu); } -#ifndef KW_PDCP - RlcUiKwuDatInd(&gCb->genCfg.lmPst, datIndInfo, sdu); -#endif + /* Filling UL RRC Message Info */ + RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, + ulRrcMsgInfo, sizeof(RlcUlRrcMsgInfo)); + if (ulRrcMsgInfo) + { + ulRrcMsgInfo->cellId = rbCb->rlcId.cellId; + ulRrcMsgInfo->ueIdx = rbCb->rlcId.ueId; + ulRrcMsgInfo->lcId = rbCb->lch.lChId; + RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, + ulRrcMsgInfo->rrcMsg, msgLen); + if (ulRrcMsgInfo->rrcMsg) + { + ODU_FIND_MSG_LEN(sdu, (MsgLen *)&msgLen); + ODU_COPY_MSG_TO_FIX_BUF(sdu, 0, msgLen, ulRrcMsgInfo->rrcMsg, (MsgLen *)©Len); + ulRrcMsgInfo->msgLen = msgLen; + + /* Sending UL RRC Message transfeer to DU APP */ + memset(&pst, 0, sizeof(Pst)); + FILL_PST_RLC_TO_DUAPP(pst, SFndProcId(), RLC_UL_INST, EVENT_UL_RRC_MSG_TRANS_TO_DU); + rlcSendUlRrcMsgToDu(&pst, ulRrcMsgInfo); + } + else + { + DU_LOG("\nRLC : Memory allocation failed"); + return RFAILED; + } + } + else + { + DU_LOG("\nRLC : Memory allocation failed"); + return RFAILED; + } + return (ROK); -} /* rlcUtlSndDatInd */ +} /* rlcUtlSendUlDataToDu */ PRIVATE Void dumpRLCUlRbInformation(RlcUlRbCb* ulRbCb) diff --git a/src/5gnrrlc/mac_stub.c b/src/5gnrrlc/mac_stub.c index 7bf768b0a..3a9e48193 100644 --- a/src/5gnrrlc/mac_stub.c +++ b/src/5gnrrlc/mac_stub.c @@ -18,97 +18,16 @@ #ifdef EGTP_TEST #include "common_def.h" -#include "mac_stub.h" -uint8_t rlcDatSn = 0; -uint64_t ulDatNum = 0; - -uint8_t macStubBOStatus(Pst *pst, SpId spId, RlcMacBOStatus *boSta) -{ - Pst rspPst; - RlcMacSchedRepInfo *schRep; - - DU_LOG("\nMAC : Received BO status from RLC"); - -// SGetSBuf(pst->region, pst->pool, (Data **)&rspPst, sizeof(Pst)); - - rspPst.selector = ODU_SELECTOR_TC; - rspPst.srcEnt = pst->dstEnt; - rspPst.dstEnt = pst->srcEnt; - rspPst.dstInst = pst->srcInst; - rspPst.dstProcId = pst->srcProcId; - rspPst.srcProcId = pst->dstProcId; - rspPst.region = pst->region; - rspPst.pool = pst->pool; - - /* Filling Scheduling Report */ - RLC_SHRABL_STATIC_BUF_ALLOC(pst->region, pst->pool, schRep, sizeof(RlcMacSchedRepInfo)); - - schRep->cellId = boSta->cellId; - schRep->rnti = boSta->rnti; - schRep->nmbLch = 1; - schRep->lchSta[0].commCh = boSta->commCh; - schRep->lchSta[0].lchStaInd.lcId = boSta->lcId; - schRep->lchSta[0].lchStaInd.totBufSize = boSta->bo + 5; /* Extra buffer space including RLC and MAC Header size */ - - DU_LOG("\nMAC : Sending scheduling report to RLC"); - - RlcMacProcSchedRep(&rspPst, 1, schRep); - - return ROK; - -} +#define DU_IP_V4_ADDR "192.168.130.81" +#define CU_IP_V4_ADDR "192.168.130.82" -uint8_t macStubSendDlData(Pst *pst, SpId spId, RlcMacData *dlData) -{ - U32 availmem; - - Pst rspPst; - Buffer *mBuf; - RlcMacData *ulData; - - DU_LOG("\nMAC_STUB : Received DL data from RLC to be sent to PHY"); - - ODU_PUT_MSG_BUF(dlData->pduInfo[0].pduBuf); - dlData->pduInfo[0].pduBuf = NULL; - -#if 0 - RLC_FREE_SHRABL_BUF(pst->region, pst->pool, - dlData, sizeof(RlcMacData)); -{ - RLC_ALLOC_SHRABL_BUF(pst->region, pst->pool, - ulData, sizeof(RlcMacData)); - - SRegInfoShow(2, &availmem); - cmMemcpy((U8 *)ulData, (U8 *)dlData, sizeof(RlcMacData)); -#endif - - ulData = dlData; - ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf); - macStubBuildUlData(mBuf); - ulData->pduInfo[0].pduBuf = mBuf; - - /* Fill response post */ - rspPst.selector = ODU_SELECTOR_TC; - rspPst.srcEnt = pst->dstEnt; - rspPst.dstEnt = pst->srcEnt; - rspPst.dstInst = pst->srcInst; - rspPst.dstProcId = pst->srcProcId; - rspPst.srcProcId = pst->dstProcId; - rspPst.region = pst->region; - rspPst.pool = pst->pool; - - ulDatNum++; - DU_LOG("\nMAC_STUB : UL data number %d", ulDatNum); - RlcProcUlData(&rspPst, 1, ulData); - return ROK; -} +uint8_t rlcDatSn = 0; void macStubBuildUlData(Buffer *mBuf) { char data[30] = "This is EGTP data from DU"; int datSize = 30; - U32 availmem; ODU_ADD_POST_MSG_MULT((Data *)data, datSize, mBuf); @@ -186,15 +105,7 @@ void macStubBuildUlData(Buffer *mBuf) ret = ODU_ADD_PRE_MSG_MULT(revPkArray, (MsgLen)cnt, mBuf); ODU_ADD_PRE_MSG_MULT((Data *)&rlcDatSn, sizeof(uint8_t), mBuf); -#if 0 - SRegInfoShow(0, &availmem); - SRegInfoShow(1, &availmem); - SRegInfoShow(2, &availmem); - SRegInfoShow(3, &availmem); - SRegInfoShow(4, &availmem); -#endif - //rlcDatSn++; - // + if(rlcDatSn++ >15 ) rlcDatSn = 0; diff --git a/src/5gnrrlc/rlc_lwr_inf_api.c b/src/5gnrrlc/rlc_lwr_inf_api.c new file mode 100644 index 000000000..615f9f3f9 --- /dev/null +++ b/src/5gnrrlc/rlc_lwr_inf_api.c @@ -0,0 +1,86 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*******************************************************************************/ +/* This file defines API towards lower interface of RLC */ + +#include "common_def.h" +#include "rlc_mac_inf.h" + +RlcMacBoStatusFunc rlcMacSendBoStatusOpts[] = +{ + packRlcBoStatus, /* 0 - loosely coupled */ + MacProcRlcBoStatus, /* 1 - tightly coupled, MAC */ + packRlcBoStatus, /* 2 - LWLC loosely coupled */ +}; +RlcMacDlDataFunc rlcMacSendDlDataOpts[] = +{ + packRlcDlData, /* 0 - loosely coupled */ + MacProcRlcDlData, /* 1 - tightly coupled, MAC */ + packRlcDlData, /* 2 - loosely coupled */ +}; +/** + * + * @brief + * + * Handler for reporting the Buffer Occupancy to MAC + * for logical channels. + * + * @b Description: + * + * This function reports the Buffer Occupancy of one or more + * logical channels to MAC. + * + * @param[in] post Post structure + * @param[in] spId Service Provider ID + * @param[in] boSta BO Status Information + * + * @return S16 + * -# ROK + * -# RFAILED + * + */ +uint8_t RlcSendBoStatusToMac(Pst *pst, RlcBoStatus *boSta) +{ + /* jump to specific primitive depending on configured selector */ + return (*rlcMacSendBoStatusOpts[pst->selector])(pst, boSta); + +} /* end of RlcMacSendBOStatus */ + +/******************************************************************* + * + * @brief Sends DL data to MAC + * + * @details + * + * Function : RlcSendDlDataToMac + * + * Functionality: Sends DL data to MAC + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t RlcSendDlDataToMac(Pst *pst, RlcData *dlData) +{ + /* jump to specific primitive depending on configured selector */ + return (*rlcMacSendDlDataOpts[pst->selector])(pst, dlData); + +} +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/5gnrrlc/rlc_lwr_inf_api.h b/src/5gnrrlc/rlc_lwr_inf_api.h new file mode 100644 index 000000000..1c1be9c26 --- /dev/null +++ b/src/5gnrrlc/rlc_lwr_inf_api.h @@ -0,0 +1,27 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*******************************************************************************/ + +/* This file stores defines used at RLC lower mac interface */ + +uint8_t RlcSendBoStatusToMac(Pst *pst, RlcBoStatus *staRsp); +uint8_t RlcSendDlDataToMac(Pst *pst, RlcData *dlData); + +/********************************************************************** + End of file +**********************************************************************/ + diff --git a/src/5gnrrlc/rlc_msg_hdl.c b/src/5gnrrlc/rlc_msg_hdl.c index 713fc2779..c9dc5181c 100644 --- a/src/5gnrrlc/rlc_msg_hdl.c +++ b/src/5gnrrlc/rlc_msg_hdl.c @@ -34,6 +34,7 @@ #include "kw_err.h" #include "kw.x" +#include "rlc_mac_inf.h" #include "du_app_rlc_inf.h" #include "rlc_utils.h" @@ -259,7 +260,7 @@ uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo) ODU_COPY_FIX_BUF_TO_MSG(dlRrcMsgInfo->rrcMsg, mBuf, 0, dlRrcMsgInfo->msgLen, \ (MsgLen *)©Len); - RlcUiKwuDatReq(pst, datReqInfo, mBuf); + RlcProcDlData(pst, datReqInfo, mBuf); /* Free memory allocated by du app */ RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(KwuDatReqInfo)); @@ -268,6 +269,202 @@ uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo) return ROK; } +/******************************************************************* + * + * @brief Process UL data from UE + * + * @details + * + * Function : RlcProcUlData + * + * Functionality: + * This function receives the PDU from MAC. + * seggregates common and dedicated logical channel + * PDU and call respective handler. + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t RlcProcUlData(Pst *pst, RlcData *ulData) +{ + uint8_t idx; + uint8_t lcId; /* Logical Channel */ + uint8_t numDLch = 0; /* Number of dedicated logical channel */ + bool dLchPduPres; /* PDU received on dedicated logical channel */ + RguLchDatInd dLchData[RGU_MAX_LC]; /* PDU info on dedicated logical channel */ + RguDDatIndInfo *dLchUlDat; /* UL data on dedicated logical channel */ + RguCDatIndInfo *cLchUlDat; /* UL data on common logical channel */ + uint16_t copyLen; + + /* Initializing dedicated logical channel Database */ + for(idx = 0; idx < RGU_MAX_LC; idx++) + { + dLchData[idx].lcId = idx; + dLchData[idx].pdu.numPdu = 0; + } + dLchPduPres = FALSE; + + /* Seggregate PDUs received on common and dedicated channels + * and call common channel's handler */ + for(idx = 0; idx< ulData->numPdu; idx++) + { + if(ulData->pduInfo[idx].commCh) + { + RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_UL, RLC_POOL, cLchUlDat, \ + sizeof(RguCDatIndInfo)); + memset(cLchUlDat, 0, sizeof(RguCDatIndInfo)); + + cLchUlDat->cellId = ulData->cellId; + GET_UE_IDX(ulData->rnti, cLchUlDat->rnti); + cLchUlDat->lcId = ulData->pduInfo[idx].lcId; + + /* Copy fixed buffer to message */ + if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, &cLchUlDat->pdu) != ROK) + { + DU_LOG("\nRLC : Memory allocation failed at RlcProcUlData"); + return RFAILED; + } + reverseFixBuf(ulData->pduInfo[idx].pduBuf, ulData->pduInfo[idx].pduLen); + ODU_COPY_FIX_BUF_TO_MSG(ulData->pduInfo[idx].pduBuf, cLchUlDat->pdu, 0, \ + ulData->pduInfo[idx].pduLen, (MsgLen *)©Len); + + RlcProcCommLcUlData(pst, 0, cLchUlDat); + } + else + { + if(!dLchPduPres) + { + RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_UL, RLC_POOL, dLchUlDat, \ + sizeof(RguDDatIndInfo)); + dLchPduPres = TRUE; + } + + /* Copy fixed buffer to message */ + lcId = ulData->pduInfo[idx].lcId; + if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, \ + &dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu]) != ROK) + { + DU_LOG("\nRLC : Memory allocation failed at RlcMacProcUlData"); + return RFAILED; + } + reverseFixBuf(ulData->pduInfo[idx].pduBuf, ulData->pduInfo[idx].pduLen); + ODU_COPY_FIX_BUF_TO_MSG(ulData->pduInfo[idx].pduBuf, \ + dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu],\ + 0, ulData->pduInfo[idx].pduLen, (MsgLen *)©Len); + + dLchData[lcId].pdu.numPdu++; + } + } + + /* If any PDU received on dedicated logical channel, copy into RguDDatIndInfo + * and call its handler */ + if(dLchPduPres) + { + dLchUlDat->cellId = ulData->cellId; + dLchUlDat->rnti = ulData->rnti; + + for(idx = 0; idx < RGU_MAX_LC; idx++) + { + if(dLchData[idx].pdu.numPdu) + { + memcpy(&dLchUlDat->lchData[numDLch], &dLchData[idx], sizeof(RguLchDatInd)); + numDLch++; + } + } + dLchUlDat->numLch = numDLch; + RlcProcDedLcUlData(pst, 0, dLchUlDat); + } + + RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ulData, sizeof(RlcData)); + return ROK; + +}/* End of RlcProcUlData */ + +/******************************************************************* + * + * @brief Handler for extracting common and dedicated channel + * Scheduling result report. + * + * @details + * + * Function : RlcProcSchedResultRpt + * + * Functionality: + * Handler for extracting common and dedicated channel + * Scheduling result report + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t RlcProcSchedResultRpt(Pst *pst, RlcSchedResultRpt *schRep) +{ + uint8_t idx; /* Iterator */ + uint8_t nmbDLch = 0; /* Number of dedicated logical channles */ + RguCStaIndInfo *cLchSchInfo; /* Common logical channel scheduling result */ + RguDStaIndInfo *dLchSchInfo; /* Dedicated logical channel scheduling result */ + + DU_LOG("\nRLC : Received scheduling report from MAC"); + + for(idx=0; idx < schRep->numLc; idx++) + { + /* If it is common channel, fill status indication information + * and trigger the handler for each common lch separately */ + if(schRep->lcSch[idx].commCh) + { + RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, cLchSchInfo, \ + sizeof(RguCStaIndInfo)); + memset(cLchSchInfo, 0, sizeof(RguCStaIndInfo)); + + cLchSchInfo->cellId = schRep->cellId; + cLchSchInfo->lcId = schRep->lcSch[idx].lcId; + cLchSchInfo->transId = schRep->slotInfo.sfn; + cLchSchInfo->transId = (cLchSchInfo->transId << 16) | schRep->slotInfo.slot; + cLchSchInfo->rnti = schRep->rnti; + RlcProcCommLcSchedRpt(pst, 0, cLchSchInfo); + + } + else + { + /* Fill status info structure if at least one dedicated channel + * scheduling report is received */ + if(nmbDLch == 0) + { + RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, dLchSchInfo, \ + sizeof(RguDStaIndInfo)); + dLchSchInfo->cellId = schRep->cellId; + dLchSchInfo->nmbOfUeGrantPerTti = 1; + dLchSchInfo->staInd[0].rnti = schRep->rnti; + dLchSchInfo->staInd[0].transId = schRep->slotInfo.sfn; + dLchSchInfo->staInd[0].transId = \ + (dLchSchInfo->staInd[0].transId << 16) | schRep->slotInfo.slot; + dLchSchInfo->staInd[0].nmbOfTbs = 1; + dLchSchInfo->staInd[0].fillCtrlPdu = true; + } + + /* Fill logical channel scheduling info */ + dLchSchInfo->staInd[0].staIndTb[0].lchStaInd[nmbDLch].lcId = \ + schRep->lcSch[idx].lcId; + dLchSchInfo->staInd[0].staIndTb[0].lchStaInd[nmbDLch].totBufSize = \ + schRep->lcSch[idx].bufSize; + nmbDLch++; + } + } + + /* Calling handler for all dedicated channels scheduling*/ + if(nmbDLch) + { + dLchSchInfo->staInd[0].staIndTb[0].nmbLch = nmbDLch; + RlcProcDedLcSchedRpt(pst, 0, dLchSchInfo); + } + + RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, schRep, sizeof(RlcSchedResultRpt)); + return ROK; +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrrlc/rlc_utils.h b/src/5gnrrlc/rlc_utils.h index c7126aefa..f5944d688 100644 --- a/src/5gnrrlc/rlc_utils.h +++ b/src/5gnrrlc/rlc_utils.h @@ -50,6 +50,30 @@ _pst.intfVer = 0; \ } +#define FILL_PST_RLC_TO_MAC(_pst, _procId, _srcInst, _event) \ +{ \ + pst.selector = ODU_SELECTOR_LWLC; \ + pst.srcEnt = ENTRLC; \ + pst.dstEnt = ENTMAC; \ + pst.dstInst = 0; \ + pst.srcInst = _srcInst; \ + pst.dstProcId = _procId; \ + pst.srcProcId = _procId; \ + if(_srcInst == RLC_UL_INST) \ + { \ + pst.region = RLC_MEM_REGION_UL; \ + } \ + else if(_srcInst == RLC_DL_INST) \ + { \ + pst.region = RLC_MEM_REGION_DL; \ + } \ + pst.pool = RLC_POOL; \ + pst.event = _event; \ + pst.route = 0; \ + pst.prior = 0; \ + pst.intfVer = 0; \ +} + void reverseFixBuf(uint8_t *buf, uint16_t len); uint16_t getTransId(); diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index 583cce728..afe2ad275 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -44,12 +44,18 @@ #include "lrg.x" /* layer management typedefs for MAC */ #include "rgr.x" /* layer management typedefs for MAC */ #include "rg_sch_inf.x" /* typedefs for Scheduler */ +#include "du_app_mac_inf.h" #include "mac_sch_interface.h" #include "sch.h" #include "sch_utils.h" extern SchCb schCb[SCH_MAX_INST]; void SchFillCfmPst(Pst *reqPst,Pst *cfmPst,RgMngmt *cfm); + +/* ue bit map */ +extern uint32_t gActvUeBitMap; +extern uint32_t gBoIndBitMap; + /* local defines */ SchCellCfgCfmFunc SchCellCfgCfmOpts[] = { @@ -626,6 +632,10 @@ uint8_t SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg) schCellCfg->ssbSchCfg.ssbOffsetPointA); memcpy(&cellCb->cellCfg, schCellCfg, sizeof(SchCellCfg)); + /* Initializing global variables */ + gActvUeBitMap = 0; + gBoIndBitMap = 0; + /* Fill and send Cell config confirm */ memset(&rspPst, 0, sizeof(Pst)); FILL_PST_SCH_TO_MAC(rspPst, pst->dstInst); @@ -656,38 +666,79 @@ uint8_t SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg) * RFAILED - failure * * ****************************************************************/ -uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo) +uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo) { - uint16_t lcIdx; + uint8_t lcId = 0; + uint16_t ueIdx = 0; + uint16_t slot; + SchUeCb *ueCb = NULLP; + SchCellCb *cell = NULLP; + SchDlSlotInfo *schDlSlotInfo = NULLP; + Inst inst = pst->dstInst-SCH_INST_START; DU_LOG("\nSCH : Received RLC BO Status indication"); - SchCellCb *cell = schCb[inst].cells[inst]; - SchDlSlotInfo *schDlSlotInfo = \ - cell->schDlSlotInfo[(cell->slotInfo.slot + SCHED_DELTA + PHY_DELTA + MSG4_DELAY) % SCH_NUM_SLOTS]; + cell = schCb[inst].cells[inst]; - for(lcIdx = 0; lcIdx < dlBoInfo->numLc; lcIdx++) + GET_UE_IDX(dlBoInfo->crnti, ueIdx); + ueCb = &cell->ueCb[ueIdx-1]; + + lcId = dlBoInfo->lcId; + if(lcId == CCCH_LCID) { - if(dlBoInfo->boInfo[lcIdx].lcId == CCCH_LCID) + slot = (cell->slotInfo.slot + SCHED_DELTA + PHY_DELTA + MSG4_DELAY) % SCH_NUM_SLOTS; + schDlSlotInfo = cell->schDlSlotInfo[slot]; + + DU_LOG("\nSCH : MSG4 Current time[%d : %d]. Scheduled at [%d : %d] ******", \ + cell->slotInfo.sfn, cell->slotInfo.slot, 0, slot); + + SCH_ALLOC(schDlSlotInfo->msg4Info, sizeof(DlMsgInfo)); + if(!schDlSlotInfo->msg4Info) { - SCH_ALLOC(schDlSlotInfo->msg4Info, sizeof(Msg4Info)); - if(!schDlSlotInfo->msg4Info) - { - DU_LOG("\nSCH : Memory allocation failed for msg4Info"); - schDlSlotInfo = NULL; - return RFAILED; - } - schDlSlotInfo->msg4Info->crnti = dlBoInfo->crnti; - schDlSlotInfo->msg4Info->ndi = 1; - schDlSlotInfo->msg4Info->harqProcNum = 0; - schDlSlotInfo->msg4Info->dlAssignIdx = 0; - schDlSlotInfo->msg4Info->pucchTpc = 0; - schDlSlotInfo->msg4Info->pucchResInd = 0; - schDlSlotInfo->msg4Info->harqFeedbackInd = 0; - schDlSlotInfo->msg4Info->dciFormatId = 1; + DU_LOG("\nSCH : Memory allocation failed for msg4Info"); + schDlSlotInfo = NULL; + return RFAILED; } + schDlSlotInfo->msg4Info->crnti = dlBoInfo->crnti; + schDlSlotInfo->msg4Info->ndi = 1; + schDlSlotInfo->msg4Info->harqProcNum = 0; + schDlSlotInfo->msg4Info->dlAssignIdx = 0; + schDlSlotInfo->msg4Info->pucchTpc = 0; + schDlSlotInfo->msg4Info->pucchResInd = 0; + schDlSlotInfo->msg4Info->harqFeedbackInd = 0; + schDlSlotInfo->msg4Info->dciFormatId = 1; } + else if(lcId == SRB1_LCID || lcId == SRB2_LCID || (lcId >= MIN_DRB_LCID && lcId <= MAX_DRB_LCID)) + { + SET_ONE_BIT(ueIdx, gBoIndBitMap); + ueCb->dlLcCtxt[lcId].bo = dlBoInfo->dataVolume; + + slot = (cell->slotInfo.slot + SCHED_DELTA + PHY_DELTA + BO_DELTA) % SCH_NUM_SLOTS; + schDlSlotInfo = cell->schDlSlotInfo[slot]; + DU_LOG("\nSCH : RLC BO Current time[%d : %d]. Scheduled at slot %d ******", \ + cell->slotInfo.sfn, cell->slotInfo.slot, slot); + SCH_ALLOC(schDlSlotInfo->dedMsgInfo, sizeof(DlMsgInfo)); + if(!schDlSlotInfo->dedMsgInfo) + { + DU_LOG("\nSCH : Memory allocation failed for dedMsgInfo"); + schDlSlotInfo = NULL; + return RFAILED; + } + schDlSlotInfo->dedMsgInfo->crnti = dlBoInfo->crnti; + schDlSlotInfo->dedMsgInfo->ndi = 1; + schDlSlotInfo->dedMsgInfo->harqProcNum = 0; + schDlSlotInfo->dedMsgInfo->dlAssignIdx = 0; + schDlSlotInfo->dedMsgInfo->pucchTpc = 0; + schDlSlotInfo->dedMsgInfo->pucchResInd = 0; + schDlSlotInfo->dedMsgInfo->harqFeedbackInd = 0; + schDlSlotInfo->dedMsgInfo->dciFormatId = 1; + } + else + { + DU_LOG("\nSCH : Invalid LC Id %d in MacSchDlRlcBoInfo", lcId); + return RFAILED; + } return ROK; } diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index 5322e8c88..4b66f98b1 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -40,9 +40,13 @@ #define DMRS_MAP_TYPE_A 1 #define NUM_DMRS_SYMBOLS 12 #define DMRS_ADDITIONAL_POS 2 +#define MAX_NUM_LC 11 #define CRC_FAILED 0 #define CRC_PASSED 1 + +#define RLC_HDR_SIZE 3 /* 3 bytes of RLC Header size */ +#define MAC_HDR_SIZE 3 /* 3 bytes of MAC Header */ #define UL_GRANT_SIZE 224 typedef struct schCellCb SchCellCb; @@ -54,6 +58,12 @@ typedef enum SCH_UE_STATE_ACTIVE }SchUeState; +typedef enum +{ + SCH_LC_STATE_INACTIVE, + SCH_LC_STATE_ACTIVE +}SchLcState; + /** * @brief * Structure holding LTE MAC's General Configuration information. @@ -83,7 +93,8 @@ typedef struct schDlSlotInfo SsbInfo ssbInfo[MAX_SSB_IDX]; /*!< SSB info */ bool sib1Pres; /*!< Flag to determine if SIB1 is present in this slot */ RarInfo *rarInfo; /*!< RAR info */ - Msg4Info *msg4Info; /*!< msg4 info */ + DlMsgInfo *msg4Info; /*!< msg4 info */ + DlMsgInfo *dedMsgInfo; /*!< DL dedicated Msg info */ }SchDlSlotInfo; typedef struct schRaCb @@ -116,7 +127,24 @@ typedef struct bsrInfo uint32_t dataVol; /* Data volume requested in bytes */ }BsrInfo; +typedef struct schLcCtxt +{ + uint8_t lcId; + uint8_t lcp; // logical Channel Prioritization + SchLcState lcState; + uint16_t bo; +}SchDlLcCtxt; +typedef struct schUlLcCtxt +{ + uint8_t lcId; + SchLcState lcState; + uint8_t priority; + uint8_t lcGroup; + uint8_t schReqId; + uint8_t pbr; // prioritisedBitRate + uint8_t bsd; // bucketSizeDuration +}SchUlLcCtxt; /** * @brief @@ -131,6 +159,10 @@ typedef struct schUeCb SchCellCb *cellCb; bool srRcvd; BsrInfo bsrInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS]; + uint8_t numUlLc; + SchUlLcCtxt ulLcCtxt[MAX_NUM_LC]; + uint8_t numDlLc; + SchDlLcCtxt dlLcCtxt[MAX_NUM_LC]; }SchUeCb; /** @@ -178,6 +210,9 @@ uint16_t schAllocPucchResource(SchCellCb *cell, uint16_t crnti, uint16_t slot); uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst); uint8_t schFillUlDci(SchUeCb *ueCb, SchPuschInfo puschInfo, DciInfo *dciInfo); uint8_t schFillPuschAlloc(SchUeCb *ueCb, uint16_t pdcchSlot, uint32_t dataVol, SchPuschInfo *puschInfo); +uint8_t schDlRsrcAllocDlMsg(DlMsgAlloc *dlMsgAlloc, SchCellCb *cell, uint16_t crnti, + uint16_t accumalatedSize, uint16_t slot); +uint16_t schAccumalateLcBoSize(SchCellCb *cell, uint16_t ueIdx); /********************************************************************** End of file diff --git a/src/5gnrsch/sch_common.c b/src/5gnrsch/sch_common.c index 7e611455c..a1a02b1b2 100644 --- a/src/5gnrsch/sch_common.c +++ b/src/5gnrsch/sch_common.c @@ -293,7 +293,7 @@ uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst) schUlSlotInfo = cell->schUlSlotInfo[ulTimingInfo.slot]; if(schUlSlotInfo->schPuschInfo) { - ulSchedInfo.crnti = cell->raCb[0].tcrnti; + ulSchedInfo.crnti = schUlSlotInfo->schPuschInfo->crnti; ulSchedInfo.dataType |= SCH_DATATYPE_PUSCH; memcpy(&ulSchedInfo.schPuschInfo, schUlSlotInfo->schPuschInfo, sizeof(SchPuschInfo)); @@ -473,6 +473,141 @@ uint16_t schAllocPucchResource(SchCellCb *cell,uint16_t crnti, uint16_t slot) return ROK; } +/******************************************************************* + * + * @brief Fills pdcch and pdsch info for dedicated DL msg + * + * @details + * + * Function : schDlRsrcAllocDlMsg + * + * Functionality: + * Fills pdcch and pdsch info for dl msg + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t schDlRsrcAllocDlMsg(DlMsgAlloc *dlMsgAlloc, SchCellCb *cell, uint16_t crnti, + uint16_t accumalatedSize, uint16_t slot) +{ + uint8_t coreset0Idx = 0; + uint8_t numRbs = 0; + uint8_t firstSymbol = 0; + uint8_t numSymbols = 0; + uint8_t offset = 0; + uint8_t offsetPointA; + uint8_t FreqDomainResource[6] = {0}; + uint16_t tbSize = 0; + uint8_t numPdschSymbols = 12; /* considering pdsch region from 2 to 13 */ + uint8_t mcs = 4; /* MCS fixed to 4 */ + SchBwpDlCfg *initialBwp = NULL; + + PdcchCfg *pdcch = &dlMsgAlloc->dlMsgPdcchCfg; + PdschCfg *pdsch = &dlMsgAlloc->dlMsgPdschCfg; + BwpCfg *bwp = &dlMsgAlloc->bwp; + + initialBwp = &cell->cellCfg.schInitialDlBwp; + offsetPointA = cell->cellCfg.ssbSchCfg.ssbOffsetPointA; + coreset0Idx = initialBwp->pdcchCommon.commonSearchSpace.coresetId; + /* derive the sib1 coreset0 params from table 13-1 spec 38.213 */ + numRbs = coresetIdxTable[coreset0Idx][1]; + numSymbols = coresetIdxTable[coreset0Idx][2]; + offset = coresetIdxTable[coreset0Idx][3]; + + /* calculate time domain parameters */ + uint16_t mask = 0x2000; + for(firstSymbol=0; firstSymbol<14;firstSymbol++) + { + if(initialBwp->pdcchCommon.commonSearchSpace.monitoringSymbol & mask) + break; + else + mask = mask>>1; + } + + /* calculate the PRBs */ + schAllocFreqDomRscType0( ((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource); + + /* fill BWP */ + bwp->freqAlloc.numPrb = initialBwp->bwp.freqAlloc.numPrb; + bwp->freqAlloc.startPrb = initialBwp->bwp.freqAlloc.startPrb; + bwp->subcarrierSpacing = initialBwp->bwp.scs; + bwp->cyclicPrefix = initialBwp->bwp.cyclicPrefix; + + /* fill the PDCCH PDU */ + pdcch->coreset0Cfg.startSymbolIndex = firstSymbol; + pdcch->coreset0Cfg.durationSymbols = numSymbols; + memcpy(pdcch->coreset0Cfg.freqDomainResource,FreqDomainResource,6); + pdcch->coreset0Cfg.cceRegMappingType = 1; /* coreset0 is always interleaved */ + pdcch->coreset0Cfg.regBundleSize = 6; /* spec-38.211 sec 7.3.2.2 */ + pdcch->coreset0Cfg.interleaverSize = 2; /* spec-38.211 sec 7.3.2.2 */ + pdcch->coreset0Cfg.coreSetType = 0; + pdcch->coreset0Cfg.coreSetSize = numRbs; + pdcch->coreset0Cfg.shiftIndex = cell->cellCfg.phyCellId; + pdcch->coreset0Cfg.precoderGranularity = 0; /* sameAsRegBundle */ + pdcch->numDlDci = 1; + pdcch->dci.rnti = crnti; + pdcch->dci.scramblingId = cell->cellCfg.phyCellId; + pdcch->dci.scramblingRnti = 0; + pdcch->dci.cceIndex = 4; /* considering SIB1 is sent at cce 0-1-2-3 */ + pdcch->dci.aggregLevel = 4; + pdcch->dci.beamPdcchInfo.numPrgs = 1; + pdcch->dci.beamPdcchInfo.prgSize = 1; + pdcch->dci.beamPdcchInfo.digBfInterfaces = 0; + pdcch->dci.beamPdcchInfo.prg[0].pmIdx = 0; + pdcch->dci.beamPdcchInfo.prg[0].beamIdx[0] = 0; + pdcch->dci.txPdcchPower.powerValue = 0; + pdcch->dci.txPdcchPower.powerControlOffsetSS = 0; + + /* fill the PDSCH PDU */ + uint8_t cwCount = 0; + pdsch->pduBitmap = 0; /* PTRS and CBG params are excluded */ + pdsch->rnti = crnti; + pdsch->pduIndex = 0; + pdsch->numCodewords = 1; + for(cwCount = 0; cwCount < pdsch->numCodewords; cwCount++) + { + pdsch->codeword[cwCount].targetCodeRate = 308; + pdsch->codeword[cwCount].qamModOrder = 2; + pdsch->codeword[cwCount].mcsIndex = 4; /* mcs configured to 4 */ + pdsch->codeword[cwCount].mcsTable = 0; /* notqam256 */ + pdsch->codeword[cwCount].rvIndex = 0; + tbSize = schCalcTbSize(accumalatedSize); + pdsch->codeword[cwCount].tbSize = tbSize; + } + pdsch->dataScramblingId = cell->cellCfg.phyCellId; + pdsch->numLayers = 1; + pdsch->transmissionScheme = 0; + pdsch->refPoint = 0; + pdsch->dmrs.dlDmrsSymbPos = 2; + pdsch->dmrs.dmrsConfigType = 0; /* type-1 */ + pdsch->dmrs.dlDmrsScramblingId = cell->cellCfg.phyCellId; + pdsch->dmrs.scid = 0; + pdsch->dmrs.numDmrsCdmGrpsNoData = 1; + pdsch->dmrs.dmrsPorts = 0; + pdsch->dmrs.mappingType = DMRS_MAP_TYPE_A; /* Setting to Type-A */ + pdsch->dmrs.nrOfDmrsSymbols = NUM_DMRS_SYMBOLS; + pdsch->dmrs.dmrsAddPos = DMRS_ADDITIONAL_POS; + pdsch->pdschFreqAlloc.resourceAllocType = 1; /* RAT type-1 RIV format */ + /* the RB numbering starts from coreset0, and PDSCH is always above SSB */ + pdsch->pdschFreqAlloc.freqAlloc.startPrb = offset + SCH_SSB_NUM_PRB; + pdsch->pdschFreqAlloc.freqAlloc.numPrb = schCalcNumPrb(tbSize,mcs,numPdschSymbols); + pdsch->pdschFreqAlloc.vrbPrbMapping = 0; /* non-interleaved */ + pdsch->pdschTimeAlloc.timeAlloc.startSymb = 2; /* spec-38.214, Table 5.1.2.1-1 */ + pdsch->pdschTimeAlloc.timeAlloc.numSymb = 12; + pdsch->beamPdschInfo.numPrgs = 1; + pdsch->beamPdschInfo.prgSize = 1; + pdsch->beamPdschInfo.digBfInterfaces = 0; + pdsch->beamPdschInfo.prg[0].pmIdx = 0; + pdsch->beamPdschInfo.prg[0].beamIdx[0] = 0; + pdsch->txPdschPower.powerControlOffset = 0; + pdsch->txPdschPower.powerControlOffsetSS = 0; + + pdcch->dci.pdschCfg = pdsch; + return ROK; +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrsch/sch_rach.c b/src/5gnrsch/sch_rach.c index 7f03bfd7f..7241828ec 100644 --- a/src/5gnrsch/sch_rach.c +++ b/src/5gnrsch/sch_rach.c @@ -62,9 +62,11 @@ extern uint8_t puschDeltaTable[MAX_MU_PUSCH]; uint16_t calculateRaRnti(uint8_t symbolIdx, uint8_t slotIdx, uint8_t freqIdx) { uint16_t raRnti = 0; - uint8_t ulCarrierIdx = 0; /* configured to 0 */ + uint8_t ulCarrierIdx = 0; /* configured to 0 */ + raRnti = (1+symbolIdx+(14*slotIdx)+(14*80*freqIdx)+(14*80*8*ulCarrierIdx)); - return raRnti; + + return raRnti; } /** @@ -82,7 +84,10 @@ uint16_t calculateRaRnti(uint8_t symbolIdx, uint8_t slotIdx, uint8_t freqIdx) **/ void createSchRaCb(uint16_t tcrnti, Inst schInst) { - schCb[schInst].cells[schInst]->raCb[0].tcrnti = tcrnti; + uint8_t ueIdx = 0; + + GET_UE_IDX(tcrnti, ueIdx); + schCb[schInst].cells[schInst]->raCb[ueIdx -1].tcrnti = tcrnti; } /** @@ -100,8 +105,8 @@ void createSchRaCb(uint16_t tcrnti, Inst schInst) * @param[out] msg3NumRb * @return void **/ -uint8_t schAllocMsg3Pusch(Inst schInst, uint16_t slot, uint16_t *msg3StartRb, -uint8_t *msg3NumRb) +uint8_t schAllocMsg3Pusch(Inst schInst, uint16_t slot, uint16_t crnti, \ + uint16_t *msg3StartRb, uint8_t *msg3NumRb) { SchCellCb *cell = NULLP; SchUlSlotInfo *schUlSlotInfo = NULLP; @@ -151,6 +156,7 @@ uint8_t *msg3NumRb) DU_LOG("SCH: Memory allocation failed in schAllocMsg3Pusch"); return RFAILED; } + schUlSlotInfo->schPuschInfo->crnti = crnti; schUlSlotInfo->schPuschInfo->harqProcId = SCH_HARQ_PROC_ID; schUlSlotInfo->schPuschInfo->resAllocType = SCH_ALLOC_TYPE_1; schUlSlotInfo->schPuschInfo->fdAlloc.startPrb = startRb; @@ -218,7 +224,7 @@ uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst) createSchRaCb(rachInd->crnti,schInst); /* allocate resources for msg3 */ - ret = schAllocMsg3Pusch(schInst, rarSlot, &msg3StartRb, &msg3NumRb); + ret = schAllocMsg3Pusch(schInst, rarSlot, rachInd->crnti, &msg3StartRb, &msg3NumRb); if(ret == ROK) { /* fill RAR info */ diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 06826958c..386d6b362 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -49,6 +49,7 @@ SchMacDlAllocFunc schMacDlAllocOpts[] = packSchMacDlAlloc }; +extern uint32_t gBoIndBitMap; extern SchCb schCb[SCH_MAX_INST]; extern int schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t offsetPointA); @@ -113,11 +114,11 @@ void schCalcSlotValues(SlotIndInfo slotInd, SchSlotValue *schSlotValue) * on PHY_DELTA + SCHED_DELTA + BO_DELTA * ****************************************************************/ - ADD_DELTA_TO_TIME(slotInd,schSlotValue->currentTime,PHY_DELTA); - ADD_DELTA_TO_TIME(slotInd,schSlotValue->broadcastTime,PHY_DELTA+SCHED_DELTA); - ADD_DELTA_TO_TIME(slotInd,schSlotValue->rarTime,PHY_DELTA+SCHED_DELTA); - ADD_DELTA_TO_TIME(slotInd,schSlotValue->msg4Time,PHY_DELTA+SCHED_DELTA); - ADD_DELTA_TO_TIME(slotInd,schSlotValue->dlMsgTime,PHY_DELTA+SCHED_DELTA+BO_DELTA); + ADD_DELTA_TO_TIME(slotInd, schSlotValue->currentTime, PHY_DELTA); + ADD_DELTA_TO_TIME(slotInd, schSlotValue->broadcastTime, PHY_DELTA + SCHED_DELTA); + ADD_DELTA_TO_TIME(slotInd, schSlotValue->rarTime, PHY_DELTA + SCHED_DELTA); + ADD_DELTA_TO_TIME(slotInd, schSlotValue->msg4Time, PHY_DELTA + SCHED_DELTA); + ADD_DELTA_TO_TIME(slotInd, schSlotValue->dlMsgTime, PHY_DELTA + SCHED_DELTA); } /******************************************************************* @@ -138,21 +139,23 @@ void schCalcSlotValues(SlotIndInfo slotInd, SchSlotValue *schSlotValue) * ****************************************************************/ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) { - int ret = ROK; - uint8_t ssb_rep, ueIdx, lcgIdx; + uint8_t ret = ROK; + uint8_t ssb_rep, ueIdx, lcIdx, lcgIdx; uint16_t slot, sfnSlot = 0; DlSchedInfo dlSchedInfo; + DlBrdcstAlloc *dlBrdcstAlloc = NULLP; + RarAlloc *rarAlloc = NULLP; + Msg4Alloc *msg4Alloc = NULLP; + DlMsgAlloc *dlMsgAlloc = NULLP; + SchCellCb *cell = NULLP; + memset(&dlSchedInfo,0,sizeof(DlSchedInfo)); - DlBrdcstAlloc *dlBrdcstAlloc = &dlSchedInfo.brdcstAlloc; - RarAlloc *rarAlloc = NULLP; - Msg4Alloc *msg4Alloc = NULLP; + schCalcSlotValues(*slotInd, &dlSchedInfo.schSlotValue); + dlBrdcstAlloc = &dlSchedInfo.brdcstAlloc; dlBrdcstAlloc->ssbTrans = NO_SSB; dlBrdcstAlloc->sib1Trans = NO_SIB1; - SchCellCb *cell = schCb[schInst].cells[schInst]; - - schCalcSlotValues(*slotInd, &dlSchedInfo.schSlotValue); - + cell = schCb[schInst].cells[schInst]; ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod; memcpy(&cell->slotInfo, slotInd, sizeof(SlotIndInfo)); dlBrdcstAlloc->ssbIdxSupported = 1; @@ -234,6 +237,8 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info != NULLP) { slot = dlSchedInfo.schSlotValue.msg4Time.slot; + DU_LOG("\nSCH: Current slot [%d]. MSG4 time slot [%d] *********", slotInd->slot, slot); + SCH_ALLOC(msg4Alloc, sizeof(Msg4Alloc)); if(!msg4Alloc) { @@ -245,7 +250,7 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) /* Msg4 info is copied, this was earlier filled in macSchDlRlcBoInfo */ memcpy(&msg4Alloc->msg4Info, cell->schDlSlotInfo[slot]->msg4Info, \ - sizeof(Msg4Info)); + sizeof(DlMsgInfo)); /* pdcch and pdsch data is filled */ schDlRsrcAllocMsg4(msg4Alloc, cell, dlSchedInfo.schSlotValue.msg4Time.slot); @@ -253,7 +258,7 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) /* PUCCH resource */ schAllocPucchResource(cell, msg4Alloc->msg4Info.crnti, dlSchedInfo.schSlotValue.msg4Time.slot); - SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info, sizeof(Msg4Info)); + SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info, sizeof(DlMsgInfo)); cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info = NULL; } /* check if UL grant must be sent in this slot for a SR/BSR that had been received */ @@ -300,6 +305,69 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) } } + /* Check for pending BO grant for LC */ + while(gBoIndBitMap) + { + slot = dlSchedInfo.schSlotValue.dlMsgTime.slot; + + DU_LOG("\nSCH: Current slot [%d]. DL MSG time slot [%d] *********", slotInd->slot, slot); + if(cell->schDlSlotInfo[slot]->dedMsgInfo == NULL) + { + break; + } + + uint16_t crnti = 0; + uint16_t accumalatedSize = 0; + SchUeCb *ueCb = NULLP; + + GET_RIGHT_MOST_SET_BIT(gBoIndBitMap,ueIdx); + GET_CRNTI(crnti,ueIdx); + ueCb = &cell->ueCb[ueIdx-1]; + + /* allocate PDCCH and PDSCH resources for the ue */ + SCH_ALLOC(dlMsgAlloc, sizeof(DlMsgAlloc)); + if(!dlMsgAlloc) + { + DU_LOG("\nMAC: Memory Allocation failed for ded DL msg alloc"); + return RFAILED; + } + memset(dlMsgAlloc, 0, sizeof(DlMsgAlloc)); + dlSchedInfo.dlMsgAlloc = dlMsgAlloc; + dlMsgAlloc->crnti = crnti; + + /* Dl ded Msg info is copied, this was earlier filled in macSchDlRlcBoInfo */ + memcpy(&dlMsgAlloc->dedMsgInfo, cell->schDlSlotInfo[slot]->dedMsgInfo, \ + sizeof(DlMsgInfo)); + + /* scheduled LC data fill */ + dlMsgAlloc->numLc = 0; + for(lcIdx = 0; lcIdx < MAX_NUM_LC; lcIdx++) + { + if(ueCb->dlLcCtxt[lcIdx].bo) + { + dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc].lcId = ueCb->dlLcCtxt[lcIdx].lcId; + + /* calculation for BO includse RLC and MAC header size */ + dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc].schBytes = \ + ueCb->dlLcCtxt[lcIdx].bo + RLC_HDR_SIZE + MAC_HDR_SIZE; + accumalatedSize += dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc].schBytes; + dlMsgAlloc->numLc++; + } + ueCb->dlLcCtxt[lcIdx].bo = 0; + } + + /* pdcch and pdsch data is filled */ + schDlRsrcAllocDlMsg(dlMsgAlloc, cell, crnti, accumalatedSize, slot); + + /* Free the dl ded msg info allocated in macSchDlRlcBoInfo */ + SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dedMsgInfo, \ + sizeof(DlMsgInfo)); + cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dedMsgInfo = NULL; + + /* after allocation is done, unset the bo bit for that ue */ + UNSET_ONE_BIT(ueIdx,gBoIndBitMap); + } + /* send msg to MAC */ ret = sendDlAllocToMac(&dlSchedInfo, schInst); if(ret != ROK) diff --git a/src/5gnrsch/sch_ue_mgr.c b/src/5gnrsch/sch_ue_mgr.c index 37e8e7700..e7f5c57a1 100644 --- a/src/5gnrsch/sch_ue_mgr.c +++ b/src/5gnrsch/sch_ue_mgr.c @@ -29,6 +29,10 @@ #include "sch.h" #include "sch_utils.h" +/* ue bit map */ +extern uint32_t gActvUeBitMap; +extern uint32_t gBoIndBitMap; + /* local defines */ SchUeCfgRspFunc SchUeCfgRspOpts[] = { @@ -91,6 +95,8 @@ void SchSendUeCfgRspToMac(SchUeCfg *ueCfg, Inst inst,\ uint8_t MacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfg) { uint8_t idx; + uint8_t lcId; + uint8_t lcIdx; uint16_t ueIdx; SchCellCb *cellCb; SchUeCb *ueCb; @@ -144,12 +150,29 @@ uint8_t MacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfg) /* Fill received Ue Configuration in UeCb */ memset(ueCb, 0, sizeof(SchUeCb)); - - GET_UE_IDX(ueCfg->crnti, ueCb->ueIdx); + ueCb->ueIdx = ueIdx; ueCb->crnti = ueCfg->crnti; memcpy(&ueCb->ueCfg, ueCfg, sizeof(SchUeCfg)); ueCb->state = SCH_UE_STATE_ACTIVE; + + /* Fill SRB1 info */ + for(lcIdx = 0; lcIdx < ueCfg->numLc; lcIdx++) + { + lcId = ueCfg->lcCfgList[lcIdx].lcId; + ueCb->dlLcCtxt[lcId].lcId = ueCfg->lcCfgList[lcIdx].lcId; + ueCb->dlLcCtxt[lcId].lcp = ueCfg->lcCfgList[lcIdx].dlLcCfg.lcp; + ueCb->dlLcCtxt[lcId].lcState = SCH_LC_STATE_ACTIVE; + ueCb->dlLcCtxt[lcId].bo = 0; + ueCb->numDlLc++; + + if(ueCfg->lcCfgList[lcIdx].ulLcCfg) + { + /* TODO : Fill UL LC Cfg. As of now for SRB1, it is null */ + } + } + cellCb->numActvUe++; + SET_ONE_BIT(ueCb->ueIdx, gActvUeBitMap); ueCb->cellCb = cellCb; ueCb->srRcvd = false; @@ -200,6 +223,7 @@ uint8_t schFillPuschAlloc(SchUeCb *ueCb, uint16_t pdcchSlot, uint32_t dataVol, S cellCb->schUlSlotInfo[puschSlot]->puschCurrentPrb += numRb; + puschInfo->crnti = ueCb->crnti; puschInfo->harqProcId = SCH_HARQ_PROC_ID; puschInfo->resAllocType = SCH_ALLOC_TYPE_1; puschInfo->fdAlloc.startPrb = startRb; diff --git a/src/cm/common_def.h b/src/cm/common_def.h index bf7518a6b..a68c279a8 100644 --- a/src/cm/common_def.h +++ b/src/cm/common_def.h @@ -88,6 +88,17 @@ #define ODU_REM_PRE_MSG SRemPreMsg #define ODU_REG_TMR_MT SRegTmrMt +/* ue bit map */ +uint32_t gActvUeBitMap; +uint32_t gBoIndBitMap; +uint16_t gCrntiCount; + +#define GET_NEW_CRNTI(_crnti) \ +{ \ + _crnti = gCrntiCount; \ + gCrntiCount++; \ +} + #define GET_UE_IDX( _crnti,_ueIdx) \ { \ _ueIdx = _crnti - ODU_START_CRNTI + 1; \ @@ -95,7 +106,7 @@ #define GET_CRNTI( _crnti,_ueIdx) \ { \ - _crnti = _ueIdx + ODU_START_CRTNI - 1; \ + _crnti = _ueIdx + ODU_START_CRNTI - 1; \ } /* Calculates cellIdx from cellId */ @@ -116,6 +127,23 @@ _byte <<= _startBit; \ } +/* this MACRO set 1 bit at the bit position */ +#define SET_ONE_BIT(_bitPos, _out) \ +{ \ + _out = ((1<<_bitPos) | _out); \ +} + +/* this MACRO un-set 1 bit at the bit position */ +#define UNSET_ONE_BIT(_bitPos, _out) \ +{ \ + _out = (~(1<<_bitPos) & _out); \ +} + +/* this MACRO finds the index of the rightmost set bit */ +#define GET_RIGHT_MOST_SET_BIT( _in,_bitPos) \ +{ \ + _bitPos = __builtin_ctz(_in); \ +} typedef struct slotIndInfo { diff --git a/src/cm/kwu.x b/src/cm/kwu.x index 2017c44b4..638adbe5b 100755 --- a/src/cm/kwu.x +++ b/src/cm/kwu.x @@ -214,7 +214,7 @@ EXTERN S16 RlcUiKwuUbndReq ARGS((Pst *pst, * -# ROK * -# RFAILED */ -EXTERN S16 RlcUiKwuDatReq ARGS((Pst *pst, +EXTERN S16 RlcProcDlData ARGS((Pst *pst, KwuDatReqInfo* datReq, Buffer *buf)); @@ -231,12 +231,12 @@ EXTERN S16 RlcUiKwuDatReq ARGS((Pst *pst, * -# ROK * -# RFAILED */ -EXTERN S16 RlcUiKwuDatInd ARGS((Pst *pst, +EXTERN S16 rlcSendUlDataToDu ARGS((Pst *pst, KwuDatIndInfo* datInd, Buffer *mBuf)); /** - *@details This primitive is used by RLC as the confirmation for the RlcUiKwuDatReq + *@details This primitive is used by RLC as the confirmation for the RlcProcDlData to the service user (RLC/PDCP). It is used only in AM mode data transfers for RLC. diff --git a/src/cm/lkw.c b/src/cm/lkw.c index 340c77b05..d18e724d3 100755 --- a/src/cm/lkw.c +++ b/src/cm/lkw.c @@ -176,14 +176,14 @@ RlcMngmt *cfg; /* RLC LM structure */ */ #ifdef ANSI -S16 unpackRlcConfigReq +uint8_t unpackRlcConfigReq ( RlcConfigReq func, /* primitive to call */ Pst *pst, /* post structure */ Buffer *mBuf /* message buffer */ ) #else -S16 unpackRlcConfigReq(func, pst, mBuf) +uint8_t unpackRlcConfigReq(func, pst, mBuf) RlcConfigReq func; /* primitive to call */ Pst *pst; /* post structure */ Buffer *mBuf; /* message buffer */ @@ -343,13 +343,13 @@ Buffer *mBuf; /* message buffer */ */ #ifdef ANSI -S16 cmPkLkwCntrlCfm +uint8_t cmPkLkwCntrlCfm ( Pst *pst, /* post structure */ RlcMngmt *cfm /* RLC LM structure */ ) #else -S16 cmPkLkwCntrlCfm(pst, cfm) +uint8_t cmPkLkwCntrlCfm(pst, cfm) Pst *pst; /* post structure */ RlcMngmt *cfm; /* RLC LM structure */ #endif @@ -511,13 +511,13 @@ Buffer *mBuf; /* message buffer */ #ifdef ANSI -S16 packRlcConfigCfm +uint8_t packRlcConfigCfm ( Pst *pst, /* post structure */ RlcMngmt *cfm /* RLC LM structure */ ) #else -S16 packRlcConfigCfm(pst,cfm) +uint8_t packRlcConfigCfm(pst,cfm) Pst *pst; /* post structure */ RlcMngmt *cfm; /* RLC LM structure */ #endif @@ -575,14 +575,14 @@ RlcMngmt *cfm; /* RLC LM structure */ * -# Failure : RFAILED */ #ifdef ANSI -S16 unpackRlcConfigCfm +uint8_t unpackRlcConfigCfm ( RlcConfigCfm func, /* primitive to call */ Pst *pst, /* post structure */ Buffer *mBuf /* message buffer */ ) #else -S16 unpackRlcConfigCfm(func, pst, mBuf) +uint8_t unpackRlcConfigCfm(func, pst, mBuf) RlcConfigCfm func; /* primitive to call */ Pst *pst; /* post structure */ Buffer *mBuf; /* message buffer */ diff --git a/src/cm/lkw.x b/src/cm/lkw.x index 8a03910c8..0c906a27f 100755 --- a/src/cm/lkw.x +++ b/src/cm/lkw.x @@ -361,11 +361,11 @@ typedef struct rlcL2MeasCfmEvt /* Control primitives towards LTE RLC */ /* Pointer functions to pack/unpack primitives */ -typedef S16 (*RlcConfigReq) ARGS((Pst *pst, RlcMngmt *cfg)); -typedef S16 (*RlcConfigCfm) ARGS((Pst *pst, RlcMngmt *cfgCfm)); +typedef uint8_t (*RlcConfigReq) ARGS((Pst *pst, RlcMngmt *cfg)); +typedef uint8_t (*RlcConfigCfm) ARGS((Pst *pst, RlcMngmt *cfgCfm)); -typedef S16 (*LkwCntrlReq) ARGS((Pst *pst, RlcMngmt *cntl)); -typedef S16 (*LkwCntrlCfm) ARGS((Pst *pst, RlcMngmt *cntlCfm)); +typedef uint8_t (*LkwCntrlReq) ARGS((Pst *pst, RlcMngmt *cntl)); +typedef uint8_t (*LkwCntrlCfm) ARGS((Pst *pst, RlcMngmt *cntlCfm)); typedef S16 (*LkwStaInd) ARGS((Pst *pst, RlcMngmt *staInd)); typedef S16 (*LkwStaReq) ARGS((Pst *pst, RlcMngmt *staReq)); @@ -393,7 +393,7 @@ typedef S16 (*LkwL2MeasStopCfm) ARGS((Pst *pst, U8 measType,U8 status)); @return ROK if success , RFAILED if failure */ -EXTERN S16 RlcMiRlcConfigReq ARGS((Pst *pst, RlcMngmt *cfg)); +EXTERN uint8_t RlcMiRlcConfigReq ARGS((Pst *pst, RlcMngmt *cfg)); /** @details This function is called by the RlcMiRlcConfigReq function for responding to configuration requests.The cfm field in the RlcMngmt structure contains the response value. @@ -415,7 +415,7 @@ control request primitive is confirmed by a RlcMiLkwCntrlCfm primitive. @param[in] cntl - Configuration management structure @return ROK if success , RFAILED if failure */ -EXTERN S16 RlcMiLkwCntrlReq ARGS((Pst *pst, RlcMngmt *cntl)); +EXTERN uint8_t RlcMiLkwCntrlReq ARGS((Pst *pst, RlcMngmt *cntl)); /** @details @@ -614,7 +614,7 @@ EXTERN S16 packRlcConfigReq ARGS(( RlcMngmt * )); -EXTERN S16 packRlcConfigCfm ARGS(( +EXTERN uint8_t packRlcConfigCfm ARGS(( Pst *, RlcMngmt * )); @@ -625,7 +625,7 @@ EXTERN S16 cmPkLkwCntrlReq ARGS(( RlcMngmt * )); -EXTERN S16 cmPkLkwCntrlCfm ARGS(( +EXTERN uint8_t cmPkLkwCntrlCfm ARGS(( Pst *, RlcMngmt * )); @@ -663,13 +663,13 @@ EXTERN S16 cmPkLkwTrcInd ARGS(( Buffer * )); -EXTERN S16 unpackRlcConfigReq ARGS(( +EXTERN uint8_t unpackRlcConfigReq ARGS(( RlcConfigReq, Pst *, Buffer * )); -EXTERN S16 unpackRlcConfigCfm ARGS(( +EXTERN uint8_t unpackRlcConfigCfm ARGS(( RlcConfigCfm, Pst *, Buffer * diff --git a/src/cm/lrg.c b/src/cm/lrg.c index 054df2073..4b192331f 100755 --- a/src/cm/lrg.c +++ b/src/cm/lrg.c @@ -253,13 +253,13 @@ Configuration Confirm from MAC to LM. * -# ROK **/ #ifdef ANSI -S16 cmPkLrgCfgCfm +uint8_t cmPkLrgCfgCfm ( Pst * pst, RgMngmt * cfm ) #else -S16 cmPkLrgCfgCfm(pst, cfm) +uint8_t cmPkLrgCfgCfm(pst, cfm) Pst * pst; RgMngmt * cfm; #endif @@ -351,13 +351,13 @@ Configuration Confirm from SCH to LM. * -# ROK **/ #ifdef ANSI -S16 cmPkLrgSchCfgCfm +uint8_t cmPkLrgSchCfgCfm ( Pst * pst, RgMngmt * cfg ) #else -S16 cmPkLrgSchCfgCfm(pst, cfg) +uint8_t cmPkLrgSchCfgCfm(pst, cfg) Pst * pst; RgMngmt * cfg; #endif diff --git a/src/cm/lrg.x b/src/cm/lrg.x index d028f8ac1..259b1acca 100755 --- a/src/cm/lrg.x +++ b/src/cm/lrg.x @@ -533,12 +533,12 @@ typedef uint8_t (*LrgSchCfgReq) ARGS(( RgMngmt *cfg /* Management Structure */ )); -typedef S16 (*LrgCfgCfm) ARGS(( +typedef uint8_t (*LrgCfgCfm) ARGS(( Pst *pst, /* Post Structure */ RgMngmt *cfg /* Management Structure */ )); -typedef S16 (*LrgSchCfgCfm) ARGS(( +typedef uint8_t (*LrgSchCfgCfm) ARGS(( Pst *pst, /* Post Structure */ RgMngmt *cfg /* Management Structure */ )); @@ -999,7 +999,7 @@ EXTERN S16 cmUnpkLrgSchL2MeasStopCfm ARGS(( #endif /** @brief This API is used to send a Configuration Confirm from MAC to LM. */ -EXTERN S16 cmPkLrgCfgCfm ARGS(( +EXTERN uint8_t cmPkLrgCfgCfm ARGS(( Pst * pst, RgMngmt * cfm )); @@ -1012,7 +1012,7 @@ EXTERN S16 cmUnpkLrgCfgCfm ARGS(( )); /** @brief This API is used to send a Configuration Confirm from SCH to LM. */ -EXTERN S16 cmPkLrgSchCfgCfm ARGS(( +EXTERN uint8_t cmPkLrgSchCfgCfm ARGS(( Pst * pst, RgMngmt * cfg )); diff --git a/src/cm/mac_sch_interface.c b/src/cm/mac_sch_interface.c index 3d0e15d84..3dab44ff9 100644 --- a/src/cm/mac_sch_interface.c +++ b/src/cm/mac_sch_interface.c @@ -130,7 +130,7 @@ uint8_t packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd) * RFAILED - failure * * ****************************************************************/ -uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo) +uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo) { if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LWLC)) { diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index 26fe41a15..0c00aa4df 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -76,6 +76,8 @@ #define CCCH_LCID 0 #define SRB1_LCID 1 #define SRB2_LCID 2 +#define MIN_DRB_LCID 3 +#define MAX_DRB_LCID 10 #define ADD_DELTA_TO_TIME(crntTime, toFill, incr) \ { \ @@ -683,18 +685,35 @@ typedef struct msg4Info uint8_t pucchResInd; uint8_t harqFeedbackInd; uint8_t dciFormatId; - uint8_t *msg4Pdu; - uint16_t msg4PduLen; -}Msg4Info; + uint8_t *dlMsgPdu; + uint16_t dlMsgPduLen; +}DlMsgInfo; typedef struct msg4Alloc { - Msg4Info msg4Info; + DlMsgInfo msg4Info; BwpCfg bwp; PdcchCfg msg4PdcchCfg; PdschCfg msg4PdschCfg; }Msg4Alloc; +typedef struct lcSchInfo +{ + uint8_t lcId; + uint16_t schBytes; /* Number of scheduled bytes */ +}LcSchInfo; + +typedef struct dlMsgAlloc +{ + uint16_t crnti; + uint8_t numLc; + LcSchInfo lcSchInfo[MAX_NUM_LOGICAL_CHANNELS]; /* Scheduled LC info */ + BwpCfg bwp; + PdcchCfg dlMsgPdcchCfg; + PdschCfg dlMsgPdschCfg; + DlMsgInfo dedMsgInfo; +}DlMsgAlloc; + typedef struct schSlotValue { SlotIndInfo currentTime; @@ -777,6 +796,9 @@ typedef struct dlSchedInfo /* UL grant in response to BSR */ DciInfo *ulGrant; + /* Allocation from dedicated DL msg */ + DlMsgAlloc *dlMsgAlloc; + }DlSchedInfo; typedef struct tbInfo @@ -789,6 +811,7 @@ typedef struct tbInfo typedef struct schPuschInfo { + uint16_t crnti; uint8_t harqProcId; /* HARQ Process ID */ uint8_t resAllocType; /* Resource allocation type */ FreqDomainAlloc fdAlloc; /* Freq domain allocation */ @@ -855,9 +878,9 @@ typedef struct dlRlcBOInfo { uint16_t cellId; uint16_t crnti; - uint16_t numLc; - BOInfo boInfo[MAX_NUM_LOGICAL_CHANNELS]; -}DlRlcBOInfo; + uint8_t lcId; + uint32_t dataVolume; +}DlRlcBoInfo; /* Info of Scheduling Request to Add/Modify */ typedef struct schSchedReqInfo @@ -1258,7 +1281,7 @@ typedef uint8_t (*MacSchCrcIndFunc) ARGS(( typedef uint8_t (*MacSchDlRlcBoInfoFunc) ARGS(( Pst *pst, /* Post structure */ - DlRlcBOInfo *dlBoInfo)); /* DL BO Info */ + DlRlcBoInfo *dlBoInfo)); /* DL BO Info */ typedef uint8_t (*MacSchUeCreateReqFunc) ARGS(( Pst *pst, /* Post structure */ @@ -1299,8 +1322,8 @@ uint8_t packMacSchRachInd(Pst *pst, RachIndInfo *rachInd); uint8_t MacSchRachInd(Pst *pst, RachIndInfo *rachInd); uint8_t packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd); uint8_t MacSchCrcInd(Pst *pst, CrcIndInfo *crcInd); -uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo); -uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo); +uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo); +uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo); uint8_t packMacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfgToSch); uint8_t MacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfgToSch); uint8_t packSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp); diff --git a/src/cm/rgu.c b/src/cm/rgu.c index df5714d50..36392974a 100755 --- a/src/cm/rgu.c +++ b/src/cm/rgu.c @@ -398,286 +398,6 @@ Buffer *mBuf; return ((*func)(pst, suId, status)); } - -/** -* @brief Request from RLC to MAC for forwarding SDUs on - * dedicated channel for transmission -* -* @details -* -* Function : packDlData -* -* @param[in] Pst* pst -* @param[in] SpId spId -* @param[in] RguDDatReqInfo * datReq -* @return S16 -* -# ROK -**/ -uint16_t packDlData -( -Pst* pst, -SpId spId, -RlcMacData *dlData -) -{ - Buffer *mBuf = NULLP; - TRC3(packDlData) - - if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU022, (ErrVal)0, "Packing failed"); -#endif - SPutSBuf(pst->region, pst->pool, (Data *)dlData, sizeof(RlcMacData)); - return RFAILED; - } - - if (pst->selector == ODU_SELECTOR_LWLC) - { - CMCHKPK(oduPackPointer,(PTR) dlData, mBuf); - } - else - { - /*rgu_c_001.main_5 - ADD - L2M Support */ -#ifdef LTE_L2_MEAS - if (packRlcMacDataInfo(pst, dlData, mBuf) != ROK) -#else - if (packRlcMacDataInfo(dlData, mBuf) != ROK) -#endif - { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU023, (ErrVal)0, "Packing failed"); -#endif - SPutSBuf(pst->region, pst->pool, (Data *)dlData, - sizeof(RlcMacData)); - SPutMsg(mBuf); - return RFAILED; - } - - if (SPutSBuf(pst->region, pst->pool, - (Data *)dlData, sizeof(RlcMacData)) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU025, (ErrVal)0, "Packing failed"); -#endif - SPutMsg(mBuf); - return RFAILED; - } - dlData = NULLP; - } - if (SPkS16(spId, mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU024, (ErrVal)0, "Packing failed"); -#endif - if (dlData != NULLP) - { - SPutSBuf(pst->region, pst->pool, - (Data *)dlData, sizeof(RlcMacData)); - } - SPutMsg(mBuf); - return RFAILED; - } - pst->event = (Event) EVTRLCDLDAT; - return (SPstTsk(pst,mBuf)); -} - - -/** -* @brief Request from RLC to MAC for forwarding SDUs on - * dedicated channel for transmission -* -* @details -* -* Function : unpackDlData -* -* @param[in] Pst* pst -* @param[in] SpId spId -* @param[in] RguDDatReqInfo * datReq -* @return S16 -* -# ROK -**/ -S16 unpackDlData -( -RlcMacDlData func, -Pst *pst, -Buffer *mBuf -) -{ - SpId spId; - RlcMacData *dlData; - - TRC3(unpackDlData) - - if (SUnpkS16(&spId, mBuf) != ROK) { - SPutMsg(mBuf); - return RFAILED; - } - - if (pst->selector == ODU_SELECTOR_LWLC) - { - CMCHKUNPK(oduUnpackPointer,(PTR *) &dlData, mBuf); - } - else - { - if ((SGetSBuf(pst->region, pst->pool, - (Data **)&dlData, sizeof(RlcMacData))) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU026, (ErrVal)0, "UnPacking failed"); -#endif - SPutMsg(mBuf); - return RFAILED; - } - cmMemset((U8*)dlData, (U8)0, sizeof(RlcMacData)); - /*rgu_c_001.main_5 - ADD - L2M Support */ -#ifdef LTE_L2_MEAS - if (unpackRlcMacDataInfo(pst,dlData, mBuf) != ROK) -#else - if (unpackRlcMacDataInfo(dlData, mBuf) != ROK) -#endif - { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU027, (ErrVal)0, "UnPacking failed"); -#endif - SPutMsg(mBuf); - SPutSBuf(pst->region, pst->pool, (Data *)dlData, - sizeof(RlcMacData)); - return RFAILED; - } - } - SPutMsg(mBuf); - - /* TODO : change function call to send RlcMacData as below: */ - return ((*func)(pst, spId, dlData)); - - //return ((*func)(pst, spId, datReq)); -} - - -/** -* @brief Data Indication from MAC to RLC to - * forward the data received for dedicated channels -* -* @details -* -* Function : packRcvdUlData -* -* @param[in] Pst* pst -* @param[in] SuId suId -* @param[in] RlcMacData *ulData -* @return S16 -* -# ROK -**/ -uint8_t packRlcUlData(Pst* pst, RlcMacData *ulData) -{ - Buffer *mBuf = NULLP; - - if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU035, (ErrVal)0, "Packing failed"); -#endif - SPutStaticBuffer(pst->region, pst->pool, (Data *)ulData, sizeof(RlcMacData),0); - return RFAILED; - } - - if (pst->selector == ODU_SELECTOR_LWLC) - { - CMCHKPK(oduPackPointer,(PTR)ulData, mBuf); - } - else - { - if (packRlcMacDataInfo(ulData, mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU036, (ErrVal)0, "Packing failed"); -#endif - SPutStaticBuffer(pst->region, pst->pool, (Data *)ulData, sizeof(RlcMacData),0); - SPutMsg(mBuf); - return RFAILED; - } - - if (SPutStaticBuffer(pst->region, pst->pool, - (Data *)ulData, sizeof(RlcMacData),0) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU038, (ErrVal)0, "Packing failed"); -#endif - SPutMsg(mBuf); - return RFAILED; - } - ulData = NULLP; - } - pst->event = (Event) EVTRLCULDAT; - return (SPstTsk(pst,mBuf)); -} - - -/** -* @brief Data Indication from MAC to RLC to - * forward the data received for dedicated channels -* -* @details -* -* Function : unpackRcvdUlData -* -* @param[in] Pst* pst -* @param[in] SuId suId -* @param[in] RlcMacData *ulData -* @return S16 -* -# ROK -**/ -uint8_t unpackRcvdUlData(RlcMacUlDataFunc func, Pst *pst, Buffer *mBuf) -{ - RlcMacData *ulData; - - TRC3(unpackRcvdUlData) - - if (pst->selector == ODU_SELECTOR_LWLC) - { - CMCHKUNPK(oduUnpackPointer,(PTR *) &ulData, mBuf); - } - else - { - if ((SGetStaticBuffer(pst->region, pst->pool, - (Data **)&ulData, sizeof(RlcMacData),0)) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU040, (ErrVal)0, "UnPacking failed"); -#endif - SPutMsg(mBuf); - return RFAILED; - } - if (unpackRlcMacDataInfo(ulData, mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU041, (ErrVal)0, "UnPacking failed"); -#endif - SPutMsg(mBuf); - SPutStaticBuffer(pst->region, pst->pool, - (Data *)ulData, sizeof(RlcMacData),0); - return RFAILED; - } - } - SPutMsg(mBuf); - return ((*func)(pst, ulData)); -} - - /*rgu_c_001.main_5 - ADD - L2M & R9 Support */ #ifdef LTE_L2_MEAS @@ -936,165 +656,6 @@ Buffer *mBuf; #endif - - -/** -* @brief Primitive invoked from RLC to MAC to - * inform the BO report for dedicated channels -* -* @details -* -* Function : packBOStatus, -* -* @param[in] Pst* pst -* @param[in] SpId spId -* @param[in] RlcMacBOStatus * staRsp -* @return S16 -* -# ROK -**/ -uint16_t packBOStatus -( -Pst* pst, -SpId spId, -RlcMacBOStatus *boStatus -) -{ - RlcMacBOStatus *boStaInfo = NULL; - Buffer *mBuf = NULLP; - - if(SGetSBuf(pst->region, pst->pool, (Data **)&boStaInfo, sizeof(RlcMacBOStatus)) != ROK) - { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU056, (ErrVal)0, "Packing failed"); -#endif - return RFAILED; - } -#ifdef ERRCLS_KW - /* boStaInfo cant be NULL here */ - if (boStaInfo == NULLP) - { - return RFAILED; - } -#endif - cmMemcpy((U8 *)boStaInfo, (U8 *)boStatus, sizeof(RlcMacBOStatus)); - if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU056, (ErrVal)0, "Packing failed"); -#endif - SPutSBuf(pst->region, pst->pool, (Data *)boStaInfo, sizeof(RlcMacBOStatus)); - - return RFAILED; - } - if (pst->selector == ODU_SELECTOR_LWLC) - { - CMCHKPK(oduPackPointer,(PTR) boStaInfo, mBuf); - } - else - { - if (packBOStatusInfo(boStatus, mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU057, (ErrVal)0, "Packing failed"); -#endif - SPutMsg(mBuf); - return RFAILED; - } - } - if (SPkS16(spId, mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU058, (ErrVal)0, "Packing failed"); -#endif - if (boStaInfo != NULLP) - { - SPutSBuf(pst->region, pst->pool, (Data *)boStaInfo, sizeof(RlcMacBOStatus)); - } - SPutMsg(mBuf); - return RFAILED; - } - - pst->event = (Event)EVTRLCBOSTA; - return (SPstTsk(pst,mBuf)); - SPutMsg(mBuf); -} - - -/** -* @brief Primitive invoked from RLC to MAC to -* inform the BO report for dedicated channels -* -* @details -* -* Function : unpackBOStatus -* -* @param[in] Pst* pst -* @param[in] SpId spId -* @param[in] RlcMacBOStatus * staRsp -* @return S16 -* -# ROK -**/ -uint16_t unpackBOStatus -( -RlcMacBoStatus func, -Pst *pst, -Buffer *mBuf -) -{ - SpId spId; - RlcMacBOStatus *boSta; - - TRC3(unpackBOStatus) - - if (SUnpkS16(&spId, mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU060, (ErrVal)0, "UnPacking failed"); -#endif - SPutMsg(mBuf); - return RFAILED; - } - - if (pst->selector == ODU_SELECTOR_LWLC) - { - CMCHKUNPK(oduUnpackPointer,(PTR *) &boSta, mBuf); - } - else - { - if ((SGetSBuf(pst->region, pst->pool, (Data **)&boSta, - sizeof(RlcMacBOStatus))) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU061, (ErrVal)0, "UnPacking failed"); -#endif - SPutMsg(mBuf); - return RFAILED; - } - if (unpackBOStatusInfo(boSta, mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU062, (ErrVal)0, "UnPacking failed"); -#endif - SPutMsg(mBuf); - SPutSBuf(pst->region, pst->pool, (Data *)boSta, sizeof(RlcMacBOStatus)); - return RFAILED; - } - } - SPutMsg(mBuf); - // (*func)(pst, spId, boSta); - SPutSBuf(pst->region, pst->pool, (Data *)boSta, sizeof(RlcMacBOStatus)); - return ROK; -} - - /*rgu_c_001.main_5 - ADD - L2M Support */ #ifdef LTE_L2_MEAS @@ -1238,229 +799,78 @@ RguHarqStatusInd *harqStatusInd; #ifdef ANSI S16 cmUnpkRguHqStaInd ( -RguHqStaInd func, -Pst *pst, -Buffer *mBuf -) -#else -S16 cmUnpkRguHqStaInd(func, pst, mBuf) -RguHqStaInd func; -Pst *pst; -Buffer *mBuf; -#endif -{ - RguHarqStatusInd *hqStaInd; - SuId suId; - U8 idx; - - TRC3(cmUnpkRguHqStaInd) - - if (SUnpkS16(&suId, mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU073, (ErrVal)0, "UnPacking failed"); -#endif - SPutMsg(mBuf); - return RFAILED; - } -#ifdef XEON_SPECIFIC_CHANGES - if ((SGetSBuf(pst->region, pst->pool, (Data **)&hqStaInd, - sizeof(RguHarqStatusInd))) != ROK) { -#else - if (pst->selector == ODU_SELECTOR_LWLC) - { - CMCHKUNPK(oduUnpackPointer,(PTR *) &hqStaInd, mBuf); - } - else - { - if ((SGetStaticBuffer(pst->region, pst->pool, - (Data **)&hqStaInd, sizeof(RguHarqStatusInd),0)) != ROK) - { -#endif -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU074, (ErrVal)0, "UnPacking failed"); -#endif - SPutMsg(mBuf); - return RFAILED; - } - CMCHKUNPK(cmUnpkLteCellId, &hqStaInd->cellId, mBuf); - CMCHKUNPK(cmUnpkLteRnti, &hqStaInd->ueId, mBuf); - CMCHKUNPK(oduPackUInt8, &hqStaInd->numTbs, mBuf); - for(idx = hqStaInd->numTbs; idx > 0; idx--) - { - CMCHKUNPK(oduPackUInt32, &hqStaInd->tbId[idx - 1], mBuf); - } - for(idx = hqStaInd->numTbs; idx > 0; idx--) - { - CMCHKUNPK(oduPackUInt16, &hqStaInd->status[idx - 1], mBuf); - } -#ifndef XEON_SPECIFIC_CHANGES - } -#endif - SPutMsg(mBuf); - (*func)(pst, suId, hqStaInd); -#ifdef XEON_SPECIFIC_CHANGES - SPutSBuf(pst->region, pst->pool, (Data *)hqStaInd, sizeof(RguHarqStatusInd)); -#else - SPutStaticBuffer(pst->region, pst->pool, (Data *)hqStaInd, sizeof(RguHarqStatusInd), 0); -#endif - return ROK; -} -#endif /* LTE_L2_MEAS */ - - -/** -* @brief Status Indication from MAC to RLC - * as a response to the staRsp primitive from RLC. - * Informs RLC of the totalBufferSize and Timing Info - * for the transmission on dedicated channels. -* -* @details -* -* Function : packSchedRep -* -* @param[in] Pst* pst -* @param[in] SuId suId -* @param[in] RlcMacSchedRep* schRep -* @return S16 -* -# ROK -**/ -S16 packSchedRep -( -Pst* pst, -SuId suId, -RlcMacSchedRepInfo * schRep -) -{ - Buffer *mBuf = NULLP; - TRC3(packSchedRep) - - if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU076, (ErrVal)0, "Packing failed"); -#endif - SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRepInfo)); - return RFAILED; - } - if (pst->selector == ODU_SELECTOR_LWLC) - { - CMCHKPK(oduPackPointer,(PTR) schRep, mBuf); - } - else - { - if (packSchedRepInfo(schRep, mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU077, (ErrVal)0, "Packing failed"); -#endif - SPutSBuf(pst->region, pst->pool, (Data *)schRep, - sizeof(RlcMacSchedRepInfo)); - SPutMsg(mBuf); - return RFAILED; - } - if (SPutSBuf(pst->region, pst->pool, (Data *)schRep, - sizeof(RlcMacSchedRepInfo)) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU079, (ErrVal)0, "Packing failed"); -#endif - SPutMsg(mBuf); - return RFAILED; - } - schRep= NULLP; - } - if (SPkS16(suId, mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU078, (ErrVal)0, "Packing failed"); -#endif - if (schRep != NULLP) - { - SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRepInfo)); - } - SPutMsg(mBuf); - return RFAILED; - } - - pst->event = (Event) EVTSCHREP; - return (SPstTsk(pst,mBuf)); -} - - -/** -* @brief Status Indication from MAC to RLC - * as a response to the staRsp primitive from RLC. - * Informs RLC of the totalBufferSize and Timing Info - * for the transmission on dedicated channels. -* -* @details -* -* Function : unpackSchedRep -* -* @param[in] Pst* pst -* @param[in] SuId suId -* @param[in] RguDStaIndInfo * staInd -* @return S16 -* -# ROK -**/ -S16 unpackSchedRep -( -RlcMacSchedRep func, +RguHqStaInd func, Pst *pst, Buffer *mBuf ) +#else +S16 cmUnpkRguHqStaInd(func, pst, mBuf) +RguHqStaInd func; +Pst *pst; +Buffer *mBuf; +#endif { - SuId suId; - RlcMacSchedRepInfo *schRep; - - TRC3(unpackSchedRep) + RguHarqStatusInd *hqStaInd; + SuId suId; + U8 idx; + + TRC3(cmUnpkRguHqStaInd) if (SUnpkS16(&suId, mBuf) != ROK) { #if (ERRCLASS & ERRCLS_ADD_RES) SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU080, (ErrVal)0, "UnPacking failed"); + (ErrVal)ERGU073, (ErrVal)0, "UnPacking failed"); #endif SPutMsg(mBuf); return RFAILED; } +#ifdef XEON_SPECIFIC_CHANGES + if ((SGetSBuf(pst->region, pst->pool, (Data **)&hqStaInd, + sizeof(RguHarqStatusInd))) != ROK) { +#else if (pst->selector == ODU_SELECTOR_LWLC) { - CMCHKUNPK(oduUnpackPointer,(PTR *) &schRep, mBuf); - } - else - { - if ((SGetSBuf(pst->region, pst->pool, (Data **)&schRep, sizeof(RlcMacSchedRepInfo))) != ROK) { + CMCHKUNPK(oduUnpackPointer,(PTR *) &hqStaInd, mBuf); + } + else + { + if ((SGetStaticBuffer(pst->region, pst->pool, + (Data **)&hqStaInd, sizeof(RguHarqStatusInd),0)) != ROK) + { +#endif #if (ERRCLASS & ERRCLS_ADD_RES) SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU081, (ErrVal)0, "UnPacking failed"); + __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, + (ErrVal)ERGU074, (ErrVal)0, "UnPacking failed"); #endif SPutMsg(mBuf); return RFAILED; } - if (unpackSchedRepInfo(schRep, mBuf) != ROK) { -#if (ERRCLASS & ERRCLS_ADD_RES) - SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId, - __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES, - (ErrVal)ERGU082, (ErrVal)0, "UnPacking failed"); -#endif - SPutMsg(mBuf); - SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRepInfo)); - return RFAILED; + CMCHKUNPK(cmUnpkLteCellId, &hqStaInd->cellId, mBuf); + CMCHKUNPK(cmUnpkLteRnti, &hqStaInd->ueId, mBuf); + CMCHKUNPK(oduPackUInt8, &hqStaInd->numTbs, mBuf); + for(idx = hqStaInd->numTbs; idx > 0; idx--) + { + CMCHKUNPK(oduPackUInt32, &hqStaInd->tbId[idx - 1], mBuf); } + for(idx = hqStaInd->numTbs; idx > 0; idx--) + { + CMCHKUNPK(oduPackUInt16, &hqStaInd->status[idx - 1], mBuf); + } +#ifndef XEON_SPECIFIC_CHANGES } +#endif SPutMsg(mBuf); - return ((*func)(pst, suId, schRep)); + (*func)(pst, suId, hqStaInd); +#ifdef XEON_SPECIFIC_CHANGES + SPutSBuf(pst->region, pst->pool, (Data *)hqStaInd, sizeof(RguHarqStatusInd)); +#else + SPutStaticBuffer(pst->region, pst->pool, (Data *)hqStaInd, sizeof(RguHarqStatusInd), 0); +#endif + return ROK; } +#endif /* LTE_L2_MEAS */ #ifdef ANSI S16 cmPkRguLcFlowCntrlInfo @@ -2559,112 +1969,6 @@ Buffer *mBuf; return ROK; } - - -/*********************************************************** -* -* Func : packRlcMacDataInfo -* -* -* Desc : RlcMacData - * Data Indication from MAC to RLC for dedicated channels of a UE -* -* -* Ret : S16 -* -* Notes: -* -* File : -* -**********************************************************/ -#ifdef ANSI -S16 packRlcMacDataInfo -( -RlcMacData *param, -Buffer *mBuf -) -#else -S16 packRlcMacDataInfo(param, mBuf) -RlcMacData *param; -Buffer *mBuf; -#endif -{ - S32 i; - MsgLen msgLen; - - TRC3(packRlcMacDataInfo); - - for (i=param->numPdu-1; i >= 0; i--) - { - msgLen = 0; - //if (SFndLenMsg(param->pduInfo[i].pduBuf, &msgLen) != ROK) - // return RFAILED; - //if (SCatMsg(mBuf, param->pduInfo[i].pduBuf, M1M2) != ROK) - // return RFAILED; - CMCHKPK(cmPkMsgLen, msgLen, mBuf); - CMCHKPK(cmPkLteLcId, param->pduInfo[i].lcId, mBuf); - CMCHKPK(oduPackBool, param->pduInfo[i].commCh, mBuf); - } - CMCHKPK(oduUnpackUInt8, param->numPdu, mBuf); - CMCHKPK(cmPkLteRnti, param->rnti, mBuf); - CMCHKPK(cmPkLteCellId, param->cellId, mBuf); - //CMCHKPK(cmPkLteTimingInfo, ¶m->timeToTx, mBuf); - return ROK; -} - - - -/*********************************************************** -* -* Func : unpackRlcMacDataInfo -* -* -* Desc : RlcMacData - * Data Indication from MAC to RLC for dedicated channels of a UE -* -* -* Ret : S16 -* -* Notes: -* -* File : -* -**********************************************************/ -#ifdef ANSI -S16 unpackRlcMacDataInfo -( -RlcMacData *param, -Buffer *mBuf -) -#else -S16 unpackRlcMacDataInfo(param, mBuf) -RlcMacData *param; -Buffer *mBuf; -#endif -{ - S32 i; - - TRC3(unpackRlcMacDataInfo); - - //CMCHKUNPK(cmUnpkLteTimingInfo, ¶m->timeToTx, mBuf); - CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf); - CMCHKUNPK(cmUnpkLteRnti, ¶m->rnti, mBuf); - CMCHKUNPK(oduPackUInt8, ¶m->numPdu, mBuf); - for (i=0; inumPdu; i++) - { - MsgLen totalMsgLen; - - CMCHKUNPK(oduUnpackBool, ¶m->pduInfo[i].commCh, mBuf); - CMCHKUNPK(cmUnpkLteLcId, ¶m->pduInfo[i].lcId, mBuf); - CMCHKUNPK(cmUnpkMsgLen, ¶m->pduInfo[i].pduLen, mBuf); - if (SFndLenMsg(mBuf, &totalMsgLen) != ROK) - return RFAILED; - //if (SSegMsg(mBuf, totalMsgLen-param->pduInfo[i].pduLen, ¶m->pduInfo[i].pduBuf) != ROK) - // return RFAILED; - } - return ROK; -} - /*********************************************************** * @@ -2774,88 +2078,6 @@ Buffer *mBuf; return ROK; } - - -/*********************************************************** -* -* Func : packBOStatusInfo -* -* -* Desc : RlcMacBOStatus - * Status Response from RLC to MAC for dedicated logical channel -* -* -* Ret : S16 -* -* Notes: -* -* File : -* -**********************************************************/ -#ifdef ANSI -S16 packBOStatusInfo -( -RlcMacBOStatus *param, -Buffer *mBuf -) -#else -S16 packBOStatusInfo(param, mBuf) -RlcMacBOStatus *param; -Buffer *mBuf; -#endif -{ - - TRC3(packBOStatusInfo); - - CMCHKPK(SPkS32, param->bo, mBuf); - CMCHKPK(cmPkLteLcId, param->lcId, mBuf); - CMCHKPK(oduPackBool, param->commCh, mBuf); - CMCHKPK(cmPkLteRnti, param->rnti, mBuf); - CMCHKPK(cmPkLteCellId, param->cellId, mBuf); - return ROK; -} /* End of packBOStatusInfo */ - - - -/*********************************************************** -* -* Func : unpackBOStatusInfo -* -* -* Desc : RlcMacBOStatus - * Status Response from RLC to MAC for dedicated logical channel -* -* -* Ret : S16 -* -* Notes: -* -* File : -* -**********************************************************/ -#ifdef ANSI -S16 unpackBOStatusInfo -( -RlcMacBOStatus *param, -Buffer *mBuf -) -#else -S16 unpackBOStatusInfo(param, mBuf) -RlcMacBOStatus *param; -Buffer *mBuf; -#endif -{ - - TRC3(unpackBOStatusInfo); - - CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf); - CMCHKUNPK(cmUnpkLteRnti, ¶m->rnti, mBuf); - CMCHKUNPK(oduUnpackBool, ¶m->commCh, mBuf); - CMCHKUNPK(cmUnpkLteLcId, ¶m->lcId, mBuf); - CMCHKUNPK(SUnpkS32, ¶m->bo, mBuf); - return ROK; -} /* End of unpackBOStatusInfo */ - /*********************************************************** * @@ -3020,87 +2242,6 @@ Buffer *mBuf; return ROK; } - -/*********************************************************** -* -* Func : packSchedRepInfo -* -* -* Desc : RlcMacSchedRep - * StaInd from MAC to RLC for dedicated logical channels of a UE -* -* -* Ret : S16 -* -* Notes: -* -* File : -* -**********************************************************/ -S16 packSchedRepInfo -( -RlcMacSchedRepInfo *param, -Buffer *mBuf -) -{ - S32 idx; - - TRC3(packSchedRepInfo); - - for(idx = (param->nmbLch-1); idx >= 0; idx--) - { - CMCHKPK(cmPkRguLchStaInd, ¶m->lchSta[idx].lchStaInd, mBuf); - CMCHKPK(oduPackBool, param->lchSta[idx].commCh, mBuf); - } - CMCHKPK(oduUnpackUInt8, param->nmbLch, mBuf); - CMCHKPK(cmPkLteRnti, param->rnti, mBuf); - CMCHKPK(cmPkLteCellId, param->cellId, mBuf); - CMCHKPK(cmPkLteTimingInfo, ¶m->timeToTx, mBuf); - - return ROK; -} /* End of packSchedRepInfo */ - - - -/*********************************************************** -* -* Func : unpackSchedRepInfo -* -* -* Desc : RlcMacSchedRep - * StaInd from MAC to RLC for dedicated logical channels of a UE -* -* -* Ret : S16 -* -* Notes: -* -* File : -* -**********************************************************/ -S16 unpackSchedRepInfo -( -RlcMacSchedRepInfo *param, -Buffer *mBuf -) -{ - S32 idx; - - TRC3(unpackSchedRepInfo); - - CMCHKUNPK(cmUnpkLteTimingInfo, ¶m->timeToTx, mBuf); - CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf); - CMCHKUNPK(cmUnpkLteRnti, ¶m->rnti, mBuf); - CMCHKUNPK(oduPackUInt8, ¶m->nmbLch, mBuf); - for(idx = 0; idx < param->nmbLch; idx++) - { - CMCHKUNPK(oduUnpackBool, ¶m->lchSta[idx].commCh, mBuf); - CMCHKUNPK(cmUnpkRguLchStaInd, ¶m->lchSta[idx].lchStaInd, mBuf); - } - - return ROK; -} /* End of unpackSchedRepInfo */ - #endif /********************************************************************** diff --git a/src/cm/rgu.h b/src/cm/rgu.h index b43785df0..6d6beff38 100755 --- a/src/cm/rgu.h +++ b/src/cm/rgu.h @@ -66,13 +66,13 @@ extern "C" { #define EVTRGUUBNDREQ 2 /*!< Un-Bind Request */ #define EVTRGUBNDCFM 3 /*!< Bind Confirm */ #define EVTRGUCDATREQ 4 /*!< Common Channel Data Request */ -//#define EVTRGUCDATIND 5 /*!< Common Channel Data Indication */ +#define EVTRGUCDATIND 5 /*!< Common Channel Data Indication */ #define EVTRGUDDATREQ 6 /*!< Dedicated Channel Data Request */ -#define EVTRLCULDAT 7 /*!< Dedicated Channel Data Indication */ -#define EVTRLCDLDAT 8 /*!< Common Channel status response */ +#define EVTRGUDDATIND 7 /*!< Dedicated Channel Data Indication */ +#define EVTRGUCSTARSP 8 /*!< Common Channel status response */ #define EVTRGUCSTAIND 9 /*!< Common Channel status Indication */ -#define EVTRLCBOSTA 10 /*!< Channel buffer occupancy status response */ -#define EVTSCHREP 11 /*!< Logical Channel Scheduling result report*/ +#define EVTRGUDSTARSP 10 /*!< Dedicated Channel status response */ +#define EVTRGUDSTAIND 11 /*!< Dedicated Channel status Indication */ /*rgu_h_001.main_5 - ADD - L2M Support */ #ifdef LTE_L2_MEAS #define EVTRGUHQSTAIND 12 /*!< HARQ status Indication */ diff --git a/src/cm/rgu.x b/src/cm/rgu.x index f43567d28..1e494de14 100755 --- a/src/cm/rgu.x +++ b/src/cm/rgu.x @@ -397,51 +397,6 @@ typedef struct rguInfoRingElem Void *msg; }RguInfoRingElem; -/* Buffer occupancy status information */ -typedef struct rlcMacBOStatus -{ - CmLteCellId cellId; /*!< CELL ID */ - CmLteRnti rnti; /*!< UE ID */ - Bool commCh; /*!< Common or Dedicated Channel */ - CmLteLcId lcId; /*!< Logical channel ID */ - S32 bo; /*!< Buffer occupancy reported by RLC */ -}RlcMacBOStatus; - -/* Schedule result report from RLC to MAC */ -typedef struct rlcMacLchSta -{ - Bool commCh; /*!region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nRLC: Memory allocation failed at packBOStatus"); + return RFAILED; + } + + if (pst->selector == ODU_SELECTOR_LWLC) + { + /* light weight loose coupling */ + CMCHKPK(oduPackPointer,(PTR) boStatus, mBuf); + } + else + { + /* light coupling */ + return RFAILED; + } + + return ODU_POST_TASK(pst,mBuf); +} + +/** + * @brief Primitive invoked from RLC to MAC to + * inform the BO report for dedicated channels + * + * @details + * + * Function : unpackBOStatus + * + * @param[in] Pst* pst + * @param[in] RlcMacBOStatus * staRsp + * @return S16 + * -# ROK + **/ +uint8_t unpackRlcBoStatus(RlcMacBoStatusFunc func, Pst *pst, Buffer *mBuf) +{ + RlcBoStatus *boSta; + + if (pst->selector == ODU_SELECTOR_LWLC) + { + /* Light weight loose coupling */ + CMCHKUNPK(oduUnpackPointer,(PTR *) &boSta, mBuf); + } + else + { + /* Light Coupling */ + return RFAILED; + } + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, boSta); +} + +/** + * @brief Status Indication from MAC to RLC + * as a response to the staRsp primitive from RLC. + * Informs RLC of the totalBufferSize and Timing Info + * for the transmission on dedicated channels. + * + * @details + * + * Function : packSchedRep + * + * @param[in] Pst* pst + * @param[in] SuId suId + * @param[in] RlcMacSchedRep* schRep + * @return S16 + * -# ROK + **/ +uint8_t packRlcSchedResultRpt(Pst* pst, RlcSchedResultRpt *schRep) +{ + Buffer *mBuf = NULLP; + + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nMAC: Memory allocation failed at packSchResultRep"); + return RFAILED; + } + if (pst->selector == ODU_SELECTOR_LWLC) + { + CMCHKPK(oduPackPointer,(PTR) schRep, mBuf); + } + else + { + return RFAILED; + } + + return ODU_POST_TASK(pst,mBuf); +} + +/** + * @brief Status Indication from MAC to RLC + * as a response to the staRsp primitive from RLC. + * Informs RLC of the totalBufferSize and Timing Info + * for the transmission on dedicated channels. + * + * @details + * + * Function : unpackSchResultRpt + * + * @param[in] Pst* pst + * @param[in] SuId suId + * @param[in] RguDStaIndInfo * staInd + * @return S16 + * -# ROK + **/ +uint8_t unpackSchedResultRpt(RlcMacSchedResultRptFunc func, Pst *pst, Buffer *mBuf) +{ + RlcSchedResultRpt *schRep; + + if (pst->selector == ODU_SELECTOR_LWLC) + { + CMCHKUNPK(oduUnpackPointer,(PTR *) &schRep, mBuf); + } + else + { + return RFAILED; + } + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, schRep); +} + +/******************************************************************* + * + * @brief Pack and send DL Data from RLC to MAC + * + * @details + * + * Function : packRlcDlData + * + * Functionality: Pack and send DL Data from RLC to MAC + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packRlcDlData(Pst* pst, RlcData *dlData) +{ + Buffer *mBuf = NULLP; + + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nRLC: Memory allocation failed at packRlcDlData"); + return RFAILED; + } + + if (pst->selector == ODU_SELECTOR_LWLC) + { + CMCHKPK(oduPackPointer,(PTR) dlData, mBuf); + } + else + { + return RFAILED; + } + return ODU_POST_TASK(pst,mBuf); + +} + +/******************************************************************* + * + * @brief unpack RLC DL data + * + * @details + * + * Function : unpackRlcDlData + * + * Functionality: unpack RLC DL data + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t unpackRlcDlData(RlcMacDlDataFunc func, Pst *pst, Buffer *mBuf) +{ + RlcData *dlData; + + if (pst->selector == ODU_SELECTOR_LWLC) + { + CMCHKUNPK(oduUnpackPointer, (PTR *) &dlData, mBuf); + } + else + { + return RFAILED; + } + ODU_PUT_MSG_BUF(mBuf); + return((*func)(pst, dlData)); +} + +/******************************************************************* + * + * @brief Pack and send UL data from MAC to RLC + * + * @details + * + * Function : packRlcUlData + * + * Functionality: Pack and send UL data from MAC to RLC + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packRlcUlData(Pst* pst, RlcData *ulData) +{ + Buffer *mBuf = NULLP; + + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nMAC : Memory allocation failed at packRlcUlData"); + return RFAILED; + } + + if (pst->selector == ODU_SELECTOR_LWLC) + { + CMCHKPK(oduPackPointer,(PTR)ulData, mBuf); + } + else + { + return RFAILED; + } + + pst->event = (Event)EVENT_UL_DATA_TO_RLC; + return ODU_POST_TASK(pst,mBuf); +} + +/******************************************************************* + * + * @brief Unpack RLC UL data + * + * @details + * + * Function : unpackRlcUlData + * + * Functionality: Unpack RLC UL data + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t unpackRlcUlData(RlcMacUlDataFunc func, Pst *pst, Buffer *mBuf) +{ + RlcData *ulData; + + if (pst->selector == ODU_SELECTOR_LWLC) + { + CMCHKUNPK(oduUnpackPointer,(PTR *) &ulData, mBuf); + } + else + { + return RFAILED; + } + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, ulData); +} + +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/cm/rlc_mac_inf.h b/src/cm/rlc_mac_inf.h new file mode 100644 index 000000000..8a67d834e --- /dev/null +++ b/src/cm/rlc_mac_inf.h @@ -0,0 +1,106 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*******************************************************************************/ +/* This file containes define for RLC-MAC interface */ + +/* RLC instances */ +#define RLC_UL_INST 0 +#define RLC_DL_INST 1 + +/* Event */ +#define EVENT_BO_STATUS_TO_MAC 15 +#define EVENT_SCHED_RESULT_TO_RLC 16 +#define EVENT_DL_DATA_TO_MAC 17 +#define EVENT_UL_DATA_TO_RLC 18 + +/* MACRO defines */ +#define MAX_NUM_LC 11 +#define MAX_NUM_PDU 16 + +/* Buffer occupancy status information */ +typedef struct rlcBoStatus +{ + uint16_t cellId; /*!< CELL ID */ + uint16_t ueIdx; /*!< UE ID */ + bool commCh; /*!< Common or Dedicated Channel */ + uint8_t lcId; /*!< Logical channel ID */ + uint16_t bo; /*!< Buffer occupancy reported by RLC */ +}RlcBoStatus; + +/* Scheduled logical channel info */ +typedef struct rlcLcSchInfo +{ + bool commCh; /* Common or dedicated channel */ + uint8_t lcId; /*!< Logical channel ID */ + uint16_t bufSize; /*!< Total buffer size in bytes scheduled by MAC */ +}RlcLcSchInfo; + +/* Schedule result report */ +typedef struct rlcSchedResultRpt +{ + //Slot info + uint16_t cellId; /*!< CELL ID */ + uint16_t rnti; /*!< Temporary CRNTI */ + uint8_t numLc; /*!< Number of logical channels scheduled */ + SlotIndInfo slotInfo; /*!< Timing info */ + RlcLcSchInfo lcSch[MAX_NUM_LC]; /*!< Scheduled info of logical channels */ +}RlcSchedResultRpt; + +/* DL/UL data transfer */ +typedef struct rlcPduInfo +{ + bool commCh; /*!preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] &= ~(EGTP_MASK_BIT3); } - ODU_FIND_MSG_LEN(egtpMsg.msg, &tPduSize); + ODU_FIND_MSG_LEN(egtpMsg.msg, (int16_t *)&tPduSize); /*Adjust the header to fill the correct length*/ msgLen = tPduSize + (EGTP_MAX_HDR_LEN - hdrLen) - 0x08; @@ -752,7 +752,8 @@ uint8_t egtpSendMsg(Buffer *mBuf) dstAddr.port = EGTP_DFLT_PORT; dstAddr.address = egtpCb.dstCb.dstIp; - ret = cmInetSendMsg(&(egtpCb.dstCb.sendTptSrvr.sockFd), &dstAddr, &info, mBuf, &txLen, CM_INET_NO_FLAG); + ret = cmInetSendMsg(&(egtpCb.dstCb.sendTptSrvr.sockFd), &dstAddr, &info, \ + mBuf, (int16_t *)&txLen, CM_INET_NO_FLAG); if(ret != ROK && ret != RWOULDBLOCK) { DU_LOG("\nEGTP : Failed sending the message"); @@ -825,7 +826,8 @@ uint8_t egtpRecvMsg() while(nMsg < EGTP_MAX_MSG_RECV) { bufLen = -1; - ret = cmInetRecvMsg(&(egtpCb.recvTptSrvr.sockFd), &fromAddr, &memInfo, &recvBuf, &bufLen, CM_INET_NO_FLAG); + ret = cmInetRecvMsg(&(egtpCb.recvTptSrvr.sockFd), &fromAddr, &memInfo, \ + &recvBuf, (int16_t *)&bufLen, CM_INET_NO_FLAG); if(ret == ROK && recvBuf != NULLP) { DU_LOG("\nEGTP : Received DL Message[%d]\n", nMsg+1); @@ -861,7 +863,7 @@ uint8_t egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) uint8_t extHdrLen = 0; /* Extension hdr length */ bool extPres = FALSE; /* Flag for indication of S, E or P presense flag */ - ODU_FIND_MSG_LEN(mBuf, &bufLen); + ODU_FIND_MSG_LEN(mBuf, (int16_t *)&bufLen); /* Decode first byte and storing in temporary variable */ ODU_REM_PRE_MSG(&tmpByte[0], mBuf); diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index ac1fdb869..f6845633f 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -74,7 +74,6 @@ #include "du_f1ap_msg_hdl.h" extern DuCfgParams duCfgParam; -uint8_t ServedCellListreturn=RFAILED; uint8_t procGNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg); uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg); @@ -943,55 +942,53 @@ void FreeServedCellList( GNB_DU_Served_Cells_List_t *duServedCell) * ****************************************************************/ void FreeF1SetupReq(F1AP_PDU_t *f1apMsg) { - uint8_t idx =0; - uint8_t idx1=1; - F1SetupRequest_t *f1SetupReq=NULLP; - - - if(f1apMsg != NULLP) - { - if(f1apMsg->choice.initiatingMessage != NULLP) - { - f1SetupReq = &f1apMsg->choice.initiatingMessage->value.choice.F1SetupRequest; - if(f1SetupReq->protocolIEs.list.array != NULLP) - { - if(f1SetupReq->protocolIEs.list.array[idx1]!=NULLP) - { - if(f1SetupReq->protocolIEs.list.array[idx1]->value.choice.GNB_DU_ID.buf != NULLP) - { - idx1++; - if(f1SetupReq->protocolIEs.list.array[idx1]->value.choice.GNB_DU_Name.buf != NULLP) - { - idx1=4; - if(ServedCellListreturn == ROK) - { - FreeRrcVer(&f1SetupReq->protocolIEs.list.array[idx1]->value.choice.RRC_Version); - } - idx1--; - FreeServedCellList(&f1SetupReq->protocolIEs.list.array[idx1]->value.choice.GNB_DU_Served_Cells_List); - idx1--; - DU_FREE(f1SetupReq->protocolIEs.list.array[idx1]->value.choice.GNB_DU_Name.buf, - strlen((char *)duCfgParam.duName)); - } - idx1--; - DU_FREE(f1SetupReq->protocolIEs.list.array[idx1]->value.choice.GNB_DU_ID.buf,\ - f1SetupReq->protocolIEs.list.array[idx1]->value.choice.GNB_DU_ID.size); - } - } - for(idx=0; idxprotocolIEs.list.count; idx++) - { - if(f1SetupReq->protocolIEs.list.array[idx]!=NULLP) - { - DU_FREE(f1SetupReq->protocolIEs.list.array[idx],sizeof(F1SetupRequestIEs_t)); - } - } - DU_FREE(f1SetupReq->protocolIEs.list.array,\ - f1SetupReq->protocolIEs.list.size); - } - DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t)); - } - DU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); - } + uint8_t idx =0; + uint8_t idx1=1; + F1SetupRequest_t *f1SetupReq=NULLP; + + + if(f1apMsg != NULLP) + { + if(f1apMsg->choice.initiatingMessage != NULLP) + { + f1SetupReq = &f1apMsg->choice.initiatingMessage->value.choice.F1SetupRequest; + if(f1SetupReq->protocolIEs.list.array != NULLP) + { + if(f1SetupReq->protocolIEs.list.array[idx1]!=NULLP) + { + if(f1SetupReq->protocolIEs.list.array[idx1]->value.choice.GNB_DU_ID.buf != NULLP) + { + DU_FREE(f1SetupReq->protocolIEs.list.array[idx1]->value.choice.GNB_DU_ID.buf,\ + f1SetupReq->protocolIEs.list.array[idx1]->value.choice.GNB_DU_ID.size); + idx1++; + if(f1SetupReq->protocolIEs.list.array[idx1]->value.choice.GNB_DU_Name.buf != NULLP) + { + DU_FREE(f1SetupReq->protocolIEs.list.array[idx1]->value.choice.GNB_DU_Name.buf, + strlen((char *)duCfgParam.duName)); + + idx1++; + FreeServedCellList(&f1SetupReq->protocolIEs.list.array[idx1]->value.\ + choice.GNB_DU_Served_Cells_List); + + idx1++; + FreeRrcVer(&f1SetupReq->protocolIEs.list.array[idx1]->value.choice.RRC_Version); + } + } + } + for(idx=0; idxprotocolIEs.list.count; idx++) + { + if(f1SetupReq->protocolIEs.list.array[idx]!=NULLP) + { + DU_FREE(f1SetupReq->protocolIEs.list.array[idx],sizeof(F1SetupRequestIEs_t)); + } + } + DU_FREE(f1SetupReq->protocolIEs.list.array,\ + f1SetupReq->protocolIEs.list.size); + } + DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t)); + } + DU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + } } /******************************************************************* @@ -1124,8 +1121,7 @@ uint8_t BuildAndSendF1SetupReq() F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List; duServedCell = &f1SetupReq->protocolIEs.list.\ array[idx2]->value.choice.GNB_DU_Served_Cells_List; - ServedCellListreturn = BuildServedCellList(duServedCell); - if(ServedCellListreturn != ROK) + if((BuildServedCellList(duServedCell)) != ROK) { break; } diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index a02ec5c0b..c88061337 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -74,19 +74,19 @@ typedef enum typedef struct cellCfgParams { NrEcgi nrEcgi; /* ECGI */ - uint16_t nrPci; /* PCI */ - uint16_t fiveGsTac; /* 5gSTac */ - Plmn plmn[MAX_PLMN]; /* List of serving PLMN IDs */ - uint32_t maxUe; /* max UE per slot */ + uint16_t nrPci; /* PCI */ + uint16_t fiveGsTac; /* 5gSTac */ + Plmn plmn[MAX_PLMN]; /* List of serving PLMN IDs */ + uint32_t maxUe; /* max UE per slot */ }CellCfgParams; typedef struct duUeCb { - uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */ - uint32_t gnbCuUeF1apId; /* GNB CU UE F1AP ID */ - UeState ueState; - MacUeCfg macUeCfg; - RlcUeCfg rlcUeCfg; + uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */ + uint32_t gnbCuUeF1apId; /* GNB CU UE F1AP ID */ + UeState ueState; + MacUeCfg macUeCfg; + RlcUeCfg rlcUeCfg; }DuUeCb; typedef struct duCellCb @@ -107,8 +107,8 @@ typedef struct duLSapCb State sapState; Mem mem; CmTimer timer; - uint8_t bndRetryCnt; - uint8_t maxBndRetry; + uint8_t bndRetryCnt; + uint8_t maxBndRetry; TmrCfg bndTmr; }DuLSapCb; diff --git a/src/du_app/du_mgr_ex_ms.c b/src/du_app/du_mgr_ex_ms.c index f2a7fd37c..ffbbb6713 100644 --- a/src/du_app/du_mgr_ex_ms.c +++ b/src/du_app/du_mgr_ex_ms.c @@ -168,11 +168,6 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) { break; } - case KWU_EVT_DAT_IND: - { - ret = cmUnpkKwuDatInd(duHdlRlcUlData, pst, mBuf); - break; - } case EVENT_RLC_UL_UE_CREATE_RSP: { ret = unpackRlcUlUeCreateRsp(DuProcRlcUlUeCreateRsp, pst, mBuf); diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index 4dd8cfc07..01cf77fcc 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -1203,12 +1203,6 @@ uint8_t duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm) if(tnlEvtCfm.cfmStatus.status == LCM_PRIM_OK) { DU_LOG("\nDU_APP : Tunnel management confirm OK"); - -#ifdef EGTP_TEST - duSendUeCreateReqToRlc(); - - duSendEgtpTestData(); -#endif } else { diff --git a/src/du_app/du_sctp.c b/src/du_app/du_sctp.c index 9df6cc9b3..19a26c77a 100644 --- a/src/du_app/du_sctp.c +++ b/src/du_app/du_sctp.c @@ -624,7 +624,7 @@ uint8_t processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, uint32 { uint8_t ret = ROK; CM_INET_FD_SET(sockFd, &pollParams->readFd); - ret = cmInetSelect(&pollParams->readFd, NULLP, timeoutPtr, &pollParams->numFd); + ret = cmInetSelect(&pollParams->readFd, NULLP, timeoutPtr, (int16_t *)&pollParams->numFd); if(CM_INET_FD_ISSET(sockFd, &pollParams->readFd)) { CM_INET_FD_CLR(sockFd, &pollParams->readFd); diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index 5d790bd4a..654df47cc 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -119,34 +119,6 @@ uint8_t duHdlEgtpDlData(EgtpMsg *egtpMsg) return ROK; } -/******************************************************************* - * - * @brief Handles UL data and send to CU - * - * @details - * - * Function : duHdlRlcUlData - * - * Functionality: - * Processes UL Data from RLC and sends to CU - * - * @params[in] Pointer to EGTP Message - * @return ROK - success - * RFAILED - failure - * - *****************************************************************/ - -uint8_t duHdlRlcUlData(Pst *pst, KwuDatIndInfo* datInd, Buffer *mBuf) -{ - DU_LOG("\nDU_APP : Received UL Data at DU_APP"); - - /* Send UL data to CU via EGTP */ - duSendEgtpDatInd(mBuf); - ODU_PUT_MSG_BUF(mBuf); - - return ROK; -} - /****************************************************************** * * @brief Builds and Sends DL CCCH Ind to MAC @@ -163,7 +135,7 @@ uint8_t duHdlRlcUlData(Pst *pst, KwuDatIndInfo* datInd, Buffer *mBuf) * * ****************************************************************/ uint8_t duBuildAndSendDlCcchInd(uint16_t *cellId, uint16_t *crnti, \ - DlCcchMsgType msgType, uint8_t *dlCcchMsg, uint16_t dlCcchMsgSize) + DlCcchMsgType msgType, uint16_t dlCcchMsgSize, uint8_t *dlCcchMsg) { uint8_t ret = ROK; uint16_t idx2; @@ -237,7 +209,7 @@ uint8_t duBuildAndSendDlCcchInd(uint16_t *cellId, uint16_t *crnti, \ * * ****************************************************************/ uint8_t duBuildAndSendDlRrcMsgToRlc(uint16_t cellId, RlcUeCfg ueCfg, \ - uint8_t lcId, bool deliveryStaReq, uint16_t rrcMsgLen, uint8_t *rrcMsg) + uint8_t lcId, bool execDup, bool deliveryStaReq, uint16_t rrcMsgLen, uint8_t *rrcMsg) { Pst pst; uint8_t ret; @@ -267,7 +239,7 @@ uint8_t duBuildAndSendDlRrcMsgToRlc(uint16_t cellId, RlcUeCfg ueCfg, \ break; } } - dlRrcMsgInfo->execDup = false; + dlRrcMsgInfo->execDup = execDup; dlRrcMsgInfo->deliveryStaRpt = deliveryStaReq; dlRrcMsgInfo->rrcMsg = rrcMsg; dlRrcMsgInfo->msgLen = rrcMsgLen; @@ -304,7 +276,7 @@ uint8_t duBuildAndSendDlRrcMsgToRlc(uint16_t cellId, RlcUeCfg ueCfg, \ uint8_t procUeContextSetupReq(F1AP_PDU_t *f1apMsg) { uint8_t ret = ROK; - uint8_t ieIdx, byteIdx, ueIdx; + uint8_t ieIdx, ueIdx; uint8_t *rrcMsg = NULLP; uint16_t rrcMsgLen; uint16_t cellId, cellIdx; @@ -379,7 +351,7 @@ uint8_t procUeContextSetupReq(F1AP_PDU_t *f1apMsg) if(ueIdx != MAX_NUM_UE) { ret = duBuildAndSendDlRrcMsgToRlc(cellId, ueCb->rlcUeCfg, SRB_ID_1, \ - deliveryStaReq, rrcMsgLen, rrcMsg); + false, deliveryStaReq, rrcMsgLen, rrcMsg); } else { @@ -410,10 +382,14 @@ uint8_t procUeContextSetupReq(F1AP_PDU_t *f1apMsg) uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg) { DLRRCMessageTransfer_t *dlRrcMsg = NULLP; - uint8_t *dlCcchMsg = NULLP; - uint8_t idx, ret, srbId; - uint16_t idx2, crnti, cellId, dlCcchMsgSize; + uint8_t *rrcMsgPdu = NULLP; + uint8_t ieIdx, ueIdx, cellIdx; + uint8_t ret, srbId; + uint16_t byteIdx, crnti, cellId, rrcMsgSize; uint32_t gnbCuUeF1apId, gnbDuUeF1apId; + bool execDup = false; + bool deliveryStaRpt = false; + bool ueFound = false; DU_LOG("\nDU_APP : DL RRC message transfer Recevied"); @@ -421,66 +397,72 @@ uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg) ret = ROK; - for(idx=0; idxprotocolIEs.list.count; idx++) + for(ieIdx=0; ieIdxprotocolIEs.list.count; ieIdx++) { - switch(dlRrcMsg->protocolIEs.list.array[idx]->id) + switch(dlRrcMsg->protocolIEs.list.array[ieIdx]->id) { case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: { - gnbCuUeF1apId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID; + gnbCuUeF1apId = dlRrcMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID; break; } case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: { - gnbDuUeF1apId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID; + gnbDuUeF1apId = dlRrcMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID; break; } case ProtocolIE_ID_id_SRBID: { - srbId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.SRBID; + srbId = dlRrcMsg->protocolIEs.list.array[ieIdx]->value.choice.SRBID; break; } case ProtocolIE_ID_id_ExecuteDuplication: - break; - + { + execDup = true; + break; + } case ProtocolIE_ID_id_RRCContainer: { - if(dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size > 0) + if(dlRrcMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size > 0) { - dlCcchMsgSize = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size; - DU_ALLOC(dlCcchMsg, dlCcchMsgSize); - for(idx2 = 0; idx2 < dlCcchMsgSize; idx2++) + rrcMsgSize = dlRrcMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size; + DU_ALLOC(rrcMsgPdu, rrcMsgSize); + for(byteIdx = 0; byteIdx < rrcMsgSize; byteIdx++) { - dlCcchMsg[idx2] = \ - dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf[idx2]; + rrcMsgPdu[byteIdx] = \ + dlRrcMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf[byteIdx]; } } else { DU_LOG("\nDU_APP : RRC Container Size is invalid:%ld",\ - dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size); + dlRrcMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size); } break; } - + case ProtocolIE_ID_id_RRCDeliveryStatusRequest: + { + deliveryStaRpt = true; + break; + } default: DU_LOG("\nDU_APP : Invalid IE received in DL RRC Msg Transfer:%ld", - dlRrcMsg->protocolIEs.list.array[idx]->id); + dlRrcMsg->protocolIEs.list.array[ieIdx]->id); } } - for(idx=0; idxnumActvUes < MAX_NUM_UE) { - ret = duCreateUeCb(&duCb.ueCcchCtxt[idx], gnbCuUeF1apId); + ret = duCreateUeCb(&duCb.ueCcchCtxt[ueIdx], gnbCuUeF1apId); if(ret) { - DU_LOG("\nDU_APP: Failed at duCreateUeCb for cellId [%d]", duCb.ueCcchCtxt[idx].cellId); + DU_LOG("\nDU_APP: Failed at duCreateUeCb for cellId [%d]", \ + duCb.ueCcchCtxt[ueIdx].cellId); ret = RFAILED; } } @@ -503,6 +486,28 @@ uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg) } } } + else + { + for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++) + { + for(ueIdx = 0 ; ueIdx < MAX_NUM_UE; ueIdx++) + { + if((gnbCuUeF1apId == duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId) + && (gnbDuUeF1apId == duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId)) + { + ueFound = true; + ret = duBuildAndSendDlRrcMsgToRlc(duCb.actvCellLst[cellIdx]->cellId, \ + duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg, srbId, \ + execDup, deliveryStaRpt, rrcMsgSize, rrcMsgPdu); + break; + } + } + if(ueFound) + break; + } + if(!ueFound) + ret = RFAILED; + } return ret; } @@ -1330,6 +1335,7 @@ uint8_t DuProcRlcUlUeCreateRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) } return ret; } + /********************************************************************** End of file ***********************************************************************/