[Epic-ID: ODUHIGH-488][Task-ID: ODUHIGH-501] WG8 Alignment | DL Broadcast Request 47/10747/2
authorlal.harshita <Harshita.Lal@radisys.com>
Mon, 20 Mar 2023 10:46:13 +0000 (16:16 +0530)
committerlal.harshita <Harshita.Lal@radisys.com>
Tue, 21 Mar 2023 09:18:09 +0000 (14:48 +0530)
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
Change-Id: Ia06795f4abad9371f28c19b7bb9ae0139385a9f2
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
src/5gnrmac/mac_cfg_hdl.c
src/5gnrmac/mac_msg_router.c
src/cm/du_app_mac_inf.c
src/cm/du_app_mac_inf.h
src/du_app/du_cell_mgr.c
src/du_app/du_f1ap_msg_hdl.c

index 1af9b0b..ac05143 100644 (file)
@@ -961,6 +961,55 @@ uint8_t MacProcDlPcchInd(Pst *pst, DlPcchInd *pcchInd)
    }
    return ret;
 }
+
+/**
+ * @brief Mac process the downlink Broadcast Req received from DUAPP
+ *
+ * @details
+ *
+ *     Function : MacProcDlBroadcastReq 
+ *
+ *     This function process the downlink Broadcast Req received from DUAPP
+ *
+ *  @param[in]  Pst           *pst
+ *  @param[in]  DlBroadcastReq    *dlBroadcastReq 
+ *  @return  int
+ *      -# ROK
+ **/
+uint8_t MacProcDlBroadcastReq(Pst *pst, MacDlBroadcastReq *dlBroadcastReq)
+{
+   uint8_t ret = ROK, idx=0;
+   uint16_t cellIdx = 0;
+
+   if(dlBroadcastReq)
+   {
+      DU_LOG("\nINFO   -->  MAC : Received DL braodcast req from DU_APP for cellId[%d]", dlBroadcastReq->cellId);
+      
+      GET_CELL_IDX(dlBroadcastReq->cellId, cellIdx);
+
+      if(macCb.macCell[cellIdx] == NULLP || macCb.macCell[cellIdx]->cellId != dlBroadcastReq->cellId)
+      {
+         ret = RFAILED;
+         DU_LOG("\nERROR  -->  MAC : MacProcDlBroadcastReq(): CellId[%d] does not exist", dlBroadcastReq->cellId);
+      }
+      else
+      {
+         /*TODO - Complete the processing of DL Broadcast Request*/
+      }
+      for(idx = 0; idx<dlBroadcastReq->numSiBlock; idx++)
+      {
+         MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlBroadcastReq->siSchedulingInfo[idx]->siAreaID, sizeof(uint8_t));
+         MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlBroadcastReq->siSchedulingInfo[idx], sizeof(SiSchedulingInfo));
+      }
+      MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlBroadcastReq, sizeof(MacDlBroadcastReq));
+   }
+   else
+   {
+      ret = RFAILED;
+      DU_LOG("\nERROR  -->  MAC : MacProcDlBroadcastReq(): Received Null pointer");
+   }
+   return ret;
+}
 /**********************************************************************
   End of file
  **********************************************************************/
index 114e1d8..1ed8fb3 100755 (executable)
@@ -173,6 +173,13 @@ void MacHdlDuappEvents(Pst *pst, Buffer *mBuf)
             unpackMacDlPcchInd(MacProcDlPcchInd, pst, mBuf);
             break;
          }
