* Spec 38.214 Sec 5.1.2.2.2
*/
coreset0Size= sib1PdcchInfo->coresetCfg.coreSetSize;
- rbStart = 0; /* For SIB1 */
- //rbStart = sib1PdcchInfo->dci.pdschCfg->pdschFreqAlloc.freqAlloc.startPrb;
+ rbStart = sib1PdcchInfo->dci.pdschCfg->pdschFreqAlloc.freqAlloc.startPrb;
rbLen = sib1PdcchInfo->dci.pdschCfg->pdschFreqAlloc.freqAlloc.numPrb;
if((rbLen >=1) && (rbLen <= coreset0Size - rbStart))
}
/* Fetching DCI field values */
- timeDomResAssign = sib1PdcchInfo->dci.pdschCfg->pdschTimeAlloc.
- rowIndex -1;
- VRB2PRBMap = sib1PdcchInfo->dci.pdschCfg->pdschFreqAlloc.\
- vrbPrbMapping;
+ timeDomResAssign = sib1PdcchInfo->dci.pdschCfg->pdschTimeAlloc.rowIndex -1;
+ VRB2PRBMap = sib1PdcchInfo->dci.pdschCfg->pdschFreqAlloc.vrbPrbMapping;
modNCodScheme = sib1PdcchInfo->dci.pdschCfg->codeword[0].mcsIndex;
redundancyVer = sib1PdcchInfo->dci.pdschCfg->codeword[0].rvIndex;
sysInfoInd = 0; /* 0 for SIB1; 1 for SI messages */
/* TODO: Fill values of coreset0Size, rbStart and rbLen */
coreset0Size= rarPdcchInfo->coresetCfg.coreSetSize;
rbStart = 0; /* For SIB1 */
- //rbStart = rarPdcchInfo->dci.pdschCfg->freqAlloc.rbStart;
+ rbStart = rarPdcchInfo->dci.pdschCfg->pdschFreqAlloc.freqAlloc.startPrb;
rbLen = rarPdcchInfo->dci.pdschCfg->pdschFreqAlloc.freqAlloc.numPrb;
if((rbLen >=1) && (rbLen <= coreset0Size - rbStart))
}
/* Fetching DCI field values */
- timeDomResAssign = rarPdcchInfo->dci.pdschCfg->pdschTimeAlloc.rowIndex -1;
+ timeDomResAssign = rarPdcchInfo->dci.pdschCfg->pdschTimeAlloc.rowIndex;
VRB2PRBMap = rarPdcchInfo->dci.pdschCfg->pdschFreqAlloc.vrbPrbMapping;
modNCodScheme = rarPdcchInfo->dci.pdschCfg->codeword[0].mcsIndex;
tbScaling = 0; /* configured to 0 scaling */
*
******************************************************************/
uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlSchedInfo *dlInfo, \
- RntiType rntiType, uint8_t coreSetType)
+ RntiType rntiType, uint8_t coreSetType, uint8_t ueIdx)
{
if(dlTtiReqPdu != NULLP)
{
memset(&dlTtiReqPdu->pdu.pdcch_pdu, 0, sizeof(fapi_dl_pdcch_pdu_t));
if(rntiType == SI_RNTI_TYPE)
{
- pdcchInfo = &dlInfo->brdcstAlloc.sib1Alloc.sib1PdcchCfg;
- bwp = &dlInfo->brdcstAlloc.sib1Alloc.bwp;
- fillSib1DlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo);
+ pdcchInfo = &dlInfo->brdcstAlloc.sib1Alloc.sib1PdcchCfg;
+ bwp = &dlInfo->brdcstAlloc.sib1Alloc.bwp;
+ fillSib1DlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo);
}
else if(rntiType == RA_RNTI_TYPE)
{
- pdcchInfo = &dlInfo->rarAlloc->rarPdcchCfg;
- bwp = &dlInfo->rarAlloc->bwp;
- fillRarDlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo);
+ pdcchInfo = &dlInfo->rarAlloc[ueIdx]->rarPdcchCfg;
+ bwp = &dlInfo->rarAlloc[ueIdx]->bwp;
+ fillRarDlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo);
}
else if(rntiType == TC_RNTI_TYPE || rntiType == C_RNTI_TYPE)
{
pdcchInfo = &dlInfo->dlMsgAlloc->dlMsgPdcchCfg;
- bwp = &dlInfo->dlMsgAlloc->bwp;
+ bwp = &dlInfo->dlMsgAlloc->bwp;
fillDlMsgDlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo,\
- &dlInfo->dlMsgAlloc->dlMsgInfo);
+ &dlInfo->dlMsgAlloc->dlMsgInfo);
}
else
{
- DU_LOG("\nERROR --> LWR_MAC: Failed filling PDCCH Pdu");
- return RFAILED;
+ DU_LOG("\nERROR --> LWR_MAC: Failed filling PDCCH Pdu");
+ return RFAILED;
}
dlTtiReqPdu->pduType = PDCCH_PDU_TYPE;
dlTtiReqPdu->pdu.pdcch_pdu.bwpSize = bwp->freqAlloc.numPrb;
dlTtiReqPdu->pdu.pdcch_pdu.precoderGranularity = pdcchInfo->coresetCfg.precoderGranularity;
dlTtiReqPdu->pdu.pdcch_pdu.numDlDci = pdcchInfo->numDlDci;
dlTtiReqPdu->pdu.pdcch_pdu.coreSetType = coreSetType;
-
+
/* Calculating PDU length. Considering only one dl dci pdu for now */
dlTtiReqPdu->pduSize = sizeof(fapi_dl_pdcch_pdu_t);
}
uint8_t calcDlTtiReqPduCount(DlSchedInfo *dlInfo)
{
uint8_t count = 0;
- uint8_t idx = 0;
+ uint8_t idx = 0, ueIdx=0;
if(dlInfo->isBroadcastPres)
{
if(dlInfo->brdcstAlloc.ssbTrans)
{
- for(idx = 0; idx < dlInfo->brdcstAlloc.ssbIdxSupported; idx++)
- {
- /* SSB PDU is filled */
- count++;
- }
+ for(idx = 0; idx < dlInfo->brdcstAlloc.ssbIdxSupported; idx++)
+ {
+ /* SSB PDU is filled */
+ count++;
+ }
}
if(dlInfo->brdcstAlloc.sib1Trans)
{
- /* PDCCH and PDSCH PDU is filled */
- count += 2;
+ /* PDCCH and PDSCH PDU is filled */
+ count += 2;
}
}
- if(dlInfo->rarAlloc != NULLP)
+
+ for(ueIdx=0; ueIdx<MAX_NUM_UE; ueIdx++)
{
- /* PDCCH and PDSCH PDU is filled */
- if(dlInfo->rarAlloc->pduPres == BOTH)
- count += 2;
- else
- count += 1;
+ if(dlInfo->rarAlloc[ueIdx] != NULLP)
+ {
+ /* PDCCH and PDSCH PDU is filled */
+ if(dlInfo->rarAlloc[ueIdx]->pduPres == BOTH)
+ count += 2;
+ else
+ count += 1;
+ }
}
+
if(dlInfo->dlMsgAlloc != NULLP)
{
/* PDCCH and PDSCH PDU is filled */
* ********************************************************************/
uint8_t calcTxDataReqPduCount(DlSchedInfo *dlInfo)
{
- uint8_t count = 0;
+ uint8_t count = 0, ueIdx=0;
if(dlInfo->isBroadcastPres && dlInfo->brdcstAlloc.sib1Trans)
{
count++;
}
- if(dlInfo->rarAlloc != NULLP)
+
+ for(ueIdx=0; ueIdx<MAX_NUM_UE; ueIdx++)
{
- count++;
+ if((dlInfo->rarAlloc[ueIdx] != NULLP) && \
+ ((dlInfo->rarAlloc[ueIdx]->pduPres == BOTH) || (dlInfo->rarAlloc[ueIdx]->pduPres == PDSCH_PDU)))
+ count++;
}
+
if(dlInfo->dlMsgAlloc != NULLP)
{
if(dlInfo->dlMsgAlloc->pduPres == BOTH || dlInfo->dlMsgAlloc->pduPres == PDSCH_PDU)
uint8_t idx =0;
uint8_t nPdu = 0;
uint8_t numPduEncoded = 0;
+ uint8_t ueIdx;
uint16_t cellIdx =0;
uint16_t pduIndex = 0;
{
rntiType = SI_RNTI_TYPE;
fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded],&currDlSlot->dlInfo,\
- rntiType, CORESET_TYPE0);
+ rntiType, CORESET_TYPE0, MAX_NUM_UE);
numPduEncoded++;
fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
&currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdschCfg,
DU_LOG("\033[0m");
}
}
-
- if(currDlSlot->dlInfo.rarAlloc != NULLP)
+
+ for(ueIdx=0; ueIdx<MAX_NUM_UE; ueIdx++)
{
- /* Filling RAR param */
- rntiType = RA_RNTI_TYPE;
- if((currDlSlot->dlInfo.rarAlloc->pduPres == BOTH) || \
- (currDlSlot->dlInfo.rarAlloc->pduPres == PDCCH_PDU))
+ if(currDlSlot->dlInfo.rarAlloc[ueIdx] != NULLP)
{
- fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
- &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
- numPduEncoded++;
- }
- if((currDlSlot->dlInfo.rarAlloc->pduPres == BOTH) || \
- (currDlSlot->dlInfo.rarAlloc->pduPres == PDSCH_PDU))
- {
- fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
- &currDlSlot->dlInfo.rarAlloc->rarPdschCfg,
- currDlSlot->dlInfo.rarAlloc->bwp,
- pduIndex);
- numPduEncoded++;
- pduIndex++;
-
- DU_LOG("\033[1;32m");
- DU_LOG("\nDEBUG --> LWR_MAC: RAR sent...");
- DU_LOG("\033[0m");
+ /* Filling RAR param */
+ rntiType = RA_RNTI_TYPE;
+ if((currDlSlot->dlInfo.rarAlloc[ueIdx]->pduPres == BOTH) || \
+ (currDlSlot->dlInfo.rarAlloc[ueIdx]->pduPres == PDCCH_PDU))
+ {
+ fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
+ &currDlSlot->dlInfo, rntiType, CORESET_TYPE0, ueIdx);
+ numPduEncoded++;
+ }
+ if((currDlSlot->dlInfo.rarAlloc[ueIdx]->pduPres == BOTH) || \
+ (currDlSlot->dlInfo.rarAlloc[ueIdx]->pduPres == PDSCH_PDU))
+ {
+ fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
+ &currDlSlot->dlInfo.rarAlloc[ueIdx]->rarPdschCfg,
+ currDlSlot->dlInfo.rarAlloc[ueIdx]->bwp,
+ pduIndex);
+ numPduEncoded++;
+ pduIndex++;
+
+ DU_LOG("\033[1;32m");
+ DU_LOG("\nDEBUG --> LWR_MAC: RAR sent...");
+ DU_LOG("\033[0m");
+ }
}
}
-
if(currDlSlot->dlInfo.dlMsgAlloc != NULLP)
{
if(currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPdu != NULLP)
{
rntiType = TC_RNTI_TYPE;
fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
- &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
+ &currDlSlot->dlInfo, rntiType, CORESET_TYPE0, MAX_NUM_UE);
}
else
{
/* Filling other DL msg params */
rntiType = C_RNTI_TYPE;
fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
- &currDlSlot->dlInfo, rntiType, CORESET_TYPE1);
+ &currDlSlot->dlInfo, rntiType, CORESET_TYPE1, MAX_NUM_UE);
}
numPduEncoded++;
}
DU_LOG("\nCall Flow: ENTMAC -> ENTLWRMAC : TX_DATA_REQ\n");
#endif
- uint8_t nPdu = 0;
- uint16_t cellIdx;
+ uint8_t nPdu = 0;
+ uint8_t ueIdx=0;
+ uint16_t cellIdx=0;
uint16_t pduIndex = 0;
fapi_tx_data_req_t *txDataReq =NULLP;
p_fapi_api_queue_elem_t txDataElem = 0;
LWR_MAC_ALLOC(txDataElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_tx_data_req_t)));
if(txDataElem == NULLP)
{
- DU_LOG("\nERROR --> LWR_MAC: Failed to allocate memory for TX data Request");
- return RFAILED;
+ DU_LOG("\nERROR --> LWR_MAC: Failed to allocate memory for TX data Request");
+ return RFAILED;
}
FILL_FAPI_LIST_ELEM(txDataElem, NULLP, FAPI_TX_DATA_REQUEST, 1, \
- sizeof(fapi_tx_data_req_t));
+ sizeof(fapi_tx_data_req_t));
txDataReq = (fapi_tx_data_req_t *)(txDataElem +1);
memset(txDataReq, 0, sizeof(fapi_tx_data_req_t));
fillMsgHeader(&txDataReq->header, FAPI_TX_DATA_REQUEST, sizeof(fapi_tx_data_req_t));
txDataReq->slot = currTimingInfo.slot;
if(dlInfo->brdcstAlloc.sib1Trans)
{
- fillSib1TxDataReq(txDataReq->pdu_desc, pduIndex, &macCb.macCell[cellIdx]->macCellCfg, \
- dlInfo->brdcstAlloc.sib1Alloc.sib1PdschCfg);
- pduIndex++;
- txDataReq->num_pdus++;
+ fillSib1TxDataReq(txDataReq->pdu_desc, pduIndex, &macCb.macCell[cellIdx]->macCellCfg, \
+ dlInfo->brdcstAlloc.sib1Alloc.sib1PdschCfg);
+ pduIndex++;
+ txDataReq->num_pdus++;
}
- if(dlInfo->rarAlloc != NULLP)
+ for(ueIdx=0; ueIdx<MAX_NUM_UE; ueIdx++)
{
- if((dlInfo->rarAlloc->pduPres == BOTH) || (dlInfo->rarAlloc->pduPres == PDSCH_PDU))
+ if(dlInfo->rarAlloc[ueIdx] != NULLP)
{
- fillRarTxDataReq(txDataReq->pdu_desc, pduIndex, &dlInfo->rarAlloc->rarInfo,\
- dlInfo->rarAlloc->rarPdschCfg);
- pduIndex++;
- txDataReq->num_pdus++;
+ if((dlInfo->rarAlloc[ueIdx]->pduPres == BOTH) || (dlInfo->rarAlloc[ueIdx]->pduPres == PDSCH_PDU))
+ {
+ fillRarTxDataReq(txDataReq->pdu_desc, pduIndex, &dlInfo->rarAlloc[ueIdx]->rarInfo,\
+ dlInfo->rarAlloc[ueIdx]->rarPdschCfg);
+ pduIndex++;
+ txDataReq->num_pdus++;
+ }
+ MAC_FREE(dlInfo->rarAlloc[ueIdx],sizeof(RarAlloc));
}
- MAC_FREE(dlInfo->rarAlloc,sizeof(RarAlloc));
}
if(dlInfo->dlMsgAlloc != NULLP)
pduIndex++;
txDataReq->num_pdus++;
MAC_FREE(dlInfo->dlMsgAlloc->dlMsgInfo.dlMsgPdu,\
- dlInfo->dlMsgAlloc->dlMsgInfo.dlMsgPduLen);
+ dlInfo->dlMsgAlloc->dlMsgInfo.dlMsgPduLen);
dlInfo->dlMsgAlloc->dlMsgInfo.dlMsgPdu = NULLP;
MAC_FREE(dlInfo->dlMsgAlloc, sizeof(DlMsgAlloc));
}
&currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdschCfg;
}
- if(dlSchedInfo->rarAlloc != NULLP)
+ for(ueIdx=0; ueIdx<MAX_NUM_UE; ueIdx++)
{
- currDlSlot = &macCb.macCell[cellIdx]->\
- dlSlot[dlSchedInfo->schSlotValue.rarTime.slot];
- currDlSlot->dlInfo.rarAlloc = dlSchedInfo->rarAlloc;
+ if(dlSchedInfo->rarAlloc[ueIdx] != NULLP)
+ {
+ currDlSlot = &macCb.macCell[cellIdx]->dlSlot[dlSchedInfo->schSlotValue.rarTime.slot];
+ currDlSlot->dlInfo.rarAlloc[ueIdx] = dlSchedInfo->rarAlloc[ueIdx];
- /* MUXing of RAR */
- fillRarPdu(&currDlSlot->dlInfo.rarAlloc->rarInfo);
+ /* MUXing of RAR */
+ fillRarPdu(&currDlSlot->dlInfo.rarAlloc[ueIdx]->rarInfo);
+ }
}
if(dlSchedInfo->dlMsgAlloc != NULLP)
cell->firstSsbTransmitted = false;
cell->firstSib1Transmitted = false;
fillSsbStartSymb(cell);
+ cmLListInit(&cell->ueToBeScheduled);
schCb[inst].cells[inst] = cell;
DU_LOG("\nINFO --> SCH : Cell init completed for cellId:%d", cell->cellId);
#ifdef NR_TDD
uint16_t slotIdx = 0;
#endif
+ bool isLcIdValid = false;
DlMsgInfo dlMsgInfo;
SchUeCb *ueCb = NULLP;
SchCellCb *cell = NULLP;
DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_DL_RLC_BO_INFO_TO_SCH\n");
#endif
- DU_LOG("\nDEBUG --> SCH : Received RLC BO Status indication");
+ DU_LOG("\nDEBUG --> SCH : Received RLC BO Status indication LCId [%d] BO [%d]", dlBoInfo->lcId, dlBoInfo->dataVolume);
cell = schCb[inst].cells[inst];
if(cell == NULLP)
GET_UE_IDX(dlBoInfo->crnti, ueIdx);
ueCb = &cell->ueCb[ueIdx-1];
lcId = dlBoInfo->lcId;
+ CHECK_LCID(lcId, isLcIdValid);
+ if(isLcIdValid == FALSE)
+ {
+ DU_LOG("ERROR --> SCH: LCID:%d is not valid", lcId);
+ return RFAILED;
+ }
memset(&dlMsgInfo, 0, sizeof(DlMsgInfo));
dlMsgInfo.crnti = dlBoInfo->crnti;
{
/* TODO : These part of changes will be corrected during DL scheduling as
* per K0 - K1 -K2 */
- if(lcId == SRB1_LCID || lcId == SRB2_LCID || lcId == SRB3_LCID || \
- (lcId >= MIN_DRB_LCID && lcId <= MAX_DRB_LCID))
+ SET_ONE_BIT(ueIdx, cell->boIndBitMap);
+ if(ueCb->dlInfo.dlLcCtxt[lcId].lcId == lcId)
{
- SET_ONE_BIT(ueIdx, cell->boIndBitMap);
- if(ueCb->dlInfo.dlLcCtxt[lcId].lcId == lcId)
- {
- ueCb->dlInfo.dlLcCtxt[lcId].bo = dlBoInfo->dataVolume;
- }
- else
- {
- DU_LOG("ERROR --> SCH: LCID:%d is not configured in SCH Cb",lcId);
- return RFAILED;
- }
+ ueCb->dlInfo.dlLcCtxt[lcId].bo = dlBoInfo->dataVolume;
}
- else if(lcId != SRB0_LCID)
+ else
{
- DU_LOG("\nERROR --> SCH : Invalid LC Id %d in MacSchDlRlcBoInfo", lcId);
+ DU_LOG("ERROR --> SCH: LCID:%d is not configured in SCH Cb",lcId);
return RFAILED;
}
return ROK;
}
+
+/*******************************************************************
+ *
+ * @brief Add UE to ueToBeScheduled List
+ *
+ * @details
+ *
+ * Function : addUeToBeScheduled
+ *
+ * Functionality:
+ * Search if UE entry present in the list
+ * If yes, return.
+ * If no, add UE to the list
+ *
+ * @params[in] Cell control block
+ * Ue Idx to be added
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t addUeToBeScheduled(SchCellCb *cell, uint8_t ueIdToAdd)
+{
+ uint8_t *ueId;
+ CmLList *node;
+
+ /* Search if UE entry is already present in ueToBeScheduled list.
+ * If yes, another entry for same UE not needed. Hence, return */
+ node = cell->ueToBeScheduled.first;
+ while(node)
+ {
+ ueId = (uint8_t *)node->node;
+ if(*ueId == ueIdToAdd)
+ return ROK;
+ node = node->next;
+ }
+
+ /* If UE entry not present already, add UE to the end of ueToBeScheduled list */
+ SCH_ALLOC(ueId, sizeof(uint8_t));
+ if(!ueId)
+ {
+ DU_LOG("\nERROR --> SCH : Memory allocation failure in addUeToBeScheduled");
+ return RFAILED;
+ }
+ *ueId = ueIdToAdd;
+ if(addNodeToLList(&cell->ueToBeScheduled, ueId, NULLP) != ROK)
+ {
+ DU_LOG("\nERROR --> SCH : Failed to add UeIdx to cell->ueToBeScheduled list");
+ return RFAILED;
+ }
+ return ROK;
+}
/*******************************************************************************
*
uint8_t ssbIdxSupported; /*!< Max SSB index */
SsbInfo ssbInfo[MAX_SSB_IDX]; /*!< SSB info */
bool sib1Pres; /*!< Flag to determine if SIB1 is present in this slot */
- RarAlloc *rarAlloc; /*!< RAR allocation */
- DlMsgAlloc *dlMsgAlloc; /*!< Dl msg allocation */
+ uint8_t pdcchUe; /*!< UE for which PDCCH is scheduled in this slot */
+ uint8_t pdschUe; /*!< UE for which PDSCH is scheduled in this slot */
+ RarAlloc *rarAlloc[MAX_NUM_UE]; /*!< RAR allocation per UE*/
+ DlMsgAlloc *dlMsgAlloc; /*!< Dl msg allocation */
}SchDlSlotInfo;
typedef struct schRaCb
*/
typedef struct schUlSlotInfo
{
- SchPrbAlloc prbAlloc; /*!< PRB allocated/available per symbol */
- uint8_t puschCurrentPrb; /*!< Current PRB for PUSCH allocation */
- bool puschPres; /*!< PUSCH presence field */
- SchPuschInfo *schPuschInfo; /*!< PUSCH info */
- bool pucchPres; /*!< PUCCH presence field */
- SchPucchInfo schPucchInfo; /*!< PUCCH info */
+ SchPrbAlloc prbAlloc; /*!< PRB allocated/available per symbol */
+ uint8_t puschCurrentPrb; /*!< Current PRB for PUSCH allocation */
+ bool puschPres; /*!< PUSCH presence field */
+ SchPuschInfo *schPuschInfo; /*!< PUSCH info */
+ bool pucchPres; /*!< PUCCH presence field */
+ SchPucchInfo schPucchInfo; /*!< PUCCH info */
+ uint8_t pucchUe; /*!< Store UE id for which PUCCH is scheduled */
+ uint8_t puschUe; /*!< Store UE id for which PUSCH is scheduled */
}SchUlSlotInfo;
/**
uint32_t actvUeBitMap; /*!<Bit map to find active UEs */
uint32_t boIndBitMap; /*!<Bit map to indicate UEs that have recevied BO */
SchUeCb ueCb[MAX_NUM_UE]; /*!<Pointer to UE contexts of this cell */
+ CmLListCp ueToBeScheduled; /*!<Linked list to store UEs pending to be scheduled, */
#ifdef NR_TDD
uint8_t numSlotsInPeriodicity; /*!< number of slots in configured periodicity and SCS */
uint32_t slotFrmtBitMap; /*!< 2 bits must be read together to determine D/U/S slots. 00-D, 01-U, 10-S */
uint16_t puschSymTblSize, SchK2TimingInfoTbl *msg3K2InfoTbl, SchK2TimingInfoTbl *k2InfoTbl);
uint8_t SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
SchUeCb* schGetUeCb(SchCellCb *cellCb, uint16_t crnti);
+uint8_t addUeToBeScheduled(SchCellCb *cell, uint8_t ueId);
/* Incoming message handler function declarations */
uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst inst);
PduTxOccsaion schCheckSib1Occ(SchCellCb *cell, SlotTimingInfo slotTime);
uint8_t schBroadcastSsbAlloc(SchCellCb *cell, SlotTimingInfo slotTime, DlBrdcstAlloc *dlBrdcstAlloc);
uint8_t schBroadcastSib1Alloc(SchCellCb *cell, SlotTimingInfo slotTime, DlBrdcstAlloc *dlBrdcstAlloc);
-void schProcessRaReq(SlotTimingInfo currTime, SchCellCb *cellCb);
+bool schProcessRaReq(SchCellCb *cellCb, SlotTimingInfo currTime, uint8_t ueId);
uint8_t schProcessMsg4Req(SchCellCb *cell, SlotTimingInfo currTime);
uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueIdx, RarAlloc *rarAlloc, uint8_t k0Index);
uint8_t schDlRsrcAllocDlMsg(SchCellCb *cell, SlotTimingInfo slotTime, uint16_t crnti,\
{
DU_LOG("\nERROR --> SCH : Memory Allocation failed for msg4SlotAlloc");
SCH_FREE(dciSlotAlloc, sizeof(DlMsgAlloc));
- cell->schDlSlotInfo[pdcchSlot]->rarAlloc = NULLP;
+ cell->schDlSlotInfo[pdcchSlot]->dlMsgAlloc = NULLP;
return RFAILED;
}
cell->schDlSlotInfo[pdschSlot]->dlMsgAlloc = msg4SlotAlloc;
* @param[in] Current timing of the cell
* @return ROK
**/
-void schProcessRaReq(SlotTimingInfo currTime, SchCellCb *cell)
+bool schProcessRaReq(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId)
{
bool k2Found = false;
- uint8_t ueIdx = 0, k0TblIdx = 0, k2TblIdx = 0;
+ uint8_t k0TblIdx = 0, k2TblIdx = 0;
uint8_t k0Index = 0, k2Index = 0;
uint8_t k0 = 0, k2 = 0;
uint8_t puschMu = 0;
SchK2TimingInfoTbl *msg3K2InfoTbl=NULLP;
RaRspWindowStatus windowStatus=0;
- while(ueIdx < MAX_NUM_UE)
- {
- if(cell->raReq[ueIdx] == NULLP)
- {
- ueIdx++;
- continue;
- }
-
#ifdef NR_TDD
- totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.ssbSchCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod);
+ totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.ssbSchCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod);
#endif
- k0K1InfoTbl = &cell->cellCfg.schInitialDlBwp.k0K1InfoTbl;
- msg3K2InfoTbl = &cell->cellCfg.schInitialUlBwp.msg3K2InfoTbl;
- puschMu = cell->cellCfg.numerology;
- msg3Delta = puschDeltaTable[puschMu];
- msg3MinSchTime = minMsg3SchTime[cell->cellCfg.numerology];
-
- /* Calculating time frame to send DCI for RAR */
- ADD_DELTA_TO_TIME(currTime, dciTime, PHY_DELTA_DL + SCHED_DELTA);
- dciSlot = dciTime.slot;
+ k0K1InfoTbl = &cell->cellCfg.schInitialDlBwp.k0K1InfoTbl;
+ msg3K2InfoTbl = &cell->cellCfg.schInitialUlBwp.msg3K2InfoTbl;
+ puschMu = cell->cellCfg.numerology;
+ msg3Delta = puschDeltaTable[puschMu];
+ msg3MinSchTime = minMsg3SchTime[cell->cellCfg.numerology];
+
+ /* Calculating time frame to send DCI for RAR */
+ ADD_DELTA_TO_TIME(currTime, dciTime, PHY_DELTA_DL + SCHED_DELTA);
+ dciSlot = dciTime.slot;
#ifdef NR_TDD
- /* Consider this slot for sending DCI, only if it is a DL slot */
- if(schGetSlotSymbFrmt(dciSlot, cell->slotFrmtBitMap) == DL_SLOT)
+ /* Consider this slot for sending DCI, only if it is a DL slot */
+ if(schGetSlotSymbFrmt(dciSlot, cell->slotFrmtBitMap) == DL_SLOT)
#endif
+ {
+ /* If PDCCH is already scheduled on this slot, cannot schedule PDSCH for another UE here. */
+ if(cell->schDlSlotInfo[dciSlot]->pdcchUe != 0)
+ return false;
+
+ /* Check if this slot is within RA response window */
+ windowStatus = isInRaRspWindow(cell->raReq[ueId-1], dciTime, cell->numSlots);
+ if(windowStatus == WITHIN_WINDOW)
{
-
- /* Check if this slot is within RA response window */
- windowStatus = isInRaRspWindow(cell->raReq[ueIdx], dciTime, cell->numSlots);
- if(windowStatus == WITHIN_WINDOW)
+ /* For all k0 values, search for a suitable k2 value to schedule MSG3.
+ * RAR DCI, RAR PDSCH and MSG3 is scheduled only if one such k0-k2 combination
+ * is found. Else no scheduling happens.
+ */
+ for(k0TblIdx = 0; k0TblIdx < k0K1InfoTbl->k0k1TimingInfo[dciSlot].numK0; k0TblIdx++)
{
- /* For all k0 values, search for a suitable k2 value to schedule MSG3.
- * RAR DCI, RAR PDSCH and MSG3 is scheduled only if one such k0-k2 combination
- * is found. Else no scheduling happens.
- */
- for(k0TblIdx = 0; k0TblIdx < k0K1InfoTbl->k0k1TimingInfo[dciSlot].numK0; k0TblIdx++)
+ k0Index = k0K1InfoTbl->k0k1TimingInfo[dciSlot].k0Indexes[k0TblIdx].k0Index;
+ k0 = cell->cellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].k0;
+
+ /* Calculating time frame to send RAR PDSCH */
+ ADD_DELTA_TO_TIME(dciTime, rarTime, k0);
+ rarSlot = rarTime.slot;
+
+ /* If PDSCH is already scheduled on this slot, cannot schedule PDSCH for another UE here. */
+ if(cell->schDlSlotInfo[rarSlot]->pdschUe != 0)
+ continue;
+
+ for(k2TblIdx = 0; k2TblIdx < msg3K2InfoTbl->k2TimingInfo[rarSlot].numK2; k2TblIdx++)
{
- k0Index = k0K1InfoTbl->k0k1TimingInfo[dciSlot].k0Indexes[k0TblIdx].k0Index;
- k0 = cell->cellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].k0;
-
- /* Calculating time frame to send RAR PDSCH */
- ADD_DELTA_TO_TIME(dciTime, rarTime, k0);
- rarSlot = rarTime.slot;
+ k2Index = msg3K2InfoTbl->k2TimingInfo[rarSlot].k2Indexes[k2TblIdx];
+ k2 = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
- for(k2TblIdx = 0; k2TblIdx < msg3K2InfoTbl->k2TimingInfo[rarSlot].numK2; k2TblIdx++)
+ /* Delta is added to the slot allocation for msg3 based on 38.214 section 6.1.2.1 */
+ k2 = k2 + msg3Delta;
+ if(k2 >= msg3MinSchTime)
{
- k2Index = msg3K2InfoTbl->k2TimingInfo[rarSlot].k2Indexes[k2TblIdx];
- k2 = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
-
- /* Delta is added to the slot allocation for msg3 based on 38.214 section 6.1.2.1 */
- k2 = k2 + msg3Delta;
- if(k2 >= msg3MinSchTime)
- {
- ADD_DELTA_TO_TIME(rarTime, msg3Time, k2);
+ ADD_DELTA_TO_TIME(rarTime, msg3Time, k2);
#ifdef NR_TDD
- if(schGetSlotSymbFrmt(msg3Time.slot % totalCfgSlot, cell->slotFrmtBitMap) == DL_SLOT)
- continue;
+ if(schGetSlotSymbFrmt(msg3Time.slot % totalCfgSlot, cell->slotFrmtBitMap) == DL_SLOT)
+ continue;
#endif
- k2Found = true;
- break;
- }
- }
- if(k2Found)
+ /* If PUSCH is already scheduled on this slot, another PUSCH
+ * pdu cannot be scheduled here */
+ if(cell->schUlSlotInfo[msg3Time.slot]->puschUe != 0)
+ continue;
+
+ k2Found = true;
break;
+ }
}
+ if(k2Found)
+ break;
}
- else if(windowStatus == WINDOW_EXPIRED)
- {
- SCH_FREE(cell->raReq[ueIdx]->rachInd, sizeof(RachIndInfo));
- SCH_FREE(cell->raReq[ueIdx], sizeof(SchRaReq));
- ueIdx++;
- continue;
- }
+ }
+ else if(windowStatus == WINDOW_EXPIRED)
+ {
+ SCH_FREE(cell->raReq[ueId-1]->rachInd, sizeof(RachIndInfo));
+ SCH_FREE(cell->raReq[ueId-1], sizeof(SchRaReq));
+ return false;
+ }
- /* If K0-K2 combination not found, no scheduling happens */
- if(!k2Found)
- {
- ueIdx++;
- continue;
- }
+ /* If K0-K2 combination not found, no scheduling happens */
+ if(!k2Found)
+ return false;
- /* Allocate memory for RAR PDCCH slot, pointer will be checked at schProcessSlotInd() */
- SCH_ALLOC(dciSlotAlloc, sizeof(RarAlloc));
- if(dciSlotAlloc == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Memory Allocation failed for dciSlotAlloc");
- return;
- }
- cell->schDlSlotInfo[dciSlot]->rarAlloc = dciSlotAlloc;
+ /* Allocate memory for RAR PDCCH slot, pointer will be checked at schProcessSlotInd() */
+ SCH_ALLOC(dciSlotAlloc, sizeof(RarAlloc));
+ if(dciSlotAlloc == NULLP)
+ {
+ DU_LOG("\nERROR --> SCH : Memory Allocation failed for dciSlotAlloc");
+ return false;
+ }
+ cell->schDlSlotInfo[dciSlot]->rarAlloc[ueId-1] = dciSlotAlloc;
- /* Fill PDCCH and PDSCH scheduling information for RAR */
- if((schFillRar(cell, rarTime, ueIdx, dciSlotAlloc, k0Index)) != ROK)
- {
- DU_LOG("\nERROR --> SCH: Scheduling of RAR failed in slot [%d]", rarSlot);
- SCH_FREE(dciSlotAlloc, sizeof(RarAlloc));
- cell->schDlSlotInfo[dciSlot]->rarAlloc = NULLP;
- return;
- }
+ /* Fill PDCCH and PDSCH scheduling information for RAR */
+ if((schFillRar(cell, rarTime, ueId, dciSlotAlloc, k0Index)) != ROK)
+ {
+ DU_LOG("\nERROR --> SCH: Scheduling of RAR failed in slot [%d]", rarSlot);
+ SCH_FREE(dciSlotAlloc, sizeof(RarAlloc));
+ cell->schDlSlotInfo[dciSlot]->rarAlloc[ueId-1] = NULLP;
+ return false;
+ }
- /* Allocate resources for msg3 */
- msg3PuschInfo = schAllocMsg3Pusch(cell->instIdx, cell->raReq[ueIdx]->rachInd->crnti, k2Index, msg3Time);
- if(msg3PuschInfo)
+ /* Allocate resources for msg3 */
+ msg3PuschInfo = schAllocMsg3Pusch(cell->instIdx, cell->raReq[ueId-1]->rachInd->crnti, k2Index, msg3Time);
+ if(msg3PuschInfo)
+ {
+ /* Fill RAR info */
+ dciSlotAlloc->rarInfo.raRnti = cell->raReq[ueId-1]->raRnti;
+ dciSlotAlloc->rarInfo.tcrnti = cell->raReq[ueId-1]->rachInd->crnti;
+ dciSlotAlloc->rarInfo.RAPID = cell->raReq[ueId-1]->rachInd->preambleIdx;
+ dciSlotAlloc->rarInfo.ta = cell->raReq[ueId-1]->rachInd->timingAdv;
+ dciSlotAlloc->rarInfo.ulGrant.bwpSize = cell->cellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb;
+ /* Spec 38.213, section 8.2, 0 : MSG3 PUSCH will be transmitted without frequency hopping */
+ dciSlotAlloc->rarInfo.ulGrant.freqHopFlag = 0;
+ dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.startPrb = msg3PuschInfo->fdAlloc.startPrb;
+ dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.numPrb = msg3PuschInfo->fdAlloc.numPrb;
+ dciSlotAlloc->rarInfo.ulGrant.k2Index = k2Index;
+ dciSlotAlloc->rarInfo.ulGrant.mcs = msg3PuschInfo->tbInfo.mcs;
+ dciSlotAlloc->rarInfo.ulGrant.tpc = 3; /* TODO : Check appropriate value to be filled */
+ /* Spec 38.213, section 8.2 : In a contention based random access
+ * procedure, the CSI request field is reserved. */
+ dciSlotAlloc->rarInfo.ulGrant.csiReq = 0;
+ }
+
+ /* Check if both DCI and RAR are sent in the same slot.
+ * If not, allocate memory RAR PDSCH slot to store RAR info
+ */
+ if(dciSlot == rarSlot)
+ dciSlotAlloc->pduPres = BOTH;
+ else
+ {
+ /* Allocate memory to schedule rarSlot to send RAR, pointer will be checked at schProcessSlotInd() */
+ SCH_ALLOC(rarSlotAlloc, sizeof(RarAlloc));
+ if(rarSlotAlloc == NULLP)
{
- /* Fill RAR info */
- dciSlotAlloc->rarInfo.raRnti = cell->raReq[ueIdx]->raRnti;
- dciSlotAlloc->rarInfo.tcrnti = cell->raReq[ueIdx]->rachInd->crnti;
- dciSlotAlloc->rarInfo.RAPID = cell->raReq[ueIdx]->rachInd->preambleIdx;
- dciSlotAlloc->rarInfo.ta = cell->raReq[ueIdx]->rachInd->timingAdv;
- dciSlotAlloc->rarInfo.ulGrant.bwpSize = cell->cellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb;
- /* Spec 38.213, section 8.2, 0 : MSG3 PUSCH will be transmitted without frequency hopping */
- dciSlotAlloc->rarInfo.ulGrant.freqHopFlag = 0;
- dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.startPrb = msg3PuschInfo->fdAlloc.startPrb;
- dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.numPrb = msg3PuschInfo->fdAlloc.numPrb;
- dciSlotAlloc->rarInfo.ulGrant.k2Index = k2Index;
- dciSlotAlloc->rarInfo.ulGrant.mcs = msg3PuschInfo->tbInfo.mcs;
- dciSlotAlloc->rarInfo.ulGrant.tpc = 3; /* TODO : Check appropriate value to be filled */
- /* Spec 38.213, section 8.2 : In a contention based random access
- * procedure, the CSI request field is reserved. */
- dciSlotAlloc->rarInfo.ulGrant.csiReq = 0;
+ DU_LOG("\nERROR --> SCH : Memory Allocation failed for rarSlotAlloc");
+ SCH_FREE(dciSlotAlloc, sizeof(RarAlloc));
+ cell->schDlSlotInfo[dciSlot]->rarAlloc[ueId-1] = NULLP;
+ return false;
}
+ cell->schDlSlotInfo[rarSlot]->rarAlloc[ueId-1] = rarSlotAlloc;
- /* Check if both DCI and RAR are sent in the same slot.
- * If not, allocate memory RAR PDSCH slot to store RAR info
- */
- if(dciSlot == rarSlot)
- dciSlotAlloc->pduPres = BOTH;
- else
- {
- /* Allocate memory to schedule rarSlot to send RAR, pointer will be checked at schProcessSlotInd() */
- SCH_ALLOC(rarSlotAlloc, sizeof(RarAlloc));
- if(rarSlotAlloc == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Memory Allocation failed for rarSlotAlloc");
- SCH_FREE(dciSlotAlloc, sizeof(RarAlloc));
- cell->schDlSlotInfo[dciSlot]->rarAlloc = NULLP;
- return;
- }
- cell->schDlSlotInfo[rarSlot]->rarAlloc = rarSlotAlloc;
+ /* Copy all RAR info */
+ memcpy(rarSlotAlloc, dciSlotAlloc, sizeof(RarAlloc));
+ rarSlotAlloc->rarPdcchCfg.dci.pdschCfg = &rarSlotAlloc->rarPdschCfg;
- /* Copy all RAR info */
- memcpy(rarSlotAlloc, dciSlotAlloc, sizeof(RarAlloc));
- rarSlotAlloc->rarPdcchCfg.dci.pdschCfg = &rarSlotAlloc->rarPdschCfg;
+ /* Assign correct PDU types in corresponding slots */
+ rarSlotAlloc->pduPres = PDSCH_PDU;
+ dciSlotAlloc->pduPres = PDCCH_PDU;
+ dciSlotAlloc->pdschSlot = rarSlot;
+ }
- /* Assign correct PDU types in corresponding slots */
- rarSlotAlloc->pduPres = PDSCH_PDU;
- dciSlotAlloc->pduPres = PDCCH_PDU;
- dciSlotAlloc->pdschSlot = rarSlot;
- }
+ cell->schDlSlotInfo[dciSlot]->pdcchUe = ueId;
+ cell->schDlSlotInfo[rarSlot]->pdschUe = ueId;
+ cell->schUlSlotInfo[msg3Time.slot]->puschUe = ueId;
- /* Create raCb at SCH */
- createSchRaCb(cell->raReq[ueIdx]->rachInd->crnti, cell->instIdx);
+ /* Create raCb at SCH */
+ createSchRaCb(cell->raReq[ueId-1]->rachInd->crnti, cell->instIdx);
- SCH_FREE(cell->raReq[ueIdx]->rachInd, sizeof(RachIndInfo));
- SCH_FREE(cell->raReq[ueIdx], sizeof(SchRaReq));
- }
- ueIdx++;
- } /* End of while(ueIdx < MAX_NUM_UE) */
+ /* Remove RachInd from pending RA request list */
+ SCH_FREE(cell->raReq[ueId-1]->rachInd, sizeof(RachIndInfo));
+ SCH_FREE(cell->raReq[ueId-1], sizeof(SchRaReq));
+
+ return true;
+ }
+ return false;
}
/**
/* Adding window size to window start time to get window end time */
ADD_DELTA_TO_TIME(raReq->winStartTime, raReq->winEndTime, winNumSlots);
-
cell->raReq[ueIdx -1] = raReq;
+ /* Adding UE Id to list of pending UEs to be scheduled */
+ addUeToBeScheduled(cell, ueIdx);
+
return ROK;
}
* @param[in] offset to pointA to determine freq alloc
* @return ROK
**/
-uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueIdx, RarAlloc *rarAlloc, uint8_t k0Index)
+uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueId, RarAlloc *rarAlloc, uint8_t k0Index)
{
uint8_t coreset0Idx = 0;
uint8_t firstSymbol = 0, numSymbols = 0;
pdcch->coresetCfg.shiftIndex = cell->cellCfg.phyCellId;
pdcch->coresetCfg.precoderGranularity = 0; /* sameAsRegBundle */
pdcch->numDlDci = 1;
- pdcch->dci.rnti = cell->raReq[ueIdx]->raRnti; /* RA-RNTI */
+ pdcch->dci.rnti = cell->raReq[ueId-1]->raRnti; /* RA-RNTI */
pdcch->dci.scramblingId = cell->cellCfg.phyCellId;
pdcch->dci.scramblingRnti = 0;
pdcch->dci.cceIndex = 4; /* considering SIB1 is sent at cce 0-1-2-3 */
/* fill the PDSCH PDU */
uint8_t cwCount = 0;
pdsch->pduBitmap = 0; /* PTRS and CBG params are excluded */
- pdsch->rnti = cell->raReq[ueIdx]->raRnti; /* RA-RNTI */
+ pdsch->rnti = cell->raReq[ueId-1]->raRnti; /* RA-RNTI */
pdsch->pduIndex = 0;
pdsch->numCodewords = 1;
for(cwCount = 0; cwCount < pdsch->numCodewords; cwCount++)
pdsch->dmrs.nrOfDmrsSymbols = NUM_DMRS_SYMBOLS;
pdsch->dmrs.dmrsAddPos = DMRS_ADDITIONAL_POS;
+ pdsch->pdschTimeAlloc.rowIndex = k0Index;
pdsch->pdschTimeAlloc.timeAlloc.startSymb = initialBwp->pdschCommon.timeDomRsrcAllocList[k0Index].startSymbol;
pdsch->pdschTimeAlloc.timeAlloc.numSymb = initialBwp->pdschCommon.timeDomRsrcAllocList[k0Index].lengthSymbol;
((ueCb->dlLcPrbEst.dedLcInfo != NULL) && (ueCb->dlLcPrbEst.dedLcInfo->dedLcList.count == 0)))
{
DU_LOG("\nDEBUG --> SCH : No pending BO for any LC id\n");
+ UNSET_ONE_BIT(ueIdx, cell->boIndBitMap);
/* Free the dl ded msg info allocated in macSchDlRlcBoInfo */
SCH_FREE(dlMsgAlloc, sizeof(DlMsgAlloc));
dlSchedInfo->dlMsgAlloc = NULLP;
- return ROK;
+ continue;
}
/*[Step3]: Calculate Best FREE BLOCK with MAX PRB count*/
* ****************************************************************/
uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst)
{
- uint8_t ueIdx, lcgIdx, ret = ROK;
- uint16_t slot;
- DlSchedInfo dlSchedInfo;
+ uint8_t ueId, ueIdx, lcgIdx, ret = ROK;
+ uint16_t slot;
+ bool isRarScheduled = false;
+ CmLList *pendingUeNode;
+ DlSchedInfo dlSchedInfo;
DlBrdcstAlloc *dlBrdcstAlloc = NULLP;
- DlMsgAlloc *dlMsgAlloc = NULLP;
- SchCellCb *cell = NULLP;
+ DlMsgAlloc *dlMsgAlloc = NULLP;
+ SchCellCb *cell = NULLP;
memset(&dlSchedInfo,0,sizeof(DlSchedInfo));
dlSchedInfo.dlMsgAlloc = NULLP;
}
}
- /* Check for Pending RA Requests */
- schProcessRaReq(*slotInd, cell);
+ /* Select first UE in the linked list to be scheduled next */
+ pendingUeNode = cell->ueToBeScheduled.first;
+ if(pendingUeNode)
+ {
+ ueId = *(uint8_t *)(pendingUeNode->node);
+
+ /* Check for Pending RA Requests */
+ if(cell->raReq[ueId-1] != NULLP)
+ {
+ isRarScheduled = schProcessRaReq(cell, *slotInd, ueId);
+ /* If RAR scheduled for this UE, remove from linked list since no
+ * pending msgs for this UE */
+ if(isRarScheduled)
+ {
+ SCH_FREE(pendingUeNode->node, sizeof(uint8_t));
+ deleteNodeFromLList(&cell->ueToBeScheduled, pendingUeNode);
+ }
+ /* If RAR couldnt be scheduled, put this UE at the end of linked
+ * list to be scheduled later */
+ else
+ {
+ cmLListAdd2Tail(&cell->ueToBeScheduled, cmLListDelFrm(&cell->ueToBeScheduled, pendingUeNode));
+ }
+ }
+ }
/* Check for RAR */
- if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarAlloc != NULLP)
+ for(ueIdx=0; ueIdx<MAX_NUM_UE; ueIdx++)
{
- slot = dlSchedInfo.schSlotValue.rarTime.slot;
- dlSchedInfo.rarAlloc = cell->schDlSlotInfo[slot]->rarAlloc;
- cell->schDlSlotInfo[slot]->rarAlloc = NULLP;
+ if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarAlloc[ueIdx] != NULLP)
+ {
+ slot = dlSchedInfo.schSlotValue.rarTime.slot;
+ dlSchedInfo.rarAlloc[ueIdx] = cell->schDlSlotInfo[slot]->rarAlloc[ueIdx];
+ cell->schDlSlotInfo[slot]->rarAlloc[ueIdx] = NULLP;
+ }
}
schProcessMsg4Req(cell, *slotInd);
* ****************************************************************/
uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete *ueDelete)
{
- uint8_t idx=0, ueIdx=0, ret=ROK;
- ErrorCause result;
+ uint8_t idx=0, ueId=0, ueIdToDel=0, ret=ROK;
+ ErrorCause result;
SchCellCb *cellCb = NULLP;
Inst inst = pst->dstInst - 1;
+ CmLList *node = NULL, *next = NULL;
#ifdef CALL_FLOW_DEBUG_LOG
DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_UE_DELETE_REQ_TO_SCH\n");
}
else
{
- GET_UE_IDX(ueDelete->crnti, ueIdx);
- if(( cellCb->ueCb[ueIdx-1].crnti == ueDelete->crnti) && ( cellCb->ueCb[ueIdx-1].state == SCH_UE_STATE_ACTIVE))
+ GET_UE_IDX(ueDelete->crnti, ueId);
+ if(( cellCb->ueCb[ueId-1].crnti == ueDelete->crnti) && ( cellCb->ueCb[ueId-1].state == SCH_UE_STATE_ACTIVE))
{
- deleteSchUeCb(&cellCb->ueCb[ueIdx-1]);
+ deleteSchUeCb(&cellCb->ueCb[ueId-1]);
+
+ /* Remove UE from ueToBeScheduled list */
+ node = cellCb->ueToBeScheduled.first;
+ while(node)
+ {
+ next = node->next;
+ ueId = *(uint8_t *)node->node;
+ if(ueId == ueIdToDel)
+ {
+ SCH_FREE(node->node, sizeof(uint8_t));
+ cmLListDelFrm(&cellCb->ueToBeScheduled, node);
+ break;
+ }
+ node = next;
+ }
cellCb->numActvUe--;
result = NOT_APPLICABLE;
}
void deleteSchCellCb(SchCellCb *cellCb)
{
uint8_t sliceIdx=0, slotIdx=0;
- CmLListCp *list;
- CmLList *node, *next;
+ CmLListCp *list=NULL;
+ CmLList *node=NULL, *next=NULL;
if(cellCb->schDlSlotInfo)
{
SCH_FREE(cellCb->cellCfg.snssai, cellCb->cellCfg.numSliceSupport*sizeof(Snssai*));
}
SCH_FREE(cellCb->cellCfg.rrmPolicy, sizeof(SchRrmPolicy));
+
+ /* Remove all UE from ueToBeScheduled list and deallocate */
+ node = cellCb->ueToBeScheduled.first;
+ while(node)
+ {
+ next = node->next;
+ SCH_FREE(node->node, sizeof(uint8_t));
+ cmLListDelFrm(&cellCb->ueToBeScheduled, node);
+ node = next;
+ }
+
memset(cellCb, 0, sizeof(SchCellCb));
}
/* MAX values */
#define MAX_NUM_CELL 1
#define MAX_NUM_MU 4
-#define MAX_NUM_UE 2
+#define MAX_NUM_UE 3
#define MAX_NUM_UE_PER_TTI 1
#define MAX_NUM_LC MAX_DRB_LCID + 1 /*Spec 38.331: Sec 6.4: maxLC-ID Keyword*/
#define MAX_NUM_SRB 3 /* Max. no of Srbs */
DlBrdcstAlloc brdcstAlloc;
/* Allocation for RAR message */
- //uint8_t isRarPres;
- RarAlloc *rarAlloc;
-
- /* Allocation from MSG4 */
- //Msg4Alloc *msg4Alloc;
+ RarAlloc *rarAlloc[MAX_NUM_UE];
/* UL grant in response to BSR */
DciInfo *ulGrant;
/*UE Ids for RACH IND*/
#define UE_IDX_0 0
#define UE_IDX_1 1
+#define UE_IDX_2 2
bool slotIndicationStarted;
uint16_t sfnValue;
numPdus--;
}
+ /* Send RACH Ind to L2 for first UE */
if(ueDb.ueCb[UE_IDX_0].rachIndSent == false && ulTtiReq->sfn == 16 && ulTtiReq->slot == 6)
{
ueDb.ueCb[UE_IDX_0].rachIndSent = true;
l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn);
ueDb.numActvUe++;
}
-
- //Following can be enabled to test with a second UE
#if 0
+ /* Send RACH Ind to L2 for second UE */
if(ueDb.ueCb[UE_IDX_1].rachIndSent == false && ulTtiReq->sfn == 304 && ulTtiReq->slot == 0)
{
ueDb.ueCb[UE_IDX_1].rachIndSent = true;
l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn);
ueDb.numActvUe++;
}
-#endif
+ /* Send RACH Ind to L2 for third UE */
+ if(ueDb.ueCb[UE_IDX_2].rachIndSent == false && ulTtiReq->sfn == 526 && ulTtiReq->slot == 0)
+ {
+ ueDb.ueCb[UE_IDX_2].rachIndSent = true;
+ l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn);
+ ueDb.numActvUe++;
+ }
+#endif
MAC_FREE(msg, msgLen);
#endif
return ROK;