[Epic-ID: ODUHIGH-][Task-ID: ODUHIGH-]WG8 alignment | Cell conf
[o-du/l2.git] / src / 5gnrsch / sch_harq_dl.c
index c5cebed..1ec31bc 100644 (file)
 #include "sch.h"
 #include "sch_utils.h"
 #include "cm_llist.h"
-
-SchMacDlReleaseHarqFunc schMacDlReleaseHarqOpts[] =
-{
-   packSchMacDlReleaseHarq,
-   MacSchReleaseDlHarqProc,
-   packSchMacDlReleaseHarq
-};
+#ifdef NR_DRX
+#include "sch_drx.h"
+#endif
 
 typedef struct schCellCb SchCellCb;
 typedef struct schUeCb SchUeCb;
@@ -56,7 +52,7 @@ void schDlHqAddToFreeList(SchDlHqProcCb *hqP);
 void schDlHqEntInit(SchCellCb *cellCb, SchUeCb *ueCb)
 {
    ueCb->dlHqEnt.numHqPrcs = SCH_MAX_NUM_DL_HQ_PROC;
-   ueCb->dlHqEnt.maxHqTx  = cellCb->cellCfg.schHqCfg.maxDlDataHqTx;
+   ueCb->dlHqEnt.maxHqTx  = cellCb->schHqCfg.maxDlDataHqTx;
    ueCb->dlHqEnt.cell = cellCb;
    ueCb->dlHqEnt.ue =ueCb;
    schDlHqEntReset(cellCb, ueCb, &ueCb->dlHqEnt);
@@ -92,6 +88,7 @@ void schDlHqEntReset(SchCellCb *cellCb, SchUeCb *ueCb, SchDlHqEnt *hqE)
       hqP->dlHqEntLnk.node = (PTR)hqP;
       hqP->dlHqProcLink.node = (PTR)hqP;
       hqP->ulSlotLnk.node = (PTR)hqP;
+      cellCb->api->SchInitDlHqProcCb(hqP);
       schDlHqAddToFreeList(hqP);
    }
 }
@@ -212,10 +209,14 @@ uint8_t schDlGetAvlHqProcess(SchCellCb *cellCb, SchUeCb *ueCb, SchDlHqProcCb **h
  **/
 void schDlReleaseHqProcess(SchDlHqProcCb *hqP)
 {
-   cmLListDeleteLList(&hqP->dlLcPrbEst.dedLcList);
-   cmLListDeleteLList(&hqP->dlLcPrbEst.defLcList);
-   schDlHqDeleteFromInUseList(hqP);
-   schDlHqAddToFreeList(hqP);
+   SchCellCb  *cellCb = NULLP;
+   if(hqP)
+   {
+      cellCb = hqP->hqEnt->cell;
+      cellCb->api->SchFreeDlHqProcCb(hqP);
+      schDlHqDeleteFromInUseList(hqP);
+      schDlHqAddToFreeList(hqP);
+   }
 }
 
 /*******************************************************************
@@ -250,7 +251,7 @@ uint8_t sendDlHarqProcReleaseToMac(SchDlHqProcCb *hqP, Inst inst)
    rlsHqInfo->ueHqInfo[0].crnti = hqP->hqEnt->ue->crnti;
    rlsHqInfo->ueHqInfo[0].hqProcId = hqP->procId;   
 
-   return(*schMacDlReleaseHarqOpts[pst.selector])(&pst, rlsHqInfo);
+   return(MacMessageRouter(&pst, (void *)rlsHqInfo));
 }
 /**
  * @brief Release Harq process TB from the DL Harq process
@@ -312,7 +313,7 @@ void schDlHqTbFail(SchDlHqProcCb *hqP, uint8_t tbIdx, bool isMaxRetx)
       hqP->tbInfo[tbIdx].state = HQ_TB_NACKED;
       if (HQ_TB_WAITING == hqP->tbInfo[tbIdx^1].state)
       {
-         cmLListAdd2Tail( &(hqP->hqEnt->ue->dlRetxHqList), &hqP->dlHqProcLink);
+         hqP->hqEnt->cell->api->SchAddToDlHqRetxList(hqP);
       }
    }
 }
@@ -342,17 +343,18 @@ void schMsg4FeedbackUpdate(SchDlHqProcCb *hqP, uint8_t fdbk)
    }
    else
    {
-      if( hqP->tbInfo[0].txCntr >= hqP->hqEnt->cell->cellCfg.schHqCfg.maxMsg4HqTx)
+      if( hqP->tbInfo[0].txCntr >= hqP->hqEnt->cell->schHqCfg.maxMsg4HqTx)
       {
          schDlReleaseHqProcess(hqP);
-         hqP->hqEnt->ue->msg4Proc = NULLP;
+         hqP->hqEnt->ue->msg4HqProc = NULLP;
          hqP->hqEnt->ue->retxMsg4HqProc = NULLP;
          /* Delete UE and RA context */
       }
-      addUeToBeScheduled(hqP->hqEnt->cell,hqP->hqEnt->ue->ueId);
+      hqP->hqEnt->cell->api->SchAddUeToSchedule(hqP->hqEnt->cell,hqP->hqEnt->ue->ueId);
       hqP->hqEnt->ue->retxMsg4HqProc = hqP;
    }
 }
+
 /**
  * @brief Handles Harq feedback for DL Data
  *
@@ -392,12 +394,40 @@ void schDlHqFeedbackUpdate(SchDlHqProcCb *hqP, uint8_t fdbk1, uint8_t fdbk2)
             else
             {
                schDlHqTbFail(hqP, tbIdx, FALSE);
-               addUeToBeScheduled(hqP->hqEnt->cell, hqP->hqEnt->ue->ueId);
             }
          }
       }
    }
 }
+
+/**
+ * @brief Deletes HARQ Entity
+ *
+ * @details
+ *
+ *     Function : schDlHqEntDelete
+ *      
+ *      This function deletes HARQ entity and its member paremeters
+ *           
+ *  @param[in]  Pointer to UE
+ *  @return  
+ *      -# void
+ **/
+void schDlHqEntDelete(SchUeCb *ueCb)
+{
+  uint8_t count;
+  SchDlHqProcCb *hqP;
+
+  cmLListDeleteLList(&ueCb->dlHqEnt.free);
+  cmLListDeleteLList(&ueCb->dlHqEnt.inUse);
+  for(count=0; count < ueCb->dlHqEnt.numHqPrcs; count++)
+  {
+     hqP = &(ueCb->dlHqEnt.procs[count]);
+     ueCb->cellCb->api->SchDeleteDlHqProcCb(hqP);
+  }
+  memset(&ueCb->dlHqEnt, 0, sizeof(SchDlHqEnt));
+}
+
 /**********************************************************************
   End of file
  **********************************************************************/