<JIRA ID: ODUHIGH-368 : Slice information associated during PDU session establishment... 16/6716/10
authorlal.harshita <Harshita.Lal@radisys.com>
Thu, 30 Sep 2021 11:42:49 +0000 (17:12 +0530)
committerlal.harshita <Harshita.Lal@radisys.com>
Mon, 4 Oct 2021 09:23:42 +0000 (14:53 +0530)
Change-Id: If3f5482709afeacea1c47c92215ad8be17e24768
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
src/5gnrmac/mac.h
src/5gnrmac/mac_ue_mgr.c
src/5gnrsch/sch.c
src/5gnrsch/sch.h
src/5gnrsch/sch_ue_mgr.c
src/cm/common_def.h
src/cu_stub/cu_f1ap_msg_hdl.c
src/cu_stub/cu_f1ap_msg_hdl.h
src/du_app/du_f1ap_msg_hdl.c

index 6064e58..b33ec31 100644 (file)
@@ -152,16 +152,28 @@ typedef struct dlHarqEnt
 /* Uplink deidcated logical channel info */
 typedef struct ulLcCb
 {
-   uint8_t   lcId;      /* Logical Channel Id */
-   uint8_t   lcGrpId;   /* Logical Channel group */
-   MacLcState lcActive;  /* Is LC active ? */
+   uint8_t    lcId;         /* Logical Channel Id */
+   uint8_t    lcGrpId;      /* Logical Channel group */
+   MacLcState lcActive;     /* Is LC active ? */
+   /*Commenting as S-NSSAI and PDU session will be used in future scope*/
+   /*For eg: When we have to send these for AMBR cases*/
+   #if 0
+   uint16_t   pduSessionId; /*Pdu Session Id*/
+   Snssai     *snssai;      /*S-NSSAI assoc with LCID*/
+   #endif
 }UlLcCb;
 
 /* Downlink dedicated logical channel info */
 typedef struct dlLcCb
 {
-   uint8_t   lcId;      /* Logical channel Id */ 
-   MacLcState   lcState;  /* Is LC active ? */
+   uint8_t    lcId;        /* Logical channel Id */ 
+   MacLcState lcState;     /* Is LC active ? */
+   /*Commenting as S-NSSAI and PDU session will be used in future scope*/
+   /*For eg: When we have to send these info via FAPI to phy layer*/
+   #if 0
+   uint16_t   pduSessionId;/*Pdu Session Id*/
+   Snssai     *snssai;    /*S-NSSAI assoc with LCID*/
+   #endif
 }DlLcCb;
 
 /* BSR Information */
index cb28673..0ee59e2 100644 (file)
@@ -1711,6 +1711,21 @@ void updateMacUlCb(uint8_t delIdx, UeUlCb *ulCb)
       memcpy(&ulCb->lcCb[lcIdx], &ulCb->lcCb[lcIdx+1], sizeof(UlLcCb));
       memset(&ulCb->lcCb[lcIdx+1], 0, sizeof(UlLcCb));
    }
+   /*Commenting as S-NSSAI and PDU session will be stored in MAC DB in future scope*/
+#if 0
+   /*Checking the Memory Leakage of Last Index*/
+   if(ulCb->lcCb[ulCb->numUlLc].snssai != NULLP)
+   {
+      DU_LOG("ERROR  --> MAC: updateMacUlCb Last index deleted :%d  memory is leaking",\
+            ulCb->numUlLc);
+      MAC_FREE(ulCb->lcCb[ulCb->numUlLc].snssai, sizeof(Snssai));
+   }
+   else
+   {
+      DU_LOG("INFO  --> MAC: updateMacUlCb Last index:%d (before deletion) memory is freed successfully",\
+            ulCb->numUlLc);
+   }
+#endif
 }
 
 /*******************************************************************
@@ -1738,8 +1753,141 @@ void updateMacDlCb(uint8_t delIdx, UeDlCb *dlCb)
       memcpy(&dlCb->lcCb[lcIdx], &dlCb->lcCb[lcIdx+1], sizeof(DlLcCb));
       memset(&dlCb->lcCb[lcIdx+1], 0, sizeof(DlLcCb));
    }
+   /*Commenting as S-NSSAI and PDU session will be stored in MAC DB in future scope*/
+#if 0
+   /*Checking the Memory Leakage of Last Index*/
+   if(dlCb->lcCb[dlCb->numDlLc].snssai != NULLP)
+   {
+      DU_LOG("ERROR  --> MAC: updateMacDlCb Last Deleted index:%d memory is leaking",\
+            dlCb->numDlLc);
+      MAC_FREE(dlCb->lcCb[dlCb->numDlLc].snssai, sizeof(Snssai));
+   }
+   else
+   {
+      DU_LOG("INFO  --> MAC: updateMacDlCb Last index:%d (before deletion) memory is freed successfully",\
+            dlCb->numDlLc);
+   }
+#endif
 }
 