+      case EVENT_MAC_DL_BROADCAST_REQ:
+         {
+            /* Process Dl Broadcast Request */  
+            unpackMacDlBroadcastReq(MacProcDlBroadcastReq, pst, mBuf);
+            break;
+         }
+
       case EVENT_MAC_UE_RESET_REQ:
          {
             /* Process UE Reset Request */  
index d5735c8..44f381b 100644 (file)
@@ -2178,6 +2178,84 @@ uint8_t unpackDuMacUeSyncStatusInd(MacDuUeSyncStatusIndFunc func, Pst *pst, Buff
     return RFAILED;
 }
 
+/*******************************************************************
+*
+* @brief Packs and Sends Dl Broadcast Request from DUAPP to MAC
+*
+* @details
+*
+*    Function : packDuMacDlBroadcastReq
+*
+*    Functionality:
+*       Packs and Sends Dl Broadcast Request from DUAPP to MAC
+*
+*
+* @params[in] Post structure pointer
+*             MacDlBroadcastReq pointer
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t packDuMacDlBroadcastReq(Pst *pst, MacDlBroadcastReq *ueDel)
+{
+    Buffer *mBuf = NULLP;
+
+    if(pst->selector == ODU_SELECTOR_LWLC)
+    {
+       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
+       {
+          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacDlBroadcastReq");
+          return RFAILED;
+       }
+       /* pack the address of the structure */
+       CMCHKPK(oduPackPointer,(PTR)ueDel, mBuf);
+    }
+    else
+    {
+       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacDlBroadcastReq");
+       return RFAILED;
+    }
+    return ODU_POST_TASK(pst,mBuf);
+}
+
+/*******************************************************************
+*
+* @brief Unpacks Dl Broadcast Request received from DU APP
+*
+* @details
+*
+*    Function : unpackMacDlBroadcastReq 
+*
+*    Functionality:
+*         Unpacks Dl Broadcast Request received from DU APP
+*
+* @params[in] Pointer to Handler
+*             Post structure pointer
+*             Message Buffer
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t unpackMacDlBroadcastReq(DuMacDlBroadcastReq func, Pst *pst, Buffer *mBuf)
+{
+    if(pst->selector == ODU_SELECTOR_LWLC)
+    {
+       MacDlBroadcastReq *dlBroadcast;
+
+       /* unpack the address of the structure */
+       CMCHKUNPK(oduUnpackPointer, (PTR *)&dlBroadcast, mBuf);
+       ODU_PUT_MSG_BUF(mBuf);
+       return (*func)(pst, dlBroadcast);
+    }
+    else
+    {
+       /* Nothing to do for other selectors */
+       DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for Dl Broadcast Request ");
+       ODU_PUT_MSG_BUF(mBuf);
+    }
+
+    return RFAILED;
+}
 /*******************************************************************
  *
  * @brief Searches for first unset bit in ueBitMap
index af3b622..76fd5f6 100644 (file)
@@ -21,7 +21,8 @@
 #define __MACINT_H__
 
 #define NUM_NUMEROLOGY 5  /* Number of numerology */
-
+#define MAX_SI_MESSAGE 32 /* As per 138 331 V15.3, RRC Multiplicity and type constraint definitions maxSI-Message = 32 */ 
+#define NUM_SIB 32         /* As per 138 331 V15.3, RRC Multiplicity and type constraint definitions  maxSIB = 32 */ 
 #define NUM_SSB                1       /* max value is 64 */
 #define SSB_MASK_SIZE  1       /* SSB mask size is 32bit for sub6 */
 #define SIB1_REPETITION_PERIOD   20
@@ -87,6 +88,7 @@
 #define EVENT_MAC_UE_RESET_REQ       225
 #define EVENT_MAC_UE_RESET_RSP       226
 #define EVENT_MAC_UE_SYNC_STATUS_IND 227
+#define EVENT_MAC_DL_BROADCAST_REQ   228
 
 #define BSR_PERIODIC_TIMER_SF_10 10
 #define BSR_RETX_TIMER_SF_320 320
 #define PAGING_SCHED_DELTA  4
 #define MAX_PLMN 2
 
