[Jira Id - ODUHIGH-373 ] Implementation of RRM Policy Configuration Per Slice 90/6790/7
authorlal.harshita <Harshita.Lal@radisys.com>
Wed, 29 Sep 2021 04:45:56 +0000 (10:15 +0530)
committerlal.harshita <Harshita.Lal@radisys.com>
Wed, 6 Oct 2021 11:33:49 +0000 (17:03 +0530)
Change-Id: Ia79c7c83d6a830e0497409de15c7f77ceaa07e3e
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
src/5gnrmac/mac_cfg_hdl.c
src/5gnrmac/mac_ue_mgr.c
src/5gnrsch/sch.h
src/5gnrsch/sch_ue_mgr.c
src/cm/common_def.h
src/cm/du_app_mac_inf.h
src/cm/mac_sch_interface.h
src/cu_stub/cu_stub.h
src/du_app/du_cfg.c
src/du_app/du_cfg.h
src/du_app/du_f1ap_msg_hdl.c

index 074556d..305c578 100644 (file)
@@ -134,7 +134,7 @@ uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg)
 {
    Pst cfmPst;
    uint16_t cellIdx;
-   uint8_t ret = ROK;
+   uint8_t ret = ROK, sliceIdx = 0;
    MacCellCb     *macCellCb;
 
    memset((uint8_t *)&cfmPst, 0, sizeof(Pst));
@@ -161,6 +161,32 @@ uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg)
    }
    memcpy(macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1Pdu, macCellCfg->sib1Cfg.sib1Pdu, \
         macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1PduLen);
+   
+   macCb.macCell[cellIdx]->macCellCfg.numSupportedSlice = macCellCfg->numSupportedSlice;
+   MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.snssai, macCb.macCell[cellIdx]->macCellCfg.numSupportedSlice\
+         * sizeof(Snssai*));
+   if(macCb.macCell[cellIdx]->macCellCfg.snssai == NULLP)
+   {
+      DU_LOG("\nERROR  --> MAC: Memory allocation failed at MacProcCellCfgReq");
+      return RFAILED;
+   }
+
+   if(macCb.macCell[cellIdx]->macCellCfg.snssai)
+   {
+      for(sliceIdx=0; sliceIdx<macCb.macCell[cellIdx]->macCellCfg.numSupportedSlice; sliceIdx++)
+      {
+         if(macCellCfg->snssai[sliceIdx])
+         {
+            MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.snssai[sliceIdx], sizeof(Snssai));
+            if(!macCb.macCell[cellIdx]->macCellCfg.snssai[sliceIdx])
+            {
+               DU_LOG("\nERROR  --> MAC: Memory allocation failed at MacProcCellCfgReq");
+               return RFAILED;
+            }
+            memcpy(macCb.macCell[cellIdx]->macCellCfg.snssai[sliceIdx], macCellCfg->snssai[sliceIdx], sizeof(Snssai));
+         }
+      }
+   }
 
    /* Send cell cfg to scheduler */
    ret = MacSchCellCfgReq(pst, macCellCfg);
@@ -200,7 +226,7 @@ uint8_t MacSchCellCfgReq(Pst *pst, MacCellCfg *macCellCfg)
 {
    SchCellCfg schCellCfg;
    Pst        cfgPst;
-   uint8_t    ssbMaskIdx = 0, rsrcListIdx = 0, ret=0;
+   uint8_t    ssbMaskIdx = 0, rsrcListIdx = 0, ret=0, sliceIdx=0;
 
    memset(&cfgPst, 0, sizeof(Pst));
    memset(&schCellCfg, 0, sizeof(SchCellCfg));
@@ -303,6 +329,41 @@ uint8_t MacSchCellCfgReq(Pst *pst, MacCellCfg *macCellCfg)
       schCellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].symbolLength =
          macCellCfg->initialUlBwp.puschCommon.timeDomRsrcAllocList[rsrcListIdx].symbolLength;
    }
