From 43f9a063a851c5318a609e9966cdc0b30f0abaf5 Mon Sep 17 00:00:00 2001 From: balajihands Date: Sat, 4 Apr 2020 20:04:25 +0530 Subject: [PATCH] Trigger_macCellCfg Change-Id: Ib6c8ead71298b1276d2fb55c22c6c40988327183 Signed-off-by: balajihands --- src/5gnrmac/lwr_mac_li.c | 8 ++++---- src/5gnrmac/rg.h | 20 ++++++++++++++++++++ src/5gnrmac/rg_lmm.c | 17 +++++++++++++---- src/cm/du_app_mac_inf.c | 11 +++++++---- src/cm/du_app_mac_inf.h | 41 +++++++++++++++++++++++++++++------------ src/du_app/du_cell_mgr.c | 24 +++++++++++------------- src/du_app/du_cfg.c | 34 +++++++++++++++++++++++----------- src/du_app/du_cfg.h | 4 +++- src/du_app/du_msg_hdl.c | 2 ++ 9 files changed, 112 insertions(+), 49 deletions(-) diff --git a/src/5gnrmac/lwr_mac_li.c b/src/5gnrmac/lwr_mac_li.c index 06323b15a..001d2e383 100644 --- a/src/5gnrmac/lwr_mac_li.c +++ b/src/5gnrmac/lwr_mac_li.c @@ -186,14 +186,14 @@ ClCellCb *cellCb /* Filling SSB configuration */ fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SS_PBCH_PWR, sizeof(U16), cellCfg.ssbCfg.ssbPbchPwr, &msgLen); - fillConfigTLV(nextTlv, configTlvs, CFG_TAG_BCH_PAYLOAD, sizeof(U16), cellCfg.ssbCfg.bchPayloadOption, &msgLen); + fillConfigTLV(nextTlv, configTlvs, CFG_TAG_BCH_PAYLOAD, sizeof(U16), cellCfg.ssbCfg.bchPayloadFlag, &msgLen); fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SCS_COMM, sizeof(U16), cellCfg.ssbCfg.scsCmn, &msgLen); - fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_OFFS_POINT_A, sizeof(U16), cellCfg.ssbCfg.ssbPrbOffset, &msgLen); + fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_OFFS_POINT_A, sizeof(U16), cellCfg.ssbCfg.ssbOffsetPointA, &msgLen); fillConfigTLV(nextTlv, configTlvs, CFG_TAG_BETA_PSS, sizeof(U16), cellCfg.ssbCfg.betaPss, &msgLen); fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_PERIOD, sizeof(U16), cellCfg.ssbCfg.ssbPeriod, &msgLen); - fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_SUBC_OFFS, sizeof(U16), cellCfg.ssbCfg.ssbSubcOffset, &msgLen); + fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_SUBC_OFFS, sizeof(U16), cellCfg.ssbCfg.ssbScOffset, &msgLen); fillConfigTLV(nextTlv, configTlvs, CFG_TAG_MIB, sizeof(U16), cellCfg.ssbCfg.mibPdu, &msgLen); - fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_MASK, sizeof(U16), cellCfg.ssbCfg.nSSBMask[0], &msgLen); + fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_MASK, sizeof(U16), cellCfg.ssbCfg.ssbMask[0], &msgLen); fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SS_PBCH_MULT_CARR_BAND, sizeof(U16), cellCfg.ssbCfg.multCarrBand, &msgLen); fillConfigTLV(nextTlv, configTlvs, CFG_TAG_MULT_CELL_SS_PBCH_CARR, sizeof(U16), cellCfg.ssbCfg.multCellCarr, &msgLen); diff --git a/src/5gnrmac/rg.h b/src/5gnrmac/rg.h index 36ead1f37..d41656336 100755 --- a/src/5gnrmac/rg.h +++ b/src/5gnrmac/rg.h @@ -244,6 +244,26 @@ U32 macHeader[2]; #define RG_MAX_DL_HARQ_NUM 8 #endif +#define MAC_MEM_REGION 4 +#define MAC_POOL 1 +/* allocate and zero out a MAC static buffer */ +#define MAC_ALLOC(_datPtr, _size) \ +{ \ + S16 _ret; \ + _ret = SGetSBuf(MAC_MEM_REGION, MAC_POOL, \ + (Data **)&_datPtr, _size); \ + if(_ret == ROK) \ + cmMemset((U8*)_datPtr, 0, _size); \ + else \ + _datPtr = NULLP; \ +} + +/* free a static buffer */ +#define MAC_FREE(_datPtr, _size) \ + if(_datPtr) \ + SPutSBuf(MAC_MEM_REGION, MAC_POOL, \ + (Data *)_datPtr, _size); + #define RG_LCG_ISCFGD(lcg) ((lcg)->lcgId != RG_INVALID_LCG_ID) /* Corrected the check for dlCcchId */ #define RG_DLCCCH_ISCFGD(cell) ((cell)->dlCcchId != RG_INVALID_LC_ID) diff --git a/src/5gnrmac/rg_lmm.c b/src/5gnrmac/rg_lmm.c index 0e7445856..7c7275523 100755 --- a/src/5gnrmac/rg_lmm.c +++ b/src/5gnrmac/rg_lmm.c @@ -57,6 +57,7 @@ static int RLOG_MODULE_ID=4096; #include "rgr.h" /* LRG Interface defines */ #include "rg.h" /* MAC defines */ #include "rg_err.h" /* MAC error defines */ +#include "du_log.h" /* header/extern include files (.x) */ #include "gen.x" /* general */ @@ -130,13 +131,13 @@ RgMngmt *cfm, Pst *cfmPst )); -extern U16 cmPackMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm); +extern U16 packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm); -packMacCellCfgCfm packMacCellCfmOpts[] = +packMacCellCfgConfirm packMacCellCfmOpts[] = { - cmPackMacCellCfgCfm, /* packing for loosely coupled */ + packMacCellCfgCfm, /* packing for loosely coupled */ duHandleMacCellCfgCfm, /* packing for tightly coupled */ - cmPackMacCellCfgCfm, /* packing for light weight loosly coupled */ + packMacCellCfgCfm, /* packing for light weight loosly coupled */ }; /** @@ -2133,6 +2134,14 @@ S16 MacHdlCellCfgReq Inst inst = pst->dstInst; cellCb = rgCb[inst].cell; + MAC_ALLOC(cellCb,sizeof(RgCellCb)); + + if(cellCb == NULLP) + { + DU_LOG("\nMAC : cellCb is NULL at handling of macCellCfg\n"); + return RFAILED; + } + memcpy(&cellCb->macCellCfg,macCellCfg,sizeof(MacCellCfg)); macCellCfgFillCfmPst(pst,&cnfPst); diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index bb1489314..6a45251d6 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -53,7 +53,7 @@ * RFAILED - failure * ***************************************************************************/ -S16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) +U16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) { if(pst->selector == DU_SELECTOR_LC) { @@ -72,6 +72,7 @@ S16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) /* pack the address of the structure */ CMCHKPK(cmPkPtr,(PTR)macCellCfg, mBuf); + DU_LOG("\nDU-APP : MAC CELL config sent"); RETVALUE(SPstTsk(pst,mBuf)); } } @@ -123,7 +124,7 @@ void unpackDuMacCellCfg( * * @details * - * Function : cmPackMacCellCfgCfm + * Function : packMacCellCfgCfm * * Functionality: * packs the transaction ID @@ -134,7 +135,7 @@ void unpackDuMacCellCfg( * RFAILED - failure * ***************************************************************************/ -U16 cmPackMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) +U16 packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) { if(pst->selector == DU_SELECTOR_LC) { @@ -154,6 +155,7 @@ U16 cmPackMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) /* only LC is supported */ return RFAILED; } + return ROK; } /************************************************************************** @@ -173,7 +175,7 @@ U16 cmPackMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) * RFAILED - failure * ***************************************************************************/ -S16 unpackMacCellCfgCfm( +U16 unpackMacCellCfgCfm( DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf) @@ -191,6 +193,7 @@ S16 unpackMacCellCfgCfm( { /* only loose coupling is suported */ } + return ROK; } /********************************************************************** diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 335c18207..51d0bee17 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -26,6 +26,11 @@ #define NUM_SSB 1 /* max value is 64 */ #define SSB_MASK_SIZE 1 /* SSB mask size is 32bit for sub6 */ +#define SIB1_NEW_TX_PERIOD 160 +#define SIB1_REPETITION_PERIOD 20 +#define CORESET_0_INDEX 0 +#define SEARCHSPACE_0_INDEX 0 +#define SIB1_MCS 4 /* Event IDs */ @@ -112,16 +117,16 @@ typedef struct carrierCfg typedef struct ssbCfg { - U32 ssbPbchPwr; /* SSB block power */ - BchPduOpt bchPayloadOption; /* Options for generation of payload */ - U8 scsCmn; /* subcarrier spacing for common */ - U16 ssbPrbOffset; /* SSB PRB offset from point A */ + uint32_t ssbPbchPwr; /* SSB block power */ + BchPduOpt bchPayloadFlag; /* Options for generation of payload */ + uint8_t scsCmn; /* subcarrier spacing for common */ + uint16_t ssbOffsetPointA; /* SSB subcarrier offset from point A */ BetaPss betaPss; SSBPeriod ssbPeriod; /* SSB Periodicity in msec */ - U8 ssbSubcOffset; /* Subcarrier Offset */ - U32 mibPdu; /* MIB payload */ - U32 nSSBMask[SSB_MASK_SIZE]; /* Bitmap for actually transmitted SSB. */ - U8 beamId[NUM_SSB]; + uint8_t ssbScOffset; /* Subcarrier Offset */ + uint8_t mibPdu[3]; /* MIB payload */ + uint32_t ssbMask[SSB_MASK_SIZE]; /* Bitmap for actually transmitted SSB. */ + uint8_t beamId[NUM_SSB]; Bool multCarrBand; /* Multiple carriers in a band */ Bool multCellCarr; /* Multiple cells in single carrier */ }SsbCfg; @@ -155,6 +160,17 @@ typedef struct tddCfg SlotConfig slotCfg[MAXIMUM_TDD_PERIODICITY][MAX_SYMB_PER_SLOT]; }TDDCfg; +typedef struct sib1CellCfg +{ + uint8_t *sib1Pdu; + uint16_t sib1PduLen; + uint16_t sib1NewTxPeriod; + uint16_t sib1RepetitionPeriod; + uint8_t coresetZeroIndex; /* derived from 4 LSB of pdcchSib1 present in MIB */ + uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */ + uint16_t sib1Mcs; +} Sib1CellCfg; + typedef struct macCellCfg { U16 transId; @@ -170,6 +186,7 @@ typedef struct macCellCfg PrachCfg prachCfg; /* PRACH Configuration */ TDDCfg tddCfg; /* TDD periodicity and slot configuration */ RSSIMeasUnit rssiUnit; /* RSSI measurement unit */ + Sib1CellCfg sib1Cfg; }MacCellCfg; typedef struct macCellCfgCfm @@ -178,12 +195,12 @@ typedef struct macCellCfgCfm }MacCellCfgCfm; /* function pointers for packing macCellCfg Request */ -typedef S16 (*packMacCellCfgReq) ARGS(( +typedef U16 (*packMacCellCfgReq) ARGS(( Pst *pst, MacCellCfg *macCellCfg )); -typedef S16 (*packMacCellCfgCfm) ARGS(( +typedef S16 (*packMacCellCfgConfirm) ARGS(( Pst *pst, MacCellCfgCfm *macCellCfgCfm )); @@ -197,7 +214,7 @@ typedef S16 (*DuMacCellCfgCfm) ARGS(( MacCellCfgCfm *macCellCfgCfm /* Config Structure */ )); -S16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg); +U16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg); EXTERN S16 MacHdlCellCfgReq ( @@ -210,7 +227,7 @@ void cmUnpackLwLcMacCellCfg( Pst *pst, Buffer *mBuf); -S16 unpackMacCellCfgCfm( +U16 unpackMacCellCfgCfm( DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf); diff --git a/src/du_app/du_cell_mgr.c b/src/du_app/du_cell_mgr.c index 961ea31ef..41b2c581d 100644 --- a/src/du_app/du_cell_mgr.c +++ b/src/du_app/du_cell_mgr.c @@ -44,13 +44,13 @@ extern S16 duBuildAndSendMacCellCfg(); * ****************************************************************/ S16 procCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate) { - U16 idx; - S16 ret; + U16 idx = 0; + S16 ret = ROK; for(idx=0; idx\ @@ -81,15 +81,17 @@ S16 procCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate) /* Now remove this cell from configured list and move to active list */ duCb.cfgCellLst[nci-1] = NULLP; duCb.actvCellLst[nci-1] = cellCb; - } - /* Start sending scheduler config */ - if(ret == ROK) - { - //TODO: uncomment later duSendSchGnbCfg(); + /* Build and send Mac Cell Cfg for the number of active cells */ + ret = duBuildAndSendMacCellCfg(); + if(ret != ROK) + { + DU_LOG("\nDU APP : macCellCfg build and send failed"); + return RFAILED; + } } - return ROK; + return ret; } /****************************************************************** @@ -170,10 +172,6 @@ S16 procF1SetupRsp(F1AP_PDU_t *f1apMsg) SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t)); #endif - /* Build and send Mac Cell Cfg Paramaters */ - //ret = duBuildAndSendMacCellCfg(); - ret = BuildAndSendDUConfigUpdate(); - return ret; } diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index cbebd4677..7217d10c0 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -136,15 +136,17 @@ S16 readMacCfg() /* SSB configuration */ duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR; - duCfgParam.macCellCfg.ssbCfg.bchPayloadOption = BCH_PAYLOAD; + duCfgParam.macCellCfg.ssbCfg.bchPayloadFlag = BCH_PAYLOAD; duCfgParam.macCellCfg.ssbCfg.scsCmn = SUBCARRIER_SPACING; - duCfgParam.macCellCfg.ssbCfg.ssbPrbOffset = PRB_OFFSET; + duCfgParam.macCellCfg.ssbCfg.ssbOffsetPointA = OFFSET_TO_POINT_A; duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS; duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PERIODICITTY; - duCfgParam.macCellCfg.ssbCfg.ssbSubcOffset = SSB_SUBCARRIER_OFFSET; - duCfgParam.macCellCfg.ssbCfg.mibPdu = 104; - duCfgParam.macCellCfg.ssbCfg.nSSBMask[0] = 2162721; - duCfgParam.macCellCfg.ssbCfg.nSSBMask[1] = 0; + duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET; + duCfgParam.macCellCfg.ssbCfg.mibPdu[0] = 0x01; + duCfgParam.macCellCfg.ssbCfg.mibPdu[1] = 0x01; + duCfgParam.macCellCfg.ssbCfg.mibPdu[2] = 0x84; + duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */ + duCfgParam.macCellCfg.ssbCfg.ssbMask[1] = 0; duCfgParam.macCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND; duCfgParam.macCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER; @@ -178,6 +180,17 @@ S16 readMacCfg() /* RSSI Measurement configuration */ duCfgParam.macCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT; + /* fill SIB1 configuration */ + duCfgParam.macCellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len; + DU_ALLOC(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len); + memcpy(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \ + duCfgParam.srvdCellLst[0].duSysInfo.sib1Len); + duCfgParam.macCellCfg.sib1Cfg.sib1NewTxPeriod = SIB1_NEW_TX_PERIOD; + duCfgParam.macCellCfg.sib1Cfg.sib1RepetitionPeriod = SIB1_REPETITION_PERIOD; + duCfgParam.macCellCfg.sib1Cfg.coresetZeroIndex = CORESET_0_INDEX; + duCfgParam.macCellCfg.sib1Cfg.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX; + duCfgParam.macCellCfg.sib1Cfg.sib1Mcs = SIB1_MCS; + /* This should be calculated based on (number of mandatory parameters) + (number of otional parameters being filled) */ duCfgParam.macCellCfg.numTlv = 39; @@ -428,6 +441,7 @@ S16 readCfg() return RFAILED; } strcpy(duCfgParam.srvdCellLst[i].duSysInfo.mibMsg, encBuf); + duCfgParam.srvdCellLst[i].duSysInfo.mibLen = encBufSize; /*gnb DU System Info mib msg*/ BuildSib1Msg(); @@ -438,11 +452,9 @@ S16 readCfg() DU_LOG("\nDU_APP: Memory allocation failure"); return RFAILED; } - for(int x=0; x