+typedef enum
+{
+   SIB_TYPE2,
+   SIB_TYPE3,
+   SIB_TYPE4,
+   SIB_TYPE5,
+   SIB_TYPE6,
+   SIB_TYPE7,
+   SIB_TYPE8,
+   SIB_TYPE9,
+   SPARE
+}SibType;
+
+typedef enum
+{
+   SSB_PER_RACH_OCCASION_ONE_EIGHTH,
+   SSB_PER_RACH_OCCASION_ONE_FOURTH,
+   SSB_PER_RACH_OCCASION_ONE_HALF,
+   SSB_PER_RACH_OCCASION_ONE,
+   SSB_PER_RACH_OCCASION_TWO,
+   SSB_PER_RACH_OCCASION_FOUR,
+   SSB_PER_RACH_OCCASION_EIGHT,
+   SSB_PER_RACH_OCCASION_SIXTEEN
+}SsbPerRachOccasion;
+
+typedef enum
+{
+   BROADCASTING,
+   NOTBROADCASTING,
+}SiBroadcastStatus;
+
+typedef enum
+{
+   RF8,
+   RF16,
+   RF32,
+   RF64,
+   RF128,
+   RF256,
+   RF512
+}SiPeriodicity;
+
+typedef enum
+{
+   S5,
+   S10,
+   S20, 
+   S40, 
+   S80, 
+   S160, 
+   S320, 
+   S640, 
+   S1280
+}SiWindowLength;
+
+typedef enum
+{
+   SI_REQ_PERIOD_1,
+   SI_REQ_PERIOD_2,
+   SI_REQ_PERIOD_4,
+   SI_REQ_PERIOD_6,
+   SI_REQ_PERIOD_8,
+   SI_REQ_PERIOD_10,
+   SI_REQ_PERIOD_12,
+   SI_REQ_PERIOD_16
+}SiRequestPeriod;
+
 typedef enum
 {
    MAC_DU_APP_RSP_NOK,
@@ -1645,6 +1714,7 @@ typedef struct macSliceCfgReq
 typedef struct macSliceCfgReq MacSliceRecfgReq;
 typedef struct macSliceCfgRsp MacSliceRecfgRsp;
 
+/*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.17 DL PCCH Indication */
 typedef struct dlPcchInd
 {
    uint16_t  cellId;
@@ -1654,6 +1724,8 @@ typedef struct dlPcchInd
    uint8_t  *pcchPdu;
 }DlPcchInd;
 
+
+/*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.1 Cell Start */
 typedef struct cellInfo
 {
     SlotTimingInfo slotInfo;
@@ -1663,12 +1735,14 @@ typedef struct cellInfo
 typedef struct cellInfo CellStartInfo;
 typedef struct cellInfo CellStopInfo;
 
+/*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.12 UE Reset Request */
 typedef struct ueReset
 {
     uint16_t cellId;
     uint8_t  ueId;
 }MacUeResetReq;
 
+/*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.13 UE Reset Response */
 typedef struct ueResetRsp
 {
    uint16_t cellId;
@@ -1676,6 +1750,7 @@ typedef struct ueResetRsp
    CauseOfResult  status;
 }MacUeResetRsp;
 
+/*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.14 UE Sync Status Indication */
 typedef struct ueSyncStatusInd
 {
    uint16_t   cellId;
@@ -1683,6 +1758,81 @@ typedef struct ueSyncStatusInd
    SyncStatus status;
 }MacUeSyncStatusInd;
 
+/* The following list of structures is taken from the SI-SchedulingInfo section of specification 33.331. */
+typedef struct sibTypeInfo
+{
+   SibType sibType;
+   uint8_t valueTag;
+   bool    areaScope;
+}SibTypeInfo;
+
+typedef struct sibMappingInfo
+{
+   uint8_t      numSibTypeInfo;
+   SibTypeInfo  sibTypeInfo[NUM_SIB];
+}SibMappingInfo;
+
+typedef struct schedulingInfo 
+{
+   SiBroadcastStatus siBroadcastStatus;
+   SiPeriodicity     siPeriodicity;
+   SibMappingInfo    sibMappingInfo;
+}SchedulingInfo;
+
+typedef struct rachOccasionsSi
+{
+   RachCfgGeneric     rachConfigSi;
+   SsbPerRachOccasion ssbPerRachOccasion;
+}RachOccasionsSi;
+
+typedef struct siReqRsrc 
+{
+   uint8_t raPreambleStartIndex;
+   uint8_t raAssociationPeriodIndex;
+   uint8_t raSsbOccasionMaskIndex; 
+}SiReqRsrc;
+
+typedef struct siRequestResource
+{
+   uint8_t    numOfSiReqRsrc;
+   SiReqRsrc  siReqRsrc[MAX_SI_MESSAGE];
+}SiRequestResource;
+
+typedef struct siRequestConfig
+{
+   RachOccasionsSi    rachOccasionsSi;
+   SiRequestPeriod    siRequestPeriod;
+   SiRequestResource  siRequestResource;
+}SiRequestConfig;
+
+typedef struct schedulingInfoList
+{
+   uint8_t        numSchInfo;
+   SchedulingInfo schedulingInfo[MAX_SI_MESSAGE];
+}SchedulingInfoList;
+
+typedef struct siSchedulingInfo
+{
+   SchedulingInfoList schInfoList;
+   SiWindowLength     siWindowLength;
+   SiRequestConfig    siRequestConfig;
+   SiRequestConfig    siRequestConfigSUL;
+   uint8_t            *siAreaID;
+}SiSchedulingInfo;
+
+/*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.18 DL Broadcast Request  */
+typedef struct macDlBroadcastReq
+{
+    uint16_t         cellId;
+    uint8_t          numSiBlock;
+    SiSchedulingInfo **siSchedulingInfo;
+}MacDlBroadcastReq;
+
+/* DL broadcast req from DU APP to MAC*/
+typedef uint8_t (*DuMacDlBroadcastReq) ARGS((
+         Pst           *pst,
+         MacDlBroadcastReq *dlBroadcast));
+
 /* Functions for CellUp Ind from MAC to DU APP*/
 typedef uint8_t (*DuMacCellUpInd) ARGS((
         Pst       *pst,
@@ -1919,6 +2069,9 @@ uint8_t unpackDuMacUeResetRsp(MacDuUeResetRspFunc func, Pst *pst, Buffer *mBuf);
 uint8_t packDuMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *ueSyncStatusInd);
 uint8_t DuProcMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *ueSyncStatusInd);
 uint8_t unpackDuMacUeSyncStatusInd(MacDuUeSyncStatusIndFunc func, Pst *pst, Buffer *mBuf);
+uint8_t packDuMacDlBroadcastReq(Pst *pst, MacDlBroadcastReq *dlBroadcastReq);
+uint8_t MacProcDlBroadcastReq(Pst *pst,  MacDlBroadcastReq *dlBroadcastReq);
+uint8_t unpackMacDlBroadcastReq(DuMacDlBroadcastReq func, Pst *pst, Buffer *mBuf);
 #endif
 
 
index 191240f..286d2db 100644 (file)
@@ -60,6 +60,12 @@ DuMacDlPcchInd packMacDlPcchIndOpts[] =
    packDuMacDlPcchInd        /* Light weight-loose coupling */
 };
 
+DuMacDlBroadcastReq packMacDlBroadcastReqOpts[] =
+{
+   packDuMacDlBroadcastReq,       /* Loose coupling */
+   MacProcDlBroadcastReq,         /* TIght coupling */
+   packDuMacDlBroadcastReq        /* Light weight-loose coupling */
+};
 /*******************************************************************
  *
  * @brief Processes cells to be activated
@@ -1062,6 +1068,56 @@ uint8_t processPagingMsg(uint16_t cellId, DuPagingMsg *rcvdF1apPagingParam)
    return ROK;
 
 }
+
+/*******************************************************************
+ *
+ * @brief DU build and send dl broacast req  and send it to MAC
+ *
+ * @details
+ *
+ *    Function : duBuildAndSendDlBroadcastReq
+ *
+ *    Functionality: DU build and send dl broacast req and send to MAC
+ *                   
+ *
+ * @params[in] cellId, crnti 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t duBuildAndSendDlBroadcastReq()
+{
+   Pst pst;
+   uint8_t ret =ROK;
+   MacDlBroadcastReq *dlBroadcast=NULLP;
+
+   DU_LOG("\nDEBUG  -->  DU_APP : Building Dl broadcast request");
+
+   DU_ALLOC_SHRABL_BUF(dlBroadcast, sizeof(MacDlBroadcastReq));
+   if(dlBroadcast)
+   {
+      /*TODO - fill MAC DL Broadcast Request*/
+      
+      FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_DL_BROADCAST_REQ);
+
+      DU_LOG("\nDEBUG  -->  DU_APP: Sending Dl broadcast  Request to MAC ");
+      ret = (*packMacDlBroadcastReqOpts[pst.selector])(&pst, dlBroadcast);
+      if(ret == RFAILED)
+      {
+         DU_LOG("\nERROR  -->  DU_APP: sendDlBroadcastReqToMac(): Failed to send Dl broadcast  Req to MAC");
+         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlBroadcast, sizeof(MacDlBroadcastReq));
+      }
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->   DU_APP: sendDlBroadcastReqToMac(): Failed to allocate memory"); 
+      ret =  RFAILED;
+   }
+
+   return ret;
+}
+
 /**********************************************************************
   End of file
  **********************************************************************/
index 2719cdb..1bece2e 100644 (file)
@@ -15291,9 +15291,9 @@ uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg, MsgLen recvBufLen, char *recvBuf)
            DU_LOG("\nERROR  -->  DU_APP : Invalid IE received in F1SetupRsp:%ld",
                  f1SetRspMsg->protocolIEs.list.array[idx]->id);
       }
-      duProcF1SetupRsp();
    }
    
+   duProcF1SetupRsp();
    freeAperDecodeF1SetupRsp(f1SetRspMsg);
 
    duCb.f1SetupReqAndRspMsg.f1MsgRspBufSize = recvBufLen;