+
+   if(macCellCfg->snssai) 
+   {
+      schCellCfg.numSliceSupport = macCellCfg->numSupportedSlice;
+      MAC_ALLOC(schCellCfg.snssai, schCellCfg.numSliceSupport * sizeof(Snssai*));
+      if(!schCellCfg.snssai)
+      {
+         DU_LOG("\nERROR  --> MAC: Memory allocation failed at MacSchCellCfgReq");
+         return RFAILED;
+      }
+      for(sliceIdx=0; sliceIdx<schCellCfg.numSliceSupport; sliceIdx++)
+      {
+         if(macCellCfg->snssai[sliceIdx])
+         {
+            MAC_ALLOC(schCellCfg.snssai[sliceIdx], sizeof(Snssai));
+            if(!schCellCfg.snssai[sliceIdx])
+            {
+               DU_LOG("\nERROR  --> MAC: Memory allocation failed at MacSchCellCfgReq");
+               return RFAILED;
+            }
+            memcpy(schCellCfg.snssai[sliceIdx], macCellCfg->snssai[sliceIdx],  sizeof(Snssai));
+         }
+      }
+   }
+   if(macCellCfg->rrmPolicy)
+   {
+      MAC_ALLOC(schCellCfg.rrmPolicy, sizeof(SchRrmPolicy));
+      if(!schCellCfg.rrmPolicy)
+      {
+         DU_LOG("\nERROR  --> MAC: Memory allocation failed at MacProcCellCfgReq");
+         return RFAILED;
+      }
+      memcpy(schCellCfg.rrmPolicy, macCellCfg->rrmPolicy, sizeof(SchRrmPolicy));
+   }
+
 #ifdef NR_TDD
    memcpy(&schCellCfg.tddCfg, &macCellCfg->tddCfg, sizeof(TDDCfg));
 #endif
@@ -470,7 +531,7 @@ uint8_t MacSendCellDeleteRsp(CellDeleteStatus result, uint8_t cellId)
  * * ****************************************************************/
 uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDelRsp)
 {
-   uint8_t  ret = ROK;
+   uint8_t  ret = ROK, sliceIdx = 0;
    uint16_t cellIdx=0;
    CellDeleteStatus status;
    
@@ -490,6 +551,15 @@ uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDelRsp)
             if(macCb.macCell[cellIdx]->cellId == schCellDelRsp->cellId)
             {
                status  = SUCCESSFUL_RSP;
+               if(macCb.macCell[cellIdx]->macCellCfg.snssai)
+               {
+                  for(sliceIdx = 0; sliceIdx<macCb.macCell[cellIdx]->macCellCfg.numSupportedSlice; sliceIdx++)
+                  {
+                     MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.snssai[sliceIdx], sizeof(Snssai));
+                  }
+                  MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.snssai, macCb.macCell[cellIdx]->macCellCfg.\
+                  numSupportedSlice * sizeof(Snssai*));
+               }
                MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1Pdu, \
                   macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1PduLen);
                MAC_FREE(macCb.macCell[cellIdx], sizeof(MacCellCb));