+/*******************************************************************
+ *
+ * @brief Update Mac UL Lc List based on CONFIG_MOD/CONFIG_DEL
+ *
+ * @details
+ *
+ *    Function : updateMacUlLcCtxt
+ *
+ *    Functionality: Update UeUlCb Lc List
+ *
+ * @params[in]  UeUlCb pointer, ueLcCfg(received from DUAPP)
+ * @return void
+ *
+ * ****************************************************************/
+void updateMacUlLcCtxt(UeUlCb *ulInfo, LcCfg *ueLcCfg)
+{
+   uint8_t ueLcIdx = 0; 
+
+   /*Traversing UL LC to be updated/Deleted*/
+   for(ueLcIdx = 0; ueLcIdx < ulInfo->numUlLc; ueLcIdx++)
+   {
+      if(ulInfo->lcCb[ueLcIdx].lcId == ueLcCfg->lcId)
+      {
+         if(ueLcCfg->configType == CONFIG_MOD)
+         {
+            /*Modify UL LC CB */
+            ulInfo->lcCb[ueLcIdx].lcGrpId = ueLcCfg->ulLcCfg.lcGroup;
+
+            /*Commenting as S-NSSAI and PDU session will be stored in MAC DB in future scope*/
+#if 0
+            /*Modifying/Copying PduSession ID and S-NSSAI into MAC's UECB*/
+            if(ueLcCfg->drbQos)
+            {
+               ulInfo->lcCb[ueLcIdx].pduSessionId = ueLcCfg->drbQos->pduSessionId;
+            }
+            if(ueLcCfg->snssai)
+            {
+               if(ulInfo->lcCb[ueLcIdx].snssai == NULLP)
+               {
+                  MAC_ALLOC(ulInfo->lcCb[ueLcIdx].snssai, sizeof(Snssai));
+               }
+
+               memcpy(ulInfo->lcCb[ueLcIdx].snssai, ueLcCfg->snssai, sizeof(Snssai));
+            }
+#endif
+            DU_LOG("\nINFO  -->  MAC: Successfully Modified LC context for lcId[%d], ueLcIdx:%d",\
+                  ueLcCfg->lcId,ueLcIdx);
+            break;
+         }
+         if(ueLcCfg->configType == CONFIG_DEL)
+         {
+            memset(&ulInfo->lcCb[ueLcIdx], 0, sizeof(UlLcCb));
+            (ulInfo->numUlLc)--;
+            updateMacUlCb(ueLcIdx, ulInfo);
+            DU_LOG("\nINFO  -->  MAC: Successfully Deleted LC context for lcId[%d]", ueLcCfg->lcId);
+            break;
+         }
+      }
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Update Mac DL Lc List based on CONFIG_MOD/CONFIG_DEL
+ *
+ * @details
+ *
+ *    Function : updateMacDlLcCtxt
+ *
+ *    Functionality: Update UeDlCb Lc List
+ *
+ * @params[in]  UeDlCb pointer, ueLcCfg(received from DUAPP)
+ * @return void
+ *
+ * ****************************************************************/
+void updateMacDlLcCtxt(UeDlCb *dlInfo, LcCfg *ueLcCfg)
+{
+   uint8_t ueLcIdx = 0; 
+
+   /*Traversing DL LC to be updated/Deleted*/
+   for(ueLcIdx = 0; ueLcIdx < dlInfo->numDlLc; ueLcIdx++)
+   {
+      if(dlInfo->lcCb[ueLcIdx].lcId == ueLcCfg->lcId)
+      {
+         if(ueLcCfg->configType == CONFIG_MOD)
+         {
+            /*Commenting as S-NSSAI and PDU session will be stored in MAC DB in future scope*/
+#if 0
+            /*Modifying/Copying PduSession ID and S-NSSAI into MAC's UECB*/
+            if(ueLcCfg->drbQos)
+            {
+               dlInfo->lcCb[ueLcIdx].pduSessionId = ueLcCfg->drbQos->pduSessionId;
+            }
+            if(ueLcCfg->snssai)
+            {
+               if(dlInfo->lcCb[ueLcIdx].snssai == NULLP)
+               {
+                  MAC_ALLOC(dlInfo->lcCb[ueLcIdx].snssai, sizeof(Snssai));
+               }
+
+               memcpy(dlInfo->lcCb[ueLcIdx].snssai, ueLcCfg->snssai, sizeof(Snssai));
+            }
+#endif
+            DU_LOG("\nINFO  -->  MAC: Successfully Modified LC context for lcId[%d], ueLcIdx:%d",\
+                  ueLcCfg->lcId,ueLcIdx);
+            break;
+         }
+         if(ueLcCfg->configType == CONFIG_DEL)
+         {
+            memset(&dlInfo->lcCb[ueLcIdx], 0, sizeof(DlLcCb));
+            (dlInfo->numDlLc)--;
+            updateMacDlCb(ueLcIdx, dlInfo);
+            DU_LOG("\nINFO  -->  MAC: Successfully Deleted LC context for lcId[%d]", ueLcCfg->lcId);
+            break;
+         }
+      }
+   }
+}
 /*******************************************************************
  *
  * @brief Fills Logical channel Cfg List to Add/Mod/Del
@@ -1758,7 +1906,7 @@ void updateMacDlCb(uint8_t delIdx, UeDlCb *dlCb)
 
 uint8_t fillMacLcCfgList(MacUeCb *ueCb, MacUeCfg *ueCfg)
 {
-   uint8_t lcIdx, ueLcIdx;
+   uint8_t lcIdx = 0;
 
    for(lcIdx = 0; lcIdx < ueCfg->numLcs; lcIdx++)
    {
@@ -1766,45 +1914,50 @@ uint8_t fillMacLcCfgList(MacUeCb *ueCb, MacUeCfg *ueCfg)
       {
          if(ueCfg->lcCfgList[lcIdx].configType == CONFIG_ADD)
          {
-           /*Filling DL LC CB */
+            /*Commenting as S-NSSAI and PDU session will be stored in MAC DB in future scope*/
+#if 0
+            /*Copying PduSession ID and S-NSSAI into MAC's UECB*/
+            if(ueCfg->lcCfgList[lcIdx].drbQos)
+            {
+               ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].pduSessionId = \
+                                                                      ueCfg->lcCfgList[lcIdx].drbQos->pduSessionId;
+
+               ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].pduSessionId = \
+                                                                      ueCfg->lcCfgList[lcIdx].drbQos->pduSessionId;
+            }
+            if(ueCfg->lcCfgList[lcIdx].snssai)
+            {
+               if(ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].snssai == NULLP)
+               {
+                  MAC_ALLOC(ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].snssai, sizeof(Snssai));
+               }
+               if(ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].snssai == NULLP)
+               {
+                  MAC_ALLOC(ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].snssai, sizeof(Snssai));
+               }
+
+               memcpy(ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].snssai, \
+                     ueCfg->lcCfgList[lcIdx].snssai, sizeof(Snssai));
+
+               memcpy(ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].snssai, \
+                     ueCfg->lcCfgList[lcIdx].snssai, sizeof(Snssai));
+
+            }
+#endif
+            /*Filling DL LC CB */
             ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].lcId = ueCfg->lcCfgList[lcIdx].lcId;
             ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].lcState = MAC_LC_STATE_ACTIVE;
             ueCb->dlInfo.numDlLc++;
-           /*Filling UL LC CB */
+            /*Filling UL LC CB */
             ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].lcId = ueCfg->lcCfgList[lcIdx].lcId;
             ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].lcGrpId = ueCfg->lcCfgList[lcIdx].ulLcCfg.lcGroup;
             ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].lcActive = MAC_LC_STATE_ACTIVE;
             ueCb->ulInfo.numUlLc++;
          }/*End of Add Config */
          else
