#include "du_ue_mgr.h"
#include "lsctp.h"
#include "legtp.h"
-#include "lphy_stub.h"
#include "du_utils.h"
#include "du_cell_mgr.h"
#ifdef O1_ENABLE
#include "AlarmInterface.h"
+#include "ConfigInterface.h"
#endif
uint8_t BuildAndSendDUConfigUpdate();
uint16_t getTransId();
uint8_t cmPkLrgSchCfgReq(Pst * pst,RgMngmt * cfg);
+uint8_t sendCellDeleteReqToMac(uint16_t cellId);
packMacCellCfgReq packMacCellCfgOpts[] =
{
uint8_t duProcCfgComplete()
{
uint8_t ret = ROK;
- static uint16_t cellId = 0;
+ uint16_t cellId = 0;
uint16_t idx;
for(idx=0; idx< DEFAULT_CELLS; idx++)
{
DuCellCb *cell = NULLP;
- DU_ALLOC(cell, sizeof(DuCellCb))
+ DU_ALLOC(cell, sizeof(DuCellCb));
if(cell == NULLP)
{
- DU_LOG("\nERROR --> DU_APP : Memory Allocation failed in duProcCfgComplete");
- ret = RFAILED;
+ DU_LOG("\nERROR --> DU_APP : Memory Allocation failed in duProcCfgComplete");
+ ret = RFAILED;
}
else
{
- uint8_t idx1=0;
- memset(cell, 0, sizeof(DuCellCb));
- cell->cellId = ++cellId;
- memset(&cell->cellInfo.nrEcgi.plmn, 0, sizeof(Plmn));
- cell->cellInfo.nrEcgi.plmn.mcc[0] = PLMN_MCC0;
- cell->cellInfo.nrEcgi.plmn.mcc[1] = PLMN_MCC1;
- cell->cellInfo.nrEcgi.plmn.mcc[2] = PLMN_MCC2;
- cell->cellInfo.nrEcgi.plmn.mnc[0] = PLMN_MNC0;
- cell->cellInfo.nrEcgi.plmn.mnc[1] = PLMN_MNC1;
- cell->cellInfo.nrEcgi.cellId = NR_CELL_ID;
- cell->cellInfo.nrPci = NR_PCI;
- cell->cellInfo.fiveGsTac = DU_TAC;
- memset(&cell->cellInfo.plmn[idx1], 0, sizeof(Plmn));
- for(idx1=0; idx1<MAX_PLMN; idx1++)
- {
- cell->cellInfo.plmn[idx1].mcc[0] = PLMN_MCC0;
- cell->cellInfo.plmn[idx1].mcc[1] = PLMN_MCC1;
- cell->cellInfo.plmn[idx1].mcc[2] = PLMN_MCC2;
- cell->cellInfo.plmn[idx1].mnc[0] = PLMN_MNC0;
- cell->cellInfo.plmn[idx1].mnc[1] = PLMN_MNC1;
- }
- cell->cellInfo.maxUe = duCfgParam.maxUe;
- cell->cellStatus = CELL_OUT_OF_SERVICE;
-
- duCb.cfgCellLst[duCb.numCfgCells] = cell;
- duCb.numCfgCells++;
+ uint8_t idx1=0;
+ memset(cell, 0, sizeof(DuCellCb));
+ cell->cellId = ++cellId;
+ memset(&cell->cellInfo.nrEcgi.plmn, 0, sizeof(Plmn));
+ cell->cellInfo.nrEcgi.plmn.mcc[0] = PLMN_MCC0;
+ cell->cellInfo.nrEcgi.plmn.mcc[1] = PLMN_MCC1;
+ cell->cellInfo.nrEcgi.plmn.mcc[2] = PLMN_MCC2;
+ cell->cellInfo.nrEcgi.plmn.mnc[0] = PLMN_MNC0;
+ cell->cellInfo.nrEcgi.plmn.mnc[1] = PLMN_MNC1;
+ cell->cellInfo.nrEcgi.cellId = cell->cellId;
+ cell->cellInfo.nrPci = NR_PCI;
+ cell->cellInfo.fiveGsTac = DU_TAC;
+ memset(&cell->cellInfo.plmn[idx1], 0, sizeof(Plmn));
+ for(idx1=0; idx1<MAX_PLMN; idx1++)
+ {
+ cell->cellInfo.plmn[idx1].mcc[0] = PLMN_MCC0;
+ cell->cellInfo.plmn[idx1].mcc[1] = PLMN_MCC1;
+ cell->cellInfo.plmn[idx1].mcc[2] = PLMN_MCC2;
+ cell->cellInfo.plmn[idx1].mnc[0] = PLMN_MNC0;
+ cell->cellInfo.plmn[idx1].mnc[1] = PLMN_MNC1;
+ }
+ cell->cellInfo.maxUe = duCfgParam.maxUe;
+ cell->cellStatus = CELL_OUT_OF_SERVICE;
+ gCellStatus = CELL_DOWN;
+ cell->gnbDuUeF1apIdGenerator = 0;
+ duCb.cfgCellLst[duCb.numCfgCells] = cell;
+ duCb.numCfgCells++;
}
}
if(ret != RFAILED)
{
if(macCellCfgCfm->cellId == duCb.actvCellLst[actvCellIdx]->cellId)
{
- duCb.actvCellLst[actvCellIdx]->duMacCellCfg = NULLP;
+ duCb.actvCellLst[actvCellIdx]->duMacCellCfg = NULLP;
}
}
if(macCellCfgCfm->rsp == ROK)
{
/* Build and send GNB-DU config update */
- ret = BuildAndSendDUConfigUpdate();
+ ret = BuildAndSendDUConfigUpdate(SERV_CELL_TO_MODIFY);
/* Build and Send Cell Start Req to MAC */
ret = duBuildAndSendMacCellStart();
* RFAILED - failure
*
* ****************************************************************/
-uint8_t duBuildAndSendMacCellStop()
+uint8_t duBuildAndSendMacCellStop(uint16_t cellId)
{
Pst pst;
- OduCellId *cellId = NULL;
-
+ uint16_t cellIdx=0;
+ OduCellId *oduCellId = NULL;
+
DU_LOG("\nINFO --> DU APP : Building and Sending cell stop request to MAC");
- /* Send Cell Stop Request to MAC */
- DU_ALLOC_SHRABL_BUF(cellId, sizeof(OduCellId));
- if(!cellId)
+ GET_CELL_IDX(cellId, cellIdx);
+ if(duCb.actvCellLst[cellIdx] != NULLP)
{
- DU_LOG("\nERROR --> DU APP : Memory alloc failed while building cell stop request");
- return RFAILED;
- }
- cellId->cellId = duCb.actvCellLst[0]->cellId;
+ /* Send Cell Stop Request to MAC */
+ DU_ALLOC_SHRABL_BUF(oduCellId, sizeof(OduCellId));
+ if(!oduCellId)
+ {
+ DU_LOG("\nERROR --> DU APP : duBuildAndSendMacCellStop(): Memory allocation failed ");
+ return RFAILED;
+ }
+ memset(oduCellId, 0, sizeof(OduCellId));
+ oduCellId->cellId = duCb.actvCellLst[cellIdx]->cellId;
- /* Fill Pst */
- FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_STOP);
+ /* Fill Pst */
+ FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_STOP);
- return (*packMacCellStopOpts[pst.selector])(&pst, cellId);
+ return (*packMacCellStopOpts[pst.selector])(&pst, oduCellId);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> DU APP : duBuildAndSendMacCellStop(): cellId[%d] doesnot exists", cellId);
+ return RFAILED;
+ }
+ return ROK;
}
/*******************************************************************
if(duGetCellCb(cellId->cellId, &cellCb) != ROK)
return RFAILED;
- if((cellCb->cellStatus == ACTIVATED))
+ if((cellCb->cellStatus == ACTIVATED) || (cellCb->cellStatus == DELETION_IN_PROGRESS))
{
DU_LOG("\nINFO --> DU APP : 5G-NR Cell %d is DOWN", cellId->cellId);
- cellCb->cellStatus = DELETION_IN_PROGRESS;
+ if(sendCellDeleteReqToMac(cellId->cellId) == RFAILED)
+ {
+ DU_LOG("\nERROR --> DU APP : duHandleStopInd(): Failed to send Cell delete req to MAC for\
+ cellId[%d]", cellId->cellId);
+ return RFAILED;
+ }
+
#ifdef O1_ENABLE
DU_LOG("\nINFO --> DU APP : Raise cell down alarm for cell id=%d", cellId->cellId);
raiseCellAlrm(CELL_DOWN_ALARM_ID, cellId->cellId);
+ setCellOpState(cellId->cellId, DISABLED, INACTIVE);
#endif
}