index 0ee59e2..a3c2a70 100644 (file)
@@ -1539,7 +1539,7 @@ uint8_t fillLogicalChannelCfg(SchLcCfg *schLcCfg, LcCfg *macLcCfg)
       {
          if(!schLcCfg->snssai)
          {
-            MAC_ALLOC(schLcCfg->snssai, sizeof(SchSnssai));
+            MAC_ALLOC(schLcCfg->snssai, sizeof(Snssai));
             if(!schLcCfg->snssai)
             {
                DU_LOG("\nERROR  -->  MAC : Memory alloc failed at snssai at fillLogicalChannelCfg()");
index 65c2a25..cbf18e7 100644 (file)
@@ -161,7 +161,7 @@ typedef struct schLcCtxt
    SchLcState lcState;
    uint32_t bo;
    uint16_t   pduSessionId; /*Pdu Session Id*/
-   SchSnssai  *snssai;      /*S-NSSAI assoc with LCID*/
+   Snssai  *snssai;      /*S-NSSAI assoc with LCID*/
 }SchDlLcCtxt;
 
 typedef struct schDlCb
@@ -180,7 +180,7 @@ typedef struct schUlLcCtxt
    uint8_t pbr;        // prioritisedBitRate
    uint8_t bsd;        // bucketSizeDuration
    uint16_t   pduSessionId; /*Pdu Session Id*/
-   SchSnssai  *snssai;      /*S-NSSAI assoc with LCID*/
+   Snssai  *snssai;      /*S-NSSAI assoc with LCID*/
 }SchUlLcCtxt;
 
 typedef struct schUlCb
index f818498..4b56ce4 100644 (file)
@@ -122,9 +122,9 @@ void fillSchDlLcCtxt(SchDlLcCtxt *ueCbLcCfg, SchLcCfg *lcCfg)
    {
      if(ueCbLcCfg->snssai == NULLP)/*In CONFIG_MOD case, no need to allocate SNSSAI memory*/
      {
-        SCH_ALLOC(ueCbLcCfg->snssai, sizeof(SchSnssai));
+        SCH_ALLOC(ueCbLcCfg->snssai, sizeof(Snssai));
      }
-     memcpy(ueCbLcCfg->snssai, lcCfg->snssai,sizeof(SchSnssai));
+     memcpy(ueCbLcCfg->snssai, lcCfg->snssai,sizeof(Snssai));
    }
 }
 
@@ -163,9 +163,9 @@ void fillSchUlLcCtxt(SchUlLcCtxt *ueCbLcCfg, SchLcCfg *lcCfg)
      /*In CONFIG_MOD case, no need to allocate SNSSAI memory again*/
      if(ueCbLcCfg->snssai == NULLP)
      {
-        SCH_ALLOC(ueCbLcCfg->snssai, sizeof(SchSnssai));
+        SCH_ALLOC(ueCbLcCfg->snssai, sizeof(Snssai));
      }
-     memcpy(ueCbLcCfg->snssai, lcCfg->snssai,sizeof(SchSnssai));
+     memcpy(ueCbLcCfg->snssai, lcCfg->snssai,sizeof(Snssai));
    }
 }
 
@@ -365,7 +365,7 @@ uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg)
       }
 
       SCH_FREE(ueCfg->schLcCfg[lcIdx].drbQos, sizeof(SchDrbQosInfo));
-      SCH_FREE(ueCfg->schLcCfg[lcIdx].snssai, sizeof(SchSnssai));
+      SCH_FREE(ueCfg->schLcCfg[lcIdx].snssai, sizeof(Snssai));
 
    }/* End of outer for loop */
    return ROK;
@@ -895,11 +895,11 @@ void deleteSchUeCb(SchUeCb *ueCb)
       /*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));
+         SCH_FREE(ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai, sizeof(Snssai));
       }
       for(ueLcIdx = 0; ueLcIdx < ueCb->dlInfo.numDlLc; ueLcIdx++)
       {
-         SCH_FREE(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, sizeof(SchSnssai));
+         SCH_FREE(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, sizeof(Snssai));
       }
       memset(ueCb, 0, sizeof(SchUeCb));
    }
@@ -1030,29 +1030,33 @@ uint8_t SchSendCellDeleteRspToMac(SchCellDelete  *ueDelete, Inst inst, SchMacRsp
  * ****************************************************************/
 void deleteSchCellCb(SchCellCb *cellCb)
 {
-   uint8_t idx=0;
+   uint8_t sliceIdx=0, slotIdx=0;
    if(cellCb->schDlSlotInfo)
    {
-      for(idx=0; idx<cellCb->numSlots; idx++)
+      for(slotIdx=0; slotIdx<cellCb->numSlots; slotIdx++)
       {
-         if(cellCb->schDlSlotInfo[idx])
-         {
-            SCH_FREE(cellCb->schDlSlotInfo[idx], sizeof(SchDlSlotInfo));
-         }
+         SCH_FREE(cellCb->schDlSlotInfo[slotIdx], sizeof(SchDlSlotInfo));
       }
       SCH_FREE(cellCb->schDlSlotInfo, cellCb->numSlots *sizeof(SchDlSlotInfo*));
    }
    if(cellCb->schUlSlotInfo)
    {
-      for(idx=0; idx<cellCb->numSlots; idx++)
+      for(slotIdx=0; slotIdx<cellCb->numSlots; slotIdx++)
       {
-         if(cellCb->schUlSlotInfo[idx])
-         {
-            SCH_FREE(cellCb->schUlSlotInfo[idx], sizeof(SchUlSlotInfo));  
-         }
+         SCH_FREE(cellCb->schUlSlotInfo[slotIdx], sizeof(SchUlSlotInfo));  
       }
       SCH_FREE(cellCb->schUlSlotInfo,  cellCb->numSlots * sizeof(SchUlSlotInfo*));
    }
+
+   if(cellCb->cellCfg.snssai)
+   {
+      for(sliceIdx=0; sliceIdx<cellCb->cellCfg.numSliceSupport; sliceIdx++)
+      {
+         SCH_FREE(cellCb->cellCfg.snssai[sliceIdx], sizeof(Snssai));
+      }
+      SCH_FREE(cellCb->cellCfg.snssai, cellCb->cellCfg.numSliceSupport*sizeof(Snssai*));
+   }
+   SCH_FREE(cellCb->cellCfg.rrmPolicy, sizeof(SchRrmPolicy));
    memset(cellCb, 0, sizeof(SchCellCb));
 
 }
