[Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-532] RIC Subscription Delete Req/Rsp API...
[o-du/l2.git] / src / 5gnrsch / sch.h
index 17a06fd..5a7a396 100644 (file)
@@ -17,8 +17,6 @@
  *******************************************************************************/
 
 /* macros */
-#define SCH_INST_START 1
-#define SCH_MAX_INST 1
 #define SCH_MU0_NUM_SLOTS 10 
 #define SCH_MU1_NUM_SLOTS 20 
 #define SCH_MU2_NUM_SLOTS 30 
@@ -47,7 +45,6 @@
 #define NUM_DMRS_SYMBOLS 1
 #define DMRS_ADDITIONAL_POS 0
 #define SCH_DEFAULT_K1 1
-#define SCH_TQ_SIZE 10
 #define SSB_IDX_SUPPORTED 1
 
 #define CRC_FAILED 0
@@ -80,6 +77,8 @@
 
 #define NUM_SCH_TYPE 2  /*Supported number of Scheduler Algorithm types*/
 
+#define SCH_TQ_SIZE 10
+
 typedef struct schDlHqProcCb SchDlHqProcCb;
 typedef struct schUlHqEnt SchUlHqEnt;
 typedef struct schRaReq SchRaReq;
@@ -279,7 +278,6 @@ struct schDlHqEnt
  */
 typedef struct schGenCb
 {
-   uint8_t         tmrRes;           /*!< Timer resolution */
    uint8_t         startCellId;      /*!< Starting Cell Id */
 #ifdef LTE_ADV
    bool            forceCntrlSrbBoOnPCel; /*!< value 1 means force scheduling
@@ -304,6 +302,7 @@ typedef struct schPrbAlloc
 {
    CmLListCp freePrbBlockList;           /*!< List of continuous blocks for available PRB */
    uint64_t  prbBitMap[ MAX_SYMB_PER_SLOT][PRB_BITMAP_MAX_IDX];  /*!< BitMap to store the allocated PRBs */
+   uint16_t  numPrbAlloc;
 }SchPrbAlloc;
 
 /**
@@ -491,6 +490,10 @@ typedef struct schUeCb
    bool          ueDrxInfoPres;
    SchDrxUeCb    drxUeCb;
 #endif
+   bool                 k0K1TblPrsnt;
+   SchK0K1TimingInfoTbl k0K1InfoTbl;
+   bool                 k2TblPrsnt;
+   SchK2TimingInfoTbl   k2InfoTbl;
 }SchUeCb;
 
 /**
@@ -576,7 +579,7 @@ typedef struct schAllApis
    void (* SchDeleteUlHqProcCb)(SchUlHqProcCb *hqP);
    void (* SchScheduleSlot)(SchCellCb *cell, SlotTimingInfo *slotInd, Inst schInst);
    uint32_t (* SchScheduleDlLc)(SlotTimingInfo pdcchTime, SlotTimingInfo pdschTime, uint8_t pdschNumSymbols, \
-      bool isRetx, SchDlHqProcCb **hqP);
+      uint16_t *startPrb, bool isRetx, SchDlHqProcCb **hqP);
    uint8_t (* SchScheduleUlLc)(SlotTimingInfo dciTime, SlotTimingInfo puschTime, uint8_t startStmb, \
       uint8_t symbLen, bool isRetx, SchUlHqProcCb **hqP);
 }SchAllApis;
@@ -597,6 +600,47 @@ typedef struct
    PdschCfg  sib1PdschCfg;
 }SchSib1Cfg;
 
+typedef struct dlTotalPrbUsage
+{
+   uint16_t numPrbUsedForTx;
+   uint16_t totalPrbAvailForTx;
+}TotalPrbUsage;
+
+typedef struct 
+{
+   TotalPrbUsage *dlTotalPrbUsage;
+   TotalPrbUsage *ulTotalPrbUsage;
+}SchKpiSupported;
+
+typedef struct
+{
+   CmLListCp  dlTotPrbUseList;
+   CmLListCp  ulTotPrbUseList;
+}SchKpiActive;
+
+typedef struct schStatsGrp
+{
+   Inst       schInst;
+   uint64_t   subscriptionId;
+   uint8_t    groupId;
+   uint16_t   periodicity;  /* In milliseconds */
+   CmTimer    periodTimer;
+   SchKpiSupported kpiStats;
+}SchStatsGrp;
+
+typedef struct schStatsInfo
+{
+   uint8_t     numStatsGroup;
+   SchStatsGrp statsGrpList[MAX_NUM_STATS_GRP];
+}SchStatsInfo;
+
+typedef struct schStatistics
+{
+   uint16_t      numOfStatsCfgd;
+   SchStatsInfo  statsInfoList[MAX_NUM_STATS_CFG];
+   SchKpiActive  activeKpiList;
+}SchStatistics;
+
 /**
  * @brief
  * Cell Control block per cell.
@@ -611,6 +655,7 @@ typedef struct schCellCb
    SchDlSlotInfo **schDlSlotInfo;                   /*!< SCH resource allocations in DL */
    SchUlSlotInfo **schUlSlotInfo;                   /*!< SCH resource allocations in UL */
    SchCellCfg    cellCfg;                           /*!< Cell ocnfiguration */
