From d2d9dcbd92e8f1be15dd5891aaf9ada9bc071e1a Mon Sep 17 00:00:00 2001 From: Balaji Shankaran Date: Thu, 23 Apr 2020 17:34:17 +0530 Subject: [PATCH] Added missing triggers and state params for cell up Change-Id: Ie3a20c467e8b22ee1647c40efd9a841eac9bc2a2 Signed-off-by: Balaji Shankaran --- src/5gnrmac/lwr_mac.h | 14 +++++----- src/5gnrmac/lwr_mac_fsm.c | 14 ++++++++-- src/5gnrmac/lwr_mac_handle_phy.c | 8 ++++++ src/5gnrmac/mac.h | 4 ++- src/5gnrmac/mac_msg_hdl.c | 6 ++--- src/5gnrmac/rg_lim.c | 16 ++++++++++-- src/5gnrmac/rg_lmm.c | 56 ++++++++++++++++++++++++++++++---------- src/cm/du_app_mac_inf.h | 1 + src/du_app/du_mgr.h | 1 + src/du_app/du_msg_hdl.c | 20 +++++++++++++- src/phy_stub/l1_bdy1.c | 1 - 11 files changed, 111 insertions(+), 30 deletions(-) diff --git a/src/5gnrmac/lwr_mac.h b/src/5gnrmac/lwr_mac.h index 1b0c5be5f..3fa21a228 100644 --- a/src/5gnrmac/lwr_mac.h +++ b/src/5gnrmac/lwr_mac.h @@ -45,12 +45,12 @@ typedef enum /* Events in Lower Mac */ typedef enum{ - FAPI_PARAM_REQUEST, - FAPI_PARAM_RESPONSE, - FAPI_CONFIG_REQUEST, - FAPI_CONFIG_RESPONSE, - FAPI_START_REQUEST, - FAPI_STOP_REQUEST, + PARAM_REQUEST, + PARAM_RESPONSE, + CONFIG_REQUEST, + CONFIG_RESPONSE, + START_REQUEST, + STOP_REQUEST, MAX_EVENT }EventState; @@ -74,7 +74,7 @@ typedef struct cellCb typedef enum { - RELEASE_15 + FAPI_RELEASE_15 }ReleaseCapab; typedef enum diff --git a/src/5gnrmac/lwr_mac_fsm.c b/src/5gnrmac/lwr_mac_fsm.c index fdc7e3cac..800856b53 100644 --- a/src/5gnrmac/lwr_mac_fsm.c +++ b/src/5gnrmac/lwr_mac_fsm.c @@ -1832,6 +1832,8 @@ S16 lwr_mac_handleParamRspEvt(void *msg) } MAC_FREE(cellParam, sizeof(ClCellParam)); MAC_FREE(paramRsp, sizeof(fapi_param_resp_t)); + + sendToLowerMac(FAPI_CONFIG_REQUEST, 0, (void *)NULL); return ROK; } else @@ -1933,8 +1935,11 @@ S16 lwr_mac_handleConfigReqEvt(void *msg) fillTlvs(&configReq->tlvs[index++], FAPI_K1_TAG, sizeof(uint16_t), macCfgParams.prachCfg.fdm[0].k1, &msgLen); fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_ZERO_CORR_CONF_TAG , sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].zeroCorrZoneCfg, &msgLen); fillTlvs(&configReq->tlvs[index++], FAPI_NUM_UNUSED_ROOT_SEQUENCES_TAG, sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].numUnusedRootSeq, &msgLen); + //MAC_ALLOC(macCfgParams.prachCfg.fdm[0].unsuedRootSeq, \ + sizeof(uint8_t)*macCfgParams.prachCfg.fdm[0].numUnusedRootSeq); + macCfgParams.prachCfg.fdm[0].unsuedRootSeq = (uint8_t *)malloc(sizeof(uint8_t)*macCfgParams.prachCfg.fdm[0].numUnusedRootSeq); fillTlvs(&configReq->tlvs[index++], FAPI_UNUSED_ROOT_SEQUENCES_TAG, - sizeof(uint8_t), *(macCfgParams.prachCfg.fdm[0].unsuedRootSeq), &msgLen); + sizeof(uint8_t), *(macCfgParams.prachCfg.fdm[0].unsuedRootSeq), &msgLen); fillTlvs(&configReq->tlvs[index++], FAPI_SSB_PER_RACH_TAG, sizeof(uint8_t), macCfgParams.prachCfg.ssbPerRach, &msgLen); fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_MULTIPLE_CARRIERS_IN_A_BAND_TAG, sizeof(uint8_t), macCfgParams.prachCfg.prachMultCarrBand, &msgLen); @@ -1985,6 +1990,11 @@ S16 lwr_mac_handleConfigRspEvt(void *msg) { DU_LOG("\nLOWER MAC: PHY has moved to Conigured state \n"); clGlobalCp.phyState = PHY_STATE_CONFIGURED; + /* TODO : + * Store config response into an intermediate struture and send to MAC + * Support LC and LWLC for sending config rsp to MAC + */ + fapiMacConfigRsp(); MAC_FREE(configRsp, sizeof(fapi_config_resp_t)); return ROK; } @@ -2007,7 +2017,7 @@ S16 lwr_mac_handleConfigRspEvt(void *msg) S16 lwr_mac_handleStartReqEvt(void *msg) { -#ifdef FAPi +#ifdef FAPI uint32_t msgLen = 0; fapi_start_req_t *startReq; MAC_ALLOC(startReq, sizeof(fapi_start_req_t)); diff --git a/src/5gnrmac/lwr_mac_handle_phy.c b/src/5gnrmac/lwr_mac_handle_phy.c index 969a395b8..710b24bad 100644 --- a/src/5gnrmac/lwr_mac_handle_phy.c +++ b/src/5gnrmac/lwr_mac_handle_phy.c @@ -44,6 +44,8 @@ #include "cm_mblk.x" /* Common LTE Defines */ #include "tfu.x" /* RGU Interface includes */ //#include "rg.x" +#include "lwr_mac.h" +#include "du_log.h" #ifdef FAPI /* function pointers for packing macCellCfg Request */ @@ -123,6 +125,12 @@ void handlePhyMessages(void *msg) { case FAPI_SLOT_INDICATION: { + if(clGlobalCp.phyState == PHY_STATE_CONFIGURED) + { + DU_LOG("\nLOWER MAC: PHY has moved to running state \n"); + clGlobalCp.phyState = PHY_STATE_RUNNING; + } + fapi_slot_ind_t *slotInd; slotInd = (fapi_slot_ind_t *)msg; handleSlotInd(slotInd); diff --git a/src/5gnrmac/mac.h b/src/5gnrmac/mac.h index f2b60ed74..6894c76a4 100644 --- a/src/5gnrmac/mac.h +++ b/src/5gnrmac/mac.h @@ -58,16 +58,18 @@ typedef struct macDlSlot typedef struct macCellCb { + uint16_t cellId; MacDlSlot dlSlot[MAX_SLOT_SUPPORTED]; }MacCellCb; typedef struct macCb { + Inst macInst; MacCellCb *macCell; }MacCb; /* global variable */ -MacCb macCb; +EXTERN MacCb macCb; #endif /********************************************************************** diff --git a/src/5gnrmac/mac_msg_hdl.c b/src/5gnrmac/mac_msg_hdl.c index 1c71db8a1..b0ff0142c 100644 --- a/src/5gnrmac/mac_msg_hdl.c +++ b/src/5gnrmac/mac_msg_hdl.c @@ -79,7 +79,7 @@ uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) { DU_LOG("\nMAC : Handling cell start request"); - sendToLowerMac(FAPI_START_REQUEST, 0, cellStartInfo); + sendToLowerMac(START_REQUEST, 0, cellStartInfo); MAC_FREE_MEM(pst->region, pst->pool, cellStartInfo, \ sizeof(MacCellStartInfo)); @@ -106,8 +106,8 @@ uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) * ****************************************************************/ uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo) { - DU_LOG("\nMAC : Handling cell start request"); - sendToLowerMac(FAPI_STOP_REQUEST, 0, cellStopInfo); + DU_LOG("\nMAC : Handling cell stop request"); + sendToLowerMac(STOP_REQUEST, 0, cellStopInfo); MAC_FREE_MEM(pst->region, pst->pool, cellStopInfo, \ sizeof(MacCellStopInfo)); diff --git a/src/5gnrmac/rg_lim.c b/src/5gnrmac/rg_lim.c index 38620fe6a..ecfb9516b 100755 --- a/src/5gnrmac/rg_lim.c +++ b/src/5gnrmac/rg_lim.c @@ -75,8 +75,8 @@ static int RLOG_MODULE_ID=4096; #include "du_app_mac_inf.h" #include "rg.x" /* typedefs for MAC */ -#include "mac_sch_interface.h" #include "mac_upr_inf_api.h" +#include "mac.h" /* local externs */ #ifdef UNUSED_FUNC @@ -601,6 +601,14 @@ TfuDelDatReqInfo *delDatReq; } /* rgLIMTfuDatReq*/ #endif /*L2_OPTMZ */ +void fapiMacConfigRsp() +{ + /* TODO : Processing of conig response from PHY */ + + /* Send cell config cfm to DU APP */ + MacSendCellCfgCfm(RSP_OK); +} + /** * @brief Transmission time interval indication from PHY. * @@ -664,12 +672,16 @@ int sendSlotIndMacToDuApp(SlotIndInfo *slotInd) return RFAILED; } + slotInfo->cellId = macCb.macCell->cellId; + slotInfo->sfn = slotInd->sfn; + slotInfo->slot = slotInd->slot; + /* Fill Pst */ pst.selector = DU_MAC_LWLC; pst.srcEnt = ENTRG; pst.dstEnt = ENTDUAPP; pst.dstInst = 0; - pst.srcInst = 0; + pst.srcInst = macCb.macInst; pst.dstProcId = rgCb[pst.srcInst].rgInit.procId; pst.srcProcId = rgCb[pst.srcInst].rgInit.procId; pst.region = MAC_MEM_REGION; diff --git a/src/5gnrmac/rg_lmm.c b/src/5gnrmac/rg_lmm.c index 8db8f032b..19bfcf04b 100755 --- a/src/5gnrmac/rg_lmm.c +++ b/src/5gnrmac/rg_lmm.c @@ -96,6 +96,7 @@ EXTERN Void rgGetSId ARGS((SystemId *s)); /* Public variable declaration */ ClCb clGlobalCp; +MacCb macCb; /* forward references */ PRIVATE U16 rgLMMGenCfg ARGS(( @@ -936,6 +937,9 @@ RgCfg *cfg; /* Configuaration information */ rgCb[inst].rgInit.region = cfg->s.genCfg.mem.region; rgCb[inst].rgInit.pool = cfg->s.genCfg.mem.pool; rgCb[inst].genCfg.tmrRes = cfg->s.genCfg.tmrRes; + + macCb.macInst = rgCb[inst].rgInit.inst; + /* Initialize SAP States */ rgCb[inst].crgSap.sapSta.sapState = LRG_NOT_CFG; @@ -2124,6 +2128,7 @@ int MacHdlCellCfgReq return RFAILED; } macCb.macCell = macCellCb; + macCb.macCell->cellId = macCellCfg->cellId; /* Send cell cfg to scheduler */ ret = MacSchCellCfgReq(pst, macCellCfg); if(ret != ROK) @@ -2199,6 +2204,40 @@ int MacSchCellCfgReq return ret; } /* end of MacSchCellCfgReq */ + +/******************************************************************* + * + * @brief Sends Cell config confirm to DU APP + * + * @details + * + * Function : MacSendCellCfgCfm + * + * Functionality: + * Sends Cell config confirm to DU APP + * + * @params[in] Response status + * @return void + * + * ****************************************************************/ +void MacSendCellCfgCfm(uint8_t response) +{ + Pst pst; + RgCellCb *cellCb; + MacCellCfgCfm macCellCfgCfm; + + cmMemset((U8 *)&pst, 0, sizeof(Pst)); + cellCb = rgCb[macCb.macInst].cell; + + macCellCfgCfm.transId = cellCb->macCellCfg.transId; + macCellCfgCfm.rsp = response; + + memcpy((void *)&pst, (void *)&rgCb[macCb.macInst].rgInit.lmPst, sizeof(Pst)); + pst.event = EVENT_MAC_CELL_CONFIG_CFM; + (*packMacCellCfmOpts[pst.selector])(&pst,&macCellCfgCfm); +} + + /** * @brief Layer Manager Configuration response handler. * @@ -2219,26 +2258,17 @@ int MacProcSchCellCfgCfm SchCellCfgCfm *schCellCfgCfm ) { - Pst cfmPst; - int ret; - RgCellCb *cellCb; - MacCellCfgCfm macCellCfgCfm; - - cmMemset((U8 *)&cfmPst, 0, sizeof(Pst)); - cellCb = rgCb[pst->dstInst].cell; - macCellCfgCfm.transId = cellCb->macCellCfg.transId; if(schCellCfgCfm->rsp == RSP_OK) { - macCellCfgCfm.rsp = RSP_OK; + sendToLowerMac(PARAM_REQUEST, 0, (void *)NULL); } else { - macCellCfgCfm.rsp = RSP_NOK; + MacSendCellCfgCfm(RSP_NOK); } - macCellCfgFillCfmPst(pst,&cfmPst); - ret = (*packMacCellCfmOpts[cfmPst.selector])(&cfmPst,&macCellCfgCfm); - + return ROK; } + /********************************************************************** End of file diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 9c6497191..40f2ab4e1 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -210,6 +210,7 @@ typedef struct macCellCfgCfm typedef struct slotInfo { + uint16_t cellId; uint16_t sfn; uint16_t slot; }SlotInfo; diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index f229b1ba0..35ef06a3a 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -167,6 +167,7 @@ typedef struct duCellCb { U32 cellId; /* Internal cell Id */ CellCfgParams cellInfo; /* Cell info */ + Bool firstSlotIndRcvd; CellStatus cellStatus; /*Cell status */ }DuCellCb; diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index 5c02e508f..be2bb5491 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -1599,7 +1599,7 @@ uint16_t duHandleMacCellCfgCfm(MacCellCfgCfm *macCellCfgCfm) /* TODO: Trigger cell start req once cell up slot ind is received*/ /* Build and Send Cell Start Req to MAC */ - //ret = duBuildAndSendMacCellStartReq(); + ret = duBuildAndSendMacCellStartReq(); } else @@ -1639,6 +1639,23 @@ uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo) DU_LOG("\nDU APP : Slot Indication received"); + if(slotInfo->cellId <=0 || slotInfo->cellId > DU_MAX_CELLS) + { + DU_LOG("\nDU APP : Invalid Cell Id %d", slotInfo->cellId); + } + if(!duCb.actvCellLst[slotInfo->cellId-1]->firstSlotIndRcvd) + { + duCb.actvCellLst[slotInfo->cellId-1]->firstSlotIndRcvd = true; + if((duCb.actvCellLst[slotInfo->cellId-1] != NULL) && \ + (duCb.actvCellLst[slotInfo->cellId-1]->cellStatus == \ + ACTIVATION_IN_PROGRESS)) + { + DU_LOG("\nDU APP : Cell Id %d is ACTIVE", slotInfo->cellId); + duCb.actvCellLst[slotInfo->cellId-1]->cellStatus = ACTIVATED; + } + + } + /* TODO : Slot Indication to be moved out of EGTP_TEST when * data path is established */ #ifdef EGTP_TEST @@ -1683,6 +1700,7 @@ uint16_t duBuildAndSendMacCellStartReq() { if(duCb.actvCellLst[id]) { + duCb.actvCellLst[id]->firstSlotIndRcvd = FALSE; cellStartInfo->cellId = duCb.actvCellLst[id]->cellInfo.nrEcgi.cellId; /* Fill Pst */ diff --git a/src/phy_stub/l1_bdy1.c b/src/phy_stub/l1_bdy1.c index 3d137f81c..2a1391ee1 100644 --- a/src/phy_stub/l1_bdy1.c +++ b/src/phy_stub/l1_bdy1.c @@ -321,7 +321,6 @@ PUBLIC S16 l1HdlStartReq(uint32_t msgLen, void *msg) { if(clGlobalCp.phyState == PHY_STATE_CONFIGURED) { - clGlobalCp.phyState = PHY_STATE_RUNNING; duStartSlotIndicaion(); #ifdef FAPI SPutSBuf(0, 0, (Data *)msg, sizeof(fapi_start_req_t)); -- 2.16.6