index 90bbf0b..26a327a 100644 (file)
 #define ODU_SET_THREAD_AFFINITY SSetAffinity
 #define ODU_CREATE_TASK SCreateSTsk
 
+/* Slice */
+#define SD_SIZE 3
+
 #ifdef NR_TDD
 /* Maximum slots for max periodicity and highest numerology is 320.
  * However, aligning to fapi_interface.h, setting this macro to 160 */
@@ -250,6 +253,12 @@ typedef struct PlmnIdentity
    uint8_t mnc[3];
 }Plmn;
 
+typedef struct snssai
+{
+   uint8_t   sst;
+   uint8_t   sd[SD_SIZE];
+}Snssai;
+
 typedef struct oduCellId
 {
    uint16_t cellId;
index c5dbf84..a484f1d 100644 (file)
@@ -48,8 +48,6 @@
 #define MONITORING_SYMB_WITHIN_SLOT_SIZE 2  /* i.e. 2 bytes because size of monitoring symbols within slot is 14 bits */
 #define MAX_NUM_DL_ALLOC 16             /* Max number of pdsch time domain downlink allocation */
 #define MAX_NUM_UL_ALLOC 16             /* Max number of pusch time domain uplink allocation */
-#define SD_SIZE   3                     /* Max size of Slice Differentiator in S-NSSAI */
-
 #define MAX_NUM_SCELL  32
 
 /* PUCCH Configuration Macro */
@@ -489,6 +487,13 @@ typedef enum
    MCS_TABLE_QAM64_LOW_SE
 }McsTable;
 
+typedef enum
+{
+   RSRC_PRB,
+   RSRC_DRB,
+   RSRC_RRC_CONNECTED_USERS
+}ResourceType;
+
 typedef struct failureCause
 {
    CauseGrp   type;
@@ -654,6 +659,23 @@ typedef struct bwpUlConfig
    PuschConfigCommon puschCommon;
 }BwpUlConfig;
 
+/* Single Network Slice Selection assistance Info */
+
+typedef struct policyMemberList
+{
+   Plmn plmn;
+   Snssai  snssai;
+}PolicyMemberList;
+
+typedef struct rrmPolicy
+{
+   ResourceType     rsrcType;
+   PolicyMemberList memberList;
+   uint8_t          policyMaxRatio;
+   uint8_t          policyMinRatio;
+   uint8_t          policyDedicatedRatio;
+}RrmPolicy;
+
 typedef struct macCellCfg
 {
    uint16_t       cellId;           /* Cell Id */
@@ -674,6 +696,9 @@ typedef struct macCellCfg
    BwpDlConfig    initialDlBwp;     /* Initial DL BWP */
    BwpUlConfig    initialUlBwp;     /* Initial UL BWP */
    uint8_t        dmrsTypeAPos;     /* DMRS Type A position */
+   uint8_t        numSupportedSlice; /* Total slice supporting */
+   Snssai         **snssai;         /* List of supporting snssai*/
+   RrmPolicy      *rrmPolicy;       /* RRM policy details */ 
 }MacCellCfg;
 
 typedef struct macCellCfgCfm