-         { 
-           //searching for Lc to be Mod
-           for(ueLcIdx = 0; ueLcIdx < ueCb->ulInfo.numUlLc; ueLcIdx++)
-           {
-               if(ueCb->ulInfo.lcCb[ueLcIdx].lcId == ueCfg->lcCfgList[lcIdx].lcId)
-               {
-                 if(ueCfg->lcCfgList[lcIdx].configType == CONFIG_MOD)
-                 {
-                    /*Nothing to Modify in DL LC CB */
-                     /*Modify UL LC CB */
-                     ueCb->ulInfo.lcCb[ueLcIdx].lcGrpId = ueCfg->lcCfgList[lcIdx].ulLcCfg.lcGroup;
-                     DU_LOG("\nINFO  -->  MAC: Successfully Modified LC context for lcId[%d]", ueCfg->lcCfgList[lcIdx].lcId);
-                     break;
-                 }
-                 if(ueCfg->lcCfgList[lcIdx].configType == CONFIG_DEL)
-                 {
-                     memset(&ueCb->dlInfo.lcCb[ueLcIdx], 0, sizeof(DlLcCb));
-                     (ueCb->dlInfo.numDlLc)--;
-                     updateMacDlCb(ueLcIdx, &ueCb->dlInfo);
-
-                     memset(&ueCb->ulInfo.lcCb[ueLcIdx], 0, sizeof(UlLcCb));
-                     (ueCb->ulInfo.numUlLc)--;
-                     updateMacUlCb(ueLcIdx, &ueCb->ulInfo);
-                     DU_LOG("\nINFO  -->  MAC: Successfully Deleted LC context for lcId[%d]", ueCfg->lcCfgList[lcIdx].lcId);
-                     break;
-                 }
-              }
-           }
+         {
+            updateMacUlLcCtxt(&ueCb->ulInfo, &ueCfg->lcCfgList[lcIdx]);            
+            updateMacDlLcCtxt(&ueCb->dlInfo, &ueCfg->lcCfgList[lcIdx]);            
          }/*End of Mod Config */
       }
    }
@@ -2544,15 +2697,15 @@ void deletePucchResourcesCfg(PucchResrcCfg *resrcCfg)
 
 uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp)
 {
-   uint8_t ueIdx =0;
+   uint8_t ueIdx =0, lcIdx = 0, isCrntiValid = 0;
    uint16_t cellIdx=0;
    uint8_t ret = RFAILED;
    UeDeleteStatus result;
-  
+
 #ifdef CALL_FLOW_DEBUG_LOG
    DU_LOG("\nCall Flow: ENTSCH -> ENTMAC : EVENT_UE_DELETE_RSP_TO_MAC\n");
 #endif   
-   
+
    if(schUeDelRsp)
    {
       if(schUeDelRsp->rsp == RSP_OK)
@@ -2561,18 +2714,41 @@ uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp)
          GET_CELL_IDX(schUeDelRsp->cellId, cellIdx);
          if(macCb.macCell[cellIdx])
          {
-            GET_UE_IDX(schUeDelRsp->crnti, ueIdx);
-            if(macCb.macCell[cellIdx]->ueCb[ueIdx -1].crnti == schUeDelRsp->crnti)
+            CHECK_CRNTI(schUeDelRsp->crnti, isCrntiValid);
+            if(!isCrntiValid)
             {
-               memset(&macCb.macCell[cellIdx]->ueCb[ueIdx -1], 0, sizeof(MacUeCb));
-               macCb.macCell[cellIdx]->numActvUe--;
-               result = SUCCESS;
-               ret = ROK;
+               /*C-RNTI value is out of Acceptable range*/
+               DU_LOG("\nERROR  -->  MAC : MacProcSchUeDeleteRsp(): Invalid crnti[%d] ",schUeDelRsp->crnti);
+               result = UEIDX_INVALID;
             }
             else
             {
-               DU_LOG("\nERROR  -->  MAC : MacProcSchUeDeleteRsp(): crnti[%d] does not exist ",schUeDelRsp->crnti);
-               result = UEIDX_INVALID;
+               GET_UE_IDX(schUeDelRsp->crnti, ueIdx);
+               if(macCb.macCell[cellIdx]->ueCb[ueIdx -1].crnti == schUeDelRsp->crnti)
+               {
+
+                  /*Commenting as S-NSSAI and PDU session will be stored in MAC DB in future scope*/
+#if 0
+                  /*Looping around LCs to free S-NSSAI memory*/
+                  for(lcIdx = 0; lcIdx < (macCb.macCell[cellIdx]->ueCb[ueIdx -1].ulInfo.numUlLc); lcIdx++)
+                  {
+                     MAC_FREE(macCb.macCell[cellIdx]->ueCb[ueIdx -1].ulInfo.lcCb[lcIdx].snssai, sizeof(Snssai));
+                  }
+                  for(lcIdx = 0; lcIdx < (macCb.macCell[cellIdx]->ueCb[ueIdx -1].dlInfo.numDlLc); lcIdx++)
+                  {
+                     MAC_FREE(macCb.macCell[cellIdx]->ueCb[ueIdx -1].dlInfo.lcCb[lcIdx].snssai, sizeof(Snssai));
+                  }
+#endif
+                  memset(&macCb.macCell[cellIdx]->ueCb[ueIdx -1], 0, sizeof(MacUeCb));
+                  macCb.macCell[cellIdx]->numActvUe--;
+                  result = SUCCESS;
+                  ret = ROK;
+               }
+               else
+               {
+                  DU_LOG("\nERROR  -->  MAC : MacProcSchUeDeleteRsp(): crnti[%d] does not exist ",schUeDelRsp->crnti);
+                  result = UEIDX_INVALID;
+               }
             }
          }
          else
index 056842f..8476c1d 100644 (file)
@@ -642,8 +642,8 @@ uint8_t schInitCellCb(Inst inst, SchCellCfg *schCellCfg)
       SCH_ALLOC(schDlSlotInfo, sizeof(SchDlSlotInfo));
       if(!schDlSlotInfo)
       {
-        DU_LOG("\nERROR  -->  SCH : Memory allocation failed in schInitCellCb");
-        return RFAILED;
+         DU_LOG("\nERROR  -->  SCH : Memory allocation failed in schInitCellCb");
+         return RFAILED;
       }
 
       /* UL Alloc */
index 5ca4170..65c2a25 100644 (file)
@@ -160,6 +160,8 @@ typedef struct schLcCtxt
    uint8_t lcp;      // logical Channel Prioritization
    SchLcState lcState;
    uint32_t bo;
+   uint16_t   pduSessionId; /*Pdu Session Id*/
+   SchSnssai  *snssai;      /*S-NSSAI assoc with LCID*/
 }SchDlLcCtxt;
 
 typedef struct schDlCb
