X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Fmac.h;h=5a1db5a007f9324fd577c3259d7950695d87ebe2;hb=6dc8a4c17da24847b3a3aee91b37151f77a8a5bc;hp=88eeb87257ea8134de41a4ecf12b7c67997d279a;hpb=6b44407d464a5a4e060999255233a7cfe78bb0fa;p=o-du%2Fl2.git diff --git a/src/5gnrmac/mac.h b/src/5gnrmac/mac.h index 88eeb8725..5a1db5a00 100644 --- a/src/5gnrmac/mac.h +++ b/src/5gnrmac/mac.h @@ -21,51 +21,17 @@ /* MAX values */ #define MAX_MAC_CE 6 #define MAX_CRI_SIZE 6 -#define MAX_MAC_DL_PDU 10 +#define MAX_MAC_DL_PDU 16 #define MAX_NUM_HARQ_PROC 16 -#define MAX_SLOT_SUPPORTED 10 /* numerology 0 15Khz */ #define MAX_ZERO_CORR_CFG_IDX 16 /* max zero correlation config index */ +#define MAC_TQ_SIZE 10 /* Timing Queue Size */ +#define MAX_NUM_TIMER 1 /* MAX number of MAC timers */ +#define MAX_PENDING_STATS_RSP 5 /* Maximum number of statistics request for which response is pending */ #define DEFAULT_CELLS 1 #define SI_RNTI 0xFFFF #define P_RNTI 0xFFFE -#define PERIODIC_BSR_TMR_1MS 1 -#define PERIODIC_BSR_TMR_5MS 5 -#define PERIODIC_BSR_TMR_10MS 10 -#define PERIODIC_BSR_TMR_16MS 16 -#define PERIODIC_BSR_TMR_20MS 20 -#define PERIODIC_BSR_TMR_32MS 32 -#define PERIODIC_BSR_TMR_40MS 40 -#define PERIODIC_BSR_TMR_60MS 60 -#define PERIODIC_BSR_TMR_80MS 80 -#define PERIODIC_BSR_TMR_128MS 128 -#define PERIODIC_BSR_TMR_160MS 160 -#define PERIODIC_BSR_TMR_320MS 320 -#define PERIODIC_BSR_TMR_640MS 640 -#define PERIODIC_BSR_TMR_1280MS 1280 -#define PERIODIC_BSR_TMR_2560MS 2560 - -#define RETX_BSR_TMR_10MS 10 -#define RETX_BSR_TMR_20MS 20 -#define RETX_BSR_TMR_40MS 40 -#define RETX_BSR_TMR_80MS 80 -#define RETX_BSR_TMR_160MS 160 -#define RETX_BSR_TMR_320MS 320 -#define RETX_BSR_TMR_640MS 640 -#define RETX_BSR_TMR_1280MS 1280 -#define RETX_BSR_TMR_2560MS 2560 -#define RETX_BSR_TMR_5120MS 5120 -#define RETX_BSR_TMR_10240MS 10240 - -#define SR_DELAY_TMR_20MS 20 -#define SR_DELAY_TMR_40MS 40 -#define SR_DELAY_TMR_64MS 64 -#define SR_DELAY_TMR_128MS 128 -#define SR_DELAY_TMR_512MS 512 -#define SR_DELAY_TMR_1024MS 1024 -#define SR_DELAY_TMR_2560MS 2560 - #define MAC_LCID_CCCH 0 #define MAC_LCID_MIN 1 #define MAC_LCID_MAX 32 @@ -85,23 +51,66 @@ #define MAC_LCID_CRI 62 #define MAC_LCID_PADDING 63 +/* Definitions for size of RAR PDU contents (in bits). + * Refer spec 38.321, sections 6.1.4, 6.2.2 and 6.2.3*/ +#define E_BIT_SIZE 1 +#define T_BIT_SIZE 1 +#define R_BIT_SIZE 1 +#define RAPID_SIZE 6 +#define LC_ID_SIZE 6 +#define TIMING_ADVANCE_SIZE 12 +#define T_CRNTI_SIZE 16 + +/* UL Grant is of size = 27 bits. Refer to Spec 38.213, Table 8.2-1 for + * contents of UL grant in RAR */ +#define FREQ_HOP_FLAG_SIZE 1 +#define FREQ_RSRC_ALLOC_SIZE 14 +#define TIME_RSRC_ALLOC_SIZE 4 +#define MCS_SIZE 4 +#define TPC_COMMAND_SIZE 3 +#define CSI_REQUEST_SIZE 1 + typedef struct macCellCb MacCellCb; +typedef enum +{ + CELL_STATE_UP, + CELL_TO_BE_STOPPED, + CELL_STOP_IN_PROGRESS, +}MacCellStatus; + typedef enum { UE_STATE_INACTIVE, - UE_STATE_ACTIVE + UE_STATE_ACTIVE, + UE_HANDIN_IN_PROGRESS }UeState; typedef enum { - LC_STATE_INACTIVE, - LC_STATE_ACTIVE -}LcState; + MAC_LC_STATE_INACTIVE, + MAC_LC_STATE_ACTIVE +}MacLcState; + +typedef struct dlTbInfo +{ + SlotTimingInfo txTime; + uint16_t tbSize; + uint8_t *tb; +}DlTbInfo; + +/* DL HARQ Process Info */ +typedef struct dlHarqProcCb +{ + uint8_t procId; /* HARQ Process Id */ + uint8_t numTb; /* Number of TB */ + DlTbInfo tbInfo[MAX_NUM_TB_PER_UE]; /* TB information */ +}DlHarqProcCb; typedef struct macDlSlot { DlSchedInfo dlInfo; + DlPageAlloc *pageAllocInfo; }MacDlSlot; typedef struct macUlSlot @@ -116,8 +125,8 @@ typedef struct macCbInfo uint8_t msg3Pdu[6]; /* used as CRI value during muxing */ uint8_t *msg4Pdu; /* storing DL-CCCH Ind Pdu */ uint16_t msg4PduLen; /* storing DL-CCCH Ind Pdu Len */ - uint8_t *msg4TxPdu; /* muxed Pdu used for re-transmission */ - uint16_t msg4TbSize; /* size required for msg4TxPdu */ + DlHarqProcCb msg4HqInfo; /* HARQ process info for msg 4 */ + bool *macMsg4Status; }MacRaCbInfo; typedef struct macCe @@ -141,16 +150,11 @@ typedef struct macDlInfo typedef struct macDlData { + uint8_t ueId; uint16_t numPdu; MacDlInfo pduInfo[MAX_MAC_DL_PDU]; }MacDlData; -/* HARQ Process Info */ -typedef struct dlHarqProcCb -{ - uint8_t procId; /* HARQ Process Id */ -}DlHarqProcCb; - /* DL HARQ entity */ typedef struct dlHarqEnt { @@ -162,16 +166,28 @@ typedef struct dlHarqEnt /* Uplink deidcated logical channel info */ typedef struct ulLcCb { - uint8_t lcId; /* Logical Channel Id */ - uint8_t lcGrpId; /* Logical Channel group */ - LcState 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 */ - LcState 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 */ @@ -187,7 +203,7 @@ typedef struct ueUlCb { uint8_t maxReTx; /* MAX HARQ retransmission */ uint8_t numUlLc; /* Number of uplink logical channels */ - UlLcCb lcCb[MAX_NUM_LOGICAL_CHANNELS]; /* Uplink dedicated logocal channels */ + UlLcCb lcCb[MAX_NUM_LC]; /* Uplink dedicated logocal channels */ }UeUlCb; /* UE specific DL Info */ @@ -195,55 +211,99 @@ typedef struct ueDlCb { DlHarqEnt dlHarqEnt; /* DL HARQ entity */ uint8_t numDlLc; /* Number of downlink logical channels */ - DlLcCb lcCb[MAX_NUM_LOGICAL_CHANNELS]; /* Downlink dedicated logical channels */ + DlLcCb lcCb[MAX_NUM_LC]; /* Downlink dedicated logical channels */ }UeDlCb; /* UE Cb */ typedef struct macUeCb { - uint16_t ueIdx; /* UE Idx assigned by DU APP */ - uint16_t crnti; /* UE CRNTI */ - MacCellCb *cellCb; /* Pointer to cellCb to whihc this UE belongs */ - UeState state; /* Is UE active ? */ - MacRaCbInfo *raCb; /* RA info */ - MacBsrTmrCfg bsrTmrCfg; /* BSR Timer Info */ - UeUlCb ulInfo; /* UE specific UL info */ - UeDlCb dlInfo; /* UE specific DL info */ + uint16_t ueId; /* UE Id from DU APP */ + uint16_t crnti; /* UE CRNTI */ + MacCellCb *cellCb; /* Pointer to cellCb to whihc this UE belongs */ + UeState state; /* Is UE active ? */ + MacCfraResource cfraResource; /* CF-RA resource */ + MacRaCbInfo *raCb; /* RA info */ + MacBsrTmrCfg bsrTmrCfg; /* BSR Timer Info */ + UeUlCb ulInfo; /* UE specific UL info */ + UeDlCb dlInfo; /* UE specific DL info */ + DataTransmissionAction transmissionAction; }MacUeCb; struct macCellCb { - uint16_t cellId; - MacRaCbInfo macRaCb[MAX_NUM_UE]; - MacDlSlot dlSlot[MAX_SLOT_SUPPORTED]; - MacUlSlot ulSlot[MAX_SLOT_SUPPORTED]; - uint16_t numActvUe; - MacUeCb ueCb[MAX_NUM_UE]; - MacCellCfg macCellCfg; - SlotIndInfo currTime; + uint16_t cellId; + uint16_t numOfSlots; + MacCellStatus state; + uint16_t crntiMap; + MacRaCbInfo macRaCb[MAX_NUM_UE]; + MacDlSlot dlSlot[MAX_SLOTS]; + MacUlSlot ulSlot[MAX_SLOTS]; + uint16_t numActvUe; + MacUeCreateReq *ueCfgTmpData[MAX_NUM_UE]; + MacUeRecfg *ueRecfgTmpData[MAX_NUM_UE]; + MacUeCb ueCb[MAX_NUM_UE]; + MacCellCfg macCellCfg; + uint8_t numerology; + SlotTimingInfo currTime; }; +typedef struct macStatistics +{ + uint8_t numPendingStatsRsp; + MacStatsRsp pendingStatsRsp[MAX_PENDING_STATS_RSP]; + + /* This structure can be developed in future to add details of + * the statistics to be calculated at MAC */ +}MacStatistics; + typedef struct macCb { - Inst macInst; - ProcId procId; - MacCellCb *macCell[MAX_NUM_CELL]; + Inst macInst; + ProcId procId; + uint8_t tmrRes; /*!< Timer resolution */ + CmTqCp tmrTqCp; /*!< Timer Task Queue Cntrl Point */ + CmTqType tmrTq[MAC_TQ_SIZE]; /*!< Timer Task Queue */ + CmTimer tmrBlk[MAX_NUM_TIMER]; /*!< Timer Block */ + MacCellCb *macCell[MAX_NUM_CELL]; + MacStatistics statistics; }MacCb; /* global variable */ MacCb macCb; + +/* Function declarations */ +uint8_t macActvInit ARGS((Ent entity, Inst inst, Region region, Reason reason)); +uint8_t macActvTsk(Pst *pst, Buffer *mBuf); +short int macActvTmr(Ent ent,Inst inst); + void fillRarPdu(RarInfo *rarInfo); -void createMacRaCb(uint16_t cellId, uint16_t crnti); -void fillMsg4DlData(uint16_t cellId, MacDlData *dlData, uint8_t *msg4Pdu); +void fillMsg4DlData(MacDlData *dlData, uint16_t msg4PduLen, uint8_t *msg4Pdu); void fillMacCe(MacCeInfo *macCeData, uint8_t *msg3Pdu); void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *msg4TxPdu, uint16_t tbSize); -uint8_t unpackRxData(uint16_t cellId, SlotIndInfo slotInfo, RxDataIndPdu *rxDataIndPdu); -void fillMg4Pdu(Msg4Alloc *msg4Alloc); -void buildAndSendMuxPdu(SlotIndInfo currTimingInfo); +uint8_t unpackRxData(uint16_t cellId, SlotTimingInfo slotInfo, RxDataIndPdu *rxDataIndPdu); +void fillMg4Pdu(DlMsgSchInfo *msg4Alloc); +void buildAndSendMuxPdu(SlotTimingInfo currTimingInfo); uint8_t macProcUlCcchInd(uint16_t cellId, uint16_t crnti, uint16_t rrcContSize, uint8_t *rrcContainer); uint8_t macProcShortBsr(uint16_t cellId, uint16_t crnti, uint8_t lcgId, uint32_t bufferSize); -uint8_t macProcUlData(uint16_t cellId, uint16_t rnti, SlotIndInfo slotInfo, \ - uint8_t lcId, uint16_t pduLen, uint8_t *pdu); +uint8_t macProcUlData(uint16_t cellId, uint16_t rnti, SlotTimingInfo slotInfo, uint8_t lcId, uint16_t pduLen, uint8_t *pdu); +uint8_t sendSchedRptToRlc(DlSchedInfo dlInfo, SlotTimingInfo slotInfo, uint8_t ueIdx, uint8_t schInfoIdx); +uint8_t macProcLongBsr(uint16_t cellId, uint16_t crnti,uint8_t numLcg, DataVolInfo dataVolInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS]); +void freeMacSliceCfgReq(MacSliceCfgReq *cfgReq,Pst *pst); +void deleteMacRaCb(uint16_t cellIdx, MacUeCb *ueCb); + +uint8_t MacProcSchSliceCfgRsp(Pst *pst, SchSliceCfgRsp *schSliceCfgRsp); +uint8_t MacProcSchSliceRecfgRsp(Pst *pst, SchSliceRecfgRsp *sliceRecfgrsp); +uint8_t MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm); +uint8_t MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo); +uint8_t MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo); +uint8_t MacProcSchRachRsrcRsp(Pst *pst, SchRachRsrcRsp *schRachRsrcRsp); +uint8_t MacProcDlPageAlloc(Pst *pst, DlPageAlloc *dlPageAlloc); +uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDeleteRsp); + +uint8_t MacProcSchStatsRsp(Pst *pst, SchStatsRsp *schStatsRsp); +uint8_t MacProcSchStatsInd(Pst *pst, SchStatsInd *schStatsInd); +uint8_t MacProcSchStatsDeleteRsp(Pst *pst, SchStatsDeleteRsp *schStatsDeleteRsp); + #endif /********************************************************************** End of file