@@ -1112,13 +1137,6 @@ typedef struct ambrCfg
    uint32_t ulBr;   /* UL Bit rate */
 }AmbrCfg;
 
-/* Single Network Slice Selection assistance Info */
-typedef struct snssai
-{
-   uint8_t sst;                /* Slice Type */
-   uint8_t sd[SD_SIZE];        /* Slice Differentiator */
-}Snssai;
-
 typedef struct nonDynFiveQi
 {
    uint16_t   fiveQi;
index 8cf9301..7207a4b 100644 (file)
@@ -83,7 +83,6 @@
 #define MAX_NUM_PUCCH_P0_PER_SET 8
 #define MAX_NUM_PATH_LOSS_REF_RS 4
 #define MAX_NUM_DL_DATA_TO_UL_ACK 15
-#define SD_SIZE   3
 #define QPSK_MODULATION 2
 
 #define RAR_PAYLOAD_SIZE 10             /* As per spec 38.321, sections 6.1.5 and 6.2.3, RAR PDU is 8 bytes long and 2 bytes of padding */
    }                                                       \
 }
 
+typedef enum
+{
+   PRB_RSRC,
+   DRB_RSRC,
+   RRC_CONNECTED_USERS_RSRC
+}SchResourceType;
+
 typedef enum
 {
    NO_TRANSMISSION,
@@ -717,6 +723,21 @@ typedef struct schBwpUlCfg
    SchK2TimingInfoTbl k2InfoTbl;
 }SchBwpUlCfg;
 
+typedef struct schPolicyMemberList
+{
+   Plmn   plmn;
+   Snssai snssai;
+}SchPolicyMemberList;
+
+typedef struct schRrmPolicy
+{
+   SchResourceType     rsrcType;
+   SchPolicyMemberList memberList;
+   uint8_t             policyMaxRatio;
+   uint8_t             policyMinRatio;
+   uint8_t             policyDedicatedRatio;
+}SchRrmPolicy;
+
 typedef struct schCellCfg
 {
    uint16_t       cellId;           /* Cell Id */
@@ -731,9 +752,12 @@ typedef struct schCellCfg
    SchRachCfg     schRachCfg;       /* PRACH config */
    SchBwpDlCfg    schInitialDlBwp;  /* Initial DL BWP */
    SchBwpUlCfg    schInitialUlBwp;  /* Initial UL BWP */
+   uint8_t        numSliceSupport;  /* Total num of slice support */
+   Snssai         **snssai;         /* List of supporting snssai*/
+   SchRrmPolicy   *rrmPolicy;       /* RRM policy */
 #ifdef NR_TDD
    TDDCfg         tddCfg;           /* TDD Cfg */ 
-#endif
+#endif   
 }SchCellCfg;
 
 typedef struct schCellCfgCfm
@@ -1468,12 +1492,6 @@ typedef struct schDrbQos
    uint32_t                ulPduSessAggMaxBitRate;   /* UL PDU Session Aggregate max bit rate */
 }SchDrbQosInfo;
 
-typedef struct schSnssai
-{
-   uint8_t   sst;
-   uint8_t   sd[SD_SIZE];
-}SchSnssai;
-
 /* Special cell configuration */
 typedef struct schSpCellCfg
 {
@@ -1503,7 +1521,7 @@ typedef struct schLcCfg
    ConfigType     configType;
    uint8_t        lcId;
    SchDrbQosInfo  *drbQos;
-   SchSnssai      *snssai;
+   Snssai         *snssai;
    SchDlLcCfg     dlLcCfg;
    SchUlLcCfg     ulLcCfg;
 }SchLcCfg;
index c1a7b81..3e8ce11 100644 (file)
@@ -26,7 +26,6 @@
 #define CU_POOL 1
 #define MAX_DU_PORT 2
 #define DU_PORT 38472