@@ -177,6 +179,8 @@ typedef struct schUlLcCtxt
    uint8_t schReqId;
    uint8_t pbr;        // prioritisedBitRate
    uint8_t bsd;        // bucketSizeDuration
+   uint16_t   pduSessionId; /*Pdu Session Id*/
+   SchSnssai  *snssai;      /*S-NSSAI assoc with LCID*/
 }SchUlLcCtxt;
 
 typedef struct schUlCb
index 769c793..f818498 100644 (file)
@@ -114,6 +114,18 @@ void fillSchDlLcCtxt(SchDlLcCtxt *ueCbLcCfg, SchLcCfg *lcCfg)
    ueCbLcCfg->lcp = lcCfg->dlLcCfg.lcp;
    ueCbLcCfg->lcState = SCH_LC_STATE_ACTIVE;
    ueCbLcCfg->bo = 0;
+   if(lcCfg->drbQos)
+   {
+     ueCbLcCfg->pduSessionId = lcCfg->drbQos->pduSessionId;
+   }
+   if(lcCfg->snssai)
+   {
+     if(ueCbLcCfg->snssai == NULLP)/*In CONFIG_MOD case, no need to allocate SNSSAI memory*/
+     {
+        SCH_ALLOC(ueCbLcCfg->snssai, sizeof(SchSnssai));
+     }
+     memcpy(ueCbLcCfg->snssai, lcCfg->snssai,sizeof(SchSnssai));
+   }
 }
 
 /*******************************************************************
@@ -142,6 +154,19 @@ void fillSchUlLcCtxt(SchUlLcCtxt *ueCbLcCfg, SchLcCfg *lcCfg)
    ueCbLcCfg->pbr     = lcCfg->ulLcCfg.pbr;
    ueCbLcCfg->bsd     = lcCfg->ulLcCfg.bsd;
 
+   if(lcCfg->drbQos)
+   {
+      ueCbLcCfg->pduSessionId = lcCfg->drbQos->pduSessionId;
+   }
+   if(lcCfg->snssai)
+   {
+     /*In CONFIG_MOD case, no need to allocate SNSSAI memory again*/
+     if(ueCbLcCfg->snssai == NULLP)
+     {
+        SCH_ALLOC(ueCbLcCfg->snssai, sizeof(SchSnssai));
+     }
+     memcpy(ueCbLcCfg->snssai, lcCfg->snssai,sizeof(SchSnssai));
+   }
 }
 
 /*******************************************************************
@@ -167,6 +192,20 @@ void updateSchUlCb(uint8_t delIdx, SchUlCb *ulInfo)
       memcpy(&ulInfo->ulLcCtxt[lcIdx], &ulInfo->ulLcCtxt[lcIdx+1], sizeof(SchUlLcCtxt));
       memset(&ulInfo->ulLcCtxt[lcIdx+1], 0, sizeof(SchUlLcCtxt));
    }
+   /*Leakage of Last Index*/
+   /*Last index of ulLcCtxt(before deletion) should be void*/
+   if(ulInfo->ulLcCtxt[ulInfo->numUlLc].snssai != NULLP)
+   {
+      DU_LOG("ERROR  --> SCH: updateSchUlCb Last index:%d (Before Deletion) memory is leaking",\
+            ulInfo->numUlLc);
+      SCH_FREE(ulInfo->ulLcCtxt[ulInfo->numUlLc].snssai, sizeof(Snssai));
+   }
+   else
+   {
+      DU_LOG("INFO  --> SCH: updateSchUlCb Last index:%d (before deletion) memory is freed successfully",\
+            ulInfo->numUlLc);
+
+   }
 }
 
 /*******************************************************************
@@ -192,6 +231,19 @@ void updateSchDlCb(uint8_t delIdx, SchDlCb *dlInfo)
       memcpy(&dlInfo->dlLcCtxt[lcIdx], &dlInfo->dlLcCtxt[lcIdx+1], sizeof(SchDlLcCtxt));
       memset(&dlInfo->dlLcCtxt[lcIdx+1], 0, sizeof(SchDlLcCtxt));
    }
+   /*Leakage of Last Index*/
+   /*Last index of ulLcCtxt(before deletion) should be void*/
+   if(dlInfo->dlLcCtxt[dlInfo->numDlLc].snssai != NULLP)
+   {
+      DU_LOG("ERROR  --> SCH: updateSchDlCb Last index:%d (before deletion) memory is leaking: Delete the S-NSSAI memory",\
+            dlInfo->numDlLc);
+      SCH_FREE(dlInfo->dlLcCtxt[dlInfo->numDlLc].snssai, sizeof(Snssai));
+   }
+   else
+   {
+      DU_LOG("INFO  --> SCH: updateSchDlCb Last index:%d (before deletion) memory is freed successfully",\
+            dlInfo->numDlLc);
+   }
 }
 
 /*******************************************************************
@@ -277,14 +329,32 @@ uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg)
                if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_MOD)
                {
                   fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]);
-                  fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]);
                   break;
                }
-               if(ueCfg->schLcCfg[ueLcIdx].configType == CONFIG_DEL)
+               /*BUG: ueCfg using lcIdx (Looping around numLCs in ueCfg whereas
+                * ueLcIdx Loops around numUlLc in SCH UL DB*/
+               if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_DEL)
                {
                   memset(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], 0, sizeof(SchUlLcCtxt));
                   ueCb->ulInfo.numUlLc--;
