X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrsch%2Fsch_crc.c;fp=src%2F5gnrsch%2Fsch_crc.c;h=4aa9f81c1c0fcf92108af8b099bcf130fab1de99;hb=2c0a8253f51c046ed8f291e14e13cde42a43a109;hp=0000000000000000000000000000000000000000;hpb=e2417efa29f0d317a3ed1044ee20cc14df32e1d3;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch_crc.c b/src/5gnrsch/sch_crc.c new file mode 100644 index 000000000..4aa9f81c1 --- /dev/null +++ b/src/5gnrsch/sch_crc.c @@ -0,0 +1,115 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + *******************************************************************************/ +#include "common_def.h" +#include "tfu.h" +#include "lrg.h" +#include "tfu.x" +#include "lrg.x" +#include "du_log.h" +#include "du_app_mac_inf.h" +#include "mac_sch_interface.h" +#include "sch.h" +#include "sch_utils.h" + +/** + * @brief Process CRC indication + * + * @details + * + * Function : schProcessCrcInd + * + * This function process CRC indication + * + * @param[in] CrcIndInfo *crcInd, recvd crc indication + * @param[in] Inst schInst, scheduler inst + * @return + * -# ROK + * -# RFAILED + **/ +uint8_t schProcessCrcInd(CrcIndInfo *crcInd, Inst schInst) +{ + SchCellCb *cell = schCb[schInst].cells[schInst]; + uint16_t count=0; + uint8_t ueId=0; + SchUlHqProcCb *hqP = NULLP; + + while(count numCrcInd) + { + GET_UE_ID(crcInd->crnti, ueId); + if (cell->raCb[ueId-1].raState == SCH_RA_STATE_MSG3_PENDING) + { + if (crcInd->crcInd[count]) + { + /* failure case*/ + if (cell->raCb[ueId-1].msg3HqProc.tbInfo.txCntr < cell->cellCfg.schRachCfg.maxMsg3Tx) + { + addUeToBeScheduled(cell, ueId); + cell->raCb[ueId - 1].retxMsg3HqProc = &cell->raCb[ueId - 1].msg3HqProc; + } + else + { + /*Release all contexts of the UE RA*/ + } + } + else + { + /* pass case*/ + /*Dedicated preamble case need to be added*/ + cell->raCb[ueId-1].raState = SCH_RA_STATE_MSG4_PENDING; + /*HARQ init part is in ADD UE CONFIG now, could be moved here*/ + } + } + else + { + if (cell->ueCb[ueId-1].hqUlmap[crcInd->timingInfo.slot]->hqList.count == 0) + { + DU_LOG("\n ERROR no harq stored in ul hq map at slot %d ue id %d\n",crcInd->timingInfo.slot, ueId); + continue; + } + if (cell->ueCb[ueId-1].hqUlmap[crcInd->timingInfo.slot]->hqList.first == 0) + { + DU_LOG("\n ERROR NULL harq stored in ul hq map at slot %d ue id %d\n",crcInd->timingInfo.slot, ueId); + continue; + } + hqP = (SchUlHqProcCb*) cell->ueCb[ueId-1].hqUlmap[crcInd->timingInfo.slot]->hqList.first->node; + if(hqP == NULLP) + { + continue; + } + else + { + if (crcInd->crcInd[count]) + { + /* failure case*/ + schUlHqProcessNack(hqP); + } + else + { + /* pass case*/ + schUlHqProcessAck(hqP); + } + } + cmLListDelFrm(&(cell->ueCb[ueId-1].hqUlmap[crcInd->timingInfo.slot]->hqList), &hqP->ulSlotLnk); + } + count++; + } + return ROK; +} +/********************************************************************** + End of file + **********************************************************************/ \ No newline at end of file