Merge "[Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-425] Changes in Ue Context Modificatio...
authorHarshita Lal <harshita.lal@radisys.com>
Mon, 28 Mar 2022 05:46:40 +0000 (05:46 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Mon, 28 Mar 2022 05:46:40 +0000 (05:46 +0000)
1  2 
src/5gnrmac/mac_msg_hdl.c
src/du_app/du_f1ap_msg_hdl.c

@@@ -186,14 -186,26 +186,26 @@@ uint8_t fapiMacCrcInd(Pst *pst, CrcInd 
   * ****************************************************************/
  uint8_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd)
  {
-    uint16_t pduIdx;
+    uint8_t ueId = 0;
+    uint16_t pduIdx, cellIdx = 0;
     DU_LOG("\nDEBUG  -->  MAC : Received Rx Data indication");
     /* TODO : compare the handle received in RxDataInd with handle send in PUSCH
      * PDU, which is stored in raCb */
  
     for(pduIdx = 0; pduIdx < rxDataInd->numPdus; pduIdx++)
     {
-       unpackRxData(rxDataInd->cellId, rxDataInd->timingInfo, &rxDataInd->pdus[pduIdx]);
+      
+       GET_CELL_IDX(rxDataInd->cellId, cellIdx);
+       GET_UE_ID(rxDataInd->pdus[pduIdx].rnti, ueId);
+       
+       if(macCb.macCell[cellIdx] && macCb.macCell[cellIdx]->ueCb[ueId -1].transmissionAction == STOP_TRANSMISSION)
+       {
+          DU_LOG("\nINFO   -->  MAC : UL data transmission not allowed for UE %d", macCb.macCell[cellIdx]->ueCb[ueId -1].duUeF1apId);
+       }
+       else
+       {
+          unpackRxData(rxDataInd->cellId, rxDataInd->timingInfo, &rxDataInd->pdus[pduIdx]);
+       }
        MAC_FREE_SHRABL_BUF(pst->region, pst->pool, rxDataInd->pdus[pduIdx].pduData,\
           rxDataInd->pdus[pduIdx].pduLength);
     }
@@@ -343,11 -355,10 +355,11 @@@ uint8_t lcId, uint16_t pduLen, uint8_t 
     ulData->slotInfo.cellId = cellId;
  
     /* Filling pdu info */
 -   if(lcId == SRB1_LCID || lcId == SRB2_LCID)
 -   {
 +   if(lcId != SRB0_LCID)
 +      ulData->pduInfo[ulData->numPdu].commCh = false;
 +   else
        ulData->pduInfo[ulData->numPdu].commCh = true;
 -   }
 +
     ulData->pduInfo[ulData->numPdu].lcId = lcId;
     ulData->pduInfo[ulData->numPdu].pduBuf = pdu;
     ulData->pduInfo[ulData->numPdu].pduLen = pduLen;
@@@ -772,10 -783,8 +784,8 @@@ uint8_t buildAndSendSrInd(UciInd *macUc
   * ****************************************************************/
  uint8_t FapiMacUciInd(Pst *pst, UciInd *macUciInd)
  {
-    uint8_t     pduIdx = 0;
-    uint8_t     ret = ROK;
-    uint16_t    nPdus;
-    uint16_t    crnti;
+    uint8_t     pduIdx = 0, ret = ROK;
+    uint16_t    nPdus = 0, crnti = 0;
  
     if(macUciInd)
     {
                 if(macUciInd->pdus[pduIdx].uci.uciPucchF0F1.srInfo.srIndPres)
                 {
                    DU_LOG("\nDEBUG  -->  MAC : Received SR UCI indication");
-                 crnti = macUciInd->pdus[pduIdx].uci.uciPucchF0F1.crnti; 
-                 ret = buildAndSendSrInd(macUciInd, crnti);
+                   crnti = macUciInd->pdus[pduIdx].uci.uciPucchF0F1.crnti; 
+                   ret = buildAndSendSrInd(macUciInd, crnti);
                 }
                 break;
              case UCI_IND_PUCCH_F2F3F4:
@@@ -13966,6 -13966,13 +13966,13 @@@ uint8_t BuildDrbSetupModList(DRBs_Setup
     struct DRBs_SetupMod_ItemIEs *drbItemIe;
  
     drbCnt = ueCfg->numDrbSetupMod;
+    if(!drbCnt)
+    {
+       DU_LOG("\nINFO  -->  F1AP : BuildDrbToBeSetupModList(): No DRB information to avaialble to add");
+       return ROK;
+    }
     drbSet->list.count = drbCnt;
     drbSet->list.size = drbCnt * sizeof(DRBs_SetupMod_ItemIEs_t *);
     DU_ALLOC(drbSet->list.array, drbSet->list.size);
@@@ -14162,7 -14169,12 +14169,12 @@@ uint8_t BuildAndSendUeContextModRsp(DuU
        ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
    
        if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
-          elementCnt = 3;
+       {
+          if(ueCb->f1UeDb->duUeCfg.numDrbSetupMod)
+             elementCnt =3;
+          else
+             elementCnt =2;
+       }
        if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
           elementCnt = 5;
        if(ueCb->f1UeDb->actionType == UE_CTXT_RRC_RECFG_COMPLETE)
        }
  
        if((ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY) || (ueCb->f1UeDb->actionType == UE_CTXT_MOD))
-       {
-          ieIdx++;
-          ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_SetupMod_List;
-          ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
-          ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
-                                                                            UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List;
-          if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
+       { 
+          if(ueCb->f1UeDb->duUeCfg.numDrbSetupMod)
           {
-             for(tnlIdx = 0; tnlIdx < duCb.numTeId; tnlIdx++)
+             ieIdx++;
+             ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_SetupMod_List;
+             ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+             ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
+                                                                               UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List;
+             if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
              {
-                if(duCb.upTnlCfg[tnlIdx]->ueId == ueCb->gnbDuUeF1apId)
+                for(tnlIdx = 0; tnlIdx < duCb.numTeId; tnlIdx++)
                 {
-                   memcpy(&ueCb->f1UeDb->duUeCfg.upTnlInfo[ueCb->f1UeDb->duUeCfg.numDrbSetupMod++], duCb.upTnlCfg[tnlIdx], sizeof(UpTnlCfg));
+                   if(duCb.upTnlCfg[tnlIdx]->ueId == ueCb->gnbDuUeF1apId)
+                   {
+                      memcpy(&ueCb->f1UeDb->duUeCfg.upTnlInfo[ueCb->f1UeDb->duUeCfg.numDrbSetupMod++], duCb.upTnlCfg[tnlIdx], sizeof(UpTnlCfg));
+                   }
                 }
              }
-          }
-          ret = BuildDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
-                   value.choice.DRBs_SetupMod_List) , &ueCb->f1UeDb->duUeCfg);
-          if(ret != ROK)
-          {
-             DU_LOG( "\nERROR  -->  F1AP : Failed to build DRB setupmod List ");
-             break;
+             ret = BuildDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
+                      value.choice.DRBs_SetupMod_List) , &ueCb->f1UeDb->duUeCfg);
+             if(ret != ROK)
+             {
+                DU_LOG( "\nERROR  -->  F1AP : Failed to build DRB setupmod List ");
+                break;
+             }
           }
        }
  
           ret = RFAILED;
           break;
        }
 +
 +      ret = ROK;
        break;
     }
     FreeUeContextModResp(f1apMsg);
@@@ -14522,17 -14535,17 +14537,17 @@@ void freeAperDecodeDrbToBeSetupModList(
   * @return void
   *
   * ****************************************************************/
- void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *UeContextModifyReq )
+ void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *ueContextModifyReq )
  {
     uint8_t arrIdx, ieId;
  
-    if(UeContextModifyReq->protocolIEs.list.array)
+    if(ueContextModifyReq->protocolIEs.list.array)
     {
-       for( arrIdx = 0 ; arrIdx<UeContextModifyReq->protocolIEs.list.count ; arrIdx++)
+       for( arrIdx = 0 ; arrIdx<ueContextModifyReq->protocolIEs.list.count ; arrIdx++)
        {
-          if(UeContextModifyReq->protocolIEs.list.array[arrIdx])
+          if(ueContextModifyReq->protocolIEs.list.array[arrIdx])
           {
-             ieId = UeContextModifyReq->protocolIEs.list.array[arrIdx]->id;
+             ieId = ueContextModifyReq->protocolIEs.list.array[arrIdx]->id;
              switch(ieId)
              {
                 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
                    break;
                 case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
                    {
-                      freeAperDecodeDrbToBeSetupModList(&UeContextModifyReq->protocolIEs.list.array[arrIdx]->\
+                      freeAperDecodeDrbToBeSetupModList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->\
                             value.choice.DRBs_ToBeSetupMod_List);
                       break;
                    }
+                case ProtocolIE_ID_id_TransmissionActionIndicator:
+                   break;
+                case ProtocolIE_ID_id_RRCContainer:
+                   {
+                      free(ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.choice.RRCContainer.buf);
+                   }
              }
-             free(UeContextModifyReq->protocolIEs.list.array[arrIdx]);
+             free(ueContextModifyReq->protocolIEs.list.array[arrIdx]);
           }
        }
-       free(UeContextModifyReq->protocolIEs.list.array);
+       free(ueContextModifyReq->protocolIEs.list.array);
     }
  }
  /*******************************************************************
@@@ -14602,6 -14621,7 +14623,7 @@@ uint8_t procF1UeContextModificationReq(
                             {
                                DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
                                duUeCb->f1UeDb->cellIdx = cellIdx;
+                               duUeCb->f1UeDb->actionType = UE_CTXT_MOD;
                             }
                             break;
                          }
                 }
                 break;
              }
+          case ProtocolIE_ID_id_RRCContainer:
+             {
+                /* Filling Dl RRC Msg Info */
+                DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+                if(!duUeCb->f1UeDb->dlRrcMsg)
+                {
+                   DU_LOG("\nERROR  -->  DU APP : procF1UeContextReleaseCommand(): \
+                         Memory allocation failed ");
+                   ret = RFAILED;
+                }
+                else
+                {
+                   duUeCb->f1UeDb->dlRrcMsgPres = true;
+                   memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
+                   ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
+                         &ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
+                         value.choice.RRCContainer);
+                }
+                break;
+             }
           case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
           case ProtocolIE_ID_id_DRBs_ToBeModified_List:
              {
                 if(duUeCb->f1UeDb)
                 {
-                   duUeCb->f1UeDb->actionType = UE_CTXT_MOD;
                    if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present ==\
                          UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List)
                    {
                 }
                 break;
              }
+          case ProtocolIE_ID_id_TransmissionActionIndicator:
+             {
+                if(duUeCb->f1UeDb)
+                {
+                   if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.TransmissionActionIndicator  == TransmissionActionIndicator_stop)
+                   {
+                      duUeCb->f1UeDb->duUeCfg.dataTransmissionAction = STOP_TRANSMISSION; 
+                   }
+                   else 
+                   {
+                      duUeCb->f1UeDb->duUeCfg.dataTransmissionAction = RESTART_TRANSMISSION; 
+                   }
+                }
+                break;
+             }
+          case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
+             {
+                if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
+                {
+                   duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true;
+                }
+                break;
+             }
+               
        }
     }