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 F1AP message handler functions */
20 #include "common_def.h"
26 #include "du_app_mac_inf.h"
28 #include "du_app_rlc_inf.h"
29 #include "du_mgr_main.h"
32 #include "FeatureSetUplinkPerCC.h"
33 #include "FeatureSetDownlinkPerCC.h"
34 #include "FeatureSets.h"
35 #include "UE-NR-Capability.h"
36 #include "UE-CapabilityRAT-Container.h"
37 #include "UE-CapabilityRAT-ContainerListRRC.h"
38 #include "GNB-DU-System-Information.h"
39 #include "CellGroupConfigRrc.h"
40 #include "MAC-CellGroupConfig.h"
41 #include "SchedulingRequestConfig.h"
42 #include "SchedulingRequestToAddMod.h"
43 #include "BSR-Config.h"
44 #include "TAG-Config.h"
46 #include "PHR-Config.h"
47 #include "RLC-Config.h"
48 #include "UL-AM-RLC.h"
49 #include "DL-AM-RLC.h"
50 #include "LogicalChannelConfig.h"
51 #include "RLC-BearerConfig.h"
52 #include "PhysicalCellGroupConfig.h"
53 #include "SpCellConfig.h"
54 #include "TDD-UL-DL-ConfigDedicated.h"
55 #include "ServingCellConfig.h"
56 #include "ControlResourceSet.h"
57 #include "SearchSpace.h"
58 #include "PDCCH-Config.h"
59 #include "PDSCH-TimeDomainResourceAllocation.h"
60 #include "PDSCH-TimeDomainResourceAllocationList.h"
61 #include "PDSCH-CodeBlockGroupTransmission.h"
62 #include "PDSCH-ServingCellConfig.h"
63 #include "DMRS-DownlinkConfig.h"
64 #include "PDSCH-Config.h"
65 #include "BWP-DownlinkDedicated.h"
66 #include "PUSCH-TimeDomainResourceAllocation.h"
67 #include "PUSCH-TimeDomainResourceAllocationList.h"
68 #include "DMRS-UplinkConfig.h"
69 #include "PUSCH-Config.h"
70 #include "SRS-ResourceId.h"
71 #include "SRS-Resource.h"
72 #include "SRS-ResourceSet.h"
73 #include "SRS-Config.h"
74 #include "BWP-UplinkDedicated.h"
75 #include "PUSCH-ServingCellConfig.h"
76 #include "UplinkConfig.h"
77 #include "DUtoCURRCContainer.h"
78 #include "GBR-QoSFlowInformation.h"
79 #include "QoSFlowLevelQoSParameters.h"
80 #include "PUCCH-Config.h"
81 #include "PUCCH-ResourceSet.h"
82 #include "PUCCH-Resource.h"
83 #include "PUCCH-PowerControl.h"
85 #include "PUCCH-PathlossReferenceRS.h"
86 #include "PUCCH-format0.h"
87 #include "PUCCH-format1.h"
88 #include "PUCCH-format2.h"
89 #include "PUCCH-format3.h"
90 #include "PUCCH-format4.h"
91 #include "PUCCH-FormatConfig.h"
92 #include "SchedulingRequestResourceConfig.h"
93 #include<ProtocolIE-Field.h>
94 #include "ProtocolExtensionField.h"
95 #include "odu_common_codec.h"
97 #include "du_cell_mgr.h"
98 #include "du_f1ap_msg_hdl.h"
99 #include "DRBs-Setup-Item.h"
100 #include "DLUPTNLInformation-ToBeSetup-List.h"
101 #include "DLUPTNLInformation-ToBeSetup-Item.h"
102 #include "UPTransportLayerInformation.h"
103 #include "GTPTunnel.h"
104 #include "SupportedSULFreqBandItem.h"
105 #include "du_sys_info_hdl.h"
108 #include "CmInterface.h"
109 extern StartupConfig g_cfg;
112 DuCfgParams duCfgParam;
114 /******************************************************************
116 * @brief Function to fetch lcId based on DRB Id
120 * Function : fetchLcId
124 * Functionality: Function to fetch lcId based on DRB Id
126 * Returns: lcId - SUCCESS
128 *****************************************************************/
130 uint8_t fetchLcId(uint8_t drbId)
132 uint8_t cellIdx = 0, ueIdx = 0, lcIdx = 0, numLcs = 0, lcId = 0;
134 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
136 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
138 if(duCb.actvCellLst[cellIdx] != NULLP)
140 numLcs = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.numLcs;
141 for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
143 if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].rbId == drbId && \
144 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].rbType == RB_TYPE_DRB)
146 lcId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].lcId;
153 DU_LOG("\nERROR --> DU_APP: fetchLcId() failed for drbId %d", drbId);
157 /************************************************************************
159 * @brief Converts enum values into actual value of Poll retransmit timer
163 * Function : getPollPdu
165 * Functionality: Converts enum values into actual value of poll
168 * @params[in] Enum value of pollPdu
169 * @return Actual value of pollPdu
171 * **********************************************************************/
173 uint16_t getPollRetxTmr(uint8_t pollRetxTmrCfg)
175 uint16_t pollRetxTmr;
177 /* All values of poll retx timer are at interval of 5ms.
178 * This is valid upto 250ms
179 * Hence converting the enum value to actual value by multiplying it to 5
181 if(pollRetxTmrCfg <= T_PollRetransmit_ms250)
182 pollRetxTmr = (pollRetxTmrCfg + 1) * 5;
185 switch(pollRetxTmrCfg)
187 case T_PollRetransmit_ms300:
190 case T_PollRetransmit_ms350:
193 case T_PollRetransmit_ms400:
196 case T_PollRetransmit_ms450:
199 case T_PollRetransmit_ms500:
202 case T_PollRetransmit_ms800:
206 DU_LOG("\nERROR --> F1AP: Invalid value of Poll Retransmit timer");
213 /*******************************************************************
215 * @brief Converts enum values into actual value of PollPdu
219 * Function : getPollPdu
221 * Functionality: Converts enum values into actual value of PollPdu
223 * @params[in] Enum value of pollPdu
224 * @return Actual value of pollPdu
226 * ****************************************************************/
227 int32_t getPollPdu(uint8_t pollPduCfg)
301 case PollPDU_infinity:
305 DU_LOG("\nERROR --> F1AP: Invalid value of poll pdu");
312 /*******************************************************************
314 * @brief Converts enum values into actual value of poll bytes
318 * Function : getPollByte
320 * Functionality: Converts enum values into actual value of pollBytes
322 * @params[in] Enum value
323 * @return Actual value
325 * ****************************************************************/
326 int32_t getPollByte(uint16_t pollBytesCfg)
376 case PollByte_kB1000:
379 case PollByte_kB1250:
382 case PollByte_kB1500:
385 case PollByte_kB2000:
388 case PollByte_kB3000:
391 case PollByte_kB4000:
394 case PollByte_kB4500:
397 case PollByte_kB5000:
400 case PollByte_kB5500:
403 case PollByte_kB6000:
406 case PollByte_kB6500:
409 case PollByte_kB7000:
412 case PollByte_kB7500:
422 pollBytes = 10000000;
425 pollBytes = 11000000;
428 pollBytes = 12000000;
431 pollBytes = 13000000;
434 pollBytes = 14000000;
437 pollBytes = 15000000;
440 pollBytes = 16000000;
443 pollBytes = 17000000;
446 pollBytes = 18000000;
449 pollBytes = 20000000;
452 pollBytes = 25000000;
455 pollBytes = 30000000;
458 pollBytes = 40000000;
460 case PollByte_infinity:
464 DU_LOG("\nERROR --> F1AP: Invalid value of poll bytes");
470 /*******************************************************************
472 * @brief Converts enum values into actual value of maxRetx
476 * Function : getMaxRetx
478 * Functionality: Converts enum values into actual value of maxRetx
480 * @params[in] Enum value
481 * @return Actual value
483 * ****************************************************************/
484 uint8_t getMaxRetx(uint8_t maxRetxCfg)
489 case UL_AM_RLC__maxRetxThreshold_t1:
492 case UL_AM_RLC__maxRetxThreshold_t2:
495 case UL_AM_RLC__maxRetxThreshold_t3:
498 case UL_AM_RLC__maxRetxThreshold_t4:
501 case UL_AM_RLC__maxRetxThreshold_t6:
504 case UL_AM_RLC__maxRetxThreshold_t8:
507 case UL_AM_RLC__maxRetxThreshold_t16:
510 case UL_AM_RLC__maxRetxThreshold_t32:
514 DU_LOG("\nERROR --> F1AP: Invalid configuration for Max retransmission threshold");
520 /*******************************************************************
521 * @brief Converts enum values into actual value of reassembly timer
525 * Function : getReAsmblTmr
527 * Functionality: Converts enum values into actual value of reassembly
530 * @params[in] Enum value of reassembly timer
531 * @return Actual value of reassembly timer
533 * **********************************************************************/
535 int8_t getReAsmblTmr(uint8_t reAsmblTmrCfg)
537 int8_t reAsmblTmr = 0;
539 if(reAsmblTmrCfg == T_Reassembly_ms0)
543 else if(reAsmblTmrCfg >= T_Reassembly_ms5 || reAsmblTmrCfg <= T_Reassembly_ms100)
545 /* All values of re assembly timer are at interval of 5ms.
546 * This is valid upto 100ms
547 * Hence converting the enum value to actual value by multiplying it to 5
549 reAsmblTmr = reAsmblTmrCfg * 5;
551 else if(reAsmblTmrCfg >= T_Reassembly_ms110 || reAsmblTmrCfg <= T_Reassembly_ms200)
553 /* All values of re assembly timer are at interval of 10ms.
554 * This is valid upto 200ms
555 * since enum value starts from 20 for 100ms, subtracting 10 and
556 * converting the enum value to actual value by multiplying it to 10
558 reAsmblTmr = ((reAsmblTmrCfg-10) * 10);
562 DU_LOG("\nERROR --> F1AP : Invalid value of Re Assembly timer %d", reAsmblTmrCfg);
568 /************************************************************************
570 * @brief Converts enum values into actual value of status prohibit timer
574 * Function : getStatProhTmr
576 * Functionality: Converts enum values into actual value of status prohibit
579 * @params[in] Enum value of status prohibit timer
580 * @return Actual value of status prohibit timer
582 * **********************************************************************/
584 int16_t getStatProhTmr(uint8_t statProhTmrCfg)
586 int16_t statProhTmr =0;
588 if(statProhTmrCfg == T_StatusProhibit_ms0)
592 else if(statProhTmrCfg >= T_StatusProhibit_ms5 || statProhTmrCfg <= T_StatusProhibit_ms250)
594 /* All values of re assembly timer are at interval of 5ms.
595 * This is valid upto 250ms
596 * Hence converting the enum value to actual value by multiplying it to 5
598 statProhTmr = statProhTmrCfg * 5;
602 switch(statProhTmrCfg)
604 case T_StatusProhibit_ms300:
607 case T_StatusProhibit_ms350:
610 case T_StatusProhibit_ms400:
613 case T_StatusProhibit_ms450:
616 case T_StatusProhibit_ms500:
619 case T_StatusProhibit_ms800:
622 case T_StatusProhibit_ms1000:
625 case T_StatusProhibit_ms1200:
628 case T_StatusProhibit_ms1600:
631 case T_StatusProhibit_ms2000:
634 case T_StatusProhibit_ms2400:
638 DU_LOG("\nInvalid value of Status Prohibit timer %d", statProhTmrCfg);
646 /*******************************************************************
648 * @brief Adding F1AP pdu to reserved pdu list
652 * Function : addToReservedF1apPduList
654 * Functionality: Adding F1AP pdu to reserved pdu list.
655 * These pdu are awaiting aknowledgment from CU
657 * @params[in] uint8_t transId, F1AP_PDU_t *f1apMsg
659 * @return ROK - success
662 * ****************************************************************/
664 void addToReservedF1apPduList(uint8_t transId, F1AP_PDU_t *f1apPdu)
666 CmLList *node = NULLP;
667 ReservedF1apPduInfo *pduInfo = NULLP;
668 DU_ALLOC(pduInfo, sizeof(ReservedF1apPduInfo));
671 DU_ALLOC(node, sizeof(CmLList));
674 pduInfo->transId = transId;
675 pduInfo->f1apMsg = (void*) f1apPdu;
677 node->node = (PTR)pduInfo;
678 cmLListAdd2Tail(&duCb.reservedF1apPduList, node);
683 /*******************************************************************
685 * @brief searching for F1AP pdu from ReservedF1apPduList
689 * Function : searchFromReservedF1apPduList
691 * Functionality: searching for F1AP pdu information
693 * @params[in] uint8_t transId
695 * @return pointer to F1AP_PDU_t
697 * ****************************************************************/
699 CmLList *searchFromReservedF1apPduList(uint8_t transId)
702 ReservedF1apPduInfo *f1apPdu;
703 if(duCb.reservedF1apPduList.count)
705 CM_LLIST_FIRST_NODE(&duCb.reservedF1apPduList, node);
708 f1apPdu = (ReservedF1apPduInfo*)node->node;
709 if(f1apPdu->transId == transId)
719 /*******************************************************************
721 * @brief deleting F1AP pdu information from ReservedF1apPduList
725 * Function : deleteFromReservedF1apPduList
727 * Functionality: deleting pdu information from ReservedF1apPduList
729 * @params[in] CmLList *node
733 * ****************************************************************/
735 void deleteFromReservedF1apPduList(CmLList *node)
737 ReservedF1apPduInfo *f1apPdu;
741 f1apPdu = (ReservedF1apPduInfo *)node->node;
742 cmLListDelFrm(&duCb.reservedF1apPduList, node);
743 DU_FREE(f1apPdu, sizeof(ReservedF1apPduInfo));
744 DU_FREE(node, sizeof(CmLList));
749 /*******************************************************************
751 * @brief Builds Uplink Info for NR
755 * Function : BuildULNRInfo
757 * Functionality: Building NR Uplink Info
759 * @params[in] NRFreqInfo_t *ulnrfreq
760 * @return ROK - success
763 * ****************************************************************/
764 uint8_t BuildULNRInfo(NRFreqInfo_t *ulnrfreq)
767 ulnrfreq->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.\
768 fdd.ulNrFreqInfo.nrArfcn;
769 ulnrfreq->freqBandListNr.list.count = 1;
770 ulnrfreq->freqBandListNr.list.size = sizeof(FreqBandNrItem_t *);
771 DU_ALLOC(ulnrfreq->freqBandListNr.list.array,ulnrfreq->freqBandListNr.list.size);
772 if(ulnrfreq->freqBandListNr.list.array == NULLP)
776 for(idx=0;idx<ulnrfreq->freqBandListNr.list.count;idx++)
778 DU_ALLOC(ulnrfreq->freqBandListNr.list.array[idx],sizeof(FreqBandNrItem_t));
779 if(ulnrfreq->freqBandListNr.list.array[idx] == NULLP)
784 ulnrfreq->freqBandListNr.list.array[0]->freqBandIndicatorNr = \
785 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.\
786 freqBand[0].nrFreqBand;
787 ulnrfreq->freqBandListNr.list.array[0]->supportedSULBandList.list.count = SUL_BAND_COUNT;
790 /*******************************************************************
792 * @brief Builds Downlink NR Info
796 * Function : BuildDLNRInfo
798 * Functionality: Building Downlink NR Info
800 * @params[in] NRFreqInfo_t *dlnrfreq
801 * @return ROK - success
804 * ****************************************************************/
805 uint8_t BuildDLNRInfo(NRFreqInfo_t *dlnrfreq)
808 dlnrfreq->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.\
809 fdd.dlNrFreqInfo.nrArfcn;
810 dlnrfreq->freqBandListNr.list.count = 1;
811 dlnrfreq->freqBandListNr.list.size = sizeof(FreqBandNrItem_t *);
812 DU_ALLOC(dlnrfreq->freqBandListNr.list.array,dlnrfreq->freqBandListNr.list.size);
813 if(dlnrfreq->freqBandListNr.list.array == NULLP)
817 for(idx=0;idx< dlnrfreq->freqBandListNr.list.count;idx++)
819 DU_ALLOC(dlnrfreq->freqBandListNr.list.array[idx],sizeof(FreqBandNrItem_t));
820 if(dlnrfreq->freqBandListNr.list.array[idx] == NULLP)
825 dlnrfreq->freqBandListNr.list.array[0]->freqBandIndicatorNr = \
826 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.\
827 freqBand[0].nrFreqBand;
828 dlnrfreq->freqBandListNr.list.array[0]->supportedSULBandList.list.count = SUL_BAND_COUNT;
833 /*******************************************************************
835 * @brief Builds NRCell ID
839 * Function : BuildNrCellId
841 * Functionality: Building the NR Cell ID
843 * @params[in] BIT_STRING_t *nrcell
844 * @return ROK - success
847 * ****************************************************************/
849 S16 BuildNrCellId(BIT_STRING_t *nrcell)
851 memset(nrcell->buf, 0, nrcell->size);
852 nrcell->buf[4] = duCfgParam.sib1Params.cellIdentity;
853 nrcell->bits_unused = 4;
857 /*******************************************************************
859 * @brief Builds Nrcgi
863 * Function : BuildNrcgi
865 * Functionality: Building the PLMN ID and NR Cell id
867 * @params[in] NRCGI_t *nrcgi
868 * @return ROK - success
871 * ****************************************************************/
872 uint8_t BuildNrcgi(NRCGI_t *nrcgi)
875 uint8_t byteSize = 5;
876 /* Allocate Buffer Memory */
877 nrcgi->pLMN_Identity.size = PLMN_SIZE * sizeof(uint8_t);
878 DU_ALLOC(nrcgi->pLMN_Identity.buf, nrcgi->pLMN_Identity.size);
879 if(nrcgi->pLMN_Identity.buf == NULLP)
883 ret = buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
884 nrcgi->pLMN_Identity.buf); // Building PLMN function
890 nrcgi->nRCellIdentity.size = byteSize * sizeof(uint8_t);
891 DU_ALLOC(nrcgi->nRCellIdentity.buf, nrcgi->nRCellIdentity.size);
892 if(nrcgi->nRCellIdentity.buf == NULLP)
896 BuildNrCellId(&nrcgi->nRCellIdentity);
900 /*******************************************************************
902 * @brief Builds FiveGStac
906 * Function : BuildFiveGSTac
908 * Functionality: Building the FiveGSTac
910 * @params[in] OCTET_STRING_t *fivegsTac
911 * @return ROK - success
914 * ****************************************************************/
915 uint8_t BuildFiveGSTac(Served_Cell_Information_t *servcell)
917 DU_ALLOC(servcell->fiveGS_TAC,sizeof(FiveGS_TAC_t));
918 if(servcell->fiveGS_TAC == NULLP)
922 servcell->fiveGS_TAC->size = 3 * sizeof(uint8_t);
923 DU_ALLOC(servcell->fiveGS_TAC->buf,\
924 sizeof(servcell->fiveGS_TAC->size));
925 if(servcell->fiveGS_TAC->buf == NULLP)
929 servcell->fiveGS_TAC->buf[0] = 0;
930 servcell->fiveGS_TAC->buf[1] = 0;
931 servcell->fiveGS_TAC->buf[2] = duCfgParam.srvdCellLst[0].duCellInfo.tac;
935 /*******************************************************************
937 * @brief fill nr frequency information
941 * Function : fillNrTddInfo
943 * Functionality: fill nr frequency information
945 * @params[in] NRFreqInfo_t freqInfo
946 * @return ROK - success
949 * ****************************************************************/
950 uint8_t fillNrTddInfo(TDD_Info_t *tddInfo)
952 uint8_t elementCnt = 1, freqBandListIdx = 0, supportedBandIdx = 0;
953 NRFreqInfo_t *freqInfo = NULLP;
957 DU_LOG("\nERROR --> DU APP : Null pointer received at fillNrTddInfo");
961 freqInfo = &tddInfo->nRFreqInfo;
962 freqInfo->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn;
964 freqInfo->freqBandListNr.list.count = elementCnt;
965 freqInfo->freqBandListNr.list.size = freqInfo->freqBandListNr.list.count * sizeof(FreqBandNrItem_t *);
966 DU_ALLOC(freqInfo->freqBandListNr.list.array, freqInfo->freqBandListNr.list.size );
967 if(!freqInfo->freqBandListNr.list.array)
969 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
973 for(freqBandListIdx = 0; freqBandListIdx<freqInfo->freqBandListNr.list.count; freqBandListIdx++)
975 DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx], sizeof(FreqBandNrItem_t ));
976 if(!freqInfo->freqBandListNr.list.array[freqBandListIdx])
978 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
982 freqInfo->freqBandListNr.list.array[freqBandListIdx]->freqBandIndicatorNr = duCfgParam.srvdCellLst[0].duCellInfo.\
983 f1Mode.mode.tdd.nrFreqInfo.freqBand[0].nrFreqBand;
984 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count = elementCnt;
985 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size = freqInfo->freqBandListNr.list.array[freqBandListIdx]->\
986 supportedSULBandList.list.count * sizeof(SupportedSULFreqBandItem_t*);
988 DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array,\
989 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size);
990 if(!freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array)
992 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
996 for(supportedBandIdx = 0; supportedBandIdx<freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count; supportedBandIdx++)
998 DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx],\
999 sizeof(SupportedSULFreqBandItem_t));
1000 if(!freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx])
1002 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
1006 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx]->freqBandIndicatorNr =\
1007 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[0].sulBand[0];
1011 tddInfo->transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs;
1012 tddInfo->transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb;
1017 /*******************************************************************
1019 * @brief Builds NR Mode
1023 * Function : BuildNrMode
1025 * Functionality: Building the NR Mode
1027 * @params[in] NR_Mode_Info_t *fdd
1028 * @return ROK - success
1031 * ****************************************************************/
1032 uint8_t BuildNrMode(NR_Mode_Info_t *mode)
1034 uint8_t BuildDLNRInforet=0;
1035 uint8_t BuildULNRInforet=0;
1038 mode->present = NR_Mode_Info_PR_tDD;
1040 mode->present = NR_Mode_Info_PR_fDD;
1043 if(mode->present == NR_Mode_Info_PR_fDD)
1045 DU_ALLOC(mode->choice.fDD,sizeof(FDD_Info_t));
1046 if(mode->choice.fDD == NULLP)
1048 DU_LOG("\nERROR --> Memory allocation failed in BuildNrMode");
1051 BuildULNRInforet = BuildULNRInfo(&mode->choice.fDD->uL_NRFreqInfo);
1052 if(BuildULNRInforet != ROK)
1054 DU_LOG("\nERROR --> Failed to build UlNrFreqInfo");
1057 BuildDLNRInforet = BuildDLNRInfo(&mode->choice.fDD->dL_NRFreqInfo);
1058 if(BuildDLNRInforet != ROK)
1060 DU_LOG("\nERROR --> Failed to build DlNrFreqInfo");
1063 mode->choice.fDD->uL_Transmission_Bandwidth.nRSCS = \
1064 duCfgParam.srvdCellLst[0].duCellInfo.\
1065 f1Mode.mode.fdd.ulTxBw.nrScs;
1066 mode->choice.fDD->uL_Transmission_Bandwidth.nRNRB = \
1067 duCfgParam.srvdCellLst[0].duCellInfo.\
1068 f1Mode.mode.fdd.ulTxBw.nrb;
1069 mode->choice.fDD->dL_Transmission_Bandwidth.nRSCS = \
1070 duCfgParam.srvdCellLst[0].duCellInfo.\
1071 f1Mode.mode.fdd.dlTxBw.nrScs;
1072 mode->choice.fDD->dL_Transmission_Bandwidth.nRNRB = \
1073 duCfgParam.srvdCellLst[0].duCellInfo.\
1074 f1Mode.mode.fdd.dlTxBw.nrb;
1076 else if(mode->present == NR_Mode_Info_PR_tDD)
1078 DU_ALLOC(mode->choice.tDD,sizeof(TDD_Info_t));
1079 if(mode->choice.tDD == NULLP)
1081 DU_LOG("\nERROR --> Memory allocation failed in BuildNrMode");
1085 if(fillNrTddInfo(mode->choice.tDD) != ROK)
1087 DU_LOG("\nERROR --> Failed to fill Nr TDD information");
1095 /*******************************************************************
1097 * @brief Builds IE Extensions for Served PLMNs
1101 * Function : BuildExtensions
1103 * Functionality: Building the IE Extensions
1105 * @params[in] struct ProtocolExtensionContainer_4624P3 *buildextend
1106 * @return ROK - success
1109 * ****************************************************************/
1110 uint8_t BuildExtensions(ProtocolExtensionContainer_4624P3_t **ieExtend)
1112 uint8_t idx=0, plmnidx=0, sliceLstIdx=0;
1113 uint8_t elementCnt=0, extensionCnt=0;
1115 extensionCnt=IE_EXTENSION_LIST_COUNT;
1116 DU_ALLOC(*ieExtend,sizeof(ProtocolExtensionContainer_4624P3_t));
1117 if((*ieExtend) == NULLP)
1119 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
1122 (*ieExtend)->list.count = extensionCnt;
1123 (*ieExtend)->list.size = \
1124 extensionCnt * sizeof(ServedPLMNs_ItemExtIEs_t *);
1125 DU_ALLOC((*ieExtend)->list.array,(*ieExtend)->list.size);
1126 if((*ieExtend)->list.array == NULLP)
1128 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
1131 for(plmnidx=0;plmnidx<extensionCnt;plmnidx++)
1133 DU_ALLOC((*ieExtend)->list.array[plmnidx],\
1134 sizeof(ServedPLMNs_ItemExtIEs_t));
1135 if((*ieExtend)->list.array[plmnidx] == NULLP)
1137 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
1142 elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices;
1144 (*ieExtend)->list.array[idx]->id = ProtocolIE_ID_id_TAISliceSupportList;
1145 (*ieExtend)->list.array[idx]->criticality = Criticality_ignore;
1146 (*ieExtend)->list.array[idx]->extensionValue.present = \
1147 ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList;
1148 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1149 list.count = elementCnt;
1150 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1151 list.size = (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1152 list.count * sizeof(SliceSupportItem_t *);
1154 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1155 list.array, elementCnt * sizeof(SliceSupportItem_t *));
1156 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1157 list.array == NULLP)
1159 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
1163 for(sliceLstIdx =0; sliceLstIdx<elementCnt; sliceLstIdx++)
1165 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1166 list.array[sliceLstIdx],sizeof(SliceSupportItem_t));
1167 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1168 list.array[sliceLstIdx] == NULLP)
1170 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
1173 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1174 list.array[sliceLstIdx]->sNSSAI.sST.size = sizeof(uint8_t);
1175 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\
1176 .list.array[sliceLstIdx]->sNSSAI.sST.buf,(*ieExtend)->list.array[idx]->\
1177 extensionValue.choice.SliceSupportList.\
1178 list.array[sliceLstIdx]->sNSSAI.sST.size);
1179 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\
1180 .list.array[sliceLstIdx]->sNSSAI.sST.buf == NULLP)
1182 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
1185 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1186 list.array[sliceLstIdx]->sNSSAI.sST.buf[0] = duCfgParam.srvdCellLst[0].duCellInfo.\
1187 cellInfo.srvdPlmn[0].taiSliceSuppLst.snssai[sliceLstIdx]->sst;
1189 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1190 list.array[sliceLstIdx]->sNSSAI.sD,sizeof(OCTET_STRING_t));
1191 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1192 list.array[sliceLstIdx]->sNSSAI.sD == NULLP)
1194 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
1197 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1198 list.array[sliceLstIdx]->sNSSAI.sD->size = 3 * sizeof(uint8_t);
1199 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1200 list.array[sliceLstIdx]->sNSSAI.sD->buf, (*ieExtend)->list.array[idx]->extensionValue.choice.\
1201 SliceSupportList.list.array[sliceLstIdx]->sNSSAI.sD->size);
1202 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1203 list.array[sliceLstIdx]->sNSSAI.sD->buf == NULLP)
1205 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
1208 memcpy((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
1209 list.array[sliceLstIdx]->sNSSAI.sD->buf, duCfgParam.srvdCellLst[0].duCellInfo.\
1210 cellInfo.srvdPlmn[0].taiSliceSuppLst.snssai[sliceLstIdx]->sd, (*ieExtend)->list.array[idx]->\
1211 extensionValue.choice.SliceSupportList.list.array[sliceLstIdx]->sNSSAI.sD->size);
1215 /*******************************************************************
1217 * @brief Builds Served PLMN
1221 * Function : BuildServedPlmn
1223 * Functionality: Building the Served PLMN
1225 * @params[in] GNB_DU_Served_Cells_Item_t *srvCellItem
1226 * @return ROK - success
1229 * ****************************************************************/
1230 uint8_t BuildServedPlmn(ServedPLMNs_List_t *srvplmn)
1233 uint8_t servPlmnCnt=1;
1234 uint8_t buildPlmnIdret=0;
1235 uint8_t BuildExtensionsret=0;
1236 srvplmn->list.count = servPlmnCnt;
1237 srvplmn->list.size = \
1238 servPlmnCnt*sizeof(ServedPLMNs_Item_t *);
1239 DU_ALLOC(srvplmn->list.array,srvplmn->list.size);
1240 if(srvplmn->list.array == NULLP)
1244 for(plmnidx=0; plmnidx<servPlmnCnt; plmnidx++)
1246 DU_ALLOC(srvplmn->list.array[plmnidx],\
1247 sizeof(ServedPLMNs_Item_t));
1248 if(srvplmn->list.array[plmnidx] == NULLP)
1253 srvplmn->list.array[0]->pLMN_Identity.size = PLMN_SIZE * sizeof(uint8_t);
1254 DU_ALLOC(srvplmn->list.array[0]->pLMN_Identity.buf, srvplmn->list.array[0]->pLMN_Identity.size);
1255 buildPlmnIdret = buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
1256 srvplmn->list.array[0]->pLMN_Identity.buf);
1257 if(buildPlmnIdret!= ROK)
1261 BuildExtensionsret = BuildExtensions(&srvplmn->list.array[0]->iE_Extensions);
1262 if(BuildExtensionsret!= ROK)
1268 /*******************************************************************
1270 * @brief Builds Served Cell List
1274 * Function : BuildServedCellList
1276 * Functionality: Building Served Cell List
1278 * @params[in] PLMNID plmn
1279 * @return ROK - success
1282 * ****************************************************************/
1284 uint8_t BuildServedCellList(GNB_DU_Served_Cells_List_t *duServedCell)
1286 uint8_t BuildNrcgiret=0;
1287 uint8_t BuildFiveGSTacret=0;
1288 uint8_t BuildServedPlmnret=0;
1289 uint8_t BuildNrModeret=0;
1293 GNB_DU_Served_Cells_Item_t *srvCellItem;
1294 duServedCell->list.size = plmnCnt * sizeof(GNB_DU_Served_Cells_ItemIEs_t *);
1295 duServedCell->list.count = plmnCnt;
1297 DU_ALLOC(duServedCell->list.array, duServedCell->list.size);
1298 if(duServedCell->list.array == NULLP)
1302 for(plmnidx=0; plmnidx<plmnCnt; plmnidx++)
1304 DU_ALLOC(duServedCell->list.array[plmnidx],\
1305 sizeof(GNB_DU_Served_Cells_ItemIEs_t));
1306 if(duServedCell->list.array[plmnidx] == NULLP)
1312 duServedCell->list.array[idx]->id = ProtocolIE_ID_id_GNB_DU_Served_Cells_Item;
1313 duServedCell->list.array[idx]->criticality = Criticality_reject;
1314 duServedCell->list.array[idx]->value.present = \
1315 GNB_DU_Served_Cells_ItemIEs__value_PR_GNB_DU_Served_Cells_Item;
1317 &duServedCell->list.array[idx]->value.choice.GNB_DU_Served_Cells_Item;
1319 BuildNrcgiret = BuildNrcgi(&srvCellItem->served_Cell_Information.nRCGI);
1320 if(BuildNrcgiret != ROK)
1325 srvCellItem->served_Cell_Information.nRPCI = \
1326 duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrPci;
1329 BuildFiveGSTacret = BuildFiveGSTac(&srvCellItem->served_Cell_Information);
1330 if(BuildFiveGSTacret != ROK)
1335 BuildServedPlmnret = BuildServedPlmn(&srvCellItem->served_Cell_Information.servedPLMNs);
1336 if(BuildServedPlmnret !=ROK)
1340 /*nR Mode Info with FDD*/
1341 BuildNrModeret = BuildNrMode(&srvCellItem->served_Cell_Information.nR_Mode_Info);
1342 if(BuildNrModeret != ROK)
1346 /*Measurement timing Config*/
1347 srvCellItem->served_Cell_Information.measurementTimingConfiguration.\
1348 size = sizeof(uint8_t);
1349 DU_ALLOC(srvCellItem->served_Cell_Information.\
1350 measurementTimingConfiguration.buf,srvCellItem->served_Cell_Information.measurementTimingConfiguration.size);
1351 if(srvCellItem->served_Cell_Information.\
1352 measurementTimingConfiguration.buf == NULLP)
1356 srvCellItem->served_Cell_Information.measurementTimingConfiguration.buf[0] = \
1357 duCfgParam.srvdCellLst[0].duCellInfo.measTimeCfg;
1359 /* GNB DU System Information */
1360 DU_ALLOC(srvCellItem->gNB_DU_System_Information,
1361 sizeof(GNB_DU_System_Information_t));
1362 if(!srvCellItem->gNB_DU_System_Information)
1367 srvCellItem->gNB_DU_System_Information->mIB_message.size = duCfgParam.srvdCellLst[0].duSysInfo.mibLen;
1368 DU_ALLOC(srvCellItem->gNB_DU_System_Information->mIB_message.buf,
1369 srvCellItem->gNB_DU_System_Information->mIB_message.size);
1370 if(!srvCellItem->gNB_DU_System_Information->mIB_message.buf)
1374 memcpy(srvCellItem->gNB_DU_System_Information->mIB_message.buf, duCfgParam.srvdCellLst[0].duSysInfo.mibMsg, \
1375 srvCellItem->gNB_DU_System_Information->mIB_message.size);
1378 srvCellItem->gNB_DU_System_Information->sIB1_message.size =\
1379 duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
1381 DU_ALLOC(srvCellItem->gNB_DU_System_Information->sIB1_message.buf,
1382 srvCellItem->gNB_DU_System_Information->sIB1_message.size);
1383 if(!srvCellItem->gNB_DU_System_Information->sIB1_message.buf)
1387 for(int x=0; x<srvCellItem->gNB_DU_System_Information->sIB1_message.size; x++)
1389 srvCellItem->gNB_DU_System_Information->sIB1_message.buf[x]=\
1390 duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg[x];
1394 /*******************************************************************
1396 * @brief Builds RRC Version
1400 * Function : BuildRrcVer
1402 * Functionality: Building RRC Version
1404 * @params[in] int idx,int elementCnt,RRC_Version_t *rrcver
1405 * @return ROK - success
1408 * ****************************************************************/
1409 uint8_t BuildRrcVer(RRC_Version_t *rrcVer)
1413 rrcVer->latest_RRC_Version.size = sizeof(uint8_t);
1414 DU_ALLOC(rrcVer->latest_RRC_Version.buf,sizeof(uint8_t));
1415 if(rrcVer->latest_RRC_Version.buf == NULLP)
1419 rrcVer->latest_RRC_Version.buf[0] = 0;
1420 rrcVer->latest_RRC_Version.bits_unused = 5;
1421 DU_ALLOC(rrcVer->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P81_t));
1422 if(rrcVer->iE_Extensions == NULLP)
1426 rrcVer->iE_Extensions->list.count = 1;
1427 rrcVer->iE_Extensions->list.size = sizeof(RRC_Version_ExtIEs_t *);
1428 DU_ALLOC(rrcVer->iE_Extensions->list.array,rrcVer->iE_Extensions->list.size);
1429 if(rrcVer->iE_Extensions->list.array == NULLP)
1434 DU_ALLOC(rrcVer->iE_Extensions->list.array[0],\
1435 sizeof(RRC_Version_ExtIEs_t));
1436 if(rrcVer->iE_Extensions->list.array[0] == NULLP)
1440 rrcVer->iE_Extensions->list.array[rrcExt]->id = \
1441 ProtocolIE_ID_id_latest_RRC_Version_Enhanced;
1442 rrcVer->iE_Extensions->list.array[rrcExt]->criticality = Criticality_reject;
1443 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.present =\
1444 RRC_Version_ExtIEs__extensionValue_PR_Latest_RRC_Version_Enhanced;
1445 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\
1446 .Latest_RRC_Version_Enhanced.size = 3*sizeof(uint8_t);
1447 DU_ALLOC(rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\
1448 .Latest_RRC_Version_Enhanced.buf,rrcVer->iE_Extensions->list.\
1449 array[rrcExt]->extensionValue.choice.Latest_RRC_Version_Enhanced.size);
1450 if(rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\
1451 .Latest_RRC_Version_Enhanced.buf == NULLP)
1456 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\
1457 Latest_RRC_Version_Enhanced.buf[rrcLatest] = 15;
1459 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\
1460 Latest_RRC_Version_Enhanced.buf[rrcLatest] = 5;
1462 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\
1463 Latest_RRC_Version_Enhanced.buf[rrcLatest] = 0;
1466 /*******************************************************************
1468 * @brief Sends F1 msg over SCTP
1472 * Function : sendF1APMsg
1474 * Functionality: Sends F1 msg over SCTP
1476 * @params[in] Region region
1478 * @return ROK - success
1481 * ****************************************************************/
1482 uint8_t sendF1APMsg()
1484 Buffer *mBuf = NULLP;
1486 if(ODU_GET_MSG_BUF(DU_APP_MEM_REGION, DU_POOL, &mBuf) == ROK)
1488 if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK)
1490 ODU_PRINT_MSG(mBuf, 0,0);
1492 if(sctpSend(mBuf, F1_INTERFACE) != ROK)
1494 DU_LOG("\nERROR --> F1AP : SCTP Send failed");
1495 ODU_PUT_MSG_BUF(mBuf);
1501 DU_LOG("\nERROR --> F1AP : ODU_ADD_POST_MSG_MULT failed");
1502 ODU_PUT_MSG_BUF(mBuf);
1505 ODU_PUT_MSG_BUF(mBuf);
1509 DU_LOG("\nERROR --> F1AP : Failed to allocate memory");
1515 /*******************************************************************
1517 * @brief deallocating the memory of function BuildAndSendF1SetupReq()
1521 * Function : FreeRrcVer
1523 * Functionality: deallocating the memory of function BuildRrcVer
1525 * @params[in] RRC_Version_t *rrcVer
1529 *****************************************************************/
1530 void FreeRrcVer(RRC_Version_t *rrcVer)
1532 if(rrcVer->latest_RRC_Version.buf != NULLP)
1534 if(rrcVer->iE_Extensions != NULLP)
1536 if(rrcVer->iE_Extensions->list.array != NULLP)
1538 if(rrcVer->iE_Extensions->list.array[0] != NULLP)
1540 if(rrcVer->iE_Extensions->list.array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf
1543 DU_FREE(rrcVer->iE_Extensions->list.array[0]->extensionValue.choice\
1544 .Latest_RRC_Version_Enhanced.buf,rrcVer->iE_Extensions->list.\
1545 array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.size);
1547 DU_FREE(rrcVer->iE_Extensions->list.array[0],sizeof(RRC_Version_ExtIEs_t));
1549 DU_FREE(rrcVer->iE_Extensions->list.array,sizeof(RRC_Version_ExtIEs_t*));
1551 DU_FREE(rrcVer->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P81_t));
1553 DU_FREE(rrcVer->latest_RRC_Version.buf,rrcVer->latest_RRC_Version.size);
1557 /*******************************************************************
1559 * @brief Deallocating memory of TDD NrFreqInfo
1563 * Function : freeTddNrFreqInfo
1565 * Functionality: freeTddNrFreqInfo
1567 * @params[in] F1AP_PDU_t *f1apDuCfg
1569 * @return ROK - void
1571 * ****************************************************************/
1572 void freeTddNrFreqInfo(NRFreqInfo_t *freqInfo)
1574 uint8_t freqBandListIdx = 0, supportedBandIdx = 0;
1576 if(freqInfo->freqBandListNr.list.array)
1578 for(freqBandListIdx = 0; freqBandListIdx<freqInfo->freqBandListNr.list.count; freqBandListIdx++)
1580 if(freqInfo->freqBandListNr.list.array[freqBandListIdx])
1582 if(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array)
1584 for(supportedBandIdx = 0; supportedBandIdx<freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count; supportedBandIdx++)
1586 DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx],\
1587 sizeof(SupportedSULFreqBandItem_t));
1589 DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array,\
1590 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size);
1593 DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx], sizeof(FreqBandNrItem_t ));
1596 DU_FREE(freqInfo->freqBandListNr.list.array, freqInfo->freqBandListNr.list.size );
1600 /*******************************************************************
1602 * @brief Deallocating memory allocated for Nr fdd frequencey mode
1606 * Function : freeFddNrFreqInfo
1608 * Functionality:Free memory allocated for Nr fdd frequencey mode
1612 * @return ROK - void
1614 * ****************************************************************/
1615 void freeFddNrFreqInfo(FDD_Info_t *fDD)
1621 if(fDD->uL_NRFreqInfo.freqBandListNr.list.array != NULLP)
1623 DU_FREE(fDD->uL_NRFreqInfo.freqBandListNr.list.\
1624 array[arrIdx], sizeof(FreqBandNrItem_t));
1625 DU_FREE(fDD->uL_NRFreqInfo.freqBandListNr.list.array, \
1626 fDD->uL_NRFreqInfo.freqBandListNr.list.size);
1629 if(fDD->dL_NRFreqInfo.freqBandListNr.list.array != NULLP)
1631 DU_FREE(fDD->dL_NRFreqInfo.freqBandListNr.list.\
1632 array[arrIdx], sizeof(FreqBandNrItem_t));
1633 DU_FREE(fDD->dL_NRFreqInfo.freqBandListNr.list.array,\
1634 fDD->dL_NRFreqInfo.freqBandListNr.list.size);
1636 DU_FREE(fDD,sizeof(FDD_Info_t));
1640 /*******************************************************************
1642 * @brief deallocating the memory of function BuildAndSendF1SetupReq()
1646 * Function : FreeServedCellList
1648 * Functionality: deallocating the memory of function BuildServedCellList
1651 * @params[in] GNB_DU_Served_Cells_List_t *duServedCell
1655 * ****************************************************************/
1656 void FreeServedCellList( GNB_DU_Served_Cells_List_t *duServedCell)
1658 uint8_t plmnCnt=MAX_PLMN;
1659 uint8_t extensionCnt=IE_EXTENSION_LIST_COUNT;
1660 uint8_t plmnIdx=0, sliceIdx=0;
1661 GNB_DU_Served_Cells_Item_t *srvCellItem;
1662 ServedPLMNs_Item_t *servedPlmnItem;
1663 SliceSupportItem_t *sliceSupportItem;
1665 if(duServedCell->list.array!=NULLP)
1667 if(duServedCell->list.array[0]!=NULLP)
1669 srvCellItem= &duServedCell->list.array[0]->value.choice.GNB_DU_Served_Cells_Item;
1671 DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\
1672 srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * sizeof(uint8_t));
1673 DU_FREE(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\
1674 srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.size * sizeof(uint8_t));
1676 if(srvCellItem->served_Cell_Information.fiveGS_TAC!=NULLP)
1678 DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC->buf,\
1679 sizeof(srvCellItem->served_Cell_Information.fiveGS_TAC->size));
1680 DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC,sizeof(FiveGS_TAC_t));
1683 if(srvCellItem->served_Cell_Information.servedPLMNs.list.array!=NULLP)
1685 if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx] != NULLP)
1687 servedPlmnItem = srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx];
1688 DU_FREE(servedPlmnItem->pLMN_Identity.buf, servedPlmnItem->pLMN_Identity.size);
1690 if(servedPlmnItem->iE_Extensions != NULLP)
1692 if(servedPlmnItem->iE_Extensions->list.array != NULLP)
1694 if(servedPlmnItem->iE_Extensions->list.array[0] != NULLP)
1696 if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
1697 SliceSupportList.list.array != NULLP)
1699 for(sliceIdx =0; sliceIdx<servedPlmnItem->iE_Extensions->list.array[0]->\
1700 extensionValue.choice.SliceSupportList.list.count; sliceIdx++)
1702 if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
1703 SliceSupportList.list.array[sliceIdx] != NULLP)
1705 sliceSupportItem = servedPlmnItem->iE_Extensions->list.array[0]->\
1706 extensionValue.choice.SliceSupportList.list.array[sliceIdx];
1708 DU_FREE(sliceSupportItem->sNSSAI.sST.buf, sizeof(uint8_t));
1710 if(sliceSupportItem->sNSSAI.sD != NULLP)
1712 DU_FREE(sliceSupportItem->sNSSAI.sD->buf,\
1713 sliceSupportItem->sNSSAI.sD->size);
1714 DU_FREE(sliceSupportItem->sNSSAI.sD, sizeof(OCTET_STRING_t));
1717 DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.\
1718 choice.SliceSupportList.list.array[sliceIdx], sizeof(SliceSupportItem_t));
1721 DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
1722 SliceSupportList.list.array, servedPlmnItem->iE_Extensions->list.array[0]->\
1723 extensionValue.choice.SliceSupportList.list.size);
1725 DU_FREE(servedPlmnItem->iE_Extensions->list.array[0],\
1726 sizeof(ServedPLMNs_ItemExtIEs_t));
1728 DU_FREE(servedPlmnItem->iE_Extensions->list.array,\
1729 extensionCnt*sizeof(ServedPLMNs_ItemExtIEs_t*));
1731 DU_FREE(servedPlmnItem->iE_Extensions, sizeof(ProtocolExtensionContainer_4624P3_t));
1733 DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx],\
1734 sizeof(ServedPLMNs_Item_t));
1736 DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array,\
1737 sizeof(ServedPLMNs_Item_t *));
1740 if(srvCellItem->served_Cell_Information.nR_Mode_Info.present == NR_Mode_Info_PR_fDD)
1742 freeFddNrFreqInfo(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD);
1746 if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD != NULLP)
1748 freeTddNrFreqInfo(&srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD->nRFreqInfo);
1749 DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
1753 DU_FREE(srvCellItem->served_Cell_Information.measurementTimingConfiguration.buf,\
1754 srvCellItem->served_Cell_Information.measurementTimingConfiguration.size);
1756 if(srvCellItem->gNB_DU_System_Information != NULLP)
1758 if(srvCellItem->gNB_DU_System_Information->mIB_message.buf != NULLP)
1760 DU_FREE(srvCellItem->gNB_DU_System_Information->mIB_message.buf,\
1761 srvCellItem->gNB_DU_System_Information->mIB_message.size);
1764 if(srvCellItem->gNB_DU_System_Information->sIB1_message.buf != NULLP)
1766 DU_FREE(srvCellItem->gNB_DU_System_Information->sIB1_message.buf,\
1767 srvCellItem->gNB_DU_System_Information->sIB1_message.size);
1770 DU_FREE(srvCellItem->gNB_DU_System_Information, sizeof(GNB_DU_System_Information_t));
1773 DU_FREE(duServedCell->list.array[0], sizeof(GNB_DU_Served_Cells_ItemIEs_t));
1775 DU_FREE(duServedCell->list.array, plmnCnt * sizeof(GNB_DU_Served_Cells_ItemIEs_t*));
1779 /*******************************************************************
1781 * @brief deallocating the memory of function BuildAndSendF1SetupReq()
1785 * Function : FreeF1SetupReq
1787 * Functionality: deallocating the memory of function BuildAndSendF1SetupReq
1789 * @params[in] F1AP_PDU_t *f1apMsg
1793 * ****************************************************************/
1794 void FreeF1SetupReq(F1AP_PDU_t *f1apMsg)
1796 uint8_t ieIdx, ieIdx2;
1797 F1SetupRequest_t *f1SetupReq=NULLP;
1799 if(f1apMsg != NULLP)
1801 if(f1apMsg->choice.initiatingMessage != NULLP)
1803 f1SetupReq = &f1apMsg->choice.initiatingMessage->value.choice.F1SetupRequest;
1804 if(f1SetupReq->protocolIEs.list.array != NULLP)
1806 for(ieIdx = 0; ieIdx < f1SetupReq->protocolIEs.list.count; ieIdx++)
1808 if(f1SetupReq->protocolIEs.list.array[ieIdx] != NULLP)
1810 switch(f1SetupReq->protocolIEs.list.array[ieIdx]->id)
1812 case ProtocolIE_ID_id_TransactionID:
1814 case ProtocolIE_ID_id_gNB_DU_ID:
1815 DU_FREE(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
1816 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
1818 case ProtocolIE_ID_id_gNB_DU_Name:
1819 DU_FREE(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.buf,\
1820 strlen((char *)duCfgParam.duName));
1822 case ProtocolIE_ID_id_gNB_DU_Served_Cells_List:
1823 FreeServedCellList(&f1SetupReq->protocolIEs.list.\
1824 array[ieIdx]->value.choice.GNB_DU_Served_Cells_List);
1826 case ProtocolIE_ID_id_GNB_DU_RRC_Version:
1827 FreeRrcVer(&f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version);
1830 DU_LOG("\nERROR --> Invalid Event Type %ld", f1SetupReq->protocolIEs.list.array[ieIdx]->id);
1835 for(ieIdx2=0; ieIdx2< ieIdx; ieIdx2++)
1837 DU_FREE(f1SetupReq->protocolIEs.list.array[ieIdx2],sizeof(F1SetupRequestIEs_t));
1839 DU_FREE(f1SetupReq->protocolIEs.list.array,\
1840 f1SetupReq->protocolIEs.list.size);
1842 DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
1844 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
1847 /*******************************************************************
1849 * @brief Builds and Send the F1SetupRequest
1853 * Function : BuildAndSendF1SetupReq
1855 * Functionality:Fills the F1SetupRequest
1857 * @return ROK - success
1860 ******************************************************************/
1861 uint8_t BuildAndSendF1SetupReq()
1863 uint8_t ret, ieIdx, elementCnt;
1864 F1AP_PDU_t *f1apMsg = NULLP;
1865 F1SetupRequest_t *f1SetupReq=NULLP;
1866 GNB_DU_Served_Cells_List_t *duServedCell=NULLP;
1867 RRC_Version_t *rrcVer=NULLP;
1868 asn_enc_rval_t encRetVal; /* Encoder return value */
1871 DU_LOG("\nINFO --> F1AP : Building F1 Setup Request\n");
1874 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
1875 if(f1apMsg == NULLP)
1879 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
1880 DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
1881 if(f1apMsg->choice.initiatingMessage == NULLP)
1885 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_F1Setup;
1886 f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
1887 f1apMsg->choice.initiatingMessage->value.present = \
1888 InitiatingMessage__value_PR_F1SetupRequest;
1890 f1SetupReq = &f1apMsg->choice.initiatingMessage->value.choice.F1SetupRequest;
1892 elementCnt = (duCfgParam.duName != NULL) ? 5 : 4;
1894 f1SetupReq->protocolIEs.list.count = elementCnt;
1895 f1SetupReq->protocolIEs.list.size = elementCnt * sizeof(F1SetupRequestIEs_t );
1897 /* Initialize the F1Setup members */
1898 DU_ALLOC(f1SetupReq->protocolIEs.list.array,f1SetupReq->protocolIEs.list.size);
1899 if(f1SetupReq->protocolIEs.list.array == NULLP)
1903 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
1905 DU_ALLOC(f1SetupReq->protocolIEs.list.array[ieIdx],\
1906 sizeof(F1SetupRequestIEs_t));
1907 if(f1SetupReq->protocolIEs.list.array[ieIdx] == NULLP)
1915 f1SetupReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_TransactionID;
1916 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1917 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present =\
1918 F1SetupRequestIEs__value_PR_TransactionID;
1919 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = \
1924 f1SetupReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_ID;
1925 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1926 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = \
1927 F1SetupRequestIEs__value_PR_GNB_DU_ID;
1928 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size =\
1931 DU_ALLOC(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
1932 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
1933 if(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf == \
1939 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf[0] =\
1943 if(duCfgParam.duName != NULL)
1946 f1SetupReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_Name;
1947 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
1948 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = F1SetupRequestIEs__value_PR_GNB_DU_Name;
1949 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.size =\
1950 strlen((char *)duCfgParam.duName);
1951 DU_ALLOC(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.\
1952 GNB_DU_Name.buf, strlen((char *)duCfgParam.duName));
1953 if(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.\
1958 strcpy((char*)f1SetupReq->protocolIEs.list.array[ieIdx]->value.\
1959 choice.GNB_DU_Name.buf,
1960 (char*)&duCfgParam.duName);
1964 /*Served Cell list */
1966 f1SetupReq->protocolIEs.list.array[ieIdx]->id = \
1967 ProtocolIE_ID_id_gNB_DU_Served_Cells_List;
1968 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1969 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = \
1970 F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List;
1971 duServedCell = &f1SetupReq->protocolIEs.list.\
1972 array[ieIdx]->value.choice.GNB_DU_Served_Cells_List;
1973 if(BuildServedCellList(duServedCell))
1979 f1SetupReq->protocolIEs.list.array[ieIdx]->id = \
1980 ProtocolIE_ID_id_GNB_DU_RRC_Version ;
1981 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1982 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = \
1983 F1SetupRequestIEs__value_PR_RRC_Version;
1984 rrcVer = &f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version;
1985 if(BuildRrcVer(rrcVer))
1989 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
1991 /* Encode the F1SetupRequest type as APER */
1992 memset(encBuf, 0, ENC_BUF_MAX_LEN);
1994 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
1997 /* Encode results */
1998 if(encRetVal.encoded == ENCODE_FAIL)
2000 DU_LOG("\nERROR --> F1AP : Could not encode F1SetupRequest structure (at %s)\n",\
2001 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
2006 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for F1SetupRequest\n");
2007 for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
2009 printf("%x",encBuf[ieIdx]);
2014 if(sendF1APMsg() != ROK)
2016 DU_LOG("\nERROR --> F1AP : Sending F1 Setup request failed");
2024 FreeF1SetupReq(f1apMsg);
2027 }/* End of BuildAndSendF1SetupReq */
2029 /*******************************************************************
2031 * @brief Deallocating memory allocated for Served_Cells_To_Modify_Item_t
2035 * Function : freeCellsToModifyItem
2037 * Functionality: Deallocating memory of variables allocated in
2038 * BuildAndSendDUConfigUpdate function
2040 * @params[in] Served_Cells_To_Modify_Item_t *modifyItem
2042 * @return ROK - void
2044 * ****************************************************************/
2046 void freeCellsToModifyItem(Served_Cells_To_Modify_Item_t *modifyItem)
2048 uint8_t arrIdx=0, servedPlmnIdx=0, sliceLstIdx=0;
2049 ServedPLMNs_Item_t *servedPlmnItem = NULLP;
2050 SliceSupportItem_t *sliceSupportItem = NULLP;
2052 DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf, modifyItem->oldNRCGI.pLMN_Identity.size);
2053 DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf, modifyItem->oldNRCGI.nRCellIdentity.size);
2055 DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\
2056 modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.size);
2057 DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\
2058 modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.size);
2060 if(modifyItem->served_Cell_Information.servedPLMNs.list.array != NULLP)
2062 if(modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx] != NULLP)
2064 servedPlmnItem = modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx];
2066 DU_FREE(servedPlmnItem->pLMN_Identity.buf,servedPlmnItem->pLMN_Identity.size);
2068 if(servedPlmnItem->iE_Extensions != NULLP)
2070 if(servedPlmnItem->iE_Extensions->list.array != NULLP)
2072 if(servedPlmnItem->iE_Extensions->list.array[arrIdx] != NULLP)
2074 if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
2075 list.array != NULLP)
2077 for(sliceLstIdx =0; sliceLstIdx<servedPlmnItem->iE_Extensions->list.array[arrIdx]->\
2078 extensionValue.choice.SliceSupportList.list.count; sliceLstIdx++)
2080 if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
2081 list.array[sliceLstIdx] != NULLP)
2084 sliceSupportItem = servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.\
2085 SliceSupportList.list.array[sliceLstIdx];
2087 DU_FREE(sliceSupportItem->sNSSAI.sST.buf, sliceSupportItem->sNSSAI.sST.size);
2088 if(sliceSupportItem->sNSSAI.sD != NULLP)
2090 DU_FREE(sliceSupportItem->sNSSAI.sD->buf, sliceSupportItem->sNSSAI.sD->size);
2091 DU_FREE(sliceSupportItem->sNSSAI.sD,sizeof(OCTET_STRING_t));
2093 DU_FREE(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.\
2094 SliceSupportList.list.array[sliceLstIdx], sizeof(SliceSupportItem_t));
2097 DU_FREE(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.\
2098 choice.SliceSupportList.list.array,\
2099 servedPlmnItem->iE_Extensions->list.array[arrIdx]->\
2100 extensionValue.choice.SliceSupportList.list.size);
2103 for(servedPlmnIdx=0; servedPlmnIdx< servedPlmnItem->iE_Extensions->list.count ; servedPlmnIdx++)
2105 DU_FREE(servedPlmnItem->iE_Extensions->list.array[servedPlmnIdx], sizeof(ServedPLMNs_ItemExtIEs_t ));
2107 DU_FREE(servedPlmnItem->iE_Extensions->list.array, servedPlmnItem->iE_Extensions->list.size);
2109 DU_FREE(servedPlmnItem->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t));
2112 for(servedPlmnIdx=0; servedPlmnIdx<modifyItem->served_Cell_Information.servedPLMNs.list.count; servedPlmnIdx++)
2114 DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[servedPlmnIdx], sizeof(ServedPLMNs_Item_t));
2116 DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\
2117 modifyItem->served_Cell_Information.servedPLMNs.list.size);
2120 if(modifyItem->served_Cell_Information.nR_Mode_Info.present == NR_Mode_Info_PR_fDD)
2122 freeFddNrFreqInfo(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD);
2126 if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD)
2128 freeTddNrFreqInfo(&modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD->nRFreqInfo);
2129 DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
2132 DU_FREE(modifyItem->served_Cell_Information.measurementTimingConfiguration.buf,\
2133 modifyItem->served_Cell_Information.measurementTimingConfiguration.size);
2136 /*******************************************************************
2138 * @brief Deallocating memory of BuildAndSendDUConfigUpdate
2142 * Function : FreeDUConfigUpdate
2144 * Functionality: Deallocating memory of variables allocated in
2145 * BuildAndSendDUConfigUpdate function
2147 * @params[in] F1AP_PDU_t *f1apDuCfg
2149 * @return ROK - void
2151 * ****************************************************************/
2152 void FreeDUConfigUpdate(F1AP_PDU_t *f1apDuCfg)
2154 uint8_t ieIdx=0, cellModifyIdx=0, cellDeleteIdx=0;
2155 GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP;
2156 Served_Cells_To_Modify_List_t *cellsToModify=NULLP;
2157 Served_Cells_To_Delete_List_t *cellsToDelete=NULLP;
2158 Served_Cells_To_Delete_Item_t *deleteItem = NULLP;
2159 Served_Cells_To_Delete_ItemIEs_t *deleteItemIe = NULLP;
2161 if(f1apDuCfg != NULLP)
2163 if(f1apDuCfg->choice.initiatingMessage != NULLP)
2165 duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->\
2166 value.choice.GNBDUConfigurationUpdate;
2167 if(duCfgUpdate->protocolIEs.list.array != NULLP)
2169 for(ieIdx=0; ieIdx<duCfgUpdate->protocolIEs.list.count; ieIdx++)
2171 if(duCfgUpdate->protocolIEs.list.array[ieIdx] != NULLP)
2173 switch(duCfgUpdate->protocolIEs.list.array[ieIdx]->id)
2175 case ProtocolIE_ID_id_Served_Cells_To_Modify_List:
2177 cellsToModify = &duCfgUpdate->protocolIEs.list.array[ieIdx]->\
2178 value.choice.Served_Cells_To_Modify_List;
2179 if(cellsToModify->list.array != NULLP)
2181 for(cellModifyIdx=0; cellModifyIdx<cellsToModify->list.count ;cellModifyIdx++)
2183 if(cellsToModify->list.array[cellModifyIdx] != NULLP)
2185 freeCellsToModifyItem(&cellsToModify->list.array[cellModifyIdx]->value.choice.\
2186 Served_Cells_To_Modify_Item);
2187 DU_FREE(cellsToModify->list.array[cellModifyIdx],\
2188 sizeof(Served_Cells_To_Modify_ItemIEs_t));
2191 DU_FREE(cellsToModify->list.array,cellsToModify->list.size);
2195 case ProtocolIE_ID_id_Served_Cells_To_Delete_List:
2197 cellsToDelete = &duCfgUpdate->protocolIEs.list.array[ieIdx]->\
2198 value.choice.Served_Cells_To_Delete_List;
2199 if(cellsToDelete->list.array != NULLP)
2201 for(cellDeleteIdx=0; cellDeleteIdx<cellsToDelete->list.count ;cellDeleteIdx++)
2203 if(cellsToDelete->list.array[cellDeleteIdx] != NULLP)
2205 deleteItemIe = ((Served_Cells_To_Delete_ItemIEs_t*)\
2206 cellsToDelete->list.array[cellDeleteIdx]);
2207 deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
2208 DU_FREE(deleteItem->oldNRCGI.pLMN_Identity.buf,\
2209 deleteItem->oldNRCGI.pLMN_Identity.size);
2210 DU_FREE(deleteItem->oldNRCGI.nRCellIdentity.buf,\
2211 deleteItem->oldNRCGI.nRCellIdentity.size);
2212 DU_FREE(cellsToDelete->list.array[cellDeleteIdx],\
2213 sizeof(Served_Cells_To_Delete_ItemIEs_t));
2216 DU_FREE(cellsToDelete->list.array,cellsToDelete->list.size);
2221 case ProtocolIE_ID_id_gNB_DU_ID:
2223 DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
2224 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
2228 DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx],\
2229 sizeof(GNBDUConfigurationUpdateIEs_t));
2232 DU_FREE(duCfgUpdate->protocolIEs.list.array,duCfgUpdate->protocolIEs.list.size);
2234 DU_FREE(f1apDuCfg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
2236 DU_FREE(f1apDuCfg, (Size)sizeof(F1AP_PDU_t));
2240 /*******************************************************************
2242 * @brief Fills Served Plmns required in ServCellInfo IE
2246 * Function : fillServedPlmns
2248 * Functionality: Fills Served Plmns required in ServCellInfo IE
2250 * @params[in] Pointer to ServedPLMNs_List_t *
2252 * @return ROK - success
2255 *****************************************************************/
2257 uint8_t fillServedPlmns(ServedPLMNs_List_t *servedPlmn)
2259 uint8_t ieIdx=0, arrayIdx=0, ieListCnt=0, elementCnt=0, sliceLstIdx=0;
2261 servedPlmn->list.array[arrayIdx]->pLMN_Identity.size = 3*sizeof(uint8_t);
2262 DU_ALLOC(servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf, servedPlmn->list.\
2263 array[arrayIdx]->pLMN_Identity.size);
2264 if(servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf == NULLP)
2266 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2269 buildPlmnId(duCfgParam.srvdCellLst[arrayIdx].duCellInfo.cellInfo.srvdPlmn[arrayIdx].plmn,\
2270 servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf);
2271 DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t));
2272 if(servedPlmn->list.array[arrayIdx]->iE_Extensions == NULLP)
2274 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2279 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.count = ieListCnt;
2280 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.size = ieListCnt *sizeof(ServedPLMNs_ItemExtIEs_t *);
2281 DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array,servedPlmn->list.array[arrayIdx]->\
2282 iE_Extensions->list.size);
2283 if(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array == NULLP)
2285 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2288 for(ieIdx=arrayIdx;ieIdx<ieListCnt;ieIdx++)
2290 DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx],\
2291 sizeof(ServedPLMNs_ItemExtIEs_t));
2292 if(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx] == NULLP)
2294 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2300 elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices;
2301 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->id =ProtocolIE_ID_id_TAISliceSupportList;
2302 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->criticality = Criticality_ignore;
2303 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.present = \
2304 ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList;
2305 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2306 list.count = elementCnt;
2307 servedPlmn->list.array[arrayIdx]->\
2308 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2309 list.size = elementCnt * sizeof(SliceSupportItem_t *);
2310 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2311 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2312 list.array,servedPlmn->list.array[arrayIdx]->\
2313 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.list.size);
2314 if(servedPlmn->list.array[arrayIdx]->\
2315 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2316 list.array == NULLP)
2318 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2322 for(sliceLstIdx =0; sliceLstIdx< elementCnt; sliceLstIdx++)
2324 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2325 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2326 list.array[sliceLstIdx],sizeof( SliceSupportItem_t));
2327 if(servedPlmn->list.array[arrayIdx]->\
2328 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2329 list.array[sliceLstIdx] == NULLP)
2331 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2335 servedPlmn->list.array[arrayIdx]->\
2336 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2337 list.array[sliceLstIdx]->sNSSAI.sST.size = sizeof(uint8_t);
2338 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2339 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2340 list.array[sliceLstIdx]->sNSSAI.sST.buf,servedPlmn->list.array[arrayIdx]->\
2341 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.list.array[sliceLstIdx]->\
2344 if(servedPlmn->list.array[arrayIdx]->\
2345 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2346 list.array[sliceLstIdx]->sNSSAI.sST.buf == NULLP)
2348 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2351 servedPlmn->list.array[arrayIdx]->\
2352 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2353 list.array[sliceLstIdx]->sNSSAI.sST.buf[arrayIdx] = duCfgParam.srvdCellLst[arrayIdx].duCellInfo.\
2354 cellInfo.srvdPlmn[arrayIdx].taiSliceSuppLst.snssai[sliceLstIdx]->sst;
2356 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2357 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2358 list.array[sliceLstIdx]->sNSSAI.sD,sizeof(OCTET_STRING_t));
2359 if(servedPlmn->list.array[arrayIdx]->\
2360 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2361 list.array[sliceLstIdx]->sNSSAI.sD == NULLP)
2363 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2366 servedPlmn->list.array[arrayIdx]->\
2367 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2368 list.array[sliceLstIdx]->sNSSAI.sD->size = 3 * sizeof(uint8_t);
2369 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2370 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2371 list.array[sliceLstIdx]->sNSSAI.sD->buf,servedPlmn->list.array[arrayIdx]->\
2372 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2373 list.array[sliceLstIdx]->sNSSAI.sD->size);
2374 if(servedPlmn->list.array[arrayIdx]->\
2375 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2376 list.array[sliceLstIdx]->sNSSAI.sD->buf == NULLP)
2378 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2381 memcpy(servedPlmn->list.array[arrayIdx]->\
2382 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2383 list.array[sliceLstIdx]->sNSSAI.sD->buf, duCfgParam.srvdCellLst[arrayIdx].duCellInfo.\
2384 cellInfo.srvdPlmn[arrayIdx].taiSliceSuppLst.snssai[sliceLstIdx]->sd,\
2385 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2386 list.array[sliceLstIdx]->sNSSAI.sD->size);
2391 /*******************************************************************
2393 * @brief Fills Nr Fdd Info required in ServCellInfo IE
2397 * Function : fillNrFddInfo
2399 * Functionality: Fills Nr Fdd Info required in ServCellInfo IE
2401 * @params[in] FDD_Info_t *fDD
2403 * @return ROK - success
2406 *****************************************************************/
2408 uint8_t fillNrFddInfo(FDD_Info_t *fDD)
2410 fDD->uL_NRFreqInfo.nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.\
2411 f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn;
2412 fDD->uL_NRFreqInfo.freqBandListNr.list.count = 1;
2413 fDD->uL_NRFreqInfo.freqBandListNr.list.size = sizeof(FreqBandNrItem_t*);
2414 DU_ALLOC(fDD->uL_NRFreqInfo.freqBandListNr.list.\
2415 array, fDD->uL_NRFreqInfo.freqBandListNr.list.size);
2416 if(fDD->uL_NRFreqInfo.freqBandListNr.list.array == NULLP)
2418 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
2422 DU_ALLOC(fDD->uL_NRFreqInfo.freqBandListNr.list.array[0], \
2423 sizeof(FreqBandNrItem_t));
2424 if(fDD->uL_NRFreqInfo.freqBandListNr.list.array[0] == NULLP)
2426 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
2430 fDD->uL_NRFreqInfo.freqBandListNr.list.array[0]->freqBandIndicatorNr = \
2431 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.\
2432 freqBand[0].nrFreqBand;
2433 fDD->uL_NRFreqInfo.freqBandListNr.list.array[0]->supportedSULBandList.list.count=0;
2434 fDD->dL_NRFreqInfo.nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.\
2435 dlNrFreqInfo.nrArfcn;
2436 fDD->dL_NRFreqInfo.freqBandListNr.list.count = 1;
2437 fDD->dL_NRFreqInfo.freqBandListNr.list.size = sizeof(FreqBandNrItem_t *);
2438 DU_ALLOC(fDD->dL_NRFreqInfo.freqBandListNr.list.array, fDD->dL_NRFreqInfo.freqBandListNr.list.size);
2439 if(fDD->dL_NRFreqInfo.freqBandListNr.list.array == NULLP)
2441 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
2445 DU_ALLOC(fDD->dL_NRFreqInfo.freqBandListNr.list.array[0], sizeof(FreqBandNrItem_t));
2446 if(fDD->dL_NRFreqInfo.freqBandListNr.list.array[0] == NULLP)
2448 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
2452 fDD->dL_NRFreqInfo.freqBandListNr.list.array[0]->freqBandIndicatorNr = \
2453 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.\
2454 freqBand[0].nrFreqBand;
2455 fDD->dL_NRFreqInfo.freqBandListNr.list.array[0]->supportedSULBandList.list.count=0;
2457 /*Transmission Bandwidth*/
2458 fDD->uL_Transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.\
2459 f1Mode.mode.fdd.ulTxBw.nrScs;
2460 fDD->uL_Transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.\
2461 f1Mode.mode.fdd.ulTxBw.nrb;
2462 fDD->dL_Transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.\
2463 f1Mode.mode.fdd.dlTxBw.nrScs;
2464 fDD->dL_Transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.\
2465 f1Mode.mode.fdd.dlTxBw.nrb;
2470 /*******************************************************************
2472 * @brief Fills ServCellInfo IE
2476 * Function : fillServedCellInfo
2478 * Functionality: Fills ServCellInfo
2480 * @params[in] Pointer to Served_Cell_Information_t *
2482 * @return ROK - success
2485 *****************************************************************/
2487 uint8_t fillServedCellInfo(Served_Cell_Information_t *srvCellInfo)
2489 uint8_t ieIdx, ieListCnt;
2492 srvCellInfo->nRCGI.pLMN_Identity.size =3*sizeof(uint8_t);
2493 DU_ALLOC(srvCellInfo->nRCGI.pLMN_Identity.buf,\
2494 srvCellInfo->nRCGI.pLMN_Identity.size);
2495 if(srvCellInfo->nRCGI.pLMN_Identity.buf == NULLP)
2497 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2500 buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
2501 srvCellInfo->nRCGI.pLMN_Identity.buf);
2502 srvCellInfo->nRCGI.nRCellIdentity.size =5*sizeof(uint8_t);
2503 DU_ALLOC(srvCellInfo->nRCGI.nRCellIdentity.buf,\
2504 srvCellInfo->nRCGI.nRCellIdentity.size);
2505 if(srvCellInfo->nRCGI.nRCellIdentity.buf == NULLP)
2507 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2511 fillBitString(&srvCellInfo->nRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
2513 srvCellInfo->nRPCI = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrPci;
2517 srvCellInfo->servedPLMNs.list.count = ieListCnt;
2518 srvCellInfo->servedPLMNs.list.size = ieListCnt*sizeof(ServedPLMNs_Item_t *);
2519 DU_ALLOC(srvCellInfo->servedPLMNs.list.array, srvCellInfo->servedPLMNs.list.size);
2520 if(srvCellInfo->servedPLMNs.list.array == NULLP)
2522 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2525 for(ieIdx=0; ieIdx < ieListCnt; ieIdx++)
2527 DU_ALLOC(srvCellInfo->servedPLMNs.list.array[ieIdx], sizeof(ServedPLMNs_Item_t));
2528 if(srvCellInfo->servedPLMNs.list.array[ieIdx]== NULLP)
2530 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2534 if(fillServedPlmns(&srvCellInfo->servedPLMNs))
2536 DU_LOG("\nERROR --> Failed to fill Served Plmn info");
2541 /*nR Mode Info with FDD*/
2542 srvCellInfo->nR_Mode_Info.present = NR_Mode_Info_PR_fDD;
2543 DU_ALLOC(srvCellInfo->nR_Mode_Info.choice.fDD, sizeof(FDD_Info_t));
2544 if(srvCellInfo->nR_Mode_Info.choice.fDD == NULLP)
2546 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2549 if(fillNrFddInfo(srvCellInfo->nR_Mode_Info.choice.fDD))
2551 DU_LOG("\nERROR --> Failed to fill the Nr FDD information");
2555 srvCellInfo->nR_Mode_Info.present = NR_Mode_Info_PR_tDD;
2556 DU_ALLOC(srvCellInfo->nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
2557 if(srvCellInfo->nR_Mode_Info.choice.tDD == NULLP)
2559 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2562 if(fillNrTddInfo(srvCellInfo->nR_Mode_Info.choice.tDD) != ROK)
2564 DU_LOG("\nERROR --> Failed to fill the Nr TDD information");
2569 /*Measurement timing Config*/
2570 srvCellInfo->measurementTimingConfiguration.size = sizeof(uint8_t);
2571 DU_ALLOC(srvCellInfo->measurementTimingConfiguration.\
2572 buf,srvCellInfo->measurementTimingConfiguration.size);
2573 if(srvCellInfo->measurementTimingConfiguration.buf == NULLP)
2577 srvCellInfo->measurementTimingConfiguration.\
2578 buf[0] = duCfgParam.srvdCellLst[0].duCellInfo.measTimeCfg;
2583 /*******************************************************************
2585 * @brief Fills ServCellToModItem IE
2589 * Function : fillServCellToModItem
2591 * Functionality: Fills ServCellToModItem IE
2593 * @params[in] Pointer to Served_Cells_To_Modify_Item_t *
2595 * @return ROK - success
2598 *****************************************************************/
2600 uint8_t fillServCellToModItem(Served_Cells_To_Modify_Item_t *modifyItem)
2603 modifyItem->oldNRCGI.pLMN_Identity.size = 3*sizeof(uint8_t);
2604 DU_ALLOC(modifyItem->oldNRCGI.pLMN_Identity.buf,modifyItem->oldNRCGI.pLMN_Identity.size);
2605 if(modifyItem->oldNRCGI.pLMN_Identity.buf == NULLP)
2609 buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
2610 modifyItem->oldNRCGI.pLMN_Identity.buf);
2613 modifyItem->oldNRCGI.nRCellIdentity.size = 5*sizeof(uint8_t);
2614 DU_ALLOC(modifyItem->oldNRCGI.nRCellIdentity.buf,\
2615 modifyItem->oldNRCGI.nRCellIdentity.size);
2616 if(modifyItem->oldNRCGI.nRCellIdentity.buf == NULLP)
2620 fillBitString(&modifyItem->oldNRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
2622 if(fillServedCellInfo(&modifyItem->served_Cell_Information))
2628 /*******************************************************************
2630 * @brief Builds ServCellToModList
2634 * Function : buildServCellToModList
2636 * Functionality: Builds the serv cell to Mod List
2638 * @params[in] Pointer to Served_Cells_To_Modify_List_t *
2640 * @return ROK - success
2643 *****************************************************************/
2645 uint8_t buildServCellToModList(Served_Cells_To_Modify_List_t *cellsToModify)
2647 uint8_t ieListCnt, ieIdx;
2648 Served_Cells_To_Modify_Item_t *modifyItem = NULLP;
2651 cellsToModify->list.count = ieListCnt;
2652 cellsToModify->list.size = ieListCnt*sizeof(Served_Cells_To_Modify_ItemIEs_t *);
2653 DU_ALLOC(cellsToModify->list.array,cellsToModify->list.size);
2654 if(cellsToModify->list.array == NULLP)
2658 for(ieIdx=0; ieIdx< ieListCnt; ieIdx++)
2660 DU_ALLOC(cellsToModify->list.array[ieIdx],sizeof(Served_Cells_To_Modify_ItemIEs_t));
2661 if(cellsToModify->list.array[ieIdx] == NULLP)
2666 cellsToModify->list.array[0]->id = ProtocolIE_ID_id_Served_Cells_To_Modify_Item;
2667 cellsToModify->list.array[0]->criticality = Criticality_reject;
2668 cellsToModify->list.array[0]->value.present =\
2669 Served_Cells_To_Modify_ItemIEs__value_PR_Served_Cells_To_Modify_Item;
2670 modifyItem=&cellsToModify->list.array[0]->value.choice.Served_Cells_To_Modify_Item;
2672 if(fillServCellToModItem(modifyItem))
2677 /*******************************************************************
2679 * @brief filling the DeleteItemList
2683 * Function : fillCellToDeleteItem
2685 * Functionality: Filling the DeleteItemIe
2687 * @params[in] Pointer to Served_Cells_To_Delete_ItemIEs_t
2689 * @return ROK - success
2692 *****************************************************************/
2693 uint8_t fillCellToDeleteItem(struct Served_Cells_To_Delete_ItemIEs *deleteItemIe)
2695 Served_Cells_To_Delete_Item_t *deleteItem=NULLP;
2697 deleteItemIe->id = ProtocolIE_ID_id_Served_Cells_To_Delete_Item;
2698 deleteItemIe->criticality = Criticality_reject;
2699 deleteItemIe->value.present =\
2700 Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item;
2701 deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
2704 deleteItem->oldNRCGI.pLMN_Identity.size = 3*sizeof(uint8_t);
2705 DU_ALLOC(deleteItem->oldNRCGI.pLMN_Identity.buf,deleteItem->oldNRCGI.pLMN_Identity.size);
2706 if(deleteItem->oldNRCGI.pLMN_Identity.buf == NULLP)
2708 DU_LOG("ERROR --> F1AP: fillCellToDeleteItem(): Failed to allocate the memory");
2711 buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
2712 deleteItem->oldNRCGI.pLMN_Identity.buf);
2715 deleteItem->oldNRCGI.nRCellIdentity.size = 5*sizeof(uint8_t);
2716 DU_ALLOC(deleteItem->oldNRCGI.nRCellIdentity.buf,\
2717 deleteItem->oldNRCGI.nRCellIdentity.size);
2718 if(deleteItem->oldNRCGI.nRCellIdentity.buf == NULLP)
2720 DU_LOG("ERROR --> F1AP: fillCellToDeleteItem(): Failed to allocate the memory");
2723 fillBitString(&deleteItem->oldNRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
2726 /*******************************************************************
2728 * @brief Builds ServCellToDeleteList
2732 * Function : buildServCellToDeleteList
2734 * Functionality: Builds the serv cell to delete List
2736 * @params[in] Pointer to Served_Cells_To_Delete_List_t *
2738 * @return ROK - success
2741 *****************************************************************/
2743 uint8_t buildServCellToDeleteList(Served_Cells_To_Delete_List_t *cellsToDelete)
2745 uint8_t ieListCnt, arrIdx;
2748 cellsToDelete->list.count = ieListCnt;
2749 cellsToDelete->list.size = ieListCnt*sizeof(Served_Cells_To_Delete_ItemIEs_t *);
2751 DU_ALLOC(cellsToDelete->list.array,cellsToDelete->list.size);
2752 if(cellsToDelete->list.array == NULLP)
2754 DU_LOG("\nERROR --> F1AP : buildServCellToDeleteList(): Memory allocation failed");
2758 for(arrIdx=0; arrIdx< ieListCnt; arrIdx++)
2760 DU_ALLOC(cellsToDelete->list.array[arrIdx],sizeof(Served_Cells_To_Delete_ItemIEs_t));
2761 if(cellsToDelete->list.array[arrIdx] == NULLP)
2763 DU_LOG("\nERROR --> F1AP : buildServCellToDeleteList(): Memory allocation failed");
2769 if(fillCellToDeleteItem((Served_Cells_To_Delete_ItemIEs_t*)cellsToDelete->list.array[arrIdx]) !=ROK)
2771 DU_LOG("\nERROR --> F1AP: buildServCellToDeleteList(): failed to fill Served_Cells_To_Delete_ItemIEs");
2777 /*******************************************************************
2779 * @brief Builds and sends the DUConfigUpdate
2783 * Function : BuildAndSendDUConfigUpdate
2785 * Functionality: Constructs the DU Update message and sends
2786 * it to the CU through SCTP.
2788 * @params[in] void **buf,Buffer to which encoded pattern is written into
2789 * @params[in] int *size,size of buffer
2791 * @return ROK - success
2794 * ****************************************************************/
2795 uint8_t BuildAndSendDUConfigUpdate(ServCellAction servCellAction)
2797 uint8_t ret =0, ieIdx=0, elementCnt=0;
2798 bool memAlloctionFailure = false;
2799 F1AP_PDU_t *f1apDuCfg = NULLP;
2800 GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP;
2801 asn_enc_rval_t encRetVal; /* Encoder return value */
2803 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
2808 DU_LOG("\nINFO --> F1AP : Building DU config update\n");
2809 /* Allocate the memory for F1DuCfg */
2810 DU_ALLOC(f1apDuCfg, sizeof(F1AP_PDU_t));
2811 if(f1apDuCfg == NULLP)
2813 DU_LOG("\nERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation for F1AP-PDU failed");
2817 f1apDuCfg->present = F1AP_PDU_PR_initiatingMessage;
2818 DU_ALLOC(f1apDuCfg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
2819 if(f1apDuCfg->choice.initiatingMessage == NULLP)
2821 DU_LOG("\nERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation for F1AP-PDU failed");
2825 f1apDuCfg->choice.initiatingMessage->procedureCode = \
2826 ProcedureCode_id_gNBDUConfigurationUpdate;
2827 f1apDuCfg->choice.initiatingMessage->criticality = Criticality_reject;
2828 f1apDuCfg->choice.initiatingMessage->value.present = \
2829 InitiatingMessage__value_PR_GNBDUConfigurationUpdate;
2830 duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->value.\
2831 choice.GNBDUConfigurationUpdate;
2833 duCfgUpdate->protocolIEs.list.count = elementCnt;
2834 duCfgUpdate->protocolIEs.list.size = \
2835 elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t*);
2837 /* Initialize the F1Setup members */
2838 DU_ALLOC(duCfgUpdate->protocolIEs.list.array,duCfgUpdate->protocolIEs.list.size);
2839 if(duCfgUpdate->protocolIEs.list.array == NULLP)
2841 DU_LOG("ERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation failed");
2844 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
2846 DU_ALLOC(duCfgUpdate->protocolIEs.list.array[ieIdx],sizeof(GNBDUConfigurationUpdateIEs_t));
2847 if(duCfgUpdate->protocolIEs.list.array[ieIdx] == NULLP)
2849 DU_LOG("ERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation failed");
2850 memAlloctionFailure = true;
2855 if(memAlloctionFailure == true)
2861 duCfgUpdate->protocolIEs.list.array[ieIdx]->id=ProtocolIE_ID_id_TransactionID;
2862 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
2863 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2864 GNBDUConfigurationUpdateIEs__value_PR_TransactionID;
2865 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = TRANS_ID;
2868 if(servCellAction == SERV_CELL_TO_MODIFY)
2870 /*Served Cell to Modify */
2871 duCfgUpdate->protocolIEs.list.array[ieIdx]->id = \
2872 ProtocolIE_ID_id_Served_Cells_To_Modify_List;
2873 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
2874 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2875 GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Modify_List;
2876 if(buildServCellToModList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
2877 Served_Cells_To_Modify_List))
2879 DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): failed to build ServCellToModList");
2885 /*Served Cell to Delete */
2886 duCfgUpdate->protocolIEs.list.array[ieIdx]->id = \
2887 ProtocolIE_ID_id_Served_Cells_To_Delete_List;
2888 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
2889 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2890 GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Delete_List;
2891 if(buildServCellToDeleteList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
2892 Served_Cells_To_Delete_List)!=ROK)
2894 DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): failed to build ServCellToDeleteList");
2899 // NOTE :GNB DU SYS INFO:MIB AND SIB1 INFORMATION TO BE BUILT AND FILLED HERE
2902 duCfgUpdate->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_ID;
2903 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
2904 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2905 GNBDUConfigurationUpdateIEs__value_PR_GNB_DU_ID;
2906 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size = sizeof(uint8_t);
2907 DU_ALLOC(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
2908 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
2909 if(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf == NULLP)
2911 DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): Memory allocation failed for GNB_DU_ID");
2914 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf[0] = duCfgParam.duId;
2916 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apDuCfg);
2918 /* Encode the DU Config Update type as APER */
2919 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
2921 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apDuCfg, PrepFinalEncBuf, encBuf);
2923 /* Checking encode results */
2924 if(encRetVal.encoded == ENCODE_FAIL)
2926 DU_LOG("ERROR --> F1AP : Could not encode DUConfigUpdate structure (at %s)\n",\
2927 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
2932 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for DUConfigUpdate\n");
2933 for(ieIdx =0; ieIdx < encBufSize; ieIdx++)
2935 printf("%x",encBuf[ieIdx]);
2939 if(sendF1APMsg() != ROK)
2941 DU_LOG("\nERROR --> F1AP : Sending GNB-DU Config Update failed");
2949 addToReservedF1apPduList(TRANS_ID,f1apDuCfg);
2954 /*******************************************************************
2956 * @brief free the ULRRCMessageTransfer
2960 * Function : FreeULRRCMessageTransfer
2962 * Functionality: Deallocating the memory of variable allocated in
2963 * FreeULRRCMessageTransfer
2967 * @return ROK - void
2969 ******************************************************************/
2970 void FreeULRRCMessageTransfer( F1AP_PDU_t *f1apMsg)
2973 ULRRCMessageTransfer_t *ulRRCMsg;
2975 if(f1apMsg != NULLP)
2977 if(f1apMsg->choice.initiatingMessage != NULLP)
2979 ulRRCMsg = &f1apMsg->choice.initiatingMessage->value.choice.ULRRCMessageTransfer;
2980 if(ulRRCMsg->protocolIEs.list.array != NULLP)
2982 for(idx1=0;idx1<ulRRCMsg->protocolIEs.list.count;idx1++)
2984 if(ulRRCMsg->protocolIEs.list.array[idx1] != NULLP)
2986 if(ulRRCMsg->protocolIEs.list.array[idx1]->value.present ==
2987 ULRRCMessageTransferIEs__value_PR_RRCContainer)
2989 DU_FREE(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf,
2990 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size);
2992 DU_FREE(ulRRCMsg->protocolIEs.list.array[idx1],sizeof(ULRRCMessageTransferIEs_t));
2995 DU_FREE(ulRRCMsg->protocolIEs.list.array,ulRRCMsg->protocolIEs.list.size );
2997 DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
2999 DU_FREE(f1apMsg,sizeof(F1AP_PDU_t));
3002 /*******************************************************************
3004 * @brief Builds and sends the ULRRCMessageTransfer
3008 * Function : BuildAndSendULRRCMessageTransfer
3010 * Functionality: Constructs the UL RRC Message Transfer and sends
3011 * it to the CU through SCTP.
3015 * @return ROK - success
3018 * ****************************************************************/
3019 uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb ueCb, uint8_t lcId, \
3020 uint16_t msgLen, uint8_t *rrcMsg)
3022 uint8_t elementCnt =0;
3025 F1AP_PDU_t *f1apMsg = NULLP;
3026 ULRRCMessageTransfer_t *ulRRCMsg = NULLP;
3027 asn_enc_rval_t encRetVal; /* Encoder return value */
3028 uint8_t ret =RFAILED;
3030 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
3034 DU_LOG("\n INFO --> F1AP : Building UL RRC Message Transfer Message\n");
3036 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
3037 if(f1apMsg == NULLP)
3039 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
3042 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
3043 DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
3044 if(f1apMsg->choice.initiatingMessage == NULLP)
3046 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
3049 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_ULRRCMessageTransfer;
3050 f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
3051 f1apMsg->choice.initiatingMessage->value.present = \
3052 InitiatingMessage__value_PR_ULRRCMessageTransfer;
3054 &f1apMsg->choice.initiatingMessage->value.choice.ULRRCMessageTransfer;
3056 ulRRCMsg->protocolIEs.list.count = elementCnt;
3057 ulRRCMsg->protocolIEs.list.size = \
3058 elementCnt * sizeof(ULRRCMessageTransferIEs_t *);
3060 /* Initialize the F1Setup members */
3061 DU_ALLOC(ulRRCMsg->protocolIEs.list.array, ulRRCMsg->protocolIEs.list.size);
3062 if(ulRRCMsg->protocolIEs.list.array == NULLP)
3064 DU_LOG(" ERROR --> F1AP : Memory allocation for UL RRC MessageTransferIEs failed");
3067 for(idx=0; idx<elementCnt; idx++)
3069 DU_ALLOC(ulRRCMsg->protocolIEs.list.array[idx],sizeof(ULRRCMessageTransferIEs_t));
3070 if(ulRRCMsg->protocolIEs.list.array[idx] == NULLP)
3078 /*GNB CU UE F1AP ID*/
3079 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
3080 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
3081 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
3082 ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
3083 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.GNB_CU_UE_F1AP_ID = ueCb.gnbCuUeF1apId;
3085 /*GNB DU UE F1AP ID*/
3087 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
3088 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
3089 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
3090 ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
3091 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.GNB_DU_UE_F1AP_ID = ueCb.gnbDuUeF1apId;
3095 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_SRBID;
3096 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
3097 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
3098 ULRRCMessageTransferIEs__value_PR_SRBID;
3099 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.SRBID = lcId;
3103 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_RRCContainer;
3104 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
3105 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
3106 ULRRCMessageTransferIEs__value_PR_RRCContainer;
3107 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size = msgLen;
3108 DU_ALLOC(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf,
3109 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size)
3110 if(!ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf)
3112 DU_LOG(" ERROR --> F1AP : Memory allocation for BuildAndSendULRRCMessageTransfer failed");
3115 memset(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, 0, msgLen);
3116 memcpy(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, \
3117 rrcMsg, ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size);
3119 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
3121 /* Encode the F1SetupRequest type as APER */
3122 memset(encBuf, 0, ENC_BUF_MAX_LEN);
3124 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
3126 /* Encode results */
3127 if(encRetVal.encoded == ENCODE_FAIL)
3129 DU_LOG( "\nERROR --> F1AP : Could not encode ULRRCMessageTransfer structure (at %s)\n",\
3130 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
3135 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for ULRRCMessageTransfer\n");
3136 for(int i=0; i< encBufSize; i++)
3138 printf("%x",encBuf[i]);
3143 if(sendF1APMsg() != ROK)
3145 DU_LOG("\nERROR --> F1AP : Sending UL RRC Message Transfer Failed");
3151 FreeULRRCMessageTransfer(f1apMsg);
3154 }/* End of BuildAndSendULRRCMessageTransfer*/
3156 /*******************************************************************
3158 * @brief Builds tag config
3162 * Function : BuildTagConfig
3164 * Functionality: Builds tag config in MacCellGroupConfig
3166 * @params[in] TAG_Config *tag_Config
3168 * @return ROK - success
3171 * ****************************************************************/
3172 uint8_t BuildTagConfig(struct TAG_Config *tagConfig)
3174 struct TAG_Config__tag_ToAddModList *tagList;
3175 uint8_t idx, elementCnt;
3177 tagConfig->tag_ToReleaseList = NULLP;
3178 tagConfig->tag_ToAddModList = NULLP;
3179 DU_ALLOC(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
3180 if(!tagConfig->tag_ToAddModList)
3182 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildTagConfig");
3186 elementCnt = 1; //ODU_VALUE_ONE;
3187 tagList = tagConfig->tag_ToAddModList;
3188 tagList->list.count = elementCnt;
3189 tagList->list.size = elementCnt * sizeof(struct TAG *);
3191 tagList->list.array = NULLP;
3192 DU_ALLOC(tagList->list.array, tagList->list.size);
3193 if(!tagList->list.array)
3195 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildTagConfig");
3199 for(idx=0; idx<tagList->list.count; idx++)
3201 tagList->list.array[idx] = NULLP;
3202 DU_ALLOC(tagList->list.array[idx], sizeof(struct TAG));
3203 if(!tagList->list.array[idx])
3205 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildTagConfig");
3211 tagList->list.array[idx]->tag_Id = TAG_ID;
3212 tagList->list.array[idx]->timeAlignmentTimer = TIME_ALIGNMENT_TMR;
3217 /*******************************************************************
3219 * @brief Builds PHR Config
3223 * Function : BuildPhrConfig
3225 * Functionality: Builds phrConfig in MacCellGroupConfig
3227 * @params[in] PHR Config *
3229 * @return ROK - success
3232 * ****************************************************************/
3233 uint8_t BuildPhrConfig(struct MAC_CellGroupConfig__phr_Config *phrConfig)
3236 phrConfig->present = MAC_CellGroupConfig__phr_Config_PR_setup;
3237 phrConfig->choice.setup = NULLP;
3238 DU_ALLOC(phrConfig->choice.setup, sizeof(struct PHR_Config));
3239 if(!phrConfig->choice.setup)
3241 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildPhrConfig");
3245 phrConfig->choice.setup->phr_PeriodicTimer = PHR_PERIODIC_TMR;
3246 phrConfig->choice.setup->phr_ProhibitTimer = PHR_PROHIBHIT_TMR;
3247 phrConfig->choice.setup->phr_Tx_PowerFactorChange = PHR_PWR_FACTOR_CHANGE;
3248 phrConfig->choice.setup->multiplePHR = false;
3249 phrConfig->choice.setup->dummy = false;
3250 phrConfig->choice.setup->phr_Type2OtherCell = false;
3251 phrConfig->choice.setup->phr_ModeOtherCG = PHR_MODE_OTHER_CG;
3256 /*******************************************************************
3258 * @brief Builds BSR Config
3262 * Function : BuildBsrConfig
3264 * Functionality: Builds BuildBsrConfig in MacCellGroupConfig
3266 * @params[in] BSR_Config *bsrConfig
3268 * @return ROK - success
3271 * ****************************************************************/
3272 uint8_t BuildBsrConfig(struct BSR_Config *bsrConfig)
3274 bsrConfig->periodicBSR_Timer = PERIODIC_BSR_TMR;
3275 bsrConfig->retxBSR_Timer = RETX_BSR_TMR;
3276 bsrConfig->logicalChannelSR_DelayTimer = NULLP;
3281 /*******************************************************************
3283 * @brief Builds scheduling request config
3287 * Function : BuildSchedulingReqConfig
3289 * Functionality: Builds BuildSchedulingReqConfig in MacCellGroupConfig
3291 * @params[in] SchedulingRequestConfig *schedulingRequestConfig
3293 * @return ROK - success
3296 * ****************************************************************/
3297 uint8_t BuildSchedulingReqConfig(struct SchedulingRequestConfig *schedulingRequestConfig)
3299 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList;
3300 uint8_t idx, elementCnt;
3302 schedulingRequestConfig->schedulingRequestToAddModList = NULLP;
3303 DU_ALLOC(schedulingRequestConfig->schedulingRequestToAddModList,
3304 sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList));
3305 if(!schedulingRequestConfig->schedulingRequestToAddModList)
3307 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
3311 elementCnt = 1; //ODU_VALUE_ONE;
3312 schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
3313 schReqList->list.count = elementCnt;
3314 schReqList->list.size = elementCnt * sizeof(struct SchedulingRequestToAddMod *);
3316 schReqList->list.array = NULLP;
3317 DU_ALLOC(schReqList->list.array, schReqList->list.size);
3318 if(!schReqList->list.array)
3320 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
3324 for(idx=0;idx<schReqList->list.count; idx++)
3326 schReqList->list.array[idx] = NULLP;
3327 DU_ALLOC(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
3328 if(!schReqList->list.array[idx])
3330 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
3336 schReqList->list.array[idx]->schedulingRequestId = SCH_REQ_ID;
3338 schReqList->list.array[idx]->sr_ProhibitTimer = NULLP;
3339 DU_ALLOC(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
3340 if(!schReqList->list.array[idx]->sr_ProhibitTimer)
3342 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
3345 *(schReqList->list.array[idx]->sr_ProhibitTimer) = SR_PROHIBIT_TMR;
3346 schReqList->list.array[idx]->sr_TransMax = SR_TRANS_MAX;
3347 schedulingRequestConfig->schedulingRequestToReleaseList = NULLP;
3352 /*******************************************************************
3354 * @brief Builds RLC Config
3358 * Function : BuildRlcConfig
3360 * Functionality: Builds RLC Config in BuildRlcBearerToAddModList
3362 * @params[in] RLC_Config *rlcConfig
3364 * @return ROK - success
3367 * ****************************************************************/
3368 uint8_t BuildRlcConfig(struct RLC_Config *rlcConfig)
3371 rlcConfig->present = RLC_Config_PR_am;
3373 rlcConfig->choice.am = NULLP;
3374 DU_ALLOC(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
3375 if(!rlcConfig->choice.am)
3377 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfig");
3382 rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength = NULLP;
3383 DU_ALLOC(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
3384 if(!rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength)
3386 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfig");
3389 *(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength) = SN_FIELD_LEN;
3390 rlcConfig->choice.am->ul_AM_RLC.t_PollRetransmit = T_POLL_RETRANSMIT;
3391 rlcConfig->choice.am->ul_AM_RLC.pollPDU = POLL_PDU;
3392 rlcConfig->choice.am->ul_AM_RLC.pollByte = POLL_BYTE;
3393 rlcConfig->choice.am->ul_AM_RLC.maxRetxThreshold = MAX_RETX_THRESHOLD;
3396 rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength = NULLP;
3397 DU_ALLOC(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
3398 if(!rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength)
3400 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfig");
3403 *(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength) = SN_FIELD_LEN;
3404 rlcConfig->choice.am->dl_AM_RLC.t_Reassembly = T_REASSEMBLY;
3405 rlcConfig->choice.am->dl_AM_RLC.t_StatusProhibit = T_STATUS_PROHIBHIT;
3410 /*******************************************************************
3412 * @brief Builds MAC LC Config
3416 * Function : BuildMacLCConfig
3418 * Functionality: Builds MAC LC Config in BuildRlcBearerToAddModList
3420 * @params[in] struct LogicalChannelConfig macLcConfig
3422 * @return ROK - success
3425 * ****************************************************************/
3426 uint8_t BuildMacLCConfig(struct LogicalChannelConfig *macLcConfig)
3429 macLcConfig->ul_SpecificParameters = NULLP;
3430 DU_ALLOC(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
3431 if(!macLcConfig->ul_SpecificParameters)
3433 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacLCConfig");
3437 macLcConfig->ul_SpecificParameters->priority = MAC_LC_PRIORITY;
3438 macLcConfig->ul_SpecificParameters->prioritisedBitRate = PRIORTISIED_BIT_RATE;
3439 macLcConfig->ul_SpecificParameters->bucketSizeDuration = BUCKET_SIZE_DURATION;
3440 macLcConfig->ul_SpecificParameters->allowedServingCells = NULLP;
3441 macLcConfig->ul_SpecificParameters->allowedSCS_List = NULLP;
3442 macLcConfig->ul_SpecificParameters->maxPUSCH_Duration = NULLP;
3443 macLcConfig->ul_SpecificParameters->configuredGrantType1Allowed = NULLP;
3445 macLcConfig->ul_SpecificParameters->logicalChannelGroup = NULLP;
3446 DU_ALLOC(macLcConfig->ul_SpecificParameters->logicalChannelGroup, sizeof(long));
3447 if(!macLcConfig->ul_SpecificParameters->logicalChannelGroup)
3449 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacLCConfig");
3452 *(macLcConfig->ul_SpecificParameters->logicalChannelGroup) = LC_GRP;
3454 macLcConfig->ul_SpecificParameters->schedulingRequestID = NULLP;
3455 DU_ALLOC(macLcConfig->ul_SpecificParameters->schedulingRequestID, sizeof(SchedulingRequestId_t));
3456 if(!macLcConfig->ul_SpecificParameters->schedulingRequestID)
3458 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacLCConfig");
3461 *(macLcConfig->ul_SpecificParameters->schedulingRequestID) = SCH_REQ_ID;
3463 macLcConfig->ul_SpecificParameters->logicalChannelSR_Mask = false;
3464 macLcConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = false;
3465 macLcConfig->ul_SpecificParameters->bitRateQueryProhibitTimer = NULLP;
3470 /*******************************************************************
3472 * @brief Builds RLC Bearer to Add/Mod list
3476 * Function :BuildRlcBearerToAddModList
3478 * Functionality: Builds RLC Bearer to Add/Mod list in DuToCuRrcContainer
3480 * @params[in] rlc_BearerToAddModList
3482 * @return ROK - success
3485 * ****************************************************************/
3486 uint8_t BuildRlcBearerToAddModList(struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList)
3488 uint8_t idx, elementCnt;
3491 rlcBearerList->list.count = elementCnt;
3492 rlcBearerList->list.size = elementCnt * sizeof(struct RLC_BearerConfig *);
3494 rlcBearerList->list.array = NULLP;
3495 DU_ALLOC(rlcBearerList->list.array, rlcBearerList->list.size);
3496 if(!rlcBearerList->list.array)
3498 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3502 for(idx=0; idx<rlcBearerList->list.count; idx++)
3504 rlcBearerList->list.array[idx] = NULLP;
3505 DU_ALLOC(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
3506 if(!rlcBearerList->list.array[idx])
3508 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3514 rlcBearerList->list.array[idx]->logicalChannelIdentity = SRB1_LCID;
3516 DU_ALLOC(rlcBearerList->list.array[idx]->servedRadioBearer, \
3517 sizeof(struct RLC_BearerConfig__servedRadioBearer));
3518 if(!rlcBearerList->list.array[idx]->servedRadioBearer)
3520 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3524 rlcBearerList->list.array[idx]->servedRadioBearer->present = \
3525 RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
3526 rlcBearerList->list.array[idx]->servedRadioBearer->choice.srb_Identity = \
3529 rlcBearerList->list.array[idx]->reestablishRLC = NULLP;
3530 rlcBearerList->list.array[idx]->rlc_Config = NULLP;
3531 DU_ALLOC(rlcBearerList->list.array[idx]->rlc_Config, sizeof(struct RLC_Config));
3532 if(!rlcBearerList->list.array[idx]->rlc_Config)
3534 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3538 if(BuildRlcConfig(rlcBearerList->list.array[idx]->rlc_Config) != ROK)
3540 DU_LOG("\nERROR --> F1AP : BuildRlcConfig failed");
3544 rlcBearerList->list.array[idx]->mac_LogicalChannelConfig = NULLP;
3545 DU_ALLOC(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, \
3546 sizeof(struct LogicalChannelConfig));
3547 if(!rlcBearerList->list.array[idx]->mac_LogicalChannelConfig)
3549 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3553 if(BuildMacLCConfig(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig) != ROK)
3555 DU_LOG("\nERROR --> F1AP : BuildMacLCConfig failed");
3562 /*******************************************************************
3564 * @brief Build Control resource set to add/modify list
3568 * Function : BuildControlRSetToAddModList
3570 * Functionality: Build Control resource set to add/modify list
3573 * struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList
3575 * @return ROK - success
3578 * ****************************************************************/
3579 uint8_t BuildControlRSetToAddModList
3581 struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList
3586 uint8_t numBytes, bitsUnused;
3587 struct ControlResourceSet *controlRSet;
3588 uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
3589 uint8_t coreset0EndPrb, coreset1StartPrb, coreset1NumPrb;
3593 controlRSetList->list.count = elementCnt;
3594 controlRSetList->list.size = \
3595 elementCnt * sizeof(struct ControlResourceSet *);
3597 controlRSetList->list.array = NULLP;
3598 DU_ALLOC(controlRSetList->list.array, controlRSetList->list.size);
3599 if(!controlRSetList->list.array)
3601 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3605 for(idx = 0; idx < elementCnt; idx++)
3607 controlRSetList->list.array[idx] = NULLP;
3608 DU_ALLOC(controlRSetList->list.array[idx], sizeof(struct ControlResourceSet));
3609 if(!controlRSetList->list.array[idx])
3611 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3617 controlRSet = controlRSetList->list.array[idx];
3619 controlRSet->controlResourceSetId = PDCCH_CTRL_RSRC_SET_ONE_ID;
3623 * Bit string stored ff0000000000
3627 controlRSet->frequencyDomainResources.size = numBytes * sizeof(uint8_t);
3629 controlRSet->frequencyDomainResources.buf = NULLP;
3630 DU_ALLOC(controlRSet->frequencyDomainResources.buf, \
3631 controlRSet->frequencyDomainResources.size);
3632 if(!controlRSet->frequencyDomainResources.buf)
3634 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3638 memset(controlRSet->frequencyDomainResources.buf, 0, FREQ_DOM_RSRC_SIZE);
3639 coreset0EndPrb = CORESET0_END_PRB;
3640 coreset1StartPrb = coreset0EndPrb + 6;
3641 coreset1NumPrb = CORESET1_NUM_PRB;
3642 /* calculate the PRBs */
3643 fillCoresetFeqDomAllocMap(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
3644 memcpy(controlRSet->frequencyDomainResources.buf, freqDomainResource, FREQ_DOM_RSRC_SIZE);
3645 controlRSet->frequencyDomainResources.bits_unused = bitsUnused;
3647 controlRSet->duration = PDCCH_CTRL_RSRC_SET_ONE_DURATION;
3648 controlRSet->cce_REG_MappingType.present = \
3649 ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved;
3651 controlRSet->precoderGranularity = PDCCH_CTRL_RSRC_SET_ONE_PRECOD_GRANULARITY;
3652 controlRSet->tci_StatesPDCCH_ToAddList = NULLP;
3653 controlRSet->tci_StatesPDCCH_ToReleaseList = NULLP;
3654 controlRSet->tci_PresentInDCI = NULLP;
3656 uint8_t tciStateIdx;
3658 DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList, \
3659 sizeof(struct ControlResourceSet__tci_StatesPDCCH_ToAddList));
3660 if(!controlRset->tci_StatesPDCCH_ToAddList)
3662 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3667 controlRset->tci_StatesPDCCH_ToAddList->list.count = elementCnt;
3668 controlRset->tci_StatesPDCCH_ToAddList->list.size = elementCnt * sizeof(TCI_StateId_t *);
3669 DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList->list.array, \
3670 controlRset->tci_StatesPDCCH_ToAddList->list.size)
3671 if(!controlRset->tci_StatesPDCCH_ToAddList->list.array)
3673 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3677 for(tciStateIdx = 0; tciStateIdx <elementCntl; tciStateIdx++)
3679 DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx], sizeof(TCI_StateId_t));
3680 if(!controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx])
3682 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3689 *(controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx]);
3691 DU_ALLOC(controlRset->tci_PresentInDCI, sizeof(long));
3692 if(!controlRset->tci_PresentInDCI)
3694 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3698 *(controlRset->tci_PresentInDCI);
3701 controlRSet->pdcch_DMRS_ScramblingID = NULLP;
3702 DU_ALLOC(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
3703 if(!controlRSet->pdcch_DMRS_ScramblingID)
3705 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3708 *(controlRSet->pdcch_DMRS_ScramblingID) = SCRAMBLING_ID;
3711 } /* End BuildControlRSetToAddModList */
3713 /*******************************************************************
3715 * @brief Build search space to add/modify list
3719 * Function : BuildSearchSpcToAddModList
3721 * Functionality: Build search space to add/modify list
3724 * @return ROK - success
3727 * ****************************************************************/
3728 uint8_t BuildSearchSpcToAddModList
3730 struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
3738 struct SearchSpace *searchSpc;
3741 searchSpcList->list.count = elementCnt;
3742 searchSpcList->list.size = elementCnt * sizeof(struct SearchSpace *);
3744 searchSpcList->list.array = NULLP;
3745 DU_ALLOC(searchSpcList->list.array, searchSpcList->list.size);
3746 if(!searchSpcList->list.array)
3748 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3752 for(idx = 0; idx < elementCnt; idx++)
3754 searchSpcList->list.array[idx] = NULLP;
3755 DU_ALLOC(searchSpcList->list.array[idx], sizeof(struct SearchSpace));
3756 if(!searchSpcList->list.array[idx])
3758 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3764 searchSpc = searchSpcList->list.array[idx];
3766 searchSpc->searchSpaceId = PDCCH_SRCH_SPC_TWO_ID;
3768 searchSpc->controlResourceSetId = NULLP;
3769 DU_ALLOC(searchSpc->controlResourceSetId, sizeof(ControlResourceSetId_t));
3770 if(!searchSpc->controlResourceSetId)
3772 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3775 *(searchSpc->controlResourceSetId) = PDCCH_CTRL_RSRC_SET_ONE_ID;
3777 searchSpc->monitoringSlotPeriodicityAndOffset = NULLP;
3778 DU_ALLOC(searchSpc->monitoringSlotPeriodicityAndOffset, \
3779 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
3780 if(!searchSpc->monitoringSlotPeriodicityAndOffset)
3782 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3785 searchSpc->monitoringSlotPeriodicityAndOffset->present = \
3786 SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
3788 searchSpc->duration = NULLP;
3789 searchSpc->monitoringSymbolsWithinSlot = NULLP;
3790 DU_ALLOC(searchSpc->monitoringSymbolsWithinSlot, sizeof(BIT_STRING_t));
3791 if(!searchSpc->monitoringSymbolsWithinSlot)
3793 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3797 /* Values taken from reference logs :
3800 * Bit string stores 8000
3805 searchSpc->monitoringSymbolsWithinSlot->size = numBytes * sizeof(uint8_t);
3806 searchSpc->monitoringSymbolsWithinSlot->buf = NULLP;
3807 DU_ALLOC(searchSpc->monitoringSymbolsWithinSlot->buf, \
3808 searchSpc->monitoringSymbolsWithinSlot->size);
3809 if(!searchSpc->monitoringSymbolsWithinSlot->buf)
3811 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3816 searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = \
3817 PDCCH_SYMBOL_WITHIN_SLOT /* setting MSB to 128 i.e. 0x80 */;
3818 searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = 0;
3819 searchSpc->monitoringSymbolsWithinSlot->bits_unused = bitsUnused;
3821 searchSpc->nrofCandidates = NULLP;
3822 DU_ALLOC(searchSpc->nrofCandidates, sizeof(struct SearchSpace__nrofCandidates));
3823 if(!searchSpc->nrofCandidates)
3825 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3829 searchSpc->nrofCandidates->aggregationLevel1 = \
3830 PDCCH_SRCH_SPC_TWO_AGG_LVL1_CANDIDATE;
3831 searchSpc->nrofCandidates->aggregationLevel2 = \
3832 PDCCH_SRCH_SPC_TWO_AGG_LVL2_CANDIDATE;
3833 searchSpc->nrofCandidates->aggregationLevel4 = \
3834 PDCCH_SRCH_SPC_TWO_AGG_LVL4_CANDIDATE;
3835 searchSpc->nrofCandidates->aggregationLevel8 = \
3836 PDCCH_SRCH_SPC_TWO_AGG_LVL8_CANDIDATE;
3837 searchSpc->nrofCandidates->aggregationLevel16 = \
3838 PDCCH_SRCH_SPC_TWO_AGG_LVL16_CANDIDATE;
3840 searchSpc->searchSpaceType = NULLP;
3841 DU_ALLOC(searchSpc->searchSpaceType, sizeof(struct SearchSpace__searchSpaceType));
3842 if(!searchSpc->searchSpaceType)
3844 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3848 searchSpc->searchSpaceType->present = SearchSpace__searchSpaceType_PR_ue_Specific;
3850 searchSpc->searchSpaceType->choice.ue_Specific = NULLP;
3851 DU_ALLOC(searchSpc->searchSpaceType->choice.ue_Specific, \
3852 sizeof(struct SearchSpace__searchSpaceType__ue_Specific));
3853 if(!searchSpc->searchSpaceType->choice.ue_Specific)
3855 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3858 searchSpc->searchSpaceType->choice.ue_Specific->dci_Formats = \
3859 PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT;
3862 }/* End BuildSearchSpcToAddModList */
3864 /*******************************************************************
3866 * @brief Builds BWP DL dedicated PDCCH config
3870 * Function : BuildBWPDlDedPdcchCfg
3872 * Functionality: Builds BWP DL dedicated PDCCH config
3874 * @params[in] struct PDCCH_Config *pdcchCfg
3876 * @return ROK - success
3879 * ****************************************************************/
3880 uint8_t BuildBWPDlDedPdcchCfg(struct PDCCH_Config *pdcchCfg)
3882 pdcchCfg->controlResourceSetToAddModList = NULLP;
3883 DU_ALLOC(pdcchCfg->controlResourceSetToAddModList, \
3884 sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
3885 if(!pdcchCfg->controlResourceSetToAddModList)
3887 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdcchCfg");
3891 if(BuildControlRSetToAddModList(pdcchCfg->controlResourceSetToAddModList) != ROK)
3896 pdcchCfg->controlResourceSetToReleaseList = NULLP;
3898 pdcchCfg->searchSpacesToAddModList = NULLP;
3899 DU_ALLOC(pdcchCfg->searchSpacesToAddModList, \
3900 sizeof(struct PDCCH_Config__searchSpacesToAddModList));
3901 if(!pdcchCfg->searchSpacesToAddModList)
3903 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdcchCfg");
3907 if(BuildSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList) != ROK)
3912 pdcchCfg->searchSpacesToReleaseList = NULLP;
3913 pdcchCfg->downlinkPreemption = NULLP;
3914 pdcchCfg->tpc_PUSCH = NULLP;
3915 pdcchCfg->tpc_PUCCH = NULLP;
3916 pdcchCfg->tpc_SRS = NULLP;
3921 /*******************************************************************
3923 * @brief Builds DMRS DL PDSCH Mapping type A
3927 * Function : BuildDMRSDLPdschMapTypeA
3929 * Functionality: Builds DMRS DL PDSCH Mapping type A
3932 * struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg
3933 * @return ROK - success
3936 * ****************************************************************/
3937 uint8_t BuildDMRSDLPdschMapTypeA
3939 struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg
3942 dmrsDlCfg->present = PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup;
3943 dmrsDlCfg->choice.setup = NULLP;
3944 DU_ALLOC(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
3945 if(!dmrsDlCfg->choice.setup)
3947 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
3951 dmrsDlCfg->choice.setup->dmrs_Type = NULLP;
3952 dmrsDlCfg->choice.setup->dmrs_AdditionalPosition = NULLP;
3953 DU_ALLOC(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition, sizeof(long));
3954 if(!dmrsDlCfg->choice.setup->dmrs_AdditionalPosition)
3956 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSDLPdschMapTypeA");
3959 *(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition) = DMRS_ADDITIONAL_POS;
3961 dmrsDlCfg->choice.setup->maxLength = NULLP;
3962 dmrsDlCfg->choice.setup->scramblingID0 = NULLP;
3963 dmrsDlCfg->choice.setup->scramblingID1 = NULLP;
3964 dmrsDlCfg->choice.setup->phaseTrackingRS = NULLP;
3969 /*******************************************************************
3971 * @brief Builds TCI states to add/modify list
3975 * Function : BuildTCIStatesToAddModList
3977 * Functionality:Builds TCI states to add/modify list
3980 * struct PDSCH_Config__tci_StatesToAddModList *tciStatesList
3982 * @return ROK - success
3985 * ****************************************************************/
3986 uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList *tciStatesList)
3991 /*******************************************************************
3993 * @brief Builds PDSCH time domain allocation list
3997 * Function : BuildPdschTimeDomAllocList
3999 * Functionality: Builds PDSCH time domain allocation list
4002 * struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
4004 * @return ROK - success
4007 * ****************************************************************/
4008 uint8_t BuildPdschTimeDomAllocList
4010 struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
4015 struct PDSCH_TimeDomainResourceAllocation *timeDomAlloc;
4017 timeDomAllocList->present = \
4018 PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup;
4020 timeDomAllocList->choice.setup = NULLP;
4021 DU_ALLOC(timeDomAllocList->choice.setup, \
4022 sizeof(struct PDSCH_TimeDomainResourceAllocationList));
4023 if(!timeDomAllocList->choice.setup)
4025 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4030 timeDomAllocList->choice.setup->list.count = elementCnt;
4031 timeDomAllocList->choice.setup->list.size = \
4032 elementCnt * sizeof(struct PDSCH_TimeDomainResourceAllocation *);
4034 timeDomAllocList->choice.setup->list.array = NULLP;
4035 DU_ALLOC(timeDomAllocList->choice.setup->list.array, \
4036 timeDomAllocList->choice.setup->list.size);
4037 if(!timeDomAllocList->choice.setup->list.array)
4039 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4043 for(idx = 0; idx < elementCnt; idx++)
4045 timeDomAllocList->choice.setup->list.array[idx] = NULLP;
4046 DU_ALLOC(timeDomAllocList->choice.setup->list.array[idx], \
4047 sizeof(struct PDSCH_TimeDomainResourceAllocation));
4048 if(!timeDomAllocList->choice.setup->list.array[idx])
4050 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4056 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4057 DU_ALLOC(timeDomAlloc->k0, sizeof(long));
4058 if(!timeDomAlloc->k0)
4060 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4063 *(timeDomAlloc->k0) = 0;
4064 timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
4065 timeDomAlloc->startSymbolAndLength = \
4066 calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
4069 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4070 DU_ALLOC(timeDomAlloc->k0, sizeof(long));
4071 if(!timeDomAlloc->k0)
4073 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4076 *(timeDomAlloc->k0) = 1;
4077 timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
4078 timeDomAlloc->startSymbolAndLength = calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
4083 /*******************************************************************
4085 * @brief Builds PDSCH PRB Bundling type
4089 * Function : BuildPdschPrbBundlingType
4091 * Functionality: Builds PDSCH PRB Bundling type
4094 * struct PDSCH_Config__prb_BundlingType *prbBndlType
4096 * @return ROK - success
4099 * ****************************************************************/
4100 uint8_t BuildPdschPrbBundlingType
4102 struct PDSCH_Config__prb_BundlingType *prbBndlType
4105 prbBndlType->present = PDSCH_Config__prb_BundlingType_PR_staticBundling;
4107 prbBndlType->choice.staticBundling = NULLP;
4108 DU_ALLOC(prbBndlType->choice.staticBundling, \
4109 sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
4110 if(!prbBndlType->choice.staticBundling)
4112 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschPrbBundlingType");
4115 prbBndlType->choice.staticBundling->bundleSize = NULLP;
4120 /*******************************************************************
4122 * @brief Builds BWP DL dedicated PDSCH config
4126 * Function : BuildBWPDlDedPdschCfg
4128 * Functionality: Builds BWP DL dedicated PDSCH config
4130 * @params[in] struct PDSCH_Config *pdschCfg
4132 * @return ROK - success
4135 * ****************************************************************/
4136 uint8_t BuildBWPDlDedPdschCfg(struct PDSCH_Config *pdschCfg)
4138 pdschCfg->dataScramblingIdentityPDSCH = NULLP;
4140 pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA = NULLP;
4141 DU_ALLOC(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, \
4142 sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
4143 if(!pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
4145 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4149 if(BuildDMRSDLPdschMapTypeA(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA) != ROK)
4154 pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeB = NULLP;
4155 pdschCfg->tci_StatesToAddModList = NULLP;
4156 pdschCfg->tci_StatesToReleaseList = NULLP;
4157 pdschCfg->vrb_ToPRB_Interleaver = NULLP;
4159 DU_ALLOC(pdschCfg->tci_StatesToAddModList, sizeof(struct PDSCH_Config__tci_StatesToAddModList));
4160 if(!pdschCfg->tci_StatesToAddModList)
4162 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4165 if(BuildTCIStatesToAddModList(pdschCfg->tci_StatesToAddModList) != ROK)
4171 pdschCfg->resourceAllocation = RES_ALLOC_TYPE;
4173 pdschCfg->pdsch_TimeDomainAllocationList = NULLP;
4174 DU_ALLOC(pdschCfg->pdsch_TimeDomainAllocationList, \
4175 sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
4176 if(!pdschCfg->pdsch_TimeDomainAllocationList)
4178 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4182 if(BuildPdschTimeDomAllocList(pdschCfg->pdsch_TimeDomainAllocationList) != ROK)
4187 pdschCfg->pdsch_AggregationFactor = NULLP;
4188 pdschCfg->rateMatchPatternToAddModList = NULLP;
4189 pdschCfg->rateMatchPatternToReleaseList = NULLP;
4190 pdschCfg->rateMatchPatternGroup1 = NULLP;
4191 pdschCfg->rateMatchPatternGroup2 = NULLP;
4192 pdschCfg->rbg_Size = PDSCH_RBG_SIZE;
4193 pdschCfg->mcs_Table = NULLP;
4195 pdschCfg->maxNrofCodeWordsScheduledByDCI = NULLP;
4196 DU_ALLOC(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
4197 if(!pdschCfg->maxNrofCodeWordsScheduledByDCI)
4199 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4202 *(pdschCfg->maxNrofCodeWordsScheduledByDCI) = PDSCH_MAX_CODEWORD_SCH_BY_DCI;
4204 if(BuildPdschPrbBundlingType(&pdschCfg->prb_BundlingType) != ROK)
4209 pdschCfg->zp_CSI_RS_ResourceToAddModList = NULLP;
4210 pdschCfg->zp_CSI_RS_ResourceToReleaseList = NULLP;
4211 pdschCfg->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList = NULLP;
4212 pdschCfg->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList = NULLP;
4213 pdschCfg->sp_ZP_CSI_RS_ResourceSetsToAddModList = NULLP;
4214 pdschCfg->sp_ZP_CSI_RS_ResourceSetsToReleaseList = NULLP;
4215 pdschCfg->p_ZP_CSI_RS_ResourceSet = NULLP;
4220 /*******************************************************************
4222 * @brief Builds intitial DL BWP
4225 * Function : BuildInitialDlBWP
4227 * Functionality: Builds intitial DL BWP in spCellCfgDed
4229 * @params[in] BWP_DownlinkDedicated_t *dlBwp
4231 * @return ROK - success
4234 * ****************************************************************/
4235 uint8_t BuildInitialDlBWP(BWP_DownlinkDedicated_t *dlBwp)
4237 dlBwp->pdcch_Config = NULLP;
4238 DU_ALLOC(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
4239 if(!dlBwp->pdcch_Config)
4241 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4244 dlBwp->pdcch_Config->present = BWP_DownlinkDedicated__pdcch_Config_PR_setup;
4246 dlBwp->pdcch_Config->choice.setup = NULLP;
4247 DU_ALLOC(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
4248 if(!dlBwp->pdcch_Config->choice.setup)
4250 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4253 if(BuildBWPDlDedPdcchCfg(dlBwp->pdcch_Config->choice.setup) != ROK)
4258 dlBwp->pdsch_Config = NULLP;
4259 DU_ALLOC(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
4260 if(!dlBwp->pdsch_Config)
4262 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4265 dlBwp->pdsch_Config->present = BWP_DownlinkDedicated__pdsch_Config_PR_setup;
4267 dlBwp->pdsch_Config->choice.setup = NULLP;
4268 DU_ALLOC(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
4269 if(!dlBwp->pdsch_Config->choice.setup)
4271 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4275 if(BuildBWPDlDedPdschCfg(dlBwp->pdsch_Config->choice.setup) != ROK)
4280 dlBwp->sps_Config = NULLP;
4281 dlBwp->radioLinkMonitoringConfig = NULLP;
4285 /*******************************************************************
4287 * @brief Builds DMRS UL Pusch Mapping type A
4291 * Function : BuildDMRSULPuschMapTypeA
4293 * Functionality: Builds DMRS UL Pusch Mapping type A
4296 * struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg
4297 * @return ROK - success
4300 * ****************************************************************/
4301 uint8_t BuildDMRSULPuschMapTypeA
4303 struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg
4306 dmrsUlCfg->present = PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup;
4307 dmrsUlCfg->choice.setup= NULLP;
4308 DU_ALLOC(dmrsUlCfg->choice.setup, sizeof(DMRS_UplinkConfig_t));
4309 if(!dmrsUlCfg->choice.setup)
4311 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4315 dmrsUlCfg->choice.setup->dmrs_Type = NULLP;
4316 dmrsUlCfg->choice.setup->dmrs_AdditionalPosition = NULLP;
4317 DU_ALLOC(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition, sizeof(long));
4318 if(!dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
4320 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4323 *(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition) = DMRS_ADDITIONAL_POS;
4325 dmrsUlCfg->choice.setup->phaseTrackingRS = NULLP;
4326 dmrsUlCfg->choice.setup->maxLength = NULLP;
4327 dmrsUlCfg->choice.setup->transformPrecodingDisabled = NULLP;
4328 DU_ALLOC(dmrsUlCfg->choice.setup->transformPrecodingDisabled, \
4329 sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
4330 if(!dmrsUlCfg->choice.setup->transformPrecodingDisabled)
4332 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4336 dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0 = NULLP;
4337 DU_ALLOC(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
4339 if(!dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0)
4341 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4344 *(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0) = SCRAMBLING_ID;
4346 dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID1 = NULLP;
4347 dmrsUlCfg->choice.setup->transformPrecodingEnabled = NULLP;
4351 /*******************************************************************
4353 * @brief Build PUSCH time domain allocation list
4357 * Function : BuildPuschTimeDomAllocList
4359 * Functionality: Build PUSCH time domain allocation list
4362 * struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList
4364 * @return ROK - success
4367 * ****************************************************************/
4368 uint8_t BuildPuschTimeDomAllocList
4370 struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList
4375 PUSCH_TimeDomainResourceAllocation_t *timeDomAlloc;
4377 timeDomAllocList->present = PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup;
4378 timeDomAllocList->choice.setup = NULLP;
4379 DU_ALLOC(timeDomAllocList->choice.setup, \
4380 sizeof(struct PUSCH_TimeDomainResourceAllocationList));
4381 if(!timeDomAllocList->choice.setup)
4383 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4388 timeDomAllocList->choice.setup->list.count = elementCnt;
4389 timeDomAllocList->choice.setup->list.size = \
4390 elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
4391 timeDomAllocList->choice.setup->list.array = NULLP;
4392 DU_ALLOC(timeDomAllocList->choice.setup->list.array, \
4393 timeDomAllocList->choice.setup->list.size);
4394 if(!timeDomAllocList->choice.setup->list.array)
4396 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4400 for(idx = 0; idx < elementCnt; idx++)
4402 timeDomAllocList->choice.setup->list.array[idx] = NULLP;
4403 DU_ALLOC(timeDomAllocList->choice.setup->list.array[idx],\
4404 sizeof(PUSCH_TimeDomainResourceAllocation_t));
4405 if(!timeDomAllocList->choice.setup->list.array[idx])
4407 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4413 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4414 DU_ALLOC(timeDomAlloc->k2, sizeof(long));
4415 if(!timeDomAlloc->k2)
4417 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4420 *(timeDomAlloc->k2) = PUSCH_K2_CFG1;
4421 timeDomAlloc->mappingType = PUSCH_MAPPING_TYPE_A;
4422 timeDomAlloc->startSymbolAndLength = calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
4425 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4426 DU_ALLOC(timeDomAlloc->k2, sizeof(long));
4427 if(!timeDomAlloc->k2)
4429 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4432 *(timeDomAlloc->k2) = PUSCH_K2_CFG2;
4433 timeDomAlloc->mappingType = PUSCH_MAPPING_TYPE_A;
4434 timeDomAlloc->startSymbolAndLength = calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
4439 /*******************************************************************
4441 * @brief Builds BWP UL dedicated PUSCH Config
4445 * Function : BuildBWPUlDedPuschCfg
4448 * Builds BWP UL dedicated PUSCH Config
4450 * @params[in] : PUSCH_Config_t *puschCfg
4452 * @return ROK - success
4455 * ****************************************************************/
4456 uint8_t BuildBWPUlDedPuschCfg(PUSCH_Config_t *puschCfg)
4458 puschCfg->dataScramblingIdentityPUSCH = NULLP;
4459 DU_ALLOC(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
4460 if(!puschCfg->dataScramblingIdentityPUSCH)
4462 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4465 *(puschCfg->dataScramblingIdentityPUSCH) = SCRAMBLING_ID;
4467 puschCfg->txConfig = NULLP;
4468 puschCfg->dmrs_UplinkForPUSCH_MappingTypeA = NULLP;
4469 DU_ALLOC(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \
4470 sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
4471 if(!puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
4473 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4477 if(BuildDMRSULPuschMapTypeA(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA) != ROK)
4482 puschCfg->dmrs_UplinkForPUSCH_MappingTypeB = NULLP;
4483 puschCfg->pusch_PowerControl = NULLP;
4484 puschCfg->frequencyHopping = NULLP;
4485 puschCfg->frequencyHoppingOffsetLists = NULLP;
4486 puschCfg->resourceAllocation = RES_ALLOC_TYPE;
4488 puschCfg->pusch_TimeDomainAllocationList = NULLP;
4489 DU_ALLOC(puschCfg->pusch_TimeDomainAllocationList, \
4490 sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
4491 if(!puschCfg->pusch_TimeDomainAllocationList)
4493 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4497 if(BuildPuschTimeDomAllocList(puschCfg->pusch_TimeDomainAllocationList) != ROK)
4502 puschCfg->pusch_AggregationFactor = NULLP;
4503 puschCfg->mcs_Table = NULLP;
4504 puschCfg->mcs_TableTransformPrecoder = NULLP;
4505 puschCfg->transformPrecoder = NULLP;
4506 DU_ALLOC(puschCfg->transformPrecoder, sizeof(long));
4507 if(!puschCfg->transformPrecoder)
4509 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4512 *(puschCfg->transformPrecoder) = PUSCH_TRANSFORM_PRECODER;
4514 puschCfg->codebookSubset = NULLP;
4515 puschCfg->maxRank = NULLP;
4516 puschCfg->rbg_Size = NULLP;
4517 puschCfg->uci_OnPUSCH = NULLP;
4518 puschCfg->tp_pi2BPSK = NULLP;
4523 /*******************************************************************
4525 * @brief Builds BWP UL dedicated PUCCH Config
4529 * Function : BuildBWPUlDedPucchCfg
4532 * Builds BWP UL dedicated PUCCH Config
4534 * @params[in] : PUCCH_Config_t *pucchCfg
4536 * @return ROK - success
4539 * ****************************************************************/
4540 uint8_t BuildBWPUlDedPucchCfg(PUCCH_Config_t *pucchCfg)
4542 uint8_t arrIdx, elementCnt;
4543 uint8_t rsrcIdx, rsrcSetIdx;
4544 PUCCH_ResourceSet_t *rsrcSet = NULLP;
4545 PUCCH_Resource_t *rsrc = NULLP;
4549 DU_ALLOC(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
4550 if(pucchCfg->resourceSetToAddModList == NULL)
4552 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4556 pucchCfg->resourceSetToAddModList->list.count = elementCnt;
4557 pucchCfg->resourceSetToAddModList->list.size = elementCnt * sizeof(PUCCH_ResourceSet_t *);
4558 DU_ALLOC(pucchCfg->resourceSetToAddModList->list.array, pucchCfg->resourceSetToAddModList->list.size);
4559 if(pucchCfg->resourceSetToAddModList->list.array == NULLP)
4561 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4564 for(rsrcSetIdx=0; rsrcSetIdx < pucchCfg->resourceSetToAddModList->list.count; rsrcSetIdx++)
4566 DU_ALLOC(pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t));
4567 if(pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx] == NULLP)
4569 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4574 rsrcSet = pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx];
4575 rsrcSet->pucch_ResourceSetId = 1;
4577 rsrcSet->resourceList.list.count = elementCnt;
4578 rsrcSet->resourceList.list.size = elementCnt * sizeof(PUCCH_ResourceId_t *);
4579 DU_ALLOC(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size);
4580 if(rsrcSet->resourceList.list.array == NULLP)
4582 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4585 for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
4587 DU_ALLOC(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
4588 if(rsrcSet->resourceList.list.array[rsrcIdx] == NULLP)
4590 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4595 *(rsrcSet->resourceList.list.array[rsrcIdx]) = 1;
4599 DU_ALLOC(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
4600 if(pucchCfg->resourceToAddModList == NULLP)
4602 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4605 pucchCfg->resourceToAddModList->list.count = elementCnt;
4606 pucchCfg->resourceToAddModList->list.size = elementCnt * sizeof(PUCCH_Resource_t *);
4607 DU_ALLOC(pucchCfg->resourceToAddModList->list.array, pucchCfg->resourceToAddModList->list.size);
4608 if(pucchCfg->resourceToAddModList->list.array == NULLP)
4610 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4613 for(rsrcIdx=0; rsrcIdx < pucchCfg->resourceToAddModList->list.count; rsrcIdx++)
4615 DU_ALLOC(pucchCfg->resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t));
4616 if(pucchCfg->resourceToAddModList->list.array[rsrcIdx] == NULLP)
4618 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4623 rsrc = pucchCfg->resourceToAddModList->list.array[rsrcIdx];
4624 rsrc->pucch_ResourceId = 1;
4625 rsrc->startingPRB = 0;
4626 rsrc->format.present = PUCCH_Resource__format_PR_format1;
4627 DU_ALLOC(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
4628 if(rsrc->format.choice.format1 == NULLP)
4630 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4633 rsrc->format.choice.format1->initialCyclicShift = 0;
4634 rsrc->format.choice.format1->nrofSymbols = 4;
4635 rsrc->format.choice.format1->startingSymbolIndex = 0;
4636 rsrc->format.choice.format1->timeDomainOCC = 0;
4639 DU_ALLOC(pucchCfg->format1, sizeof(struct PUCCH_Config__format1));
4640 if(pucchCfg->format1 == NULLP)
4642 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4645 pucchCfg->format1->present = PUCCH_Config__format1_PR_setup;
4646 DU_ALLOC(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t));
4647 if(pucchCfg->format1->choice.setup == NULLP)
4649 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4652 DU_ALLOC(pucchCfg->format1->choice.setup->nrofSlots, sizeof(long));
4653 if(pucchCfg->format1->choice.setup->nrofSlots == NULLP)
4655 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4658 *(pucchCfg->format1->choice.setup->nrofSlots) = PUCCH_FormatConfig__nrofSlots_n4;
4661 DU_ALLOC(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
4662 if(pucchCfg->dl_DataToUL_ACK == NULLP)
4664 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4669 pucchCfg->dl_DataToUL_ACK->list.count = elementCnt;
4670 pucchCfg->dl_DataToUL_ACK->list.size = elementCnt * sizeof(long *);
4671 DU_ALLOC(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size);
4672 if(pucchCfg->dl_DataToUL_ACK->list.array == NULLP)
4674 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4678 for(arrIdx = 0; arrIdx < pucchCfg->dl_DataToUL_ACK->list.count; arrIdx++)
4680 DU_ALLOC(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx], sizeof(long));
4681 if(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx] == NULLP)
4683 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
4689 *(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx++]) = 1;
4690 *(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx]) = 2;
4694 /*******************************************************************
4696 * @brief Fills SRS resource to add/modify list
4700 * Function : BuildSrsRsrcAddModList
4702 * Functionality: Fills SRS resource to add/modify list
4705 * @return ROK - success
4708 * ****************************************************************/
4709 uint8_t BuildSrsRsrcAddModList(struct SRS_Config__srs_ResourceToAddModList *resourceList)
4715 resourceList->list.count = elementCnt;
4716 resourceList->list.size = elementCnt * sizeof(SRS_Resource_t *);
4717 resourceList->list.array = NULLP;
4718 DU_ALLOC(resourceList->list.array, resourceList->list.size);
4719 if(!resourceList->list.array)
4721 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
4725 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
4727 DU_ALLOC(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
4728 if(!resourceList->list.array[rsrcIdx])
4730 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
4736 resourceList->list.array[rsrcIdx]->srs_ResourceId = SRS_RSRC_ID;
4737 resourceList->list.array[rsrcIdx]->nrofSRS_Ports = SRS_Resource__nrofSRS_Ports_port1;
4738 resourceList->list.array[rsrcIdx]->transmissionComb.present = SRS_Resource__transmissionComb_PR_n2;
4740 resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2 = NULLP;
4741 DU_ALLOC(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2, \
4742 sizeof(struct SRS_Resource__transmissionComb__n2));
4743 if(!resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2)
4745 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
4748 resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->combOffset_n2\
4749 = SRS_COMB_OFFSET_N2;
4750 resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->cyclicShift_n2\
4751 = SRS_CYCLIC_SHIFT_N2;
4753 resourceList->list.array[rsrcIdx]->resourceMapping.startPosition = \
4755 resourceList->list.array[rsrcIdx]->resourceMapping.nrofSymbols = \
4756 SRS_Resource__resourceMapping__nrofSymbols_n1;
4757 resourceList->list.array[rsrcIdx]->resourceMapping.repetitionFactor = \
4758 SRS_Resource__resourceMapping__repetitionFactor_n1;
4760 resourceList->list.array[rsrcIdx]->freqDomainPosition = SRS_FREQ_DOM_POS;
4761 resourceList->list.array[rsrcIdx]->freqDomainShift = SRS_FREQ_DOM_SHIFT;
4762 resourceList->list.array[rsrcIdx]->freqHopping.c_SRS = C_SRS;
4763 resourceList->list.array[rsrcIdx]->freqHopping.b_SRS = B_SRS;
4764 resourceList->list.array[rsrcIdx]->freqHopping.b_hop = B_HOP;
4765 resourceList->list.array[rsrcIdx]->groupOrSequenceHopping = \
4766 SRS_Resource__groupOrSequenceHopping_neither;
4768 /* Setting resource type to aperiodic for intergration purposes */
4769 resourceList->list.array[rsrcIdx]->resourceType.present = \
4770 SRS_Resource__resourceType_PR_aperiodic;
4771 resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic = NULLP;
4772 DU_ALLOC(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,
4773 sizeof(struct SRS_Resource__resourceType__aperiodic));
4774 if(!resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic)
4776 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
4779 resourceList->list.array[rsrcIdx]->sequenceId = SRS_SEQ_ID;
4784 /*******************************************************************
4786 * @brief Build SRS resource set Add/mod list
4790 * Function : BuildSrsRsrcSetAddModList
4792 * Functionality: Build SRS resource set Add/mod list
4795 * @return ROK - success
4798 * ****************************************************************/
4799 uint8_t BuildSrsRsrcSetAddModList
4801 struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList
4807 struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList;
4810 rsrcSetList->list.count = elementCnt;
4811 rsrcSetList->list.size = elementCnt * sizeof(SRS_ResourceSet_t *);
4812 rsrcSetList->list.array = NULLP;
4813 DU_ALLOC(rsrcSetList->list.array, rsrcSetList->list.size);
4814 if(!rsrcSetList->list.array)
4816 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
4820 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
4822 DU_ALLOC(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
4823 if(!rsrcSetList->list.array[rSetIdx])
4825 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
4831 rsrcSetList->list.array[rSetIdx]->srs_ResourceSetId = SRS_RSET_ID;
4833 /* Fill Resource Id list in resource set */
4834 rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList = NULLP;
4835 DU_ALLOC(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
4836 sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
4837 if(!rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
4839 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
4844 rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
4845 rsrcIdList->list.count = elementCnt;
4846 rsrcIdList->list.size = elementCnt * sizeof(SRS_ResourceId_t *);
4847 rsrcIdList->list.array = NULLP;
4848 DU_ALLOC(rsrcIdList->list.array, rsrcIdList->list.size);
4849 if(!rsrcIdList->list.array)
4851 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
4855 for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
4857 DU_ALLOC(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
4858 if(!rsrcIdList->list.array[rsrcIdx])
4860 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
4866 *rsrcIdList->list.array[rsrcIdx] = SRS_RSRC_ID;
4868 /* Fill resource type */
4869 rsrcSetList->list.array[rSetIdx]->resourceType.present = \
4870 SRS_ResourceSet__resourceType_PR_aperiodic;
4872 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic = NULLP;
4873 DU_ALLOC(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
4874 sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
4875 if(!rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic)
4877 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
4880 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger \
4881 = APERIODIC_SRS_RESRC_TRIGGER;
4883 /* TODO : Fill values for below IEs as expected by Viavi */
4884 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->csi_RS = NULLP;
4885 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->slotOffset = NULLP;
4888 rsrcSetList->list.array[rSetIdx]->usage = SRS_ResourceSet__usage_codebook;
4889 rsrcSetList->list.array[rSetIdx]->alpha = NULLP;
4890 rsrcSetList->list.array[rSetIdx]->p0 = NULLP;
4891 rsrcSetList->list.array[rSetIdx]->pathlossReferenceRS = NULLP;
4892 rsrcSetList->list.array[rSetIdx]->srs_PowerControlAdjustmentStates = NULLP;
4897 /*******************************************************************
4899 * @brief Builds BWP UL dedicated SRS Config
4903 * Function : BuildBWPUlDedSrsCfg
4905 * Functionality: Builds BWP UL dedicated SRS Config
4907 * @params[in] SRS Config
4908 * @return ROK - success
4911 * ****************************************************************/
4912 uint8_t BuildBWPUlDedSrsCfg(SRS_Config_t *srsCfg)
4914 srsCfg->srs_ResourceSetToReleaseList = NULLP;
4915 srsCfg->srs_ResourceSetToAddModList = NULLP;
4916 DU_ALLOC(srsCfg->srs_ResourceSetToAddModList, \
4917 sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
4918 if(!srsCfg->srs_ResourceSetToAddModList)
4920 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedSrsCfg");
4923 if(BuildSrsRsrcSetAddModList(srsCfg->srs_ResourceSetToAddModList) != ROK)
4928 srsCfg->srs_ResourceToReleaseList = NULLP;
4930 /* Resource to Add/Modify list */
4931 srsCfg->srs_ResourceToAddModList = NULLP;
4932 DU_ALLOC(srsCfg->srs_ResourceToAddModList, \
4933 sizeof(struct SRS_Config__srs_ResourceToAddModList));
4934 if(!srsCfg->srs_ResourceToAddModList)
4936 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedSrsCfg");
4940 if(BuildSrsRsrcAddModList(srsCfg->srs_ResourceToAddModList) != ROK)
4945 srsCfg->tpc_Accumulation = NULLP;
4952 /*******************************************************************
4954 * @brief Builds Pusch Serving cell Config
4958 * Function : BuildPuschSrvCellCfg
4960 * Functionality: Builds Pusch Serving cell Config
4962 * @params[in] struct UplinkConfig__pusch_ServingCellConfig *puschCfg
4964 * @return ROK - success
4967 * ****************************************************************/
4968 uint8_t BuildPuschSrvCellCfg(struct UplinkConfig__pusch_ServingCellConfig *puschCfg)
4970 puschCfg->present = UplinkConfig__pusch_ServingCellConfig_PR_setup;
4971 puschCfg->choice.setup = NULLP;
4972 DU_ALLOC(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
4973 if(!puschCfg->choice.setup)
4975 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
4979 puschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
4980 puschCfg->choice.setup->rateMatching = NULLP;
4981 puschCfg->choice.setup->xOverhead = NULLP;
4982 puschCfg->choice.setup->ext1 = NULLP;
4983 DU_ALLOC(puschCfg->choice.setup->ext1, sizeof(struct PUSCH_ServingCellConfig__ext1));
4984 if(!puschCfg->choice.setup->ext1)
4986 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
4990 puschCfg->choice.setup->ext1->maxMIMO_Layers = NULLP;
4991 DU_ALLOC(puschCfg->choice.setup->ext1->maxMIMO_Layers, sizeof(long));
4992 if(!puschCfg->choice.setup->ext1->maxMIMO_Layers)
4994 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
4997 *(puschCfg->choice.setup->ext1->maxMIMO_Layers) = PUSCH_MAX_MIMO_LAYERS;
4999 puschCfg->choice.setup->ext1->processingType2Enabled= NULLP;
5000 DU_ALLOC(puschCfg->choice.setup->ext1->processingType2Enabled,sizeof(BOOLEAN_t));
5001 if(!puschCfg->choice.setup->ext1->processingType2Enabled)
5003 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
5006 *(puschCfg->choice.setup->ext1->processingType2Enabled) = PUSCH_PROCESS_TYPE2_ENABLED;
5010 /*******************************************************************
5012 * @brief Builds inital UL BWP
5016 * Function : BuildInitialUlBWP
5018 * Functionality: Builds initial UL BWP
5020 * @params[in] BWP_UplinkDedicated_t *ulBwp
5021 * @return ROK - success
5024 * ****************************************************************/
5025 uint8_t BuildInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
5027 ulBwp->pucch_Config = NULLP;
5028 DU_ALLOC(ulBwp->pucch_Config, sizeof(struct BWP_UplinkDedicated__pucch_Config));
5029 if(!ulBwp->pucch_Config)
5031 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
5035 ulBwp->pucch_Config->present = BWP_UplinkDedicated__pucch_Config_PR_setup;
5036 ulBwp->pucch_Config->choice.setup = NULLP;
5037 DU_ALLOC(ulBwp->pucch_Config->choice.setup, sizeof(PUCCH_Config_t));
5038 if(!ulBwp->pucch_Config->choice.setup)
5040 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
5044 if(BuildBWPUlDedPucchCfg(ulBwp->pucch_Config->choice.setup) != ROK)
5049 /* Fill BWP UL dedicated PUSCH config */
5050 ulBwp->pusch_Config = NULLP;
5051 DU_ALLOC(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
5052 if(!ulBwp->pusch_Config)
5054 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
5058 ulBwp->pusch_Config->present = BWP_UplinkDedicated__pusch_Config_PR_setup;
5059 ulBwp->pusch_Config->choice.setup = NULLP;
5060 DU_ALLOC(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
5061 if(!ulBwp->pusch_Config->choice.setup)
5063 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
5067 if(BuildBWPUlDedPuschCfg(ulBwp->pusch_Config->choice.setup) != ROK)
5072 ulBwp->configuredGrantConfig = NULLP;
5074 /* Fill BPW UL dedicated SRS config */
5075 ulBwp->srs_Config = NULLP;
5076 DU_ALLOC(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
5077 if(!ulBwp->srs_Config)
5079 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
5083 ulBwp->srs_Config->present = BWP_UplinkDedicated__srs_Config_PR_setup;
5084 ulBwp->srs_Config->choice.setup = NULLP;
5085 DU_ALLOC(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
5086 if(!ulBwp->srs_Config->choice.setup)
5088 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
5092 if(BuildBWPUlDedSrsCfg(ulBwp->srs_Config->choice.setup) != ROK)
5097 ulBwp->beamFailureRecoveryConfig = NULLP;
5102 /*******************************************************************
5104 * @brief Builds UL config
5107 * Function : BuildUlCfg
5109 * Functionality: Builds UL config in spCellCfgDed
5111 * @params[in] UplinkConfig_t *ulCfg
5113 * @return ROK - success
5116 * ****************************************************************/
5117 uint8_t BuildUlCfg(UplinkConfig_t *ulCfg)
5119 ulCfg->initialUplinkBWP = NULLP;
5120 DU_ALLOC(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
5121 if(!ulCfg->initialUplinkBWP)
5123 DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
5127 if(BuildInitialUlBWP(ulCfg->initialUplinkBWP) != ROK)
5132 ulCfg->uplinkBWP_ToReleaseList = NULLP;
5133 ulCfg->uplinkBWP_ToAddModList = NULLP;
5134 ulCfg->firstActiveUplinkBWP_Id = NULLP;
5135 DU_ALLOC(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
5136 if(!ulCfg->firstActiveUplinkBWP_Id)
5138 DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
5141 *(ulCfg->firstActiveUplinkBWP_Id) = ACTIVE_UL_BWP_ID;
5143 ulCfg->pusch_ServingCellConfig = NULLP;
5144 DU_ALLOC(ulCfg->pusch_ServingCellConfig, \
5145 sizeof(struct UplinkConfig__pusch_ServingCellConfig));
5146 if(!ulCfg->pusch_ServingCellConfig)
5148 DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
5152 if(BuildPuschSrvCellCfg(ulCfg->pusch_ServingCellConfig) != ROK)
5157 ulCfg->carrierSwitching = NULLP;
5158 ulCfg->ext1 = NULLP;
5162 /*******************************************************************
5164 * @brief Builds PDSCH serving cell config
5167 * Function : BuildPdschSrvCellCfg
5169 * Functionality: Builds PDSCH serving cell config in spCellCfgDed
5171 * @params[in] struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg
5173 * @return ROK - success
5176 * ****************************************************************/
5177 uint8_t BuildPdschSrvCellCfg(struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg)
5179 pdschCfg->present = ServingCellConfig__pdsch_ServingCellConfig_PR_setup;
5180 pdschCfg->choice.setup = NULLP;
5181 DU_ALLOC(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig));
5182 if(!pdschCfg->choice.setup)
5184 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
5188 pdschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
5189 pdschCfg->choice.setup->xOverhead = NULLP;
5190 pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH = NULLP;
5191 DU_ALLOC(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH, sizeof(long));
5192 if(!pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH)
5194 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
5197 *(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH)= PDSCH_NUM_HARQ_PROC;
5198 pdschCfg->choice.setup->pucch_Cell = NULLP;
5199 pdschCfg->choice.setup->ext1 = NULLP;
5204 /*******************************************************************
5206 * @brief Builds CSI Meas config
5209 * Function : BuildCsiMeasCfg
5211 * Functionality: Builds CSI Meas config in spCellCfgDed
5213 * @params[in] struct ServingCellConfig__csi_MeasConfig *csiMeasCfg
5215 * @return ROK - success
5218 * ****************************************************************/
5219 uint8_t BuildCsiMeasCfg(struct ServingCellConfig__csi_MeasConfig *csiMeasCfg)
5225 /*******************************************************************
5227 * @brief Builds Spcell config dedicated
5230 * Function : BuildSpCellCfgDed
5232 * Functionality: Builds sp cell config dedicated in spCellCfg
5234 * @params[in] ServingCellConfig_t srvCellCfg
5236 * @return ROK - success
5239 * ****************************************************************/
5240 uint8_t BuildSpCellCfgDed(ServingCellConfig_t *srvCellCfg)
5242 srvCellCfg->tdd_UL_DL_ConfigurationDedicated = NULLP;
5243 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t));
5244 if(!srvCellCfg->tdd_UL_DL_ConfigurationDedicated)
5246 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
5250 srvCellCfg->initialDownlinkBWP = NULLP;
5251 DU_ALLOC(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
5252 if(!srvCellCfg->initialDownlinkBWP)
5254 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
5258 if(BuildInitialDlBWP(srvCellCfg->initialDownlinkBWP) != ROK)
5260 DU_LOG("\nERROR --> F1AP : BuildInitialDlBWP failed");
5263 srvCellCfg->downlinkBWP_ToReleaseList = NULLP;
5264 srvCellCfg->downlinkBWP_ToAddModList = NULLP;
5266 srvCellCfg->firstActiveDownlinkBWP_Id = NULLP;
5267 DU_ALLOC(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
5268 if(!srvCellCfg->firstActiveDownlinkBWP_Id)
5270 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
5273 *(srvCellCfg->firstActiveDownlinkBWP_Id) = ACTIVE_DL_BWP_ID;
5275 srvCellCfg->bwp_InactivityTimer = NULLP;
5277 srvCellCfg->defaultDownlinkBWP_Id = NULLP;
5278 DU_ALLOC(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
5279 if(!srvCellCfg->defaultDownlinkBWP_Id)
5281 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
5284 *(srvCellCfg->defaultDownlinkBWP_Id) = ACTIVE_DL_BWP_ID;
5286 srvCellCfg->uplinkConfig = NULLP;
5287 DU_ALLOC(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));
5288 if(!srvCellCfg->uplinkConfig)
5290 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
5294 if(BuildUlCfg(srvCellCfg->uplinkConfig) != ROK)
5296 DU_LOG("\nERROR --> F1AP : BuildUlCfg failed");
5299 srvCellCfg->supplementaryUplink = NULLP;
5300 srvCellCfg->pdcch_ServingCellConfig = NULLP;
5302 srvCellCfg->pdsch_ServingCellConfig = NULLP;
5303 DU_ALLOC(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct ServingCellConfig__pdsch_ServingCellConfig));
5304 if(!srvCellCfg->pdsch_ServingCellConfig)
5306 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
5310 if(BuildPdschSrvCellCfg(srvCellCfg->pdsch_ServingCellConfig) != ROK)
5312 DU_LOG("\nERROR --> F1AP : BuildPdschSrvCellCfg failed");
5316 srvCellCfg->csi_MeasConfig = NULLP;
5318 DU_ALLOC(srvCellCfg->csi_MeasConfig, sizeof(struct ServingCellConfig__csi_MeasConfig))
5319 if(!srvCellCfg->csi_MeasConfig)
5321 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
5325 if(BuildCsiMeasCfg(srvCellCfg->csi_MeasConfig) != ROK)
5327 DU_LOG("\nF1AP : BuildCsiMeasCfg failed");
5331 srvCellCfg->sCellDeactivationTimer = NULLP;
5332 srvCellCfg->crossCarrierSchedulingConfig = NULLP;
5333 srvCellCfg->tag_Id = TAG_ID;
5334 srvCellCfg->dummy = NULLP;
5335 srvCellCfg->pathlossReferenceLinking = NULLP;
5336 srvCellCfg->servingCellMO = NULLP;
5337 srvCellCfg->ext1 = NULLP;
5341 /*******************************************************************
5343 * @brief Builds Spcell config
5347 * Function : BuildSpCellCfg
5349 * Functionality: Builds sp cell config in DuToCuRrcContainer
5351 * @params[in] SpCellConfig_t spCellCfg
5353 * @return ROK - success
5356 * ****************************************************************/
5357 uint8_t BuildSpCellCfg(SpCellConfig_t *spCellCfg)
5360 spCellCfg->servCellIndex = NULLP;
5361 DU_ALLOC(spCellCfg->servCellIndex, sizeof(long));
5362 if(!spCellCfg->servCellIndex)
5364 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
5367 *(spCellCfg->servCellIndex) = SERV_CELL_IDX;
5369 spCellCfg->reconfigurationWithSync = NULLP;
5370 spCellCfg->rlf_TimersAndConstants = NULLP;
5371 spCellCfg->rlmInSyncOutOfSyncThreshold = NULLP;
5372 DU_ALLOC(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
5373 if(!spCellCfg->rlmInSyncOutOfSyncThreshold)
5375 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
5378 *(spCellCfg->rlmInSyncOutOfSyncThreshold) = RLM_SYNC_OUT_SYNC_THRESHOLD;
5380 spCellCfg->spCellConfigDedicated = NULLP;
5381 DU_ALLOC(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
5382 if(!spCellCfg->spCellConfigDedicated)
5384 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
5387 if(BuildSpCellCfgDed(spCellCfg->spCellConfigDedicated) != ROK)
5389 DU_LOG("\nERROR --> F1AP : BuildSpCellCfgDed failed");
5394 /*******************************************************************
5396 * @brief Builds Phy cell group config
5400 * Function : BuildPhyCellGrpCfg
5402 * Functionality: Builds Phy cell group config in DuToCuRrcContainer
5404 * @params[in] PhysicalCellGroupConfig_t *phyCellGrpCfg
5406 * @return ROK - success
5409 * ****************************************************************/
5410 uint8_t BuildPhyCellGrpCfg(PhysicalCellGroupConfig_t *phyCellGrpCfg)
5412 phyCellGrpCfg->harq_ACK_SpatialBundlingPUCCH = NULLP;
5413 phyCellGrpCfg->harq_ACK_SpatialBundlingPUSCH = NULLP;
5415 phyCellGrpCfg->p_NR_FR1 = NULLP;
5416 DU_ALLOC(phyCellGrpCfg->p_NR_FR1, sizeof(long));
5417 if(!phyCellGrpCfg->p_NR_FR1)
5419 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildPhyCellGrpCfg");
5422 *(phyCellGrpCfg->p_NR_FR1) = P_NR_FR1;
5423 phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = PDSCH_HARQ_ACK_CODEBOOK;
5424 phyCellGrpCfg->tpc_SRS_RNTI = NULLP;
5425 phyCellGrpCfg->tpc_PUCCH_RNTI = NULLP;
5426 phyCellGrpCfg->tpc_PUSCH_RNTI = NULLP;
5427 phyCellGrpCfg->sp_CSI_RNTI = NULLP;
5428 phyCellGrpCfg->cs_RNTI = NULLP;
5429 phyCellGrpCfg->ext1 = NULLP;
5430 phyCellGrpCfg->ext2 = NULLP;
5434 /*******************************************************************
5436 * @brief Builds Mac cell group config
5440 * Function : BuildMacCellGrpCfg
5442 * Functionality: Builds Mac cell group config in DuToCuRrcContainer
5444 * @params[in] MAC_CellGroupConfig_t *macCellGrpCfg
5446 * @return ROK - success
5449 * ****************************************************************/
5450 uint8_t BuildMacCellGrpCfg(MAC_CellGroupConfig_t *macCellGrpCfg)
5452 macCellGrpCfg->drx_Config = NULLP;
5453 macCellGrpCfg->schedulingRequestConfig = NULLP;
5454 DU_ALLOC(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
5455 if(!macCellGrpCfg->schedulingRequestConfig)
5457 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
5461 if(BuildSchedulingReqConfig(macCellGrpCfg->schedulingRequestConfig) != ROK)
5463 DU_LOG("\nERROR --> F1AP : BuildSchedulingReqConfig failed");
5467 macCellGrpCfg->bsr_Config = NULLP;
5468 DU_ALLOC(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
5469 if(!macCellGrpCfg->bsr_Config)
5471 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
5475 if(BuildBsrConfig(macCellGrpCfg->bsr_Config) != ROK)
5477 DU_LOG("\nERROR --> F1AP : BuildBsrConfig failed");
5481 macCellGrpCfg->tag_Config = NULLP;
5482 DU_ALLOC(macCellGrpCfg->tag_Config, sizeof(struct TAG_Config));
5483 if(!macCellGrpCfg->tag_Config)
5485 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
5489 if(BuildTagConfig(macCellGrpCfg->tag_Config) != ROK)
5491 DU_LOG("\nERROR --> F1AP : BuildTagConfig failed");
5495 macCellGrpCfg->phr_Config = NULLP;
5496 DU_ALLOC(macCellGrpCfg->phr_Config, sizeof(struct MAC_CellGroupConfig__phr_Config));
5497 if(!macCellGrpCfg->phr_Config)
5499 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
5503 if(BuildPhrConfig(macCellGrpCfg->phr_Config) != ROK)
5505 DU_LOG("\nERROR --> F1AP : BuildPhrConfig failed");
5509 macCellGrpCfg->skipUplinkTxDynamic = false;
5510 macCellGrpCfg->ext1 = NULLP;
5514 /*******************************************************************
5516 * @brief Frees memeory allocated for SearchSpcToAddModList
5520 * Function : FreeSearchSpcToAddModList
5522 * Functionality: Deallocating memory of SearchSpcToAddModList
5524 * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
5528 4221 * ****************************************************************/
5529 void FreeSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
5533 struct SearchSpace *searchSpc=NULLP;
5535 if(searchSpcList->list.array)
5537 if(searchSpcList->list.array[idx2])
5539 searchSpc = searchSpcList->list.array[idx2];
5540 if(searchSpc->controlResourceSetId)
5542 if(searchSpc->monitoringSlotPeriodicityAndOffset)
5544 if(searchSpc->monitoringSymbolsWithinSlot)
5546 if(searchSpc->monitoringSymbolsWithinSlot->buf)
5548 if(searchSpc->nrofCandidates)
5550 if(searchSpc->searchSpaceType)
5552 DU_FREE(searchSpc->searchSpaceType->choice.ue_Specific,\
5553 sizeof(struct SearchSpace__searchSpaceType__ue_Specific));
5554 DU_FREE(searchSpc->searchSpaceType, sizeof(struct
5555 SearchSpace__searchSpaceType));
5557 DU_FREE(searchSpc->nrofCandidates,
5558 sizeof(struct SearchSpace__nrofCandidates));
5560 DU_FREE(searchSpc->monitoringSymbolsWithinSlot->buf, \
5561 searchSpc->monitoringSymbolsWithinSlot->size);
5563 DU_FREE(searchSpc->monitoringSymbolsWithinSlot,
5564 sizeof(BIT_STRING_t));
5566 DU_FREE(searchSpc->monitoringSlotPeriodicityAndOffset, \
5567 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
5569 DU_FREE(searchSpc->controlResourceSetId,
5570 sizeof(ControlResourceSetId_t));
5573 for(idx1 = 0; idx1 < searchSpcList->list.count; idx1++)
5575 DU_FREE(searchSpcList->list.array[idx1],
5576 sizeof(struct SearchSpace));
5578 DU_FREE(searchSpcList->list.array,searchSpcList->list.size);
5581 /*******************************************************************
5583 * @brief Frees memory allocated for PdschTimeDomAllocList
5587 * Function : FreePdschTimeDomAllocList
5589 * Functionality: Deallocating memory of PdschTimeDomAllocList
5591 * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
5595 * ****************************************************************/
5596 void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
5600 if(timeDomAllocList->choice.setup)
5602 if(timeDomAllocList->choice.setup->list.array)
5604 for(idx1 = 0; idx1 <timeDomAllocList->choice.setup->list.count ; idx1++)
5606 DU_FREE(timeDomAllocList->choice.setup->list.array[idx1]->k0, sizeof(long));
5607 DU_FREE(timeDomAllocList->choice.setup->list.array[idx1],
5608 sizeof(struct PDSCH_TimeDomainResourceAllocation));
5610 DU_FREE(timeDomAllocList->choice.setup->list.array, \
5611 timeDomAllocList->choice.setup->list.size);
5613 DU_FREE(timeDomAllocList->choice.setup,\
5614 sizeof(struct PDSCH_TimeDomainResourceAllocationList));
5617 /*******************************************************************
5619 * @brief Frees memory allocated for PuschTimeDomAllocList
5623 * Function : FreePuschTimeDomAllocList
5625 * Functionality: Deallocating memory of PuschTimeDomAllocList
5627 * @params[in] PUSCH_Config_t *puschCfg
5631 * ****************************************************************/
5632 void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg)
5634 uint8_t rsrcListIdx=0;
5635 struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
5637 if(puschCfg->pusch_TimeDomainAllocationList)
5639 timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
5640 if(timeDomAllocList_t->choice.setup)
5642 if(timeDomAllocList_t->choice.setup->list.array)
5644 for(rsrcListIdx = 0; rsrcListIdx<timeDomAllocList_t->choice.setup->list.count; rsrcListIdx++)
5646 DU_FREE(timeDomAllocList_t->choice.setup->list.array[rsrcListIdx]->k2, sizeof(long));
5647 DU_FREE(timeDomAllocList_t->choice.setup->list.array[rsrcListIdx],\
5648 sizeof(PUSCH_TimeDomainResourceAllocation_t));
5650 DU_FREE(timeDomAllocList_t->choice.setup->list.array, \
5651 timeDomAllocList_t->choice.setup->list.size);
5653 DU_FREE(timeDomAllocList_t->choice.setup, \
5654 sizeof(struct PUSCH_TimeDomainResourceAllocationList));
5656 DU_FREE(puschCfg->transformPrecoder, sizeof(long));
5657 DU_FREE(puschCfg->pusch_TimeDomainAllocationList, \
5658 sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
5663 /*******************************************************************
5665 * @brief Frees memory allocated for Dedicated PUCCH config
5669 * Function : FreeBWPUlDedPucchCfg
5671 * Functionality: Deallocating memory of Dedicated PUCCH cfg
5673 * @params[in] BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg
5677 * ****************************************************************/
5678 void FreeBWPUlDedPucchCfg(struct BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg)
5680 uint8_t k1Idx, rsrcIdx, rsrcSetIdx;
5681 PUCCH_Config_t *pucchCfg = NULLP;
5682 PUCCH_ResourceSet_t *rsrcSet = NULLP;
5683 PUCCH_Resource_t *rsrc = NULLP;
5687 if(ulBwpPucchCfg->choice.setup)
5689 pucchCfg = ulBwpPucchCfg->choice.setup;
5691 //Free resource set list
5692 if(pucchCfg->resourceSetToAddModList)
5694 if(pucchCfg->resourceSetToAddModList->list.array)
5696 for(rsrcSetIdx=0; rsrcSetIdx < pucchCfg->resourceSetToAddModList->list.count; rsrcSetIdx++)
5698 rsrcSet = pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx];
5699 if(rsrcSet->resourceList.list.array)
5701 for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
5703 DU_FREE(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
5705 DU_FREE(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size);
5707 DU_FREE(pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t));
5709 DU_FREE(pucchCfg->resourceSetToAddModList->list.array, pucchCfg->resourceSetToAddModList->list.size);
5711 DU_FREE(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
5714 //Free resource list
5715 if(pucchCfg->resourceToAddModList)
5717 if(pucchCfg->resourceToAddModList->list.array)
5719 for(rsrcIdx=0; rsrcIdx < pucchCfg->resourceToAddModList->list.count; rsrcIdx++)
5721 rsrc = pucchCfg->resourceToAddModList->list.array[rsrcIdx];
5722 DU_FREE(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
5723 DU_FREE(pucchCfg->resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t));
5725 DU_FREE(pucchCfg->resourceToAddModList->list.array, pucchCfg->resourceToAddModList->list.size);
5727 DU_FREE(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
5731 if(pucchCfg->format1)
5733 if(pucchCfg->format1->choice.setup)
5735 DU_FREE(pucchCfg->format1->choice.setup->nrofSlots, sizeof(long));
5736 DU_FREE(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t));
5738 DU_FREE(pucchCfg->format1, sizeof(struct PUCCH_Config__format1));
5742 if(pucchCfg->dl_DataToUL_ACK)
5744 if(pucchCfg->dl_DataToUL_ACK->list.array)
5746 for(k1Idx = 0; k1Idx < pucchCfg->dl_DataToUL_ACK->list.count; k1Idx++)
5748 DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array[k1Idx], sizeof(long));
5750 DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size);
5752 DU_FREE(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
5755 DU_FREE(ulBwpPucchCfg->choice.setup, sizeof(PUCCH_Config_t));
5757 DU_FREE(ulBwpPucchCfg, sizeof(struct BWP_UplinkDedicated__pucch_Config));
5761 /*******************************************************************
5763 * @brief Frees memory allocated for InitialUlBWP
5767 * Function : FreeInitialUlBWP
5769 * Functionality: Deallocating memory of InitialUlBWP
5771 * @params[in] BWP_UplinkDedicated_t *ulBwp
5775 * ****************************************************************/
5776 void FreeInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
5778 uint8_t rSetIdx, rsrcIdx;
5779 SRS_Config_t *srsCfg = NULLP;
5780 PUSCH_Config_t *puschCfg = NULLP;
5781 struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
5782 struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
5783 struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
5784 struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
5786 FreeBWPUlDedPucchCfg(ulBwp->pucch_Config);
5788 if(ulBwp->pusch_Config)
5790 if(ulBwp->pusch_Config->choice.setup)
5792 puschCfg=ulBwp->pusch_Config->choice.setup;
5793 if(puschCfg->dataScramblingIdentityPUSCH)
5795 if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
5797 FreePuschTimeDomAllocList(puschCfg);
5798 dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
5799 if(dmrsUlCfg->choice.setup)
5801 if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
5803 if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
5805 DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
5807 DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled,
5808 sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
5810 DU_FREE(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition,
5813 DU_FREE(dmrsUlCfg->choice.setup,sizeof(DMRS_UplinkConfig_t));
5815 DU_FREE(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \
5816 sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
5818 DU_FREE(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
5820 DU_FREE(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
5822 DU_FREE(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
5824 /* Free SRS-Config */
5825 if(ulBwp->srs_Config)
5827 if(ulBwp->srs_Config->choice.setup)
5829 srsCfg = ulBwp->srs_Config->choice.setup;
5831 /* Free Resource Set to add/mod list */
5832 if(srsCfg->srs_ResourceSetToAddModList)
5834 rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
5835 if(rsrcSetList->list.array)
5839 /* Free SRS resource Id list in this SRS resource set */
5840 if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
5842 rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
5844 if(rsrcIdList->list.array)
5846 for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
5848 DU_FREE(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
5850 DU_FREE(rsrcIdList->list.array, rsrcIdList->list.size);
5852 DU_FREE(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
5853 sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
5856 /* Free resource type info for this SRS resource set */
5857 DU_FREE(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
5858 sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
5860 /* Free memory for each resource set */
5861 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
5863 DU_FREE(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
5865 DU_FREE(rsrcSetList->list.array, rsrcSetList->list.size);
5867 DU_FREE(srsCfg->srs_ResourceSetToAddModList, \
5868 sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
5871 /* Free resource to add/modd list */
5872 if(srsCfg->srs_ResourceToAddModList)
5874 resourceList = srsCfg->srs_ResourceToAddModList;
5875 if(resourceList->list.array)
5878 DU_FREE(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2,\
5879 sizeof(struct SRS_Resource__transmissionComb__n2));
5880 DU_FREE(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,\
5881 sizeof(struct SRS_Resource__resourceType__aperiodic));
5883 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
5885 DU_FREE(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
5887 DU_FREE(resourceList->list.array, resourceList->list.size);
5889 DU_FREE(srsCfg->srs_ResourceToAddModList, \
5890 sizeof(struct SRS_Config__srs_ResourceToAddModList));
5893 DU_FREE(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
5895 DU_FREE(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
5899 /*******************************************************************
5901 * @brief Frees memory allocated for initialUplinkBWP
5905 * Function : FreeinitialUplinkBWP
5907 * Functionality: Deallocating memory of initialUplinkBWP
5909 * @params[in] UplinkConfig_t *ulCfg
5914 * ****************************************************************/
5915 void FreeinitialUplinkBWP(UplinkConfig_t *ulCfg)
5917 BWP_UplinkDedicated_t *ulBwp=NULLP;
5918 struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
5920 if(ulCfg->initialUplinkBWP)
5922 ulBwp=ulCfg->initialUplinkBWP;
5923 if(ulCfg->firstActiveUplinkBWP_Id)
5925 if(ulCfg->pusch_ServingCellConfig)
5927 puschCfg=ulCfg->pusch_ServingCellConfig;
5928 if(puschCfg->choice.setup)
5930 if(puschCfg->choice.setup->ext1)
5932 DU_FREE(puschCfg->choice.setup->ext1->\
5933 processingType2Enabled,sizeof(BOOLEAN_t));
5934 DU_FREE(puschCfg->choice.setup->ext1->\
5935 maxMIMO_Layers,sizeof(long));
5936 DU_FREE(puschCfg->choice.setup->ext1, \
5937 sizeof(struct PUSCH_ServingCellConfig__ext1));
5939 DU_FREE(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
5941 DU_FREE(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig));
5943 DU_FREE(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
5945 FreeInitialUlBWP(ulBwp);
5946 DU_FREE(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
5949 /*******************************************************************
5951 * @brief Frees emmory allocated for BWPDlDedPdschCfg
5955 * Function : FreeBWPDlDedPdschCfg
5957 * Functionality: Deallocating memory of BWPDlDedPdschCfg
5959 * @params[in] BWP_DownlinkDedicated_t *dlBwp
5964 * ****************************************************************/
5965 void FreeBWPDlDedPdschCfg(BWP_DownlinkDedicated_t *dlBwp)
5967 struct PDSCH_Config *pdschCfg=NULLP;
5968 struct PDSCH_Config__prb_BundlingType *prbBndlType=NULLP;
5969 struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList=NULLP;
5970 struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg=NULLP;
5972 if(dlBwp->pdsch_Config->choice.setup)
5974 pdschCfg=dlBwp->pdsch_Config->choice.setup;
5975 if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
5977 if(pdschCfg->pdsch_TimeDomainAllocationList)
5979 timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
5980 if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
5982 prbBndlType=&pdschCfg->prb_BundlingType;
5983 DU_FREE(prbBndlType->choice.staticBundling,\
5984 sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
5985 DU_FREE(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
5987 FreePdschTimeDomAllocList(timeDomAllocList);
5988 DU_FREE(pdschCfg->pdsch_TimeDomainAllocationList, \
5989 sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
5991 dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
5992 if(dmrsDlCfg->choice.setup)
5994 DU_FREE(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition,
5996 DU_FREE(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
5998 DU_FREE(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, \
5999 sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
6001 DU_FREE(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
6004 /*******************************************************************
6006 * @brief Frees emmory allocated for BWPDlDedPdcchCfg
6010 * Function : FreeBWPDlDedPdcchCfg
6012 * Functionality: Deallocating memory of BWPDlDedPdcchCfg
6014 * @params[in] BWP_DownlinkDedicated_t *dlBwp
6019 * ****************************************************************/
6020 void FreeBWPDlDedPdcchCfg(BWP_DownlinkDedicated_t *dlBwp)
6024 struct PDCCH_Config *pdcchCfg=NULLP;
6025 struct ControlResourceSet *controlRSet=NULLP;
6026 struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList=NULLP;
6028 if(dlBwp->pdcch_Config->choice.setup)
6030 pdcchCfg=dlBwp->pdcch_Config->choice.setup;
6031 if(pdcchCfg->controlResourceSetToAddModList)
6033 controlRSetList = pdcchCfg->controlResourceSetToAddModList;
6034 if(controlRSetList->list.array)
6036 controlRSet = controlRSetList->list.array[idx2];
6039 if(controlRSet->frequencyDomainResources.buf)
6041 if(controlRSet->pdcch_DMRS_ScramblingID)
6043 if(pdcchCfg->searchSpacesToAddModList)
6045 FreeSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
6046 DU_FREE(pdcchCfg->searchSpacesToAddModList, \
6047 sizeof(struct PDCCH_Config__searchSpacesToAddModList));
6049 DU_FREE(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
6051 DU_FREE(controlRSet->frequencyDomainResources.buf, \
6052 controlRSet->frequencyDomainResources.size);
6055 for(idx1 = 0; idx1 <controlRSetList->list.count; idx1++)
6057 DU_FREE(controlRSetList->list.array[idx1], sizeof(struct ControlResourceSet));
6059 DU_FREE(controlRSetList->list.array, controlRSetList->list.size);
6061 DU_FREE(pdcchCfg->controlResourceSetToAddModList, \
6062 sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
6064 DU_FREE(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
6068 /*******************************************************************
6070 * @brief Frees emmory allocated for DUToCURRCContainer
6074 * Function : FreeMemDuToCuRrcCont
6076 * Functionality: Deallocating memory of DuToCuRrcContainer
6078 * @params[in] DuToCuRRCContainer, DuToCuRRCContainer
6080 * @return ROK - success
6083 * ****************************************************************/
6084 uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg)
6087 SpCellConfig_t *spCellCfg=NULLP;
6088 ServingCellConfig_t *srvCellCfg=NULLP;
6089 BWP_DownlinkDedicated_t *dlBwp=NULLP;
6090 MAC_CellGroupConfig_t *macCellGrpCfg=NULLP;
6091 PhysicalCellGroupConfig_t *phyCellGrpCfg=NULLP;
6092 struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList=NULLP;
6093 struct RLC_Config *rlcConfig=NULLP;
6094 struct LogicalChannelConfig *macLcConfig=NULLP;
6095 struct SchedulingRequestConfig *schedulingRequestConfig=NULLP;
6096 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList=NULLP;
6097 struct TAG_Config *tagConfig=NULLP;
6098 struct TAG_Config__tag_ToAddModList *tagList=NULLP;
6099 struct MAC_CellGroupConfig__phr_Config *phrConfig=NULLP;
6100 struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg=NULLP;
6102 rlcBearerList = cellGrpCfg->rlc_BearerToAddModList;
6105 if(rlcBearerList->list.array)
6107 for(idx=0; idx<rlcBearerList->list.count; idx++)
6109 if(rlcBearerList->list.array[idx])
6111 rlcConfig = rlcBearerList->list.array[idx]->rlc_Config;
6112 macLcConfig = rlcBearerList->list.array[idx]->mac_LogicalChannelConfig;
6115 if(rlcConfig->choice.am)
6117 DU_FREE(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
6118 DU_FREE(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
6119 DU_FREE(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
6121 DU_FREE(rlcConfig, sizeof(struct RLC_Config));
6123 DU_FREE(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
6126 if(macLcConfig->ul_SpecificParameters)
6128 DU_FREE(macLcConfig->ul_SpecificParameters->schedulingRequestID, sizeof(SchedulingRequestId_t));
6129 DU_FREE(macLcConfig->ul_SpecificParameters->logicalChannelGroup, sizeof(long));
6130 DU_FREE(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
6132 DU_FREE(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
6134 DU_FREE(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
6137 DU_FREE(rlcBearerList->list.array, rlcBearerList->list.size);
6139 DU_FREE(cellGrpCfg->rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
6142 macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig;
6145 schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig;
6146 if(schedulingRequestConfig)
6148 schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
6151 if(schReqList->list.array)
6153 for(idx=0;idx<schReqList->list.count; idx++)
6155 if(schReqList->list.array[idx])
6157 DU_FREE(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
6158 DU_FREE(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
6161 DU_FREE(schReqList->list.array, schReqList->list.size);
6163 DU_FREE(schedulingRequestConfig->schedulingRequestToAddModList,\
6164 sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList)); }
6165 DU_FREE(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
6167 if(macCellGrpCfg->bsr_Config)
6169 DU_FREE(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
6171 tagConfig = macCellGrpCfg->tag_Config;
6174 tagList = tagConfig->tag_ToAddModList;
6177 if(tagList->list.array)
6179 for(idx=0; idx<tagList->list.count; idx++)
6181 DU_FREE(tagList->list.array[idx], sizeof(struct TAG));
6183 DU_FREE(tagList->list.array, tagList->list.size);
6185 DU_FREE(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
6187 DU_FREE(tagConfig, sizeof(struct TAG_Config));
6190 phrConfig = macCellGrpCfg->phr_Config;
6193 DU_FREE(phrConfig->choice.setup, sizeof(struct PHR_Config));
6194 DU_FREE(phrConfig, sizeof(struct MAC_CellGroupConfig__phr_Config));
6197 DU_FREE(macCellGrpCfg, sizeof(MAC_CellGroupConfig_t));
6200 phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig;
6203 DU_FREE(phyCellGrpCfg->p_NR_FR1, sizeof(long));
6204 DU_FREE(phyCellGrpCfg, sizeof(PhysicalCellGroupConfig_t));
6207 spCellCfg = cellGrpCfg->spCellConfig;
6210 if(spCellCfg->servCellIndex)
6212 if(spCellCfg->rlmInSyncOutOfSyncThreshold)
6214 if(spCellCfg->spCellConfigDedicated)
6216 srvCellCfg = spCellCfg->spCellConfigDedicated;
6217 if(srvCellCfg->tdd_UL_DL_ConfigurationDedicated)
6219 if(srvCellCfg->initialDownlinkBWP)
6221 dlBwp = srvCellCfg->initialDownlinkBWP;
6222 if(srvCellCfg->firstActiveDownlinkBWP_Id)
6224 if(srvCellCfg->defaultDownlinkBWP_Id)
6226 if(srvCellCfg->uplinkConfig)
6228 if(srvCellCfg->pdsch_ServingCellConfig)
6230 pdschCfg= srvCellCfg->pdsch_ServingCellConfig;
6231 if(pdschCfg->choice.setup)
6233 DU_FREE(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH,sizeof(long));
6234 DU_FREE(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig));
6236 DU_FREE(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct
6237 ServingCellConfig__pdsch_ServingCellConfig));
6239 FreeinitialUplinkBWP(srvCellCfg->uplinkConfig);
6240 DU_FREE(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));
6242 DU_FREE(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
6244 DU_FREE(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
6246 if(dlBwp->pdcch_Config)
6248 if(dlBwp->pdsch_Config)
6250 FreeBWPDlDedPdschCfg(dlBwp);
6251 DU_FREE(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
6253 FreeBWPDlDedPdcchCfg(dlBwp);
6254 DU_FREE(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
6256 DU_FREE(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
6258 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t));
6260 DU_FREE(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
6262 DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
6264 DU_FREE(spCellCfg->servCellIndex, sizeof(long));
6266 DU_FREE(spCellCfg,sizeof(SpCellConfig_t));
6270 /*******************************************************************
6272 * @brief Builds DU To CU RRC Container
6276 * Function : BuildDuToCuRrcContainer
6278 * Functionality: Builds DuToCuRrcContainer
6280 * @params[in] idx, index in F1AP msg
6281 * DuToCuRRCContainer, DuToCuRRCContainer
6283 * @return ROK - success
6286 * ****************************************************************/
6287 uint8_t BuildDuToCuRrcContainer(DUtoCURRCContainer_t *duToCuRrcContainer)
6290 CellGroupConfigRrc_t cellGrpCfg;
6291 asn_enc_rval_t encRetVal;
6292 memset(&cellGrpCfg, 0, sizeof(CellGroupConfigRrc_t));
6293 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
6297 cellGrpCfg.cellGroupId = CELL_GRP_ID;
6299 cellGrpCfg.rlc_BearerToAddModList = NULLP;
6300 DU_ALLOC(cellGrpCfg.rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
6301 if(!cellGrpCfg.rlc_BearerToAddModList)
6303 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
6307 if(BuildRlcBearerToAddModList(cellGrpCfg.rlc_BearerToAddModList) != ROK)
6309 DU_LOG("\nERROR --> F1AP : BuildRlcBearerToAddModList failed");
6314 cellGrpCfg.rlc_BearerToReleaseList = NULLP;
6315 cellGrpCfg.mac_CellGroupConfig = NULLP;
6316 DU_ALLOC(cellGrpCfg.mac_CellGroupConfig, sizeof(MAC_CellGroupConfig_t));
6317 if(!cellGrpCfg.mac_CellGroupConfig)
6319 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
6323 if(BuildMacCellGrpCfg(cellGrpCfg.mac_CellGroupConfig) != ROK)
6325 DU_LOG("\nERROR --> F1AP : BuildMacCellGrpCfg failed");
6330 cellGrpCfg.physicalCellGroupConfig = NULLP;
6331 DU_ALLOC(cellGrpCfg.physicalCellGroupConfig, sizeof(PhysicalCellGroupConfig_t));
6332 if(!cellGrpCfg.physicalCellGroupConfig)
6334 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
6338 if(BuildPhyCellGrpCfg(cellGrpCfg.physicalCellGroupConfig) != ROK)
6340 DU_LOG("\nERROR --> F1AP : BuildPhyCellGrpCfg failed");
6345 cellGrpCfg.spCellConfig = NULLP;
6346 DU_ALLOC(cellGrpCfg.spCellConfig, sizeof(SpCellConfig_t));
6347 if(!cellGrpCfg.spCellConfig)
6349 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
6353 if(BuildSpCellCfg(cellGrpCfg.spCellConfig) != ROK)
6355 DU_LOG("\nERROR --> F1AP : BuildSpCellCfg failed");
6360 cellGrpCfg.sCellToAddModList = NULLP;
6361 cellGrpCfg.sCellToReleaseList = NULLP;
6362 cellGrpCfg.ext1 = NULLP;
6364 /* encode cellGrpCfg into duToCuRrcContainer */
6365 xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, &cellGrpCfg);
6366 memset(encBuf, 0, ENC_BUF_MAX_LEN);
6368 encRetVal = aper_encode(&asn_DEF_CellGroupConfigRrc, 0, &cellGrpCfg, PrepFinalEncBuf, encBuf);
6369 /* Encode results */
6370 if(encRetVal.encoded == ENCODE_FAIL)
6372 DU_LOG( "\nERROR --> F1AP : Could not encode DuToCuRrcContainer (at %s)\n",\
6373 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
6379 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for DuToCuRrcContainer\n");
6380 for(int i=0; i< encBufSize; i++)
6382 printf("%x",encBuf[i]);
6386 duToCuRrcContainer->size = encBufSize;
6387 DU_ALLOC(duToCuRrcContainer->buf, duToCuRrcContainer->size);
6388 if(!duToCuRrcContainer->buf)
6390 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDuToCuRrcContainer");
6396 memcpy(duToCuRrcContainer->buf, encBuf, duToCuRrcContainer->size);
6400 FreeMemDuToCuRrcCont(&cellGrpCfg);
6404 /*******************************************************************
6406 * @brief Free memory allocated in InitialULRRCMessage
6410 * Function : freeInitUlRrcMsgTransfer
6412 * Functionality: Free memory allocated in InitialULRRCMessage
6414 * @params[in]F1AP_PDU_t *f1apMsg)
6416 * @return ROK - success
6419 * ****************************************************************/
6421 uint8_t freeInitUlRrcMsgTransfer(F1AP_PDU_t *f1apMsg)
6423 uint8_t ieIdx, arrIdx;
6424 InitialULRRCMessageTransfer_t *initULRRCMsg=NULLP;
6428 if(f1apMsg->choice.initiatingMessage)
6430 initULRRCMsg = &f1apMsg->choice.initiatingMessage->value.\
6431 choice.InitialULRRCMessageTransfer;
6432 if(initULRRCMsg->protocolIEs.list.array)
6434 for(ieIdx = 0; ieIdx < initULRRCMsg->protocolIEs.list.count; ieIdx++)
6436 switch(initULRRCMsg->protocolIEs.list.array[ieIdx]->id)
6438 case ProtocolIE_ID_id_NRCGI:
6440 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.buf)
6442 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.buf)
6444 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.buf,\
6445 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.size);
6447 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.buf,\
6448 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.size);
6452 case ProtocolIE_ID_id_RRCContainer:
6454 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
6456 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,\
6457 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
6461 case ProtocolIE_ID_id_DUtoCURRCContainer:
6463 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.buf)
6465 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.buf,
6466 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.size);
6474 for(arrIdx = 0; arrIdx < ieIdx; arrIdx++)
6476 if(initULRRCMsg->protocolIEs.list.array[arrIdx])
6478 DU_FREE(initULRRCMsg->protocolIEs.list.array[arrIdx],\
6479 sizeof(InitialULRRCMessageTransferIEs_t));
6482 DU_FREE(initULRRCMsg->protocolIEs.list.array, initULRRCMsg->protocolIEs.list.size);
6484 DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
6486 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
6490 DU_LOG("\nERROR --> DU_APP : Recevied F1ap Pdu is null at freeInitUlRrcMsgTransfer()");
6496 /*******************************************************************
6498 * @brief Builds and sends the InitialULRRCMessage
6502 * Function : BuildAndSendInitialRrcMsgTransfer
6504 * Functionality: Constructs the Initial UL RRC Message Transfer and sends
6505 * it to the CU through SCTP.
6509 * @return ROK - success
6512 * ****************************************************************/
6513 uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti,
6514 uint16_t rrcContSize, uint8_t *rrcContainer)
6519 asn_enc_rval_t encRetVal;
6520 F1AP_PDU_t *f1apMsg = NULLP;
6521 InitialULRRCMessageTransfer_t *initULRRCMsg = NULLP;
6522 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
6526 DU_LOG("\n INFO --> F1AP : Building RRC Setup Request\n");
6527 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
6528 if(f1apMsg == NULLP)
6530 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
6533 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
6534 DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
6535 if(f1apMsg->choice.initiatingMessage == NULLP)
6537 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
6540 f1apMsg->choice.initiatingMessage->procedureCode =\
6541 ProcedureCode_id_InitialULRRCMessageTransfer;
6542 f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
6543 f1apMsg->choice.initiatingMessage->value.present = \
6544 InitiatingMessage__value_PR_InitialULRRCMessageTransfer;
6546 &f1apMsg->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer;
6548 initULRRCMsg->protocolIEs.list.count = elementCnt;
6549 initULRRCMsg->protocolIEs.list.size = \
6550 elementCnt * sizeof(InitialULRRCMessageTransferIEs_t *);
6551 /* Initialize the F1Setup members */
6552 DU_ALLOC(initULRRCMsg->protocolIEs.list.array,initULRRCMsg->protocolIEs.list.size);
6553 if(initULRRCMsg->protocolIEs.list.array == NULLP)
6555 DU_LOG(" ERROR --> F1AP : Memory allocation for\
6556 RRCSetupRequestMessageTransferIEs failed");
6559 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
6561 DU_ALLOC(initULRRCMsg->protocolIEs.list.array[ieIdx],\
6562 sizeof(InitialULRRCMessageTransferIEs_t));
6563 if(initULRRCMsg->protocolIEs.list.array[ieIdx] == NULLP)
6569 /*GNB DU UE F1AP ID*/
6570 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
6571 ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
6572 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
6573 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present = \
6574 InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
6575 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
6580 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
6581 ProtocolIE_ID_id_NRCGI;
6582 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
6583 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present = \
6584 InitialULRRCMessageTransferIEs__value_PR_NRCGI;
6587 BuildNrcgi(&initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI);
6595 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
6596 ProtocolIE_ID_id_C_RNTI;
6597 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
6598 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
6599 InitialULRRCMessageTransferIEs__value_PR_C_RNTI;
6600 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.C_RNTI = crnti;
6604 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
6605 ProtocolIE_ID_id_RRCContainer;
6606 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
6607 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
6608 InitialULRRCMessageTransferIEs__value_PR_RRCContainer;
6610 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size = rrcContSize;
6611 DU_ALLOC(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,
6612 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size)
6613 if(!initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
6615 DU_LOG(" ERROR --> F1AP : Memory allocation for RRCSetupRequestMessageTransferIEs failed");
6619 memcpy(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, rrcContainer,
6620 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
6623 /*DUtoCURRCContainer*/
6625 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DUtoCURRCContainer;
6626 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
6627 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
6628 InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer;
6630 ret = BuildDuToCuRrcContainer(&initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer);
6636 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
6638 /* Encode the F1SetupRequest type as APER */
6639 memset(encBuf, 0, ENC_BUF_MAX_LEN);
6641 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
6642 /* Encode results */
6643 if(encRetVal.encoded == ENCODE_FAIL)
6645 DU_LOG( "\nERROR --> F1AP : Could not encode Initial UL RRC Message Transfer\
6646 structure (at %s)\n",encRetVal.failed_type ? \
6647 encRetVal.failed_type->name : "unknown");
6654 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for Initial UL RRC\
6655 Message transfer\n");
6656 for(int i=0; i< encBufSize; i++)
6658 printf("%x",encBuf[i]);
6662 if(sendF1APMsg() != ROK)
6664 DU_LOG("\nERROR --> F1AP : Sending Initial UL RRC Message Transfer Failed");
6670 freeInitUlRrcMsgTransfer(f1apMsg);
6672 }/* End of BuildAndSendInitialRrcMsgTransfer*/
6674 /***** UE SETUP REQUEST *****/
6676 /*******************************************************************
6678 * @brief Free Qos And Snssai Drb Info
6682 * Function : freeDrbQosAndSnssaiInfo
6684 * Functionality: Free Qos And Snssai Drb Info
6686 * @params[in] LcCfg *lcCfg,
6689 * ****************************************************************/
6690 void freeDrbQosAndSnssaiInfo(LcCfg *lcCfg)
6694 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
6698 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
6702 /******************************************************************
6704 * @brief Function to delete the RLC Lc cfg from UE APP DB
6708 * Function : freeRlcLcCfg
6710 * Functionality: Function to delete the RLC Lc cfg from UE APP DB
6713 *****************************************************************/
6715 void freeRlcLcCfg(RlcBearerCfg *lcCfg)
6717 switch(lcCfg->rlcMode)
6723 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.amCfg, sizeof(AmBearerCfg));
6727 case RLC_UM_BI_DIRECTIONAL :
6729 if(lcCfg->u.umBiDirCfg)
6731 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
6735 case RLC_UM_UNI_DIRECTIONAL_UL :
6737 if(lcCfg->u.umUniDirUlCfg)
6739 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
6744 case RLC_UM_UNI_DIRECTIONAL_DL :
6746 if(lcCfg->u.umUniDirDlCfg)
6748 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
6753 DU_LOG("\nERROR --> DU_APP: Invalid Rlc Mode %d at freeRlcLcCfg()", lcCfg->rlcMode);
6756 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
6759 /*******************************************************************
6761 * @brief Function to free MacLcCfg
6765 * Function : freeMacLcCfg
6767 * Functionality: Function to free MacLcCfg
6769 * @params[in] LcCfg *lcCfg,
6772 * ****************************************************************/
6774 void freeMacLcCfg(LcCfg *lcCfg)
6776 /* Deleting DRBQOS */
6779 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
6781 /* Deleting SNSSAI */
6784 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
6787 /*******************************************************************
6789 * @brief Free UE NR Capability received in UE Context setup request
6793 * Function : freeAperDecodeUeNrCapability
6796 * Free UE NR Capability received in UE Context setup request
6799 * @return ROK - success
6802 * ****************************************************************/
6803 void freeAperDecodeUeNrCapability(void *ueNrCapability)
6806 FeatureSets_t *featureSets =NULLP;
6807 UE_NR_Capability_t *ueNrCap = (UE_NR_Capability_t *)ueNrCapability;
6809 if(ueNrCap->rf_Parameters.supportedBandListNR.list.array)
6811 for(arrIdx = 0; arrIdx < ueNrCap->rf_Parameters.supportedBandListNR.list.count; arrIdx++)
6813 if(ueNrCap->rf_Parameters.supportedBandListNR.list.array[arrIdx])
6814 free(ueNrCap->rf_Parameters.supportedBandListNR.list.array[arrIdx]);
6816 free(ueNrCap->rf_Parameters.supportedBandListNR.list.array);
6819 if(ueNrCap->featureSets)
6821 featureSets = ueNrCap->featureSets;
6822 if(featureSets->featureSetsDownlinkPerCC)
6824 if(featureSets->featureSetsDownlinkPerCC->list.array)
6826 for(arrIdx = 0; arrIdx < featureSets->featureSetsDownlinkPerCC->list.count; arrIdx++)
6828 if(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx])
6830 if(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]->supportedModulationOrderDL)
6831 free(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]->supportedModulationOrderDL);
6832 free(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]);
6835 free(featureSets->featureSetsDownlinkPerCC->list.array);
6837 free(featureSets->featureSetsDownlinkPerCC);
6839 if(featureSets->featureSetsUplinkPerCC)
6841 if(featureSets->featureSetsUplinkPerCC->list.array)
6843 for(arrIdx = 0; arrIdx < featureSets->featureSetsUplinkPerCC->list.count; arrIdx++)
6845 if(featureSets->featureSetsUplinkPerCC->list.array[arrIdx])
6847 if(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]->supportedModulationOrderUL)
6848 free(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]->supportedModulationOrderUL);
6849 free(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]);
6852 free(featureSets->featureSetsUplinkPerCC->list.array);
6854 free(featureSets->featureSetsUplinkPerCC);
6856 free(ueNrCap->featureSets);
6860 /*******************************************************************
6862 * @brief Function to free PdcchSearchSpcToAddModList
6863 where memory allocated by aper_decoder
6867 * Function : freeAperDecodePdcchSearchSpcToAddModList
6869 * Functionality: Function to free PdcchSearchSpcToAddModList
6871 * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
6874 * ****************************************************************/
6876 void freeAperDecodePdcchSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
6878 uint8_t searchSpcArrIdx=0;
6879 uint8_t searchSpcArrIdx1=0;
6880 struct SearchSpace *searchSpc=NULLP;
6883 if(searchSpcList->list.array)
6885 if(searchSpcList->list.array[searchSpcArrIdx1])
6887 searchSpc = searchSpcList->list.array[searchSpcArrIdx1];
6888 if(searchSpc->controlResourceSetId)
6890 if(searchSpc->monitoringSlotPeriodicityAndOffset)
6892 if(searchSpc->monitoringSymbolsWithinSlot)
6894 if(searchSpc->monitoringSymbolsWithinSlot->buf)
6896 if(searchSpc->nrofCandidates)
6898 if(searchSpc->searchSpaceType)
6900 free(searchSpc->searchSpaceType->choice.ue_Specific);
6901 free(searchSpc->searchSpaceType);
6903 free(searchSpc->nrofCandidates);
6905 free(searchSpc->monitoringSymbolsWithinSlot->buf);
6907 free(searchSpc->monitoringSymbolsWithinSlot);
6909 free(searchSpc->monitoringSlotPeriodicityAndOffset);
6911 free(searchSpc->controlResourceSetId);
6914 for(searchSpcArrIdx = 0; searchSpcArrIdx < searchSpcList->list.count; searchSpcArrIdx++)
6916 free(searchSpcList->list.array[searchSpcArrIdx]);
6918 free(searchSpcList->list.array);
6921 /*******************************************************************
6923 * @brief Function for free part for the memory allocated by aper_decoder
6927 * Function : freeAperDecodeBWPDlDedPdcchConfig
6929 * Functionality: Function to free BWPDlDedPdcchConfig
6934 * ****************************************************************/
6937 void freeAperDecodeBWPDlDedPdcchConfig(BWP_DownlinkDedicated_t *dlBwp)
6941 struct PDCCH_Config *pdcchCfg=NULLP;
6942 struct ControlResourceSet *controlRSet=NULLP;
6943 struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList=NULLP;
6945 if(dlBwp->pdcch_Config->choice.setup)
6947 pdcchCfg=dlBwp->pdcch_Config->choice.setup;
6948 if(pdcchCfg->controlResourceSetToAddModList)
6950 controlRSetList = pdcchCfg->controlResourceSetToAddModList;
6951 if(controlRSetList->list.array)
6953 controlRSet = controlRSetList->list.array[arrIdx2];
6956 if(controlRSet->frequencyDomainResources.buf)
6958 if(controlRSet->pdcch_DMRS_ScramblingID)
6960 if(pdcchCfg->searchSpacesToAddModList)
6962 freeAperDecodePdcchSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
6963 free(pdcchCfg->searchSpacesToAddModList);
6965 free(controlRSet->pdcch_DMRS_ScramblingID);
6967 free(controlRSet->frequencyDomainResources.buf);
6970 for(arrIdx1 = 0; arrIdx1 <controlRSetList->list.count; arrIdx1++)
6972 free(controlRSetList->list.array[arrIdx1]);
6974 free(controlRSetList->list.array);
6976 free(pdcchCfg->controlResourceSetToAddModList);
6978 free(dlBwp->pdcch_Config->choice.setup);
6981 /*******************************************************************
6983 * @brief Function to free PdschTimeDomAllocationList
6984 * where the memory allocated by aper_decoder
6988 * Function : freeAperDecodePdschTimeDomAllocationList
6990 * Functionality: Function to free PdschTimeDomAllocationList
6992 * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
6995 * ****************************************************************/
6998 void freeAperDecodePdschTimeDomAllocationList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
7002 if(timeDomAllocList->choice.setup)
7004 if(timeDomAllocList->choice.setup->list.array)
7006 for(arrIdx = 0; arrIdx <timeDomAllocList->choice.setup->list.count ; arrIdx++)
7008 free(timeDomAllocList->choice.setup->list.array[arrIdx]);
7010 free(timeDomAllocList->choice.setup->list.array);
7012 free(timeDomAllocList->choice.setup);
7016 /*******************************************************************
7018 * @brief Function to free BWPDlDedPdschConfig
7019 * where the memory allocated by aper_decoder
7023 * Function : freeAperDecodeBWPDlDedPdschConfig
7025 * Functionality: Function to free BWPDlDedPdschConfig
7027 * @params[in] BWP_DownlinkDedicated_t *dlBwp
7030 * ****************************************************************/
7033 void freeAperDecodeBWPDlDedPdschConfig(BWP_DownlinkDedicated_t *dlBwp)
7035 struct PDSCH_Config *pdschCfg=NULLP;
7036 struct PDSCH_Config__prb_BundlingType *prbBndlType=NULLP;
7037 struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList=NULLP;
7038 struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg=NULLP;
7040 if(dlBwp->pdsch_Config->choice.setup)
7042 pdschCfg=dlBwp->pdsch_Config->choice.setup;
7043 if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
7045 if(pdschCfg->pdsch_TimeDomainAllocationList)
7047 timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
7048 if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
7050 prbBndlType=&pdschCfg->prb_BundlingType;
7051 free(prbBndlType->choice.staticBundling);
7052 free(pdschCfg->maxNrofCodeWordsScheduledByDCI);
7054 freeAperDecodePdschTimeDomAllocationList(timeDomAllocList);
7055 free(pdschCfg->pdsch_TimeDomainAllocationList);
7057 dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
7058 if(dmrsDlCfg->choice.setup)
7060 free(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition);
7061 free(dmrsDlCfg->choice.setup);
7063 free(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA);
7065 free(dlBwp->pdsch_Config->choice.setup);
7068 /*******************************************************************
7070 * @brief Function to free PuschTimeDomAllocListCfg
7071 where the memory allocated by aper_decoder
7075 * Function : freeAperDecodePuschTimeDomAllocListCfg
7077 * Functionality: Function to free PuschTimeDomAllocListCfg
7079 * @params[in] PUSCH_Config_t *puschCfg
7082 * ****************************************************************/
7085 void freeAperDecodePuschTimeDomAllocListCfg(PUSCH_Config_t *puschCfg)
7089 struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
7091 if(puschCfg->pusch_TimeDomainAllocationList)
7093 timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
7094 if(timeDomAllocList_t->choice.setup)
7096 if(timeDomAllocList_t->choice.setup->list.array)
7098 free(timeDomAllocList_t->choice.setup->list.array[arrIdx1]->k2);
7099 for(arrIdx = 0; arrIdx<timeDomAllocList_t->choice.setup->list.count; arrIdx++)
7101 free(timeDomAllocList_t->choice.setup->list.array[arrIdx]);
7103 free(timeDomAllocList_t->choice.setup->list.array);
7105 free(timeDomAllocList_t->choice.setup);
7107 free(puschCfg->transformPrecoder);
7108 free(puschCfg->pusch_TimeDomainAllocationList);
7111 /*******************************************************************
7113 * @brief Function to free InitialUlBWPConfig where memory allocated by aper_decoder
7117 * Function : freeAperDecodeInitialUlBWPConfig
7119 * Functionality: Function to free InitialUlBWPConfig
7121 * @params[in] BWP_UplinkDedicated_t *ulBwp
7124 * ****************************************************************/
7127 void freeAperDecodeInitialUlBWPConfig(BWP_UplinkDedicated_t *ulBwp)
7131 SRS_Config_t *srsCfg = NULLP;
7132 PUSCH_Config_t *puschCfg = NULLP;
7133 struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
7134 struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
7135 struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
7136 struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
7138 if(ulBwp->pusch_Config)
7140 if(ulBwp->pusch_Config->choice.setup)
7142 puschCfg=ulBwp->pusch_Config->choice.setup;
7143 if(puschCfg->dataScramblingIdentityPUSCH)
7145 if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
7147 freeAperDecodePuschTimeDomAllocListCfg(puschCfg);
7148 dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
7149 if(dmrsUlCfg->choice.setup)
7151 if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
7153 if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
7155 free(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0);
7156 free(dmrsUlCfg->choice.setup->transformPrecodingDisabled);
7158 free(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition);
7160 free(dmrsUlCfg->choice.setup);
7162 free(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA);
7164 free(puschCfg->dataScramblingIdentityPUSCH);
7166 free(ulBwp->pusch_Config->choice.setup);
7168 free(ulBwp->pusch_Config);
7170 /* Free SRS-Config */
7171 if(ulBwp->srs_Config)
7173 if(ulBwp->srs_Config->choice.setup)
7175 srsCfg = ulBwp->srs_Config->choice.setup;
7177 /* Free Resource Set to add/mod list */
7178 if(srsCfg->srs_ResourceSetToAddModList)
7180 rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
7181 if(rsrcSetList->list.array)
7185 /* Free SRS resource Id list in this SRS resource set */
7186 if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
7189 rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
7191 if(rsrcIdList->list.array)
7193 for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count;
7196 free(rsrcIdList->list.array[rsrcIdx]);
7198 free(rsrcIdList->list.array);
7200 free(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList);
7203 /* Free resource type info for this SRS resource set */
7205 free(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic);
7207 /* Free memory for each resource set */
7208 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
7210 free(rsrcSetList->list.array[rSetIdx]);
7212 free(rsrcSetList->list.array);
7214 free(srsCfg->srs_ResourceSetToAddModList);
7217 /* Free resource to add/modd list */
7218 if(srsCfg->srs_ResourceToAddModList)
7220 resourceList = srsCfg->srs_ResourceToAddModList;
7221 if(resourceList->list.array)
7225 free(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2);
7226 free(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic);
7228 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
7230 free(resourceList->list.array[rsrcIdx]);
7232 free(resourceList->list.array);
7234 free(srsCfg->srs_ResourceToAddModList);
7237 free(ulBwp->srs_Config->choice.setup);
7239 free(ulBwp->srs_Config);
7243 /*******************************************************************
7245 * @brief Function to free initialUplinkBWPConfig where memory allocated by aper_decoder
7249 * Function : freeAperDecodeinitialUplinkBWPConfig
7251 * Functionality: Function to free initialUplinkBWPConfig
7253 * @params[in] UplinkConfig_t *ulCfg
7256 * ****************************************************************/
7259 void freeAperDecodeinitialUplinkBWPConfig(UplinkConfig_t *ulCfg)
7261 BWP_UplinkDedicated_t *ulBwp=NULLP;
7262 struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
7264 if(ulCfg->initialUplinkBWP)
7266 ulBwp=ulCfg->initialUplinkBWP;
7267 if(ulCfg->firstActiveUplinkBWP_Id)
7269 if(ulCfg->pusch_ServingCellConfig)
7271 puschCfg=ulCfg->pusch_ServingCellConfig;
7272 if(puschCfg->choice.setup)
7274 if(puschCfg->choice.setup->ext1)
7276 free(puschCfg->choice.setup->ext1->processingType2Enabled);
7277 free(puschCfg->choice.setup->ext1->maxMIMO_Layers);
7278 free(puschCfg->choice.setup->ext1);
7280 free(puschCfg->choice.setup);
7282 free(ulCfg->pusch_ServingCellConfig);
7284 free(ulCfg->firstActiveUplinkBWP_Id);
7286 freeAperDecodeInitialUlBWPConfig(ulBwp);
7287 free(ulCfg->initialUplinkBWP);
7291 /*******************************************************************
7293 * @brief Function to free DuUeCfg
7297 * Function : freeDuUeCfg
7299 * Functionality: Function to free DuUeCfg
7301 * @params[in] DuUeCfg *ueCfg
7304 * ****************************************************************/
7305 void freeDuUeCfg(DuUeCfg *ueCfg)
7309 SpCellConfig_t *spCellCfg = NULLP;
7310 ServingCellConfig_t *srvCellCfg = NULLP;
7311 BWP_DownlinkDedicated_t *dlBwp = NULLP;
7312 MAC_CellGroupConfig_t *macCellGrpCfg = NULLP;
7313 PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP;
7314 struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList = NULLP;
7315 struct RLC_Config *rlcConfig = NULLP;
7316 struct LogicalChannelConfig *macLcConfig = NULLP;
7317 struct SchedulingRequestConfig *schedulingRequestConfig = NULLP;
7318 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList = NULLP;
7319 struct TAG_Config *tagConfig = NULLP;
7320 struct TAG_Config__tag_ToAddModList *tagList = NULLP;
7321 struct MAC_CellGroupConfig__phr_Config *phrConfig = NULLP;
7322 struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg = NULLP;
7323 CellGroupConfigRrc_t *cellGrpCfg = ueCfg->cellGrpCfg;
7325 if(ueCfg->ueNrCapability)
7327 freeAperDecodeUeNrCapability(ueCfg->ueNrCapability);
7328 DU_FREE(ueCfg->ueNrCapability, sizeof(UE_NR_Capability_t));
7329 ueCfg->ueNrCapability = NULLP;
7332 if(ueCfg->cellGrpCfg)
7335 rlcBearerList = cellGrpCfg->rlc_BearerToAddModList;
7338 if(rlcBearerList->list.array)
7340 for(arrIdx=0; arrIdx<rlcBearerList->list.count; arrIdx++)
7342 if(rlcBearerList->list.array[arrIdx])
7344 rlcConfig = rlcBearerList->list.array[arrIdx]->rlc_Config;
7345 macLcConfig = rlcBearerList->list.array[arrIdx]->mac_LogicalChannelConfig;
7347 if(rlcBearerList->list.array[arrIdx]->servedRadioBearer)
7349 free(rlcBearerList->list.array[arrIdx]->servedRadioBearer);
7353 if(rlcConfig->choice.am)
7355 free(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength);
7356 free(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength);
7357 free(rlcConfig->choice.am);
7359 free(rlcBearerList->list.array[arrIdx]->rlc_Config);
7363 if(macLcConfig->ul_SpecificParameters)
7365 free(macLcConfig->ul_SpecificParameters->schedulingRequestID);
7366 free(macLcConfig->ul_SpecificParameters->logicalChannelGroup);
7367 free(macLcConfig->ul_SpecificParameters);
7369 free(rlcBearerList->list.array[arrIdx]->mac_LogicalChannelConfig);
7371 free(rlcBearerList->list.array[arrIdx]);
7374 free(rlcBearerList->list.array);
7376 free(cellGrpCfg->rlc_BearerToAddModList);
7379 macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig;
7382 schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig;
7383 if(schedulingRequestConfig)
7385 schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
7388 if(schReqList->list.array)
7390 for(arrIdx=0;arrIdx<schReqList->list.count; arrIdx++)
7392 if(schReqList->list.array[arrIdx])
7394 free(schReqList->list.array[arrIdx]->sr_ProhibitTimer);
7395 free(schReqList->list.array[arrIdx]);
7398 free(schReqList->list.array);
7400 free(schedulingRequestConfig->schedulingRequestToAddModList);
7402 free(macCellGrpCfg->schedulingRequestConfig);
7404 if(macCellGrpCfg->bsr_Config)
7406 free(macCellGrpCfg->bsr_Config);
7408 tagConfig = macCellGrpCfg->tag_Config;
7411 tagList = tagConfig->tag_ToAddModList;
7414 if(tagList->list.array)
7416 for(arrIdx=0; arrIdx<tagList->list.count; arrIdx++)
7418 free(tagList->list.array[arrIdx]);
7420 free(tagList->list.array);
7422 free(tagConfig->tag_ToAddModList);
7427 phrConfig = macCellGrpCfg->phr_Config;
7430 free(phrConfig->choice.setup);
7434 free(macCellGrpCfg);
7437 phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig;
7440 free(phyCellGrpCfg->p_NR_FR1);
7441 free(phyCellGrpCfg);
7444 spCellCfg = cellGrpCfg->spCellConfig;
7447 if(spCellCfg->servCellIndex)
7449 if(spCellCfg->rlmInSyncOutOfSyncThreshold)
7451 if(spCellCfg->spCellConfigDedicated)
7453 srvCellCfg = spCellCfg->spCellConfigDedicated;
7454 if(srvCellCfg->initialDownlinkBWP)
7456 dlBwp = srvCellCfg->initialDownlinkBWP;
7457 if(srvCellCfg->firstActiveDownlinkBWP_Id)
7459 if(srvCellCfg->defaultDownlinkBWP_Id)
7461 if(srvCellCfg->uplinkConfig)
7464 if(srvCellCfg->pdsch_ServingCellConfig)
7467 srvCellCfg->pdsch_ServingCellConfig;
7468 if(pdschCfg->choice.setup)
7471 free(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH);
7472 free(pdschCfg->choice.setup);
7475 free(srvCellCfg->pdsch_ServingCellConfig);
7478 freeAperDecodeinitialUplinkBWPConfig(srvCellCfg->uplinkConfig);
7479 free(srvCellCfg->uplinkConfig);
7481 free(srvCellCfg->defaultDownlinkBWP_Id);
7484 free(srvCellCfg->firstActiveDownlinkBWP_Id);
7486 if(dlBwp->pdcch_Config)
7488 if(dlBwp->pdsch_Config)
7490 freeAperDecodeBWPDlDedPdschConfig(dlBwp);
7491 free(dlBwp->pdsch_Config);
7493 freeAperDecodeBWPDlDedPdcchConfig(dlBwp);
7494 free(dlBwp->pdcch_Config);
7496 free(srvCellCfg->initialDownlinkBWP);
7499 free(spCellCfg->spCellConfigDedicated);
7501 free(spCellCfg->rlmInSyncOutOfSyncThreshold);
7503 free(spCellCfg->servCellIndex);
7507 DU_FREE(ueCfg->cellGrpCfg, sizeof(CellGroupConfigRrc_t));
7508 ueCfg->cellGrpCfg = NULLP;
7512 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCfg->ambrCfg, sizeof(AmbrCfg));
7514 for(lcIdx = 0; lcIdx < ueCfg->numRlcLcs; lcIdx++)
7516 freeRlcLcCfg(&ueCfg->rlcLcCfg[lcIdx]);
7518 for(lcIdx = 0; lcIdx < ueCfg->numMacLcs; lcIdx++)
7520 freeMacLcCfg(&ueCfg->macLcCfg[lcIdx]);
7522 for(lcIdx = 0; lcIdx < ueCfg->numDrb; lcIdx++)
7524 DU_FREE(ueCfg->upTnlInfo[lcIdx].tnlCfg1, sizeof(GtpTnlCfg));
7528 /*******************************************************************
7530 * @brief Function to free UecontextSetupDb
7534 * Function : freeF1UeDb
7536 * Functionality: Function to free UecontextSetupDb
7538 * @params[in] UecontextSetupDb *
7541 * ****************************************************************/
7543 void freeF1UeDb(F1UeContextSetupDb *f1UeDb)
7546 if(f1UeDb->dlRrcMsg)
7548 if(f1UeDb->dlRrcMsg->rrcMsgPdu)
7550 //DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,\
7551 f1UeDb->dlRrcMsg->rrcMsgPdu, f1UeDb->dlRrcMsg->rrcMsgSize);
7553 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
7555 freeDuUeCfg(&f1UeDb->duUeCfg);
7556 memset(f1UeDb, 0, sizeof(F1UeContextSetupDb));
7557 DU_FREE(f1UeDb, sizeof(F1UeContextSetupDb));
7560 /*******************************************************************
7562 * @brief Function to build Am cfg Info
7566 * Function : extractRlcAmCfg
7568 * Functionality: Function to build Am cfg Info
7570 * @params[in] AmBearerCfg *
7573 * @return ROK/RFAILED
7575 * ****************************************************************/
7577 void extractRlcAmCfg(AmBearerCfg *amCfgToSet, struct RLC_Config__am *rlcAmCfg)
7582 if(rlcAmCfg->dl_AM_RLC.sn_FieldLength)
7584 amCfgToSet->ulAmCfg.snLenUl = *(rlcAmCfg->dl_AM_RLC.sn_FieldLength);
7585 /*TODO: Check the timer value when sent by real CU */
7586 amCfgToSet->ulAmCfg.reAssemTmr = rlcAmCfg->dl_AM_RLC.t_Reassembly;
7587 amCfgToSet->ulAmCfg.statProhTmr = rlcAmCfg->dl_AM_RLC.t_StatusProhibit;
7591 if(rlcAmCfg->ul_AM_RLC.sn_FieldLength)
7593 amCfgToSet->dlAmCfg.snLenDl = *(rlcAmCfg->ul_AM_RLC.sn_FieldLength);
7594 amCfgToSet->dlAmCfg.pollRetxTmr = rlcAmCfg->ul_AM_RLC.t_PollRetransmit;
7595 amCfgToSet->dlAmCfg.pollPdu = rlcAmCfg->ul_AM_RLC.pollPDU;
7596 amCfgToSet->dlAmCfg.pollByte = rlcAmCfg->ul_AM_RLC.pollByte;
7597 amCfgToSet->dlAmCfg.maxRetxTh = rlcAmCfg->ul_AM_RLC.maxRetxThreshold;
7602 /*******************************************************************
7604 * @brief Function to build Um Bi Info
7608 * Function : extractRlcUmBiCfg
7610 * Functionality: Function to build Um Bi Info
7612 * @params[in] UmBiDirBearerCfg *
7615 * @return ROK/RFAILED
7617 * ****************************************************************/
7619 void extractRlcUmBiCfg(UmBiDirBearerCfg *umBiCfgToSet, struct RLC_Config__um_Bi_Directional *rlcBiCfg)
7623 /* UL UM BI DIR Cfg */
7624 if(rlcBiCfg->dl_UM_RLC.sn_FieldLength)
7626 umBiCfgToSet->ulUmCfg.snLenUlUm = *(rlcBiCfg->dl_UM_RLC.sn_FieldLength);
7627 umBiCfgToSet->ulUmCfg.reAssemTmr = rlcBiCfg->dl_UM_RLC.t_Reassembly;
7630 /* DL UM BI DIR Cfg */
7631 if(rlcBiCfg->ul_UM_RLC.sn_FieldLength)
7632 umBiCfgToSet->dlUmCfg.snLenDlUm = *(rlcBiCfg->ul_UM_RLC.sn_FieldLength);
7636 /*******************************************************************
7638 * @brief Function to build Um Ul Info
7642 * Function : extractRlcUmUlCfg
7644 * Functionality: Function to build Um Ul Info
7646 * @params[in] UmUniDirUlBearerCfg *
7649 * @return ROK/RFAILED
7651 * ****************************************************************/
7653 void extractRlcUmUlCfg(UmUniDirUlBearerCfg *umUlCfgToSet, struct RLC_Config__um_Uni_Directional_DL *umUlCfg)
7657 if(umUlCfg->dl_UM_RLC.sn_FieldLength)
7659 umUlCfgToSet->ulUmCfg.snLenUlUm = *(umUlCfg->dl_UM_RLC.sn_FieldLength);
7660 umUlCfgToSet->ulUmCfg.reAssemTmr = umUlCfg->dl_UM_RLC.t_Reassembly;
7665 /*******************************************************************
7667 * @brief Function to build Um Uni Dl Info
7671 * Function : extractRlcUmDlCfg
7673 * Functionality: Function to build Um Uni Dl Info
7675 * @params[in] UmUniDirDlBearerCfg *
7678 * @return ROK/RFAILED
7680 * ****************************************************************/
7681 void extractRlcUmDlCfg(UmUniDirDlBearerCfg *umDlCfgToSet, struct RLC_Config__um_Uni_Directional_UL *umDlCfg)
7685 if(umDlCfg->ul_UM_RLC.sn_FieldLength)
7686 umDlCfgToSet->dlUmCfg.snLenDlUm = *(umDlCfg->ul_UM_RLC.sn_FieldLength);
7690 /*******************************************************************
7692 * @brief Function to extractRlcModeCfg
7696 * Function : extractRlcModeCfg
7698 * Functionality: Function to extractRlcModeCfg
7700 * @params[in] RLC_Config_t *
7703 * @return ROK/RFAILED
7705 * ****************************************************************/
7706 void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lcCfg)
7714 if(lcCfg->choice.am)
7716 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.amCfg, sizeof(AmBearerCfg));
7717 if(rlcDbCfg->u.amCfg)
7718 extractRlcAmCfg(rlcDbCfg->u.amCfg, lcCfg->choice.am);
7722 case RLC_UM_BI_DIRECTIONAL :
7724 if(lcCfg->choice.um_Bi_Directional)
7726 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
7727 if(rlcDbCfg->u.umBiDirCfg)
7728 extractRlcUmBiCfg(rlcDbCfg->u.umBiDirCfg, lcCfg->choice.um_Bi_Directional);
7732 case RLC_UM_UNI_DIRECTIONAL_UL :
7734 if(lcCfg->choice.um_Uni_Directional_DL)
7736 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
7737 if(rlcDbCfg->u.umUniDirUlCfg)
7738 extractRlcUmUlCfg(rlcDbCfg->u.umUniDirUlCfg, lcCfg->choice.um_Uni_Directional_DL);
7742 case RLC_UM_UNI_DIRECTIONAL_DL :
7744 if(lcCfg->choice.um_Uni_Directional_UL)
7746 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
7747 if(rlcDbCfg->u.umUniDirDlCfg)
7748 extractRlcUmDlCfg(rlcDbCfg->u.umUniDirDlCfg, lcCfg->choice.um_Uni_Directional_UL);
7753 DU_LOG("\nERROR --> DUAPP: Invalid rlcMode %d at extractRlcCfgToAddMod()", rlcMode);
7759 /*******************************************************************
7761 * @brief Function to extract extractUlLcCfg
7765 * Function : extractUlLcCfg
7767 * Functionality: Function to extract extractUlLcCfg
7769 * @params[in] UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg
7772 * ****************************************************************/
7774 void extractUlLcCfg(UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg)
7778 if(ulLcCfg->ul_SpecificParameters)
7780 f1UlLcCfg->priority = \
7781 ulLcCfg->ul_SpecificParameters->priority;
7782 if(ulLcCfg->ul_SpecificParameters->logicalChannelGroup)
7784 f1UlLcCfg->lcGroup = \
7785 *(ulLcCfg->ul_SpecificParameters->logicalChannelGroup);
7787 if(ulLcCfg->ul_SpecificParameters->schedulingRequestID)
7789 f1UlLcCfg->schReqId = \
7790 *(ulLcCfg->ul_SpecificParameters->schedulingRequestID);
7793 ulLcCfg->ul_SpecificParameters->prioritisedBitRate;
7795 ulLcCfg->ul_SpecificParameters->bucketSizeDuration;
7800 /*******************************************************************
7802 * @brief Function to extract Snssai Cfg Info from CU
7806 * Function : extractDrbSnssaiCfg
7808 * Functionality: Function to extract Drb Snssai Cfg Info from CU
7810 * @params[in] DRB_Information_t *drbInfo, Snssai *snssai
7811 * @return ROK/RFAILED
7813 * ****************************************************************/
7815 uint8_t extractDrbSnssaiCfg(SNSSAI_t *RecvSnssai, Snssai **snssaiToBeShared)
7817 if(!(*snssaiToBeShared))
7819 DU_ALLOC_SHRABL_BUF((*snssaiToBeShared), sizeof(Snssai));
7820 if(snssaiToBeShared == NULLP)
7822 DU_LOG("\nERROR --> DUAPP : extractDrbSnssaiCfg(): Memory failed at allocating for SNSSAI ");
7828 memcpy(&(*snssaiToBeShared)->sst, RecvSnssai->sST.buf, RecvSnssai->sST.size);
7831 memcpy((*snssaiToBeShared)->sd, RecvSnssai->sD->buf, RecvSnssai->sD->size);
7835 DU_LOG("\nERROR --> DUAPP : extractDrbSnssaiCfg(): Received Null pointer of Snssai->SD");
7842 /*******************************************************************
7844 * @brief Function to procRlcLcCfg
7848 * Function : procRlcLcCfg
7850 * Functionality: Function to procRlcLcCfg
7852 * @params[in] rbId, lcId, rbType, rlcMod
7853 * RLC_Config_t *, RlcBearerCfg * ,
7856 * ****************************************************************/
7858 void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\
7859 uint8_t configType, RLC_Config_t *f1RlcCfg, RlcBearerCfg *lcCfg, QoSInformation_t *qoSInformation)
7861 DRB_Information_t *drbInfo;
7864 lcCfg->configType = configType;
7866 if(rbType == RB_TYPE_SRB)
7868 lcCfg->rbType = RB_TYPE_SRB;
7870 lcCfg->lcType = LCH_DCCH;
7871 lcCfg->rlcMode = RLC_AM;
7873 else if(rbType == RB_TYPE_DRB)
7875 lcCfg->rbType = RB_TYPE_DRB;
7877 lcCfg->lcType = LCH_DTCH;
7878 lcCfg->rlcMode = rlcMode;
7880 if(f1RlcCfg) /* rlc mode config recived */
7882 extractRlcModeCfg(lcCfg->rlcMode, lcCfg, f1RlcCfg);
7884 if(qoSInformation != NULLP)
7886 if(qoSInformation->present == QoSInformation_PR_choice_extension)
7888 if(qoSInformation->choice.choice_extension->value.present ==\
7889 QoSInformation_ExtIEs__value_PR_DRB_Information)
7891 drbInfo = &qoSInformation->choice.choice_extension->value.choice.DRB_Information;
7892 if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &lcCfg->snssai) != ROK)
7894 DU_LOG("\nERROR --> DUAPP: Unable to extract Snssai information at procRlcLcCfg()");
7902 /*******************************************************************
7904 * @brief Fills DrbQos Info received by CU
7908 * Function : extractQosInfo
7910 * Functionality: Fills DrbQos Info received by CU
7912 * @params[in] DrbQosInfo *qosToAdd,
7913 * QoSFlowLevelQoSParameters_t *qosFlowCfg
7916 * ****************************************************************/
7918 void extractQosInfo(DrbQosInfo *qosToAdd, QoSFlowLevelQoSParameters_t *qosFlowCfg)
7920 uint8_t qosCntIdx = 0;
7921 ProtocolExtensionContainer_4624P74_t *qosIeExt = NULLP;
7923 qosToAdd->fiveQiType = qosFlowCfg->qoS_Characteristics.present;
7924 qosToAdd->u.nonDyn5Qi.fiveQi =\
7925 qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI;
7926 if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow)
7928 qosToAdd->u.nonDyn5Qi.avgWindow = \
7929 *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
7931 qosToAdd->u.nonDyn5Qi.maxDataBurstVol = \
7932 *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
7933 if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel)
7935 qosToAdd->u.nonDyn5Qi.priorLevel = \
7936 *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel);
7938 qosToAdd->ngRanRetPri.priorityLevel = \
7939 qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel;
7940 qosToAdd->ngRanRetPri.preEmptionCap = \
7941 qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability;
7942 qosToAdd->ngRanRetPri.preEmptionVul = \
7943 qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionVulnerability;
7944 if(qosFlowCfg->gBR_QoS_Flow_Information)
7946 memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateDl, \
7947 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.buf, \
7948 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.size);
7949 memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateUl, \
7950 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.buf, \
7951 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.size);
7952 memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateDl,\
7953 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.buf, \
7954 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.size);
7955 memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateUl,\
7956 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.buf, \
7957 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.size);
7959 /*Extracting PDU_SESSION_ID*/
7960 qosIeExt = (ProtocolExtensionContainer_4624P74_t *)qosFlowCfg->iE_Extensions;
7963 for(qosCntIdx = 0; qosCntIdx < qosIeExt->list.count; qosCntIdx++)
7965 if(qosIeExt->list.array[qosCntIdx]->extensionValue.present == \
7966 QoSFlowLevelQoSParameters_ExtIEs__extensionValue_PR_PDUSessionID)
7968 qosToAdd->pduSessionId = qosIeExt->list.array[qosCntIdx]->extensionValue.choice.PDUSessionID;
7969 DU_LOG("\nDEBUG --> DU_F1AP : extractQosInfo: PDU SessionID:%d",qosToAdd->pduSessionId);
7973 qosToAdd->ulPduSessAggMaxBitRate = 0;
7976 /*******************************************************************
7978 * @brief Function to extract GTP Tunnel Info from CU
7982 * Function : extractUpTnlInfo
7984 * Functionality: Function to extract GTP Tunnel Info from CU
7986 * @params[in] F1AP message
7987 * @return ROK/RFAILED
7989 * ****************************************************************/
7991 uint8_t extractUpTnlInfo(uint8_t drbId, uint8_t configType,\
7992 ULUPTNLInformation_ToBeSetup_List_t *tnlInfo, UpTnlCfg *upTnlInfo)
7995 uint32_t ipv4_du = 0;
7996 GTPTunnel_t *gtpTunnel = NULLP;
7998 upTnlInfo->drbId = drbId;
7999 upTnlInfo->configType = configType;
8001 cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du);
8003 cmInetAddr((char *)DU_IP_V4_ADDR, &ipv4_du);
8006 for(tnlIdx=0; tnlIdx < tnlInfo->list.count; tnlIdx++)
8008 if(tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.present == UPTransportLayerInformation_PR_gTPTunnel)
8010 if(tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.choice.gTPTunnel)
8012 gtpTunnel = tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.choice.gTPTunnel;
8013 DU_ALLOC(upTnlInfo->tnlCfg1, sizeof(GtpTnlCfg));
8014 if(upTnlInfo->tnlCfg1 == NULLP)
8016 DU_LOG("\nERROR --> F1AP : extractUpTnlInfo: Failed to allocate mmeory for tunnel cfg 1");
8019 bitStringToInt(>pTunnel->transportLayerAddress, &upTnlInfo->tnlCfg1->ulTnlAddress);
8020 upTnlInfo->tnlCfg1->dlTnlAddress = ipv4_du;
8021 if(gtpTunnel->gTP_TEID.size > 0)
8023 teIdStringToInt(gtpTunnel->gTP_TEID.buf, &upTnlInfo->tnlCfg1->teId);
8032 /*******************************************************************
8034 * @brief Function to extract Drb Qos Cfg Info from CU
8038 * Function : extractDrbQosCfg
8040 * Functionality: Function to extract Drb Qos Cfg Info from CU
8042 * @params[in] DRB_Information_t *drbInfo, LcCfg *macLcToAdd
8043 * @return ROK/RFAILED
8045 * ****************************************************************/
8047 uint8_t extractDrbQosCfg(DRB_Information_t *drbInfo, LcCfg *macLcToAdd )
8049 if(!macLcToAdd->drbQos)
8051 DU_ALLOC_SHRABL_BUF(macLcToAdd->drbQos, sizeof(DrbQosInfo));
8052 if(macLcToAdd->drbQos == NULLP)
8054 DU_LOG("\nERROR --> DUAPP:Memory failed at allocating DrbQos at extractDrbQosCfg()");
8059 if(drbInfo->dRB_QoS.qoS_Characteristics.present == QoS_Characteristics_PR_non_Dynamic_5QI)
8061 extractQosInfo(macLcToAdd->drbQos, &drbInfo->dRB_QoS);
8062 macLcToAdd->dlLcCfg.lcp = macLcToAdd->drbQos->ngRanRetPri.priorityLevel;
8064 if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &macLcToAdd->snssai) != ROK)
8066 DU_LOG("\nERROR --> DUAPP: Unable to extract Snssai information at extractDrbQosCfg()");
8071 /*******************************************************************
8073 * @brief Function to extract DRB info received from CU
8077 * Function : extractDrbCfg
8079 * Functionality: Function to extract DRB info received from CU
8081 * @params[in] F1AP message
8084 * ****************************************************************/
8085 uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, DRBs_ToBeSetupMod_Item_t *drbSetupModItem,\
8086 DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo)
8088 DRB_Information_t *drbInfo = NULLP;
8090 if(drbItem != NULLP)
8092 if(extractUpTnlInfo(drbItem->dRBID, CONFIG_ADD, &drbItem->uLUPTNLInformation_ToBeSetup_List, upTnlInfo) != ROK)
8094 DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
8097 if(drbItem->qoSInformation.present == QoSInformation_PR_choice_extension)
8099 if(drbItem->qoSInformation.choice.choice_extension->value.present == QoSInformation_ExtIEs__value_PR_DRB_Information)
8101 drbInfo = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information;
8102 if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK)
8104 DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()");
8110 else if(drbSetupModItem != NULLP)
8112 if(extractUpTnlInfo(drbSetupModItem->dRBID, CONFIG_ADD, &drbSetupModItem->uLUPTNLInformation_ToBeSetup_List,\
8115 DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
8118 if(drbSetupModItem->qoSInformation.present == QoSInformation_PR_choice_extension)
8120 if(drbSetupModItem->qoSInformation.choice.choice_extension->value.present ==\
8121 QoSInformation_ExtIEs__value_PR_DRB_Information)
8123 drbInfo = &drbSetupModItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information;
8124 if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK)
8126 DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()");
8133 else if(drbModItem != NULLP)
8135 if(extractUpTnlInfo(drbModItem->dRBID, CONFIG_MOD, &drbModItem->uLUPTNLInformation_ToBeSetup_List,\
8138 DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
8141 if(drbModItem->qoSInformation != NULLP)
8143 if(drbModItem->qoSInformation->present == QoSInformation_PR_choice_extension)
8145 if(drbModItem->qoSInformation->choice.choice_extension->value.present ==\
8146 QoSInformation_ExtIEs__value_PR_DRB_Information)
8148 drbInfo = &drbModItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information;
8149 if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK)
8151 DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()");
8162 /*******************************************************************
8164 * @brief Function to extract RB info received from CU
8168 * Function : extractMacRbCfg
8170 * Functionality: Function to extract RB info received from CU
8172 * @params[in] F1AP message
8173 * @return ROK/RFAILED
8175 * ****************************************************************/
8177 uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg,\
8178 DRBs_ToBeSetupMod_Item_t *drbSetupModCfg, DRBs_ToBeModified_Item_t *drbModCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
8182 if(extractDrbCfg(drbCfg, NULL, NULL, lcCfg, upTnlInfo) != ROK)
8184 DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()");
8188 else if(drbSetupModCfg != NULLP)
8190 if(extractDrbCfg(NULL, drbSetupModCfg, NULL, lcCfg, upTnlInfo) != ROK)
8192 DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()");
8196 else if(drbModCfg != NULLP)
8198 if(extractDrbCfg(NULL, NULL, drbModCfg, lcCfg, upTnlInfo) != ROK)
8200 DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()");
8206 lcCfg->drbQos = NULLP;
8207 lcCfg->snssai = NULLP;
8208 if(lcCfg->lcId == SRB2_LCID)
8209 lcCfg->dlLcCfg.lcp = LC_PRIORITY_3;
8211 lcCfg->dlLcCfg.lcp = LC_PRIORITY_1;
8215 lcCfg->ulLcCfgPres = true;
8216 extractUlLcCfg(&lcCfg->ulLcCfg, ulLcCfg);
8219 lcCfg->ulLcCfgPres = false;
8223 /*******************************************************************
8225 * @brief Function processing LC config info received from CU
8229 * Function : procMacLcCfg
8231 * Functionality: Function processing LC config info received from CU
8233 * @params[in] F1AP message
8234 * @return ROK/RFAILED
8236 * ****************************************************************/
8238 uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType, DRBs_ToBeSetup_Item_t *drbItem,\
8239 DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LogicalChannelConfig_t *ulLcCfg,\
8240 LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
8245 lcCfg->configType = configType;
8246 if(rbType == RB_TYPE_SRB)
8248 ret = extractMacRbCfg(lcId, NULL, NULL, NULL, ulLcCfg, lcCfg, NULL);
8250 else if(rbType == RB_TYPE_DRB)
8253 ret = extractMacRbCfg(lcId, drbItem, NULL, NULL, ulLcCfg, lcCfg, upTnlInfo);
8254 else if(drbSetupModItem != NULL)
8255 ret = extractMacRbCfg(lcId, NULL, drbSetupModItem, NULL, ulLcCfg, lcCfg, upTnlInfo);
8256 else if(drbModItem != NULL)
8257 ret = extractMacRbCfg(lcId, NULL, NULL, drbModItem, ulLcCfg, lcCfg, upTnlInfo);
8262 /*******************************************************************
8264 * @brief Function to extract Rlc cfg To Add/Mod in CellGrp Info
8268 * Function : extractRlcCfgToAddMod
8270 * Functionality: Function to extract Rlc cfg To Add/Mod in CellGrp Info
8272 * @params[in] CellGroupConfigRrc__rlc_BearerTo pointer
8274 * @return ROK/RFAILED
8276 * ****************************************************************/
8278 uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList *lcCfg, DuUeCfg *ueCfgDb)
8280 uint8_t idx, rbId, lcId, rlcMode, rbType;
8281 RLC_Config_t *f1RlcCfg = NULLP;
8282 LogicalChannelConfig_t *macUlLcCfg = NULLP;
8284 for(idx = 0; idx < lcCfg->list.count; idx++)
8286 lcId = lcCfg->list.array[idx]->logicalChannelIdentity;
8287 if(lcCfg->list.array[idx]->servedRadioBearer)
8289 /* RadioBearer for SRB/DRB */
8290 if(lcCfg->list.array[idx]->servedRadioBearer->present ==\
8291 RLC_BearerConfig__servedRadioBearer_PR_srb_Identity)
8293 rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.srb_Identity;
8294 rbType = RB_TYPE_SRB;
8296 else if(lcCfg->list.array[idx]->servedRadioBearer->present ==\
8297 RLC_BearerConfig__servedRadioBearer_PR_drb_Identity)
8299 rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.drb_Identity;
8300 rbType = RB_TYPE_DRB;
8304 DU_LOG("\nERROR --> No components present in Bearer config to ADD/MOD");
8307 /* MAC UL LC Config */
8308 if(lcCfg->list.array[idx]->mac_LogicalChannelConfig)
8310 macUlLcCfg = lcCfg->list.array[idx]->mac_LogicalChannelConfig;
8315 DU_LOG("\nERROR --> DUAPP: Received RadioBearer config is NULL");
8318 /* RLC Mode Config */
8319 if(lcCfg->list.array[idx]->rlc_Config)
8321 rlcMode = lcCfg->list.array[idx]->rlc_Config->present;
8322 f1RlcCfg = lcCfg->list.array[idx]->rlc_Config;
8325 /* Filling RLC/MAC Config*/
8326 memset(&ueCfgDb->macLcCfg[idx], 0, sizeof(LcCfg));
8327 memset(&ueCfgDb->rlcLcCfg[idx], 0, sizeof(RlcBearerCfg));
8328 procRlcLcCfg(rbId, lcId, rbType, rlcMode, CONFIG_UNKNOWN, f1RlcCfg, &(ueCfgDb->rlcLcCfg[idx]), NULLP);
8329 if(procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, NULL, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx], NULL) != ROK)
8331 DU_LOG("\nERROR --> DU APP : Failed while filling MAC LC config at extractRlcCfgToAddMod()");
8334 (ueCfgDb->numRlcLcs)++;
8335 (ueCfgDb->numMacLcs)++;
8336 DU_LOG("\nDEBUG -> DUAPP: extractRlcCfgToAddMod:RBType:%d, DrbID: %d,lcId:%d, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
8337 rbType, rbId, lcId, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
8339 //TODO: To send the failure cause in UeContextSetupRsp
8343 /*******************************************************************
8345 * @brief DeAlloc pdsch serv cell config info
8349 * Function : freeMacPdschServCellInfo
8351 * Functionality: DeAlloc pdsch serv cell config info
8353 * @params[in] PdschServCellCfg pointer
8356 * ****************************************************************/
8358 void freeMacPdschServCellInfo(PdschServCellCfg *pdsch)
8360 if(pdsch->xOverhead)
8362 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->xOverhead, sizeof(PdschXOverhead));
8364 if(pdsch->codeBlkGrpFlushInd)
8366 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->codeBlkGrpFlushInd, sizeof(bool));
8368 if(pdsch->maxCodeBlkGrpPerTb)
8370 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
8372 if(pdsch->maxMimoLayers)
8374 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxMimoLayers, sizeof(uint8_t));
8378 /*******************************************************************
8380 * @brief Free Serving cell Info
8384 * Function : freeMacServingCellInfo
8386 * Functionality: Free Serving cell Info
8388 * @params[in] ServCellCfgInfo *srvCellCfg
8391 * ****************************************************************/
8392 void freeMacServingCellInfo(ServCellCfgInfo *srvCellCfg)
8394 uint8_t timeDomRsrcIdx;
8396 if(srvCellCfg->initDlBwp.pdschPresent)
8398 for(timeDomRsrcIdx = 0; timeDomRsrcIdx < srvCellCfg->initDlBwp.pdschCfg.numTimeDomRsrcAlloc; timeDomRsrcIdx++)
8400 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, \
8401 srvCellCfg->initDlBwp.pdschCfg.timeDomRsrcAllociList[timeDomRsrcIdx].k0, sizeof(uint8_t));
8405 freeMacPdschServCellInfo(&srvCellCfg->pdschServCellCfg);
8406 if(srvCellCfg->bwpInactivityTmr)
8408 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
8411 if(srvCellCfg->initUlBwp.pucchPresent)
8413 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->initUlBwp.pucchCfg.dlDataToUlAck, sizeof(PucchDlDataToUlAck));
8417 /*******************************************************************
8419 * @brief Free cell Grp Cfg Info
8423 * Function : freeUeReCfgCellGrpInfo
8425 * Functionality: Free cell Grp Cfg Info
8427 * @params[in] MacUeCfg* duUeCfg
8430 * ****************************************************************/
8432 void freeUeReCfgCellGrpInfo(MacUeCfg *macUeCfg)
8434 freeMacServingCellInfo(&macUeCfg->spCellCfg.servCellCfg);
8437 /*******************************************************************
8439 * @brief Fills Reconfig SchReqReConfig
8443 * Function : extractSchReqReConfig
8445 * Functionality: Fills Reconfig SchReqReConfig
8447 * @params[in] SchedulingRequestConfig_t *cuSchedReq
8448 * SchedReqCfg* macSchedReq
8451 * ****************************************************************/
8452 void extractSchReqReConfig(SchedulingRequestConfig_t *cuSchedReq, SchedReqCfg *macSchedReq)
8454 uint8_t schReqIdx = 0;
8455 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqListToAdd = NULLP;
8456 struct SchedulingRequestConfig__schedulingRequestToReleaseList *schReqListToRel = NULLP;
8458 if(cuSchedReq->schedulingRequestToAddModList)
8460 schReqListToAdd = cuSchedReq->schedulingRequestToAddModList;
8461 if(schReqListToAdd->list.count)
8463 macSchedReq->addModListCount = schReqListToAdd->list.count;
8464 for(schReqIdx = 0; schReqIdx < schReqListToAdd->list.count; schReqIdx++)
8466 macSchedReq->addModList[schReqIdx].schedReqId = \
8467 schReqListToAdd->list.array[schReqIdx]->schedulingRequestId;
8468 macSchedReq->addModList[schReqIdx].srProhibitTmr = \
8469 *(schReqListToAdd->list.array[schReqIdx]->sr_ProhibitTimer);
8470 macSchedReq->addModList[schReqIdx].srTransMax =\
8471 schReqListToAdd->list.array[schReqIdx]->sr_TransMax;
8475 /* Scheduling Req To release */
8476 if(cuSchedReq->schedulingRequestToReleaseList)
8478 schReqListToRel = cuSchedReq->schedulingRequestToReleaseList;
8479 if(schReqListToRel->list.count)
8481 macSchedReq->relListCount = schReqListToRel->list.count;
8482 for(schReqIdx = 0; schReqIdx < schReqListToRel->list.count; schReqIdx++)
8484 macSchedReq->relList[schReqIdx] = \
8485 *schReqListToRel->list.array[schReqIdx];
8491 /*******************************************************************
8493 * @brief Fills TagReconfig
8497 * Function : extractTagReconfig
8499 * Functionality: Fills extractTagReconfig
8501 * @params[in] TAG_Config_t *cuTagCfg
8505 * ****************************************************************/
8507 void extractTagReconfig(TAG_Config_t *cuTagCfg, TagCfg *macTagCfg)
8510 struct TAG_Config__tag_ToAddModList *tagListToAddMod = NULLP;
8511 struct TAG_Config__tag_ToReleaseList *tagListToRel = NULLP;
8513 /* Tag config to AddMod */
8514 if(cuTagCfg->tag_ToAddModList)
8516 tagListToAddMod = cuTagCfg->tag_ToAddModList;
8517 if(tagListToAddMod->list.count)
8519 macTagCfg->addModListCount = tagListToAddMod->list.count;
8520 for(tagIdx = 0; tagIdx < tagListToAddMod->list.count; tagIdx++)
8522 macTagCfg->addModList[tagIdx].tagId =\
8523 tagListToAddMod->list.array[tagIdx]->tag_Id;
8524 macTagCfg->addModList[tagIdx].timeAlignTimer = \
8526 tagListToAddMod->list.array[tagIdx]->timeAlignmentTimer;
8530 /* Tag config to release */
8531 if(cuTagCfg->tag_ToReleaseList)
8533 tagListToRel = cuTagCfg->tag_ToReleaseList;
8534 if(tagListToRel->list.count)
8536 macTagCfg->relListCount = tagListToRel->list.count;
8537 for(tagIdx = 0; tagIdx < tagListToRel->list.count; tagIdx++)
8539 macTagCfg->relList[tagIdx] = *tagListToRel->list.array[tagIdx];
8545 /*******************************************************************
8547 * @brief Fills PdcchCfg received by CU
8551 * Function : extractPdcchCfg
8553 * Functionality: Fills PdcchCfg received by CU
8555 * @params[in] PDCCH_Config_t *cuPdcchCfg,
8556 * PdcchConfig *duPdcchCfg
8559 * ****************************************************************/
8561 void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg)
8563 uint8_t cRsetIdx = 0;
8564 uint8_t srchSpcIdx = 0;
8566 struct PDCCH_Config__controlResourceSetToAddModList *cRsetToAddModList = NULLP;
8567 struct PDCCH_Config__controlResourceSetToReleaseList *cRsetToRelList = NULLP;
8568 struct PDCCH_Config__searchSpacesToAddModList *srchSpcToAddModList = NULLP;
8569 struct PDCCH_Config__searchSpacesToReleaseList *srchSpcToRelList = NULLP;
8572 /* Control Resource Set To Add/Mod List */
8573 if(cuPdcchCfg->controlResourceSetToAddModList)
8575 cRsetToAddModList = cuPdcchCfg->controlResourceSetToAddModList;
8576 if(cRsetToAddModList->list.count)
8578 macPdcchCfg->numCRsetToAddMod = cRsetToAddModList->list.count;
8579 for(cRsetIdx = 0; cRsetIdx < cRsetToAddModList->list.count; cRsetIdx++)
8581 macPdcchCfg->cRSetToAddModList[cRsetIdx].cRSetId = \
8582 cRsetToAddModList->list.array[cRsetIdx]->controlResourceSetId;
8583 //freqDomRsrcBitStringToInt(&cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources,\
8584 macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc);
8585 memcpy(macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc, \
8586 cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources.buf,
8587 cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources.size);
8589 macPdcchCfg->cRSetToAddModList[cRsetIdx].duration = \
8590 cRsetToAddModList->list.array[cRsetIdx]->duration;
8592 macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType = \
8593 cRsetToAddModList->list.array[cRsetIdx]->cce_REG_MappingType.present;
8594 if(macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType == CCE_REG_MAPPINGTYPE_PR_INTERLEAVED)
8596 //TODO: handle the case for Interleaved
8598 macPdcchCfg->cRSetToAddModList[cRsetIdx].precoderGranularity = \
8599 cRsetToAddModList->list.array[cRsetIdx]->precoderGranularity;
8600 if(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID)
8602 macPdcchCfg->cRSetToAddModList[cRsetIdx].dmrsScramblingId= \
8603 *(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID);
8608 /* Control Resource Set To Release List */
8609 if(cuPdcchCfg->controlResourceSetToReleaseList)
8611 cRsetToRelList = cuPdcchCfg->controlResourceSetToReleaseList;
8612 if(cRsetToRelList->list.count)
8614 macPdcchCfg->numCRsetToRel = cRsetToRelList->list.count;
8615 for(cRsetIdx = 0; cRsetIdx < cRsetToRelList->list.count; cRsetIdx++)
8617 macPdcchCfg->cRSetToRelList[cRsetIdx] = *(cRsetToRelList->list.array[cRsetIdx]);
8622 /* Search space To Add/Mod List */
8623 if(cuPdcchCfg->searchSpacesToAddModList)
8625 srchSpcToAddModList = cuPdcchCfg->searchSpacesToAddModList;
8626 if(srchSpcToAddModList->list.count)
8628 macPdcchCfg->numSearchSpcToAddMod = srchSpcToAddModList->list.count;
8629 for(srchSpcIdx = 0; srchSpcIdx < srchSpcToAddModList->list.count; srchSpcIdx++)
8631 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceId =\
8632 srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceId;
8633 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].cRSetId =\
8634 *(srchSpcToAddModList->list.array[srchSpcIdx]->controlResourceSetId);
8635 if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset)
8637 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSlotPeriodicityAndOffset =\
8638 srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset->present;
8640 if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot)
8642 bitStringToInt(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot,\
8643 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSymbolsWithinSlot);
8645 if(srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates)
8647 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel1 = \
8648 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel1;
8649 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel2 = \
8650 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel2;
8651 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel4 = \
8652 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel4;
8654 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel8 = \
8655 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel8;
8657 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel16 = \
8658 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel16;
8660 if(srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType)
8662 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType =\
8663 srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->present;
8664 if(macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType == SEARCHSPACETYPE_PR_UE_SPECIFIC)
8666 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].ueSpecificDciFormat =\
8667 srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->choice.ue_Specific->dci_Formats;
8674 /* Search space To Rel List */
8675 if(cuPdcchCfg->searchSpacesToReleaseList)
8677 srchSpcToRelList = cuPdcchCfg->searchSpacesToReleaseList;
8678 if(srchSpcToRelList->list.count)
8680 macPdcchCfg->numSearchSpcToRel = srchSpcToRelList->list.count;
8681 for(srchSpcIdx = 0; srchSpcIdx < srchSpcToRelList->list.count; srchSpcIdx++)
8683 macPdcchCfg->searchSpcToRelList[srchSpcIdx] =\
8684 *(srchSpcToRelList->list.array[srchSpcIdx]);
8690 /*******************************************************************
8692 * @brief Fills PdschCfg received by CU
8696 * Function : extractPdschCfg
8698 * Functionality: Fills PdschCfg received by CU
8700 * @params[in] PDSCH_Config_t *cuPdschCfg = Information which is send by CU,
8701 * which we have stored in F1UeContextSetupDb,
8702 * PdschConfig *macPdschCfg = Used to Store the information which
8703 * needs to send in other layer, as well as this can be the variable
8704 * which stores the information in DuCb,
8705 * PdschConfig *storedPdschCfg = Null in case of sending the
8706 * information to other layer else it will have stored pdsch
8707 * configuration in copyOfmacUeCfg.
8710 * ****************************************************************/
8712 void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg, PdschConfig *storedPdschCfg)
8715 struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAlloc = NULLP;
8717 if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
8719 if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->present == \
8720 PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup)
8722 if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)
8724 macPdschCfg->dmrsDlCfgForPdschMapTypeA.addPos = \
8725 *(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition);
8729 macPdschCfg->resourceAllocType = cuPdschCfg->resourceAllocation;
8730 if(cuPdschCfg->pdsch_TimeDomainAllocationList)
8732 timeDomAlloc = cuPdschCfg->pdsch_TimeDomainAllocationList;
8733 if(timeDomAlloc->present ==\
8734 PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup)
8736 if(timeDomAlloc->choice.setup)
8738 macPdschCfg->numTimeDomRsrcAlloc = timeDomAlloc->choice.setup->list.count;
8739 for(timeDomIdx = 0; timeDomIdx < timeDomAlloc->choice.setup->list.count; timeDomIdx++)
8741 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 = NULLP;
8742 if(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0)
8744 if(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 == NULL)
8748 if(storedPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0)
8750 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 =\
8751 storedPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0;
8755 DU_ALLOC_SHRABL_BUF(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0, sizeof(uint8_t));
8760 DU_ALLOC_SHRABL_BUF(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0, sizeof(uint8_t));
8762 if(!macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0)
8764 DU_LOG("\nERROR --> DU APP : Memory allocation failed for k0 at extractPdschCfg()");
8768 *(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0) = \
8769 *(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0);
8771 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].mappingType = \
8772 timeDomAlloc->choice.setup->list.array[timeDomIdx]->mappingType;
8773 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbolAndLength = \
8774 timeDomAlloc->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
8779 macPdschCfg->rbgSize = cuPdschCfg->rbg_Size;
8780 if(cuPdschCfg->maxNrofCodeWordsScheduledByDCI)
8781 macPdschCfg->numCodeWordsSchByDci = *(cuPdschCfg->maxNrofCodeWordsScheduledByDCI);
8782 if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_staticBundling)
8784 macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present;
8785 if(cuPdschCfg->prb_BundlingType.choice.staticBundling)
8787 if(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize)
8789 macPdschCfg->bundlingInfo.StaticBundling.size = \
8790 *(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize);
8794 else if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_dynamicBundling)
8796 macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present;
8801 /*******************************************************************
8803 * @brief Fills PdschServingCellCfg received by CU
8807 * Function : extractPdschServingCellCfg
8809 * Functionality: Fills PdschCfg received by CU
8811 * @params[in] PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg,
8812 * PdschServCellCfg *macUePdschSrvCellCfg
8813 * @return ROK/RFAILED
8815 * ****************************************************************/
8817 uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg, PdschServCellCfg *macUePdschSrvCellCfg)
8819 if(cuPdschSrvCellCfg->codeBlockGroupTransmission)
8821 if(cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup)
8823 if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
8825 *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) = \
8826 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
8830 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
8831 if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
8833 *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) = \
8834 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
8838 DU_LOG("\nERROR --> DU APP : Memory allocation failed for maxCodeBlkGrpPerTb at extractPdschServingCellCfg()");
8842 if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
8844 *(macUePdschSrvCellCfg->codeBlkGrpFlushInd) = \
8845 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator;
8849 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->codeBlkGrpFlushInd , sizeof(bool));
8850 if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
8852 *(macUePdschSrvCellCfg->codeBlkGrpFlushInd) = \
8853 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator;
8857 DU_LOG("\nERROR --> DU APP : Memory allocation failed for codeBlkGrpFlushInd at extractPdschServingCellCfg()");
8863 if(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH)
8865 macUePdschSrvCellCfg->numHarqProcForPdsch = *(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH);
8867 if(cuPdschSrvCellCfg->ext1)
8869 if(cuPdschSrvCellCfg->ext1->maxMIMO_Layers)
8871 if(macUePdschSrvCellCfg->maxMimoLayers)
8873 *(macUePdschSrvCellCfg->maxMimoLayers) = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers);
8877 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxMimoLayers, sizeof(uint8_t));
8878 if(macUePdschSrvCellCfg->maxMimoLayers)
8880 *(macUePdschSrvCellCfg->maxMimoLayers) = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers);
8884 DU_LOG("\nERROR --> DU APP : Memory allocation failed for maxMimoLayers at extractPdschServingCellCfg()");
8890 if(cuPdschSrvCellCfg->xOverhead)
8892 if(macUePdschSrvCellCfg->xOverhead)
8894 *(macUePdschSrvCellCfg->xOverhead) = *(cuPdschSrvCellCfg->xOverhead);
8898 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->xOverhead, sizeof(PdschXOverhead));
8899 if(macUePdschSrvCellCfg->xOverhead)
8901 *(macUePdschSrvCellCfg->xOverhead) = *(cuPdschSrvCellCfg->xOverhead);
8905 DU_LOG("\nERROR --> DU APP : Memory allocation failed for xOverhead at extractPdschServingCellCfg()");
8913 /*******************************************************************
8915 * @brief Fills PuschCfg received by CU
8919 * Function : extractPuschCfg
8921 * Functionality: Fills PuschCfg received by CU
8923 * @params[in] BWP_UplinkDedicated__pusch_Config *cuPuschCfg,
8924 * PuschCfg *macPuschCfg
8927 * ****************************************************************/
8929 void extractPuschCfg(struct BWP_UplinkDedicated__pusch_Config *cuPuschCfg, PuschCfg *macPuschCfg)
8931 uint8_t timeDomIdx = 0;
8932 DMRS_UplinkConfig_t *dmrsUlCfg = NULLP;
8933 struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList = NULLP;
8935 if(cuPuschCfg->present == BWP_UplinkDedicated__pusch_Config_PR_setup)
8937 if(cuPuschCfg->choice.setup)
8939 if(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH)
8941 macPuschCfg->dataScramblingId = \
8942 *(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH);
8944 if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA)
8946 if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->present == PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup)
8948 if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup)
8950 dmrsUlCfg = (cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup);
8951 if(dmrsUlCfg->dmrs_AdditionalPosition)
8953 macPuschCfg->dmrsUlCfgForPuschMapTypeA.addPos =\
8954 *(dmrsUlCfg->dmrs_AdditionalPosition);
8956 if(dmrsUlCfg->transformPrecodingDisabled)
8958 if(dmrsUlCfg->transformPrecodingDisabled->scramblingID0)
8960 macPuschCfg->dmrsUlCfgForPuschMapTypeA.transPrecodDisabled.scramblingId0 = \
8961 *(dmrsUlCfg->transformPrecodingDisabled->scramblingID0);
8967 /*Res Alloc Type for UL */
8968 if(cuPuschCfg->choice.setup->resourceAllocation)
8970 macPuschCfg->resourceAllocType = \
8971 cuPuschCfg->choice.setup->resourceAllocation;
8973 if(cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList)
8975 timeDomAllocList = cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList;
8976 if(timeDomAllocList->present == PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup)
8978 if(timeDomAllocList->choice.setup)
8980 macPuschCfg->numTimeDomRsrcAlloc = timeDomAllocList->choice.setup->list.count;
8981 for(timeDomIdx = 0; timeDomIdx <timeDomAllocList->choice.setup->list.count; timeDomIdx++)
8983 macPuschCfg->timeDomRsrcAllocList[timeDomIdx].k2 = \
8984 *(timeDomAllocList->choice.setup->list.array[timeDomIdx]->k2);
8985 macPuschCfg->timeDomRsrcAllocList[timeDomIdx].mappingType = \
8986 timeDomAllocList->choice.setup->list.array[timeDomIdx]->mappingType;
8987 macPuschCfg->timeDomRsrcAllocList[timeDomIdx].startSymbolAndLength = \
8988 timeDomAllocList->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
8993 if(cuPuschCfg->choice.setup->transformPrecoder)
8994 macPuschCfg->transformPrecoder = *(cuPuschCfg->choice.setup->transformPrecoder);
8999 /*******************************************************************
9001 * @brief Function to fill pucch Power Control
9005 * Function : extractPucchPowerControl
9007 * Functionality: Function to fill pucch Power Control
9009 * @params[in] PucchPowerControl *pwrCtrl,
9010 * struct PUCCH_PowerControl *cuPwrCtrlCfg
9013 * ****************************************************************/
9015 void extractPucchPowerControl(PucchPowerControl *pwrCtrl, struct PUCCH_PowerControl *cuPwrCtrlCfg)
9019 if(cuPwrCtrlCfg->deltaF_PUCCH_f0)
9020 pwrCtrl->deltaF_Format0 = *cuPwrCtrlCfg->deltaF_PUCCH_f0;
9021 if(cuPwrCtrlCfg->deltaF_PUCCH_f1)
9022 pwrCtrl->deltaF_Format1 = *cuPwrCtrlCfg->deltaF_PUCCH_f1;
9023 if(cuPwrCtrlCfg->deltaF_PUCCH_f2)
9024 pwrCtrl->deltaF_Format2 = *cuPwrCtrlCfg->deltaF_PUCCH_f2;
9025 if(cuPwrCtrlCfg->deltaF_PUCCH_f3)
9026 pwrCtrl->deltaF_Format3 = *cuPwrCtrlCfg->deltaF_PUCCH_f3;
9027 if(cuPwrCtrlCfg->deltaF_PUCCH_f4)
9028 pwrCtrl->deltaF_Format4 = *cuPwrCtrlCfg->deltaF_PUCCH_f4;
9029 if(cuPwrCtrlCfg->p0_Set)
9031 pwrCtrl->p0SetCount = cuPwrCtrlCfg->p0_Set->list.count;
9032 for(arrIdx=0; arrIdx < pwrCtrl->p0SetCount; arrIdx++)
9034 pwrCtrl->p0Set[arrIdx].p0PucchId =\
9035 cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Id;
9036 pwrCtrl->p0Set[arrIdx].p0PucchVal =\
9037 cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Value;
9040 if(cuPwrCtrlCfg->pathlossReferenceRSs)
9042 pwrCtrl->pathLossRefRSListCount = cuPwrCtrlCfg->pathlossReferenceRSs->list.count;
9043 for(arrIdx = 0; arrIdx < pwrCtrl->pathLossRefRSListCount; arrIdx++)
9045 pwrCtrl->pathLossRefRSList[arrIdx].pathLossRefRSId =\
9046 cuPwrCtrlCfg->pathlossReferenceRSs->list.array[arrIdx]->pucch_PathlossReferenceRS_Id;
9051 /*******************************************************************
9053 * @brief Function to extractResrcSetToAddModList sent by CU
9057 * Function : extractResrcSetToAddModList
9059 * Functionality: Fucntion to extractResrcSetToAddModList
9061 * @params[in] PucchResrcSetCfg pointer,
9062 * struct PUCCH_Config__resourceSetToAddModList pointer
9065 * ****************************************************************/
9067 void extractResrcSetToAddModList(PucchResrcSetCfg *macRsrcSetList, struct PUCCH_Config__resourceSetToAddModList *cuRsrcSetList)
9069 uint8_t arrIdx, rsrcListIdx;
9071 macRsrcSetList->resrcSetToAddModListCount = cuRsrcSetList->list.count;
9072 for(arrIdx = 0; arrIdx < macRsrcSetList->resrcSetToAddModListCount; arrIdx++)
9074 macRsrcSetList->resrcSetToAddModList[arrIdx].resrcSetId =\
9075 cuRsrcSetList->list.array[arrIdx]->pucch_ResourceSetId;
9076 macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount =\
9077 cuRsrcSetList->list.array[arrIdx]->resourceList.list.count;
9078 for(rsrcListIdx = 0; rsrcListIdx < macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount; rsrcListIdx++)
9080 macRsrcSetList->resrcSetToAddModList[arrIdx].resrcList[rsrcListIdx] =\
9081 *cuRsrcSetList->list.array[arrIdx]->resourceList.list.array[rsrcListIdx];
9084 if(cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1)
9086 macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize =\
9087 *cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1;
9091 macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize = 0;
9094 }/* End of extractResrcSetToAddModList */
9096 /*******************************************************************
9098 * @brief Fills extractResrcToAddModList sent by CU
9102 * Function : extractResrcToAddModList
9104 * Functionality: Fills extractResrcToAddModList
9106 * @params[in] PucchResrcCfg pointer,
9107 * struct PUCCH_Config__resourceToAddModList pointer
9108 * @return ROk/RFAILED
9110 * ****************************************************************/
9112 uint8_t extractResrcToAddModList(PucchResrcCfg *macResrcList, struct PUCCH_Config__resourceToAddModList *cuResrcList)
9116 macResrcList->resrcToAddModListCount = cuResrcList->list.count;
9117 for(arrIdx = 0; arrIdx < macResrcList->resrcToAddModListCount; arrIdx++)
9119 macResrcList->resrcToAddModList[arrIdx].resrcId =\
9120 cuResrcList->list.array[arrIdx]->pucch_ResourceId;
9121 macResrcList->resrcToAddModList[arrIdx].startPrb =\
9122 cuResrcList->list.array[arrIdx]->startingPRB;
9123 if(cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping)
9125 macResrcList->resrcToAddModList[arrIdx].intraFreqHop =\
9126 *cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping;
9128 if(cuResrcList->list.array[arrIdx]->secondHopPRB)
9130 macResrcList->resrcToAddModList[arrIdx].secondPrbHop =\
9131 *cuResrcList->list.array[arrIdx]->secondHopPRB;
9133 /* PUCCH RSRC FORMAT */
9134 if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format0)
9136 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_0;
9137 if(cuResrcList->list.array[arrIdx]->format.choice.format0)
9139 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0, sizeof(PucchFormat0));
9140 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0 == NULLP)
9142 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format0 in extractResrcToAddModList()");
9145 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->initialCyclicShift =\
9146 cuResrcList->list.array[arrIdx]->format.choice.format0->initialCyclicShift;
9147 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->numSymbols =\
9148 cuResrcList->list.array[arrIdx]->format.choice.format0->nrofSymbols;
9149 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->startSymbolIdx =\
9150 cuResrcList->list.array[arrIdx]->format.choice.format0->startingSymbolIndex;
9153 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format1)
9155 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_1;
9156 if(cuResrcList->list.array[arrIdx]->format.choice.format1)
9158 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1, sizeof(PucchFormat1));
9159 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1 == NULLP)
9161 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format1 in extractResrcToAddModList()");
9164 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->initialCyclicShift =\
9165 cuResrcList->list.array[arrIdx]->format.choice.format1->initialCyclicShift;
9166 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->numSymbols =\
9167 cuResrcList->list.array[arrIdx]->format.choice.format1->nrofSymbols;
9168 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->startSymbolIdx =\
9169 cuResrcList->list.array[arrIdx]->format.choice.format1->startingSymbolIndex;
9170 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->timeDomOCC =\
9171 cuResrcList->list.array[arrIdx]->format.choice.format1->timeDomainOCC;
9174 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format2)
9176 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_2;
9177 if(cuResrcList->list.array[arrIdx]->format.choice.format2)
9179 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2, sizeof(PucchFormat2_3));
9180 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2 == NULLP)
9182 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format2 in extractResrcToAddModList()");
9185 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numPrbs =\
9186 cuResrcList->list.array[arrIdx]->format.choice.format2->nrofPRBs;
9187 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numSymbols =\
9188 cuResrcList->list.array[arrIdx]->format.choice.format2->nrofSymbols;
9189 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->startSymbolIdx =\
9190 cuResrcList->list.array[arrIdx]->format.choice.format2->startingSymbolIndex;
9193 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format3)
9195 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_3;
9196 if(cuResrcList->list.array[arrIdx]->format.choice.format3)
9198 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3, sizeof(PucchFormat2_3));
9199 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3 == NULLP)
9201 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format3 in extractResrcToAddModList()");
9204 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numPrbs =\
9205 cuResrcList->list.array[arrIdx]->format.choice.format3->nrofPRBs;
9206 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numSymbols =\
9207 cuResrcList->list.array[arrIdx]->format.choice.format3->nrofSymbols;
9208 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->startSymbolIdx =\
9209 cuResrcList->list.array[arrIdx]->format.choice.format3->startingSymbolIndex;
9212 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format4)
9214 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_4;
9215 if(cuResrcList->list.array[arrIdx]->format.choice.format4)
9217 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4, sizeof(PucchFormat4));
9218 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4 == NULLP)
9220 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format4 in extractResrcToAddModList()");
9223 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->numSymbols =\
9224 cuResrcList->list.array[arrIdx]->format.choice.format4->nrofSymbols;
9225 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occLen =\
9226 cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Length;
9227 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occIdx =\
9228 cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Index;
9229 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->startSymbolIdx =\
9230 cuResrcList->list.array[arrIdx]->format.choice.format4->startingSymbolIndex;
9236 }/* End of extractResrcToAddModList */
9238 /*******************************************************************
9240 * @brief Fills fillPucchSchedReqPeriodAndOffset sent by CU
9244 * Function : fillPucchSchedReqPeriodAndOffset
9246 * Functionality: To fillPucchSchedReqPeriodAndOffset
9248 * @params[in] macPeriodicty,
9249 * SchedulingRequestResourceConfig__periodicityAndOffset pointer
9252 * ****************************************************************/
9254 void fillPucchSchedReqPeriodAndOffset(uint8_t macPeriodicty, uint16_t macOffset,\
9255 struct SchedulingRequestResourceConfig__periodicityAndOffset *cuPeriodicty)
9257 macPeriodicty = cuPeriodicty->present;
9258 switch(macPeriodicty)
9260 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym2:
9262 macOffset = cuPeriodicty->choice.sym2;
9265 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym6or7:
9267 macOffset = cuPeriodicty->choice.sym6or7;
9270 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl1:
9272 macOffset = cuPeriodicty->choice.sl1;
9275 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl2:
9277 macOffset = cuPeriodicty->choice.sl2;
9280 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl4:
9282 macOffset = cuPeriodicty->choice.sl4;
9285 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl5:
9287 macOffset = cuPeriodicty->choice.sl5;
9290 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl8:
9292 macOffset = cuPeriodicty->choice.sl8;
9295 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10:
9297 macOffset = cuPeriodicty->choice.sl10;
9300 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl16:
9302 macOffset = cuPeriodicty->choice.sl16;
9305 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl20:
9307 macOffset = cuPeriodicty->choice.sl20;
9310 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40:
9312 macOffset = cuPeriodicty->choice.sl40;
9315 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl80:
9317 macOffset = cuPeriodicty->choice.sl80;
9320 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl160:
9322 macOffset = cuPeriodicty->choice.sl160;
9325 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320:
9327 macOffset = cuPeriodicty->choice.sl320;
9330 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl640:
9332 macOffset = cuPeriodicty->choice.sl640;
9336 DU_LOG("\nERROR --> F1AP : Invalid periodicity %d", macPeriodicty);
9340 /*******************************************************************
9342 * @brief Function to extractPucchFormatCfg sent by CU
9346 * Function : extractPucchFormatCfg
9348 * Functionality: Function to extractPucchFormatCfg
9350 * @params[in] PucchFormatCfg pointer,
9351 * PUCCH_FormatConfig_t pointer
9354 * ****************************************************************/
9356 void extractPucchFormatCfg(PucchFormatCfg *macFormatCfg, PUCCH_FormatConfig_t *cuFormatCfg)
9358 if(cuFormatCfg->interslotFrequencyHopping)
9359 macFormatCfg->interSlotFreqHop = *cuFormatCfg->interslotFrequencyHopping;
9360 if(cuFormatCfg->additionalDMRS)
9361 macFormatCfg->addDmrs = *cuFormatCfg->additionalDMRS;
9362 if(cuFormatCfg->maxCodeRate)
9363 macFormatCfg->maxCodeRate = *cuFormatCfg->maxCodeRate;
9364 if(cuFormatCfg->nrofSlots)
9365 macFormatCfg->numSlots = *cuFormatCfg->nrofSlots;
9366 if(cuFormatCfg->pi2BPSK)
9367 macFormatCfg->pi2BPSK = *cuFormatCfg->pi2BPSK;
9368 if(cuFormatCfg->simultaneousHARQ_ACK_CSI)
9369 macFormatCfg->harqAckCSI = *cuFormatCfg->simultaneousHARQ_ACK_CSI;
9370 }/* End of extractPucchFormatCfg */
9372 /*******************************************************************
9374 * @brief Function to extractSchedReqCfgToAddMod sent by CU
9378 * Function : extractSchedReqCfgToAddMod
9380 * Functionality: Function to extractSchedReqCfgToAddMod
9382 * @params[in] PucchSchedReqCfg pointer,
9383 * PUCCH_Config__schedulingRequestResourceToAddModList pointer
9386 * ****************************************************************/
9388 void extractSchedReqCfgToAddMod(PucchSchedReqCfg *macSchedReqCfg, struct PUCCH_Config__schedulingRequestResourceToAddModList *cuSchedReqList)
9392 macSchedReqCfg->schedAddModListCount = cuSchedReqList->list.count;
9393 for(arrIdx = 0; arrIdx < macSchedReqCfg->schedAddModListCount; arrIdx++)
9395 macSchedReqCfg->schedAddModList[arrIdx].resrcId =\
9396 cuSchedReqList->list.array[arrIdx]->schedulingRequestResourceId;
9397 macSchedReqCfg->schedAddModList[arrIdx].requestId =\
9398 cuSchedReqList->list.array[arrIdx]->schedulingRequestID;
9399 if(cuSchedReqList->list.array[arrIdx]->periodicityAndOffset)
9401 fillPucchSchedReqPeriodAndOffset(macSchedReqCfg->schedAddModList[arrIdx].periodicity,\
9402 macSchedReqCfg->schedAddModList[arrIdx].offset, cuSchedReqList->list.array[arrIdx]->periodicityAndOffset);
9404 if(cuSchedReqList->list.array[arrIdx]->resource)
9406 macSchedReqCfg->schedAddModList[arrIdx].resrc =\
9407 *cuSchedReqList->list.array[arrIdx]->resource;
9411 }/* End of extractSchedReqCfgToAddMod */
9413 /*******************************************************************
9415 * @brief Fills PucchCfg received by CU
9419 * Function : extractPucchCfg
9421 * Functionality: Fills PucchCfg received by CU
9423 * @params[in] BWP_UplinkDedicated__pucch_Config *cuPucchCfg = Information which
9424 * is send by CU, which we have stored in F1UeContextSetupDb,
9425 * PucchCfg *macPucchCfg = Used to Store the information which
9426 * needs to send in other layer, as well as this can be the variable
9427 * which stores the information in DuCb,
9428 * PucchCfg *storedPucchCfg = Null in case of sending the
9429 * information to other layer else it will have Pucch Cfg which
9430 * we have stored in copyOfmacUeCfg.
9431 * @return ROK/RFAILED
9433 * ****************************************************************/
9435 uint8_t extractPucchCfg(struct BWP_UplinkDedicated__pucch_Config *cuPucchCfg, PucchCfg *macPucchCfg,\
9436 PucchCfg *storedPucchCfg)
9440 if(cuPucchCfg->present == BWP_UplinkDedicated__pucch_Config_PR_setup)
9442 if(cuPucchCfg->choice.setup)
9444 /* Resource Set Cfg */
9445 if(cuPucchCfg->choice.setup->resourceSetToAddModList)
9447 DU_ALLOC_SHRABL_BUF(macPucchCfg->resrcSet, sizeof(PucchResrcSetCfg));
9448 if(macPucchCfg->resrcSet == NULLP)
9450 DU_LOG("\nERROR --> F1AP : Failed to extract Resrc set List in extractPucchCfg()");
9453 memset(macPucchCfg->resrcSet, 0, sizeof(PucchResrcSetCfg));
9454 extractResrcSetToAddModList(macPucchCfg->resrcSet, cuPucchCfg->choice.setup->resourceSetToAddModList);
9458 if(cuPucchCfg->choice.setup->resourceToAddModList)
9460 DU_ALLOC_SHRABL_BUF(macPucchCfg->resrc, sizeof(PucchResrcCfg));
9461 if(macPucchCfg->resrc == NULLP)
9463 DU_LOG("\nERROR --> F1AP : Failed to extract Resrc List in extractPucchCfg()");
9466 memset(macPucchCfg->resrc, 0, sizeof(PucchResrcCfg));
9467 extractResrcToAddModList(macPucchCfg->resrc, cuPucchCfg->choice.setup->resourceToAddModList);
9471 if(cuPucchCfg->choice.setup->format1)
9473 DU_ALLOC_SHRABL_BUF(macPucchCfg->format1, sizeof(PucchFormatCfg));
9474 if(macPucchCfg->format1 == NULLP)
9476 DU_LOG("\nERROR --> F1AP : Failed to extract format 1 Cfg in extractPucchCfg()");
9479 memset(macPucchCfg->format1, 0, sizeof(PucchFormatCfg));
9480 extractPucchFormatCfg(macPucchCfg->format1,\
9481 cuPucchCfg->choice.setup->format1->choice.setup);
9485 if(cuPucchCfg->choice.setup->format2)
9487 DU_ALLOC_SHRABL_BUF(macPucchCfg->format2, sizeof(PucchFormatCfg));
9488 if(macPucchCfg->format2 == NULLP)
9490 DU_LOG("\nERROR --> F1AP : Failed to extract format 2 Cfg in extractPucchCfg()");
9493 memset(macPucchCfg->format2, 0, sizeof(PucchFormatCfg));
9494 extractPucchFormatCfg(macPucchCfg->format2,\
9495 cuPucchCfg->choice.setup->format2->choice.setup);
9499 if(cuPucchCfg->choice.setup->format3)
9501 DU_ALLOC_SHRABL_BUF(macPucchCfg->format3, sizeof(PucchFormatCfg));
9502 if(macPucchCfg->format3 == NULLP)
9504 DU_LOG("\nERROR --> F1AP : Failed to extract format 3 Cfg in extractPucchCfg()");
9507 memset(macPucchCfg->format3, 0, sizeof(PucchFormatCfg));
9508 extractPucchFormatCfg(macPucchCfg->format3,\
9509 cuPucchCfg->choice.setup->format3->choice.setup);
9513 if(cuPucchCfg->choice.setup->format4)
9515 DU_ALLOC_SHRABL_BUF(macPucchCfg->format4, sizeof(PucchFormatCfg));
9516 if(macPucchCfg->format4 == NULLP)
9518 DU_LOG("\nERROR --> F1AP : Failed to extract format 4 Cfg in extractPucchCfg()");
9521 memset(macPucchCfg->format4, 0, sizeof(PucchFormatCfg));
9522 extractPucchFormatCfg(macPucchCfg->format4,\
9523 cuPucchCfg->choice.setup->format4->choice.setup);
9526 /* Sched Req List */
9527 if(cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList)
9529 DU_ALLOC_SHRABL_BUF(macPucchCfg->schedReq, sizeof(PucchSchedReqCfg));
9530 if(macPucchCfg->schedReq == NULLP)
9532 DU_LOG("\nERROR --> F1AP : Failed to extract schedReqCfg in extractPucchCfg()");
9535 memset(macPucchCfg->schedReq, 0, sizeof(PucchSchedReqCfg));
9536 extractSchedReqCfgToAddMod(macPucchCfg->schedReq,\
9537 cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList);
9540 /*TODO: Add support for Spatial Info */
9543 if(cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList)
9545 DU_ALLOC_SHRABL_BUF(macPucchCfg->multiCsiCfg, sizeof(PucchMultiCsiCfg));
9546 if(macPucchCfg->multiCsiCfg == NULLP)
9548 DU_LOG("\nERROR --> F1AP : Failed to extract multiCsiCfg in extractPucchCfg()");
9551 memset(macPucchCfg->multiCsiCfg, 0, sizeof(PucchMultiCsiCfg));
9552 macPucchCfg->multiCsiCfg->multiCsiResrcListCount = cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.count;
9553 for(arrIdx =0; arrIdx < macPucchCfg->multiCsiCfg->multiCsiResrcListCount; arrIdx++)
9555 macPucchCfg->multiCsiCfg->multiCsiResrcList[arrIdx] =\
9556 *cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.array[arrIdx];
9560 /* Dl_DataToUL_ACK */
9561 if(cuPucchCfg->choice.setup->dl_DataToUL_ACK)
9565 if(storedPucchCfg->dlDataToUlAck)
9567 macPucchCfg->dlDataToUlAck = storedPucchCfg->dlDataToUlAck;
9571 DU_ALLOC_SHRABL_BUF(macPucchCfg->dlDataToUlAck, sizeof(PucchDlDataToUlAck));
9576 DU_ALLOC_SHRABL_BUF(macPucchCfg->dlDataToUlAck, sizeof(PucchDlDataToUlAck));
9578 if(macPucchCfg->dlDataToUlAck == NULLP)
9580 DU_LOG("\nERROR --> F1AP : Failed to extract Dl_DataToUL_ACK in extractPucchCfg()");
9583 memset(macPucchCfg->dlDataToUlAck, 0, sizeof(PucchDlDataToUlAck));
9584 macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount = cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.count;
9585 for(arrIdx = 0; arrIdx < macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount; arrIdx++)
9587 macPucchCfg->dlDataToUlAck->dlDataToUlAckList[arrIdx] =\
9588 *cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.array[arrIdx];
9593 if(cuPucchCfg->choice.setup->pucch_PowerControl)
9595 DU_ALLOC_SHRABL_BUF(macPucchCfg->powerControl, sizeof(PucchPowerControl));
9596 if(macPucchCfg->powerControl == NULLP)
9598 DU_LOG("\nERROR --> F1AP : Failed to extract power control in extractPucchCfg()");
9601 extractPucchPowerControl(macPucchCfg->powerControl,\
9602 cuPucchCfg->choice.setup->pucch_PowerControl);
9609 /*******************************************************************
9611 * @brief Fills ServingCellReconfig received by CU
9615 * Function : extractSpCellDedicatedCfg
9617 * Functionality: Fills ServingCellReconfig received by CU
9619 * @params[in] ServingCellConfig_t *cuSrvCellCfg = Information which is send by
9620 * CU, which we have stored in F1UeContextSetupDb,
9621 * ServCellCfgInfo *macSrvCellCfg = Used to Store the information
9622 * which needs to send in other layer, as well as this can be the
9623 * variable which stores the information in DuCb,
9624 * ServCellCfgInfo *storedSrvCellCfg = Null in case of sending the
9625 * information to other layer else it will have ServCellCfgInfo which
9626 * we have stored in copyOfmacUeCfg.
9627 * @return ROK/RFAILD
9629 * ****************************************************************/
9630 uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellCfgInfo *macSrvCellCfg,\
9631 ServCellCfgInfo *storedSrvCellCfg)
9634 BWP_DownlinkDedicated_t *dlBwp = NULLP;
9635 BWP_UplinkDedicated_t *ulBwp = NULLP;
9637 if(cuSrvCellCfg->initialDownlinkBWP)
9639 dlBwp = ((BWP_DownlinkDedicated_t *)(cuSrvCellCfg->initialDownlinkBWP));
9640 if(dlBwp->pdcch_Config)
9642 if(dlBwp->pdcch_Config->choice.setup)
9644 macSrvCellCfg->initDlBwp.pdcchPresent = true;
9645 if(storedSrvCellCfg)
9647 if(!storedSrvCellCfg->initDlBwp.pdcchPresent)
9649 extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
9653 extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
9658 extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
9662 if(dlBwp->pdsch_Config)
9664 if(dlBwp->pdsch_Config->choice.setup)
9666 macSrvCellCfg->initDlBwp.pdschPresent = true;
9668 if(storedSrvCellCfg)
9670 if(!storedSrvCellCfg->initDlBwp.pdschPresent)
9672 extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg, NULL);
9676 extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg,\
9677 &storedSrvCellCfg->initDlBwp.pdschCfg);
9682 extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg, NULL);
9687 if(cuSrvCellCfg->firstActiveDownlinkBWP_Id)
9688 macSrvCellCfg->firstActvDlBwpId = *(cuSrvCellCfg->firstActiveDownlinkBWP_Id);
9689 if(cuSrvCellCfg->defaultDownlinkBWP_Id)
9690 macSrvCellCfg->defaultDlBwpId = *(cuSrvCellCfg->defaultDownlinkBWP_Id);
9691 if(cuSrvCellCfg->bwp_InactivityTimer)
9693 if(macSrvCellCfg->bwpInactivityTmr)
9695 memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t));
9699 macSrvCellCfg->bwpInactivityTmr = NULLP;
9700 DU_ALLOC_SHRABL_BUF(macSrvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
9701 if(macSrvCellCfg->bwpInactivityTmr)
9703 memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t));
9707 DU_LOG("\nERROR --> F1AP : Memory Alloc failed for bwpInactivityTmr at extractSpCellDedicatedCfg()");
9712 if(cuSrvCellCfg->pdsch_ServingCellConfig)
9714 if(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup)
9716 ret = extractPdschServingCellCfg(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup, &macSrvCellCfg->pdschServCellCfg);
9719 DU_LOG("\nERROR --> F1AP : Failed at extractPdschServingCellCfg()");
9724 if(cuSrvCellCfg->uplinkConfig)
9726 if(cuSrvCellCfg->uplinkConfig->initialUplinkBWP)
9728 ulBwp = ((BWP_UplinkDedicated_t *)(cuSrvCellCfg->uplinkConfig->initialUplinkBWP));
9729 if(ulBwp->pusch_Config)
9731 macSrvCellCfg->initUlBwp.puschPresent = true;
9732 extractPuschCfg(ulBwp->pusch_Config, &macSrvCellCfg->initUlBwp.puschCfg);
9734 if(ulBwp->pucch_Config)
9736 macSrvCellCfg->initUlBwp.pucchPresent = true;
9737 memset(&macSrvCellCfg->initUlBwp.pucchCfg, 0, sizeof(PucchCfg));
9738 if(storedSrvCellCfg)
9740 if(!storedSrvCellCfg->initUlBwp.pucchPresent)
9741 extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg, NULL);
9743 extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg,\
9744 &storedSrvCellCfg->initUlBwp.pucchCfg);
9748 extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg, NULL);
9752 if(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id)
9753 macSrvCellCfg->firstActvUlBwpId = *(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id);
9757 /*******************************************************************
9759 * @brief Fills Reconfig Cell group Info received by CU
9763 * Function : extractUeReCfgCellInfo
9765 * Functionality: Fills Reconfig Cell group Info received by CU
9767 * @params[in] CellGroupConfigRrc_t *cellGrp = CellGroupConfigRrc_t information which
9768 * is send by CU, which we have stored in F1UeContextSetupDb
9769 * MacUeCfg *MacUeCfg = Used to Store the information,
9770 * which needs to send in other layer, as well as this can be
9771 * the variable which stores the information in DuCb,
9772 * MacUeCfg *storedMacUeCfg = Null in case of sending the
9773 * information to other layer else it will have copyOfmacUeCfg
9774 * which we have stored in F1UeContextSetupDb.
9776 * @return ROK/RFAILED
9778 * ****************************************************************/
9779 uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg, MacUeCfg *storedMacUeCfg)
9782 MAC_CellGroupConfig_t *macCellGroup = NULLP;
9783 PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP;
9784 SpCellConfig_t *spcellCfg = NULLP;
9785 ServingCellConfig_t *servCellCfg = NULLP;
9789 /* Fill MacCell Group Reconfig */
9790 if(cellGrp->mac_CellGroupConfig)
9792 macUeCfg->macCellGrpCfgPres = true;
9793 macCellGroup = ((MAC_CellGroupConfig_t *)(cellGrp->mac_CellGroupConfig));
9794 if(macCellGroup->schedulingRequestConfig)
9796 extractSchReqReConfig(macCellGroup->schedulingRequestConfig, &macUeCfg->macCellGrpCfg.schReqCfg);
9798 if(macCellGroup->tag_Config)
9800 extractTagReconfig(macCellGroup->tag_Config, &macUeCfg->macCellGrpCfg.tagCfg);
9802 if(macCellGroup->bsr_Config)
9804 macUeCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer = macCellGroup->bsr_Config->periodicBSR_Timer;
9805 macUeCfg->macCellGrpCfg.bsrTmrCfg.retxTimer = macCellGroup->bsr_Config->retxBSR_Timer;
9806 if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer)
9808 macUeCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer =\
9809 *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer);
9812 if(macCellGroup->phr_Config)
9814 if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup)
9816 macUeCfg->macCellGrpCfg.phrCfgSetupPres = true;
9817 if(macCellGroup->phr_Config->choice.setup)
9819 macUeCfg->macCellGrpCfg.phrCfg.periodicTimer = \
9820 macCellGroup->phr_Config->choice.setup->phr_PeriodicTimer;
9821 macUeCfg->macCellGrpCfg.phrCfg.prohibitTimer = \
9822 macCellGroup->phr_Config->choice.setup->phr_ProhibitTimer;
9823 macUeCfg->macCellGrpCfg.phrCfg.txPowerFactor = \
9824 macCellGroup->phr_Config->choice.setup->phr_Tx_PowerFactorChange;
9825 macUeCfg->macCellGrpCfg.phrCfg.multiplePHR = \
9826 macCellGroup->phr_Config->choice.setup->multiplePHR;
9827 macUeCfg->macCellGrpCfg.phrCfg.dummy = \
9828 macCellGroup->phr_Config->choice.setup->dummy;
9829 macUeCfg->macCellGrpCfg.phrCfg.phrType2OtherCell = \
9830 macCellGroup->phr_Config->choice.setup->phr_Type2OtherCell;
9831 macUeCfg->macCellGrpCfg.phrCfg.phrOtherCG = \
9832 macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG;
9837 /* Fill Physical Cell Group Reconfig */
9838 if(cellGrp->physicalCellGroupConfig)
9840 macUeCfg->phyCellGrpCfgPres = true;
9841 phyCellGrpCfg = ((PhysicalCellGroupConfig_t *)(cellGrp->physicalCellGroupConfig));
9842 if(phyCellGrpCfg->p_NR_FR1)
9844 if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1)
9845 macUeCfg->phyCellGrpCfg.pNrFr1 = *(phyCellGrpCfg->p_NR_FR1);
9847 macUeCfg->phyCellGrpCfg.pdschHarqAckCodebook = phyCellGrpCfg->pdsch_HARQ_ACK_Codebook;
9849 /* Fill SpCell Reconfig */
9850 if(cellGrp->spCellConfig)
9852 macUeCfg->spCellCfgPres = true;
9853 spcellCfg = ((SpCellConfig_t *)(cellGrp->spCellConfig));
9854 if(spcellCfg->servCellIndex)
9856 macUeCfg->spCellCfg.servCellIdx = *(spcellCfg->servCellIndex);
9858 /* Fill Serving cell Reconfig info */
9859 if(cellGrp->spCellConfig->spCellConfigDedicated)
9861 servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated));
9864 if(!storedMacUeCfg->spCellCfgPres)
9865 ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg, NULL);
9867 ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg,\
9868 &storedMacUeCfg->spCellCfg.servCellCfg);
9872 ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg, NULL);
9876 DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()");
9883 /*******************************************************************
9885 * @brief free the memory allocated by decoder
9889 * Function : freeAperDecodeNrcgi
9891 * Functionality: Free Nrcgi values
9893 * @params[in] NRCGI_t *nrcgi
9896 * ****************************************************************/
9899 void freeAperDecodeNrcgi(NRCGI_t *nrcgi)
9901 if(nrcgi->pLMN_Identity.buf != NULLP)
9903 free(nrcgi->pLMN_Identity.buf);
9905 if(nrcgi->nRCellIdentity.buf != NULLP)
9907 free(nrcgi->nRCellIdentity.buf);
9910 /*******************************************************************
9912 * @brief free the memory allocated by decoder
9916 * Function : freeAperDecodeCuToDuInfo
9918 * Functionality: Free Cu To Du Information
9920 * @params[in] CUtoDURRCInformation_t *rrcMsg
9923 * ****************************************************************/
9926 void freeAperDecodeCuToDuInfo(CUtoDURRCInformation_t *rrcMsg)
9931 if(rrcMsg->uE_CapabilityRAT_ContainerList)
9933 if(rrcMsg->uE_CapabilityRAT_ContainerList->buf)
9934 free(rrcMsg->uE_CapabilityRAT_ContainerList->buf);
9935 free(rrcMsg->uE_CapabilityRAT_ContainerList);
9938 if(rrcMsg->iE_Extensions)
9940 if(rrcMsg->iE_Extensions->list.array)
9942 for(ieIdx= 0; ieIdx < rrcMsg->iE_Extensions->list.count; ieIdx++)
9944 if(rrcMsg->iE_Extensions->list.array[ieIdx])
9946 switch(rrcMsg->iE_Extensions->list.array[ieIdx]->id)
9948 case ProtocolIE_ID_id_CellGroupConfig:
9949 if(rrcMsg->iE_Extensions->list.array[ieIdx]->extensionValue.choice.CellGroupConfig.buf != NULLP)
9951 free(rrcMsg->iE_Extensions->list.array[ieIdx]->extensionValue.choice.CellGroupConfig.buf);
9955 DU_LOG("\nERROR --> F1AP : Invalid Event type %ld at FreeCuToDuInfo()", \
9956 rrcMsg->iE_Extensions->list.array[ieIdx]->id);
9961 for(arrIdx = 0; arrIdx < ieIdx; arrIdx++)
9963 free(rrcMsg->iE_Extensions->list.array[arrIdx]);
9965 free(rrcMsg->iE_Extensions->list.array);
9969 free(rrcMsg->iE_Extensions);
9972 /*******************************************************************
9974 * @brief free the memory allocated by decoder
9978 * Function : freeAperDecodeSplCellList
9980 * Functionality: Free Spl Cell List
9981 where memory allocated by aper_decoder
9983 * @params[in] SCell_ToBeSetup_List_t *spCellLst
9986 * ****************************************************************/
9989 void freeAperDecodeSplCellList(SCell_ToBeSetup_List_t *spCellLst)
9993 if(spCellLst->list.array != NULLP)
9995 for(cellIdx=0; cellIdx<spCellLst->list.count; cellIdx++)
9997 if(cellIdx==0&&spCellLst->list.array[cellIdx]!=NULLP)
9999 freeAperDecodeNrcgi(&spCellLst->list.array[cellIdx]->value.choice.SCell_ToBeSetup_Item.sCell_ID);
10001 if(spCellLst->list.array[cellIdx]!=NULLP)
10003 free(spCellLst->list.array[cellIdx]);
10006 free(spCellLst->list.array);
10009 /*******************************************************************
10011 * @brief free the memory allocated by decoder
10015 * Function : freeAperDecodeSRBSetup
10017 * Functionality: added free part for the memory allocated by aper_decoder
10019 * @params[in] SRBs_ToBeSetup_List_t *srbSet
10022 ****************************************************************/
10025 void freeAperDecodeSRBSetup(SRBs_ToBeSetup_List_t *srbSet)
10028 if(srbSet->list.array != NULLP)
10030 for(srbIdx=0; srbIdx<srbSet->list.count; srbIdx++)
10032 if(srbSet->list.array[srbIdx]!=NULLP)
10034 free(srbSet->list.array[srbIdx]);
10037 free(srbSet->list.array);
10041 /*******************************************************************
10043 * @brief free the memory allocated by decoder
10047 * Function : freeAperDecodeULTnlInfo
10049 * Functionality: added free part for the memory allocated by aper_decoder
10051 * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
10054 * ****************************************************************/
10057 void freeAperDecodeULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
10060 if(ulInfo->list.array != NULLP)
10062 for(ulIdx=0; ulIdx<ulInfo->list.count; ulIdx++)
10064 if(ulIdx==0&&ulInfo->list.array[ulIdx]!=NULLP)
10066 if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel!=NULLP)
10068 if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->\
10069 transportLayerAddress.buf != NULLP)
10071 if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\
10074 free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf);
10076 free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->\
10077 transportLayerAddress.buf);
10079 free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel);
10082 if(ulInfo->list.array[ulIdx]!=NULLP)
10084 free(ulInfo->list.array[ulIdx]);
10087 free(ulInfo->list.array);
10090 /*******************************************************************
10092 * @brief free the memory allocated by decoder
10096 * Function : freeAperDecodeDRBSetup
10098 * Functionality: free DRBSetup which is allocated by decoder
10100 * @params[in] DRBs_ToBeSetup_List_t *drbSet
10103 * ****************************************************************/
10105 void freeAperDecodeDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
10107 DRBs_ToBeSetup_Item_t *drbSetItem = NULLP;
10108 uint8_t flowIdx =0;
10111 if(drbSet->list.array != NULLP)
10113 for(drbIdx=0; drbIdx<drbSet->list.count; drbIdx++)
10115 if(drbIdx==0&&drbSet->list.array[drbIdx] != NULLP)
10117 drbSetItem =&drbSet->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
10118 if(drbSetItem->qoSInformation.choice.choice_extension != NULLP)
10120 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
10121 qoS_Characteristics.choice.non_Dynamic_5QI !=NULLP)
10123 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
10124 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
10126 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
10127 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
10130 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf!=NULLP)
10133 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD!=NULLP)
10136 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->\
10140 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\
10141 flows_Mapped_To_DRB_List.list.array != NULLP)
10144 for(flowIdx=0;flowIdx<drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
10145 DRB_Information.flows_Mapped_To_DRB_List.list.count; flowIdx++)
10148 if(flowIdx==0&&drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
10149 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP)
10151 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
10152 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
10153 qoSFlowLevelQoSParameters.\
10154 qoS_Characteristics.choice.non_Dynamic_5QI!=NULLP)
10156 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
10157 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
10158 qoSFlowLevelQoSParameters.\
10159 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
10162 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
10163 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
10164 qoSFlowLevelQoSParameters.\
10165 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
10169 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
10170 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
10171 qoSFlowLevelQoSParameters.\
10172 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
10175 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
10176 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
10177 qoSFlowLevelQoSParameters.\
10178 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
10181 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
10183 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
10184 qoSFlowLevelQoSParameters.\
10185 qoS_Characteristics.choice.non_Dynamic_5QI);
10188 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
10189 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP)
10192 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
10193 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]);
10197 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
10198 DRB_Information.flows_Mapped_To_DRB_List.list.array);
10201 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
10202 DRB_Information.sNSSAI.sD->buf);
10205 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD);
10208 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf);
10212 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
10214 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
10217 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
10218 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
10221 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
10222 qoS_Characteristics.choice.non_Dynamic_5QI);
10224 free(drbSetItem->qoSInformation.choice.choice_extension);
10226 freeAperDecodeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List);
10227 if(drbSetItem->uLConfiguration)
10229 free(drbSetItem->uLConfiguration);
10232 if(drbSet->list.array[drbIdx]!=NULLP)
10234 free(drbSet->list.array[drbIdx]);
10237 free(drbSet->list.array);
10242 /*******************************************************************
10244 * @brief builds Mac Cell Cfg
10248 * Function : procUeReCfgCellInfo
10250 * Functionality: builds Mac Cell Cfg
10252 * @params[in] MacUeCfg *macUeCfgToSend = Used to Store the information which
10253 * needs to send in other layer, as well as this can be
10254 * the variable which stores the information in DuCb.
10255 * MacUeCfg *storedMacUeCfg = Null in case of sending the
10256 * information to other layer else it will have copyOfmacUeCfg
10257 * which we have stored in F1UeContextSetupDb
10258 * void *cellInfo = CellGroupConfigRrc_t information which is send
10259 * by CU, which we have stored in F1UeContextSetupDb
10263 * ****************************************************************/
10264 uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfgToSend,MacUeCfg *storedMacUeCfg, void *cellInfo)
10267 CellGroupConfigRrc_t *cellGrp = NULLP;
10271 cellGrp = (CellGroupConfigRrc_t *)cellInfo;
10272 ret = extractUeReCfgCellInfo(cellGrp, macUeCfgToSend, storedMacUeCfg);
10274 DU_LOG("\nERROR --> F1AP : Failed at procUeReCfgCellInfo()");
10278 freeUeReCfgCellGrpInfo(macUeCfgToSend);
10283 /*******************************************************************
10285 * @brief Filling modulation info in mac ue cfg
10289 * Function : duFillModulationDetails
10291 * Functionality: Filling modulation info in mac ue cfg
10293 * @params[in] MAC UE Config to be updated
10294 * Current UE configuration
10295 * UE NR capability from CU
10296 * @return ROK - success
10297 * RFAILED - failure
10299 * ****************************************************************/
10300 void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap)
10302 UE_NR_Capability_t *ueNrCap=NULLP;
10306 memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
10307 memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
10311 ueNrCap = (UE_NR_Capability_t *)ueCap;
10313 /* Filling DL modulation info */
10314 if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsDownlinkPerCC && \
10315 ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0] && \
10316 ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL)
10318 switch(*(ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL))
10320 case ModulationOrder_qpsk:
10322 ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK;
10325 case ModulationOrder_qam16:
10327 ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM16;
10330 case ModulationOrder_qam64:
10332 ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM64;
10333 ueCfg->dlModInfo.mcsIndex = PDSCH_MCS_INDEX;
10334 ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64;
10337 case ModulationOrder_qam256:
10339 ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM256;
10344 DU_LOG("\nERROR --> DU APP: Incorrect downlink modulation order received. Reatining old modulation configuration");
10345 memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
10352 memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
10355 /* Filling UL modulation info */
10356 if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsUplinkPerCC && \
10357 ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0] && \
10358 ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL)
10360 switch(*(ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL))
10362 case ModulationOrder_qpsk:
10364 ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK;
10367 case ModulationOrder_qam16:
10369 ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM16;
10370 ueCfg->ulModInfo.mcsIndex = PUSCH_MCS_INDEX;
10371 ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64;
10374 case ModulationOrder_qam64:
10376 ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM64;
10379 case ModulationOrder_qam256:
10381 ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM256;
10386 DU_LOG("\nERROR --> DU APP: Incorrect uplink modulation order received. Reatining old modulation configuration");
10387 memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
10394 memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
10399 /*******************************************************************
10401 * @brief Function to extract cellGrp Info present in cutoDu cont
10405 * Function : extractCellGrpInfo
10407 * Functionality: Function to extract cellGrp Info present
10410 * @params[in] ProtocolExtensionContainer_4624P16_t pointer
10412 * @return CellGroupConfigRrc_t *
10414 * ****************************************************************/
10416 CellGroupConfigRrc_t *extractCellGrpInfo(ProtocolExtensionContainer_4624P16_t *protocolIeExtn,\
10421 uint16_t recvBufLen =0;
10422 CellGroupConfigRrc_t *cellGrpCfg = NULLP;
10423 CUtoDURRCInformation_ExtIEs_t *extIeInfo = NULLP;
10424 asn_dec_rval_t rval; /* Decoder return value */
10425 memset(&rval, 0, sizeof(asn_dec_rval_t));
10429 for(idx2 = 0; idx2 < protocolIeExtn->list.count; idx2++)
10431 extIeInfo = ((CUtoDURRCInformation_ExtIEs_t *)(protocolIeExtn->list.array[idx2]));
10432 id = extIeInfo->id;
10435 case ProtocolIE_ID_id_CellGroupConfig:
10437 recvBufLen = extIeInfo->extensionValue.choice.CellGroupConfig.size;
10438 /* decoding the CellGroup Buf received */
10439 DU_ALLOC(cellGrpCfg, sizeof(CellGroupConfigRrc_t));
10442 memset(cellGrpCfg, 0, sizeof(CellGroupConfigRrc_t));
10443 rval = aper_decode(0, &asn_DEF_CellGroupConfigRrc, (void **)&cellGrpCfg,
10444 extIeInfo->extensionValue.choice.CellGroupConfig.buf, recvBufLen, 0, 0);
10445 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
10447 DU_LOG("\nERROR --> F1AP : ASN decode failed at decodeCellGrpCfg()");
10450 xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, cellGrpCfg);
10451 if(extractRlcCfgToAddMod(cellGrpCfg->rlc_BearerToAddModList, ueCfgDb))
10457 DU_LOG("\nERROR --> F1AP : Invalid IE received CUtoDURRCInformation:%d at decodeCellGrpCfg()", id);
10465 /*******************************************************************
10467 * @brief Fills Srb List received by CU
10471 * Function : procSrbListToSetup
10473 * Functionality: Fills Srb List received by CU
10475 * @params[in] SRBs_ToBeSetup_Item_t *cuSrbItem
10477 * RlcBearerCfg pointer
10480 * ****************************************************************/
10481 uint8_t procSrbListToSetup(SRBs_ToBeSetup_Item_t * srbItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd)
10484 /* Filling RLC INFO */
10485 procRlcLcCfg(srbItem->sRBID, srbItem->sRBID, RB_TYPE_SRB, RLC_AM, CONFIG_ADD, NULL, rlcLcToAdd, NULL);
10487 /* Filling MAC INFO */
10488 if(procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL,NULL, NULL, NULL, macLcToAdd, NULL) != ROK)
10490 DU_LOG("\nERROR --> F1AP : Failed at MAC LC Cfg in procSrbListToSetup()");
10499 /*******************************************************************
10501 * @brief extract Srb List received by CU
10505 * Function : extractSrbListToSetup
10507 * Functionality: extract Srb List received by CU
10508 * for both MAC and RLC
10510 * @params[in] SRBs_ToBeSetup_Item_t pointer
10512 * @return ROK/RFAIED
10514 * ****************************************************************/
10516 uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb)
10518 uint8_t ret, srbIdx;
10519 SRBs_ToBeSetup_Item_t *srbItem = NULLP;
10523 for(srbIdx = 0; srbIdx < srbCfg->list.count; srbIdx++)
10525 srbItem = &srbCfg->list.array[srbIdx]->value.choice.SRBs_ToBeSetup_Item;
10526 if(ueCfgDb->numMacLcs > MAX_NUM_LC)
10528 DU_LOG("\nERROR --> F1AP: MAX LC Reached in MAC");
10532 if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
10534 DU_LOG("\nERROR --> F1AP: MAX LC Reached in RLC");
10538 memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
10539 memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
10540 ret = procSrbListToSetup(srbItem, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\
10541 &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs]);
10542 ueCfgDb->numRlcLcs++;
10543 ueCfgDb->numMacLcs++;
10544 DU_LOG("\nDEBUG --> DUAPP: extractSrbListToSetup: SRBID: %d [RLC,MAC,NumDrb]:[%x,%x,%x]",\
10545 srbItem->sRBID, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
10548 DU_LOG("\nERROR --> F1AP: Failed at extractSrbListToSetup()");
10559 /*******************************************************************
10561 * @brief Fills Drb List received by CU
10565 * Function : procDrbListToSetupMod
10567 * Functionality: Fills Drb List received by CU
10568 * for both MAC and RLC
10570 * @params[in] DRBs_ToBeSetup_Item_t , DRBs_ToBeSetupMod_Item_t,
10571 * DRBs_ToBeModified_Item_t , lcId, LcCfg pointer,
10572 * RlcBearerCfg , UpTnlCfg, RlcUeCfg
10575 * ****************************************************************/
10577 uint8_t procDrbListToSetupMod(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem,\
10578 DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo, RlcUeCfg *storedRlcUeCfg)
10580 uint8_t cfgIdx = 0;
10581 RlcMode rlcModeInfo;
10583 if(drbItem != NULLP)
10585 /* Filling RLC INFO */
10586 procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd, &drbItem->\
10589 /* Filling MAC INFO */
10590 if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
10592 DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
10596 else if(drbSetupModItem != NULLP)
10598 procRlcLcCfg(drbSetupModItem->dRBID, lcId, RB_TYPE_DRB, drbSetupModItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd,
10599 &drbSetupModItem->qoSInformation);
10601 if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, NULL, drbSetupModItem, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
10603 DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
10607 else if(drbModItem != NULLP)
10609 /* Drb to Mod IEs doesnot have rlcMode to be modified
10610 * in ASN. Hence no change in RLC configurations */
10611 if(storedRlcUeCfg != NULLP)
10613 for(cfgIdx = 0; cfgIdx < storedRlcUeCfg->numLcs; cfgIdx++)
10615 if(storedRlcUeCfg->rlcLcCfg[cfgIdx].lcId == lcId)
10617 rlcModeInfo = storedRlcUeCfg->rlcLcCfg[cfgIdx].rlcMode;
10623 procRlcLcCfg(drbModItem->dRBID, lcId, RB_TYPE_DRB, rlcModeInfo, CONFIG_MOD, NULL, rlcLcToAdd, drbModItem->qoSInformation);
10624 if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_MOD, NULL, NULL, drbModItem, NULL, macLcToAdd, upTnlInfo) != ROK)
10626 DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
10633 /*******************************************************************
10635 * @brief extract Drb List received by CU
10639 * Function : extractDrbListToSetupMod
10641 * Functionality: extract Drb List received by CU
10642 * for both MAC and RLC
10644 * @params[in] DRBs_ToBeSetup_Item_t pointer
10646 * @return ROK/RFAIED
10648 * ****************************************************************/
10650 uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMod_List_t *drbSetupModCfg,\
10651 DRBs_ToBeModified_List_t *drbModCfg, uint8_t drbCount, DuUeCfg *ueCfgDb, uint32_t *drbBitMap, RlcUeCfg *rlcUeCfg)
10653 uint8_t ret, drbIdx = 0, lcId = 0;
10654 DRBs_ToBeSetup_Item_t *drbItem = NULLP;
10655 DRBs_ToBeSetupMod_ItemIEs_t *drbSetupModItem = NULLP;
10656 DRBs_ToBeModified_ItemIEs_t *drbModItem = NULLP;
10661 for(drbIdx = 0; drbIdx < drbCount; drbIdx++)
10663 if(ueCfgDb->numMacLcs > MAX_NUM_LC)
10665 DU_LOG("\nERROR --> F1AP : MAX LC Reached in MAC at extractDrbListToSetupMod()");
10669 if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
10671 DU_LOG("\nERROR --> F1AP : MAX LC Reached in RLC at extractDrbListToSetupMod()");
10675 memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
10676 memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
10678 if(drbModCfg != NULLP)
10680 drbModItem = (DRBs_ToBeModified_ItemIEs_t *) drbModCfg->list.array[drbIdx];
10681 lcId = fetchLcId(drbModItem->value.choice.DRBs_ToBeModified_Item.dRBID);
10682 if(lcId < MIN_DRB_LCID)
10684 DU_LOG("\nERROR --> F1AP : Failed fetching LCID %d in extractDrbListToSetupMod() for Modified List", lcId);
10687 ret = procDrbListToSetupMod(lcId, NULL, NULL, &(drbModItem->value.choice.DRBs_ToBeModified_Item),\
10688 &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs],\
10689 &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
10692 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for Modified List");
10699 lcId = getDrbLcId(drbBitMap);
10700 if(lcId == RFAILED)
10702 DU_LOG("\nERROR --> F1AP : InCorrect LCID extractDrbListToSetupMod()");
10708 drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
10709 ret = procDrbListToSetupMod(lcId, drbItem, NULL, NULL, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\
10710 &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
10713 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetup List");
10717 else if(drbSetupModCfg != NULL)
10719 drbSetupModItem = (DRBs_ToBeSetupMod_ItemIEs_t *) drbSetupModCfg->list.array[drbIdx];
10720 ret = procDrbListToSetupMod(lcId, NULL, &(drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item), NULL,\
10721 &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs],\
10722 &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
10725 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetupMod List");
10728 ueCfgDb->numDrbSetupMod++;
10731 ueCfgDb->numRlcLcs++;
10732 ueCfgDb->numMacLcs++;
10735 DU_LOG("\nDEBUG --> DUAPP: extractDrbListToSetupMod:lcId:%x ,BitMap:%x, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
10736 lcId,*drbBitMap, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
10739 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod()");
10750 /*******************************************************************
10752 * @brief Function to extract Dl RRC Msg received from CU
10756 * Function : extractDlRrcMsg
10758 * Functionality: Function to extract Dl RRC Msg received from CU
10760 * @params[in] F1AP message
10761 * @return ROK - success
10762 * RFAILED - failure
10764 * ****************************************************************/
10766 uint8_t extractDlRrcMsg(uint32_t gnbDuUeF1apId, uint32_t gnbCuUeF1apId, \
10767 F1DlRrcMsg *dlRrcMsg, RRCContainer_t *rrcContainer)
10770 dlRrcMsg->rrcMsgSize = rrcContainer->size;
10771 if(dlRrcMsg->rrcMsgSize > 0)
10773 DU_ALLOC_SHRABL_BUF(dlRrcMsg->rrcMsgPdu, dlRrcMsg->rrcMsgSize);
10774 if(!dlRrcMsg->rrcMsgPdu)
10776 DU_LOG("\nERROR --> DU APP : Memory allocation failed for RRC Msg in extractDlRrcMsg()");
10781 dlRrcMsg->gnbDuUeF1apId = gnbDuUeF1apId;
10782 dlRrcMsg->gnbCuUeF1apId = gnbCuUeF1apId;
10783 dlRrcMsg->srbId = SRB1_LCID;
10784 memcpy(dlRrcMsg->rrcMsgPdu, rrcContainer->buf, dlRrcMsg->rrcMsgSize);
10790 /*******************************************************************
10792 * @brief Extract UE capability info
10796 * Function : extractUeCapability
10798 * Functionality: Extract UE capability info and stores in ue Cb
10800 * @params[in] Octet string of UE capability RAT container list
10801 * @return ROK - success
10802 * RFAILED - failure
10804 * ****************************************************************/
10805 UE_NR_Capability_t *extractUeCapability(UE_CapabilityRAT_ContainerList_t *ueCapablityListBuf, DuUeCb *ueCb)
10808 uint16_t recvBufLen;
10809 asn_dec_rval_t rval;
10810 UE_NR_Capability_t *ueNrCap = NULLP;
10811 UE_CapabilityRAT_ContainerListRRC_t *ueCapRatContList = NULLP;
10813 /* Decoding UE Capability RAT Container List */
10814 recvBufLen = ueCapablityListBuf->size;
10815 DU_ALLOC(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
10816 if(!ueCapRatContList)
10818 DU_LOG("\nERROR --> F1AP : Memory allocation failed in extractUeCapability");
10821 memset(ueCapRatContList, 0, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
10822 memset(&rval, 0, sizeof(asn_dec_rval_t));
10823 rval = aper_decode(0, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, (void **)&ueCapRatContList,
10824 ueCapablityListBuf->buf, recvBufLen, 0, 0);
10825 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
10827 DU_LOG("\nERROR --> F1AP : ASN decode failed at decodeCellGrpCfg()");
10830 xer_fprint(stdout, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, ueCapRatContList);
10832 /* Free encoded buffer after decoding */
10834 for(idx = 0; idx < ueCapRatContList->list.count; idx++)
10836 if(ueCapRatContList->list.array[idx]->rat_Type == RAT_Type_nr)
10838 /* Decoding UE NR Capability */
10839 recvBufLen = ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.size;
10840 DU_ALLOC(ueNrCap, sizeof(UE_NR_Capability_t));
10843 DU_LOG("\nERROR --> F1AP : Memory allocation failed in extractUeCapability");
10844 DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
10847 memset(ueNrCap, 0, sizeof(UE_NR_Capability_t));
10848 memset(&rval, 0, sizeof(asn_dec_rval_t));
10849 rval = aper_decode(0, &asn_DEF_UE_NR_Capability, (void **)&ueNrCap,
10850 ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.buf, recvBufLen, 0, 0);
10851 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
10853 DU_LOG("\nERROR --> F1AP : ASN decode failed at decodeCellGrpCfg()");
10856 xer_fprint(stdout, &asn_DEF_UE_NR_Capability, ueNrCap);
10858 /* Free encoded buffer after decoding */
10859 free(ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.buf);
10861 free(ueCapRatContList->list.array[idx]);
10865 free(ueCapRatContList->list.array);
10866 DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
10870 /*******************************************************************
10872 * @brief free UE context setup request from CU
10876 * Function : freeAperDecodeF1UeContextSetupReq
10878 * Functionality: freeing part for the memory allocated by aper_decoder
10880 * @params[in] F1AP message
10881 * @return ROK - success
10882 * RFAILED - failure
10884 * ****************************************************************/
10885 void freeAperDecodeF1UeContextSetupReq(UEContextSetupRequest_t *ueSetReq)
10889 if(ueSetReq->protocolIEs.list.array != NULLP)
10891 for(ieIdx = 0; ieIdx < ueSetReq->protocolIEs.list.count; ieIdx++)
10893 if(ueSetReq->protocolIEs.list.array[ieIdx])
10895 switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
10897 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
10899 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
10901 case ProtocolIE_ID_id_SpCell_ID:
10902 freeAperDecodeNrcgi(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.NRCGI);
10904 case ProtocolIE_ID_id_ServCellIndex:
10906 case ProtocolIE_ID_id_SpCellULConfigured:
10908 case ProtocolIE_ID_id_CUtoDURRCInformation:
10910 freeAperDecodeCuToDuInfo(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation);
10912 case ProtocolIE_ID_id_SCell_ToBeSetup_List:
10914 freeAperDecodeSplCellList(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SCell_ToBeSetup_List);
10916 case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
10918 freeAperDecodeSRBSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List);
10920 case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
10922 freeAperDecodeDRBSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List);
10924 case ProtocolIE_ID_id_RRCContainer:
10927 if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf != NULLP)
10930 free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf);
10934 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
10936 case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
10938 if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf)
10940 free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf);
10945 DU_LOG("\nERROR --> F1AP: Invalid event type %ld " ,ueSetReq->protocolIEs.list.array[ieIdx]->id);
10947 free(ueSetReq->protocolIEs.list.array[ieIdx]);
10950 free(ueSetReq->protocolIEs.list.array);
10953 /*******************************************************************
10955 * @brief Process UE context setup request from CU
10959 * Function : procF1UeContextSetupReq
10961 * Functionality: Process UE context setup request from CU
10963 * @params[in] F1AP message
10964 * @return ROK - success
10965 * RFAILED - failure
10967 * ****************************************************************/
10968 uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
10970 uint8_t ret=0, ieIdx=0, ueIdx=0, cellIdx=0;
10971 bool ueCbFound = false;
10972 uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0, bitRateSize=0;
10973 DuUeCb *duUeCb = NULL;
10974 UEContextSetupRequest_t *ueSetReq = NULL;
10975 DRBs_ToBeSetup_List_t *drbCfg = NULL;
10979 ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
10980 for(ieIdx=0; (ieIdx < ueSetReq->protocolIEs.list.count && ret == ROK); ieIdx++)
10982 switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
10984 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
10986 gnbCuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
10989 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
10991 gnbDuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
10994 case ProtocolIE_ID_id_ServCellIndex:
10996 cellIdx = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.ServCellIndex;
10997 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
10999 if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
11000 (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
11003 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
11004 DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
11007 memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
11008 duUeCb->f1UeDb->actionType = UE_CTXT_SETUP;
11009 duUeCb->f1UeDb->cellIdx = cellIdx;
11013 DU_LOG("\nERROR --> F1AP: Memory Alloc Failed at procF1UeContextSetupReq()");
11024 DU_LOG("\nERROR --> F1AP: DuUeCb is not found at procF1UeContextSetupReq()");
11029 case ProtocolIE_ID_id_SpCellULConfigured:
11030 /* Indicates whether the gNB-CU requests the gNB-DU to configure the uplink as no UL,
11031 UL, SUL or UL+SUL for the indicated cell for the UE */
11033 case ProtocolIE_ID_id_CUtoDURRCInformation:
11035 if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList)
11037 duUeCb->f1UeDb->duUeCfg.ueNrCapability = \
11038 extractUeCapability(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.\
11039 uE_CapabilityRAT_ContainerList, duUeCb);
11041 if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.iE_Extensions)
11043 duUeCb->f1UeDb->duUeCfg.cellGrpCfg = extractCellGrpInfo(ueSetReq->protocolIEs.list.array[ieIdx]->\
11044 value.choice.CUtoDURRCInformation.iE_Extensions, &duUeCb->f1UeDb->duUeCfg);
11045 if(!duUeCb->f1UeDb->duUeCfg.cellGrpCfg)
11047 DU_LOG("\nERROR --> F1AP: Failed to extract cell Grp Info");
11048 //TODO: Update the failure cause in ue context Setup Response
11054 case ProtocolIE_ID_id_SCell_ToBeSetup_List:
11056 DU_LOG("\nINFO --> DU_APP: Received SCell_ToBeSetup_List but Not processing the list");
11059 case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
11061 if(extractSrbListToSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List,\
11062 &duUeCb->f1UeDb->duUeCfg))
11064 DU_LOG("\nERROR --> DU APP : Failed at extractSrbListToSetup()");
11065 //TODO: Update the failure cause in ue context Setup Response
11070 case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
11072 drbCfg = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List;
11074 if(extractDrbListToSetupMod(drbCfg, NULL, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULLP))
11076 DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod()");
11077 //TODO: Update the failure cause in ue context Setup Response
11082 case ProtocolIE_ID_id_RRCContainer:
11084 /* Filling Dl RRC Msg Info */
11085 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
11086 if(!duUeCb->f1UeDb->dlRrcMsg)
11088 DU_LOG("\nERROR --> DU APP : Memory allocation failed for DL RRC Msg in procUeCtxtSetupReq()");
11093 duUeCb->f1UeDb->dlRrcMsgPres = true;
11094 memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
11095 ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
11096 &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer);
11100 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
11102 if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
11104 duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true;
11108 DU_LOG("\nERROR --> Ignoring delivery report, since rrcContainer is not present");
11112 case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
11114 /* MaximumBitRate Uplink */
11115 bitRateSize = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.size;
11116 if(bitRateSize > 0)
11118 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->duUeCfg.ambrCfg, bitRateSize);
11119 if(!duUeCb->f1UeDb->duUeCfg.ambrCfg)
11121 DU_LOG("\nERROR --> DU APP : Memory allocation failed for bitRate in procUeCtxtSetupReq");
11126 memset(duUeCb->f1UeDb->duUeCfg.ambrCfg, 0, sizeof(AmbrCfg));
11127 memcpy(&duUeCb->f1UeDb->duUeCfg.ambrCfg->ulBr,
11128 ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf, bitRateSize);
11143 /*TODO : Negative case*/
11144 // BuildAndSendUeContextSetupRsp(cellId,ueIdx);
11145 DU_LOG("\nERROR --> F1AP: Failed to process UE CNTXT SETUP REQ at procF1UeContextSetupReq()");
11148 ret = duProcUeContextSetupRequest(duUeCb);
11150 freeAperDecodeF1UeContextSetupReq(ueSetReq);
11154 /*******************************************************************
11155 * @brief Free the memory allocated for Dl Tunnel Info
11159 * Function : freeDlTnlInfo
11162 * Free the memory allocated for Dl Tunnel Info
11164 * @params[in] DLUPTNLInformation_ToBeSetup_List_t *
11167 * ****************************************************************/
11169 void freeDlTnlInfo(DLUPTNLInformation_ToBeSetup_List_t *tnlInfo)
11171 uint8_t arrIdx = 0;
11175 for(arrIdx=0; arrIdx < tnlInfo->list.count; arrIdx++)
11177 DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.buf,\
11178 tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size);
11179 DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf,\
11180 tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->gTP_TEID.size);
11181 DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel, sizeof(GTPTunnel_t));
11182 DU_FREE(tnlInfo->list.array[arrIdx], sizeof(DLUPTNLInformation_ToBeSetup_Item_t));
11184 DU_FREE(tnlInfo->list.array, tnlInfo->list.size);
11188 /*******************************************************************
11189 * @brief Free the memory allocated for DRB setup List
11193 * Function : freeDrbSetupList
11196 * Free the memory allocated for DRB setup list
11198 * @params[in] DRBs_Setup_List_t *
11201 * ****************************************************************/
11202 void freeDrbSetupList(DRBs_Setup_List_t *drbSetupList)
11204 uint8_t arrIdx = 0;
11205 DRBs_Setup_ItemIEs_t *drbItemIe = NULLP;
11207 for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++)
11209 drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
11210 freeDlTnlInfo(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List);
11211 DU_FREE(drbSetupList->list.array[arrIdx], sizeof(DRBs_Setup_Item_t));
11213 DU_FREE(drbSetupList->list.array, drbSetupList->list.size);
11216 /*******************************************************************
11217 * @brief Free the memory allocated for UE Setup response
11221 * Function : FreeUeContextSetupRsp
11224 * Free the memory allocated for UE Setup response
11226 * @params[in] F1AP PDU for UE setup response
11227 * @return ROK - success
11228 * RFAILED - failure
11230 * ****************************************************************/
11231 void FreeUeContextSetupRsp(F1AP_PDU_t *f1apMsg)
11234 UEContextSetupResponse_t *ueSetRsp = NULLP;
11238 if(f1apMsg->choice.successfulOutcome)
11240 ueSetRsp = &f1apMsg->choice.successfulOutcome->value.choice.\
11241 UEContextSetupResponse;
11242 if(ueSetRsp->protocolIEs.list.array)
11244 for(idx = 0; idx < ueSetRsp->protocolIEs.list.count; idx++)
11246 if(ueSetRsp->protocolIEs.list.array[idx])
11248 switch(ueSetRsp->protocolIEs.list.array[idx]->id)
11250 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
11252 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
11254 case ProtocolIE_ID_id_DUtoCURRCInformation:
11256 CellGroupConfig_t *cellGrpCfg = NULLP;
11257 cellGrpCfg = &ueSetRsp->protocolIEs.list.array[idx]->value.choice.\
11258 DUtoCURRCInformation.cellGroupConfig;
11259 if(cellGrpCfg->buf != NULLP)
11261 DU_FREE(cellGrpCfg->buf, cellGrpCfg->size);
11262 cellGrpCfg = NULLP;
11266 case ProtocolIE_ID_id_DRBs_Setup_List:
11268 freeDrbSetupList(&ueSetRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List);
11272 DU_LOG("\nERROR --> DUAPP: Invalid Id %ld at FreeUeContextSetupRsp()",\
11273 ueSetRsp->protocolIEs.list.array[idx]->id);
11276 DU_FREE(ueSetRsp->protocolIEs.list.array[idx],\
11277 sizeof(UEContextSetupResponseIEs_t));
11280 DU_FREE(ueSetRsp->protocolIEs.list.array, \
11281 ueSetRsp->protocolIEs.list.size);
11283 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
11285 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
11289 /*******************************************************************
11291 * @brief Builds Ue context Setup Rsp DU To CU Info
11295 * Function : EncodeUeCntxtDuToCuInfo
11297 * Functionality: Builds Ue context Setup Rsp DU To CU Info
11299 * @params[in] CellGroupConfig_t *, CellGroupConfigRrc_t *
11301 * @return ROK - success
11302 * RFAILED - failure
11304 ******************************************************************/
11306 uint8_t EncodeUeCntxtDuToCuInfo(CellGroupConfig_t *duToCuCellGrp, CellGroupConfigRrc_t *duCellGrpCfg)
11308 asn_enc_rval_t encRetVal;
11310 xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, duCellGrpCfg);
11311 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
11313 encRetVal = aper_encode(&asn_DEF_CellGroupConfigRrc, 0, duCellGrpCfg, PrepFinalEncBuf, encBuf);
11314 /* Encode results */
11315 if(encRetVal.encoded == ENCODE_FAIL)
11317 DU_LOG( "\nERROR --> F1AP : Could not encode UeCntxtDuToCuInfo (at %s)\n",\
11318 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
11323 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UeCntxtDuToCuInfo\n");
11324 for(int i=0; i< encBufSize; i++)
11326 printf("%x",encBuf[i]);
11329 duToCuCellGrp->size = encBufSize;
11330 DU_ALLOC(duToCuCellGrp->buf, duToCuCellGrp->size);
11331 if(!duToCuCellGrp->buf)
11333 DU_LOG("\nERROR --> F1AP : Memory allocation failed in UeCntxtDuToCuInfo");
11335 memcpy(duToCuCellGrp->buf, encBuf, duToCuCellGrp->size);
11339 /*******************************************************************
11341 * @brief Fills Dl Gtp tunnel Info
11345 * Function : fillGtpTunnelforDl
11347 * Functionality: Fills Dl Gtp tunnel Info
11351 * @return ROK - success
11352 * RFAILED - failure
11354 * ****************************************************************/
11356 uint8_t fillGtpTunnelforDl(GTPTunnel_t *gtpDl, GtpTnlCfg *gtpUeCfg)
11358 uint8_t bufSize = 0;
11360 gtpDl->transportLayerAddress.size = 4*sizeof(uint8_t);
11361 DU_ALLOC(gtpDl->transportLayerAddress.buf, gtpDl->transportLayerAddress.size);
11362 if(gtpDl->transportLayerAddress.buf == NULLP)
11366 memcpy(gtpDl->transportLayerAddress.buf, >pUeCfg->dlTnlAddress, gtpDl->transportLayerAddress.size);
11369 gtpDl->gTP_TEID.size = 4 * sizeof(uint8_t);
11370 DU_ALLOC(gtpDl->gTP_TEID.buf, gtpDl->gTP_TEID.size);
11371 if(gtpDl->gTP_TEID.buf == NULLP)
11375 bufSize = 3; /*forming an Octect String*/
11376 fillTeIdString(bufSize, gtpUeCfg->teId, gtpDl->gTP_TEID.buf);
11381 /*******************************************************************
11383 * @brief Fills DL Tunnel Setup List
11387 * Function : fillDlTnlSetupList
11389 * Functionality: Fills the DL Tunnel Setup List
11393 * @return ROK - success
11394 * RFAILED - failure
11396 * ****************************************************************/
11398 uint8_t fillDlTnlSetupList(DLUPTNLInformation_ToBeSetup_List_t *dlTnlInfo, UpTnlCfg *tnlCfg)
11400 uint8_t ret = ROK, arrIdx = 0, eleCount = 0;
11403 dlTnlInfo->list.count = eleCount;
11404 dlTnlInfo->list.size = (eleCount * sizeof(DLUPTNLInformation_ToBeSetup_Item_t *));
11406 /* Initialize the DL Tnl Setup List Members */
11407 DU_ALLOC(dlTnlInfo->list.array, dlTnlInfo->list.size);
11408 if(dlTnlInfo->list.array == NULLP)
11410 DU_LOG(" ERROR --> F1AP : Memory allocation for DL Tnl Setup List in fillDlTnlSetupList()");
11413 for(arrIdx=0; arrIdx < eleCount; arrIdx++)
11415 DU_ALLOC(dlTnlInfo->list.array[arrIdx], sizeof(DLUPTNLInformation_ToBeSetup_Item_t));
11416 if(dlTnlInfo->list.array[arrIdx] == NULLP)
11418 DU_LOG(" ERROR --> F1AP : Memory allocation for arrIdx [%d] failed in fillDlTnlSetupList()", arrIdx);
11421 dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.present = UPTransportLayerInformation_PR_gTPTunnel;
11422 DU_ALLOC(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel, sizeof(GTPTunnel_t));
11423 if(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel == NULLP)
11425 DU_LOG(" ERROR --> F1AP : Memory allocation for DL tunnel info in fillDlTnlSetupList()");
11428 ret = fillGtpTunnelforDl(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel,\
11436 /*******************************************************************
11438 * @brief Fills the Drb Setup List for Ue Context Setup Response
11442 * Function : fillDrbSetupList
11444 * Functionality: Fills the Drb Setup List for Ue Context Setup Response
11448 * @return ROK - success
11449 * RFAILED - failure
11451 * ****************************************************************/
11452 uint8_t fillDrbSetupList(DRBs_Setup_List_t *drbSetupList, DuUeCfg *ueCfg)
11454 uint8_t ret = ROK, arrIdx = 0, eleCount = 0;
11455 DRBs_Setup_ItemIEs_t *drbItemIe = NULLP;
11457 eleCount = ueCfg->numDrb;
11458 drbSetupList->list.count = eleCount;
11459 drbSetupList->list.size = \
11460 (eleCount * sizeof(DRBs_Setup_Item_t *));
11462 /* Initialize the Drb Setup List Members */
11463 DU_ALLOC(drbSetupList->list.array, drbSetupList->list.size);
11464 if(drbSetupList->list.array == NULLP)
11466 DU_LOG(" ERROR --> F1AP : Memory allocation for DRB Setup List in fillDrbSetupList()");
11470 for(arrIdx=0; arrIdx < eleCount; arrIdx++)
11472 DU_ALLOC(drbSetupList->list.array[arrIdx], sizeof(DRBs_Setup_Item_t));
11473 if(drbSetupList->list.array[arrIdx] == NULLP)
11475 DU_LOG(" ERROR --> F1AP : Memory allocation for arrIdx [%d] failed in fillDrbSetupList()", arrIdx);
11478 drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
11479 drbItemIe->id = ProtocolIE_ID_id_DRBs_Setup_Item;
11480 drbItemIe->criticality = Criticality_reject;
11481 drbItemIe->value.present = DRBs_Setup_ItemIEs__value_PR_DRBs_Setup_Item;
11482 drbItemIe->value.choice.DRBs_Setup_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId;
11483 ret = fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List,\
11484 &ueCfg->upTnlInfo[arrIdx]);
11491 /*******************************************************************
11493 * @brief Builds and sends the UE Setup Response
11497 * Function : BuildAndSendUeContextSetupRsp
11499 * Functionality: Constructs the UE Setup Response and sends
11500 * it to the DU through SCTP.
11502 * @params[in] uint8_t cellId,uint8_t ueIdx
11504 * @return ROK - success
11505 * RFAILED - failure
11507 * ****************************************************************/
11508 uint8_t BuildAndSendUeContextSetupRsp(uint8_t cellId,uint8_t ueIdx)
11510 uint8_t idx, ret, cellIdx, elementCnt;
11511 uint32_t gnbCuUeF1apId; /* gNB-CU UE F1AP Id */
11512 uint32_t gnbDuUeF1apId; /* gNB-DU UE F1AP Id */
11513 asn_enc_rval_t encRetVal; /* Encoder return value */
11514 F1AP_PDU_t *f1apMsg = NULLP;
11515 UEContextSetupResponse_t *ueSetRsp = NULLP;
11516 CellGroupConfigRrc_t *cellGrpCfg = NULLP;
11517 DuUeCb *ueCb = NULLP;
11519 DU_LOG("\n INFO --> F1AP : Building UE Context Setup Response for cellId %d, ueIdx %d\n", cellId, ueIdx);
11523 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
11524 if(f1apMsg == NULLP)
11526 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
11531 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
11532 DU_ALLOC(f1apMsg->choice.successfulOutcome,
11533 sizeof(SuccessfulOutcome_t));
11534 if(f1apMsg->choice.successfulOutcome == NULLP)
11536 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
11541 f1apMsg->choice.successfulOutcome->procedureCode = \
11542 ProcedureCode_id_UEContextSetup;
11543 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
11544 f1apMsg->choice.successfulOutcome->value.present = \
11545 SuccessfulOutcome__value_PR_UEContextSetupResponse;
11548 &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse;
11550 ueSetRsp->protocolIEs.list.count = elementCnt;
11551 ueSetRsp->protocolIEs.list.size = \
11552 elementCnt * sizeof(UEContextSetupResponse_t *);
11554 /* Initialize the UESetup members */
11555 DU_ALLOC(ueSetRsp->protocolIEs.list.array, \
11556 ueSetRsp->protocolIEs.list.size);
11557 if(ueSetRsp->protocolIEs.list.array == NULLP)
11559 DU_LOG(" ERROR --> F1AP : Memory allocation for UE Setup Response failed");
11564 for(idx=0; idx<elementCnt; idx++)
11566 DU_ALLOC(ueSetRsp->protocolIEs.list.array[idx],\
11567 sizeof(UEContextSetupResponseIEs_t));
11568 if(ueSetRsp->protocolIEs.list.array[idx] == NULLP)
11570 DU_LOG(" ERROR --> F1AP : Memory allocation for UE Setup Response failed");
11575 /* Fetching Ue Cb Info*/
11576 GET_CELL_IDX(cellId, cellIdx);
11577 gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId;
11578 gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId;
11579 ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1];
11582 /*GNB CU UE F1AP ID*/
11583 ueSetRsp->protocolIEs.list.array[idx]->id = \
11584 ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
11585 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
11586 ueSetRsp->protocolIEs.list.array[idx]->value.present = \
11587 UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
11588 ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId;
11590 /*GNB DU UE F1AP ID*/
11592 ueSetRsp->protocolIEs.list.array[idx]->id = \
11593 ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
11594 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
11595 ueSetRsp->protocolIEs.list.array[idx]->value.present = \
11596 UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
11597 ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
11600 /*DUtoCURRC Information */
11602 ueSetRsp->protocolIEs.list.array[idx]->id = \
11603 ProtocolIE_ID_id_DUtoCURRCInformation;
11604 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
11605 ueSetRsp->protocolIEs.list.array[idx]->value.present =\
11606 UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation;
11609 if(ueCb->f1UeDb->duUeCfg.cellGrpCfg)
11611 cellGrpCfg = (CellGroupConfigRrc_t*)ueCb->f1UeDb->duUeCfg.cellGrpCfg;
11612 ret = EncodeUeCntxtDuToCuInfo(&ueSetRsp->protocolIEs.list.array[idx]->value.\
11613 choice.DUtoCURRCInformation.cellGroupConfig, cellGrpCfg);
11616 DU_LOG("\nERROR --> F1AP : Failed to EncodeUeCntxtDuToCuInfo in BuildAndSendUeContextSetupRsp()");
11617 freeF1UeDb(ueCb->f1UeDb);
11618 ueCb->f1UeDb = NULLP;
11625 DU_LOG("\nERROR --> F1AP : Failed to form DUtoCU RRCInfo at BuildAndSendUeContextSetupRsp()");
11630 /* Drb Setup List */
11632 ueSetRsp->protocolIEs.list.array[idx]->id = \
11633 ProtocolIE_ID_id_DRBs_Setup_List;
11634 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
11635 ueSetRsp->protocolIEs.list.array[idx]->value.present =\
11636 UEContextSetupResponseIEs__value_PR_DRBs_Setup_List;
11637 ret = fillDrbSetupList(&ueSetRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List,\
11638 &ueCb->f1UeDb->duUeCfg);
11641 DU_LOG("\nERROR --> F1AP : Failed to fillDrbSetupList in BuildAndSendUeContextSetupRsp()");
11642 freeF1UeDb(ueCb->f1UeDb);
11643 ueCb->f1UeDb = NULLP;
11647 /* Free UeContext Db created during Ue context Req */
11648 freeF1UeDb(ueCb->f1UeDb);
11649 ueCb->f1UeDb = NULLP;
11651 /* TODO: To send Drb list */
11652 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
11654 /* Encode the UE context setup response type as APER */
11655 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
11657 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
11659 /* Encode results */
11660 if(encRetVal.encoded == ENCODE_FAIL)
11662 DU_LOG( "\nERROR --> F1AP : Could not encode UE Context Setup Response structure (at %s)\n",\
11663 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
11669 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UE Context Setup Response\n");
11670 for(int i=0; i< encBufSize; i++)
11672 printf("%x",encBuf[i]);
11677 if(sendF1APMsg() != ROK)
11679 DU_LOG("\nERROR --> F1AP : Sending UE Context Setup Response failed");
11685 FreeUeContextSetupRsp(f1apMsg);
11687 }/* End of BuildAndSendUeContextSetupRsp */
11688 /*******************************************************************
11690 * @brief Build And Send Ue Context Rsp
11694 * Function : BuildAndSendUeCtxtRsp
11696 * Functionality : Build And Send Ue Context Rsp
11699 * @return sucess = ROK
11700 * failure = RFAILED
11702 * ****************************************************************/
11703 uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueIdx)
11705 uint8_t cellIdx = 0, actionType = 0;
11707 GET_CELL_IDX(cellId, cellIdx);
11708 actionType = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].f1UeDb->actionType;
11712 case UE_CTXT_SETUP:
11714 BuildAndSendUeContextSetupRsp(cellId,ueIdx);
11719 BuildAndSendUeContextModRsp(cellId, ueIdx);
11723 DU_LOG("ERROR --> F1AP: Invalid Action Type %d at BuildAndSendUeCtxtRsp()", actionType);
11730 /*******************************************************************
11732 * @brief deallocating the memory of F1reset msg
11736 * Function : FreeF1ResetReq
11739 * - freeing memory of F1reset request msg
11745 * ****************************************************************/
11746 void FreeF1ResetReq(F1AP_PDU_t *f1apMsg)
11749 Reset_t *f1ResetMsg;
11753 if(f1apMsg->choice.initiatingMessage)
11755 f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
11757 if(f1ResetMsg->protocolIEs.list.array)
11759 for(idx=0 ;idx < f1ResetMsg->protocolIEs.list.count ; idx++)
11761 if(f1ResetMsg->protocolIEs.list.array[idx])
11763 DU_FREE(f1ResetMsg->protocolIEs.list.array[idx],sizeof(ResetIEs_t));
11766 DU_FREE(f1ResetMsg->protocolIEs.list.array,f1ResetMsg->protocolIEs.list.size);
11768 DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
11770 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
11773 /*******************************************************************
11775 * @brief Build and Send F1reset request
11779 * Function : BuildAndSendF1ResetReq
11782 * - Build and Send F1reset request msg
11785 * @return ROK - success
11786 * RFAILED - failure
11788 * ****************************************************************/
11789 uint8_t BuildAndSendF1ResetReq()
11791 uint8_t elementCnt=0;
11793 uint8_t ret= RFAILED;
11794 Reset_t *f1ResetMsg = NULLP;
11795 F1AP_PDU_t *f1apMsg = NULLP;
11796 asn_enc_rval_t encRetVal;
11797 DU_LOG("\nINFO --> F1AP : Building F1 Reset request \n");
11800 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
11801 if(f1apMsg == NULLP)
11805 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
11806 DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
11807 if(f1apMsg->choice.initiatingMessage == NULLP)
11811 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_Reset;
11812 f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
11813 f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_Reset;
11815 f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
11818 f1ResetMsg->protocolIEs.list.count = elementCnt;
11819 f1ResetMsg->protocolIEs.list.size = elementCnt * sizeof(ResetIEs_t *);
11821 /* Initialize the F1Setup members */
11822 DU_ALLOC(f1ResetMsg->protocolIEs.list.array,f1ResetMsg->protocolIEs.list.size);
11823 if(f1ResetMsg->protocolIEs.list.array == NULLP)
11827 for(idx=0; idx<elementCnt; idx++)
11829 DU_ALLOC(f1ResetMsg->protocolIEs.list.array[idx],sizeof(ResetIEs_t));
11830 if(f1ResetMsg->protocolIEs.list.array[idx] == NULLP)
11838 f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID;
11839 f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
11840 f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_TransactionID;
11841 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.TransactionID = 1;
11845 f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_Cause;
11846 f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
11847 f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_Cause;
11848 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.Cause.present = Cause_PR_radioNetwork;
11849 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.Cause.choice.radioNetwork = CauseRadioNetwork_action_desirable_for_radio_reasons;
11853 f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_ResetType;
11854 f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
11855 f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_ResetType;
11856 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.ResetType.present = ResetType_PR_f1_Interface;
11857 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.ResetType.choice.f1_Interface = ResetAll_reset_all;
11859 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
11861 /* Encode the F1SetupRequest type as APER */
11862 memset(encBuf, 0, ENC_BUF_MAX_LEN);
11864 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
11867 /* Encode results */
11868 if(encRetVal.encoded == ENCODE_FAIL)
11870 DU_LOG("\nERROR --> F1AP : Could not encode F1Reset structure (at %s)\n",\
11871 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
11876 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for F1Reset\n");
11877 for(idx=0; idx< encBufSize; idx++)
11879 printf("%x",encBuf[idx]);
11883 if(sendF1APMsg() != ROK)
11885 DU_LOG("\nERROR --> F1AP : Sending F1 Reset request failed");
11893 FreeF1ResetReq(f1apMsg);
11896 /*******************************************************************
11898 * @brief Build And Send F1ResetAck
11902 * Function : BuildAndSendF1ResetAck
11905 * - Build And Send F1ResetRSP
11907 * @return ROK - success
11908 * RFAILED - failure
11910 * ****************************************************************/
11911 void FreeF1ResetAck(F1AP_PDU_t *f1apMsg)
11914 ResetAcknowledge_t *f1ResetAck;
11918 if(f1apMsg->choice.successfulOutcome)
11920 f1ResetAck= &f1apMsg->choice.successfulOutcome->value.choice.ResetAcknowledge;
11922 if(f1ResetAck->protocolIEs.list.array)
11924 for(idx=0; idx<f1ResetAck->protocolIEs.list.count ; idx++)
11926 if(f1ResetAck->protocolIEs.list.array[idx])
11928 DU_FREE(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
11931 DU_FREE(f1ResetAck->protocolIEs.list.array, f1ResetAck->protocolIEs.list.size );
11933 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
11935 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
11939 /*******************************************************************
11941 * @brief Build And Send F1ResetAck
11945 * Function : BuildAndSendF1ResetAck
11948 * - Build And Send F1ResetRSP
11951 * @return ROK - success
11952 * RFAILED - failure
11954 * ****************************************************************/
11955 uint8_t BuildAndSendF1ResetAck()
11958 uint8_t elementCnt = 0;
11959 uint8_t ret = RFAILED;
11960 F1AP_PDU_t *f1apMsg = NULL;
11961 ResetAcknowledge_t *f1ResetAck = NULLP;
11962 asn_enc_rval_t encRetVal;
11963 DU_LOG("\nINFO --> F1AP : Building F1 Reset Acknowledgment \n");
11966 /* Allocate the memory for F1ResetRequest_t */
11967 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
11968 if(f1apMsg == NULLP)
11970 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
11974 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
11976 DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
11977 if(f1apMsg->choice.successfulOutcome == NULLP)
11979 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
11982 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
11983 f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_ResetAcknowledge;
11984 f1ResetAck = &f1apMsg->choice.successfulOutcome->value.choice.ResetAcknowledge;
11988 f1ResetAck->protocolIEs.list.count = elementCnt;
11989 f1ResetAck->protocolIEs.list.size = elementCnt*sizeof(ResetAcknowledgeIEs_t *);
11991 DU_ALLOC(f1ResetAck->protocolIEs.list.array, f1ResetAck->protocolIEs.list.size );
11992 if(f1ResetAck->protocolIEs.list.array == NULLP)
11994 DU_LOG("\nERROR --> F1AP : Memory allocation for F1ResetAckIEs failed");
11998 for(idx=0; idx<elementCnt; idx++)
12000 DU_ALLOC(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
12001 if(f1ResetAck->protocolIEs.list.array[idx] == NULLP)
12008 f1ResetAck->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID;
12009 f1ResetAck->protocolIEs.list.array[idx]->criticality = Criticality_reject;
12010 f1ResetAck->protocolIEs.list.array[idx]->value.present = ResetAcknowledgeIEs__value_PR_TransactionID;
12011 f1ResetAck->protocolIEs.list.array[idx]->value.choice.TransactionID = TRANS_ID;
12013 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
12015 /* Encode the F1SetupRequest type as UPER */
12016 memset(encBuf, 0, ENC_BUF_MAX_LEN);
12018 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
12020 /* Check encode results */
12021 if(encRetVal.encoded == ENCODE_FAIL)
12023 DU_LOG("\nERROR --> F1AP : Could not encode F1ResetAck structure (at %s)\n",\
12024 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
12029 DU_LOG("\nDUBUG --> F1AP : Created APER encoded buffer for F1ResetAck\n");
12030 for(int i=0; i< encBufSize; i++)
12032 printf("%x",encBuf[i]);
12036 if(sendF1APMsg() != ROK)
12038 DU_LOG("\nERROR --> F1AP : Sending F1 Reset Acknowledgement failed");
12046 FreeF1ResetAck(f1apMsg);
12049 /******************************************************************
12051 * @brief free F1 reset msg allocated by aper_decoder
12055 * Function : freeAperDecodeF1ResetMsg
12057 * Functionality: free F1 reset msg allocated by aper_decoder
12059 * @params[in] Reset_t *f1ResetMsg
12062 * ****************************************************************/
12064 void freeAperDecodeF1ResetMsg(Reset_t *f1ResetMsg)
12067 if(f1ResetMsg->protocolIEs.list.array)
12069 for(ieIdx=0 ;ieIdx < f1ResetMsg->protocolIEs.list.count ; ieIdx++)
12071 if(f1ResetMsg->protocolIEs.list.array[ieIdx])
12073 free(f1ResetMsg->protocolIEs.list.array[ieIdx]);
12076 free(f1ResetMsg->protocolIEs.list.array);
12080 /******************************************************************
12082 * @brief Processes DL RRC Message Transfer sent by CU
12086 * Function : procF1ResetReq
12088 * Functionality: Processes DL RRC Message Transfer sent by CU
12090 * @params[in] F1AP_PDU_t ASN decoded F1AP message
12091 * @return ROK - success
12092 * RFAILED - failure
12094 * ****************************************************************/
12095 uint8_t procF1ResetReq(F1AP_PDU_t *f1apMsg)
12097 /* we are currently not supporting Ue release. right now we are supporting only init case of fireset */
12100 Reset_t *f1ResetMsg = NULLP;
12102 DU_LOG("\nINFO --> Processing F1 reset request");
12103 f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
12105 for(ieIdx=0; ieIdx<f1ResetMsg->protocolIEs.list.count; ieIdx++)
12107 switch(f1ResetMsg->protocolIEs.list.array[ieIdx]->id)
12109 case ProtocolIE_ID_id_TransactionID:
12112 case ProtocolIE_ID_id_Cause:
12115 case ProtocolIE_ID_id_ResetType:
12124 ret = BuildAndSendF1ResetAck();
12125 DU_LOG("\nINFO --> UE release is not supported for now");
12127 freeAperDecodeF1ResetMsg(f1ResetMsg);
12132 /*******************************************************************
12134 * @brief free the RRC delivery report
12138 * Function : freeRrcDeliveryReport
12140 * Functionality: free the RRC delivery report
12143 * @return ROK - success
12144 * RFAILED - failure
12146 * ****************************************************************/
12147 void freeRrcDeliveryReport(F1AP_PDU_t *f1apMsg )
12150 RRCDeliveryReport_t *rrcDeliveryReport= NULLP;
12154 if(f1apMsg->choice.initiatingMessage)
12156 rrcDeliveryReport = &f1apMsg->choice.initiatingMessage->value.choice.RRCDeliveryReport;
12157 if(rrcDeliveryReport->protocolIEs.list.array)
12159 for(idx =0 ;idx <rrcDeliveryReport->protocolIEs.list.count ;
12162 if(rrcDeliveryReport->protocolIEs.list.array[idx])
12164 DU_FREE(rrcDeliveryReport->protocolIEs.list.array[idx],
12165 sizeof(RRCDeliveryReportIEs_t));
12168 DU_FREE(rrcDeliveryReport->protocolIEs.list.array,
12169 rrcDeliveryReport->protocolIEs.list.size);
12171 DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
12174 sizeof(F1AP_PDU_t));
12178 /*******************************************************************
12180 * @brief Builds and sends the RRC delivery report
12184 * Function : BuildAndSendRrcDeliveryReport
12186 * Functionality: Builds and sends the RRC delivery report
12190 * @return ROK - success
12191 * RFAILED - failure
12193 * ****************************************************************/
12194 uint8_t BuildAndSendRrcDeliveryReport(uint32_t gnbCuUeF1apId, \
12195 uint32_t gnbDuUeF1apId, RrcDeliveryReport *rrcDelivery)
12197 uint8_t ret = RFAILED;
12200 uint8_t elementCnt = 0;
12201 F1AP_PDU_t *f1apMsg = NULLP;
12202 asn_enc_rval_t encRetVal;
12203 RRCDeliveryReport_t *rrcDeliveryReport= NULLP;
12207 DU_LOG("\nINFO --> F1AP : Building RRC delivery Message Transfer Message\n");
12208 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
12209 if(f1apMsg == NULLP)
12211 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
12214 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
12215 DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
12216 if(f1apMsg->choice.initiatingMessage == NULLP)
12218 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
12221 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_RRCDeliveryReport;
12222 f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
12223 f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_RRCDeliveryReport;
12225 rrcDeliveryReport = &f1apMsg->choice.initiatingMessage->value.choice.RRCDeliveryReport;
12227 rrcDeliveryReport->protocolIEs.list.count = elementCnt;
12228 rrcDeliveryReport->protocolIEs.list.size = elementCnt * sizeof(RRCDeliveryReportIEs_t *);
12230 /* Initialize the F1Setup members */
12231 DU_ALLOC(rrcDeliveryReport->protocolIEs.list.array, rrcDeliveryReport->protocolIEs.list.size);
12232 if(rrcDeliveryReport->protocolIEs.list.array == NULLP)
12234 DU_LOG(" ERROR --> F1AP : Memory allocation for RRC Delivery failed");
12237 for(idx =0 ;idx <elementCnt; idx++)
12239 DU_ALLOC(rrcDeliveryReport->protocolIEs.list.array[idx], sizeof(RRCDeliveryReportIEs_t));
12240 if(rrcDeliveryReport->protocolIEs.list.array[idx] == NULLP)
12248 /*GNB CU UE F1AP ID*/
12249 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
12250 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
12251 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_GNB_CU_UE_F1AP_ID;
12252 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId;
12254 /*GNB DU UE F1AP ID*/
12256 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
12257 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
12258 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_GNB_DU_UE_F1AP_ID;
12259 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
12261 /*RRC delivery status*/
12263 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_RRCDeliveryStatus;
12264 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_ignore;
12265 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_RRCDeliveryStatus;
12266 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.delivery_status =\
12267 rrcDelivery->rrcDeliveryStatus.deliveryStatus;
12268 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.triggering_message =\
12269 rrcDelivery->rrcDeliveryStatus.triggeringMessage;
12273 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_SRBID;
12274 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_ignore;
12275 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_SRBID;
12276 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.SRBID = rrcDelivery->srbId;
12278 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
12280 /* Encode the RRC DELIVERY REPORT type as APER */
12281 memset(encBuf, 0, ENC_BUF_MAX_LEN);
12283 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
12286 /* Encode results */
12287 if(encRetVal.encoded == ENCODE_FAIL)
12289 DU_LOG("\nERROR --> F1AP : Could not encode RRC Delivery Msg structure (at %s)\n",\
12290 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
12295 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for RRC Delivery Msg \n");
12296 for(idx=0; idx< encBufSize; idx++)
12298 printf("%x",encBuf[idx]);
12303 if(sendF1APMsg() != ROK)
12305 DU_LOG("\nERROR --> F1AP : Sending RRC delivery msg request failed");
12313 freeRrcDeliveryReport(f1apMsg);
12317 /*******************************************************************
12319 * @brief Processes cells to be activated
12323 * Function : extractCellsToBeActivated
12326 * - Processes cells to be activated list received in F1SetupRsp
12329 * @return ROK - success
12330 * RFAILED - failure
12332 * ****************************************************************/
12334 uint8_t extractCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
12337 uint16_t idx, nci, pci = 0;
12338 Cells_to_be_Activated_List_Item_t cell;
12340 for(idx=0; idx<cellsToActivate.list.count; idx++)
12343 cell = cellsToActivate.list.array[idx]->value.choice.Cells_to_be_Activated_List_Item;
12344 bitStringToInt(&cell.nRCGI.nRCellIdentity, &nci);
12350 ret = duProcCellsToBeActivated(cell.nRCGI.pLMN_Identity.buf, nci, pci);
12354 /******************************************************************
12356 * @brief Processes F1 Setup Response allocated by aper_decoder
12360 * Function : freeF1SetupRsp
12362 * Functionality: free F1 Setup Response allocated by aper_decoder
12364 * @params[in] F1SetupResponse_t *f1SetRspMsg
12367 * ****************************************************************/
12369 void freeAperDecodeF1SetupRsp(F1SetupResponse_t *f1SetRspMsg)
12373 Cells_to_be_Activated_List_t *cellToActivate =NULLP;
12374 RRC_Version_t *rrcVer =NULLP;
12376 if(f1SetRspMsg->protocolIEs.list.array)
12378 for(ieIdx=0; ieIdx<f1SetRspMsg->protocolIEs.list.count; ieIdx++)
12380 if(f1SetRspMsg->protocolIEs.list.array[ieIdx])
12382 switch(f1SetRspMsg->protocolIEs.list.array[ieIdx]->id)
12384 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
12387 &f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.Cells_to_be_Activated_List;
12388 if(cellToActivate->list.array)
12390 for(arrIdx=0; arrIdx<cellToActivate->list.count ; arrIdx++)
12392 if(cellToActivate->list.array[arrIdx])
12395 if(cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.nRCGI.\
12398 if(cellToActivate->list.array[0]->value.choice.\
12399 Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf)
12401 free(cellToActivate->list.array[0]->value.choice.\
12402 Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf);
12405 free(cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.\
12406 nRCGI.pLMN_Identity.buf);
12408 free(cellToActivate->list.array[arrIdx]);
12411 free(cellToActivate->list.array);
12415 case ProtocolIE_ID_id_TransactionID:
12419 case ProtocolIE_ID_id_gNB_CU_Name:
12421 free(f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_Name.buf);
12424 case ProtocolIE_ID_id_GNB_CU_RRC_Version:
12426 rrcVer = &f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version;
12427 if(rrcVer->latest_RRC_Version.buf)
12429 if(rrcVer->iE_Extensions)
12431 if(rrcVer->iE_Extensions->list.array)
12433 if(rrcVer->iE_Extensions->list.array[0])
12435 if(rrcVer->iE_Extensions->list.\
12436 array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf)
12438 free(rrcVer->iE_Extensions->list.\
12439 array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf);
12441 free(rrcVer->iE_Extensions->list.array[0]);
12443 free(rrcVer->iE_Extensions->list.array);
12445 free(rrcVer->iE_Extensions);
12447 free(rrcVer->latest_RRC_Version.buf);
12454 DU_LOG("\nERROR --> DU_APP : Invalid IE received in F1SetupRsp:%ld",
12455 f1SetRspMsg->protocolIEs.list.array[ieIdx]->id);
12458 free(f1SetRspMsg->protocolIEs.list.array[ieIdx]);
12461 free(f1SetRspMsg->protocolIEs.list.array);
12464 /******************************************************************
12466 * @brief Processes F1 Setup Response sent by CU
12470 * Function : procF1SetupRsp
12472 * Functionality: Processes F1 Setup Response sent by CU
12474 * @params[in] F1AP_PDU_t ASN decoded F1AP message
12475 * @return ROK - success
12476 * RFAILED - failure
12478 * ****************************************************************/
12479 uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg)
12483 F1SetupResponse_t *f1SetRspMsg = NULLP;
12484 GNB_CU_Name_t *cuName = NULLP;
12485 F1SetupRsp f1SetRspDb;
12486 RRC_Version_t *rrcVer =NULLP;
12488 memset(&f1SetRspDb, 0, sizeof(F1SetupRsp));
12490 DU_LOG("\nINFO --> F1AP : F1 Setup Response received");
12491 f1SetRspMsg = &f1apMsg->choice.successfulOutcome->value.choice.F1SetupResponse;
12493 for(idx=0; idx<f1SetRspMsg->protocolIEs.list.count; idx++)
12495 switch(f1SetRspMsg->protocolIEs.list.array[idx]->id)
12497 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
12499 extractCellsToBeActivated(f1SetRspMsg->protocolIEs.list.array[idx]->\
12500 value.choice.Cells_to_be_Activated_List);
12503 case ProtocolIE_ID_id_TransactionID:
12505 f1SetRspDb.transId = f1SetRspMsg->protocolIEs.list.array[idx]->\
12506 value.choice.TransactionID;
12509 case ProtocolIE_ID_id_gNB_CU_Name:
12511 cuName = &f1SetRspMsg->protocolIEs.list.array[idx]->\
12512 value.choice.GNB_CU_Name;
12513 strcpy(f1SetRspDb.cuName, (const char*)cuName->buf);
12516 case ProtocolIE_ID_id_GNB_CU_RRC_Version:
12518 rrcVer = &f1SetRspMsg->protocolIEs.list.array[idx]->value.choice.RRC_Version;
12519 strcpy(f1SetRspDb.rrcVersion.rrcVer,
12520 (const char*)rrcVer->latest_RRC_Version.buf);
12524 DU_LOG("\nERROR --> DU_APP : Invalid IE received in F1SetupRsp:%ld",
12525 f1SetRspMsg->protocolIEs.list.array[idx]->id);
12527 duProcF1SetupRsp();
12530 freeAperDecodeF1SetupRsp(f1SetRspMsg);
12533 /*******************************************************************
12535 * @brief free GNB DU config update ack
12539 * Function : freeAperDecodeGnbDuAck
12541 * Functionality: Processes GNB DU config update ack And
12542 * added free part for the memory allocated by aper_decoder
12544 * @params[in] F1AP_PDU_t ASN decoded F1AP message
12545 * @return ROK - success
12546 * RFAILED - failure
12548 * ****************************************************************/
12550 void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck)
12554 if(gnbDuAck->protocolIEs.list.array)
12556 for(ieIdx=0; ieIdx < gnbDuAck->protocolIEs.list.count; ieIdx++)
12558 if(gnbDuAck->protocolIEs.list.array[ieIdx])
12560 free(gnbDuAck->protocolIEs.list.array[ieIdx]);
12563 free(gnbDuAck->protocolIEs.list.array);
12567 /*******************************************************************
12569 * @brief Building result of gnb-du config update ack output
12573 * Function : duProcGnbDuCfgUpdAckMsg
12576 * Building output of gnb-du config update ack
12578 * @params[in] transId
12581 * ****************************************************************/
12583 uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
12585 uint8_t ieIdx=0, arrIdx=0,ret=ROK;
12586 uint8_t ueId =0 , ueIdx =0, totalActiveUe = 0;
12587 uint16_t cellId =0, cellIdx =0, crnti=0;
12588 CmLList *f1apPduNode = NULLP;
12589 ReservedF1apPduInfo *f1apPduInfo =NULLP;
12590 F1AP_PDU_t *f1apMsgPdu = NULLP;
12591 GNBDUConfigurationUpdate_t *gnbDuConfigUpdate = NULLP;
12592 BIT_STRING_t *cellIdentity=NULLP;
12593 struct Served_Cells_To_Delete_ItemIEs *deleteItemIe=NULLP;
12594 Served_Cells_To_Delete_List_t *cellsToDelete=NULLP;
12595 Served_Cells_To_Delete_Item_t *deleteItem=NULLP;
12597 DU_LOG("\nINFO --> DU APP: GNB-DU config update Ack received ");
12598 f1apPduNode = searchFromReservedF1apPduList(transId);
12599 f1apPduInfo = (ReservedF1apPduInfo *)f1apPduNode->node;
12600 f1apMsgPdu = (F1AP_PDU_t *)f1apPduInfo->f1apMsg;
12604 if(f1apMsgPdu->choice.initiatingMessage)
12606 gnbDuConfigUpdate = &f1apMsgPdu->choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate;
12607 for(ieIdx=0; ieIdx < gnbDuConfigUpdate->protocolIEs.list.count; ieIdx++)
12609 switch(gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->id)
12611 case ProtocolIE_ID_id_Served_Cells_To_Delete_List:
12613 cellsToDelete = &gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
12614 Served_Cells_To_Delete_List;
12615 if(cellsToDelete->list.array)
12617 if(cellsToDelete->list.array[arrIdx])
12619 deleteItemIe = (Served_Cells_To_Delete_ItemIEs_t*)cellsToDelete->list.array[arrIdx];
12620 deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
12621 if(deleteItem->oldNRCGI.nRCellIdentity.buf)
12623 cellIdentity = &deleteItem->oldNRCGI.nRCellIdentity;
12624 bitStringToInt(cellIdentity, &cellId);
12629 GET_CELL_IDX(cellId, cellIdx);
12630 if(duCb.actvCellLst[cellIdx] != NULLP)
12632 if(duCb.actvCellLst[cellIdx]->numActvUes == 0)
12634 duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS;
12635 ret = duSendCellDeletReq(cellId);
12638 DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to send cell delete\
12639 request for cellId[%d]", cellId);
12644 totalActiveUe = duCb.actvCellLst[cellIdx]->numActvUes;
12645 while(totalActiveUe)
12647 if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState != UE_ACTIVE)
12653 crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
12654 GET_UE_IDX(crnti,ueId);
12655 /* Sending Ue Context release request only for maximum supporting UEs */
12656 ret = BuildAndSendUeContextReleaseReq(cellId, ueId);
12659 DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to build and send UE delete\
12660 request for cellId[%d]", cellId);
12669 DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%d] not found", cellId);
12682 FreeDUConfigUpdate(f1apMsgPdu);
12683 deleteFromReservedF1apPduList(f1apPduNode);
12687 /*******************************************************************
12689 * @brief Processes GNB DU config update ack
12693 * Function : procF1GNBDUCfgUpdAck
12695 * Functionality: added free part for the memory allocated by aper_decoder
12697 * @params[in] F1AP_PDU_t *f1apMsg
12700 * ****************************************************************/
12701 uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
12703 uint8_t ieIdx=0,transId=0;
12704 GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck = NULLP;
12706 DU_LOG("\nINFO --> F1AP : GNB-DU config update acknowledgment");
12707 gnbDuAck = &f1apMsg->choice.successfulOutcome->value.choice.GNBDUConfigurationUpdateAcknowledge;
12709 for(ieIdx=0; ieIdx < gnbDuAck->protocolIEs.list.count; ieIdx++)
12711 switch(gnbDuAck->protocolIEs.list.array[ieIdx]->id)
12713 case ProtocolIE_ID_id_TransactionID:
12715 transId = gnbDuAck->protocolIEs.list.array[ieIdx]->value.choice.TransactionID;
12718 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
12724 DU_LOG("\nERROR --> F1AP: procF1GNBDUCfgUpdAck(): Invalid IE Received: %ld", \
12725 gnbDuAck->protocolIEs.list.array[ieIdx]->id);
12731 duProcGnbDuCfgUpdAckMsg(transId);
12734 /* presently we are not supporting F1 Reset from DU to CU , we are only
12735 * supporting F1 Reset from CU to DU */
12737 if(BuildAndSendF1ResetReq() != ROK)
12743 freeAperDecodeGnbDuAck(gnbDuAck);
12746 /******************************************************************
12748 * @brief free DL RRC Message Transfer allocated by aper_decoder
12752 * Function : freeAperDecodef1DlRrcMsg
12754 * Functionality: free DL RRC Message Transfer allocated by aper_decoder
12756 * @params[in] DLRRCMessageTransfer_t *f1DlRrcMsg
12757 * @return ROK - success
12758 * RFAILED - failure
12760 * ****************************************************************/
12762 void freeAperDecodef1DlRrcMsg(DLRRCMessageTransfer_t *f1DlRrcMsg)
12765 RRCContainer_t *rrcContainer = NULLP;
12767 if(f1DlRrcMsg->protocolIEs.list.array)
12769 for(ieIdx=0; ieIdx<f1DlRrcMsg->protocolIEs.list.count; ieIdx++)
12771 if(f1DlRrcMsg->protocolIEs.list.array[ieIdx])
12773 switch(f1DlRrcMsg->protocolIEs.list.array[ieIdx]->id)
12775 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
12777 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
12779 case ProtocolIE_ID_id_SRBID:
12781 case ProtocolIE_ID_id_RRCContainer:
12783 rrcContainer =&f1DlRrcMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer;
12784 free(rrcContainer->buf);
12786 case ProtocolIE_ID_id_ExecuteDuplication:
12788 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
12792 free(f1DlRrcMsg->protocolIEs.list.array[ieIdx]);
12795 free(f1DlRrcMsg->protocolIEs.list.array);
12798 /******************************************************************
12800 * @brief Processes DL RRC Message Transfer sent by CU
12804 * Function : procF1DlRrcMsgTrans
12806 * Functionality: Processes DL RRC Message Transfer sent by CU
12808 * @params[in] F1AP_PDU_t ASN decoded F1AP message
12809 * @return ROK - success
12810 * RFAILED - failure
12812 * ****************************************************************/
12813 uint8_t procF1DlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
12816 DLRRCMessageTransfer_t *f1DlRrcMsg = NULLP;
12818 memset(&dlMsg, 0, sizeof(F1DlRrcMsg));
12820 DU_LOG("\nINFO --> DU_APP : DL RRC message transfer Recevied");
12821 f1DlRrcMsg = &f1apMsg->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
12825 for(idx=0; idx<f1DlRrcMsg->protocolIEs.list.count; idx++)
12827 switch(f1DlRrcMsg->protocolIEs.list.array[idx]->id)
12829 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
12831 dlMsg.gnbCuUeF1apId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID;
12834 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
12836 dlMsg.gnbDuUeF1apId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
12839 case ProtocolIE_ID_id_SRBID:
12841 dlMsg.srbId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.SRBID;
12844 case ProtocolIE_ID_id_ExecuteDuplication:
12845 dlMsg.execDup = true;
12848 case ProtocolIE_ID_id_RRCContainer:
12850 if(f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size > 0)
12852 dlMsg.rrcMsgSize = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size;
12853 DU_ALLOC_SHRABL_BUF(dlMsg.rrcMsgPdu, dlMsg.rrcMsgSize);
12854 if(dlMsg.rrcMsgPdu)
12856 memcpy(dlMsg.rrcMsgPdu, f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,\
12861 DU_LOG("\nERROR --> DU APP : Memory alloc Failed at RRC Container at procF1DlRrcMsgTrans()");
12867 DU_LOG("\nERROR --> DU_APP : RRC Container Size is invalid:%ld",\
12868 f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
12873 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
12875 dlMsg.deliveryStatRpt = true;
12879 DU_LOG("\nERROR --> DU_APP : Invalid IE received in DL RRC Msg Transfer:%ld",
12880 f1DlRrcMsg->protocolIEs.list.array[idx]->id);
12884 ret = duProcDlRrcMsg(&dlMsg);
12886 freeAperDecodef1DlRrcMsg(f1DlRrcMsg);
12889 /*******************************************************************
12891 * @brief Builds the DRB to be Setup Mod list
12897 * Functionality: Constructs the DRB to be Setup Mod list
12899 * @params[in] DRBs_SetupMod_List_t *drbSet
12901 * @return ROK - success
12902 * RFAILED - failure
12904 * ****************************************************************/
12906 uint8_t BuildDrbSetupModList(DRBs_SetupMod_List_t *drbSet , DuUeCfg *ueCfg)
12910 struct DRBs_SetupMod_ItemIEs *drbItemIe;
12912 drbCnt = ueCfg->numDrbSetupMod;
12913 drbSet->list.count = drbCnt;
12914 drbSet->list.size = drbCnt * sizeof(DRBs_SetupMod_ItemIEs_t *);
12915 DU_ALLOC(drbSet->list.array, drbSet->list.size);
12916 if(drbSet->list.array == NULLP)
12918 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
12921 for(arrIdx=0; arrIdx<drbCnt; arrIdx++)
12923 DU_ALLOC(drbSet->list.array[arrIdx], sizeof(DRBs_SetupMod_ItemIEs_t));
12924 if(drbSet->list.array[arrIdx] == NULLP)
12926 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
12930 drbItemIe = (struct DRBs_SetupMod_ItemIEs *)drbSet->list.array[arrIdx];
12931 drbItemIe->id = ProtocolIE_ID_id_DRBs_SetupMod_Item;
12932 drbItemIe->criticality = Criticality_reject;
12933 drbItemIe->value.present = DRBs_SetupMod_ItemIEs__value_PR_DRBs_SetupMod_Item;
12934 drbItemIe->value.choice.DRBs_SetupMod_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId;
12935 if(fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List,\
12936 &ueCfg->upTnlInfo[arrIdx])!= ROK)
12938 DU_LOG("\nERROR --> F1AP : Failed to fill DlTnl SetupList in BuildDrbToBeSetupModList");
12946 /*******************************************************************
12947 * @brief Free the memory allocated for DRB setup List
12951 * Function : FreeDrbSetupModList
12954 * Free the memory allocated for DRB setup list
12956 * @params[in] DRBs_Setup_List_t *
12959 * ****************************************************************/
12960 void FreeDrbSetupModList(DRBs_SetupMod_List_t *drbSetupList)
12962 uint8_t arrIdx = 0;
12963 DRBs_SetupMod_ItemIEs_t *drbItemIe = NULLP;
12965 for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++)
12967 drbItemIe = ((DRBs_SetupMod_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
12968 freeDlTnlInfo(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List);
12969 DU_FREE(drbSetupList->list.array[arrIdx], sizeof(DRBs_SetupMod_ItemIEs_t));
12971 DU_FREE(drbSetupList->list.array, drbSetupList->list.size);
12973 /*******************************************************************
12974 * @brief Free the memory allocated for UE Context Mod Response
12978 * Function : FreeUeContextModResp
12981 * Free the memory allocated for UE Context Mod Response
12983 * @params[in] F1AP_PDU_t *f1apMsg
12986 * ****************************************************************/
12988 void FreeUeContextModResp(F1AP_PDU_t *f1apMsg)
12991 UEContextModificationResponse_t *ueContextModifyRes = NULLP;
12994 if(f1apMsg->choice.successfulOutcome)
12996 ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
12997 if(ueContextModifyRes->protocolIEs.list.array)
12999 for(ieIdx=0 ; ieIdx<ueContextModifyRes->protocolIEs.list.count; ieIdx++)
13001 if(ueContextModifyRes->protocolIEs.list.array[ieIdx])
13003 switch(ueContextModifyRes->protocolIEs.list.array[ieIdx]->id)
13005 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
13007 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
13009 case ProtocolIE_ID_id_DRBs_SetupMod_List:
13011 FreeDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
13012 value.choice.DRBs_SetupMod_List));
13016 DU_FREE(ueContextModifyRes->protocolIEs.list.array[ieIdx], sizeof(UEContextModificationResponse_t));
13020 DU_FREE(ueContextModifyRes->protocolIEs.list.array, ueContextModifyRes->protocolIEs.list.size);
13022 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
13024 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
13028 /*****************************************************************i
13030 * @brief Creating the ue context modifcation response and sending
13034 * Function : BuildAndSendUeContextModRsp
13037 * - Creating the ue context modifcation response
13039 * @params[in] uint8_t cellId,uint8_t ueIdx
13040 * @return ROK - success
13041 * RFAILED - failure
13043 * ****************************************************************/
13044 uint8_t BuildAndSendUeContextModRsp(uint8_t cellId,uint8_t ueIdx)
13047 uint8_t cellIdx =0;
13048 uint8_t elementCnt = 0;
13049 uint8_t ret = RFAILED;
13050 uint32_t gnbCuUeF1apId; /* gNB-CU UE F1AP Id */
13051 uint32_t gnbDuUeF1apId; /* gNB-DU UE F1AP Id */
13052 F1AP_PDU_t *f1apMsg = NULLP;
13053 asn_enc_rval_t encRetVal;
13054 UEContextModificationResponse_t *ueContextModifyRes = NULLP;
13055 DuUeCb *ueCb = NULLP;
13057 DU_LOG("\nINFO --> F1AP : Building Ue context modification response\n");
13061 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
13062 if(f1apMsg == NULLP)
13064 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
13068 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
13070 DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
13071 if(f1apMsg->choice.successfulOutcome == NULLP)
13073 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
13076 f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_UEContextModification;
13077 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
13078 f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_UEContextModificationResponse;
13080 ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
13083 ueContextModifyRes->protocolIEs.list.count = elementCnt;
13084 ueContextModifyRes->protocolIEs.list.size = elementCnt*sizeof(UEContextModificationResponse_t*);
13086 /* Initialize the UE context modification members */
13087 DU_ALLOC(ueContextModifyRes->protocolIEs.list.array, ueContextModifyRes->protocolIEs.list.size);
13088 if(ueContextModifyRes->protocolIEs.list.array == NULLP)
13090 DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed");
13094 for(ieIdx=0 ; ieIdx<elementCnt; ieIdx++)
13096 DU_ALLOC(ueContextModifyRes->protocolIEs.list.array[ieIdx], sizeof(UEContextModificationResponse_t));
13097 if(ueContextModifyRes->protocolIEs.list.array[ieIdx] == NULLP)
13099 DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed");
13104 /* Fetching Ue Cb Info*/
13105 GET_CELL_IDX(cellId, cellIdx);
13106 gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId;
13107 gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId;
13108 ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1];
13111 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
13112 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
13113 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
13114 UEContextModificationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
13115 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId;
13118 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
13119 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
13120 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present=\
13121 UEContextModificationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
13122 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
13125 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_SetupMod_List;
13126 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
13127 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
13128 UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List;
13131 ret = BuildDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
13132 value.choice.DRBs_SetupMod_List) , &ueCb->f1UeDb->duUeCfg);
13135 DU_LOG( "\nERROR --> F1AP : Failed to build drb setupmod List ");
13138 freeF1UeDb(ueCb->f1UeDb);
13139 ueCb->f1UeDb = NULLP;
13141 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
13143 /* Encode the F1SetupRequest type as APER */
13144 memset(encBuf, 0, ENC_BUF_MAX_LEN);
13146 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,encBuf);
13148 /* Encode results */
13149 if(encRetVal.encoded == ENCODE_FAIL)
13151 DU_LOG( "\nERROR --> F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\
13152 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
13158 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UE Context Modification Response\n");
13159 for(int i=0; i< encBufSize; i++)
13161 printf("%x",encBuf[i]);
13166 if(sendF1APMsg() != ROK)
13168 DU_LOG("\nERROR --> F1AP : Sending UE Context Setup Res Failed");
13174 FreeUeContextModResp(f1apMsg);
13177 /*******************************************************************
13179 * @brief Deallocating the memory allocated by the aper decoder
13184 * Function : freeAperDecodeQosInfo
13186 * Functionality: Deallocating the memory allocated for QOSInfo
13188 * @params[in] QoSFlowLevelQoSParameters_t *drbQos
13192 * ****************************************************************/
13194 void freeAperDecodeQosInfo(QoSFlowLevelQoSParameters_t *drbQos)
13196 if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI != NULLP)
13198 if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
13200 if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
13202 free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
13204 free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
13206 free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI);
13209 /*******************************************************************
13211 * @brief Deallocating the memory allocated by the aper decoder
13212 * for UlTnlInfoforDrb
13216 * Function : freeAperDecodeUlTnlInfoforDrbSetupMod
13218 * Functionality: Deallocating memory allocated for UlTnlInfoforDrb
13220 * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
13224 * ****************************************************************/
13225 void freeAperDecodeUlTnlInfoforDrbSetupMod(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
13229 if(ulInfo->list.array)
13231 for(arrIdx=0; arrIdx<ulInfo->list.count ; arrIdx++)
13233 if(ulInfo->list.array[arrIdx])
13235 if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel )
13237 if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.buf)
13239 if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf)
13241 free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
13244 free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
13245 transportLayerAddress.buf);
13247 free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel);
13249 free(ulInfo->list.array[arrIdx]);
13252 free(ulInfo->list.array);
13255 /*******************************************************************
13257 * @brief Deallocating the memory allocated by the aper decoder
13258 * for DrbSetupModItem
13262 * Function : freeAperDecodeDrbSetupModItem
13264 * Functionality: Deallocating memory allocated for DrbSetupModItem
13266 * @params[in] DRBs_ToBeSetupMod_Item_t *drbItem
13270 * ****************************************************************/
13272 void freeAperDecodeDrbSetupModItem(DRBs_ToBeSetupMod_Item_t *drbItem)
13275 SNSSAI_t *snssai =NULLP;
13276 Flows_Mapped_To_DRB_List_t *flowMap = NULLP;
13278 drbItem->qoSInformation.present = QoSInformation_PR_choice_extension;
13279 switch(drbItem->qoSInformation.present)
13281 case QoSInformation_PR_NOTHING:
13283 case QoSInformation_PR_eUTRANQoS:
13285 if(drbItem->qoSInformation.choice.eUTRANQoS)
13287 free(drbItem->qoSInformation.choice.eUTRANQoS);
13291 case QoSInformation_PR_choice_extension:
13293 if(drbItem->qoSInformation.choice.choice_extension)
13295 freeAperDecodeQosInfo(&drbItem->qoSInformation.choice.choice_extension->value.choice.\
13296 DRB_Information.dRB_QoS);
13297 snssai = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI;
13298 if(snssai->sST.buf)
13300 free(snssai->sST.buf);
13304 if(snssai->sD->buf)
13306 free(snssai->sD->buf);
13311 flowMap = &drbItem->qoSInformation.choice.choice_extension->value.choice.\
13312 DRB_Information.flows_Mapped_To_DRB_List;
13313 if(flowMap->list.array)
13315 for(arrIdx=0; arrIdx<flowMap->list.count; arrIdx++)
13317 if(flowMap->list.array[arrIdx] )
13319 freeAperDecodeQosInfo(&flowMap->list.array[arrIdx]->qoSFlowLevelQoSParameters);
13320 free(flowMap->list.array[arrIdx]);
13323 free(flowMap->list.array);
13326 free(drbItem->qoSInformation.choice.choice_extension);
13332 freeAperDecodeUlTnlInfoforDrbSetupMod(&drbItem->uLUPTNLInformation_ToBeSetup_List);
13333 if(drbItem->uLConfiguration)
13335 free(drbItem->uLConfiguration);
13339 /*******************************************************************
13341 * @brief Deallocating the memory allocated by the aper decoder
13342 * for DrbToBeSetupModList
13346 * Function : freeAperDecodeDrbToBeSetupModList
13348 * Functionality: Deallocating memory allocated for DrbToBeSetupModList
13350 * @params[in] DRBs_ToBeSetupMod_List_t *drbSet
13354 * ****************************************************************/
13356 void freeAperDecodeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
13359 struct DRBs_ToBeSetupMod_ItemIEs *drbItemIe;
13361 if(drbSet->list.array)
13363 for(arrIdx=0; arrIdx<drbSet->list.count ; arrIdx++)
13365 if(drbSet->list.array[arrIdx] != NULLP)
13369 drbItemIe = (DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx];
13370 freeAperDecodeDrbSetupModItem(&(drbItemIe->value.choice.DRBs_ToBeSetupMod_Item));
13372 free(drbSet->list.array[arrIdx]);
13375 free(drbSet->list.array);
13379 /*******************************************************************
13381 * @brief Deallocating the memory allocated by the aper decoder
13382 * for UeContextModificationReqMsg
13386 * Function : freeAperDecodeUeContextModificationReqMsg
13388 * Functionality: Deallocating memory allocated for
13389 * UeContextModificationReqMsg
13391 * @params[in] UEContextModificationRequest_t *UeContextModifyReq
13395 * ****************************************************************/
13396 void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *UeContextModifyReq )
13398 uint8_t arrIdx, ieId;
13400 if(UeContextModifyReq->protocolIEs.list.array)
13402 for( arrIdx = 0 ; arrIdx<UeContextModifyReq->protocolIEs.list.count ; arrIdx++)
13404 if(UeContextModifyReq->protocolIEs.list.array[arrIdx])
13406 ieId = UeContextModifyReq->protocolIEs.list.array[arrIdx]->id;
13409 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
13411 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
13413 case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
13415 freeAperDecodeDrbToBeSetupModList(&UeContextModifyReq->protocolIEs.list.array[arrIdx]->\
13416 value.choice.DRBs_ToBeSetupMod_List);
13420 free(UeContextModifyReq->protocolIEs.list.array[arrIdx]);
13423 free(UeContextModifyReq->protocolIEs.list.array);
13426 /*******************************************************************
13428 * @brief processing the F1 UeContextModificationReq
13432 * Function : procF1UeContextModificationReq
13434 * Functionality: processing the F1 UeContextModificationReq
13436 * @params[in] F1AP_PDU_t *f1apMsg
13439 * ****************************************************************/
13440 uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
13442 UEContextModificationRequest_t *ueContextModifyReq = NULLP;
13443 uint8_t ret = ROK, ieIdx = 0, cellIdx=0, ueIdx=0;
13444 DuUeCb *duUeCb = NULLP;
13445 DRBs_ToBeSetupMod_List_t *drbSetupModCfg;
13446 DRBs_ToBeModified_List_t *drbModifiedCfg;
13447 uint32_t gnbCuUeF1apId, gnbDuUeF1apId;
13449 ueContextModifyReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest;
13450 for(ieIdx=0; (ieIdx < ueContextModifyReq->protocolIEs.list.count && ret == ROK); ieIdx++)
13452 switch(ueContextModifyReq->protocolIEs.list.array[ieIdx]->id)
13454 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
13456 gnbCuUeF1apId = ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
13459 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
13461 gnbDuUeF1apId = ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
13464 case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
13465 case ProtocolIE_ID_id_DRBs_ToBeModified_List:
13467 for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++)
13469 for(ueIdx = 0; ueIdx < duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++)
13471 if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
13472 (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
13475 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
13476 if(duUeCb->f1UeDb == NULLP)
13478 DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
13482 duUeCb->f1UeDb->actionType = UE_CTXT_MOD;
13483 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present ==\
13484 UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List)
13486 drbSetupModCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
13487 choice.DRBs_ToBeSetupMod_List;
13489 if(extractDrbListToSetupMod(NULL, drbSetupModCfg, NULL, drbSetupModCfg->list.count,\
13490 &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULL))
13492 DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod() for DrbSetupModList");
13497 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present == \
13498 UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List)
13501 drbModifiedCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
13502 choice.DRBs_ToBeModified_List;
13503 if(extractDrbListToSetupMod(NULL, NULL, drbModifiedCfg, drbModifiedCfg->list.count,\
13504 &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, &duUeCb->rlcUeCfg))
13506 DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod() for DrbModifiedList");
13514 if(ueIdx >= duCb.actvCellLst[cellIdx]->numActvUes)
13516 DU_LOG("\nERROR --> DU APP : wrong values of gnbCuUeF1apId and gnbDuUeF1apId ");
13526 ret = duProcUeContextModReq(duUeCb);
13528 freeAperDecodeUeContextModificationReqMsg(ueContextModifyReq);
13531 /*****************************************************************i
13533 * @brief Free memory allocated for UE Context Release Request
13537 * Function : FreeUeContextReleaseReq
13540 * - Free memory allocated for UE Context Release Request
13542 * @params[in] F1AP_PDU_t *f1apMsg
13545 * *************************************************************/
13546 void FreeUeContextReleaseReq(F1AP_PDU_t *f1apMsg)
13549 UEContextReleaseRequest_t *ueReleaseReq = NULLP;
13553 if(f1apMsg->choice.initiatingMessage)
13555 ueReleaseReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseRequest;
13556 if(ueReleaseReq->protocolIEs.list.array)
13558 for(ieIdx=0 ; ieIdx<ueReleaseReq->protocolIEs.list.count; ieIdx++)
13560 DU_FREE(ueReleaseReq->protocolIEs.list.array[ieIdx], sizeof(UEContextReleaseRequest_t));
13562 DU_FREE(ueReleaseReq->protocolIEs.list.array, ueReleaseReq->protocolIEs.list.size);
13564 DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
13566 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
13570 /*****************************************************************i
13572 * @brief Build and Send UE Context Release Request
13576 * Function : BuildAndSendUeContextReleaseReq
13579 * - Build and Send UE Context Release Request
13582 * @return ROK - success
13583 * RFAILED - failure
13585 * *************************************************************/
13586 uint8_t BuildAndSendUeContextReleaseReq(uint16_t cellId, uint8_t ueIdx)
13588 bool memAllocFail = false;
13590 uint8_t ret = RFAILED;
13591 uint16_t cellIdx =0;
13592 uint16_t crnti = 0;
13593 uint8_t elementCnt = 0;
13594 uint32_t gnbCuUeF1apId =0; /* gNB-CU UE F1AP Id */
13595 uint32_t gnbDuUeF1apId =0; /* gNB-DU UE F1AP Id */
13596 asn_enc_rval_t encRetVal;
13597 F1AP_PDU_t *f1apMsg = NULLP;
13598 UEContextReleaseRequest_t *ueReleaseReq = NULLP;
13600 DU_LOG("\nINFO --> Building the UE Context Release Request");
13603 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
13604 if(f1apMsg == NULLP)
13606 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for f1apMsg");
13610 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
13611 DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
13612 if(f1apMsg->choice.initiatingMessage == NULLP)
13614 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for\
13615 initiatingMessage");
13618 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_UEContextReleaseRequest;
13619 f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
13620 f1apMsg->choice.initiatingMessage->value.present = \
13621 InitiatingMessage__value_PR_UEContextReleaseRequest;
13623 ueReleaseReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseRequest;
13627 ueReleaseReq->protocolIEs.list.count = elementCnt;
13628 ueReleaseReq->protocolIEs.list.size = elementCnt * sizeof(UEContextReleaseRequest_t *);
13630 /* Initialize the F1Setup members */
13631 DU_ALLOC(ueReleaseReq->protocolIEs.list.array,ueReleaseReq->protocolIEs.list.size);
13632 if(ueReleaseReq->protocolIEs.list.array == NULLP)
13634 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for IE array");
13637 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
13639 DU_ALLOC(ueReleaseReq->protocolIEs.list.array[ieIdx],\
13640 sizeof(UEContextReleaseRequest_t));
13641 if(ueReleaseReq->protocolIEs.list.array[ieIdx] == NULLP)
13643 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for IE elements");
13644 memAllocFail = true;
13648 if(memAllocFail == true)
13651 /* Fetching Ue Cb Info*/
13652 GET_CELL_IDX(cellId, cellIdx);
13653 if(duCb.actvCellLst[cellIdx] == NULLP)
13655 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): CellId[%d] does not exist", cellId);
13660 GET_CRNTI(crnti, ueIdx);
13661 if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].crnti != crnti)
13663 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): crnti[%d] does not exist", crnti);
13666 gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId;
13667 gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId;
13671 ueReleaseReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
13672 ueReleaseReq->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
13673 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.present = \
13674 UEContextReleaseRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
13675 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID =gnbCuUeF1apId;
13678 ueReleaseReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
13679 ueReleaseReq->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
13680 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.present =\
13681 UEContextReleaseRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
13682 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =gnbDuUeF1apId;
13684 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
13686 /* Encode the F1SetupRequest type as APER */
13687 memset(encBuf, 0, ENC_BUF_MAX_LEN);
13689 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
13690 /* Encode results */
13691 if(encRetVal.encoded == ENCODE_FAIL)
13693 DU_LOG("\nERROR --> F1AP : Could not encode UEContextReleaseRequest structure (at %s)\n",\
13694 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
13699 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UEContextReleaseRequest\n");
13700 for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
13702 printf("%x",encBuf[ieIdx]);
13707 if(sendF1APMsg() != ROK)
13709 DU_LOG("\nERROR --> F1AP : Sending UE Context Release Request failed");
13716 FreeUeContextReleaseReq(f1apMsg);
13719 /*****************************************************************i
13721 * @brief Free memory allocated for UE Context Release Complete
13725 * Function : FreeUeContextReleaseComplete
13728 * - Free memory allocated for UE Context Release Complete
13730 * @params[in] F1AP_PDU_t *f1apMsg
13733 * *************************************************************/
13734 void FreeUeContextReleaseComplete(F1AP_PDU_t *f1apMsg)
13737 UEContextReleaseComplete_t *ueReleaseComplete = NULLP;
13741 if(f1apMsg->choice.successfulOutcome)
13743 ueReleaseComplete =&f1apMsg->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
13744 if(ueReleaseComplete->protocolIEs.list.array)
13746 for(ieIdx=0 ; ieIdx<ueReleaseComplete->protocolIEs.list.count; ieIdx++)
13748 DU_FREE(ueReleaseComplete->protocolIEs.list.array[ieIdx], sizeof(UEContextReleaseComplete_t));
13750 DU_FREE(ueReleaseComplete->protocolIEs.list.array, ueReleaseComplete->protocolIEs.list.size);
13752 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
13754 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
13758 /*****************************************************************i
13760 * @brief Build and Send UE Context Release Complete
13764 * Function : BuildAndSendUeContextReleaseComplete
13767 * - Build and Send UE Context Release Complete
13769 * @params[in] cellId, gnbCuUeF1apId, gnbDuUeF1apId
13770 * @return ROK - success
13771 * RFAILED - failure
13773 * *************************************************************/
13774 uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId)
13776 bool memAllocFail = false;
13777 uint8_t ieIdx =0, ret = RFAILED, elementCnt = 0;
13778 asn_enc_rval_t encRetVal;
13779 F1AP_PDU_t *f1apMsg = NULLP;
13780 UEContextReleaseComplete_t *ueReleaseComplete = NULLP;
13782 DU_LOG("\nINFO --> Building the UE Context Release Complete");
13785 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
13786 if(f1apMsg == NULLP)
13788 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for f1apMsg");
13792 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
13793 DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
13794 if(f1apMsg->choice.successfulOutcome == NULLP)
13796 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for\
13797 successfulOutcome");
13800 f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_UEContextRelease;
13801 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
13802 f1apMsg->choice.successfulOutcome->value.present = \
13803 SuccessfulOutcome__value_PR_UEContextReleaseComplete;
13805 ueReleaseComplete = &f1apMsg->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
13808 ueReleaseComplete->protocolIEs.list.count = elementCnt;
13809 ueReleaseComplete->protocolIEs.list.size = elementCnt * sizeof(UEContextReleaseComplete_t *);
13811 /* Initialize the UE Release Complete members */
13812 DU_ALLOC(ueReleaseComplete->protocolIEs.list.array,ueReleaseComplete->protocolIEs.list.size);
13813 if(ueReleaseComplete->protocolIEs.list.array == NULLP)
13815 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for IE array");
13818 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
13820 DU_ALLOC(ueReleaseComplete->protocolIEs.list.array[ieIdx],\
13821 sizeof(UEContextReleaseComplete_t));
13822 if(ueReleaseComplete->protocolIEs.list.array[ieIdx] == NULLP)
13824 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for IE\
13826 memAllocFail = true;
13830 if(memAllocFail == true)
13835 ueReleaseComplete->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
13836 ueReleaseComplete->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
13837 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.present = \
13838 UEContextReleaseCompleteIEs__value_PR_GNB_CU_UE_F1AP_ID;
13839 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID =gnbCuUeF1apId;
13842 ueReleaseComplete->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
13843 ueReleaseComplete->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
13844 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.present =\
13845 UEContextReleaseCompleteIEs__value_PR_GNB_DU_UE_F1AP_ID;
13846 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =gnbDuUeF1apId;
13848 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
13850 /* Encode the F1SetupComplete type as APER */
13851 memset(encBuf, 0, ENC_BUF_MAX_LEN);
13853 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
13854 /* Encode results */
13855 if(encRetVal.encoded == ENCODE_FAIL)
13857 DU_LOG("\nERROR --> F1AP : Could not encode UEContextReleaseComplete structure (at %s)\n",\
13858 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
13863 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UEContextReleaseComplete\n");
13864 for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
13866 printf("%x",encBuf[ieIdx]);
13871 if(sendF1APMsg() != ROK)
13873 DU_LOG("\nERROR --> F1AP : Sending UE Context Release Complete failed");
13880 if(ret == ROK && (duCb.actvCellLst[cellId-1]->numActvUes == 0))
13882 duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS;
13883 ret = duSendCellDeletReq(cellId);
13886 DU_LOG("\nERROR --> F1AP: BuildAndSendUeContextReleaseComplete(): Failed to process cell\
13887 Delete req for CellId");
13890 FreeUeContextReleaseComplete(f1apMsg);
13895 /*******************************************************************
13897 * @brief added free part for the memory allocated by aper_decoder
13901 * Function : freeAperDecodeUeContextReleaseCommand
13903 * Functionality: added free part for the memory allocated by aper_decoder
13905 * @params[in] F1AP_PDU_t *f1apMsg
13908 * ****************************************************************/
13909 void freeAperDecodeUeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
13912 UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
13914 ueContextReleaseCommand = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
13916 if(ueContextReleaseCommand->protocolIEs.list.array)
13918 for(ieIdx=0; ieIdx < ueContextReleaseCommand->protocolIEs.list.count; ieIdx++)
13920 if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx])
13922 switch(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id)
13924 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
13926 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
13928 case ProtocolIE_ID_id_Cause:
13930 case ProtocolIE_ID_id_RRCContainer:
13932 if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
13934 free(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf);
13939 DU_LOG("\nERROR --> F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\
13940 ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id);
13944 free(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]);
13946 free(ueContextReleaseCommand->protocolIEs.list.array);
13949 /*******************************************************************
13951 * @brief processing of UE Context Release Command
13955 * Function : procF1UeContextReleaseCommand
13957 * Functionality: processing of UE Context Release Command
13959 * @params[in] F1AP_PDU_t *f1apMsg
13962 * ****************************************************************/
13963 uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
13965 uint8_t ieIdx=0, ret=ROK, ueIdx=0;
13966 uint16_t cellIdx =0;
13968 uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0;
13969 DuUeCb *duUeCb = NULLP;
13970 UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
13972 ueContextReleaseCommand = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
13974 if(ueContextReleaseCommand->protocolIEs.list.array)
13976 for(ieIdx=0; ieIdx < ueContextReleaseCommand->protocolIEs.list.count; ieIdx++)
13978 if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx])
13980 switch(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id)
13982 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
13984 gnbCuUeF1apId= ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
13985 value.choice.GNB_CU_UE_F1AP_ID;
13989 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
13991 gnbDuUeF1apId = ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
13992 value.choice.GNB_DU_UE_F1AP_ID;
13996 case ProtocolIE_ID_id_Cause:
14001 case ProtocolIE_ID_id_RRCContainer:
14003 for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++)
14005 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
14007 if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
14008 (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
14010 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
14011 DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
14014 memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
14015 duUeCb->f1UeDb->actionType = UE_CTXT_RELEASE;
14016 duUeCb->f1UeDb->cellIdx = cellIdx;
14017 /* Filling Dl RRC Msg Info */
14018 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
14019 if(!duUeCb->f1UeDb->dlRrcMsg)
14021 DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \
14022 Memory allocation failed ");
14027 duUeCb->f1UeDb->dlRrcMsgPres = true;
14028 memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
14029 ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
14030 &ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
14031 value.choice.RRCContainer);
14037 DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \
14038 Memory allocation failed ");
14047 if(ueIdxFound == true)
14054 DU_LOG("\nERROR --> F1AP: DuUeCb is not found at procF1UeContextReleaseCommand()");
14062 DU_LOG("\nERROR --> F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\
14063 ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id);
14071 duProcUeContextReleaseCommand(duUeCb);
14073 freeAperDecodeUeContextReleaseCommand(f1apMsg);
14076 /**************************************************************
14078 * @brief Handles received F1AP message and sends back response
14082 * Function : F1APMsgHdlr
14085 * - Decodes received F1AP control message
14086 * - Prepares response message, encodes and sends to SCTP
14089 * @return ROK - success
14090 * RFAILED - failure
14092 * ****************************************************************/
14093 void F1APMsgHdlr(Buffer *mBuf)
14096 char *recvBuf =NULLP;
14098 MsgLen recvBufLen =0;
14099 F1AP_PDU_t *f1apMsg =NULLP;
14100 asn_dec_rval_t rval; /* Decoder return value */
14101 F1AP_PDU_t f1apasnmsg ;
14102 DU_LOG("\nINFO --> F1AP : Received F1AP message buffer");
14103 ODU_PRINT_MSG(mBuf, 0,0);
14105 /* Copy mBuf into char array to decode it */
14106 ODU_GET_MSG_LEN(mBuf, &recvBufLen);
14107 DU_ALLOC(recvBuf, (Size)recvBufLen);
14109 if(recvBuf == NULLP)
14111 DU_LOG("\nERROR --> F1AP : Memory allocation failed");
14114 if(ODU_COPY_MSG_TO_FIX_BUF(mBuf, 0, recvBufLen, (Data *)recvBuf, ©Cnt) != ROK)
14116 DU_LOG("\nERROR --> F1AP : Failed while copying %d", copyCnt);
14120 printf("\nDEBUG --> F1AP : Received flat buffer to be decoded : ");
14121 for(i=0; i< recvBufLen; i++)
14123 printf("%x",recvBuf[i]);
14126 /* Decoding flat buffer into F1AP messsage */
14127 f1apMsg = &f1apasnmsg;
14128 memset(f1apMsg, 0, sizeof(F1AP_PDU_t));
14130 rval = aper_decode(0, &asn_DEF_F1AP_PDU, (void **)&f1apMsg, recvBuf, recvBufLen, 0, 0);
14131 DU_FREE(recvBuf, (Size)recvBufLen);
14133 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
14135 DU_LOG("\nERROR --> F1AP : ASN decode failed");
14139 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
14141 switch(f1apMsg->present)
14143 case F1AP_PDU_PR_successfulOutcome:
14145 switch(f1apMsg->choice.successfulOutcome->value.present)
14147 case SuccessfulOutcome__value_PR_ResetAcknowledge:
14149 DU_LOG("\nINFO --> F1AP : F1ResetAcknowledge is received successfully ");
14152 case SuccessfulOutcome__value_PR_F1SetupResponse:
14154 #ifndef ODU_TEST_STUB
14155 procF1SetupRsp(f1apMsg);
14160 case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge:
14162 procF1GNBDUCfgUpdAck(f1apMsg);
14168 DU_LOG("\nERROR --> F1AP : Invalid type of SuccessfulOutcome__value_PR_ResetAcknowledge [%d]",\
14169 f1apMsg->choice.successfulOutcome->value.present);
14172 }/* End of switch(successfulOutcome) */
14173 free(f1apMsg->choice.successfulOutcome);
14176 case F1AP_PDU_PR_initiatingMessage:
14178 switch(f1apMsg->choice.initiatingMessage->value.present)
14180 case InitiatingMessage__value_PR_Reset:
14182 procF1ResetReq(f1apMsg);
14185 case InitiatingMessage__value_PR_DLRRCMessageTransfer:
14187 procF1DlRrcMsgTrans(f1apMsg);
14190 case InitiatingMessage__value_PR_UEContextSetupRequest:
14192 procF1UeContextSetupReq(f1apMsg);
14195 case InitiatingMessage__value_PR_UEContextModificationRequest:
14197 procF1UeContextModificationReq(f1apMsg);
14200 case InitiatingMessage__value_PR_UEContextReleaseCommand:
14202 procF1UeContextReleaseCommand(f1apMsg);
14207 DU_LOG("\nERROR --> F1AP : Invalid type of F1AP_PDU_PR_initiatingMessage [%d]",
14208 f1apMsg->choice.initiatingMessage->value.present);
14211 }/* End of switch(initiatingMessage) */
14212 free(f1apMsg->choice.initiatingMessage);
14218 DU_LOG("\nERROR --> F1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present);
14223 }/* End of switch(f1apMsg->present) */
14225 } /* End of F1APMsgHdlr */
14227 /**********************************************************************
14229 **********************************************************************/