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"
35 #include "GlobalDefs.h"
36 #include "AlarmInterface.h"
40 /*******************************************************************
42 * @brief Processes cells to be activated
46 * Function : duProcCellsToBeActivated
49 * - Processes cells to be activated list received in F1SetupRsp
52 * @return ROK - success
55 * ****************************************************************/
56 uint8_t duProcCellsToBeActivated(uint8_t *plmnStr, uint16_t nci, uint16_t nRPci)
59 DuCellCb *cellCb = NULLP;
60 uint8_t cfgIdx, tmpPlmn[4];
62 for(cfgIdx=0; cfgIdx<duCb.numCfgCells; cfgIdx++)
64 memset(tmpPlmn, 0, 4);
65 buildPlmnId(duCb.cfgCellLst[cfgIdx]->cellInfo.nrEcgi.plmn, tmpPlmn);
66 if(duCb.cfgCellLst[cfgIdx]->cellInfo.nrEcgi.cellId == nci &&
67 (strcmp((const char*)tmpPlmn, (const char*)plmnStr) == 0))
69 cellCb = duCb.cfgCellLst[cfgIdx];
74 DU_LOG("\nERROR --> DU APP : No Cell found for NCI %d", nci);
79 cellCb->cellStatus = ACTIVATION_IN_PROGRESS;
80 cellCb->cellInfo.nrPci = nRPci;
82 duCb.actvCellLst[duCb.numActvCells++] = cellCb;
84 if(duBuildAndSendMacCellCfg(cellCb->cellId) != ROK)
86 DU_LOG("\nERROR --> DU APP : macCellCfg build and send failed");
87 /* Delete cell from actvCellList */
88 duCb.actvCellLst[--(duCb.numActvCells)] = NULLP;
94 /*******************************************************************
96 * @brief Handles DU F1Setup Rsp received in F1AP
100 * Function : duProcF1SetupRsp
103 * - Handles DU F1Setup Rsp received in F1AP
105 * @params[in] Pointer to F1SetupRsp
108 ******************************************************************/
109 void duProcF1SetupRsp()
111 DU_LOG("\nINFO --> DU_APP : F1 Setup Response received");
112 duCb.f1Status = TRUE; //Set F1 status as true
115 /*******************************************************************
117 * @brief Handles GNB DU Cfg Update Ack received in F1AP
121 * Function : duProcGnbDuCfgUpdAckMsg
124 * - Handles GNB DU Cfg Update Ack received in F1AP
126 * @params[in] Pointer to F1GnbDuCfgUpdAck
129 ******************************************************************/
130 void duProcGnbDuCfgUpdAckMsg()
132 DU_LOG("\nINFO --> DU APP: GNB-DU config update Ack received ");
134 /*******************************************************************
136 * @brief Returns cellCb based on cell ID
140 * Function : duGetCellCb
142 * Functionality: Returns DU APP CellCb based on cell ID
144 * @params[in] F1AP_PDU_t ASN decoded F1AP message
145 * @return ROK - success
148 * ****************************************************************/
149 uint8_t duGetCellCb(uint16_t cellId, DuCellCb **cellCb)
152 for(cellIdx=0; cellIdx<duCb.numActvCells; cellIdx++)
154 if(duCb.actvCellLst[cellIdx]->cellId == cellId)
155 *cellCb = duCb.actvCellLst[cellIdx];
161 DU_LOG("\nERROR --> DU APP : Cell Id %d not found in DU APP", cellId);
168 /*******************************************************************
170 * @brief Handles cell up indication from MAC
174 * Function : duHandleCellUpInd
177 * Handles cell up indication from MAC
179 * @params[in] Post structure pointer
181 * @return ROK - success
184 * ****************************************************************/
185 uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId)
187 DuCellCb *cellCb = NULLP;
189 if(cellId->cellId <=0 || cellId->cellId > MAX_NUM_CELL)
191 DU_LOG("\nERROR --> DU APP : Invalid Cell Id %d in duHandleCellUpInd()", cellId->cellId);
195 if(duGetCellCb(cellId->cellId, &cellCb) != ROK)
198 if((cellCb != NULL) && (cellCb->cellStatus == ACTIVATION_IN_PROGRESS))
200 DU_LOG("\nINFO --> DU APP : 5G-NR Cell %d is UP", cellId->cellId);
201 cellCb->cellStatus = ACTIVATED;
204 DU_LOG("\nINFO --> DU APP : Raise cell UP alarm for cell id=%d", cellId->cellId);
205 raiseCellAlrm(CELL_UP_ALARM_ID, cellId->cellId);
209 if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC))
210 DU_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, sizeof(OduCellId));
214 /**********************************************************************
216 **********************************************************************/