-                  updateSchUlCb(ueLcIdx, &ueCb->ulInfo); //moving arr elements one idx ahead 
+                  updateSchUlCb(ueLcIdx, &ueCb->ulInfo); //moving arr elements one idx ahead
+
+                  break;
+               }
+            }
+         }/*End of inner for loop */
+
+         for(ueLcIdx = 0; ueLcIdx < ueCb->dlInfo.numDlLc; ueLcIdx++) //searching for Lc to be Mod
+         {
+            if(ueCb->dlInfo.dlLcCtxt[ueLcIdx].lcId == ueCfg->schLcCfg[lcIdx].lcId)
+            {
+               if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_MOD)
+               {
+                  fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]);
+                  break;
+               }
+               if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_DEL)
+               {
                   memset(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], 0, sizeof(SchDlLcCtxt));
                   ueCb->dlInfo.numDlLc--;
                   updateSchDlCb(ueLcIdx, &ueCb->dlInfo); //moving arr elements one idx ahead
@@ -784,7 +854,7 @@ void deleteSchPdschServCellCfg(SchPdschServCellCfg *pdschServCellCfg)
 * ****************************************************************/
 void deleteSchUeCb(SchUeCb *ueCb) 
 {
-   uint8_t timeDomRsrcIdx;
+   uint8_t timeDomRsrcIdx = 0, ueLcIdx = 0;
    SchPucchCfg *pucchCfg = NULLP;
    SchPdschConfig *pdschCfg = NULLP;
 
@@ -822,6 +892,15 @@ void deleteSchUeCb(SchUeCb *ueCb)
          SCH_FREE(ueCb->ueCfg.spCellCfg.servCellCfg.bwpInactivityTmr, sizeof(uint8_t));
          deleteSchPdschServCellCfg(&ueCb->ueCfg.spCellCfg.servCellCfg.pdschServCellCfg);
       }
+      /*Need to Free the memory allocated for S-NSSAI*/
+      for(ueLcIdx = 0; ueLcIdx < ueCb->ulInfo.numUlLc; ueLcIdx++)
+      {
+         SCH_FREE(ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai, sizeof(SchSnssai));
+      }
+      for(ueLcIdx = 0; ueLcIdx < ueCb->dlInfo.numDlLc; ueLcIdx++)
+      {
+         SCH_FREE(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, sizeof(SchSnssai));
+      }
       memset(ueCb, 0, sizeof(SchUeCb));
    }
 }
index 754037a..90bbf0b 100644 (file)
    _bitPos = __builtin_ctz(_in);                 \
 }
 
+/* MACRO for checking CRNTI range*/
+#define CHECK_CRNTI(_crnti, _isCrntiValid)                                         \
+{                                                                   \
+  _isCrntiValid = ((_crnti >= ODU_START_CRNTI && _crnti <= ODU_END_CRNTI ) ? 1 : 0); \
+}
+
 typedef enum
 {
    UE_CFG_INACTIVE,
index 344c15e..85b46d9 100644 (file)
 #define RES_ALLOC_TYPE       1          /* Resource allocation type */
 #define FIVE_QI_VALUE9 9  /*spec 23.501, Table 5.7.4-1*/
 #define FIVE_QI_VALUE8 8  /*spec 23.501, Table 5.7.4-1*/
+#define PDU_SESSION_ID_1 1
+#define PDU_SESSION_ID_2 2
+#define INVALID_PDU_SESSION_ID -1
 
 /*******************************************************************
  *
@@ -2029,13 +2032,18 @@ uint8_t BuildSRBSetup(SRBs_ToBeSetup_List_t *srbSet)
  *    Functionality: Constructs the QOS Info for DRB Setup Item
  *
  * @params[in] QoSInformation_t *qosinfo
+ *             int16_t pduSessionID
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildQOSInfo(QoSFlowLevelQoSParameters_t *drbQos, uint8_t actionType)
+uint8_t BuildQOSInfo(QoSFlowLevelQoSParameters_t *drbQos, uint8_t actionType, \
+                        int16_t pduSessionID)
 {
+   uint8_t elementCnt = 0, qosCntIdx = 0;
+   ProtocolExtensionContainer_4624P74_t *qosIeExt = NULLP;
+
    /* NonDynamic5QIDescriptor */
    drbQos->qoS_Characteristics.present = QoS_Characteristics_PR_non_Dynamic_5QI;
    CU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI,sizeof(NonDynamic5QIDescriptor_t));
@@ -2051,18 +2059,18 @@ uint8_t BuildQOSInfo(QoSFlowLevelQoSParameters_t *drbQos, uint8_t actionType)
 
    /*AveragingWindow*/
    CU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\
-        sizeof(AveragingWindow_t));
+         sizeof(AveragingWindow_t));
    if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow == \
-        NULLP)
+         NULLP)
    {
       return RFAILED;
    }
    *(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow) = 0;
    /*MaxDataBurstVolume*/
    CU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\
-        sizeof(MaxDataBurstVolume_t));
+         sizeof(MaxDataBurstVolume_t));
    if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume == \
-        NULLP)
+         NULLP)
    {
       return RFAILED;
    }
@@ -2073,6 +2081,54 @@ uint8_t BuildQOSInfo(QoSFlowLevelQoSParameters_t *drbQos, uint8_t actionType)
    drbQos->nGRANallocationRetentionPriority.pre_emptionCapability = Pre_emptionCapability_may_trigger_pre_emption;
    drbQos->nGRANallocationRetentionPriority.pre_emptionVulnerability = Pre_emptionVulnerability_not_pre_emptable;
 