+   uint8_t       numerology;
    bool          firstSsbTransmitted;
    bool          firstSib1Transmitted;
    uint8_t       ssbStartSymbArr[SCH_MAX_SSB_BEAM]; /*!< start symbol per SSB beam */
@@ -641,12 +686,12 @@ typedef struct schCellCb
    uint8_t              maxMsg3Tx;         /* MAximum num of msg3 tx*/
 }SchCellCb;
 
-
-typedef struct schSliceCfg
+typedef struct schTimer
 {
-   uint8_t        numOfSliceConfigured;
-   SchRrmPolicyOfSlice **listOfSlices;
-}SchSliceCfg;
+   CmTqCp       tmrTqCp;               /*!< Timer Task Queue Cntrl Point */
+   CmTqType     tmrTq[SCH_TQ_SIZE];    /*!< Timer Task Queue */
+   uint8_t      tmrRes;              /*!< Timer resolution */
+}SchTimer;
 
 /**
  * @brief
@@ -656,11 +701,11 @@ typedef struct schCb
 {
    TskInit                schInit;               /*!< Task Init info */
    SchGenCb               genCfg;                /*!< General Config info */
-   CmTqCp                 tmrTqCp;               /*!< Timer Task Queue Cntrl Point */
-   CmTqType               tmrTq[SCH_TQ_SIZE];    /*!< Timer Task Queue */
+   SchTimer               schTimersInfo;         /*!< Sch timer queues and resolution */
    SchAllApis             allApis[NUM_SCH_TYPE]; /*!<List of All Scheduler Type dependent Function pointers*/
    SchCellCb              *cells[MAX_NUM_CELL];  /* Array to store cellCb ptr */
-   SchSliceCfg            sliceCfg;
+   CmLListCp              sliceCfg;              /* Linklist to Store Slice configuration */
+   SchStatistics          statistics;            /* Statistics configuration and calculated values */
 }SchCb;
 
 /* Declaration for scheduler control blocks */
@@ -686,6 +731,9 @@ uint8_t SchProcCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
 uint8_t SchProcSlotInd(Pst *pst, SlotTimingInfo *slotInd);
 uint8_t SchProcRachInd(Pst *pst, RachIndInfo *rachInd);
 uint8_t SchProcCrcInd(Pst *pst, CrcIndInfo *crcInd);
+uint8_t SchProcUlCqiInd(Pst *pst, SchUlCqiInd *ulCqiInd);
+uint8_t SchProcDlCqiInd(Pst *pst, SchDlCqiInd *dlCqiInd);
+uint8_t SchProcPhrInd(Pst *pst, SchPwrHeadroomInd *schPhrInd);
 uint8_t SchProcDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo);
 uint8_t SchAddUeConfigReq(Pst *pst, SchUeCfgReq *ueCfgToSch);
 uint8_t SchProcBsr(Pst *pst, UlBufferStatusRptInd *bsrInd);
@@ -715,7 +763,7 @@ uint8_t schDlRsrcAllocMsg4(SchCellCb *cell, SlotTimingInfo msg4Time, uint8_t ueI
 uint8_t pdschStartSymbol, uint8_t pdschNumSymbols, bool isRetx, SchDlHqProcCb *hqP);
 uint8_t allocatePrbDl(SchCellCb *cell, SlotTimingInfo slotTime, uint8_t startSymbol, uint8_t symbolLength, \
    uint16_t *startPrb, uint16_t numPrb);
-void fillDlMsgInfo(DlMsgSchInfo *dlMsgInfo, uint8_t crnti, bool isRetx, SchDlHqProcCb* hqP);
+void fillDlMsgInfo(DlMsgSchInfo *dlMsgInfo, uint16_t crnti, bool isRetx, SchDlHqProcCb* hqP); /*AS per 38.473 V15.3.0, Section 9.3.1.32 crnti value range is b/w 0..65535*/
 bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, bool dedMsg, uint8_t *pdschStartSymbol,\
 uint8_t *pdschSymblLen, SlotTimingInfo *pdcchTime,  SlotTimingInfo *pdschTime, SlotTimingInfo *pucchTime, bool isRetx, SchDlHqProcCb *hqP);
 RaRspWindowStatus isInRaRspWindow(SchRaReq *raReq, SlotTimingInfo frameToCheck, uint16_t numSlotsPerSystemFrame);
@@ -771,6 +819,12 @@ void schUpdateHarqFdbk(SchUeCb *ueCb, uint8_t numHarq, uint8_t *harqPayload,Slot
 uint8_t schFillUlDciForMsg3Retx(SchRaCb *raCb, SchPuschInfo *puschInfo, DciInfo *dciInfo);
 bool schGetMsg3K2(SchCellCb *cell, SchUlHqProcCb* msg3HqProc, uint16_t dlTime, SlotTimingInfo *msg3Time, bool isRetx);
 void schMsg4Complete(SchUeCb *ueCb);
+
+/* Statistics Function */
+uint8_t SchProcStatsReq(Pst *pst, SchStatsReq *statsReq);
+uint8_t SchSendStatsIndToMac(Inst inst, SchStatsInd  *statsInd);
+uint8_t schCalcAndSendGrpStats(SchStatsGrp *grpInfo);
+uint8_t SchProcStatsDeleteReq(Pst *pst, SchStatsDeleteReq *statsDeleteReq);
 /**********************************************************************
   End of file
  **********************************************************************/