-#define SD_SIZE   3 /*  As per the spec 38.473, SD size must be of size(3) */
 #define MAX_NUM_OF_SLICE 1024 /* As per the spec 38.473, maxnoofSliceItems = 1024*/
 
 /*VALID Tunnel ID*/
@@ -85,13 +84,6 @@ typedef struct CuSctpParams
    uint16_t    cuPort;
 }CuSctpParams;
 
-/* Single Network Slice Selection assistance Info */
-typedef struct snssai
-{
-   uint8_t sst;                /* Slice Type */
-   uint8_t sd[SD_SIZE];        /* Slice Differentiator */
-}Snssai;
-
 typedef struct cuCfgParams
 {
    uint32_t         cuId;
index f9b4176..e2cc0da 100644 (file)
@@ -142,7 +142,8 @@ void FillSlotConfig()
 /* This function is used to fill up the cell configuration for CL */
 uint8_t readMacCfg()
 {
-   uint8_t idx;
+   uint8_t idx=0, sliceIdx=0;
+   F1TaiSliceSuppLst *taiSliceSuppLst;
 
    duCfgParam.macCellCfg.carrierId = CARRIER_IDX;
 
@@ -353,6 +354,48 @@ uint8_t readMacCfg()
    /* fill PUCCH config common */
    duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchResourceCommon = PUCCH_RSRC_COMMON;
    duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchGroupHopping = PUCCH_GROUP_HOPPING;
+   
+   /* SNSSAI And RRM policy Configuration */
+   taiSliceSuppLst = &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst;
+   duCfgParam.macCellCfg.numSupportedSlice = taiSliceSuppLst->numSupportedSlices;
+   if(taiSliceSuppLst->snssai)
+   {
+      DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.snssai, (duCfgParam.macCellCfg.numSupportedSlice) * sizeof(Snssai*));
+      if(duCfgParam.macCellCfg.snssai == NULLP)
+      {
+         DU_LOG("\nERROR  --> DU_APP: Memory allocation failed at readMacCfg");
+         return RFAILED;
+      }
+   }
+   for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
+   {
+      if(taiSliceSuppLst->snssai[sliceIdx] != NULLP)
+      {
+         DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.snssai[sliceIdx], sizeof(Snssai));
+         if(duCfgParam.macCellCfg.snssai[sliceIdx] == NULLP)
+         {
+            DU_LOG("\nERROR  --> DU_APP: Memory allocation failed at readMacCfg");
+            return RFAILED;
+         }
+         memcpy(duCfgParam.macCellCfg.snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
+      }
+   }
+   
+   DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.rrmPolicy, sizeof(RrmPolicy));
+   if(duCfgParam.macCellCfg.rrmPolicy == NULLP)
+   {
+      DU_LOG("\nERROR  --> DU_APP: Memory allocation failed at readMacCfg");
+      return RFAILED;
+   }
+   memset(duCfgParam.macCellCfg.rrmPolicy, 0, sizeof(RrmPolicy));
+   /* TODO Check the exact data type of resource type once will receive the
+    * information from O1 interface */
+   duCfgParam.macCellCfg.rrmPolicy->rsrcType = RSRC_PRB;
+   memcpy(&duCfgParam.macCellCfg.rrmPolicy->memberList.snssai, duCfgParam.macCellCfg.snssai[DEDICATED_SLICE_INDEX],\
+   sizeof(Snssai));
+   duCfgParam.macCellCfg.rrmPolicy->policyMaxRatio = MAX_RATIO;
+   duCfgParam.macCellCfg.rrmPolicy->policyMinRatio = MIN_RATIO;
+   duCfgParam.macCellCfg.rrmPolicy->policyDedicatedRatio = DEDICATED_RATIO;
 
    return ROK;
 }
@@ -605,17 +648,10 @@ uint8_t readCfg()
    MibParams mib;
    Sib1Params sib1;
    F1TaiSliceSuppLst *taiSliceSuppLst;
-   RrmPolicy  *rrmPolicy;
 
    /* TODO Added these below variable for local testing, once we will receive the
     * configuration from O1 we can remove these variable */