+   /*If PDU Session ID is INVALID thus not to be included in Qos IE, skip the PDU Session IE */
+   if(pduSessionID <= INVALID_PDU_SESSION_ID)
+   {
+      DU_LOG("\nINFO  --> F1AP : Invalid PDU_SESSION_ID");
+      return ROK;
+   }
+
+   CU_ALLOC(drbQos->iE_Extensions, sizeof(ProtocolExtensionContainer_4624P74_t));
+   qosIeExt = (ProtocolExtensionContainer_4624P74_t *)drbQos->iE_Extensions;
+
+   if(qosIeExt)
+   {
+      elementCnt = NUM_QOS_EXT;
+      qosIeExt->list.count = elementCnt;
+      qosIeExt->list.size = elementCnt * sizeof(QoSFlowLevelQoSParameters_ExtIEs_t *);
+
+      /*Initialize QoSFlowLevelQoSParameters_ExtIEs_t*/
+      CU_ALLOC(qosIeExt->list.array, qosIeExt->list.size);
+
+      if(qosIeExt->list.array == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation for QoSFlowLevelQoSParameters_ExtIEs_t failed");
+         return  RFAILED;
+      }
+
+      for(qosCntIdx=0; qosCntIdx < elementCnt; qosCntIdx++)
+      {
+         CU_ALLOC(qosIeExt->list.array[qosCntIdx], sizeof(QoSFlowLevelQoSParameters_ExtIEs_t));
+         if(qosIeExt->list.array[qosCntIdx] == NULLP)
+         {
+            DU_LOG("\nERROR  -->       F1AP : Memory allocation for QoSFlowLevelQoSParameters_ExtIEs_t array failed");
+            return  RFAILED;
+         }
+         /*Filling QoSFlowLevelQoSParameters_ExtIEs_t*/
+         qosIeExt->list.array[qosCntIdx]->id = ProtocolIE_ID_id_PDUSessionID;
+         /*Below Criticality mentioned in Spec38.473, 15.4.1 and later*/
+         qosIeExt->list.array[qosCntIdx]->criticality = Criticality_ignore; 
+         qosIeExt->list.array[qosCntIdx]->extensionValue.present = \
+                                                                   QoSFlowLevelQoSParameters_ExtIEs__extensionValue_PR_PDUSessionID;
+         qosIeExt->list.array[qosCntIdx]->extensionValue.choice.PDUSessionID = (PDUSessionID_t)pduSessionID;
+      }
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->     F1AP : Memory allocation for QosIE_extension failed");
+      return RFAILED;
+   }
+
    return ROK;
 }/*End of BuildQOSInfo*/
 
@@ -2087,12 +2143,13 @@ uint8_t BuildQOSInfo(QoSFlowLevelQoSParameters_t *drbQos, uint8_t actionType)
  *    Functionality: Constructs the SNSSAI For DRB list
  *
  * @params[in] SNSSAI_t *snssai
+ *             Snssai  *snssaiToCopy S-NSSAI from CuCfgParam to be copied
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildSNSSAI(SNSSAI_t *snssai)
+uint8_t BuildSNSSAI(SNSSAI_t *snssai, Snssai *snssaiToCopy)
 {
    /*SNSSAI*/
    /*ssT*/
@@ -2102,7 +2159,7 @@ uint8_t BuildSNSSAI(SNSSAI_t *snssai)
    {
       return RFAILED;
    }
-   snssai->sST.buf[0] = 3;
+   memcpy(snssai->sST.buf, &snssaiToCopy->sst, snssai->sST.size);
    /*sD*/
    CU_ALLOC(snssai->sD,sizeof(OCTET_STRING_t));
    if(snssai->sD == NULLP)
@@ -2115,9 +2172,7 @@ uint8_t BuildSNSSAI(SNSSAI_t *snssai)
    {
       return RFAILED;
    }
-   snssai->sD->buf[0] = 3;
-   snssai->sD->buf[1] = 6;
-   snssai->sD->buf[2] = 9;
+   memcpy(snssai->sD->buf, snssaiToCopy->sd, snssai->sD->size);
    return ROK;
 }/*End of BuildSNSSAI*/
 
@@ -2162,7 +2217,7 @@ uint8_t BuildFlowsMap(Flows_Mapped_To_DRB_List_t *flowMap , uint8_t actionType)
    idx = 0;
    flowMap->list.array[idx]->qoSFlowIdentifier = 0;
    ret = BuildQOSInfo(&flowMap->list.array[idx]->qoSFlowLevelQoSParameters,\
-         actionType);
+         actionType, INVALID_PDU_SESSION_ID);
    if(ret != ROK)
    {
       DU_LOG("\nERROR  -->  F1AP : Failed to Build QOS Info in BuildFlowsMap()");
@@ -2329,7 +2384,7 @@ uint8_t BuildDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
                                                                       QoSInformation_ExtIEs__value_PR_DRB_Information;
       BuildQOSInforet =  BuildQOSInfo(&drbSetItem->qoSInformation.choice.\
                              choice_extension->value.choice.DRB_Information.dRB_QoS,\
-                         ProtocolIE_ID_id_DRBs_ToBeSetup_Item);
+                         ProtocolIE_ID_id_DRBs_ToBeSetup_Item, PDU_SESSION_ID_1);
       if(BuildQOSInforet != ROK)
       {
          DU_LOG("\nERROR  -->  F1AP : Failed to build QOS Info in BuildDRBSetup");
@@ -2337,7 +2392,7 @@ uint8_t BuildDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
       }
       /*SNSSAI*/
       BuildSNSSAIret = BuildSNSSAI(&drbSetItem->qoSInformation.choice.\
-                              choice_extension->value.choice.DRB_Information.sNSSAI);
+                              choice_extension->value.choice.DRB_Information.sNSSAI, cuCfgParams.snssaiList[0]);
       if(BuildSNSSAIret != ROK)
       {
          DU_LOG("\nERROR  -->  F1AP : Failed to build SNSSAI Info in BuildDRBSetup");
@@ -2474,20 +2529,40 @@ void FreeSRBSetup(SRBs_ToBeSetup_List_t *srbSet)
  * ****************************************************************/
 void FreeQOSInfo(QoSFlowLevelQoSParameters_t *drbQos)
 {
+   ProtocolExtensionContainer_4624P74_t *qosIeExt = NULLP;
+   uint8_t qosCntIdx = 0;
+
    if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI != NULLP)
    {
       if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
       {
-        if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
-        {
-           CU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\
-                 sizeof(MaxDataBurstVolume_t));
-        }
-        CU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\
-              sizeof(AveragingWindow_t));
+         if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
+         {
+            CU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\
+                  sizeof(MaxDataBurstVolume_t));
+         }
+         CU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\
+               sizeof(AveragingWindow_t));
       }
       CU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI,\
