1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /* This file contains message handling functionality for DU cell management */
20 #include "common_def.h"
27 #include "du_app_mac_inf.h"
28 #include "du_app_rlc_inf.h"
32 #include "du_cell_mgr.h"
36 #include "AlarmInterface.h"
37 #include "ConfigInterface.h"
41 /*******************************************************************
43 * @brief Processes cells to be activated
47 * Function : duProcCellsToBeActivated
50 * - Processes cells to be activated list received in F1SetupRsp
53 * @return ROK - success
56 * ****************************************************************/
57 uint8_t duProcCellsToBeActivated(uint8_t *plmnStr, uint16_t nci, uint16_t nRPci)
60 DuCellCb *cellCb = NULLP;
61 uint8_t cfgIdx, tmpPlmn[4];
63 for(cfgIdx=0; cfgIdx<duCb.numCfgCells; cfgIdx++)
65 memset(tmpPlmn, 0, 4);
66 buildPlmnId(duCb.cfgCellLst[cfgIdx]->cellInfo.nrEcgi.plmn, tmpPlmn);
67 if(duCb.cfgCellLst[cfgIdx]->cellInfo.nrEcgi.cellId == nci &&
68 (strcmp((const char*)tmpPlmn, (const char*)plmnStr) == 0))
70 cellCb = duCb.cfgCellLst[cfgIdx];
75 DU_LOG("\nERROR --> DU APP : No Cell found for NCI %d", nci);
80 cellCb->cellStatus = ACTIVATION_IN_PROGRESS;
81 cellCb->cellInfo.nrPci = nRPci;
83 duCb.actvCellLst[duCb.numActvCells++] = cellCb;
85 if(duBuildAndSendMacCellCfg(cellCb->cellId) != ROK)
87 DU_LOG("\nERROR --> DU APP : macCellCfg build and send failed");
88 /* Delete cell from actvCellList */
89 duCb.actvCellLst[--(duCb.numActvCells)] = NULLP;
95 /*******************************************************************
97 * @brief Handles DU F1Setup Rsp received in F1AP
101 * Function : duProcF1SetupRsp
104 * - Handles DU F1Setup Rsp received in F1AP
106 * @params[in] Pointer to F1SetupRsp
109 ******************************************************************/
110 void duProcF1SetupRsp()
112 DU_LOG("\nINFO --> DU_APP : F1 Setup Response received");
113 duCb.f1Status = TRUE; //Set F1 status as true
116 /*******************************************************************
118 * @brief Returns cellCb based on cell ID
122 * Function : duGetCellCb
124 * Functionality: Returns DU APP CellCb based on cell ID
126 * @params[in] F1AP_PDU_t ASN decoded F1AP message
127 * @return ROK - success
130 * ****************************************************************/
131 uint8_t duGetCellCb(uint16_t cellId, DuCellCb **cellCb)
134 for(cellIdx=0; cellIdx<duCb.numActvCells; cellIdx++)
136 if(duCb.actvCellLst[cellIdx]->cellId == cellId)
137 *cellCb = duCb.actvCellLst[cellIdx];
143 DU_LOG("\nERROR --> DU APP : Cell Id %d not found in DU APP", cellId);
150 /*******************************************************************
152 * @brief Handles cell up indication from MAC
156 * Function : duHandleCellUpInd
159 * Handles cell up indication from MAC
161 * @params[in] Post structure pointer
163 * @return ROK - success
166 * ****************************************************************/
167 uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId)
169 DuCellCb *cellCb = NULLP;
171 if(cellId->cellId <=0 || cellId->cellId > MAX_NUM_CELL)
173 DU_LOG("\nERROR --> DU APP : Invalid Cell Id %d in duHandleCellUpInd()", cellId->cellId);
177 if(duGetCellCb(cellId->cellId, &cellCb) != ROK)
180 if((cellCb != NULL) && (cellCb->cellStatus == ACTIVATION_IN_PROGRESS))
182 DU_LOG("\nINFO --> DU APP : 5G-NR Cell %d is UP", cellId->cellId);
183 cellCb->cellStatus = ACTIVATED;
184 gCellStatus = CELL_UP;
187 DU_LOG("\nINFO --> DU APP : Raise cell UP alarm for cell id=%d", cellId->cellId);
188 raiseCellAlrm(CELL_UP_ALARM_ID, cellId->cellId);
189 setCellOpState(cellId->cellId, ENABLED, ACTIVE);
193 if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC))
194 DU_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, sizeof(OduCellId));
198 /**********************************************************************
200 **********************************************************************/