-   F1Snsaai snsaai[NUM_OF_SUPPORTED_SLICE] = {{1,{2,3,4}},{5,{6,7,8}}};
-   ResourceType rsrcType = PRB;
-   RrmPolicyRatio policyRatio= {10,20,30};
-   PolicyMemberList memberList;
-   
-   memset(&memberList, 0, sizeof(PolicyMemberList));
-   memberList.snsaai =  snsaai[DEDICATED_SLICE_INDEX];
+   Snssai snssai[NUM_OF_SUPPORTED_SLICE] = {{1,{2,3,4}},{5,{6,7,8}}};
 
 #ifdef O1_ENABLE
    if( getStartupConfig(&g_cfg) != ROK )
@@ -745,31 +781,35 @@ uint8_t readCfg()
       /* List of Supporting Slices */
       for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
       {
-         taiSliceSuppLst = &duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].taiSliceSuppLst;
-
-         taiSliceSuppLst->pres = true;
+         taiSliceSuppLst = &duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].\
+         taiSliceSuppLst;
+         
+         /* TODO Calculte the exact number of supported slices once will get
+          * cell configuration from O1 */
          taiSliceSuppLst->numSupportedSlices = NUM_OF_SUPPORTED_SLICE;
+         if(taiSliceSuppLst->numSupportedSlices > MAX_NUM_OF_SLICE_ITEMS)
+         {
+            DU_LOG("\nERROR --> DU_APP: readCfg(): Number of supported slice [%d] is more than 1024",\
+            taiSliceSuppLst->numSupportedSlices);
+            return RFAILED;
+         }
 
-         memset(&taiSliceSuppLst->snssai, 0, sizeof(F1Snsaai));
-         for(sliceIdx=0; sliceIdx<NUM_OF_SUPPORTED_SLICE; sliceIdx++)
+         DU_ALLOC(taiSliceSuppLst->snssai, taiSliceSuppLst->numSupportedSlices*sizeof(Snssai*));
+         if(taiSliceSuppLst->snssai == NULLP)
+         {
+            DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
+            return RFAILED;
+         }
+         
+         for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
          {
-            DU_ALLOC(taiSliceSuppLst->snssai[sliceIdx], sizeof(F1Snsaai));
+            DU_ALLOC(taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
             if(taiSliceSuppLst->snssai[sliceIdx] == NULLP)
             {
                DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
                return RFAILED;
             }
-            memcpy(taiSliceSuppLst->snssai[sliceIdx], &snsaai[sliceIdx], sizeof(F1Snsaai));
-            
-            /* Checking rrmPolicy Slice list available or not */
-            if(!memcmp(&snsaai[sliceIdx], &memberList.snsaai, sizeof(F1Snsaai)))
-            {
-               rrmPolicy = &duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].rrmPolicy;
-               rrmPolicy->present = true;
-               rrmPolicy->rsrcType = rsrcType; 
-               rrmPolicy->memberList.snsaai = memberList.snsaai;
-               rrmPolicy->rrmPolicyRatio = policyRatio;
-            }
+            memcpy(taiSliceSuppLst->snssai[sliceIdx], &snssai[sliceIdx], sizeof(Snssai));
          }
       }
       /* TAC and EPSTAC */
index 9a7029d..cc30db1 100644 (file)
 #define MAXNUMOFUACPERPLMN 64       /* Maximum number of signalled categories per PLMN */
 #define NR_RANAC           150      /* RANAC */
 #define DEFAULT_CELLS      1        /* Max num of broadcast PLMN ids */
-#define NUM_OF_SUPPORTED_SLICE  2
-#define DEDICATED_SLICE_INDEX   1 
 #define IE_EXTENSION_LIST_COUNT 1
 
 /* Macro definitions for MIB/SIB1 */
 /*VALID Tunnel ID*/
 #define MIN_TEID 1   /*[Spec 29.281,Sec 5.1]: All Zero TEIDs are never assigned for setting up GTP-U Tunnel*/
 #define MAX_TEID 10 /*[Spec 29.281]: Max limit is not mentioned but as per GTP-U Header Format, TEID occupies 4 octets */