-           sizeof(NonDynamic5QIDescriptor_t));
+            sizeof(NonDynamic5QIDescriptor_t));
+   }
+   if(drbQos->iE_Extensions)
+   {
+      qosIeExt = (ProtocolExtensionContainer_4624P74_t *)drbQos->iE_Extensions;
+      if(qosIeExt->list.array != NULLP)
+      {
+         for(qosCntIdx=0; qosCntIdx <  qosIeExt->list.count; qosCntIdx++)
+         {
+            if(qosIeExt->list.array[qosCntIdx])
+            {
+               CU_FREE(qosIeExt->list.array[qosCntIdx], sizeof(QoSFlowLevelQoSParameters_ExtIEs_t));
+            }
+         }
+         CU_FREE(qosIeExt->list.array, qosIeExt->list.size);
+      }
+
+      CU_FREE(drbQos->iE_Extensions, sizeof(ProtocolExtensionContainer_4624P74_t));
    }
 }
 /*******************************************************************
@@ -2561,9 +2636,12 @@ void FreeULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
 void FreeDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
 {
    DRBs_ToBeSetup_Item_t *drbSetItem;
-   uint8_t  flowidx;
-   uint8_t  drbidx;
-   if(drbSet->list.array == NULLP)
+   ProtocolExtensionContainer_4624P74_t *qosIeExt = NULLP;
+   
+   uint8_t  flowidx = 0, drbidx = 0, qosCntIdx = 0;
+
+   /*BUG: Need to check drbSet->list.array is not Empty to procced with Deletion*/
+   if(drbSet->list.array != NULLP)
    {
       for(drbidx=0; drbidx<drbSet->list.count; drbidx++)
       {
@@ -2654,6 +2732,26 @@ void FreeDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
                         CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
                                       qoS_Characteristics.choice.non_Dynamic_5QI, sizeof(NonDynamic5QIDescriptor_t));
              }
+             if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+                        iE_Extensions != NULLP)
+             {
+                qosIeExt = (ProtocolExtensionContainer_4624P74_t *)drbSetItem->qoSInformation.choice.\
+                                    choice_extension->value.choice.DRB_Information.dRB_QoS.iE_Extensions;
+                 if(qosIeExt->list.array != NULLP)
+                 {
+                   for(qosCntIdx=0; qosCntIdx < qosIeExt->list.count; qosCntIdx++)
+                   {
+                      if(qosIeExt->list.array[qosCntIdx] != NULLP)
+                      {
+                         CU_FREE(qosIeExt->list.array[qosCntIdx], sizeof(QoSFlowLevelQoSParameters_ExtIEs_t));
+                      }
+                    }
+                    CU_FREE(qosIeExt->list.array, qosIeExt->list.size);
+                  }
+                  CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+                                   iE_Extensions, sizeof(ProtocolExtensionContainer_4624P74_t));
+              }
+                  
                  CU_FREE(drbSetItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t));
                }
                CU_FREE(drbSet->list.array[drbidx],sizeof(DRBs_ToBeSetup_ItemIEs_t));
@@ -2689,62 +2787,63 @@ void FreeUeContextSetupReq(F1AP_PDU_t  *f1apMsg)
    {
       if(f1apMsg->choice.initiatingMessage != NULLP)
       {
-        ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
-        if(ueSetReq->protocolIEs.list.array != NULLP)
-        {
-           for(idx = 0; idx < ueSetReq->protocolIEs.list.count; idx++)
-           {
-              if(ueSetReq->protocolIEs.list.array[idx])
-              {
-                 switch(ueSetReq->protocolIEs.list.array[idx]->id)
-                 {
-                    case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
-                       break;
-                    case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
-                       break;
-                    case ProtocolIE_ID_id_SpCell_ID:
-                       FreeNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI);
-                       break;
-                    case ProtocolIE_ID_id_ServCellIndex:
-                       break;
-                    case ProtocolIE_ID_id_SpCellULConfigured:
-                       break;
-                    case ProtocolIE_ID_id_CUtoDURRCInformation:
-                       FreeCuToDuInfo(&ueSetReq->protocolIEs.list.array[idx]->value.choice.CUtoDURRCInformation);
-                       break;
-                    case ProtocolIE_ID_id_SCell_ToBeSetup_List:
-                       FreeSplCellList(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SCell_ToBeSetup_List);
-                       break;
-                    case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
-                       FreeSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SRBs_ToBeSetup_List);
-                       break;
-                    case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
-                       FreeDRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.DRBs_ToBeSetup_List);
-                       break;
-                    case ProtocolIE_ID_id_RRCContainer:
-                       if(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf != NULLP)
-                       {
-                         CU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, \
-                         ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
-                       }
-                       break;
-                    default:
-                       DU_LOG("\nERROR  -->  F1AP: Invalid event type %ld", ueSetReq->protocolIEs.list.array[idx]->id);
-                 }
-              }
-              break;
-           }
-           for(ieId=0; ieId<idx; ieId++)
-           {
-              if(ueSetReq->protocolIEs.list.array[ieId] != NULLP)
-              {
-                      CU_FREE(ueSetReq->protocolIEs.list.array[ieId],sizeof(UEContextSetupRequestIEs_t));
-              }
-           }
-           CU_FREE(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size);
-        }
-        CU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
-  }
+         ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
+         if(ueSetReq->protocolIEs.list.array != NULLP)
+         {
+            for(idx = 0; idx < ueSetReq->protocolIEs.list.count; idx++)
+            {
+               if(ueSetReq->protocolIEs.list.array[idx])
+               {
+                  switch(ueSetReq->protocolIEs.list.array[idx]->id)
+                  {
+                     case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                        break;
+                     case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                        break;
+                     case ProtocolIE_ID_id_SpCell_ID:
+                        FreeNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI);
+                        break;
+                     case ProtocolIE_ID_id_ServCellIndex:
+                        break;
+                     case ProtocolIE_ID_id_SpCellULConfigured:
+                        break;
+                     case ProtocolIE_ID_id_CUtoDURRCInformation:
+                        FreeCuToDuInfo(&ueSetReq->protocolIEs.list.array[idx]->value.choice.CUtoDURRCInformation);
+                        break;
+                     case ProtocolIE_ID_id_SCell_ToBeSetup_List:
+                        FreeSplCellList(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SCell_ToBeSetup_List);
+                        break;
+                     case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
+                        FreeSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SRBs_ToBeSetup_List);
+                        break;
+                     case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
+                        FreeDRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.DRBs_ToBeSetup_List);
+                        break;
+                     case ProtocolIE_ID_id_RRCContainer:
+                        if(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf != NULLP)
+                        {
+                           CU_FREE(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, \
+                                 ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
+                        }
+                        break;
+                     default:
+                        DU_LOG("\nERROR  -->  F1AP: Invalid event type %ld", ueSetReq->protocolIEs.list.array[idx]->id);
+                        break;
+                  }
+               }
+               /*BUG: Break is causing to exit the for Loop before complete traversing and freeing of each IE*/
+            }
+            for(ieId=0; ieId<idx; ieId++)
+            {
+               if(ueSetReq->protocolIEs.list.array[ieId] != NULLP)
+               {
+                  CU_FREE(ueSetReq->protocolIEs.list.array[ieId],sizeof(UEContextSetupRequestIEs_t));
+               }
+            }
+            CU_FREE(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size);
+         }
+         CU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
+      }
       CU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
    }
 }
