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"
34 /*******************************************************************
36 * @brief Processes cells to be activated
40 * Function : duProcCellsToBeActivated
43 * - Processes cells to be activated list received in F1SetupRsp
46 * @return ROK - success
49 * ****************************************************************/
50 uint8_t duProcCellsToBeActivated(uint8_t *plmnStr, uint16_t nci, uint16_t nRPci)
53 DuCellCb *cellCb = NULLP;
54 uint8_t cfgIdx, tmpPlmn[4];
56 for(cfgIdx=0; cfgIdx<duCb.numCfgCells; cfgIdx++)
58 memset(tmpPlmn, 0, 4);
59 buildPlmnId(duCb.cfgCellLst[cfgIdx]->cellInfo.nrEcgi.plmn, tmpPlmn);
60 if(duCb.cfgCellLst[cfgIdx]->cellInfo.nrEcgi.cellId == nci &&
61 (strcmp((const char*)tmpPlmn, (const char*)plmnStr) == 0))
63 cellCb = duCb.cfgCellLst[cfgIdx];
68 DU_LOG("\nERROR --> DU APP : No Cell found for NCI %d", nci);
73 cellCb->cellStatus = ACTIVATION_IN_PROGRESS;
74 cellCb->cellInfo.nrPci = nRPci;
76 duCb.actvCellLst[duCb.numActvCells++] = cellCb;
78 if(duBuildAndSendMacCellCfg(cellCb->cellId) != ROK)
80 DU_LOG("\nERROR --> DU APP : macCellCfg build and send failed");
81 /* Delete cell from actvCellList */
82 duCb.actvCellLst[--(duCb.numActvCells)] = NULLP;
88 /*******************************************************************
90 * @brief Handles DU F1Setup Rsp received in F1AP
94 * Function : duProcF1SetupRsp
97 * - Handles DU F1Setup Rsp received in F1AP
99 * @params[in] Pointer to F1SetupRsp
102 ******************************************************************/
103 void duProcF1SetupRsp()
105 DU_LOG("\nINFO --> DU_APP : F1 Setup Response received");
106 duCb.f1Status = TRUE; //Set F1 status as true
109 /*******************************************************************
111 * @brief Handles GNB DU Cfg Update Ack received in F1AP
115 * Function : duProcGnbDuCfgUpdAckMsg
118 * - Handles GNB DU Cfg Update Ack received in F1AP
120 * @params[in] Pointer to F1GnbDuCfgUpdAck
123 ******************************************************************/
124 void duProcGnbDuCfgUpdAckMsg()
126 DU_LOG("\nINFO --> DU APP: GNB-DU config update Ack received ");
128 /*******************************************************************
130 * @brief Returns cellCb based on cell ID
134 * Function : duGetCellCb
136 * Functionality: Returns DU APP CellCb based on cell ID
138 * @params[in] F1AP_PDU_t ASN decoded F1AP message
139 * @return ROK - success
142 * ****************************************************************/
143 uint8_t duGetCellCb(uint16_t cellId, DuCellCb **cellCb)
146 for(cellIdx=0; cellIdx<duCb.numActvCells; cellIdx++)
148 if(duCb.actvCellLst[cellIdx]->cellId == cellId)
149 *cellCb = duCb.actvCellLst[cellIdx];
155 DU_LOG("\nERROR --> DU APP : Cell Id %d not found in DU APP", cellId);
162 /*******************************************************************
164 * @brief Handles cell up indication from MAC
168 * Function : duHandleCellUpInd
171 * Handles cell up indication from MAC
173 * @params[in] Post structure pointer
175 * @return ROK - success
178 * ****************************************************************/
179 uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId)
181 DuCellCb *cellCb = NULLP;
183 if(cellId->cellId <=0 || cellId->cellId > MAX_NUM_CELL)
185 DU_LOG("\nERROR --> DU APP : Invalid Cell Id %d in duHandleCellUpInd()", cellId->cellId);
189 if(duGetCellCb(cellId->cellId, &cellCb) != ROK)
192 if((cellCb != NULL) && (cellCb->cellStatus == ACTIVATION_IN_PROGRESS))
194 DU_LOG("\nINFO --> DU APP : 5G-NR Cell %d is UP", cellId->cellId);
195 cellCb->cellStatus = ACTIVATED;
198 DU_LOG("\nINFO --> DU APP : Raise cell UP alarm for cell id=%d", cellId->cellId);
199 raiseCellAlrm(CELL_UP_ALARM_ID, cellId->cellId);
203 if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC))
204 DU_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, sizeof(OduCellId));
208 /**********************************************************************
210 **********************************************************************/