+
+/* Slice Ratio */
+#define MAX_RATIO        30
+#define MIN_RATIO        20
+#define DEDICATED_RATIO  10
+#define DEDICATED_SLICE_INDEX   1 
+#define NUM_OF_SUPPORTED_SLICE  2
+
 typedef enum
 {
    GNBDU,
@@ -483,13 +489,6 @@ typedef enum
    PUSCH_MAPPING_TYPE_B,
 }puschMappingType;
 
-typedef enum
-{
-   PRB,
-   DRB,
-   RRC_CONNECTED_USERS
-}ResourceType;
-
 typedef struct f1RrcVersion
 {
    char    rrcVer[30];     /* Latest RRC Version */
@@ -646,12 +645,6 @@ typedef struct f1EutraModeInfo
    }mode;
 }F1EutraModeInfo;
 
-typedef struct f1Snsaai
-{
-   uint8_t   sst;
-   uint8_t   sd[SD_SIZE];
-}F1Snsaai;
-
 typedef struct epIpAddr
 {
    char transportAddr[20]; /* Transport Layer Address */
@@ -663,32 +656,10 @@ typedef struct epIpAddrPort
    char   port[2];
 }EpIpAddrPort;
 
-typedef struct policyMemberList
-{
-   Plmn   plmn;
-   F1Snsaai snsaai;   
-}PolicyMemberList;
-
-typedef struct rrmPolicyRatio
-{
-   uint8_t policyMaxRatio;
-   uint8_t policyMinRatio;
-   uint8_t policyDedicatedRatio;
-}RrmPolicyRatio;
-
-typedef struct rrmPolicy
-{
-   bool present;
-   ResourceType     rsrcType;
-   PolicyMemberList memberList;
-   RrmPolicyRatio   rrmPolicyRatio;
-}RrmPolicy;
-
 typedef struct f1TaiSliceSuppLst
 {
-   bool       pres;
    uint8_t    numSupportedSlices;
-   F1Snsaai   *snssai[MAX_NUM_OF_SLICE_ITEMS];   
+   Snssai    **snssai;   
 }F1TaiSliceSuppLst;
 
 typedef struct f1SrvdPlmn
@@ -696,7 +667,6 @@ typedef struct f1SrvdPlmn
    Plmn   plmn;
    Plmn   extPlmn;    /* Extended available PLMN list */
    F1TaiSliceSuppLst taiSliceSuppLst;
-   RrmPolicy  rrmPolicy;
 }F1SrvdPlmn;
 
 typedef struct f1BrdcstPlmnInfo
index 1c07b75..11b4b11 100644 (file)
@@ -986,7 +986,7 @@ uint8_t BuildExtensions(ProtocolExtensionContainer_4624P3_t **ieExtend)
       }
    }
    
-   elementCnt = NUM_OF_SUPPORTED_SLICE;
+   elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices;
    idx = 0;
    (*ieExtend)->list.array[idx]->id = ProtocolIE_ID_id_TAISliceSupportList;
    (*ieExtend)->list.array[idx]->criticality = Criticality_ignore;
@@ -1482,7 +1482,8 @@ void FreeServedCellList( GNB_DU_Served_Cells_List_t *duServedCell)
                               }
                            }
                            DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
-                           SliceSupportList.list.array, sizeof(SliceSupportItem_t*));
+                           SliceSupportList.list.array, servedPlmnItem->iE_Extensions->list.array[0]->\
+                           extensionValue.choice.SliceSupportList.list.size);
                         }
                         DU_FREE(servedPlmnItem->iE_Extensions->list.array[0],\
                         sizeof(ServedPLMNs_ItemExtIEs_t));
@@ -2076,7 +2077,7 @@ uint8_t fillServedPlmns(ServedPLMNs_List_t *servedPlmn)
    }
    
    ieIdx = 0;
-   elementCnt = NUM_OF_SUPPORTED_SLICE
+   elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices
    servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->id =ProtocolIE_ID_id_TAISliceSupportList;
    servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->criticality = Criticality_ignore;
    servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.present = \