@@ -7341,7 +7440,7 @@ uint8_t FillDrbItemToSetupMod(uint8_t arrIdx, DRBs_ToBeSetupMod_Item_t *drbItem)
         drbItem->qoSInformation.choice.choice_extension->criticality = Criticality_ignore;
         drbItem->qoSInformation.choice.choice_extension->value.present = QoSInformation_ExtIEs__value_PR_DRB_Information;
         ret =  BuildQOSInfo(&drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS,\
-           ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item);
+           ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item, PDU_SESSION_ID_2);
         if(ret != ROK)
         {
            DU_LOG("\nERROR  -->  F1AP : BuildQOSInfo failed");
@@ -7350,7 +7449,7 @@ uint8_t FillDrbItemToSetupMod(uint8_t arrIdx, DRBs_ToBeSetupMod_Item_t *drbItem)
         
         /*SNSSAI*/
         ret = BuildSNSSAI(&drbItem->qoSInformation.choice.\
-              choice_extension->value.choice.DRB_Information.sNSSAI);
+              choice_extension->value.choice.DRB_Information.sNSSAI, cuCfgParams.snssaiList[1]);
         if(ret != ROK)
         {
            DU_LOG("\nERROR  -->  F1AP : BuildSNSSAI failed");
@@ -7576,7 +7675,7 @@ uint8_t FillDrbToBeModItem(DRBs_ToBeModified_Item_t *drbItem)
                drbItem->qoSInformation->choice.choice_extension->criticality = Criticality_ignore;
                drbItem->qoSInformation->choice.choice_extension->value.present = QoSInformation_ExtIEs__value_PR_DRB_Information;
                ret =  BuildQOSInfo(&drbItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information.dRB_QoS,\
-                     ProtocolIE_ID_id_DRBs_ToBeModified_Item);
+                     ProtocolIE_ID_id_DRBs_ToBeModified_Item, INVALID_PDU_SESSION_ID);
                if(ret != ROK)
                {
                   DU_LOG("\nERROR  -->  F1AP : BuildQOSInfo failed");
@@ -7585,7 +7684,7 @@ uint8_t FillDrbToBeModItem(DRBs_ToBeModified_Item_t *drbItem)
 
                /*SNSSAI*/
                ret = BuildSNSSAI(&drbItem->qoSInformation->choice.\
-                     choice_extension->value.choice.DRB_Information.sNSSAI);
+                     choice_extension->value.choice.DRB_Information.sNSSAI,cuCfgParams.snssaiList[0]);
                if(ret != ROK)
                {
                   DU_LOG("\nERROR  -->  F1AP : BuildSNSSAI failed");
index b8ceb09..62b771f 100644 (file)
@@ -70,6 +70,7 @@
 #define SECURITY_MODE_COMPLETE 5
 #define RRC_RECONFIG 6
 #define UE_CONTEXT_MOD_REQ 7
+#define NUM_QOS_EXT 1
 
 
 typedef struct f1apDb
index bb82b16..1c07b75 100644 (file)
@@ -7435,43 +7435,59 @@ void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\
 
 void extractQosInfo(DrbQosInfo *qosToAdd, QoSFlowLevelQoSParameters_t *qosFlowCfg)
 {
+   uint8_t qosCntIdx = 0;
+   ProtocolExtensionContainer_4624P74_t *qosIeExt = NULLP;
+
    qosToAdd->fiveQiType = qosFlowCfg->qoS_Characteristics.present;
    qosToAdd->u.nonDyn5Qi.fiveQi     =\
-         qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI;
+                                     qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI;
    if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow)
    {
       qosToAdd->u.nonDyn5Qi.avgWindow = \
-        *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
+                                        *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
    }
    qosToAdd->u.nonDyn5Qi.maxDataBurstVol = \
-      *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
+                                           *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
    if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel)
    {
       qosToAdd->u.nonDyn5Qi.priorLevel = \
-         *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel);
+                                         *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel);
    }
    qosToAdd->ngRanRetPri.priorityLevel = \
-      qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel; 
+                                         qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel; 
    qosToAdd->ngRanRetPri.preEmptionCap = \
-      qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability;
+                                         qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability;
    qosToAdd->ngRanRetPri.preEmptionVul = \
-      qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionVulnerability;
+                                         qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionVulnerability;
    if(qosFlowCfg->gBR_QoS_Flow_Information)
    {
       memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateDl, \
-         qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.buf, \
-         qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.size);
+            qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.buf, \
+            qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.size);
       memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateUl, \
-         qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.buf, \
-         qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.size);
+            qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.buf, \
+            qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.size);
       memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateDl,\
-         qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.buf, \
-         qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.size);
+            qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.buf, \
+            qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.size);
       memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateUl,\
-         qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.buf, \
-         qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.size);
+            qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.buf, \
+            qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.size);
+   }
+   /*Extracting PDU_SESSION_ID*/
+   qosIeExt = (ProtocolExtensionContainer_4624P74_t *)qosFlowCfg->iE_Extensions;
+   if(qosIeExt)
+   {
+      for(qosCntIdx = 0; qosCntIdx < qosIeExt->list.count; qosCntIdx++)
+      {
+         if(qosIeExt->list.array[qosCntIdx]->extensionValue.present == \
+               QoSFlowLevelQoSParameters_ExtIEs__extensionValue_PR_PDUSessionID)
+         {
+            qosToAdd->pduSessionId = qosIeExt->list.array[qosCntIdx]->extensionValue.choice.PDUSessionID;
+            DU_LOG("\nDEBUG -->  DU_F1AP : extractQosInfo: PDU SessionID:%d",qosToAdd->pduSessionId);
+         }
+      }  
    }
-   qosToAdd->pduSessionId = 0;
    qosToAdd->ulPduSessAggMaxBitRate = 0;
 }