#define SI_RNTI 0xFFFF
#define P_RNTI 0xFFFE
-#define PERIODIC_BSR_TMR_1MS 1
-#define PERIODIC_BSR_TMR_5MS 5
-#define PERIODIC_BSR_TMR_10MS 10
-#define PERIODIC_BSR_TMR_16MS 16
-#define PERIODIC_BSR_TMR_20MS 20
-#define PERIODIC_BSR_TMR_32MS 32
-#define PERIODIC_BSR_TMR_40MS 40
-#define PERIODIC_BSR_TMR_60MS 60
-#define PERIODIC_BSR_TMR_80MS 80
-#define PERIODIC_BSR_TMR_128MS 128
-#define PERIODIC_BSR_TMR_160MS 160
-#define PERIODIC_BSR_TMR_320MS 320
-#define PERIODIC_BSR_TMR_640MS 640
-#define PERIODIC_BSR_TMR_1280MS 1280
-#define PERIODIC_BSR_TMR_2560MS 2560
-
-#define RETX_BSR_TMR_10MS 10
-#define RETX_BSR_TMR_20MS 20
-#define RETX_BSR_TMR_40MS 40
-#define RETX_BSR_TMR_80MS 80
-#define RETX_BSR_TMR_160MS 160
-#define RETX_BSR_TMR_320MS 320
-#define RETX_BSR_TMR_640MS 640
-#define RETX_BSR_TMR_1280MS 1280
-#define RETX_BSR_TMR_2560MS 2560
-#define RETX_BSR_TMR_5120MS 5120
-#define RETX_BSR_TMR_10240MS 10240
-
-#define SR_DELAY_TMR_20MS 20
-#define SR_DELAY_TMR_40MS 40
-#define SR_DELAY_TMR_64MS 64
-#define SR_DELAY_TMR_128MS 128
-#define SR_DELAY_TMR_512MS 512
-#define SR_DELAY_TMR_1024MS 1024
-#define SR_DELAY_TMR_2560MS 2560
-
#define MAC_LCID_CCCH 0
#define MAC_LCID_MIN 1
#define MAC_LCID_MAX 32
MacDlSlot dlSlot[MAX_SLOT_SUPPORTED];
MacUlSlot ulSlot[MAX_SLOT_SUPPORTED];
uint16_t numActvUe;
+ MacUeCfg *ueCfgTmpData[MAX_NUM_UE];
MacUeCb ueCb[MAX_NUM_UE];
MacCellCfg macCellCfg;
SlotIndInfo currTime;
return ROK;
}
+/*******************************************************************
+ *
+ * @brief Sends UE configuration to Scheduler
+ *
+ * @details
+ *
+ * Function : sendUeReqToSch
+ *
+ * Functionality: sends UE configuration to Scheduler
+ *
+ * @params[in] Pst and Ue configuration
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t sendUeReqToSch(Pst *pst, SchUeCfg *schUeCfg)
+{
+ Pst schPst;
+ switch(pst->event)
+ {
+ case EVENT_MAC_UE_CREATE_REQ:
+ FILL_PST_MAC_TO_SCH(schPst, EVENT_UE_CREATE_REQ_TO_SCH);
+ return(*macSchUeCreateReqOpts[schPst.selector])(&schPst, schUeCfg);
+
+ case EVENT_MAC_UE_RECONFIG_REQ:
+ FILL_PST_MAC_TO_SCH(schPst, EVENT_UE_RECONFIG_REQ_TO_SCH);
+ return(*macSchUeReconfigReqOpts[schPst.selector])(&schPst,schUeCfg);
+ default:
+ DU_LOG("\n Invalid Pst received %d", pst->event);
+ return RFAILED;
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Fills Sch Drb Qos Information
+ *
+ * @details
+ *
+ * Function : fillSchDrbQosInfo
+ *
+ * Functionality: Fills Sch Drb Qos Information
+ *
+ * @params[in] macLcCfg : Logical channel Cfg at MAC
+ * schLcCfg : LC cfg to fill at scheduler
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+void fillSchDrbQosInfo(DrbQosInfo *macDrbQos, SchDrbQosInfo *schDrbQos)
+{
+ schDrbQos->fiveQiType = macDrbQos->fiveQiType;
+ if(schDrbQos->fiveQiType == SCH_QOS_NON_DYNAMIC)
+ {
+ schDrbQos->u.nonDyn5Qi.fiveQi = macDrbQos->u.nonDyn5Qi.fiveQi;
+ schDrbQos->u.nonDyn5Qi.avgWindow = macDrbQos->u.nonDyn5Qi.avgWindow;
+ schDrbQos->u.nonDyn5Qi.maxDataBurstVol = macDrbQos->u.nonDyn5Qi.maxDataBurstVol;
+ schDrbQos->u.nonDyn5Qi.priorLevel = macDrbQos->u.nonDyn5Qi.priorLevel;
+ }
+ else if(schDrbQos->fiveQiType == SCH_QOS_DYNAMIC)
+ {
+ schDrbQos->u.dyn5Qi.priorLevel = macDrbQos->u.dyn5Qi.priorLevel;
+ schDrbQos->u.dyn5Qi.packetDelayBudget = macDrbQos->u.dyn5Qi.packetDelayBudget;
+ schDrbQos->u.dyn5Qi.packetErrRateScalar= macDrbQos->u.dyn5Qi.packetErrRateScalar;
+ schDrbQos->u.dyn5Qi.packetErrRateExp = macDrbQos->u.dyn5Qi.packetErrRateExp;
+ schDrbQos->u.dyn5Qi.fiveQi = macDrbQos->u.dyn5Qi.fiveQi;
+ schDrbQos->u.dyn5Qi.delayCritical = macDrbQos->u.dyn5Qi.delayCritical;
+ schDrbQos->u.dyn5Qi.avgWindow = macDrbQos->u.dyn5Qi.avgWindow;
+ schDrbQos->u.dyn5Qi.maxDataBurstVol = macDrbQos->u.dyn5Qi.maxDataBurstVol;
+ }
+ schDrbQos->ngRanRetPri.priorityLevel = macDrbQos->ngRanRetPri.priorityLevel;
+ schDrbQos->ngRanRetPri.preEmptionCap = macDrbQos->ngRanRetPri.preEmptionCap;
+ schDrbQos->ngRanRetPri.preEmptionVul = macDrbQos->ngRanRetPri.preEmptionVul;
+ schDrbQos->grbQosFlowInfo.maxFlowBitRateDl = macDrbQos->grbQosInfo.maxFlowBitRateDl;
+ schDrbQos->grbQosFlowInfo.maxFlowBitRateUl = macDrbQos->grbQosInfo.maxFlowBitRateUl;
+ schDrbQos->grbQosFlowInfo.guarFlowBitRateDl= macDrbQos->grbQosInfo.guarFlowBitRateDl;
+ schDrbQos->grbQosFlowInfo.guarFlowBitRateUl= macDrbQos->grbQosInfo.guarFlowBitRateUl;
+ schDrbQos->pduSessionId = macDrbQos->pduSessionId;
+ schDrbQos->ulPduSessAggMaxBitRate = macDrbQos->ulPduSessAggMaxBitRate;
+}
+
+/*******************************************************************
+ *
+ * @brief Fill SCH UL logical channel configuration
+ *
+ * @details
+ *
+ * Function : fillSchUlLcCfg
+ *
+ * Functionality: Fills Sch Ul Lc configuration
+ *
+ * @params[in] macLcCfg : Logical channel Cfg at MAC
+ * schLcCfg : LC cfg to fill at scheduler
+ * @return void
+ *
+ * ****************************************************************/
+
+void fillSchUlLcCfg(SchUlLcCfg *schUlLcCfg, UlLcCfg *macUlLcCfg)
+{
+ schUlLcCfg->priority= macUlLcCfg->priority;
+ schUlLcCfg->lcGroup = macUlLcCfg->lcGroup;
+ schUlLcCfg->schReqId= macUlLcCfg->schReqId;
+ schUlLcCfg->pbr = macUlLcCfg->pbr;
+ schUlLcCfg->bsd = macUlLcCfg->bsd;
+}
/*******************************************************************
*
* RFAILED - failure
*
* ****************************************************************/
-uint8_t fillLogicalChannelCfg(LcCfg macLcCfg, SchLcCfg *schLcCfg)
+uint8_t fillLogicalChannelCfg(SchLcCfg *schLcCfg, LcCfg *macLcCfg)
{
- schLcCfg->lcId = macLcCfg.lcId;
- schLcCfg->dlLcCfg.lcp = macLcCfg.dlLcCfg.lcp;
+ uint8_t sdIdx;
+ uint8_t ret = ROK;
+ schLcCfg->lcId = macLcCfg->lcId;
+ schLcCfg->configType = macLcCfg->configType;
+ schLcCfg->dlLcCfg.lcp = macLcCfg->dlLcCfg.lcp;
+ fillSchUlLcCfg(&schLcCfg->ulLcCfg, &macLcCfg->ulLcCfg);
- schLcCfg->drbQos = NULL;
- if(macLcCfg.drbQos)
+ if(macLcCfg->drbQos)
{
- /* TODO : Optional Parameter */
- }
+ if(!schLcCfg->drbQos)
+ {
+ MAC_ALLOC(schLcCfg->drbQos, sizeof(SchDrbQosInfo));
+ if(!schLcCfg->drbQos)
+ {
+ DU_LOG("\nMAC : Memory alloc failed at drbQos at fillLogicalChannelCfg()");
+ ret = RFAILED;
+ }
+ }
+ if(ret == ROK)
+ {
+ fillSchDrbQosInfo(macLcCfg->drbQos, schLcCfg->drbQos);
+ }
+ else
+ return ret;
+ }
+ else
+ {
+ schLcCfg->drbQos = NULLP;
+ }
- schLcCfg->snssai = NULL;
- if(macLcCfg.snssai)
+ if(ret == ROK)
{
- /* TODO : Optional Parameter */
+ if(macLcCfg->snssai)
+ {
+ if(!schLcCfg->snssai)
+ {
+ MAC_ALLOC(schLcCfg->snssai, sizeof(SchSnssai));
+ if(!schLcCfg->snssai)
+ {
+ DU_LOG("\nMAC : Memory alloc failed at snssai at fillLogicalChannelCfg()");
+ ret = RFAILED;
+ }
+ }
+ if(ret == ROK)
+ {
+ schLcCfg->snssai->sst = macLcCfg->snssai->sst;
+ for(sdIdx = 0; sdIdx < SD_SIZE; sdIdx++)
+ {
+ schLcCfg->snssai->sd[sdIdx] = macLcCfg->snssai->sd[sdIdx];
+ }
+ }
+ else
+ {
+ schLcCfg->snssai = NULLP;
+ /*Freeing the previously allocated buffer in case of failure */
+ if(schLcCfg->drbQos)
+ {
+ MAC_FREE(schLcCfg->drbQos, sizeof(SchDrbQosInfo));
+ schLcCfg->drbQos = NULLP;
+ }
+ return ret;
+ }
+ }
+ else
+ {
+ schLcCfg->snssai = NULLP;
+ }
}
+ return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills Logical channel Cfg List to Add/Mod/Del
+ *
+ * @details
+ *
+ * Function : fillSchLcCfgList
+ *
+ * Functionality: Fills Logical channel Cfg List to Add/Mod/Del
+ *
+ * @params[in] MAC UE Cb Cfg , MAC UE Configuration
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t fillSchLcCfgList(SchUeCfg *schUeCfg, MacUeCfg *ueCfg)
+{
+ uint8_t lcIdx;
+
+ for(lcIdx = 0; lcIdx < ueCfg->numLcs; lcIdx++)
+ {
+ if(fillLogicalChannelCfg(&schUeCfg->schLcCfg[lcIdx], &ueCfg->lcCfgList[lcIdx]) != ROK)
+ {
+ DU_LOG("\nMAC : fillLogicalChannelCfg() failed for lc Idx[%d]", lcIdx);
+ return RFAILED;
+ }
+ schUeCfg->numLcs++;
+ }
return ROK;
}
*
* @details
*
- * Function : sendAddUeCreateReqToSch
+ * Function : fillSchUeCfg
*
* Functionality: Fills and sends UE configuration to Scheduler
*
* RFAILED - failure
*
* ****************************************************************/
-uint8_t sendAddUeCreateReqToSch(MacUeCfg *ueCfg)
+uint8_t fillSchUeCfg(Pst *pst, SchUeCfg *schUeCfg, MacUeCfg *ueCfg)
{
- Pst pst;
- uint8_t idx;
- SchUeCfg schUeCfg;
+ uint8_t ret = ROK;
- schUeCfg.cellId = ueCfg->cellId;
- schUeCfg.crnti = ueCfg->crnti;
+ schUeCfg->cellId = ueCfg->cellId;
+ schUeCfg->crnti = ueCfg->crnti;
/* Copy MAC cell group config */
- memset(&schUeCfg.macCellGrpCfg, 0, sizeof(SchMacCellGrpCfg));
- if(fillMacCellGroupCfg(ueCfg->macCellGrpCfg, &schUeCfg.macCellGrpCfg) != ROK)
+ memset(&schUeCfg->macCellGrpCfg, 0, sizeof(SchMacCellGrpCfg));
+ if(fillMacCellGroupCfg(ueCfg->macCellGrpCfg, &schUeCfg->macCellGrpCfg) != ROK)
{
DU_LOG("\nMAC : fillMacCellGroupCfg() failed");
return RFAILED;
}
/* Copy Physical cell group config */
- memset(&schUeCfg.phyCellGrpCfg, 0,sizeof(SchPhyCellGrpCfg));
- if(fillPhyCellGroupCfg(ueCfg->phyCellGrpCfg, &schUeCfg.phyCellGrpCfg) != ROK)
+ memset(&schUeCfg->phyCellGrpCfg, 0,sizeof(SchPhyCellGrpCfg));
+ if(fillPhyCellGroupCfg(ueCfg->phyCellGrpCfg, &schUeCfg->phyCellGrpCfg) != ROK)
{
DU_LOG("\nMAC : fillPhyCellGroupCfg() failed");
return RFAILED;
}
/* Copy sp cell config */
- memset(&schUeCfg.spCellCfg, 0, sizeof(SchSpCellCfg));
- if(fillSpCellCfg(ueCfg->spCellCfg, &schUeCfg.spCellCfg) != ROK)
+ memset(&schUeCfg->spCellCfg, 0, sizeof(SchSpCellCfg));
+ if(fillSpCellCfg(ueCfg->spCellCfg, &schUeCfg->spCellCfg) != ROK)
{
DU_LOG("\nMAC : fillSpCellCfg() failed");
return RFAILED;
}
- schUeCfg.aggrMaxBitRate = NULL;
+ schUeCfg->aggrMaxBitRate = NULL;
if(ueCfg->maxAggrBitRate != NULL)
{
-
- MAC_ALLOC(schUeCfg.aggrMaxBitRate, sizeof(SchAggrMaxBitRate));
- if(!schUeCfg.aggrMaxBitRate)
+ MAC_ALLOC(schUeCfg->aggrMaxBitRate, sizeof(SchAggrMaxBitRate));
+ if(!schUeCfg->aggrMaxBitRate)
{
- DU_LOG("\nMAC : Memory allocation failed in sendAddUeCreateReqToSch");
+ DU_LOG("\nMAC : Memory allocation failed in sendReconfigReqToSch");
return RFAILED;
}
- schUeCfg.aggrMaxBitRate->ulBitRate = ueCfg->maxAggrBitRate->ulBits;
- schUeCfg.aggrMaxBitRate->dlBitRate = ueCfg->maxAggrBitRate->dlBits;
+ schUeCfg->aggrMaxBitRate->ulBitRate = ueCfg->maxAggrBitRate->ulBits;
+ schUeCfg->aggrMaxBitRate->dlBitRate = ueCfg->maxAggrBitRate->dlBits;
}
- schUeCfg.numLc = ueCfg->numLcs;
- if(schUeCfg.numLc > MAX_NUM_LC)
+ /* Fill sch Lc Cfg to Add/ Mod/ Del */
+ ret = fillSchLcCfgList(schUeCfg, ueCfg);
+ if(ret == RFAILED)
{
- DU_LOG("\nMAC : Number of Logical channels %d exceeds max limit %d",\
- schUeCfg.numLc, MAX_NUM_LC);
- }
- for(idx = 0; idx < schUeCfg.numLc; idx++)
+ DU_LOG("\nMAC : Failed to copy LCs at fillSchUeCfg()");
+ return ret;
+ }
+ return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Update UeUlCb Lc List
+ *
+ * @details
+ *
+ * Function : updateMacUlCb
+ *
+ * Functionality: Update UeUlCb Lc List
+ *
+ * @params[in] delIdx, UeUlCb pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void updateMacUlCb(uint8_t delIdx, UeUlCb *ulCb)
+{
+ uint8_t lcIdx = 0;
+
+ for(lcIdx = delIdx; lcIdx < ulCb->numUlLc; lcIdx++)
{
- if(fillLogicalChannelCfg(ueCfg->lcCfgList[idx], &schUeCfg.lcCfgList[idx]) != ROK)
+ /* Moving the array element to one step ahead */
+ memcpy(&ulCb->lcCb[lcIdx], &ulCb->lcCb[lcIdx+1], sizeof(UlLcCb));
+ memset(&ulCb->lcCb[lcIdx+1], 0, sizeof(UlLcCb));
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Update UeDlCb Lc List
+ *
+ * @details
+ *
+ * Function : updateMacDlCb
+ *
+ * Functionality: Update UeDlCb Lc List
+ *
+ * @params[in] delIdx, UeDlCb pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void updateMacDlCb(uint8_t delIdx, UeDlCb *dlCb)
+{
+ uint8_t lcIdx = 0;
+
+ for(lcIdx = delIdx; lcIdx < dlCb->numDlLc; lcIdx++)
+ {
+ /* Moving the array element to one step ahead */
+ memcpy(&dlCb->lcCb[lcIdx], &dlCb->lcCb[lcIdx+1], sizeof(DlLcCb));
+ memset(&dlCb->lcCb[lcIdx+1], 0, sizeof(DlLcCb));
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Fills Logical channel Cfg List to Add/Mod/Del
+ *
+ * @details
+ *
+ * Function : fillMacLcCfgList
+ *
+ * Functionality: Fills Logical channel Cfg List to Add/Mod/Del
+ *
+ * @params[in] MAC UE Cb Cfg , MAC UE Configuration
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t fillMacLcCfgList(MacUeCb *ueCb, MacUeCfg *ueCfg)
+{
+ uint8_t lcIdx, ueLcIdx;
+
+ for(lcIdx = 0; lcIdx < ueCfg->numLcs; lcIdx++)
+ {
+ if(ueCb->dlInfo.numDlLc < MAX_NUM_LC)
{
- DU_LOG("\nMAC : fillLogicalChannelCfg() failed");
- return RFAILED;
+ if(ueCfg->lcCfgList[lcIdx].configType == CONFIG_ADD)
+ {
+ /*Filling DL LC CB */
+ ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].lcId = ueCfg->lcCfgList[lcIdx].lcId;
+ ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].lcState = MAC_LC_STATE_ACTIVE;
+ ueCb->dlInfo.numDlLc++;
+ /*Filling UL LC CB */
+ ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].lcId = ueCfg->lcCfgList[lcIdx].lcId;
+ ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].lcGrpId = ueCfg->lcCfgList[lcIdx].ulLcCfg.lcGroup;
+ ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].lcActive = MAC_LC_STATE_ACTIVE;
+ ueCb->ulInfo.numUlLc++;
+ }/*End of Add Config */
+ else
+ {
+ //searching for Lc to be Mod
+ for(ueLcIdx = 0; ueLcIdx < ueCb->ulInfo.numUlLc; ueLcIdx++)
+ {
+ if(ueCb->ulInfo.lcCb[ueLcIdx].lcId == ueCfg->lcCfgList[lcIdx].lcId)
+ {
+ if(ueCfg->lcCfgList[lcIdx].configType == CONFIG_MOD)
+ {
+ /*Nothing to Modify in DL LC CB */
+ /*Modify UL LC CB */
+ ueCb->ulInfo.lcCb[ueLcIdx].lcGrpId = ueCfg->lcCfgList[lcIdx].ulLcCfg.lcGroup;
+ DU_LOG("\nMAC: Successfully Modified LC context for lcId[%d]", ueCfg->lcCfgList[lcIdx].lcId);
+ break;
+ }
+ if(ueCfg->lcCfgList[lcIdx].configType == CONFIG_DEL)
+ {
+ memset(&ueCb->dlInfo.lcCb[ueLcIdx], 0, sizeof(DlLcCb));
+ (ueCb->dlInfo.numDlLc)--;
+ updateMacDlCb(ueLcIdx, &ueCb->dlInfo);
+
+ memset(&ueCb->ulInfo.lcCb[ueLcIdx], 0, sizeof(UlLcCb));
+ (ueCb->ulInfo.numUlLc)--;
+ updateMacUlCb(ueLcIdx, &ueCb->ulInfo);
+ DU_LOG("\nMAC: Successfully Deleted LC context for lcId[%d]", ueCfg->lcCfgList[lcIdx].lcId);
+ break;
+ }
+ }
+ }
+ }/*End of Mod Config */
+ }
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills MAC UE Cb Cfg
+ *
+ * @details
+ *
+ * Function : fillMacUeCb
+ *
+ * Functionality: Fills MAC UE Cb Cfg
+ *
+ * @params[in] MAC UE Cb Cfg , MAC UE Configuration
+ * cellIdx
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t fillMacUeCb(MacUeCb *ueCb, MacUeCfg *ueCfg, uint8_t cellIdx)
+{
+ uint8_t ret = ROK;
+
+ ueCb->ueIdx = ueCfg->ueIdx;
+ ueCb->crnti = ueCfg->crnti;
+ ueCb->cellCb = macCb.macCell[cellIdx];
+ ueCb->dlInfo.dlHarqEnt.numHarqProcs = \
+ ueCfg->spCellCfg.servCellCfg.pdschServCellCfg.numHarqProcForPdsch;
+ ueCb->state = UE_STATE_ACTIVE;
+ /*TODO: To check the bsr value during implementation */
+ ueCb->bsrTmrCfg.periodicTimer = ueCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer;
+ ueCb->bsrTmrCfg.retxTimer = ueCfg->macCellGrpCfg.bsrTmrCfg.retxTimer;
+ ueCb->bsrTmrCfg.srDelayTimer = ueCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer;
+ ret = fillMacLcCfgList(ueCb, ueCfg);
+ if(ret == RFAILED)
+ {
+ DU_LOG("\nMAC: Failed while filing MAC LC List at fillMacUeCb()");
+ }
+ return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Function to update Mac Ra Cb
+ *
+ * @details
+ *
+ * Function : updateMacRaCb
+ *
+ * Functionality: Function to update Mac Ra Cb
+ *
+ * @params[in] cellIdx, Mac Ue Cb
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t updateMacRaCb(uint16_t cellIdx, MacUeCb *ueCb)
+{
+ uint8_t ueIdx;
+ /* Copy RA Cb */
+ for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+ {
+ if(macCb.macCell[cellIdx]->macRaCb[ueIdx].crnti == ueCb->crnti)
+ {
+ ueCb->raCb = &macCb.macCell[cellIdx]->macRaCb[ueIdx];
+ break;
}
}
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Function to delete Mac Ra Cb
+ *
+ * @details
+ *
+ * Function : deleteMacRaCb
+ *
+ * Functionality: Function to delete Mac Ra Cb
+ *
+ * @params[in] cellIdx, Mac Ue Cb
+ * @return void
+ *
+ * ****************************************************************/
- /* Fill event and send UE create request to SCH */
- FILL_PST_MAC_TO_SCH(pst, EVENT_UE_CONFIG_REQ_TO_SCH);
- return(*macSchUeCreateReqOpts[pst.selector])(&pst, &schUeCfg);
+void deleteMacRaCb(uint16_t cellIdx, MacUeCb *ueCb)
+{
+ uint8_t ueIdx;
+
+ for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+ {
+ if(macCb.macCell[cellIdx]->macRaCb[ueIdx].crnti == ueCb->crnti)
+ {
+ if(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu)
+ {
+ MAC_FREE(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu, \
+ macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen);
+ }
+ if(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu)
+ {
+ MAC_FREE(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu, \
+ macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TbSize);
+ }
+ memset(&macCb.macCell[cellIdx]->macRaCb[ueIdx], 0, sizeof(MacRaCbInfo));
+ break;
+ }
+ }
+
}
/*******************************************************************
*
- * @brief Creates UE Cb and fills ueCfg
+ * @brief Creates UE Cb
*
* @details
*
* Function : createUeCb
*
+ * Functionality: Creates UE Cb
+ *
+ * @params[in] MAC UE Configuration
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t createUeCb(uint8_t cellIdx, MacUeCb *ueCb, MacUeCfg *ueCfg)
+{
+ uint8_t ret =ROK;
+
+ if((ueCb->ueIdx == ueCfg->ueIdx) && (ueCb->crnti == ueCfg->crnti)\
+ &&(ueCb->state == UE_STATE_ACTIVE))
+ {
+ DU_LOG("\n MAC : CRNTI %d already configured ", ueCfg->crnti);
+ return ROKDUP;
+ }
+ else
+ {
+ memset(ueCb, 0, sizeof(MacUeCb));
+ ret = fillMacUeCb(ueCb, ueCfg, cellIdx);
+ if(ret != ROK)
+ {
+ DU_LOG("\nMAC : Failed to create Ue Cb at createUeCb()");
+ return ret;
+ }
+ else
+ {
+ macCb.macCell[cellIdx]->numActvUe++;
+ updateMacRaCb(cellIdx, ueCb);
+ return ROK;
+ }
+
+ }
+
+}
+
+/*******************************************************************
+ *
+ * @brief Modify UE Cb Cfg
+ *
+ * @details
+ *
+ * Function : modifyUeCb
+ *
+ * Functionality: modify UE Cb
+ *
+ * @params[in] MAC UE Configuration
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t modifyUeCb(uint8_t cellIdx, MacUeCb *ueCb, MacUeCfg *ueCfg)
+{
+ uint8_t ret = ROK;
+
+ if((ueCb->ueIdx == ueCfg->ueIdx) && (ueCb->crnti == ueCfg->crnti)\
+ &&(ueCb->state == UE_STATE_ACTIVE))
+ {
+ DU_LOG("\n MAC : Reconfig Req received for CRNTI %d ", ueCfg->crnti);
+ ret = fillMacUeCb(ueCb, ueCfg, cellIdx);
+ if(ret != ROK)
+ {
+ DU_LOG("\nMAC : Failed to modify Ue Cb at modifyUeCb()");
+ return ret;
+ }
+ else
+ {
+ deleteMacRaCb(cellIdx, ueCb);
+ return ROK;
+ }
+ }
+ return RFAILED;
+}
+
+
+/*******************************************************************
+ *
+ * @brief Creates UE Cb and fills ueCfg
+ *
+ * @details
+ *
+ * Function : procMacUeCfgData
+ *
* Functionality: Creates UE Cb and fills ueCfg
*
* @params[in] MAC UE Configuration
* RFAILED - failure
*
* ****************************************************************/
-uint8_t createUeCb(MacUeCfg *ueCfg)
+
+uint8_t procMacUeCfgData(Pst *pst, MacUeCfg *ueCfg)
{
- uint16_t ueIdx, lcIdx, cellIdx;
- MacUeCb *ueCb;
+ uint8_t ret = ROK;
+ uint16_t cellIdx;
+ MacUeCb *ueCb = NULLP;
+
GET_CELL_IDX(ueCfg->cellId, cellIdx);
/* Check if UE already configured */
ueCb = &macCb.macCell[cellIdx]->ueCb[ueCfg->ueIdx -1];
- if(ueCb)
+ switch(pst->event)
{
- if((ueCb->ueIdx == ueCfg->ueIdx) && (ueCb->crnti == ueCfg->crnti) &&\
- (ueCb->state == UE_STATE_ACTIVE))
- {
- DU_LOG("\n MAC : CRNTI %d already configured ", ueCfg->crnti);
- return ROKDUP;
- }
- }
-
- /* Fill received Ue Configuration in UeCb */
- memset(ueCb, 0, sizeof(MacUeCb));
-
- ueCb->crnti = ueCfg->crnti;
- ueCb->cellCb = macCb.macCell[cellIdx];
- ueCb->dlInfo.dlHarqEnt.numHarqProcs = \
- ueCfg->spCellCfg.servCellCfg.pdschServCellCfg.numHarqProcForPdsch;
- ueCb->state = UE_STATE_ACTIVE;
-
- /* Fill BSR info */
- switch(ueCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer)
- {
- case 0:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_1MS;
- break;
- case 1:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_5MS;
- break;
- case 2:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_10MS;
- break;
- case 3:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_16MS;
- break;
- case 4:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_20MS;
- break;
- case 5:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_32MS;
- break;
- case 6:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_40MS;
- break;
- case 7:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_60MS;
- break;
- case 8:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_80MS;
- break;
- case 9:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_128MS;
- break;
- case 10:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_160MS;
- break;
- case 11:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_320MS;
- break;
- case 12:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_640MS;
- break;
- case 13:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_1280MS;
- break;
- case 14:
- ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_2560MS;
- break;
- default:
- DU_LOG("\nMAC : Invalid BSR Periodic Timer");
- return RFAILED;
- }
-
- switch(ueCfg->macCellGrpCfg.bsrTmrCfg.retxTimer)
- {
- case 0:
- ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_10MS;
- break;
- case 1:
- ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_20MS;
+ case EVENT_UE_CREATE_RSP_TO_MAC:
+ ret = createUeCb(cellIdx, ueCb, ueCfg);
break;
- case 2:
- ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_40MS;
- break;
- case 3:
- ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_80MS;
- break;
- case 4:
- ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_160MS;
- break;
- case 5:
- ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_320MS;
- break;
- case 6:
- ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_640MS;
- break;
- case 7:
- ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_1280MS;
- break;
- case 8:
- ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_2560MS;
- break;
- case 9:
- ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_5120MS;
- break;
- case 10:
- ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_10240MS;
+ case EVENT_UE_RECONFIG_RSP_TO_MAC:
+ ret = modifyUeCb(cellIdx, ueCb, ueCfg);
break;
default:
- DU_LOG("\nMAC : Invalid BSR retransmission timer");
break;
}
- switch(ueCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer)
- {
- case 0:
- ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_20MS;
- break;
- case 1:
- ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_40MS;
- break;
- case 2:
- ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_64MS;
- break;
- case 3:
- ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_128MS;
- break;
- case 4:
- ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_512MS;
- break;
- case 5:
- ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_1024MS;
- break;
- case 6:
- ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_2560MS;
- break;
- default:
- DU_LOG("\nMAC : Invalid SR delay timer");
- return RFAILED;
- }
+ return ret;
+}
- /* Fill SRB1 info */
- if(ueCfg->numLcs > MAX_NUM_LC)
- {
- DU_LOG("\nMAC : Number of LC to configure[%d] exceeds limit[%d]",\
- ueCfg->numLcs, MAX_NUM_LC);
- return RFAILED;
- }
+/*******************************************************************
+ *
+ * @brief Function to store the UeCfg Data
+ *
+ * @details
+ *
+ * Function : copyToTmpData
+ *
+ * Functionality: Function to store the UeCfg Data
+ *
+ * @params[in] MacUeCfg pointer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
- 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 = MAC_LC_STATE_ACTIVE;
- ueCb->dlInfo.numDlLc++;
- }
+uint8_t copyToTmpData(MacUeCfg *ueCfg)
+{
+ uint8_t cellIdx;
+ MacUeCfg *tmpData = NULLP;
- /* Copy RA Cb */
- for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+ MAC_ALLOC(tmpData, sizeof(MacUeCfg));
+ if(!tmpData)
{
- if(macCb.macCell[cellIdx]->macRaCb[ueIdx].crnti == ueCb->crnti)
- {
- ueCb->raCb = &macCb.macCell[cellIdx]->macRaCb[ueIdx];
- break;
- }
+ DU_LOG("\nMAC: Memory Alloc Failed at copyToTmpData()");
+ return RFAILED;
}
-
- macCb.macCell[cellIdx]->numActvUe++;
-
+ memcpy(tmpData, ueCfg, sizeof(MacUeCfg));
+ GET_CELL_IDX(ueCfg->cellId, cellIdx);
+ macCb.macCell[cellIdx]->ueCfgTmpData[ueCfg->ueIdx-1] = tmpData;
return ROK;
}
* ****************************************************************/
uint8_t MacProcUeCreateReq(Pst *pst, MacUeCfg *ueCfg)
{
- uint8_t ret;
+ uint8_t ret = ROK;
+ SchUeCfg schUeCfg;
+ memset(&schUeCfg, 0, sizeof(SchUeCfg));
DU_LOG("\nMAC : UE Create Request for CRNTI[%d]", ueCfg->crnti);
if(ueCfg)
{
- ret = createUeCb(ueCfg);
+ /*Storing received ueCfg in ueCfgTmpData */
+ ret = copyToTmpData(ueCfg);
if(ret == ROK)
{
- ret = sendAddUeCreateReqToSch(ueCfg);
+ /*Sending Cfg Req to SCH */
+ ret = fillSchUeCfg(pst, &schUeCfg, ueCfg);
if(ret != ROK)
+ DU_LOG("\nMAC : Failed to fill Sch Ue Cfg at MacProcUeCreateReq()");
+ else
{
- DU_LOG("\nMAC : Failed to send UE Create request to scheduler");
+ /* Fill event and send UE create request to SCH */
+ ret = sendUeReqToSch(pst, &schUeCfg);
+ if(ret != ROK)
+ DU_LOG("\nMAC : Failed to send UE Create request to SCH");
}
}
else
{
- DU_LOG("\nMAC : Failed to create MAC UE Cb ");
+ DU_LOG("\nMAC : Failed to store MAC UE CFG ");
}
}
else
/* Fill Post structure and send UE Create response*/
memset(&rspPst, 0, sizeof(Pst));
- FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_UE_CONFIG_RSP);
+ FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_UE_CREATE_RSP);
return MacDuUeCfgRspOpts[rspPst.selector](&rspPst, cfgRsp);
}
+/*******************************************************************
+ *
+ * @brief Fill and Send UE Reconfig response from MAC to DU APP
+ *
+ * @details
+ *
+ * Function : MacSendUeReconfigRsp
+ *
+ * Functionality: Fill and Send UE Reconfig response from MAC to DUAPP
+ *
+ * @params[in] MAC UE create result
+ * SCH UE create response
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t MacSendUeReconfigRsp(MacRsp result, SchUeCfgRsp *schCfgRsp)
+{
+ MacUeCfgRsp *cfgRsp;
+ Pst rspPst;
+
+ MAC_ALLOC_SHRABL_BUF(cfgRsp, sizeof(MacUeCfgRsp));
+ if(!cfgRsp)
+ {
+ DU_LOG("\nMAC: Memory allocation for UE Reconfig response failed");
+ return RFAILED;
+ }
+
+ /* Filling UE Config response */
+ memset(cfgRsp, 0, sizeof(MacUeCfgRsp));
+ cfgRsp->cellId = schCfgRsp->cellId;
+ cfgRsp->ueIdx = schCfgRsp->ueIdx;
+ cfgRsp->result = result;
+
+ /* Fill Post structure and send UE Create response*/
+ memset(&rspPst, 0, sizeof(Pst));
+ FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_UE_RECONFIG_RSP);
+ return MacDuUeCfgRspOpts[rspPst.selector](&rspPst, cfgRsp);
+}
+
+/*******************************************************************
+ *
+ * @brief Function to return Mac Ue Cfg pointer
+ *
+ * @details
+ *
+ * Function : getMacUeCfg
+ *
+ * Functionality:
+ * Function to return Mac Ue Cfg pointer
+ *
+ * @params[in] cellIdx, ueIdx
+ *
+ * @return MacUeCfg pointer - success
+ * NULLP - failure
+ *
+ * ****************************************************************/
+
+MacUeCfg *getMacUeCfg(uint16_t cellIdx, uint8_t ueIdx)
+{
+ MacUeCfg *ueCfg = NULLP;
+ if(macCb.macCell[cellIdx])
+ {
+ ueCfg = macCb.macCell[cellIdx]->ueCfgTmpData[ueIdx-1];
+ }
+ else
+ {
+ DU_LOG("\nMAC: Failed to get macCellCb in getMacUeCfg()");
+ }
+ return ueCfg;
+}
/*******************************************************************
*
uint8_t result = MAC_DU_APP_RSP_NOK;
uint8_t ret = ROK;
uint16_t cellIdx;
+ MacUeCfg *ueCfg = NULLP;
GET_CELL_IDX(schCfgRsp->cellId, cellIdx);
+ ueCfg = getMacUeCfg(cellIdx, schCfgRsp->ueIdx);
- if(schCfgRsp->rsp == RSP_NOK)
+ if(ueCfg)
+ {
+ if(schCfgRsp->rsp == RSP_NOK)
+ {
+ DU_LOG("\nMAC : SCH UE Config Response : FAILURE [CRNTI %d] for event %d", schCfgRsp->crnti, pst->event);
+ }
+ else
+ {
+ DU_LOG("\nMAC : SCH UE Config Response : SUCCESS [CRNTI %d]", schCfgRsp->crnti);
+ ret = procMacUeCfgData(pst, ueCfg);
+ if(ret == ROK)
+ {
+ result = MAC_DU_APP_RSP_OK;
+ }
+ }
+ MAC_FREE(ueCfg, sizeof(MacUeCfg));
+ ueCfg = NULLP;
+ }
+ if(pst->event == EVENT_UE_CREATE_RSP_TO_MAC)
{
- DU_LOG("\nMAC : SCH UE Create Response : FAILURE [CRNTI %d]", schCfgRsp->crnti);
- memset(&macCb.macCell[cellIdx]->ueCb[schCfgRsp->ueIdx -1], 0, sizeof(MacUeCb));
- macCb.macCell[cellIdx]->numActvUe--;
- result = MAC_DU_APP_RSP_NOK;
+ ret = MacSendUeCreateRsp(result, schCfgRsp);
}
- else
+ if(pst->event == EVENT_UE_RECONFIG_RSP_TO_MAC)
{
- DU_LOG("\nMAC : SCH UE Create Response : SUCCESS [CRNTI %d]", schCfgRsp->crnti);
- result = MAC_DU_APP_RSP_OK;
+ ret = MacSendUeReconfigRsp(result, schCfgRsp);
}
- ret = MacSendUeCreateRsp(result, schCfgRsp);
+
return ret;
}
* ****************************************************************/
uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg)
{
- //TODO:
+ uint8_t ret = ROK;
+ SchUeCfg schUeCfg;
+ memset(&schUeCfg, 0, sizeof(SchUeCfg));
+
+ DU_LOG("\nMAC : UE Reconfig Request for CRNTI[%d]", ueCfg->crnti);
+
+ if(ueCfg)
+ {
+ /*Storing received ueCfg in ueCfgTmpData */
+ ret = copyToTmpData(ueCfg);
+ if(ret == ROK)
+ {
+ /*Sending Cfg Req to SCH */
+ ret = fillSchUeCfg(pst, &schUeCfg, ueCfg);
+ if(ret != ROK)
+ DU_LOG("\nMAC : Failed to fill sch Ue Cfg at MacProcUeReconfigReq()");
+ else
+ {
+ /* Fill event and send UE create request to SCH */
+ ret = sendUeReqToSch(pst, &schUeCfg);
+ if(ret != ROK)
+ DU_LOG("\nMAC : Failed to send UE Reconfig Request to SCH");
+ }
+ }
+ else
+ {
+ DU_LOG("\nMAC : Failed to store MAC UE Cb ");
+ }
+ }
+ else
+ {
+ DU_LOG("\nMAC : MAC UE Create request processing failed");
+ ret = RFAILED;
+ }
+ /* FREE shared memory */
+ MAC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(MacUeCfg));
return ROK;
}
unpackDuMacCellCfg(MacProcCellCfgReq, pst, mBuf);
break;
case EVENT_MAC_CELL_START_REQ:
- /* Process MAC cell start request */
- unpackMacCellStartReq(MacProcCellStartReq, pst, mBuf);
- break;
- case EVENT_MAC_CELL_STOP_REQ:
- /* Process MAC cell stop request */
- unpackMacCellStopReq(MacProcCellStopReq, pst, mBuf);
- break;
- case EVENT_MAC_DL_CCCH_IND:
- /* Process DL CCCH Ind */
- unpackMacDlCcchInd(MacProcDlCcchInd, pst, mBuf);
- break;
- case EVENT_MAC_UE_CONFIG_REQ:
- /* Process Ue Create Request */
- unpackMacUeCreateReq(MacProcUeCreateReq, pst, mBuf);
- break;
- case EVENT_MAC_UE_RECONFIG_REQ:
- /* Process Ue Reconfig Request */
- unpackMacUeReconfigReq(MacProcUeReconfigReq, pst, mBuf);
- break;
+ /* Process MAC cell start request */
+ unpackMacCellStartReq(MacProcCellStartReq, pst, mBuf);
+ break;
+ case EVENT_MAC_CELL_STOP_REQ:
+ /* Process MAC cell stop request */
+ unpackMacCellStopReq(MacProcCellStopReq, pst, mBuf);
+ break;
+ case EVENT_MAC_DL_CCCH_IND:
+ /* Process DL CCCH Ind */
+ unpackMacDlCcchInd(MacProcDlCcchInd, pst, mBuf);
+ break;
+ case EVENT_MAC_UE_CREATE_REQ:
+ /* Process Ue Create Request */
+ unpackMacUeCreateReq(MacProcUeCreateReq, pst, mBuf);
+ break;
+ case EVENT_MAC_UE_RECONFIG_REQ:
+ /* Process Ue Reconfig Request */
+ unpackMacUeReconfigReq(MacProcUeReconfigReq, pst, mBuf);
+ break;
default:
RG_FREE_MSG(mBuf);
break;
}
#endif /* ERRCLASS & ERRCLS_ADD_RES */
rlcHdlCrlcUlCfgReq(tRlcCb,cfgTmpData, cfmInfo, cfgCfm);
- if(tRlcCb->u.ulCb->rlcUlUdxEventType == EVENT_RLC_UE_CONFIG_REQ)
+ if(tRlcCb->u.ulCb->rlcUlUdxEventType == EVENT_RLC_UE_CREATE_REQ)
{
- FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_CONFIG_RSP);
+ FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_CREATE_RSP);
}
else if(tRlcCb->u.ulCb->rlcUlUdxEventType == EVENT_RLC_UE_RECONFIG_REQ)
{
break;
}
- case EVENT_RLC_UE_CONFIG_REQ: /* UE Create Request */
+ case EVENT_RLC_UE_CREATE_REQ: /* UE Create Request */
{
ret = unpackRlcUeCreateReq(RlcProcUeCreateReq, pst, mBuf);
break;
}
- case EVENT_RLC_UE_RECONFIG_REQ: /* UE Reconfig Request */
+ case EVENT_RLC_UE_RECONFIG_REQ: /* UE Reconfig Request */
{
ret = unpackRlcUeReconfigReq(RlcProcUeReconfigReq, pst, mBuf);
break;
(lcId >= MIN_DRB_LCID && lcId <= MAX_DRB_LCID))
{
SET_ONE_BIT(ueIdx, cell->boIndBitMap);
- ueCb->dlLcCtxt[lcId].bo = dlBoInfo->dataVolume;
+ ueCb->dlInfo.dlLcCtxt[lcId].bo = dlBoInfo->dataVolume;
}
else if(lcId != SRB0_LCID)
{
typedef struct schLcCtxt
{
+ uint8_t lcId; // logical Channel ID
uint8_t lcp; // logical Channel Prioritization
SchLcState lcState;
uint16_t bo;
}SchDlLcCtxt;
+typedef struct schDlCb
+{
+ uint8_t numDlLc;
+ SchDlLcCtxt dlLcCtxt[MAX_NUM_LC];
+}SchDlCb;
+
typedef struct schUlLcCtxt
{
- SchLcState lcState;
+ SchLcState lcState;
+ uint8_t lcId;
uint8_t priority;
uint8_t lcGroup;
uint8_t schReqId;
uint8_t bsd; // bucketSizeDuration
}SchUlLcCtxt;
+typedef struct schUlCb
+{
+ uint8_t numUlLc;
+ SchUlLcCtxt ulLcCtxt[MAX_NUM_LC];
+}SchUlCb;
+
/**
* @brief
* UE control block
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];
+ SchUlCb ulInfo;
+ SchDlCb dlInfo;
}SchUeCb;
/**
dlMsgAlloc->numLc = 0;
for(lcIdx = 0; lcIdx < MAX_NUM_LC; lcIdx++)
{
- if(ueCb->dlLcCtxt[lcIdx].bo)
+ if(ueCb->dlInfo.dlLcCtxt[lcIdx].bo)
{
dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc].lcId = lcIdx;
/* calculation for BO includse RLC and MAC header size */
dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc].schBytes = \
- ueCb->dlLcCtxt[lcIdx].bo + RLC_HDR_SIZE + MAC_HDR_SIZE;
+ ueCb->dlInfo.dlLcCtxt[lcIdx].bo + RLC_HDR_SIZE + MAC_HDR_SIZE;
accumalatedSize += dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc].schBytes;
dlMsgAlloc->numLc++;
}
- ueCb->dlLcCtxt[lcIdx].bo = 0;
+ ueCb->dlInfo.dlLcCtxt[lcIdx].bo = 0;
}
/* pdcch and pdsch data is filled */
* RFAILED - failure
*
* ****************************************************************/
-void SchSendUeCfgRspToMac(SchUeCfg *ueCfg, Inst inst,\
+void SchSendUeCfgRspToMac(uint16_t event, SchUeCfg *ueCfg, Inst inst,\
SchMacRsp result, SchUeCfgRsp *cfgRsp)
{
Pst rspPst;
/* Filling response post */
memset(&rspPst, 0, sizeof(Pst));
FILL_PST_SCH_TO_MAC(rspPst, inst);
- rspPst.event = EVENT_UE_CONFIG_RSP_TO_MAC;
-
+ if(event == EVENT_UE_CREATE_REQ_TO_SCH)
+ {
+ rspPst.event = EVENT_UE_CREATE_RSP_TO_MAC;
+ }
+ else if(event == EVENT_UE_RECONFIG_REQ_TO_SCH)
+ {
+ rspPst.event = EVENT_UE_RECONFIG_RSP_TO_MAC;
+ }
SchUeCfgRspOpts[rspPst.selector](&rspPst, cfgRsp);
}
/*******************************************************************
*
- * @brief Hanles Ue create request from MAC
+ * @brief Function to fill Dl Lc Context in SCH Ue Cb
*
* @details
*
- * Function : MacSchUeCreateReq
+ * Function : fillSchDlLcCtxt
*
- * Functionality: Hanles Ue create request from MAC
+ * Functionality: Function to fill Dl Lc Context in SCH Ue Cb
*
- * @params[in]
- * @return ROK - success
- * RFAILED - failure
+ * @params[in] SchDlLcCtxt pointer,
+ * SchLcCfg pointer
+ * @return void
*
* ****************************************************************/
-uint8_t MacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfg)
+
+void fillSchDlLcCtxt(SchDlLcCtxt *ueCbLcCfg, SchLcCfg *lcCfg)
{
- uint8_t idx;
- uint8_t lcId;
- uint8_t lcIdx;
- uint16_t ueIdx;
- SchCellCb *cellCb;
- SchUeCb *ueCb;
- SchUeCfgRsp cfgRsp;
- Inst inst = pst->dstInst - 1;
+ ueCbLcCfg->lcId = lcCfg->lcId;
+ ueCbLcCfg->lcp = lcCfg->dlLcCfg.lcp;
+ ueCbLcCfg->lcState = SCH_LC_STATE_ACTIVE;
+ ueCbLcCfg->bo = 0;
+}
- DU_LOG("\nSCH : UE Create Request for CRNTI[%d]", ueCfg->crnti);
+/*******************************************************************
+ *
+ * @brief Function to fill Ul Lc Context in SCH Ue Cb
+ *
+ * @details
+ *
+ * Function : fillSchUlLcCtxt
+ *
+ * Functionality: Function to fill Ul Lc Context in SCH Ue Cb
+ *
+ * @params[in] SchUlLcCtxt pointer,
+ * SchLcCfg pointer
+ * @return void
+ *
+ * ****************************************************************/
- memset(&cfgRsp, 0, sizeof(SchUeCfgRsp));
+void fillSchUlLcCtxt(SchUlLcCtxt *ueCbLcCfg, SchLcCfg *lcCfg)
+{
+ ueCbLcCfg->lcId = lcCfg->lcId;
+ ueCbLcCfg->lcState = SCH_LC_STATE_ACTIVE;
+ ueCbLcCfg->priority = lcCfg->ulLcCfg.priority;
+ ueCbLcCfg->lcGroup = lcCfg->ulLcCfg.lcGroup;
+ ueCbLcCfg->schReqId = lcCfg->ulLcCfg.schReqId;
+ ueCbLcCfg->pbr = lcCfg->ulLcCfg.pbr;
+ ueCbLcCfg->bsd = lcCfg->ulLcCfg.bsd;
- if(!ueCfg)
+}
+
+/*******************************************************************
+ *
+ * @brief Function to update Sch Ul Lc Cb
+ *
+ * @details
+ *
+ * Function : updateSchUlCb
+ *
+ * Functionality: Function to update SCH Ul Lc Cb
+ *
+ * @returns void
+ *
+ * ****************************************************************/
+
+void updateSchUlCb(uint8_t delIdx, SchUlCb *ulInfo)
+{
+ uint8_t lcIdx = 0;
+
+ for(lcIdx = delIdx; lcIdx < ulInfo->numUlLc; lcIdx++)
{
- DU_LOG("\nSCH : UE create request failed");
- return RFAILED;
+ memcpy(&ulInfo->ulLcCtxt[lcIdx], &ulInfo->ulLcCtxt[lcIdx+1], sizeof(SchUlLcCtxt));
+ memset(&ulInfo->ulLcCtxt[lcIdx+1], 0, sizeof(SchUlLcCtxt));
}
+}
+
+/*******************************************************************
+ *
+ * @brief Function to update SCH Dl Lc Cb
+ *
+ * @details
+ *
+ * Function : updateSchDlCb
+ *
+ * Functionality: Function to update SCH DL Lc Cb
+ *
+ * @returns void
+ *
+ * ****************************************************************/
+
+void updateSchDlCb(uint8_t delIdx, SchDlCb *dlInfo)
+{
+ uint8_t lcIdx = 0;
+
+ for(lcIdx = delIdx; lcIdx < dlInfo->numDlLc; lcIdx++)
+ {
+ memcpy(&dlInfo->dlLcCtxt[lcIdx], &dlInfo->dlLcCtxt[lcIdx+1], sizeof(SchDlLcCtxt));
+ memset(&dlInfo->dlLcCtxt[lcIdx+1], 0, sizeof(SchDlLcCtxt));
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to fill SchUeCb
+ *
+ * @details
+ *
+ * Function : fillSchUeCb
+ *
+ * Functionality: Function to fill SchUeCb
+ *
+ * @params[in] SchUeCb pointer,
+ * SchUeCfg pointer
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+
+uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg)
+{
+ uint8_t lcIdx, ueLcIdx;
+
+ memset(&ueCb->ueCfg, 0, sizeof(SchUeCfg));
+ memcpy(&ueCb->ueCfg, ueCfg, sizeof(SchUeCfg));
+ ueCb->state = SCH_UE_STATE_ACTIVE;
+
+ for(lcIdx = 0; lcIdx < ueCfg->numLcs; lcIdx++)
+ {
+ if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_ADD)
+ {
+ fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueCb->ulInfo.numUlLc], &ueCfg->schLcCfg[lcIdx]);
+ ueCb->ulInfo.numUlLc++;
+ fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueCb->dlInfo.numDlLc], &ueCfg->schLcCfg[lcIdx]);
+ ueCb->dlInfo.numDlLc++;
+ }
+ else
+ {
+ for(ueLcIdx = 0; ueLcIdx < ueCb->ulInfo.numUlLc; ueLcIdx++) //searching for Lc to be Mod
+ {
+ if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].lcId == ueCfg->schLcCfg[lcIdx].lcId)
+ {
+ if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_MOD)
+ {
+ fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]);
+ fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]);
+ break;
+ }
+ if(ueCfg->schLcCfg[ueLcIdx].configType == CONFIG_DEL)
+ {
+ memset(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], 0, sizeof(SchUlLcCtxt));
+ ueCb->ulInfo.numUlLc--;
+ updateSchUlCb(ueLcIdx, &ueCb->ulInfo); //moving arr elements one idx ahead
+ memset(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], 0, sizeof(SchDlLcCtxt));
+ ueCb->dlInfo.numDlLc--;
+ updateSchDlCb(ueLcIdx, &ueCb->dlInfo); //moving arr elements one idx ahead
+ break;
+ }
+ }
+ }/*End of inner for loop */
+ }
+ }/* End of outer for loop */
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Function to get SCH Cell Cb
+ *
+ * @details
+ *
+ * Function : getSchCellCb
+ *
+ * Functionality: Function to get SCH Cell Cb
+ *
+ * @params[in] event, SchUeCfg pointer
+ * @return schUeCb pointer - success
+ * NULLP - failure
+ *
+ * ****************************************************************/
+
+SchCellCb *getSchCellCb(uint16_t srcEvent, Inst inst, SchUeCfg *ueCfg)
+{
+ uint8_t idx;
+ SchCellCb *cellCb = NULLP;
+ SchUeCfgRsp cfgRsp;
+ memset(&cfgRsp, 0, sizeof(SchUeCfgRsp));
/* Search of cell cb */
for(idx = 0; idx < MAX_NUM_CELL; idx++)
if(idx == MAX_NUM_CELL)
{
DU_LOG("\nSCH : Ue create request failed. Invalid cell id %d", ueCfg->cellId);
- SchSendUeCfgRspToMac(ueCfg, inst, RSP_NOK, &cfgRsp);
- return ROK;
+ SchSendUeCfgRspToMac(srcEvent, ueCfg, inst, RSP_NOK, &cfgRsp);
+ return NULLP;
}
/* Check if max number of UE configured */
if(cellCb->numActvUe > MAX_NUM_UE)
{
DU_LOG("SCH : Max number of UE [%d] already configured", MAX_NUM_UE);
- SchSendUeCfgRspToMac(ueCfg, inst, RSP_NOK, &cfgRsp);
- return ROK;
+ SchSendUeCfgRspToMac(srcEvent, ueCfg, inst, RSP_NOK, &cfgRsp);
+ return NULLP;
}
+ return cellCb;
+}
+
+
+/*******************************************************************
+ *
+ * @brief Hanles Ue create request from MAC
+ *
+ * @details
+ *
+ * Function : MacSchUeCreateReq
+ *
+ * Functionality: Hanles Ue create request from MAC
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t MacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfg)
+{
+ uint8_t ueIdx, lcIdx, ret = ROK;
+ SchCellCb *cellCb = NULLP;
+ SchUeCb *ueCb = NULLP;
+ SchUeCfgRsp cfgRsp;
+ Inst inst = pst->dstInst - 1;
+ memset(&cfgRsp, 0, sizeof(SchUeCfgRsp));
+
+ if(!ueCfg)
+ {
+ DU_LOG("\nSCH : UE create request failed at MacSchUeCreateReq()");
+ return RFAILED;
+ }
+ DU_LOG("\nSCH : UE Create Request for CRNTI[%d]", ueCfg->crnti);
+ cellCb = getSchCellCb(pst->event, inst, ueCfg);
/* Search if UE already configured */
GET_UE_IDX(ueCfg->crnti, ueIdx);
if((ueCb->crnti == ueCfg->crnti) && (ueCb->state == SCH_UE_STATE_ACTIVE))
{
DU_LOG("\n SCH : CRNTI %d already configured ", ueCfg->crnti);
- SchSendUeCfgRspToMac(ueCfg, inst, RSP_OK, &cfgRsp);
+ SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_OK, &cfgRsp);
return ROK;
}
}
+ else
+ {
+ DU_LOG("\n SCH : SchUeCb not found at MacSchUeCreateReq() ");
+ SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_NOK, &cfgRsp);
+ return RFAILED;
+ }
/* Fill received Ue Configuration in UeCb */
memset(ueCb, 0, sizeof(SchUeCb));
+ GET_UE_IDX(ueCfg->crnti, 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++)
+ ret = fillSchUeCb(ueCb, ueCfg);
+ if(ret == ROK)
{
- 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++;
+ cellCb->numActvUe++;
+ SET_ONE_BIT(ueCb->ueIdx, cellCb->actvUeBitMap);
+ ueCb->cellCb = cellCb;
+ ueCb->srRcvd = false;
+ for(lcIdx=0; lcIdx<MAX_NUM_LOGICAL_CHANNEL_GROUPS; lcIdx++)
+ ueCb->bsrInfo[lcIdx].dataVol = 0;
+
+ SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_OK, &cfgRsp);
}
-
- cellCb->numActvUe++;
- SET_ONE_BIT(ueCb->ueIdx, cellCb->actvUeBitMap);
-
- ueCb->cellCb = cellCb;
- ueCb->srRcvd = false;
- for(idx=0; idx<MAX_NUM_LOGICAL_CHANNEL_GROUPS; idx++)
- ueCb->bsrInfo[idx].dataVol = 0;
-
- SchSendUeCfgRspToMac(ueCfg, inst, RSP_OK, &cfgRsp);
- return ROK;
+ return ret;
}
/*******************************************************************
return ROK;
}
-
/*******************************************************************
*
* @brief Hanles Ue Reconfig request from MAC
* ****************************************************************/
uint8_t MacSchUeReconfigReq(Pst *pst, SchUeCfg *ueCfg)
{
- //TODO:
- return ROK;
+ uint8_t ueIdx, lcIdx, ret = ROK;
+ SchCellCb *cellCb = NULLP;
+ SchUeCb *ueCb = NULLP;
+ SchUeCfgRsp cfgRsp;
+ Inst inst = pst->dstInst - 1;
+ memset(&cfgRsp, 0, sizeof(SchUeCfgRsp));
+
+ if(!ueCfg)
+ {
+ DU_LOG("\nSCH : Reconfig request failed at MacSchUeReconfigReq()");
+ return RFAILED;
+ }
+ DU_LOG("\nSCH : Reconfig Request for CRNTI[%d]", ueCfg->crnti);
+ cellCb = getSchCellCb(pst->event, inst, ueCfg);
+
+ /* Search if UE already configured */
+ GET_UE_IDX(ueCfg->crnti, ueIdx);
+ ueCb = &cellCb->ueCb[ueIdx -1];
+
+ if(!ueCb)
+ {
+ DU_LOG("\n SCH : SchUeCb not found at MacSchUeReconfigReq() ");
+ SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_NOK, &cfgRsp);
+ return RFAILED;
+ }
+ if((ueCb->crnti == ueCfg->crnti) && (ueCb->state == SCH_UE_STATE_ACTIVE))
+ {
+ /* Found the UeCb to Reconfig */
+ ret = fillSchUeCb(ueCb, ueCfg);
+ if(ret == ROK)
+ {
+ ueCb->cellCb = cellCb;
+ ueCb->srRcvd = false;
+ for(lcIdx=0; lcIdx<MAX_NUM_LOGICAL_CHANNEL_GROUPS; lcIdx++)
+ ueCb->bsrInfo[lcIdx].dataVol = 0;
+
+ SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_OK, &cfgRsp);
+ }
+ }
+ return ret;
}
+
/**********************************************************************
End of file
**********************************************************************/
typedef enum
{
UE_CFG_INACTIVE,
- UE_CONFIG_COMPLETE,
+ UE_CREATE_COMPLETE,
UE_RECFG_COMPLETE
}UeCfgState;
{
if(pst->selector == ODU_SELECTOR_LWLC)
{
- MacUeCfgRsp *cfgRsp;
+ MacUeCfgRsp *cfgRsp = NULLP;
/* unpack the address of the structure */
CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf);
#define EVENT_MAC_STOP_IND 205
#define EVENT_MAC_UL_CCCH_IND 206
#define EVENT_MAC_DL_CCCH_IND 207
-#define EVENT_MAC_UE_CONFIG_REQ 208
-#define EVENT_MAC_UE_CONFIG_RSP 209
+#define EVENT_MAC_UE_CREATE_REQ 208
+#define EVENT_MAC_UE_CREATE_RSP 209
#define EVENT_MAC_UE_RECONFIG_REQ 210
#define EVENT_MAC_UE_RECONFIG_RSP 211
+#define BSR_PERIODIC_TIMER_SF_10 10
+#define BSR_RETX_TIMER_SF_320 320
+#define BSR_SR_DELAY_TMR_2560 2560
+
typedef enum
{
MAC_DU_APP_RSP_NOK,
TIME_ALIGNMENT_TIMER_INFINITY
}TimeAlignmentTimer;
-typedef enum
-{
- BSR_PERIODIC_TIMER_SF_1,
- BSR_PERIODIC_TIMER_SF_5,
- BSR_PERIODIC_TIMER_SF_10,
- BSR_PERIODIC_TIMER_SF_16,
- BSR_PERIODIC_TIMER_SF_20,
- BSR_PERIODIC_TIMER_SF_32,
- BSR_PERIODIC_TIMER_SF_40,
- BSR_PERIODIC_TIMER_SF_64,
- BSR_PERIODIC_TIMER_SF_80,
- BSR_PERIODIC_TIMER_SF_128,
- BSR_PERIODIC_TIMER_SF_160,
- BSR_PERIODIC_TIMER_SF_320,
- BSR_PERIODIC_TIMER_SF_640,
- BSR_PERIODIC_TIMER_SF_1280,
- BSR_PERIODIC_TIMER_SF_2560,
- BSR_PERIODIC_TIMER_INFINITY
-}BsrPeriodicTimer;
-
-typedef enum
-{
- BSR_RETX_TIMER_SF_10,
- BSR_RETX_TIMER_SF_20,
- BSR_RETX_TIMER_SF_40,
- BSR_RETX_TIMER_SF_80,
- BSR_RETX_TIMER_SF_160,
- BSR_RETX_TIMER_SF_320,
- BSR_RETX_TIMER_SF_640,
- BSR_RETX_TIMER_SF_1280,
- BSR_RETX_TIMER_SF_2560,
- BSR_RETX_TIMER_SF_5120,
- BSR_RETX_TIMER_SF_10240,
- BSR_RETX_TIMER_SPARE_5,
- BSR_RETX_TIMER_SPARE_4,
- BSR_RETX_TIMER_SPARE_3,
- BSR_RETX_TIMER_SPARE_2,
- BSR_RETX_TIMER_SPARE_1
-}BsrReTxTimer;
-
-typedef enum
-{
- BSR_SR_DELAY_TMR_20,
- BSR_SR_DELAY_TMR_40,
- BSR_SR_DELAY_TMR_64,
- BSR_SR_DELAY_TMR_128,
- BSR_SR_DELAY_TMR_512,
- BSR_SR_DELAY_TMR_1024,
- BSR_SR_DELAY_TMR_2560,
- BSR_SR_DELAY_TMR_SPARE_1
-}BsrSrDelayTimer;
typedef enum
{
PHR_PERIODIC_TIMER_SF_10,
typedef struct bsrTmrCfg
{
- BsrPeriodicTimer periodicTimer;
- BsrReTxTimer retxTimer;
- BsrSrDelayTimer srDelayTimer;
+ uint16_t periodicTimer;
+ uint16_t retxTimer;
+ uint16_t srDelayTimer;
}BsrTmrCfg;
{
if(pst->selector == ODU_SELECTOR_LWLC)
{
- RlcUeCfgRsp *cfgRsp;
+ RlcUeCfgRsp *cfgRsp = NULLP;
/* unpack the address of the structure */
CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf);
ODU_PUT_MSG_BUF(mBuf);
#define __RLC_INF_H__
/* Events */
-#define EVENT_RLC_UE_CONFIG_REQ 210
-#define EVENT_RLC_UE_CONFIG_RSP 211 /*!< Config Confirm */
+#define EVENT_RLC_UE_CREATE_REQ 210
+#define EVENT_RLC_UE_CREATE_RSP 211 /*!< Config Confirm */
#define EVENT_UL_RRC_MSG_TRANS_TO_DU 212
#define EVENT_DL_RRC_MSG_TRANS_TO_RLC 213
#define EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU 214
#define EVENT_RACH_IND_TO_SCH 5
#define EVENT_CRC_IND_TO_SCH 6
#define EVENT_DL_RLC_BO_INFO_TO_SCH 7
-#define EVENT_UE_CONFIG_REQ_TO_SCH 8
-#define EVENT_UE_CONFIG_RSP_TO_MAC 9
+#define EVENT_UE_CREATE_REQ_TO_SCH 8
+#define EVENT_UE_CREATE_RSP_TO_MAC 9
#define EVENT_SLOT_IND_TO_SCH 10
#define EVENT_SHORT_BSR 11
#define EVENT_UCI_IND_TO_SCH 12
/* Logical Channel configuration */
typedef struct schLcCfg
{
+ ConfigType configType;
uint8_t lcId;
SchDrbQosInfo *drbQos;
SchSnssai *snssai;
SchPhyCellGrpCfg phyCellGrpCfg;
SchSpCellCfg spCellCfg;
SchAggrMaxBitRate *aggrMaxBitRate;
- uint8_t numLc;
- SchLcCfg lcCfgList[MAX_NUM_LC];
+ uint8_t numLcs;
+ SchLcCfg schLcCfg[MAX_NUM_LC];
}SchUeCfg;
typedef struct schUeCfgRsp
uint8_t MacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd);
uint8_t packMacSchUeReconfigReq(Pst *pst, SchUeCfg *ueCfgToSch);
uint8_t MacSchUeReconfigReq(Pst *pst, SchUeCfg *ueCfgToSch);
+uint8_t packSchUeReconfigRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
+uint8_t MacProcSchUeReconfigRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
/**********************************************************************
End of file
{
extractTagReconfig(macCellGroup->tag_Config, &macUeCfg->macCellGrpCfg.tagCfg);
}
+ if(macCellGroup->bsr_Config)
+ {
+ macUeCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer = macCellGroup->bsr_Config->periodicBSR_Timer;
+ macUeCfg->macCellGrpCfg.bsrTmrCfg.retxTimer = macCellGroup->bsr_Config->retxBSR_Timer;
+ if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer)
+ {
+ macUeCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer =\
+ *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer);
+ }
+ }
+ if(macCellGroup->phr_Config)
+ {
+ if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup)
+ {
+ macUeCfg->macCellGrpCfg.phrCfgSetupPres = true;
+ if(macCellGroup->phr_Config->choice.setup)
+ {
+ macUeCfg->macCellGrpCfg.phrCfg.periodicTimer = \
+ macCellGroup->phr_Config->choice.setup->phr_PeriodicTimer;
+ macUeCfg->macCellGrpCfg.phrCfg.prohibitTimer = \
+ macCellGroup->phr_Config->choice.setup->phr_ProhibitTimer;
+ macUeCfg->macCellGrpCfg.phrCfg.txPowerFactor = \
+ macCellGroup->phr_Config->choice.setup->phr_Tx_PowerFactorChange;
+ macUeCfg->macCellGrpCfg.phrCfg.multiplePHR = \
+ macCellGroup->phr_Config->choice.setup->multiplePHR;
+ macUeCfg->macCellGrpCfg.phrCfg.dummy = \
+ macCellGroup->phr_Config->choice.setup->dummy;
+ macUeCfg->macCellGrpCfg.phrCfg.phrType2OtherCell = \
+ macCellGroup->phr_Config->choice.setup->phr_Type2OtherCell;
+ macUeCfg->macCellGrpCfg.phrCfg.phrOtherCG = \
+ macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG;
+ }
+ }
+
+
+ }
}
/* Fill Physical Cell Group Reconfig */
if(cellGrp->physicalCellGroupConfig)
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildAndSendRrcDeliveryReport(uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId, RrcDeliveryReport
-*rrcDelivery)
+uint8_t BuildAndSendRrcDeliveryReport(uint32_t gnbCuUeF1apId, \
+ uint32_t gnbDuUeF1apId, RrcDeliveryReport *rrcDelivery)
{
uint8_t ret = RFAILED;
uint8_t idx = 0;
rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_RRCDeliveryStatus;
rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_ignore;
rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_RRCDeliveryStatus;
- rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.delivery_status =
+ rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.delivery_status =\
rrcDelivery->rrcDeliveryStatus.deliveryStatus;
- rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.triggering_message =
+ rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.triggering_message =\
rrcDelivery->rrcDeliveryStatus.triggeringMessage;
/* SRB ID */
{
break;
}
- case EVENT_RLC_UE_CONFIG_RSP:
+ case EVENT_RLC_UE_CREATE_RSP:
{
ret = unpackRlcUeCfgRsp(DuProcRlcUeCfgRsp, pst, mBuf);
break;
ret = unpackMacUlCcchInd(duHandleUlCcchInd, pst, mBuf);
break;
}
- case EVENT_MAC_UE_CONFIG_RSP:
+ case EVENT_MAC_UE_CREATE_RSP:
{
ret = unpackDuMacUeCfgRsp(DuProcMacUeCfgRsp, pst, mBuf);
break;
ret = unpackDuMacUeCfgRsp(DuProcMacUeCfgRsp, pst, mBuf);
break;
}
-
default:
{
DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTMAC");
*
* Functionality: Fills Default UL LC Cfg
*
- *
+ * @params[in] UlLcCfg *ulLcCfg
+ * @return void
*****************************************************************/
void fillDefaultUlLcCfg(UlLcCfg *ulLcCfg)
{
*
* Functionality: Fills Initial DL Bandwidth Part
*
+ * @params[in] InitialDlBwp *initDlBwp
+ * @return void
*
*****************************************************************/
void fillDefaultInitDlBwp(InitialDlBwp *initDlBwp)
*
* Functionality: Fills Initial UL Bandwidth Part
*
+ * @params[in] InitialUlBwp *initUlBwp
+ * @return void
*
*****************************************************************/
void fillDefaultInitUlBwp(InitialUlBwp *initUlBwp)
*
* Functionality: Fills Sp Cell Group Info
*
+ * @params[in] SpCellCfg *spCell
+ * @return void
*
*****************************************************************/
void fillDefaultSpCellGrpInfo(SpCellCfg *spCell)
*
* Functionality: Fills Physical Cell Group Info
*
+ * @params[in] PhyCellGrpCfg *cellGrp
+ * @return void
*
*****************************************************************/
void fillDefaultPhyCellGrpInfo(PhyCellGrpCfg *cellGrp)
*
* Functionality: Fills Mac Cell Group Info
*
+ * @params[in] MacCellGrpCfg *cellGrp
+ * @return void
*
*****************************************************************/
void fillDefaultMacCellGrpInfo(MacCellGrpCfg *cellGrp)
}
}
-
+/******************************************************************
+ *
+ * @brief Function to fill Mac Lc Cfg for SRB1
+ *
+ * @details
+ *
+ * Function : fillMacSrb1LcCfg
+ *
+ * Functionality: Function to fill Mac Lc cfg for SRB1
+ *
+ * @params[in] LcCfg *lcCfg, LcCfg *ueSetReqDb
+ * @return void
+ *****************************************************************/
void fillMacSrb1LcCfg(LcCfg *macLcCfg)
{
*
* Functionality: Function to fill the Lc cfg from ueSetupReqDb
*
+ * @params[in] LcCfg *lcCfg, LcCfg *ueSetReqDb
+ * @return ROK/RFAILED
*
*****************************************************************/
if(!lcCfg->drbQos)
{
DU_LOG("\nDU APP: Memory Alloc failed at drQos at fillMacLcCfgToAddMod()");
- ret = RFAILED;
+ return RFAILED;
}
}
if(ret == ROK)
lcCfg->drbQos = NULLP;
}
- /* Filling SNSSAI */
- if(ueSetReqDb->snssai && ret == ROK)
+ if(ret == ROK)
{
- if(!lcCfg->snssai)
+ if(ueSetReqDb->snssai)
{
- DU_ALLOC_SHRABL_BUF(lcCfg->snssai, sizeof(Snssai));
if(!lcCfg->snssai)
{
- DU_LOG("\nDU APP: Memory Alloc failed at snnsai at fillMacLcCfgToAddMod()");
- ret = RFAILED;
+ DU_ALLOC_SHRABL_BUF(lcCfg->snssai, sizeof(Snssai));
+ if(!lcCfg->snssai)
+ {
+ DU_LOG("\nDU APP: Memory Alloc failed at snnsai at fillMacLcCfgToAddMod()");
+ ret = RFAILED;
+ }
}
+ if(ret == ROK)
+ {
+ /* Filling SNSSAI */
+ memcpy(lcCfg->snssai, ueSetReqDb->snssai, sizeof(Snssai));
+ }
+ else
+ {
+ lcCfg->snssai = NULLP;
+ if(lcCfg->drbQos)
+ {
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
+ lcCfg->drbQos = NULLP;
+ }
+ return ret;
+ }
}
- if(ret == ROK)
- {
- memcpy(lcCfg->snssai, ueSetReqDb->snssai, sizeof(Snssai));
- }
- }
- else
- {
- lcCfg->snssai = NULLP;
- if(lcCfg->drbQos)
- {
- DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
- lcCfg->drbQos = NULLP;
- }
+ else
+ lcCfg->snssai = NULLP;
}
lcCfg->ulLcCfgPres = ueSetReqDb->ulLcCfgPres;
memcpy(&lcCfg->ulLcCfg, &ueSetReqDb->ulLcCfg, sizeof(UlLcCfg));
*
* Functionality: Function to copy bit Rate from ueSetupReqDb
*
+ * @params[in] MaxAggrBitRate *macBitRate, MaxAggrBitRate *ueDbBitRate
+ * @return ROK/RFAILED
*
*****************************************************************/
*
* Functionality: Builds and Send UE ReConfig Request to MAC
*
- * @Params[in] MacUeCfg *
+ * @Params[in] MacUeCfg pointer
* @return ROK - success
* RFAILED - failure
*
*
* Functionality: Function to return Drb LcId
*
- *Returns: lcId - SUCCESS
+ * Returns: lcId - SUCCESS
* RFAILED - FAILURE
*****************************************************************/
*
* Functionality: Fills MacUeCfg
*
+ * @params[in] cellId, ueIdx, crnti,
+ * UeContextSetupDb pointer,
+ * MacUeCfg pointer
+ * @return ROK/RFAILED
*
*****************************************************************/
uint8_t fillMacUeCfg(uint16_t cellId, uint8_t ueIdx, uint16_t crnti, \
*
* Functionality: Fills Rlc AM Information
*
+ * @params[in] AmBearerCfg *amCfg
+ * @return void
*
*****************************************************************/
void fillDefaultAmInfo(AmBearerCfg *amCfg)
*
* Functionality: Fills RLC UM Bi Directional Information
*
+ * @params[in] UmBiDirBearerCfg *umBiDirCfg
+ * @return void
*
*****************************************************************/
void fillDefaultUmBiInfo(UmBiDirBearerCfg *umBiDirCfg)
*
* Functionality: Fills RLC UM Uni Directional Info
*
+ * @params[in] UmUniDirUlBearerCfg *UmUlCfg
+ * @return void
*
*****************************************************************/
void fillDefaultUmUlInfo(UmUniDirUlBearerCfg *UmUlCfg)
*
* Functionality: Fills RLC UM Uni Directional DL Info
*
+ * @params[in] UmUniDirDlBearerCfg *UmDlCfg
+ * @return void
*
*****************************************************************/
void fillDefaultUmDlInfo(UmUniDirDlBearerCfg *UmDlCfg)
*
* Functionality: Builds Rlc Mode Default Configuration
*
+ * @params[in] rlcMode, RlcBearerCfg *lcCfg
+ * @return ROK/RFAILED
*
*****************************************************************/
uint8_t fillDefaultRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *lcCfg)
{
+
if(lcCfg)
{
switch(rlcMode)
DU_ALLOC_SHRABL_BUF(lcCfg->u.amCfg, sizeof(AmBearerCfg));
if(lcCfg->u.amCfg)
fillDefaultAmInfo(lcCfg->u.amCfg);
+ else
+ {
+ DU_LOG("\n DU_APP: Memory Alloc failed at AmCfg at fillDefaultRlcModeCfg()");
+ return RFAILED;
+ }
}
break;
}
DU_ALLOC_SHRABL_BUF(lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
if(lcCfg->u.umBiDirCfg)
fillDefaultUmBiInfo(lcCfg->u.umBiDirCfg);
+ else
+ {
+ DU_LOG("\n DU_APP: Memory Alloc failed at UmBiDirCfg at fillDefaultRlcModeCfg()");
+ return RFAILED;
+ }
}
break;
}
DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
if(lcCfg->u.umUniDirUlCfg)
fillDefaultUmUlInfo(lcCfg->u.umUniDirUlCfg);
+ else
+ {
+ DU_LOG("\n DU_APP: Memory Alloc failed at UmUniDirUlCfg at fillDefaultRlcModeCfg()");
+ return RFAILED;
+ }
}
break;
}
DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
if(lcCfg->u.umUniDirDlCfg)
fillDefaultUmDlInfo(lcCfg->u.umUniDirDlCfg);
+ else
+ {
+ DU_LOG("\n DU_APP: Memory Alloc failed at UmUniDirDlCfg at fillDefaultRlcModeCfg()");
+ return RFAILED;
+ }
}
break;
}
}
return ROK;
}
-void fillRlcSrb1LcCfg(RlcBearerCfg *rlcLcCfg)
+
+/*******************************************************************
+ *
+ * @brief Function to fill Rlc Lc Cfg for SRB1
+ *
+ * @details
+ *
+ * Function : fillRlcSrb1LcCfg
+ *
+ * Functionality:
+ * Function to fill Rlc Lc Cfg for SRB1
+ *
+ * @params[in] Pointer to RlcBearerCfg
+ * @return ROK/RFAILED
+ *
+ *****************************************************************/
+
+uint8_t fillRlcSrb1LcCfg(RlcBearerCfg *rlcLcCfg)
{
+ uint8_t ret = ROK;
+
rlcLcCfg->rbId = SRB1_LCID;
rlcLcCfg->rbType = RB_TYPE_SRB;
rlcLcCfg->lcId = SRB1_LCID;
rlcLcCfg->lcType = LCH_DCCH;
rlcLcCfg->rlcMode = RLC_AM;
rlcLcCfg->configType = CONFIG_ADD;
- fillDefaultRlcModeCfg(rlcLcCfg->rlcMode, rlcLcCfg);
+ ret = fillDefaultRlcModeCfg(rlcLcCfg->rlcMode, rlcLcCfg);
+ return ret;
}
/*******************************************************************
/* Initial RB being Added */
rlcUeCfg->cellId = cellId;
rlcUeCfg->ueIdx = ueIdx;
- fillRlcSrb1LcCfg(&rlcUeCfg->rlcLcCfg[0]);
- rlcUeCfg->numLcs++;
+ ret = fillRlcSrb1LcCfg(&rlcUeCfg->rlcLcCfg[0]);
+ if(ret == ROK)
+ rlcUeCfg->numLcs++;
+ else
+ memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
}
else
{
/*Filling RlcUeCfg */
rlcUeCfg->cellId = cellId;
rlcUeCfg->ueIdx = ueIdx;
- for(dbIdx = 0; dbIdx < ueCfgDb->numRlcLcs; dbIdx++)
+ for(dbIdx = 0; (dbIdx < ueCfgDb->numRlcLcs && ret == ROK); dbIdx++)
{
- fillDefaultRlcModeCfg(ueCfgDb->rlcLcCfg[dbIdx].rlcMode, &ueCfgDb->rlcLcCfg[dbIdx]);
+ ret = fillDefaultRlcModeCfg(ueCfgDb->rlcLcCfg[dbIdx].rlcMode, &ueCfgDb->rlcLcCfg[dbIdx]);
+ if(ret == RFAILED)
+ {
+ DU_LOG("\n DU_APP: Failed to fill Rlc Mode at fillRlcUeCfg()");
+ memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
+ return ret;
+ }
/* Fill Rlc Ue Cfg List for ADD/MOD/DEL */
for(lcIdx = 0; lcIdx < duRlcDb->numLcs; lcIdx++)
{
return RFAILED;
}
/* Fill Pst */
- FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CONFIG_REQ);
+ FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CREATE_REQ);
/* Copying ueCb to a sharable buffer */
DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
{
uint8_t ret = ROK;
- uint8_t ueIdx, cellIdx;
if(cfgRsp)
{
if(cfgRsp->result == MAC_DU_APP_RSP_OK)
{
- cellIdx = (cfgRsp->cellId -1);
- ueIdx = (cfgRsp->ueIdx -1);
-
- if(pst->event == EVENT_MAC_UE_CONFIG_RSP)
+ if(pst->event == EVENT_MAC_UE_CREATE_RSP)
{
DU_LOG("\nDU APP : MAC UE Create Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx);
- duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.macUeCfgState = UE_CONFIG_COMPLETE;
+ duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
+ macUeCfg.macUeCfgState = UE_CREATE_COMPLETE;
}
else if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
{
DU_LOG("\nDU APP : MAC UE Reconfig Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx);
- duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.macUeCfgState = UE_RECFG_COMPLETE;
+ duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
+ macUeCfg.macUeCfgState = UE_RECFG_COMPLETE;
if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK)
BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId);
}
}
ret = RFAILED;
}
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp));
}
else
{
return ret;
}
+
/*******************************************************************
*
* @brief Processes UE create Req to RLC UL
RlcUeCfg *rlcUeCfg = NULLP;
Pst pst;
- fillRlcUeCfg(cellId, ueIdx, NULL, duRlcUeCfg);
- FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_CONFIG_REQ);
+ ret = fillRlcUeCfg(cellId, ueIdx, NULL, duRlcUeCfg);
+ if(ret == RFAILED)
+ {
+ DU_LOG("\nDU_APP: Failed to fill Rlc Ue Cfg at duBuildAndSendUeCreateReqToRlc()");
+ return ret;
+ }
+ FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_CREATE_REQ);
/* Copying ueCfg to a sharable buffer */
DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCfg));
if(rlcUeCfg)
uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
{
uint8_t ret = ROK;
- uint8_t ueIdx, cellIdx;
if(cfgRsp)
{
if(cfgRsp->result == RLC_DU_APP_RSP_OK)
{
- cellIdx = (cfgRsp->cellId -1);
- ueIdx = (cfgRsp->ueIdx -1);
-
- if(pst->event == EVENT_RLC_UE_CONFIG_RSP)
+ if(pst->event == EVENT_RLC_UE_CREATE_RSP)
{
DU_LOG("\nDU_APP: RLC UE Create Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx);
- duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcUeCfgState = UE_CONFIG_COMPLETE;
+ duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
+ rlcUeCfg.rlcUeCfgState = UE_CREATE_COMPLETE;
}
else if(pst->event == EVENT_RLC_UE_RECONFIG_RSP)
{
DU_LOG("\nDU_APP: RLC UE Reconfig Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx);
- duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE;
+ duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\
+ rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE;
if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK)
BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId);
{
memset(macUeCfg, 0, sizeof(MacUeCfg));
ret = fillMacUeCfg(cellId, ueIdx, crnti, ueCfgDb, macUeCfg);
- if(ret == ROK)
+ if(ret == RFAILED)
+ DU_LOG("\nDU_APP: Failed to fill Mac Ue Cfg at duBuildAndSendUeReCfgReqToMac()");
+ else
ret = sendUeReCfgReqToMac(macUeCfg);
}
else