[Epic-ID: ODUHIGH-462][Task-ID: ODUHIGH-472] Handling of drx timer in SCH [storing...
[o-du/l2.git] / src / 5gnrmac / mac_ue_mgr.c
index 06953b4..fda65cf 100644 (file)
@@ -136,6 +136,32 @@ uint8_t fillMacCellGroupCfg(MacCellGrpCfg macCellGrp, SchMacCellGrpCfg  *macCell
       macCellGrpCfg->phrCfg.modeOtherCG = macCellGrp.phrCfg.phrOtherCG;
    }
 
+#ifdef NR_DRX
+   /* Copy Drx configuration */
+   macCellGrpCfg->drxCfgPresent = true;
+   macCellGrpCfg->drxCfg.drxOnDurationTimer.onDurationTimerValInMs = macCellGrp.drxCfg.drxOnDurationTimer.onDurationTimerValInMs;
+   if(!macCellGrp.drxCfg.drxOnDurationTimer.onDurationTimerValInMs)
+      macCellGrpCfg->drxCfg.drxOnDurationTimer.onDurationtimerValue.subMilliSeconds = \
+      macCellGrp.drxCfg.drxOnDurationTimer.onDurationtimerValue.subMilliSeconds;
+   else
+      macCellGrpCfg->drxCfg.drxOnDurationTimer.onDurationtimerValue.milliSeconds = \
+      macCellGrp.drxCfg.drxOnDurationTimer.onDurationtimerValue.milliSeconds;
+   macCellGrpCfg->drxCfg.drxInactivityTimer = macCellGrp.drxCfg.drxInactivityTimer;
+   macCellGrpCfg->drxCfg.drxHarqRttTimerDl = macCellGrp.drxCfg.drxHarqRttTimerDl;
+   macCellGrpCfg->drxCfg.drxHarqRttTimerUl = macCellGrp.drxCfg.drxHarqRttTimerUl;
+   macCellGrpCfg->drxCfg.drxRetransmissionTimerDl = macCellGrp.drxCfg.drxRetransmissionTimerDl;
+   macCellGrpCfg->drxCfg.drxRetransmissionTimerUl = macCellGrp.drxCfg.drxRetransmissionTimerUl;
+   macCellGrpCfg->drxCfg.drxLongCycleStartOffset.drxLongCycleStartOffsetChoice = macCellGrp.drxCfg.drxLongCycleStartOffset.\
+                                                                              drxLongCycleStartOffsetChoice;
+   macCellGrpCfg->drxCfg.drxLongCycleStartOffset.drxLongCycleStartOffsetVal = macCellGrp.drxCfg.drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
+   macCellGrpCfg->drxCfg.shortDrxPres = macCellGrp.drxCfg.shortDrxPres;
+   if(macCellGrpCfg->drxCfg.shortDrxPres)
+   {
+      macCellGrpCfg->drxCfg.shortDrx.drxShortCycle = macCellGrp.drxCfg.shortDrx.drxShortCycle;
+      macCellGrpCfg->drxCfg.shortDrx.drxShortCycleTimer = macCellGrp.drxCfg.shortDrx.drxShortCycleTimer;
+   }
+   macCellGrpCfg->drxCfg.drxSlotOffset = macCellGrp.drxCfg.drxSlotOffset;
+#endif
    return ROK;
 }
 
@@ -1684,6 +1710,11 @@ uint8_t fillSchUeCfg(Pst *pst, SchUeCfg *schUeCfg, MacUeCfg *ueCfg)
       DU_LOG("\nERROR  -->  MAC : Failed to copy LCs at fillSchUeCfg()");
       return ret;
    }
+
+#ifdef NR_DRX
+   schUeCfg->drxConfigIndicatorRelease = ueCfg->drxConfigIndicatorRelease;;
+#endif
+   
    return ret;
 }
 
@@ -2071,7 +2102,7 @@ void deleteMacRaCb(uint16_t cellIdx, MacUeCb *ueCb)
       for(tbIdx = 0; tbIdx < raCb->msg4HqInfo.numTb; tbIdx++)
       {
          MAC_FREE(raCb->msg4HqInfo.tbInfo[tbIdx].tb, \
-               raCb->msg4HqInfo.tbInfo[tbIdx].tbSize);
+               raCb->msg4HqInfo.tbInfo[tbIdx].tbSize - TX_PAYLOAD_HDR_LEN);
       }
       memset(raCb, 0, sizeof(MacRaCbInfo));
    }
@@ -2708,10 +2739,10 @@ void deletePucchResourcesCfg(PucchResrcCfg *resrcCfg)
 *
 * @details
 *
-*    Function : MacProcSchUeCfgRsp
+*    Function : MacProcSchUeDeleteRsp 
 *
 *    Functionality:
-*      Processes UE create delete from scheduler
+*      Processes UE delete from scheduler
 *
 * @params[in] Pst : Post structure
 *             schUeDelRsp : Scheduler UE delete respons
@@ -2722,10 +2753,11 @@ void deletePucchResourcesCfg(PucchResrcCfg *resrcCfg)
 
 uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp)
 {
-   uint8_t ueId =0, isCrntiValid = 0;
+   uint8_t ueId =0, isCrntiValid = 0, tbIdx =0, idx=0;
    uint16_t cellIdx=0;
    uint8_t ret = RFAILED;
    UeDeleteStatus result;
+   DlHarqEnt  *dlHarqEnt;
 
 #ifdef CALL_FLOW_DEBUG_LOG
    DU_LOG("\nCall Flow: ENTSCH -> ENTMAC : EVENT_UE_DELETE_RSP_TO_MAC\n");
@@ -2764,9 +2796,21 @@ uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp)
                      MAC_FREE(macCb.macCell[cellIdx]->ueCb[ueId -1].dlInfo.lcCb[lcIdx].snssai, sizeof(Snssai));
                   }
 #endif
+                  dlHarqEnt = &macCb.macCell[cellIdx]->ueCb[ueId -1].dlInfo.dlHarqEnt;
+                  for(idx =0 ; idx<MAX_NUM_HARQ_PROC; idx++)
+                  {
+                     tbIdx = 0;
+                     while(dlHarqEnt->harqProcCb[idx].numTb)
+                     {
+
+                        MAC_FREE(dlHarqEnt->harqProcCb[idx].tbInfo[tbIdx].tb, dlHarqEnt->harqProcCb[idx].tbInfo[tbIdx].tbSize);
+                        dlHarqEnt->harqProcCb[idx].numTb--;
+                        tbIdx++;
+                     }
+                  }
                   memset(&macCb.macCell[cellIdx]->ueCb[ueId -1], 0, sizeof(MacUeCb));
                   macCb.macCell[cellIdx]->numActvUe--;
-                  result = SUCCESS;
+                  result = DEL_SUCCESSFUL;
                   ret = ROK;
                }
                else
@@ -2857,7 +2901,7 @@ uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete)
 {
    uint8_t ret = ROK;
    uint8_t cellIdx=0;
-   UeDeleteStatus result=SUCCESS;
+   UeDeleteStatus result=DEL_SUCCESSFUL;
    MacUeCb  *ueCb = NULLP;
    MacCellCb *cellCb = NULLP;
 
@@ -2891,7 +2935,7 @@ uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete)
          result = CELLID_INVALID;
       }
 
-      if(result != SUCCESS)
+      if(result != DEL_SUCCESSFUL)
       {
          MacSendUeDeleteRsp(ueDelete->cellId, ueDelete->crnti, result);
          MAC_FREE_SHRABL_BUF(pst->region, pst->pool, ueDelete, sizeof(MacUeDelete));