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"
25 #include "du_app_mac_inf.h"
28 #include<ProtocolIE-Field.h>
30 #include "du_cell_mgr.h"
31 #include "odu_common_codec.h"
33 extern DuCfgParams duCfgParam;
34 extern S16 duBuildAndSendMacCellCfg();
36 /*******************************************************************
38 * @brief Processes cells to be activated
42 * Function : procCellsToBeActivated
45 * - Processes cells to be activated list received in F1SetupRsp
48 * @return ROK - success
51 * ****************************************************************/
52 S16 procCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
57 for(idx=0; idx<cellsToActivate.list.count; idx++)
61 DuCellCb *cellCb = NULLP;
63 Cells_to_be_Activated_List_Item_t cell = cellsToActivate.list.array[idx]->\
64 value.choice.Cells_to_be_Activated_List_Item;
66 bitStringToInt(&cell.nRCGI.nRCellIdentity, &nci);
67 if(nci <= 0 || nci > MAX_NUM_CELL)
69 DU_LOG("\nDU APP : Invalid NCI %d", nci);
78 cellCb = duCb.cfgCellLst[nci-1];
82 DU_LOG("\nDU APP : No Cell found for NCI %d", nci);
85 cellCb->cellStatus = ACTIVATION_IN_PROGRESS;
86 cellCb->cellInfo.nrPci = pci;
88 /* Now remove this cell from configured list and move to active list */
89 duCb.cfgCellLst[nci-1] = NULL;
90 duCb.actvCellLst[nci-1] = cellCb;
92 /* Build and send Mac Cell Cfg for the number of active cells */
93 ret = duBuildAndSendMacCellCfg();
96 DU_LOG("\nDU APP : macCellCfg build and send failed");
103 /******************************************************************
105 * @brief Processes F1 Setup Response sent by CU
109 * Function : procF1SetupRsp
111 * Functionality: Processes F1 Setup Response sent by CU
113 * @params[in] F1AP_PDU_t ASN decoded F1AP message
114 * @return ROK - success
117 * ****************************************************************/
118 uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg)
122 F1SetupResponse_t *f1SetRspMsg;
123 F1SetupRsp f1SetRspDb;
124 GNB_CU_Name_t *cuName;
125 RRC_Version_t *rrc_Ver;
128 DU_LOG("\nDU_APP : F1 Setup Response received");
129 printf("\nDU_APP : F1 Setup Response received");
130 duCb.f1Status = TRUE; //Set F1 status as true
131 f1SetRspMsg = &f1apMsg->choice.successfulOutcome->value.choice.F1SetupResponse;
133 for(idx=0; idx<f1SetRspMsg->protocolIEs.list.count; idx++)
135 // F1SetupResponseIEs_t f1RspIe = f1SetRspMsg->protocolIEs.list.array[idx];
136 switch(f1SetRspMsg->protocolIEs.list.array[idx]->id)
138 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
140 procCellsToBeActivated(f1SetRspMsg->protocolIEs.list.array[idx]->\
141 value.choice.Cells_to_be_Activated_List);
144 //TODO: where to store and how to use below variables?can they be skipped
145 case ProtocolIE_ID_id_TransactionID:
147 f1SetRspDb.transId = f1SetRspMsg->protocolIEs.list.array[idx]->\
148 value.choice.TransactionID;
151 case ProtocolIE_ID_id_gNB_CU_Name:
153 cuName = &f1SetRspMsg->protocolIEs.list.array[idx]->\
154 value.choice.GNB_CU_Name;
155 strcpy(f1SetRspDb.cuName, (const char*)cuName->buf);
158 case ProtocolIE_ID_id_GNB_CU_RRC_Version:
160 rrc_Ver = &f1SetRspMsg->protocolIEs.list.array[idx]->\
161 value.choice.RRC_Version;
162 strcpy(f1SetRspDb.rrcVersion.rrcVer,
163 (const char*)rrc_Ver->latest_RRC_Version.buf);
167 DU_LOG("\nDU_APP : Invalid IE received in F1SetupRsp:%ld",
168 f1SetRspMsg->protocolIEs.list.array[idx]->id);
172 /* TODO :Check the deallocation */
174 SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&(f1SetupRsp->protocolIEs.list.array),\
175 (Size)elementCnt * sizeof(F1SetupResponseIEs_t *));
176 SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&(f1apMsg->choice.successfulOutcome),\
177 (Size)sizeof(SuccessfulOutcome_t));
178 SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t));
184 /*******************************************************************
186 * @brief Processes GNB DU config update ack
190 * Function : procGNBDUCfgUpdAck
192 * Functionality: Processes GNB DU config update ack
194 * @params[in] F1AP_PDU_t ASN decoded F1AP message
195 * @return ROK - success
198 * ****************************************************************/
199 S16 procGNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
201 DU_LOG("\nF1AP : GNB-DU config update acknowledgment received");
202 /* TODO :Check the deallocation */
204 SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data*)&(gNBDuCfgAck->protocolIEs.list.array),\
205 (Size)elementCnt * sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t
207 SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data*)&(f1apMsg->choice.successfulOutcome),\
208 (Size)sizeof(SuccessfulOutcome_t));
209 SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data*)&f1apMsg,(Size)sizeof(F1AP_PDU_t));
215 /**********************************************************************
217 **********************************************************************/