X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_sys_info_hdl.c;h=08a86f03b71337c697d2d07000e6ae9180a8f665;hb=05d098e6b94f629a932caaff404f2b703b123852;hp=080ccf16dd469d8b44f043cb3a4f52a47ae758d6;hpb=3eb33bcb19a8e47fcf8b58b417d6fa05919952cf;p=o-du%2Fl2.git diff --git a/src/du_app/du_sys_info_hdl.c b/src/du_app/du_sys_info_hdl.c index 080ccf16d..08a86f03b 100644 --- a/src/du_app/du_sys_info_hdl.c +++ b/src/du_app/du_sys_info_hdl.c @@ -18,6 +18,7 @@ /* This file contains ASN codec for MIB and SIB1 msgs */ #include "common_def.h" +#include "du_tmr.h" #include "lrg.h" #include "lkw.x" #include "lrg.x" @@ -25,6 +26,7 @@ #include "du_app_mac_inf.h" #include "du_cfg.h" #include "du_app_rlc_inf.h" +#include "du_e2ap_mgr.h" #include "du_mgr.h" #include "du_utils.h" #include "BCCH-BCH-Message.h" @@ -56,8 +58,9 @@ #include "MCC.h" #include "SIB1.h" #include "odu_common_codec.h" -#include "du_sys_info_hdl.h" +#include "BCCH-DL-SCH-Message.h" #include "du_f1ap_conversions.h" +#include "du_sys_info_hdl.h" void FreeSib1Msg(SIB1_t *sib1Msg); uint8_t FreqInfoUlret = RFAILED; @@ -191,7 +194,7 @@ uint8_t BuildMibPdu() xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg); memset(encBuf, 0, ENC_BUF_MAX_LEN); encBufSize = 0; - encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0, + encRetVal = uper_encode(&asn_DEF_BCCH_BCH_Message, 0, bcchMsg, PrepFinalEncBuf, encBuf); printf("\nencbufSize:%d\n", encBufSize); if(encRetVal.encoded == -1) @@ -287,7 +290,7 @@ uint8_t BuildMibMsg() xer_fprint(stdout, &asn_DEF_MIB, mibMsg); memset(encBuf, 0, ENC_BUF_MAX_LEN); encBufSize = 0; - encRetVal = aper_encode(&asn_DEF_MIB, 0, + encRetVal = uper_encode(&asn_DEF_MIB, 0, mibMsg, PrepFinalEncBuf, encBuf); printf("\nencbufSize:%d\n", encBufSize); if(encRetVal.encoded == -1) @@ -452,6 +455,7 @@ uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo) DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure"); return RFAILED; } + elementCnt = cellAccessInfo->plmn_IdentityList.list.count; for(idx=0; idxplmn_IdentityList.list.array[idx]->\ - plmn_IdentityList; + plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList; plmnIdInfo->list.count = elementCnt; plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *); DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size); @@ -481,8 +484,7 @@ uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo) for(idx1=0; idx1list.array[idx1], - sizeof(PLMN_IdentitY_t)); + DU_ALLOC(plmnIdInfo->list.array[idx1], sizeof(PLMN_IdentitY_t)); if(!(plmnIdInfo->list.array[idx1])) { DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure"); @@ -490,8 +492,7 @@ uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo) } } idx1 = 0; - DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc, - sizeof(MCC_t)); + DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc, sizeof(MCC_t)); if(!plmnIdInfo->list.array[idx1]->mcc) { DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure"); @@ -500,15 +501,13 @@ uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo) elementCnt = ODU_VALUE_THREE; plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt; - plmnIdInfo->list.array[idx1]->mcc->list.size =\ - elementCnt * sizeof(MCC_MNC_Digit_t *); - DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array, - plmnIdInfo->list.array[idx1]->mcc->list.size) - if(!(plmnIdInfo->list.array[idx1]->mcc->list.array)) - { - DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure"); - return RFAILED; - } + plmnIdInfo->list.array[idx1]->mcc->list.size = elementCnt * sizeof(MCC_MNC_Digit_t *); + DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array, plmnIdInfo->list.array[idx1]->mcc->list.size); + if(!(plmnIdInfo->list.array[idx1]->mcc->list.array)) + { + DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure"); + return RFAILED; + } for(idx2=0; idx2list.array[idx1]->mcc->list.array[idx2], @@ -923,6 +922,12 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8; searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16; +/* Commented due to ASN decode failure in wireshark. + * Parameters like dci_Format0_0_AndFormat1_0 which are pointer to a structure that + * does not have any member parameter lead to decode failure in wireshark. + * The issue has been reported to Nokia. + * The following code will be uncommented once the issue is resolved */ +#if 0 /* Search Space type and DCI Format */ DU_ALLOC(searchSpace->searchSpaceType, sizeof( struct SearchSpace__searchSpaceType)); if(!searchSpace->searchSpaceType) @@ -947,7 +952,8 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); return RFAILED; } - + + searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = NULLP; DU_ALLOC(searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0, \ sizeof(struct SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0)); if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) @@ -955,6 +961,11 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); return RFAILED; } + + searchSpace->searchSpaceType->choice.common->dci_Format2_0 = NULLP; + searchSpace->searchSpaceType->choice.common->dci_Format2_1 = NULLP; + searchSpace->searchSpaceType->choice.common->dci_Format2_2 = NULLP; + searchSpace->searchSpaceType->choice.common->dci_Format2_3 = NULLP; break; } case SearchSpace__searchSpaceType_PR_ue_Specific: @@ -967,6 +978,7 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace return RFAILED; } } +#endif return ROK; }/* BuildCommonSerachSpaceList */ @@ -1082,7 +1094,6 @@ uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcch return RFAILED; } *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc; - break; } default : @@ -2378,6 +2389,7 @@ uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg) * ****************************************************************/ uint8_t BuildSib1Msg() { + BCCH_DL_SCH_Message_t bcchMsg; SIB1_t *sib1Msg; CellAccessRelatedInfo_t *cellAccessInfo; uint8_t elementCnt; @@ -2387,15 +2399,50 @@ uint8_t BuildSib1Msg() do { - DU_ALLOC(sib1Msg, sizeof(SIB1_t)); - if(!sib1Msg) + bcchMsg.message.present = BCCH_DL_SCH_MessageType_PR_c1; + + DU_ALLOC(bcchMsg.message.choice.c1, sizeof(struct BCCH_DL_SCH_MessageType__c1)); + if(!bcchMsg.message.choice.c1) + { + DU_LOG("\nERROR --> DU APP: BCCH-DL-SCH msg memory allocation failure"); + break; + } + bcchMsg.message.choice.c1->present = BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1; + DU_ALLOC(bcchMsg.message.choice.c1->choice.systemInformationBlockType1, sizeof(SIB1_t)); + if(!bcchMsg.message.choice.c1->choice.systemInformationBlockType1) { DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure"); break; } - + sib1Msg = bcchMsg.message.choice.c1->choice.systemInformationBlockType1; elementCnt = ODU_VALUE_ONE; + /* Cell Selection Info */ + DU_ALLOC(sib1Msg->cellSelectionInfo, sizeof(struct SIB1__cellSelectionInfo)); + if(!sib1Msg->cellSelectionInfo) + { + DU_LOG("\nERROR --> DU APP: SIB1 Cell Selection Info memory allocation failed"); + break; + } + + sib1Msg->cellSelectionInfo->q_RxLevMin = -50; + + DU_ALLOC(sib1Msg->cellSelectionInfo->q_RxLevMinSUL, sizeof(Q_RxLevMin_t)); + if(!sib1Msg->cellSelectionInfo->q_RxLevMinSUL) + { + DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for q_RxLevMinSUL"); + break; + } + *(sib1Msg->cellSelectionInfo->q_RxLevMinSUL) = -50; + + DU_ALLOC(sib1Msg->cellSelectionInfo->q_QualMin, sizeof(Q_QualMin_t)); + if(!sib1Msg->cellSelectionInfo->q_QualMin) + { + DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for q_QualMin"); + break; + } + *(sib1Msg->cellSelectionInfo->q_QualMin) = -30; + /* PLMN list */ cellAccessInfo = &sib1Msg->cellAccessRelatedInfo; cellAccessInfo->plmn_IdentityList.list.count = elementCnt; @@ -2413,10 +2460,16 @@ uint8_t BuildSib1Msg() DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure"); break; } - sib1Msg->connEstFailureControl->connEstFailCount =\ - duCfgParam.sib1Params.connEstFailCnt; - sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\ - duCfgParam.sib1Params.connEstFailOffValidity; + sib1Msg->connEstFailureControl->connEstFailCount = duCfgParam.sib1Params.connEstFailCnt; + sib1Msg->connEstFailureControl->connEstFailOffsetValidity = duCfgParam.sib1Params.connEstFailOffValidity; + + DU_ALLOC(sib1Msg->connEstFailureControl->connEstFailOffset, sizeof(long)); + if(!sib1Msg->connEstFailureControl->connEstFailOffset) + { + DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for connEstFailOffset"); + break; + } + *(sib1Msg->connEstFailureControl->connEstFailOffset) = duCfgParam.sib1Params.connEstFailOffset; /* SI Scheduling Info */ DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t)); @@ -2449,17 +2502,17 @@ uint8_t BuildSib1Msg() break; } - xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg); + xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, &bcchMsg); /* Encode the F1SetupRequest type as APER */ memset(encBuf, 0, ENC_BUF_MAX_LEN); encBufSize = 0; - encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\ + encRetVal = uper_encode(&asn_DEF_BCCH_DL_SCH_Message, 0, &bcchMsg, PrepFinalEncBuf,\ encBuf); printf("\nencbufSize: %d\n", encBufSize); if(encRetVal.encoded == -1) { - DU_LOG("\nERROR --> DU APP : Could not encode SIB1 structure (at %s)\n",\ + DU_LOG("\nERROR --> DU APP : Could not encode BCCH-DL-SCH structure (at %s)\n",\ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); @@ -2477,12 +2530,11 @@ uint8_t BuildSib1Msg() break; }while(true); - FreeSib1Msg(sib1Msg); + FreeBcchDlSchMsg(bcchMsg); return ret; - - } + /******************************************************************* * * @brief : deallocating the memory of BuildSib1Msg @@ -2869,7 +2921,7 @@ void FreePuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg) /* P0 Nominal with grant */ DU_FREE(setup->p0_NominalWithGrant, sizeof(long)); - DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t)); + DU_FREE(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t)); } }/* BuildPuschCfgCommon */ @@ -3201,6 +3253,48 @@ void FreeSib1Msg(SIB1_t *sib1Msg) } +/******************************************************************* + * + * @brief : Deallocation of BCCH_DL_SCH_Message_t + * + * @details + * + * Function : FreeBcchDlSchMsg + * + * Functionality: Freeing memory of BCCH DL SCH Message + * + * @params[in] : BCCH_DL_SCH_Message_t bcchMsg + * @return : void + * + *******************************************************************/ +void FreeBcchDlSchMsg(BCCH_DL_SCH_Message_t bcchMsg) +{ + switch(bcchMsg.message.present) + { + case BCCH_DL_SCH_MessageType_PR_c1: + { + switch(bcchMsg.message.choice.c1->present) + { + case BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: + { + FreeSib1Msg(bcchMsg.message.choice.c1->choice.systemInformationBlockType1); + break; + } + case BCCH_DL_SCH_MessageType__c1_PR_systemInformation: + break; + case BCCH_DL_SCH_MessageType__c1_PR_NOTHING: + break; + } + DU_FREE(bcchMsg.message.choice.c1, sizeof(struct BCCH_DL_SCH_MessageType__c1)); + break; + } + case BCCH_DL_SCH_MessageType_PR_messageClassExtension: + break; + case BCCH_DL_SCH_MessageType_PR_NOTHING: + break; + } +} + /********************************************************************** End of file **********************************************************************/