Merge remote-tracking branch 'origin/develop' into harq_latency_control

Conflicts:
	cmake_targets/phy_simulators
	openair1/PHY/CODING/crc_byte.c
	openair2/GNB_APP/gnb_paramdef.h
	openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
	openair2/RRC/NR/rrc_gNB.c
This commit is contained in:
Raymond Knopp
2022-02-13 09:55:01 +01:00
607 changed files with 31638 additions and 20847 deletions
+35 -15
View File
@@ -323,31 +323,37 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
// call do_RRCSetup like full procedure and extract masterCellGroup
NR_CellGroupConfig_t cellGroupConfig;
NR_ServingCellConfigCommon_t *scc=RC.nrrrc[module_idP]->carrier.servingcellconfigcommon;
uint8_t sdu2[100];
memset(&cellGroupConfig,0,sizeof(cellGroupConfig));
fill_initial_cellGroupConfig(rntiP,&cellGroupConfig,scc,&RC.nrrrc[module_idP]->carrier);
fill_initial_cellGroupConfig(rntiP,-1,&cellGroupConfig,scc,&RC.nrrrc[module_idP]->carrier);
MessageDef* tmp=itti_alloc_new_message_sized(TASK_RRC_GNB, 0, F1AP_INITIAL_UL_RRC_MESSAGE, sizeof(f1ap_initial_ul_rrc_message_t) + sdu_lenP);
f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(tmp);
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
(void *)&cellGroupConfig,
sdu2,
100);
msg->du2cu_rrc_container,
1024); //sizeof(msg->du2cu_rrc_container));
int sdu2_len = (enc_rval.encoded+7)/8;
if (enc_rval.encoded == -1) {
LOG_E(F1AP,"Could not encoded cellGroupConfig, failed element %s\n",enc_rval.failed_type->name);
exit(-1);
}
/* do ITTI message */
DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
module_idP,
CC_id,
UE_id,
rntiP,
sduP,
sdu_lenP,
(const int8_t*)sdu2,
sdu2_len
);
msg->du2cu_rrc_container_length = (enc_rval.encoded+7)/8;
msg->crnti=rntiP;
msg->rrc_container=(uint8_t*) (msg+1); // Made extra room after the struct with itti_alloc_msg_sized()
memcpy(msg->rrc_container, sduP, sdu_lenP);
msg->rrc_container_length=sdu_lenP;
itti_send_msg_to_task(TASK_DU_F1, 0, tmp);
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_idP]);
ue_context_p->ue_id_rnti = rntiP;
ue_context_p->ue_context.rnti = rntiP;
ue_context_p->ue_context.random_ue_identity = rntiP;
ue_context_p->ue_context.Srb0.Active = 1;
RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_idP]->rrc_ue_head, ue_context_p);
return(0);
}
@@ -383,3 +389,17 @@ void nr_mac_gNB_rrc_ul_failure(const module_id_t Mod_instP,
LOG_D(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP);
}
}
void nr_mac_gNB_rrc_ul_failure_reset(const module_id_t Mod_instP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP) {
struct rrc_gNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[Mod_instP], rntiP);
if (ue_context_p != NULL) {
LOG_W(RRC,"Frame %d, Subframe %d: UE %x UL failure reset, deactivating timer\n",frameP,subframeP,rntiP);
ue_context_p->ue_context.ul_failure_timer=0;
} else {
LOG_W(RRC,"Frame %d, Subframe %d: UL failure reset: UE %x unknown \n",frameP,subframeP,rntiP);
}
}
+220 -139
View File
@@ -39,6 +39,7 @@
#include <asn_application.h>
#include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */
#include <per_encoder.h>
#include <nr/nr_common.h>
#include "asn1_msg.h"
#include "../nr_rrc_proto.h"
@@ -297,15 +298,6 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
) {
asn_enc_rval_t enc_rval;
// TODO : Add support for more than one PLMN
int num_plmn = 1; // int num_plmn = configuration->num_plmn;
struct NR_PLMN_Identity *nr_plmn = CALLOC(1, sizeof(struct NR_PLMN_Identity) * num_plmn);
NR_MCC_MNC_Digit_t (*nr_mcc_digit)[3] = (NR_MCC_MNC_Digit_t(*)[3])CALLOC(1, sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);
NR_MCC_MNC_Digit_t (*nr_mnc_digit)[3] = (NR_MCC_MNC_Digit_t(*)[3])CALLOC(1, sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);;
memset(nr_plmn,0,sizeof(struct NR_PLMN_Identity) * num_plmn);
memset(nr_mcc_digit,0,sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);
memset(nr_mnc_digit,0,sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);
NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t));
carrier->siblock1 = sib1_message;
sib1_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1;
@@ -317,51 +309,52 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
// cellSelectionInfo
sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo));
// Fixme: should be in config file
//The IE Q-RxLevMin is used to indicate for cell selection/ re-selection the required minimum received RSRP level in the (NR) cell.
//Corresponds to parameter Qrxlevmin in TS38.304.
//Actual value Qrxlevmin = field value * 2 [dBm].
sib1->cellSelectionInfo->q_RxLevMin = -65;
// cellAccessRelatedInfo
struct NR_PLMN_IdentityInfo *nr_plmn_info=CALLOC(1,sizeof(struct NR_PLMN_IdentityInfo));
asn_set_empty(&nr_plmn_info->plmn_IdentityList.list);
// TODO : Add support for more than one PLMN
int num_plmn = 1; // int num_plmn = configuration->num_plmn;
asn1cSequenceAdd(sib1->cellAccessRelatedInfo.plmn_IdentityList.list, struct NR_PLMN_IdentityInfo, nr_plmn_info);
for (int i = 0; i < num_plmn; ++i) {
nr_mcc_digit[i][0] = (configuration->mcc[i]/100)%10;
nr_mcc_digit[i][1] = (configuration->mcc[i]/10)%10;
nr_mcc_digit[i][2] = (configuration->mcc[i])%10;
nr_plmn[i].mcc = CALLOC(1,sizeof(struct NR_MCC));
asn_set_empty(&nr_plmn[i].mcc->list);
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][0]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][1]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][2]);
if(configuration->mnc_digit_length[i] == 3) nr_mnc_digit[i][0] = (configuration->mnc[i]/100)%10;
nr_mnc_digit[i][1] = (configuration->mnc[i]/10)%10;
nr_mnc_digit[i][2] = (configuration->mnc[i])%10;
nr_plmn[i].mnc.list.size=0;
nr_plmn[i].mnc.list.count=0;
if(configuration->mnc_digit_length[i] == 3) ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][0]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][1]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][2]);
ASN_SEQUENCE_ADD(&nr_plmn_info->plmn_IdentityList.list, &nr_plmn[i]);
asn1cSequenceAdd(nr_plmn_info->plmn_IdentityList.list, struct NR_PLMN_Identity, nr_plmn);
asn1cCalloc(nr_plmn->mcc, mcc);
int confMcc=configuration->mcc[i];
asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc0);
*mcc0=(confMcc/100)%10;
asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc1);
*mcc1=(confMcc/10)%10;
asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc2);
*mcc2=confMcc%10;
int mnc=configuration->mnc[i];
if(configuration->mnc_digit_length[i] == 3) {
asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc0);
*mnc0=(configuration->mnc[i]/100)%10;
mnc/=10;
}
asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc1);
*mnc1=(mnc/10)%10;
asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc2);
*mnc2=(mnc)%10;
}//end plmn loop
nr_plmn_info->cellIdentity.buf = CALLOC(1,5);
nr_plmn_info->cellIdentity.buf[0]= (configuration->cell_identity >> 28) & 0xff;
nr_plmn_info->cellIdentity.buf[1]= (configuration->cell_identity >> 20) & 0xff;
nr_plmn_info->cellIdentity.buf[2]= (configuration->cell_identity >> 12) & 0xff;
nr_plmn_info->cellIdentity.buf[3]= (configuration->cell_identity >> 4) & 0xff;
nr_plmn_info->cellIdentity.buf[4]= (configuration->cell_identity << 4) & 0xff;
nr_plmn_info->cellIdentity.size= 5;
nr_plmn_info->cellIdentity.bits_unused= 4;
uint64_t tmp=htobe64(configuration->cell_identity)<<4;
memcpy(nr_plmn_info->cellIdentity.buf, ((char*)&tmp)+3, 5);
nr_plmn_info->cellReservedForOperatorUse = NR_PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
nr_plmn_info->trackingAreaCode = CALLOC(1,sizeof(NR_TrackingAreaCode_t));
uint32_t tmp2=htobe32(configuration->tac);
nr_plmn_info->trackingAreaCode->buf = CALLOC(1,3);
nr_plmn_info->trackingAreaCode->buf[0] = ( ((uint32_t)configuration->tac) >> 16) & 0xff;
nr_plmn_info->trackingAreaCode->buf[1] = ( ((uint32_t)configuration->tac) >> 8) & 0xff;
nr_plmn_info->trackingAreaCode->buf[2] = ( ((uint32_t)configuration->tac) >> 0) & 0xff;
memcpy(nr_plmn_info->trackingAreaCode->buf, ((char*) &tmp2)+1, 3);
nr_plmn_info->trackingAreaCode->size = 3;
nr_plmn_info->trackingAreaCode->bits_unused = 0;
ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, nr_plmn_info);
// connEstFailureControl
// TODO: add connEstFailureControl
@@ -397,19 +390,19 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo);*/
// servingCellConfigCommon
sib1->servingCellConfigCommon = CALLOC(1,sizeof(struct NR_ServingCellConfigCommonSIB));
asn1cCalloc(sib1->servingCellConfigCommon, ServCellCom);
NR_BWP_DownlinkCommon_t *initialDownlinkBWP=&ServCellCom->downlinkConfigCommon.initialDownlinkBWP;
initialDownlinkBWP->genericParameters=
configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list);
asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list);
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth;
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.subcarrierSpacing = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing;
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.cyclicPrefix = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix;
for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count; i++) {
struct NR_NR_MultiBandInfo *nrMultiBandInfo = CALLOC(1,sizeof(struct NR_NR_MultiBandInfo));
asn1cSequenceAdd(ServCellCom->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list,
struct NR_NR_MultiBandInfo, nrMultiBandInfo);
nrMultiBandInfo->freqBandIndicatorNR = configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i];
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list,nrMultiBandInfo);
}
int scs_scaling0 = 1<<(configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing);
int scs_scaling = scs_scaling0;
int scs_scaling2 = scs_scaling0;
@@ -432,17 +425,19 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
absolute_diff,scs_scaling2,scs_scaling,(int)sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA);
for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.count; i++) {
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list,configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]);
ASN_SEQUENCE_ADD(&ServCellCom->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list,
configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]);
}
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon;
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList));
asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list);
initialDownlinkBWP->pdcch_ConfigCommon =
configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon;
initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList =
CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList));
NR_SearchSpace_t *ss1 = calloc(1,sizeof(*ss1));
asn1cSequenceAdd(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,
NR_SearchSpace_t, ss1);
ss1->searchSpaceId = 1;
ss1->controlResourceSetId=calloc(1,sizeof(*ss1->controlResourceSetId));
*ss1->controlResourceSetId=0;
asn1cCallocOne(ss1->controlResourceSetId, 0);
ss1->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss1->monitoringSlotPeriodicityAndOffset));
ss1->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
ss1->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss1->monitoringSymbolsWithinSlot));
@@ -462,9 +457,9 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
ss1->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
ss1->searchSpaceType->choice.common=calloc(1,sizeof(*ss1->searchSpaceType->choice.common));
ss1->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss1->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss1);
NR_SearchSpace_t *ss5 = calloc(1,sizeof(*ss5));
asn1cSequenceAdd(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,
NR_SearchSpace_t, ss5);
ss5->searchSpaceId = 5;
ss5->controlResourceSetId=calloc(1,sizeof(*ss5->controlResourceSetId));
*ss5->controlResourceSetId=0;
@@ -490,9 +485,9 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
ss5->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
ss5->searchSpaceType->choice.common=calloc(1,sizeof(*ss5->searchSpaceType->choice.common));
ss5->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss5->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss5);
NR_SearchSpace_t *ss7 = calloc(1,sizeof(*ss7));
asn1cSequenceAdd(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,
NR_SearchSpace_t, ss7);
ss7->searchSpaceId = 7;
ss7->controlResourceSetId=calloc(1,sizeof(*ss7->controlResourceSetId));
*ss7->controlResourceSetId=0;
@@ -515,63 +510,59 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
ss7->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
ss7->searchSpaceType->choice.common=calloc(1,sizeof(*ss7->searchSpaceType->choice.common));
ss7->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss7->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss7);
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = calloc(1,sizeof(NR_SearchSpaceId_t));
*sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = 0;
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation = calloc(1,sizeof(NR_SearchSpaceId_t));
*sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation = 7;
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->pagingSearchSpace = calloc(1,sizeof(NR_SearchSpaceId_t));
*sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->pagingSearchSpace = 5;
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->ra_SearchSpace = calloc(1,sizeof(NR_SearchSpaceId_t));
*sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->ra_SearchSpace = 1;
asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1, 0);
asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation, 7);
asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->pagingSearchSpace, 5);
asn1cCallocOne( initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace, 1);
initialDownlinkBWP->pdsch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon;
ServCellCom->downlinkConfigCommon.bcch_Config.modificationPeriodCoeff = NR_BCCH_Config__modificationPeriodCoeff_n2;
ServCellCom->downlinkConfigCommon.pcch_Config.defaultPagingCycle = NR_PagingCycle_rf256;
ServCellCom->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.present = NR_PCCH_Config__nAndPagingFrameOffset_PR_quarterT;
ServCellCom->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.choice.quarterT = 1;
ServCellCom->downlinkConfigCommon.pcch_Config.ns = NR_PCCH_Config__ns_one;
sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon;
sib1->servingCellConfigCommon->downlinkConfigCommon.bcch_Config.modificationPeriodCoeff = NR_BCCH_Config__modificationPeriodCoeff_n2;
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.defaultPagingCycle = NR_PagingCycle_rf256;
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.present = NR_PCCH_Config__nAndPagingFrameOffset_PR_quarterT;
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.choice.quarterT = 1;
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.ns = NR_PCCH_Config__ns_one;
asn1cCalloc(ServCellCom->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO,
P0);
P0->present = NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT;
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO = calloc(1,sizeof(struct NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO));
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO->present = NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT;
asn1cCalloc(P0->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT,
Z8);
asn1cSequenceAdd(Z8->list,
long,
ZoneEight);
asn1cCallocOne(ZoneEight, 0);
sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT = CALLOC(1,sizeof(struct NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT));
asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT->list);
long *sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT = calloc(1,sizeof(long));
*sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT = 0;
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT->list,sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT);
sib1->servingCellConfigCommon->uplinkConfigCommon = CALLOC(1,sizeof(struct NR_UplinkConfigCommonSIB));
asn_set_empty(&sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list);
asn1cCalloc(ServCellCom->uplinkConfigCommon, UL)
asn_set_empty(&UL->frequencyInfoUL.scs_SpecificCarrierList.list);
for(int i = 0; i< configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.count; i++) {
ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list,configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]);
ASN_SEQUENCE_ADD(&UL->frequencyInfoUL.scs_SpecificCarrierList.list,
configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]);
}
sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.p_Max = CALLOC(1,sizeof(NR_P_Max_t));
*sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.p_Max = 23;
asn1cCallocOne(UL->frequencyInfoUL.p_Max, 23);
sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters = configuration->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon;
UL->initialUplinkBWP.genericParameters = configuration->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
UL->initialUplinkBWP.rach_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon;
UL->initialUplinkBWP.pusch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon;
UL->initialUplinkBWP.pusch_ConfigCommon->choice.setup->groupHoppingEnabledTransformPrecoding = null;
sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon;
sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->groupHoppingEnabledTransformPrecoding = null;
UL->initialUplinkBWP.pucch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon;
sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon;
UL->timeAlignmentTimerCommon = NR_TimeAlignmentTimer_infinity;
sib1->servingCellConfigCommon->uplinkConfigCommon->timeAlignmentTimerCommon = NR_TimeAlignmentTimer_infinity;
ServCellCom->n_TimingAdvanceOffset = configuration->scc->n_TimingAdvanceOffset;
sib1->servingCellConfigCommon->n_TimingAdvanceOffset = configuration->scc->n_TimingAdvanceOffset;
sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.buf = calloc(1, sizeof(uint8_t));
ServCellCom->ssb_PositionsInBurst.inOneGroup.buf = calloc(1, sizeof(uint8_t));
uint8_t bitmap8,temp_bitmap=0;
switch (configuration->scc->ssb_PositionsInBurst->present) {
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap:
sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.shortBitmap;
ServCellCom->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.shortBitmap;
break;
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap:
sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.mediumBitmap;
ServCellCom->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.mediumBitmap;
break;
/*
groupPresence: This field is present when maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1.
@@ -582,14 +573,13 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
(i.e., to SSB index 1, 9, and so on), and so on. Value 0 in the bitmap indicates that the corresponding SS/PBCH block is not transmitted while value 1 indicates that the corresponding SS/PBCH block is transmitted.
*/
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_longBitmap:
sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.size = 1;
sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.bits_unused = 0;
sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence = calloc(1, sizeof(BIT_STRING_t));
memset(sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence, 0, sizeof(BIT_STRING_t));
sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->size = 1;
sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->bits_unused = 0;
sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->buf = calloc(1, sizeof(uint8_t));
sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->buf[0] = 0;
ServCellCom->ssb_PositionsInBurst.inOneGroup.size = 1;
ServCellCom->ssb_PositionsInBurst.inOneGroup.bits_unused = 0;
ServCellCom->ssb_PositionsInBurst.groupPresence = calloc(1, sizeof(BIT_STRING_t));
ServCellCom->ssb_PositionsInBurst.groupPresence->size = 1;
ServCellCom->ssb_PositionsInBurst.groupPresence->bits_unused = 0;
ServCellCom->ssb_PositionsInBurst.groupPresence->buf = calloc(1, sizeof(uint8_t));
ServCellCom->ssb_PositionsInBurst.groupPresence->buf[0] = 0;
for (int i=0; i<8; i++){
bitmap8 = configuration->scc->ssb_PositionsInBurst->choice.longBitmap.buf[i];
if (bitmap8!=0){
@@ -598,8 +588,8 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
else
AssertFatal(temp_bitmap==bitmap8,"For longBitmap the groups of 8 SSBs containing at least 1 transmitted SSB should be all the same\n");
sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.buf[0] = bitmap8;
sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->buf[0] |= 1<<(7-i);
ServCellCom->ssb_PositionsInBurst.inOneGroup.buf[0] = bitmap8;
ServCellCom->ssb_PositionsInBurst.groupPresence->buf[0] |= 1<<(7-i);
}
}
break;
@@ -608,12 +598,12 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
break;
}
sib1->servingCellConfigCommon->ssb_PeriodicityServingCell = *configuration->scc->ssb_periodicityServingCell;
sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon = CALLOC(1,sizeof(struct NR_TDD_UL_DL_ConfigCommon));
sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing = configuration->scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing;
sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->pattern1 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern1;
sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->pattern2 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern2;
sib1->servingCellConfigCommon->ss_PBCH_BlockPower = configuration->scc->ss_PBCH_BlockPower;
ServCellCom->ssb_PeriodicityServingCell = *configuration->scc->ssb_periodicityServingCell;
ServCellCom->tdd_UL_DL_ConfigurationCommon = CALLOC(1,sizeof(struct NR_TDD_UL_DL_ConfigCommon));
ServCellCom->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing = configuration->scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing;
ServCellCom->tdd_UL_DL_ConfigurationCommon->pattern1 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern1;
ServCellCom->tdd_UL_DL_ConfigurationCommon->pattern2 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern2;
ServCellCom->ss_PBCH_BlockPower = configuration->scc->ss_PBCH_BlockPower;
// ims-EmergencySupport
// TODO: add ims-EmergencySupport
@@ -987,10 +977,42 @@ uint8_t do_RRCReject(uint8_t Mod_id,
return((enc_rval.encoded+7)/8);
}
// TODO: Implement to b_SRS = 1 and b_SRS = 2
long rrc_get_max_nr_csrs(uint8_t max_rbs, long b_SRS) {
if(b_SRS>0) {
LOG_E(NR_RRC,"rrc_get_max_nr_csrs(): Not implemented yet for b_SRS>0\n");
return 0; // This c_srs is always valid
}
const uint16_t m_SRS[64] = { 4, 8, 12, 16, 16, 20, 24, 24, 28, 32, 36, 40, 48, 48, 52, 56, 60, 64, 72, 72, 76, 80, 88,
96, 96, 104, 112, 120, 120, 120, 128, 128, 128, 132, 136, 144, 144, 144, 144, 152, 160,
160, 160, 168, 176, 184, 192, 192, 192, 192, 208, 216, 224, 240, 240, 240, 240, 256, 256,
256, 264, 272, 272, 272 };
long c_srs = 0;
uint16_t m = 4;
for(int c = 1; c<64; c++) {
if(m_SRS[c]>m && m_SRS[c]<max_rbs) {
c_srs = c;
m = m_SRS[c];
}
}
return c_srs;
}
void fill_initial_SpCellConfig(rnti_t rnti,
int uid,
NR_SpCellConfig_t *SpCellConfig,
NR_ServingCellConfigCommon_t *scc,
rrc_gNB_carrier_data_t *carrier) {
// This assert will never happen in the current implementation because NUMBER_OF_UE_MAX = 4.
// However, if in the future NUMBER_OF_UE_MAX is increased, it will be necessary to improve the allocation of SRS resources,
// where the startPosition = 2 or 3 and sl160 = 17, 17, 27 ... 157 only give us 30 different allocations.
AssertFatal(uid>=0 && uid<30, "gNB cannot allocate the SRS resources\n");
int curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,MAX_BWP_SIZE);
SpCellConfig->servCellIndex = NULL;
SpCellConfig->reconfigurationWithSync = NULL;
@@ -1069,7 +1091,7 @@ void fill_initial_SpCellConfig(rnti_t rnti,
pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList = calloc(1,sizeof(*pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList));
NR_PUSCH_PathlossReferenceRS_t *plrefRS = calloc(1,sizeof(*plrefRS));
plrefRS->pusch_PathlossReferenceRS_Id=0;
plrefRS->referenceSignal.present = NR_PathlossReferenceRS_Config_PR_ssb_Index;
plrefRS->referenceSignal.present = NR_PUSCH_PathlossReferenceRS__referenceSignal_PR_ssb_Index;
plrefRS->referenceSignal.choice.ssb_Index = 0;
ASN_SEQUENCE_ADD(&pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList->list,plrefRS);
pusch_Config->pusch_PowerControl->pathlossReferenceRSToReleaseList = NULL;
@@ -1116,13 +1138,21 @@ void fill_initial_SpCellConfig(rnti_t rnti,
*srs_resset0_id=0;
ASN_SEQUENCE_ADD(&srs_resset0->srs_ResourceIdList->list,srs_resset0_id);
srs_Config->srs_ResourceToReleaseList=NULL;
srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_aperiodic;
srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic));
srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1;
srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL;
srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset));
*srs_resset0->resourceType.choice.aperiodic->slotOffset=2;
srs_resset0->resourceType.choice.aperiodic->ext1=NULL;
if(carrier->do_SRS) {
srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_periodic;
srs_resset0->resourceType.choice.periodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.periodic));
srs_resset0->resourceType.choice.periodic->associatedCSI_RS = NULL;
} else {
srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_aperiodic;
srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic));
srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1;
srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL;
srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset));
*srs_resset0->resourceType.choice.aperiodic->slotOffset=2;
srs_resset0->resourceType.choice.aperiodic->ext1=NULL;
}
srs_resset0->usage=NR_SRS_ResourceSet__usage_codebook;
srs_resset0->alpha = calloc(1,sizeof(*srs_resset0->alpha));
*srs_resset0->alpha = NR_Alpha_alpha1;
@@ -1141,17 +1171,28 @@ void fill_initial_SpCellConfig(rnti_t rnti,
srs_res0->transmissionComb.choice.n2=calloc(1,sizeof(*srs_res0->transmissionComb.choice.n2));
srs_res0->transmissionComb.choice.n2->combOffset_n2=0;
srs_res0->transmissionComb.choice.n2->cyclicShift_n2=0;
srs_res0->resourceMapping.startPosition=2;
srs_res0->resourceMapping.startPosition = 2 + uid%2;
srs_res0->resourceMapping.nrofSymbols=NR_SRS_Resource__resourceMapping__nrofSymbols_n1;
srs_res0->resourceMapping.repetitionFactor=NR_SRS_Resource__resourceMapping__repetitionFactor_n1;
srs_res0->freqDomainPosition=0;
srs_res0->freqDomainShift=0;
srs_res0->freqHopping.c_SRS = 0;
srs_res0->freqHopping.b_SRS=0;
srs_res0->freqHopping.b_hop=0;
srs_res0->freqHopping.c_SRS = rrc_get_max_nr_csrs(
NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, 275),
srs_res0->freqHopping.b_SRS);
srs_res0->groupOrSequenceHopping=NR_SRS_Resource__groupOrSequenceHopping_neither;
srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic;
srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic));
if(carrier->do_SRS) {
srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_periodic;
srs_res0->resourceType.choice.periodic=calloc(1,sizeof(*srs_res0->resourceType.choice.periodic));
srs_res0->resourceType.choice.periodic->periodicityAndOffset_p.present = NR_SRS_PeriodicityAndOffset_PR_sl160;
srs_res0->resourceType.choice.periodic->periodicityAndOffset_p.choice.sl160 = 17 + (uid>1)*10; // 17/17/.../147/157 are mixed slots
} else {
srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic;
srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic));
}
srs_res0->sequenceId=40;
srs_res0->spatialRelationInfo=calloc(1,sizeof(*srs_res0->spatialRelationInfo));
srs_res0->spatialRelationInfo->servingCellId=NULL;
@@ -1185,9 +1226,9 @@ void fill_initial_SpCellConfig(rnti_t rnti,
long *delay[8];
for (int i=0;i<8;i++) {
delay[i] = calloc(1,sizeof(*delay[i]));
AssertFatal(carrier->minRXTXTIMEpdsch >=2 && carrier->minRXTXTIMEpdsch <7,
"check minRXTXTIMEpdsch %d\n",carrier->minRXTXTIMEpdsch);
*delay[i] = (i+carrier->minRXTXTIMEpdsch);
AssertFatal(carrier->minRXTXTIME >=2 && carrier->minRXTXTIME <7,
"check minRXTXTIME %d\n",carrier->minRXTXTIME);
*delay[i] = (i+carrier->minRXTXTIME);
ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]);
}
@@ -1401,6 +1442,7 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr
}
void fill_initial_cellGroupConfig(rnti_t rnti,
int uid,
NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc,
rrc_gNB_carrier_data_t *carrier) {
@@ -1494,7 +1536,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti,
cellGroupConfig->spCellConfig = calloc(1,sizeof(*cellGroupConfig->spCellConfig));
fill_initial_SpCellConfig(rnti,cellGroupConfig->spCellConfig,scc,carrier);
fill_initial_SpCellConfig(rnti,uid,cellGroupConfig->spCellConfig,scc,carrier);
cellGroupConfig->sCellToAddModList = NULL;
cellGroupConfig->sCellToReleaseList = NULL;
@@ -1573,7 +1615,7 @@ uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
}
else {
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
fill_initial_cellGroupConfig(ue_context_pP->ue_context.rnti,cellGroupConfig,scc,carrier);
fill_initial_cellGroupConfig(ue_context_pP->ue_context.rnti,ue_context_pP->local_uid,cellGroupConfig,scc,carrier);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
@@ -1771,6 +1813,7 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
uint8_t do_NR_RRCRelease(uint8_t *buffer,
size_t buffer_size,
uint8_t Transaction_id) {
asn_enc_rval_t enc_rval;
NR_DL_DCCH_Message_t dl_dcch_msg;
@@ -1796,7 +1839,7 @@ uint8_t do_NR_RRCRelease(uint8_t *buffer,
NULL,
(void *)&dl_dcch_msg,
buffer,
RRC_BUF_SIZE);
buffer_size);
if(enc_rval.encoded == -1) {
LOG_I(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
@@ -1809,6 +1852,7 @@ uint8_t do_NR_RRCRelease(uint8_t *buffer,
int16_t do_RRCReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
uint8_t Transaction_id,
NR_SRB_ToAddModList_t *SRB_configList,
NR_DRB_ToAddModList_t *DRB_configList,
@@ -1904,7 +1948,7 @@ int16_t do_RRCReconfiguration(
NULL,
(void *)&dl_dcch_msg,
buffer,
1000);
buffer_size);
if(enc_rval.encoded == -1) {
LOG_I(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
@@ -1929,7 +1973,7 @@ int16_t do_RRCReconfiguration(
}
uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, uint8_t *rv) {
asn_enc_rval_t enc_rval;
uint8_t buf[5],buf2=0;
NR_UL_CCCH_Message_t ul_ccch_msg;
@@ -1973,16 +2017,51 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
NULL,
(void *)&ul_ccch_msg,
buffer,
100);
buffer_size);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded);
LOG_D(NR_RRC,"[UE] RRCSetupRequest Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
}
//------------------------------------------------------------------------------
uint8_t
do_NR_RRCReconfigurationComplete_for_nsa(
uint8_t *buffer,
size_t buffer_size,
NR_RRC_TransactionIdentifier_t Transaction_id
)
//------------------------------------------------------------------------------
{
NR_RRCReconfigurationComplete_t rrc_complete_msg;
memset(&rrc_complete_msg, 0, sizeof(rrc_complete_msg));
rrc_complete_msg.rrc_TransactionIdentifier = Transaction_id;
rrc_complete_msg.criticalExtensions.choice.rrcReconfigurationComplete =
CALLOC(1, sizeof(*rrc_complete_msg.criticalExtensions.choice.rrcReconfigurationComplete));
rrc_complete_msg.criticalExtensions.present =
NR_RRCReconfigurationComplete__criticalExtensions_PR_rrcReconfigurationComplete;
rrc_complete_msg.criticalExtensions.choice.rrcReconfigurationComplete->nonCriticalExtension = NULL;
rrc_complete_msg.criticalExtensions.choice.rrcReconfigurationComplete->lateNonCriticalExtension = NULL;
if (0) {
xer_fprint(stdout, &asn_DEF_NR_RRCReconfigurationComplete, (void *)&rrc_complete_msg);
}
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RRCReconfigurationComplete,
NULL,
(void *)&rrc_complete_msg,
buffer,
buffer_size);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
LOG_A(NR_RRC, "rrcReconfigurationComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
}
//------------------------------------------------------------------------------
uint8_t
do_NR_RRCReconfigurationComplete(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
const uint8_t Transaction_id
)
//------------------------------------------------------------------------------
@@ -2010,14 +2089,15 @@ do_NR_RRCReconfigurationComplete(
NULL,
(void *)&ul_dcch_msg,
buffer,
100);
buffer_size);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
LOG_I(NR_RRC,"rrcReconfigurationComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
}
uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Transaction_id, uint8_t sel_plmn_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS){
uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size,
const uint8_t Transaction_id, uint8_t sel_plmn_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS){
asn_enc_rval_t enc_rval;
NR_UL_DCCH_Message_t ul_dcch_msg;
@@ -2060,7 +2140,7 @@ enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message,
NULL,
(void *)&ul_dcch_msg,
buffer,
100);
buffer_size);
AssertFatal(enc_rval.encoded > 0,"ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name,enc_rval.encoded);
LOG_D(NR_RRC,"RRCSetupComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
@@ -2175,6 +2255,7 @@ const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP,
int CC_id,
uint8_t *const buffer,
size_t buffer_size,
//const uint8_t transmission_mode,
const uint8_t Transaction_id,
NR_SRB_ToAddModList_t **SRB_configList
@@ -2297,7 +2378,7 @@ NR_SRB_ToAddModList_t **SRB_configList
}
uint8_t
do_RRCReestablishmentComplete(uint8_t *buffer, int64_t rrc_TransactionIdentifier) {
do_RRCReestablishmentComplete(uint8_t *buffer, size_t buffer_size, int64_t rrc_TransactionIdentifier) {
asn_enc_rval_t enc_rval;
NR_UL_DCCH_Message_t ul_dcch_msg;
NR_RRCReestablishmentComplete_t *rrcReestablishmentComplete;
@@ -2323,7 +2404,7 @@ do_RRCReestablishmentComplete(uint8_t *buffer, int64_t rrc_TransactionIdentifier
NULL,
(void *)&ul_dcch_msg,
buffer,
100);
buffer_size);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded);
LOG_D(NR_RRC,"[UE] RRCReestablishmentComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
+32 -13
View File
@@ -28,6 +28,8 @@
* \email: raymond.knopp@eurecom.fr and navid.nikaein@eurecom.fr, kroempa@gmail.com
*/
#pragma once
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h> /* for atoi(3) */
@@ -53,6 +55,15 @@
*/
int xer_sprint_NR(char *string, size_t string_size, struct asn_TYPE_descriptor_s *td, void *sptr);
#define asn1cCallocOne(VaR, VaLue) \
VaR = calloc(1,sizeof(*VaR)); *VaR=VaLue;
#define asn1cCalloc(VaR, lOcPtr) \
typeof(VaR) lOcPtr = VaR = calloc(1,sizeof(*VaR));
#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) \
TyPe *lOcPtr= calloc(1,sizeof(TyPe)); \
ASN_SEQUENCE_ADD(&VaR,lOcPtr);
uint8_t do_MIB_NR(gNB_RRC_INST *rrc,
uint32_t frame);
@@ -90,13 +101,15 @@ uint8_t do_RRCReject(uint8_t Mod_id,
uint8_t *const buffer);
void fill_initial_SpCellConfig(rnti_t rnti,
NR_SpCellConfig_t *SpCellConfig,
NR_ServingCellConfigCommon_t *scc,
int uid,
NR_SpCellConfig_t *SpCellConfig,
NR_ServingCellConfigCommon_t *scc,
rrc_gNB_carrier_data_t *carrier);
void fill_initial_cellGroupConfig(rnti_t rnti,
NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc,
int uid,
NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc,
rrc_gNB_carrier_data_t *carrier);
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup,int use_rlc_um_for_drb);
@@ -119,12 +132,13 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer,
const uint8_t Transaction_id);
uint8_t do_NR_RRCRelease(uint8_t *buffer,
uint8_t do_NR_RRCRelease(uint8_t *buffer, size_t buffer_size,
uint8_t Transaction_id);
int16_t do_RRCReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
uint8_t Transaction_id,
NR_SRB_ToAddModList_t *SRB_configList,
NR_DRB_ToAddModList_t *DRB_configList,
@@ -135,19 +149,23 @@ int16_t do_RRCReconfiguration(
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList,
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig,
NR_CellGroupConfig_t *cellGroupConfig);
uint8_t do_RRCSetupComplete(uint8_t Mod_id,
uint8_t *buffer,
const uint8_t Transaction_id,
uint8_t sel_plmn_id,
const int dedicatedInfoNASLength,
uint8_t do_RRCSetupComplete(uint8_t Mod_id,
uint8_t *buffer,
size_t buffer_size,
const uint8_t Transaction_id,
uint8_t sel_plmn_id,
const int dedicatedInfoNASLength,
const char *dedicatedInfoNAS);
uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv);
uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, uint8_t *rv);
uint8_t do_NR_RRCReconfigurationComplete_for_nsa(uint8_t *buffer, size_t buffer_size, NR_RRC_TransactionIdentifier_t Transaction_id);
uint8_t do_NR_RRCReconfigurationComplete(
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
size_t buffer_size,
const uint8_t Transaction_id
);
@@ -172,6 +190,7 @@ do_RRCReestablishment(
rrc_gNB_ue_context_t *const ue_context_pP,
int CC_id,
uint8_t *const buffer,
size_t buffer_size,
//const uint8_t transmission_mode,
const uint8_t Transaction_id,
NR_SRB_ToAddModList_t **SRB_configList
@@ -179,6 +198,6 @@ do_RRCReestablishment(
uint8_t
do_RRCReestablishmentComplete(
uint8_t *buffer,
uint8_t *buffer, size_t buffer_size,
int64_t rrc_TransactionIdentifier);
+71 -88
View File
@@ -29,96 +29,79 @@
*/
#include "nr_rrc_config.h"
#include "common/utils/nr/nr_common.h"
void rrc_config_rlc_bearer(uint8_t Mod_id,
int CC_id,
rlc_bearer_config_t *rlc_config
){
rlc_config->LogicalChannelIdentity[CC_id] = 0;
rlc_config->servedRadioBearer_present[CC_id] = 0;
rlc_config->srb_Identity[CC_id] = 0;
rlc_config->drb_Identity[CC_id] = 0;
rlc_config->reestablishRLC[CC_id] = 0;
rlc_config->rlc_Config_present[CC_id] = 0;
rlc_config->ul_AM_sn_FieldLength[CC_id] = 0;
rlc_config->t_PollRetransmit[CC_id] = 0;
rlc_config->pollPDU[CC_id] = 0;
rlc_config->pollByte[CC_id] = 0;
rlc_config->maxRetxThreshold[CC_id] = 0;
rlc_config->dl_AM_sn_FieldLength[CC_id] = 0;
rlc_config->dl_AM_t_Reassembly[CC_id] = 0;
rlc_config->t_StatusProhibit[CC_id] = 0;
rlc_config->ul_UM_sn_FieldLength[CC_id] = 0;
rlc_config->dl_UM_sn_FieldLength[CC_id] = 0;
rlc_config->dl_UM_t_Reassembly[CC_id] = 0;
rlc_config->priority[CC_id] = 0;
rlc_config->prioritisedBitRate[CC_id] = 0;
rlc_config->bucketSizeDuration[CC_id] = 0;
rlc_config->allowedServingCells[CC_id] = 0;
rlc_config->subcarrierspacing[CC_id] = 0;
rlc_config->maxPUSCH_Duration[CC_id] = 0;
rlc_config->configuredGrantType1Allowed[CC_id] = 0;
rlc_config->logicalChannelGroup[CC_id] = 0;
rlc_config->schedulingRequestID[CC_id] = 0;
rlc_config->logicalChannelSR_Mask[CC_id] = 0;
rlc_config->logicalChannelSR_DelayTimerApplied[CC_id] = 0;
void nr_rrc_config_dl_tda(NR_ServingCellConfigCommon_t *scc){
lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
// setting default TDA for DL with
struct NR_PDSCH_TimeDomainResourceAllocation *timedomainresourceallocation = CALLOC(1,sizeof(NR_PDSCH_TimeDomainResourceAllocation_t));
timedomainresourceallocation->mappingType = NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
timedomainresourceallocation->startSymbolAndLength = get_SLIV(1,13); // basic slot configuration starting in symbol 1 til the end of the slot
ASN_SEQUENCE_ADD(&scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,
timedomainresourceallocation);
if(frame_type==TDD) {
// TDD
if(scc->tdd_UL_DL_ConfigurationCommon) {
int dl_symb = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols;
if(dl_symb > 1) {
timedomainresourceallocation = CALLOC(1,sizeof(NR_PDSCH_TimeDomainResourceAllocation_t));
timedomainresourceallocation->mappingType = NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
timedomainresourceallocation->startSymbolAndLength = get_SLIV(1,dl_symb-1); // mixed slot configuration starting in symbol 1 til the end of the dl allocation
ASN_SEQUENCE_ADD(&scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,
timedomainresourceallocation);
}
}
}
}
void rrc_config_mac_cellgroup(uint8_t Mod_id,
int CC_id,
mac_cellgroup_t *mac_cellgroup_config
){
mac_cellgroup_config->DRX_Config_PR[CC_id] = 0;
mac_cellgroup_config->drx_onDurationTimer_PR[CC_id] = 0;
mac_cellgroup_config->subMilliSeconds[CC_id] = 0;
mac_cellgroup_config->milliSeconds[CC_id] = 0;
mac_cellgroup_config->drx_InactivityTimer[CC_id] = 0;
mac_cellgroup_config->drx_HARQ_RTT_TimerDL[CC_id] = 0;
mac_cellgroup_config->drx_HARQ_RTT_TimerUL[CC_id] = 0;
mac_cellgroup_config->drx_RetransmissionTimerDL[CC_id] = 0;
mac_cellgroup_config->drx_RetransmissionTimerUL[CC_id] = 0;
mac_cellgroup_config->drx_LongCycleStartOffset_PR[CC_id] = 0;
mac_cellgroup_config->drx_LongCycleStartOffset[CC_id] = 0;
mac_cellgroup_config->drx_ShortCycle[CC_id] = 0;
mac_cellgroup_config->drx_ShortCycleTimer[CC_id] = 0;
mac_cellgroup_config->drx_SlotOffset[CC_id] = 0;
mac_cellgroup_config->schedulingRequestId[CC_id] = 0;
mac_cellgroup_config->sr_ProhibitTimer[CC_id] = 0;
mac_cellgroup_config->sr_TransMax[CC_id] = 0;
mac_cellgroup_config->periodicBSR_Timer[CC_id] = 0;
mac_cellgroup_config->retxBSR_Timer[CC_id] = 0;
mac_cellgroup_config->logicalChannelSR_DelayTimer[CC_id] = 0;
mac_cellgroup_config->tag_Id[CC_id] = 0;
mac_cellgroup_config->timeAlignmentTimer[CC_id] = 0;
mac_cellgroup_config->PHR_Config_PR[CC_id] = 0;
mac_cellgroup_config->phr_PeriodicTimer[CC_id] = 0;
mac_cellgroup_config->phr_ProhibitTimer[CC_id] = 0;
mac_cellgroup_config->phr_Tx_PowerFactorChange[CC_id] = 0;
mac_cellgroup_config->multiplePHR[CC_id] = 0;
mac_cellgroup_config->phr_Type2SpCell[CC_id] = 0;
mac_cellgroup_config->phr_Type2OtherCell[CC_id] = 0;
mac_cellgroup_config->phr_ModeOtherCG[CC_id] = 0;
mac_cellgroup_config->skipUplinkTxDynamic[CC_id] = 0;
void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay){
//TODO change to accomodate for SRS
int temp_min_delay = 6; // k2 = 2 or 3 won'r work as well as higher values
int k2 = (min_fb_delay<temp_min_delay)?temp_min_delay:min_fb_delay;
uint8_t DELTA[4]= {2,3,4,6}; // Delta parameter for Msg3
int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing;
lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
struct NR_PUSCH_TimeDomainResourceAllocation *pusch_timedomainresourceallocation = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation));
pusch_timedomainresourceallocation->k2 = CALLOC(1,sizeof(long));
*pusch_timedomainresourceallocation->k2 = k2;
pusch_timedomainresourceallocation->mappingType = NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
pusch_timedomainresourceallocation->startSymbolAndLength = get_SLIV(0,13); // basic slot configuration starting in symbol 0 til the last but one symbol
ASN_SEQUENCE_ADD(&scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list,pusch_timedomainresourceallocation);
if(frame_type==TDD) {
// TDD
if(scc->tdd_UL_DL_ConfigurationCommon) {
int ul_symb = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols;
pusch_timedomainresourceallocation = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation));
pusch_timedomainresourceallocation->k2 = CALLOC(1,sizeof(long));
*pusch_timedomainresourceallocation->k2 = k2;
pusch_timedomainresourceallocation->mappingType = NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
pusch_timedomainresourceallocation->startSymbolAndLength = get_SLIV(14-ul_symb,ul_symb-1); // starting in fist ul symbol til the last but one
ASN_SEQUENCE_ADD(&scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list,pusch_timedomainresourceallocation);
// for msg3 in the mixed slot
int nb_periods_per_frame = get_nb_periods_per_frame(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity);
int nb_slots_per_period = ((1<<mu) * 10)/nb_periods_per_frame;
struct NR_PUSCH_TimeDomainResourceAllocation *pusch_timedomainresourceallocation_msg3 = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation));
pusch_timedomainresourceallocation_msg3->k2 = CALLOC(1,sizeof(long));
*pusch_timedomainresourceallocation_msg3->k2 = nb_slots_per_period - DELTA[mu];
if(*pusch_timedomainresourceallocation_msg3->k2 < min_fb_delay)
*pusch_timedomainresourceallocation_msg3->k2 += nb_slots_per_period;
AssertFatal(*pusch_timedomainresourceallocation_msg3->k2<33,"Computed k2 for msg3 %ld is larger than the range allowed by RRC (0..32)\n",
*pusch_timedomainresourceallocation_msg3->k2);
pusch_timedomainresourceallocation_msg3->mappingType = NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
pusch_timedomainresourceallocation_msg3->startSymbolAndLength = get_SLIV(14-ul_symb,ul_symb-1); // starting in fist ul symbol til the last but one
ASN_SEQUENCE_ADD(&scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list,pusch_timedomainresourceallocation_msg3);
}
}
}
void rrc_config_physicalcellgroup(uint8_t Mod_id,
int CC_id,
physicalcellgroup_t *physicalcellgroup_config
){
physicalcellgroup_config->harq_ACK_SpatialBundlingPUCCH[CC_id] = 0;
physicalcellgroup_config->harq_ACK_SpatialBundlingPUSCH[CC_id] = 0;
physicalcellgroup_config->p_NR[CC_id] = 0;
physicalcellgroup_config->pdsch_HARQ_ACK_Codebook[CC_id] = 0;
physicalcellgroup_config->tpc_SRS_RNTI[CC_id] = 0;
physicalcellgroup_config->tpc_PUCCH_RNTI[CC_id] = 0;
physicalcellgroup_config->tpc_PUSCH_RNTI[CC_id] = 0;
physicalcellgroup_config->sp_CSI_RNTI[CC_id] = 0;
physicalcellgroup_config->RNTI_Value[CC_id] = 0;
}
void rrc_config_rachdedicated(uint8_t Mod_id,
int CC_id,
physicalcellgroup_t *physicalcellgroup_config
){
}
+2 -23
View File
@@ -111,29 +111,8 @@ typedef struct physicalcellgroup_s{
long RNTI_Value[MAX_NUM_CCs];
}physicalcellgroup_t;
typedef struct rach_dedicated_s{
}rach_dedicated_t;
void nr_rrc_config_dl_tda(NR_ServingCellConfigCommon_t *scc);
void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay);
void rrc_config_servingcellconfigcommon(uint8_t Mod_id,
int CC_id,
gNB_RrcConfigurationReq *common_configuration
);
void rrc_config_rlc_bearer(uint8_t Mod_id,
int CC_id,
rlc_bearer_config_t *rlc_config
);
void rrc_config_mac_cellgroup(uint8_t Mod_id,
int CC_id,
mac_cellgroup_t *mac_cellgroup_config
);
void rrc_config_physicalcellgroup(uint8_t Mod_id,
int CC_id,
physicalcellgroup_t *physicalcellgroup_config
);
#endif
+10 -5
View File
@@ -123,12 +123,12 @@ typedef enum UE_STATE_NR_e {
#define RRM_CALLOC(t,n) (t *) malloc16( sizeof(t) * n)
#define RRM_CALLOC2(t,s) (t *) malloc16( s )
#define MAX_MEAS_OBJ 6
#define MAX_MEAS_CONFIG 6
#define MAX_MEAS_ID 6
#define MAX_MEAS_OBJ 7
#define MAX_MEAS_CONFIG 7
#define MAX_MEAS_ID 7
#define PAYLOAD_SIZE_MAX 1024
#define RRC_BUF_SIZE 8192
#define RRC_BUF_SIZE 512
#define UNDEF_SECURITY_MODE 0xff
#define NO_SECURITY_MODE 0x20
@@ -367,6 +367,8 @@ typedef struct gNB_RRC_UE_s {
transport_layer_addr_t gnb_gtp_addrs[S1AP_MAX_E_RAB];
rb_id_t gnb_gtp_ebi[S1AP_MAX_E_RAB];
rb_id_t gnb_gtp_psi[S1AP_MAX_E_RAB];
//GTPV1 F1-U TUNNELS
uint32_t incoming_teid[S1AP_MAX_E_RAB];
uint32_t ul_failure_timer;
uint32_t ue_release_timer;
@@ -447,8 +449,9 @@ typedef struct {
int sib1_tda;
int pdsch_AntennaPorts;
int pusch_AntennaPorts;
int minRXTXTIMEpdsch;
int minRXTXTIME;
int do_CSIRS;
int do_SRS;
NR_BCCH_DL_SCH_Message_t *siblock1;
NR_ServingCellConfigCommon_t *servingcellconfigcommon;
NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1;
@@ -521,6 +524,8 @@ typedef struct gNB_RRC_INST_s {
int cell_info_configured;
pthread_mutex_t cell_info_mutex;
char *uecap_file;
// security configuration (preferred algorithms)
nr_security_configuration_t security;
} gNB_RRC_INST;
+4
View File
@@ -79,7 +79,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
int scg_id,
int servCellIndex,
int dl_antenna_ports,
int minRXTXTIMEpdsch,
int do_csirs,
int do_srs,
int initial_csi_index,
int uid);
@@ -90,7 +92,9 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
NR_RRCReconfiguration_IEs_t *reconfig,
NR_CellGroupConfig_t *secondaryCellGroup,
int dl_antenna_ports,
int minRXTXTIMEpdsch,
int do_csirs,
int do_srs,
int initial_csi_index,
int uid);
+580 -201
View File
@@ -47,6 +47,12 @@
#include "NR_BCCH-BCH-Message.h"
#include "NR_UL-DCCH-Message.h"
#include "NR_DL-DCCH-Message.h"
#include "NR_DL-CCCH-Message.h"
#include "NR_UL-CCCH-Message.h"
#include "NR_RRCReject.h"
#include "NR_RejectWaitTime.h"
#include "NR_RRCSetup.h"
#include "NR_CellGroupConfig.h"
#include "NR_MeasResults.h"
#include "LTE_UECapabilityInformation.h"
@@ -88,6 +94,7 @@
#include "executables/softmodem-common.h"
#include <openair2/RRC/NR/rrc_gNB_UE_context.h>
#include <openair2/X2AP/x2ap_eNB.h>
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "BIT_STRING.h"
#include "assertions.h"
@@ -125,6 +132,23 @@ uint8_t first_rrcreconfiguration = 0;
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
boolean_t DURecvCb( protocol_ctxt_t *ctxt_pP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_buffer_sizeP,
unsigned char *const sdu_buffer_pP,
const pdcp_transmission_mode_t modeP,
const uint32_t *sourceL2Id,
const uint32_t *destinationL2Id) {
// The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue
mem_block_t *sdu=get_free_mem_block(sdu_buffer_sizeP, __func__);
memcpy(sdu->data, sdu_buffer_pP, sdu_buffer_sizeP);
du_rlc_data_req(ctxt_pP,srb_flagP, false, rb_idP,muiP, confirmP, sdu_buffer_sizeP, sdu);
return true;
}
void openair_nr_rrc_on(const protocol_ctxt_t *const ctxt_pP) {
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" gNB:OPENAIR NR RRC IN....\n",PROTOCOL_NR_RRC_CTXT_ARGS(ctxt_pP));
rrc_config_nr_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier.SI, BCCH, 1);
@@ -136,80 +160,6 @@ void openair_nr_rrc_on(const protocol_ctxt_t *const ctxt_pP) {
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
void rrc_gNB_process_SgNBAdditionRequest(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *ue_context_pP
) {
rrc_gNB_generate_SgNBAdditionRequestAcknowledge(ctxt_pP,ue_context_pP);
}
void rrc_gNB_generate_SgNBAdditionRequestAcknowledge(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP) {
//uint8_t size;
//uint8_t buffer[100];
//int CC_id = ue_context_pP->ue_context.primaryCC_id;
//OCTET_STRING_t *secondaryCellGroup;
NR_CellGroupConfig_t *cellGroupconfig;
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_BearerToAddModList;
struct NR_MAC_CellGroupConfig *mac_CellGroupConfig;
struct NR_PhysicalCellGroupConfig *physicalCellGroupConfig;
struct NR_SpCellConfig *spCellConfig;
//struct NR_CellGroupConfig__sCellToAddModList *sCellToAddModList;
cellGroupconfig = CALLOC(1,sizeof(NR_CellGroupConfig_t));
cellGroupconfig->rlc_BearerToAddModList = CALLOC(1,sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList));
cellGroupconfig->mac_CellGroupConfig = CALLOC(1,sizeof(struct NR_MAC_CellGroupConfig));
cellGroupconfig->physicalCellGroupConfig = CALLOC(1,sizeof(struct NR_PhysicalCellGroupConfig));
cellGroupconfig->spCellConfig = CALLOC(1,sizeof(struct NR_SpCellConfig));
//cellGroupconfig->sCellToAddModList = CALLOC(1,sizeof(struct NR_CellGroupConfig__sCellToAddModList));
rlc_BearerToAddModList = cellGroupconfig->rlc_BearerToAddModList;
mac_CellGroupConfig = cellGroupconfig->mac_CellGroupConfig;
physicalCellGroupConfig = cellGroupconfig->physicalCellGroupConfig;
spCellConfig = cellGroupconfig->spCellConfig;
//sCellToAddModList = cellGroupconfig->sCellToAddModList;
rlc_bearer_config_t *rlc_config;
rlc_config = CALLOC(1,sizeof(rlc_bearer_config_t));
//Fill rlc_bearer config value
rrc_config_rlc_bearer(ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
rlc_config
);
//Fill rlc_bearer config to structure
do_RLC_BEARER(ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
rlc_BearerToAddModList,
rlc_config);
mac_cellgroup_t *mac_cellgroup_config;
mac_cellgroup_config = CALLOC(1,sizeof(mac_cellgroup_t));
//Fill mac_cellgroup_config config value
rrc_config_mac_cellgroup(ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
mac_cellgroup_config
);
//Fill mac_cellgroup config to structure
do_MAC_CELLGROUP(ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
mac_CellGroupConfig,
mac_cellgroup_config);
physicalcellgroup_t *physicalcellgroup_config;
physicalcellgroup_config = CALLOC(1,sizeof(physicalcellgroup_t));
//Fill physicalcellgroup_config config value
rrc_config_physicalcellgroup(ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
physicalcellgroup_config
);
//Fill physicalcellgroup config to structure
do_PHYSICALCELLGROUP(ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
physicalCellGroupConfig,
physicalcellgroup_config);
do_SpCellConfig(RC.nrrrc[ctxt_pP->module_id],
spCellConfig);
}
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration) {
LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__);
if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) {
@@ -252,56 +202,12 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration
pthread_mutex_unlock(&rrc->cell_info_mutex);
if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) {
// This is for phytest only, emulate first X2 message if uecap.raw file is present
FILE *fd;
fd = fopen("uecap.raw","r");
if (fd != NULL) {
char buffer[4096];
int msg_len=fread(buffer,1,4096,fd);
LOG_I(RRC,"Read in %d bytes for uecap\n",msg_len);
LTE_UL_DCCH_Message_t *LTE_UL_DCCH_Message;
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_LTE_UL_DCCH_Message,
(void **)&LTE_UL_DCCH_Message,
(uint8_t *)buffer,
msg_len);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
AssertFatal(1==0,"NR_UL_DCCH_MESSAGE decode error\n");
// free the memory
SEQUENCE_free( &asn_DEF_LTE_UL_DCCH_Message, LTE_UL_DCCH_Message, 1 );
return;
}
fclose(fd);
xer_fprint(stdout,&asn_DEF_LTE_UL_DCCH_Message, LTE_UL_DCCH_Message);
// recreate enough of X2 EN-DC Container
AssertFatal(LTE_UL_DCCH_Message->message.choice.c1.present == LTE_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation,
"ueCapabilityInformation not present\n");
NR_CG_ConfigInfo_t *CG_ConfigInfo = calloc(1,sizeof(*CG_ConfigInfo));
CG_ConfigInfo->criticalExtensions.present = NR_CG_ConfigInfo__criticalExtensions_PR_c1;
CG_ConfigInfo->criticalExtensions.choice.c1 = calloc(1,sizeof(*CG_ConfigInfo->criticalExtensions.choice.c1));
CG_ConfigInfo->criticalExtensions.choice.c1->present = NR_CG_ConfigInfo__criticalExtensions__c1_PR_cg_ConfigInfo;
CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo = calloc(1,sizeof(*CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo));
NR_CG_ConfigInfo_IEs_t *cg_ConfigInfo = CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo;
cg_ConfigInfo->ue_CapabilityInfo = calloc(1,sizeof(*cg_ConfigInfo->ue_CapabilityInfo));
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UE_CapabilityRAT_ContainerList,NULL,
(void *)&LTE_UL_DCCH_Message->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList,buffer,4096);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
OCTET_STRING_fromBuf(cg_ConfigInfo->ue_CapabilityInfo,
(const char *)buffer,
(enc_rval.encoded+7)>>3);
parse_CG_ConfigInfo(rrc,CG_ConfigInfo,NULL);
} else {
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(rrc);
ue_context_p->ue_context.spCellConfig = calloc(1, sizeof(struct NR_SpCellConfig));
ue_context_p->ue_context.spCellConfig->spCellConfigDedicated = configuration->scd;
LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p);
if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) {
rrc_add_nsa_user(rrc,ue_context_p,NULL);
}
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(rrc);
ue_context_p->ue_context.spCellConfig = calloc(1, sizeof(struct NR_SpCellConfig));
ue_context_p->ue_context.spCellConfig->spCellConfigDedicated = configuration->scd;
LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p);
if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) {
rrc_add_nsa_user(rrc,ue_context_p,NULL);
}
}
}
@@ -330,9 +236,11 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu
rrc->carrier.ssb_SubcarrierOffset = configuration->ssb_SubcarrierOffset;
rrc->carrier.pdsch_AntennaPorts = configuration->pdsch_AntennaPorts;
rrc->carrier.pusch_AntennaPorts = configuration->pusch_AntennaPorts;
rrc->carrier.minRXTXTIMEpdsch = configuration->minRXTXTIMEpdsch;
rrc->carrier.minRXTXTIME = configuration->minRXTXTIME;
rrc->carrier.sib1_tda = configuration->sib1_tda;
rrc->carrier.do_CSIRS = configuration->do_CSIRS;
rrc->carrier.do_SRS = configuration->do_SRS;
nr_rrc_config_ul_tda(configuration->scc,configuration->minRXTXTIME);
/// System Information INIT
pthread_mutex_init(&rrc->cell_info_mutex,NULL);
rrc->cell_info_configured = 0;
@@ -365,6 +273,8 @@ void rrc_gNB_process_AdditionRequestInformation(const module_id_t gnb_mod_idP, x
AssertFatal(cg_configinfo->criticalExtensions.choice.c1->present == NR_CG_ConfigInfo__criticalExtensions__c1_PR_cg_ConfigInfo,
"ueCapabilityInformation not present\n");
parse_CG_ConfigInfo(rrc,cg_configinfo,m);
LOG_A(NR_RRC, "Successfully parsed CG_ConfigInfo of size %zu bits. (%zu bytes)\n",
dec_rval.consumed, (dec_rval.consumed +7/8));
}
@@ -398,7 +308,7 @@ void apply_macrlc_config(gNB_RRC_INST *rrc,
nr_rrc_rlc_config_asn1_req(ctxt_pP,
ue_context_pP->ue_context.SRB_configList,
NULL,
ue_context_pP->ue_context.DRB_configList,
NULL,
NULL,
get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL);
@@ -708,7 +618,7 @@ rrc_gNB_process_RRCSetupComplete(
)
//-----------------------------------------------------------------------------
{
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing NR_RRCSetupComplete from UE (SRB1 Active)\n",
LOG_A(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing NR_RRCSetupComplete from UE (SRB1 Active)\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
ue_context_pP->ue_context.Srb1.Active = 1;
ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = 1;
@@ -839,8 +749,8 @@ rrc_gNB_generate_defaultRRCReconfiguration(
dedicatedNAS_MessageList = NULL;
}
memset(buffer, 0, RRC_BUF_SIZE);
size = do_RRCReconfiguration(ctxt_pP, buffer,
memset(buffer, 0, sizeof(buffer));
size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer),
xid,
NULL, //*SRB_configList2,
NULL, //*DRB_configList,
@@ -1107,11 +1017,11 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
dedicatedNAS_MessageList = NULL;
}
memset(buffer, 0, RRC_BUF_SIZE);
memset(buffer, 0, sizeof(buffer));
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
fill_mastercellGroupConfig(cellGroupConfig, ue_context_pP->ue_context.masterCellGroup,
rrc->um_on_default_drb);
size = do_RRCReconfiguration(ctxt_pP, buffer,
size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer),
xid,
*SRB_configList2,
*DRB_configList,
@@ -1219,8 +1129,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release(
LOG_W(NR_RRC,"dedlicated NAS list is empty\n");
}
memset(buffer, 0, RRC_BUF_SIZE);
size = do_RRCReconfiguration(ctxt_pP, buffer, xid,
memset(buffer, 0, sizeof(buffer));
size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer), xid,
NULL,
NULL,
*DRB_Release_configList2,
@@ -1299,7 +1209,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid];
NR_DRB_ToReleaseList_t *DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid];
NR_DRB_Identity_t *drb_id_p = NULL;
// uint8_t nr_DRB2LCHAN[8];
// uint8_t nr_DRB2LCHAN[8];
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
ue_context_pP->ue_context.ue_reestablishment_timer = 0;
@@ -1363,6 +1273,49 @@ rrc_gNB_process_RRCReconfigurationComplete(
NULL,
get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL);
}
else if(SRB_configList!=NULL || DRB_configList!=NULL){
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ);
f1ap_ue_context_setup_t *req=&F1AP_UE_CONTEXT_SETUP_REQ (message_p);
req->gNB_CU_ue_id = 0;
req->gNB_DU_ue_id = 0;
req->rnti = ue_context_pP->ue_context.rnti;
req->mcc = rrc->configuration.mcc[0];
req->mnc = rrc->configuration.mnc[0];
req->mnc_digit_length = rrc->configuration.mnc_digit_length[0];
req->nr_cellid = rrc->nr_cellid;
if(SRB_configList!=NULL){
req->srbs_to_be_setup = malloc(SRB_configList->list.count*sizeof(f1ap_srb_to_be_setup_t));
req->srbs_to_be_setup_length = SRB_configList->list.count;
f1ap_srb_to_be_setup_t *SRBs=req->srbs_to_be_setup;
for (int i = 0; i < SRB_configList->list.count; i++){
if(SRB_configList->list.array[i]->srb_Identity > 1){
SRBs[i].srb_id = SRB_configList->list.array[i]->srb_Identity;
SRBs[i].lcid = SRB_configList->list.array[i]->srb_Identity;
}
}
}
if(DRB_configList!=NULL){
gtpv1u_gnb_create_tunnel_req_t create_tunnel_req;
memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t));
req->drbs_to_be_setup = malloc(DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t));
req->drbs_to_be_setup_length = DRB_configList->list.count;
f1ap_drb_to_be_setup_t *DRBs=req->drbs_to_be_setup;
LOG_I(RRC, "Length of DRB list:%d, %d \n", DRB_configList->list.count, req->drbs_to_be_setup_length);
for (int i = 0; i < DRB_configList->list.count; i++){
DRBs[i].drb_id = DRB_configList->list.array[i]->drb_Identity;
DRBs[i].rlc_mode = RLC_MODE_AM;
DRBs[i].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr);
DRBs[i].up_ul_tnl[0].port=rrc->eth_params_s.my_portd;
DRBs[i].up_ul_tnl_length = 1;
DRBs[i].up_dl_tnl[0].tl_address = inet_addr(rrc->eth_params_s.remote_addr);
DRBs[i].up_dl_tnl[0].port=rrc->eth_params_s.remote_portd;
DRBs[i].up_dl_tnl_length = 1;
}
LOG_I(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n");
}
itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
}
#endif
/* Set the SRB active in UE context */
@@ -1396,7 +1349,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
for (int i = 0; i < DRB_configList->list.count; i++) {
if (DRB_configList->list.array[i]) {
drb_id = (int)DRB_configList->list.array[i]->drb_Identity;
LOG_I(NR_RRC, "[gNB %d] Frame %d : Logical Channel UL-DCCH, Received NR_RRCReconfigurationComplete from UE rnti %x, reconfiguring DRB %d\n",
LOG_A(NR_RRC, "[gNB %d] Frame %d : Logical Channel UL-DCCH, Received NR_RRCReconfigurationComplete from UE rnti %x, reconfiguring DRB %d\n",
ctxt_pP->module_id,
ctxt_pP->frame,
ctxt_pP->rnti,
@@ -1487,6 +1440,7 @@ rrc_gNB_generate_RRCReestablishment(
ue_context_pP,
CC_id,
(uint8_t *) ue_context->Srb0.Tx_buffer.Payload,
sizeof(ue_context->Srb0.Tx_buffer.Payload),
//(uint8_t) carrier->p_gNB, // at this point we do not have the UE capability information, so it can only be TM1 or TM2
rrc_gNB_get_next_transaction_identifier(module_id),
SRB_configList
@@ -1672,11 +1626,11 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete(
if (ue_context_pP->ue_context.pduSession[i].status == PDU_SESSION_STATUS_ESTABLISHED || ue_context_pP->ue_context.pduSession[i].status == PDU_SESSION_STATUS_DONE) {
create_tunnel_req.pdusession_id[j] = ue_context_pP->ue_context.pduSession[i].param.pdusession_id;
create_tunnel_req.incoming_rb_id[j] = i+1;
create_tunnel_req.upf_NGu_teid[j] = ue_context_pP->ue_context.pduSession[i].param.gtp_teid;
memcpy(create_tunnel_req.upf_addr[j].buffer,
create_tunnel_req.outgoing_teid[j] = ue_context_pP->ue_context.pduSession[i].param.gtp_teid;
memcpy(create_tunnel_req.dst_addr[j].buffer,
ue_context_pP->ue_context.pduSession[i].param.upf_addr.buffer,
sizeof(uint8_t)*20);
create_tunnel_req.upf_addr[j].length = ue_context_pP->ue_context.pduSession[i].param.upf_addr.length;
create_tunnel_req.dst_addr[j].length = ue_context_pP->ue_context.pduSession[i].param.upf_addr.length;
j++;
}
}
@@ -1742,9 +1696,9 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete(
i, ue_context_pP->ue_context.pduSession[i].status, "PDU_SESSION_STATUS_DONE");
}
memset(buffer, 0, RRC_BUF_SIZE);
memset(buffer, 0, sizeof(buffer));
size = do_RRCReconfiguration(ctxt_pP, buffer,
size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer),
xid,
*SRB_configList2,
DRB_configList,
@@ -2737,16 +2691,19 @@ rrc_gNB_decode_dcch(
void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
LOG_I(NR_RRC,"Received F1 Setup Request from gNB_DU %llu (%s)\n",(unsigned long long int)f1_setup_req->gNB_DU_id,f1_setup_req->gNB_DU_name);
int cu_cell_ind = 0;
MessageDef *msg_p = NULL,*msg_p2=NULL;
MessageDef *msg_p =itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_SETUP_RESP);
F1AP_SETUP_RESP (msg_p).num_cells_to_activate = 0;
MessageDef *msg_p2=itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE);
for (int i = 0; i < f1_setup_req->num_cells_available; i++) {
int found_cell=0;
for (int j=0; j<RC.nb_nr_inst; j++) {
gNB_RRC_INST *rrc = RC.nrrrc[j];
if (rrc->configuration.mcc[0] == f1_setup_req->mcc[i] &&
rrc->configuration.mnc[0] == f1_setup_req->mnc[i] &&
rrc->nr_cellid == f1_setup_req->nr_cellid[i]) {
if (rrc->configuration.mcc[0] == f1_setup_req->cell[i].mcc &&
rrc->configuration.mnc[0] == f1_setup_req->cell[i].mnc &&
rrc->nr_cellid == f1_setup_req->cell[i].nr_cellid) {
//fixme: multi instance is not consistent here
F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name;
// check that CU rrc instance corresponds to mcc/mnc/cgi (normally cgi should be enough, but just in case)
rrc->carrier.MIB = malloc(f1_setup_req->mib_length[i]);
rrc->carrier.sizeof_MIB = f1_setup_req->mib_length[i];
@@ -2759,7 +2716,7 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
f1_setup_req->mib[i],
f1_setup_req->mib_length[i]);
AssertFatal(dec_rval.code == RC_OK,
"[gNB_DU %"PRIu8"] Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits)\n",
"[gNB_CU %"PRIu8"] Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits)\n",
j,
dec_rval.consumed );
NR_BCCH_BCH_Message_t *mib = &rrc->carrier.mib;
@@ -2789,27 +2746,14 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
AssertFatal(bcch_message->message.choice.c1->present == NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1,
"bcch_message->message.choice.c1->present != NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n");
rrc->carrier.sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1;
rrc->carrier.physCellId = f1_setup_req->nr_pci[i];
if (cu_cell_ind == 0) {
// prepare F1_SETUP_RESPONSE + GNB_CU_CONFIGURATION_UPDATE
if (msg_p == NULL) {
msg_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_SETUP_RESP);
}
if (msg_p2 == NULL) {
msg_p2 = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE);
}
F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name;
F1AP_SETUP_RESP (msg_p).num_cells_to_activate = 0;
}
rrc->carrier.physCellId = f1_setup_req->cell[i].nr_pci;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).gNB_CU_name = rrc->node_name;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mcc = rrc->configuration.mcc[0];
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mnc = rrc->configuration.mnc[0];
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mnc_digit_length = rrc->configuration.mnc_digit_length[0];
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nr_cellid = rrc->nr_cellid;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->nr_pci[i];
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->cell[i].nr_pci;
int num_SI= 0;
if (rrc->carrier.SIB23) {
@@ -2820,22 +2764,20 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) {
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].num_SI = num_SI;
cu_cell_ind++;
found_cell=1;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).num_cells_to_activate = cu_cell_ind;
// send
break;
} else {// setup_req mcc/mnc match rrc internal list element
LOG_W(NR_RRC,"[Inst %d] No matching MCC/MNC: rrc->mcc/f1_setup_req->mcc %d/%d rrc->mnc/f1_setup_req->mnc %d/%d rrc->nr_cellid/f1_setup_req->nr_cellid %ld/%ld \n",
j, rrc->configuration.mcc[0], f1_setup_req->mcc[i],
rrc->configuration.mnc[0], f1_setup_req->mnc[i],
rrc->nr_cellid, f1_setup_req->nr_cellid[i]);
j, rrc->configuration.mcc[0], f1_setup_req->cell[i].mcc,
rrc->configuration.mnc[0], f1_setup_req->cell[i].mnc,
rrc->nr_cellid, f1_setup_req->cell[i].nr_cellid);
}
}// for (int j=0;j<RC.nb_inst;j++)
if (found_cell == 0) {
if (cu_cell_ind == 0) {
AssertFatal(1 == 0, "No cell found\n");
}
else {
} else {
// send ITTI message to F1AP-CU task
itti_send_msg_to_task (TASK_CU_F1, 0, msg_p);
@@ -2859,6 +2801,421 @@ void rrc_gNB_process_dc_overall_timeout(const module_id_t gnb_mod_idP, x2ap_ENDC
rrc_remove_nsa_user(rrc, m->rnti);
}
static int rrc_process_DU_DL(MessageDef *msg_p, const char *msg_name, instance_t instance) {
NRDuDlReq_t * req=&NRDuDlReq(msg_p);
protocol_ctxt_t ctxt;
ctxt.rnti = req->rnti;
ctxt.module_id = instance;
ctxt.instance = instance;
ctxt.enb_flag = 1;
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
struct rrc_gNB_ue_context_s *ue_context_p =
rrc_gNB_get_ue_context(rrc, ctxt.rnti);
if (req->srb_id == 0) {
NR_DL_CCCH_Message_t *dl_ccch_msg=NULL;
asn_dec_rval_t dec_rval;
dec_rval = uper_decode(NULL,
&asn_DEF_NR_DL_CCCH_Message,
(void **)&dl_ccch_msg,
req->buf->data,
req->buf->size,0,0);
AssertFatal(dec_rval.code == RC_OK, "could not decode F1AP message\n");
switch (dl_ccch_msg->message.choice.c1->present) {
case NR_DL_CCCH_MessageType__c1_PR_NOTHING:
LOG_I(F1AP,"Received PR_NOTHING on DL-CCCH-Message\n");
break;
case NR_DL_CCCH_MessageType__c1_PR_rrcReject:
LOG_I(F1AP,"Logical Channel DL-CCCH (SRB0), Received RRCReject\n");
break;
case NR_DL_CCCH_MessageType__c1_PR_rrcSetup: {
LOG_I(F1AP, "Logical Channel DL-CCCH (SRB0), Received RRCSetup RNTI %x\n",
req->rnti);
// Get configuration
NR_RRCSetup_t *rrcSetup = dl_ccch_msg->message.choice.c1->choice.rrcSetup;
AssertFatal(rrcSetup!=NULL, "rrcSetup is null\n");
NR_RRCSetup_IEs_t *rrcSetup_ies = rrcSetup->criticalExtensions.choice.rrcSetup;
ue_context_p->ue_context.SRB_configList = rrcSetup_ies->radioBearerConfig.srb_ToAddModList;
AssertFatal(rrcSetup_ies->masterCellGroup.buf!=NULL,"masterCellGroup is null\n");
asn_dec_rval_t dec_rval;
dec_rval = uper_decode(NULL,
&asn_DEF_NR_CellGroupConfig,
(void **)&ue_context_p->ue_context.masterCellGroup,
rrcSetup_ies->masterCellGroup.buf,
rrcSetup_ies->masterCellGroup.size,0,0);
AssertFatal(dec_rval.code == RC_OK, "could not decode masterCellGroup\n");
apply_macrlc_config(rrc,ue_context_p,&ctxt);
gNB_RRC_UE_t *ue_p = &ue_context_p->ue_context;
AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n");
memcpy((void *)ue_p->Srb0.Tx_buffer.Payload,
(void *)req->buf->data,
req->buf->size); // ie->value.choice.RRCContainer.size
ue_p->Srb0.Tx_buffer.payload_size = req->buf->size;
break;
} // case
case NR_DL_CCCH_MessageType__c1_PR_spare2:
LOG_I(F1AP,
"Logical Channel DL-CCCH (SRB0), Received spare2\n");
break;
case NR_DL_CCCH_MessageType__c1_PR_spare1:
LOG_I(F1AP,
"Logical Channel DL-CCCH (SRB0), Received spare1\n");
break;
default:
AssertFatal(1==0,
"Unknown message\n");
break;
}// switch case
return(0);
} else if (req->srb_id == 1) {
NR_DL_DCCH_Message_t *dl_dcch_msg=NULL;
asn_dec_rval_t dec_rval;
dec_rval = uper_decode(NULL,
&asn_DEF_NR_DL_DCCH_Message,
(void **)&dl_dcch_msg,
&req->buf->data[2], // buf[0] includes the pdcp header
req->buf->size-6,0,0);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0))
LOG_E(F1AP," Failed to decode DL-DCCH (%zu bytes)\n",dec_rval.consumed);
else
LOG_D(F1AP, "Received message: present %d and c1 present %d\n",
dl_dcch_msg->message.present, dl_dcch_msg->message.choice.c1->present);
if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) {
switch (dl_dcch_msg->message.choice.c1->present) {
case NR_DL_DCCH_MessageType__c1_PR_NOTHING:
LOG_I(F1AP, "Received PR_NOTHING on DL-DCCH-Message\n");
return 0;
case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration:
// handle RRCReconfiguration
LOG_I(F1AP, "Logical Channel DL-DCCH (SRB1), Received RRCReconfiguration RNTI %x\n",
req->rnti);
NR_RRCReconfiguration_t *rrcReconfiguration = dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration;
if (rrcReconfiguration->criticalExtensions.present == NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) {
NR_RRCReconfiguration_IEs_t *rrcReconfiguration_ies =
rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration;
if (rrcReconfiguration_ies->measConfig != NULL) {
LOG_I(F1AP, "Measurement Configuration is present\n");
}
if (rrcReconfiguration_ies->radioBearerConfig) {
LOG_I(F1AP, "Radio Resource Configuration is present\n");
long drb_id;
int i;
NR_DRB_ToAddModList_t *DRB_configList = rrcReconfiguration_ies->radioBearerConfig->drb_ToAddModList;
NR_SRB_ToAddModList_t *SRB_configList = rrcReconfiguration_ies->radioBearerConfig->srb_ToAddModList;
// NR_DRB_ToReleaseList_t *DRB_ReleaseList = rrcReconfiguration_ies->radioBearerConfig->drb_ToReleaseList;
// rrc_rlc_config_asn1_req
if (SRB_configList != NULL) {
for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) {
if (SRB_configList->list.array[i]->srb_Identity == 1 ) {
ue_context_p->ue_context.Srb1.Active=1;
} else if (SRB_configList->list.array[i]->srb_Identity == 2 ) {
ue_context_p->ue_context.Srb2.Active=1;
ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2;
LOG_I(F1AP, "[DU %d] SRB2 is now active\n",ctxt.module_id);
} else {
LOG_W(F1AP, "[DU %d] invalide SRB identity %ld\n",ctxt.module_id,
SRB_configList->list.array[i]->srb_Identity);
}
}
}
if (DRB_configList != NULL) {
for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8)
if (DRB_configList->list.array[i]) {
drb_id = (int)DRB_configList->list.array[i]->drb_Identity;
LOG_I(F1AP,
"[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d\n",
ctxt.module_id,
ctxt.rnti,
(int)DRB_configList->list.array[i]->drb_Identity);
// (int)*DRB_configList->list.array[i]->logicalChannelIdentity);
if (ue_context_p->ue_context.DRB_active[drb_id] == 0) {
ue_context_p->ue_context.DRB_active[drb_id] = 1;
// logicalChannelIdentity
// rrc_mac_config_req_eNB
}
} else { // remove LCHAN from MAC/PHY
AssertFatal(1==0,"Can't handle this yet in DU\n");
}
}
}
}
}
break;
case NR_DL_DCCH_MessageType__c1_PR_rrcResume:
LOG_I(F1AP,"Received rrcResume\n");
break;
case NR_DL_DCCH_MessageType__c1_PR_rrcRelease:
LOG_I(F1AP,"Received rrcRelease\n");
break;
case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment:
LOG_I(F1AP,"Received rrcReestablishment\n");
break;
case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand:
LOG_I(F1AP,"Received securityModeCommand\n");
break;
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer:
LOG_I(F1AP, "Received dlInformationTransfer\n");
break;
case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry:
LOG_I(F1AP, "Received ueCapabilityEnquiry\n");
break;
case NR_DL_DCCH_MessageType__c1_PR_counterCheck:
LOG_I(F1AP, "Received counterCheck\n");
break;
case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand:
case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16:
case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16:
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16:
case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16:
case NR_DL_DCCH_MessageType__c1_PR_spare3:
case NR_DL_DCCH_MessageType__c1_PR_spare2:
case NR_DL_DCCH_MessageType__c1_PR_spare1:
break;
}
}
} else if (req->srb_id == 2) {
// TODO
//abort();
}
LOG_I(F1AP, "Received DL RRC Transfer on srb_id %ld\n", req->srb_id);
// rlc_op_status_t rlc_status;
// boolean_t ret = TRUE;
//LOG_I(F1AP, "PRRCContainer size %lu:", ie->value.choice.RRCContainer.size);
//for (int i = 0; i < ie->value.choice.RRCContainer.size; i++)
// printf("%02x ", ie->value.choice.RRCContainer.buf[i]);
//printf (", PDCP PDU size %d:", rrc_dl_sdu_len);
//for (int i=0;i<rrc_dl_sdu_len;i++) printf("%2x ",pdcp_pdu_p->data[i]);
//printf("\n");
du_rlc_data_req(&ctxt, 1, 0, req->srb_id , 1, 0, req->buf->size, req->buf);
// rlc_status = rlc_data_req(&ctxt
// , 1
// , MBMS_FLAG_NO
// , srb_id
// , 0
// , 0
// , rrc_dl_sdu_len
// , pdcp_pdu_p
// ,NULL
// ,NULL
// );
// switch (rlc_status) {
// case RLC_OP_STATUS_OK:
// //LOG_I(F1AP, "Data sending request over RLC succeeded!\n");
// ret=TRUE;
// break;
// case RLC_OP_STATUS_BAD_PARAMETER:
// LOG_W(F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n");
// ret= FALSE;
// break;
// case RLC_OP_STATUS_INTERNAL_ERROR:
// LOG_W(F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n");
// ret= FALSE;
// break;
// case RLC_OP_STATUS_OUT_OF_RESSOURCES:
// LOG_W(F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n");
// ret= FALSE;
// break;
// default:
// LOG_W(F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status);
// ret= FALSE;
// break;
// } // switch case
// return ret;
return 0;
}
static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const char *msg_name, instance_t instance){
f1ap_ue_context_setup_t * req=&F1AP_UE_CONTEXT_SETUP_REQ(msg_p);
protocol_ctxt_t ctxt;
ctxt.rnti = req->rnti;
ctxt.module_id = instance;
ctxt.instance = instance;
ctxt.enb_flag = 1;
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
gNB_MAC_INST *mac = RC.nrmac[ctxt.module_id];
struct rrc_gNB_ue_context_s *ue_context_p =
rrc_gNB_get_ue_context(rrc, ctxt.rnti);
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_RESP);
f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(message_p);
uint32_t incoming_teid = 0;
NR_CellGroupConfig_t *cellGroupConfig;
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
fill_mastercellGroupConfig(cellGroupConfig, ue_context_p->ue_context.masterCellGroup);
/* Configure SRB2 */
NR_SRB_ToAddMod_t *SRB2_config = NULL;
NR_SRB_ToAddModList_t *SRB_configList = NULL;
uint8_t SRBs_before_new_addition = 0;
if(req->srbs_to_be_setup_length>0){
if(ue_context_p->ue_context.SRB_configList == NULL){
LOG_W(NR_RRC, "The SRB list of the UE context is empty before the addition of new SRB at the DU \n");
ue_context_p->ue_context.SRB_configList = CALLOC(1, sizeof(*ue_context_p->ue_context.SRB_configList));
}
SRB_configList = ue_context_p->ue_context.SRB_configList;
SRBs_before_new_addition = SRB_configList->list.count;
for (int i=0; i<req->srbs_to_be_setup_length; i++){
SRB2_config = CALLOC(1, sizeof(*SRB2_config));
SRB2_config->srb_Identity = req->srbs_to_be_setup[i].srb_id;
ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
}
}
/* Configure DRB */
NR_DRB_ToAddMod_t *DRB_config = NULL;
NR_DRB_ToAddModList_t *DRB_configList = NULL;
if(req->drbs_to_be_setup_length>0){
if(ue_context_p->ue_context.DRB_configList == NULL){
ue_context_p->ue_context.DRB_configList = CALLOC(1, sizeof(*ue_context_p->ue_context.DRB_configList));
}
DRB_configList = ue_context_p->ue_context.DRB_configList;
for (int i=0; i<req->drbs_to_be_setup_length; i++){
DRB_config = CALLOC(1, sizeof(*DRB_config));
DRB_config->drb_Identity = req->drbs_to_be_setup[i].drb_id;
ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config);
f1ap_drb_to_be_setup_t drb_p = req->drbs_to_be_setup[i];
transport_layer_addr_t addr;
memcpy(addr.buffer, &drb_p.up_ul_tnl[0].tl_address, sizeof(drb_p.up_ul_tnl[0].tl_address));
addr.length=sizeof(drb_p.up_ul_tnl[0].tl_address)*8;
extern instance_t DUuniqInstance;
incoming_teid=newGtpuCreateTunnel(DUuniqInstance,
req->rnti,
drb_p.drb_id,
drb_p.drb_id,
drb_p.up_ul_tnl[0].teid,
addr,
drb_p.up_ul_tnl[0].port,
DURecvCb);
}
}
apply_macrlc_config(rrc, ue_context_p, &ctxt);
/* Fill the UE context setup response ITTI message to send to F1AP */
resp->gNB_CU_ue_id = req->gNB_CU_ue_id;
resp->rnti = ctxt.rnti;
if(DRB_configList){
if(DRB_configList->list.count > 0){
resp->drbs_to_be_setup = calloc(1,DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t));
resp->drbs_to_be_setup_length = DRB_configList->list.count;
for (int i=0; i<DRB_configList->list.count; i++){
resp->drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity;
resp->drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM;
resp->drbs_to_be_setup[i].up_dl_tnl[0].teid = incoming_teid;
resp->drbs_to_be_setup[i].up_dl_tnl[0].tl_address = inet_addr(mac->eth_params_n.my_addr);
resp->drbs_to_be_setup[i].up_dl_tnl_length = 1;
}
}
else{
LOG_W(NR_RRC, "No DRB added upon reception of F1 UE context setup request with a DRB to setup list\n");
}
}
if(SRB_configList){
if(SRB_configList->list.count >0 && SRBs_before_new_addition < SRB_configList->list.count){
resp->srbs_to_be_setup = calloc(1,req->srbs_to_be_setup_length*sizeof(f1ap_srb_to_be_setup_t));
resp->srbs_to_be_setup_length = req->srbs_to_be_setup_length;
for (int i=SRBs_before_new_addition; i<SRB_configList->list.count; i++){
resp->srbs_to_be_setup[i-SRBs_before_new_addition].srb_id = SRB_configList->list.array[i]->srb_Identity;
}
}
else{
LOG_W(NR_RRC, "No SRB added upon reception of F1 UE Context setup request at the DU\n");
}
}
else{
LOG_W(NR_RRC, "No SRB added upon reception of F1 UE Context setup request at the DU\n");
}
resp->du_to_cu_rrc_information = calloc(1,1024*sizeof(uint8_t));
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
(void *)cellGroupConfig,
resp->du_to_cu_rrc_information,
1024);
resp->du_to_cu_rrc_information_length = (enc_rval.encoded+7)>>3;
free(cellGroupConfig);
itti_send_msg_to_task (TASK_DU_F1, ctxt.module_id, message_p);
}
static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const char *msg_name, instance_t instance){
f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(msg_p);
protocol_ctxt_t ctxt;
ctxt.rnti = resp->rnti;
ctxt.module_id = instance;
ctxt.instance = instance;
ctxt.enb_flag = 1;
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt.rnti);
NR_CellGroupConfig_t *cellGroupConfig = NULL;
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_NR_CellGroupConfig,
(void **)&cellGroupConfig,
(uint8_t *)resp->du_to_cu_rrc_information,
(int) resp->du_to_cu_rrc_information_length);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
AssertFatal(1==0,"Cell group config decode error\n");
// free the memory
SEQUENCE_free( &asn_DEF_NR_CellGroupConfig, cellGroupConfig, 1 );
return;
}
//xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, cellGroupConfig);
if(ue_context_p->ue_context.masterCellGroup == NULL){
ue_context_p->ue_context.masterCellGroup = calloc(1, sizeof(NR_CellGroupConfig_t));
}
if(cellGroupConfig->rlc_BearerToAddModList!=NULL){
if(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList != NULL){
LOG_I(NR_RRC, "rlc_BearerToAddModList not empty before filling it \n");
free(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList);
}
ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList));
memcpy(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList, cellGroupConfig->rlc_BearerToAddModList,
sizeof(*cellGroupConfig->rlc_BearerToAddModList));
}
xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, ue_context_p->ue_context.masterCellGroup);
free(cellGroupConfig->rlc_BearerToAddModList);
free(cellGroupConfig);
}
unsigned int mask_flip(unsigned int x) {
return((((x>>8) + (x<<8))&0xffff)>>6);
}
@@ -3171,7 +3528,6 @@ void *rrc_gnb_task(void *args_p) {
.frame=-1,
.subframe=-1,
.eNB_index=0,
.configured=true,
.brOption=false
};
itti_mark_task_ready(TASK_RRC_GNB);
@@ -3203,36 +3559,46 @@ void *rrc_gnb_task(void *args_p) {
/* Messages from MAC */
case NR_RRC_MAC_CCCH_DATA_IND:
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).gnb_index,
GNB_FLAG_YES,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).rnti,
msg_p->ittiMsgHeader.lte_time.frame,
msg_p->ittiMsgHeader.lte_time.slot);
LOG_I(NR_RRC,"Decoding CCCH : ue %d, inst %ld, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n",
ctxt.rnti,
instance,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id,
&ctxt,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= CCCH_SDU_SIZE) {
LOG_I(NR_RRC, "CCCH message has size %d > %d\n",
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,CCCH_SDU_SIZE);
break;
}
nr_rrc_gNB_decode_ccch(&ctxt,
(uint8_t *)NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id);
if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container) {
free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container->buf);
free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container);
}
{
instance_t i;
for (i=0; i<RC.nb_nr_inst; i++) {
// first get RRC instance (note, no the ITTI instance)
gNB_RRC_INST *rrc = RC.nrrrc[i];
if (rrc->nr_cellid == NR_RRC_MAC_CCCH_DATA_IND(msg_p).nr_cellid)
break;
}
AssertFatal(i!=RC.nb_nr_inst, "Cell_id not found\n");
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
i,
GNB_FLAG_YES,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).rnti,
msg_p->ittiMsgHeader.lte_time.frame,
msg_p->ittiMsgHeader.lte_time.slot);
LOG_I(NR_RRC,"Decoding CCCH : ue %d, inst %ld, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n",
ctxt.rnti,
i,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id,
&ctxt,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= CCCH_SDU_SIZE) {
LOG_I(NR_RRC, "CCCH message has size %d > %d\n",
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,CCCH_SDU_SIZE);
break;
}
nr_rrc_gNB_decode_ccch(&ctxt,
(uint8_t *)NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container,
NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id);
if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container) {
free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container->buf);
free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container);
}
}
break;
/* Messages from PDCP */
@@ -3288,6 +3654,18 @@ void *rrc_gnb_task(void *args_p) {
LOG_I(NR_RRC,"[gNB %ld] Received %s : %p\n", instance, msg_name_p, &F1AP_SETUP_REQ(msg_p));
rrc_gNB_process_f1_setup_req(&F1AP_SETUP_REQ(msg_p));
break;
case NR_DU_RRC_DL_INDICATION:
rrc_process_DU_DL(msg_p, msg_name_p, instance);
break;
case F1AP_UE_CONTEXT_SETUP_REQ:
rrc_DU_process_ue_context_setup_request(msg_p, msg_name_p, instance);
break;
case F1AP_UE_CONTEXT_SETUP_RESP:
rrc_CU_process_ue_context_setup_response(msg_p, msg_name_p, instance);
break;
/* Messages from X2AP */
case X2AP_ENDC_SGNB_ADDITION_REQ:
@@ -3296,7 +3674,7 @@ void *rrc_gnb_task(void *args_p) {
break;
case X2AP_ENDC_SGNB_RECONF_COMPLETE:
LOG_I(NR_RRC, "Handling of reconfiguration complete message at RRC gNB is pending \n");
LOG_A(NR_RRC, "Handling of reconfiguration complete message at RRC gNB is pending \n");
break;
case NGAP_INITIAL_CONTEXT_SETUP_REQ:
@@ -3523,9 +3901,10 @@ rrc_gNB_generate_RRCRelease(
uint8_t buffer[RRC_BUF_SIZE];
uint16_t size = 0;
memset(buffer, 0, RRC_BUF_SIZE);
memset(buffer, 0, sizeof(buffer));
size = do_NR_RRCRelease(buffer,rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id));
size = do_NR_RRCRelease(buffer, sizeof(buffer),
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id));
ue_context_pP->ue_context.ue_reestablishment_timer = 0;
ue_context_pP->ue_context.ue_release_timer = 0;
ue_context_pP->ue_context.ul_failure_timer = 0;
+13 -11
View File
@@ -306,7 +306,9 @@ nr_rrc_pdcp_config_security(
uint8_t *kRRCenc = NULL;
uint8_t *kRRCint = NULL;
uint8_t *kUPenc = NULL;
static int print_keys= 1;
//uint8_t *k_kdf = NULL;
static int print_keys= 1;
/* Derive the keys from kgnb */
if (SRB_configList != NULL) {
@@ -481,7 +483,7 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
uint16_t ue_initial_id;
uint32_t gNB_ue_ngap_id;
rrc_gNB_ue_context_t *ue_context_p = NULL;
protocol_ctxt_t ctxt;
protocol_ctxt_t ctxt={0};
uint8_t pdu_sessions_done = 0;
gtpv1u_gnb_create_tunnel_req_t create_tunnel_req;
gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp;
@@ -520,14 +522,14 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
ue_context_p->ue_context.pduSession[i].param = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done];
create_tunnel_req.pdusession_id[pdu_sessions_done] = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].pdusession_id;
create_tunnel_req.incoming_rb_id[pdu_sessions_done] = i+1;
create_tunnel_req.upf_NGu_teid[pdu_sessions_done] = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].gtp_teid;
create_tunnel_req.upf_addr[pdu_sessions_done].length = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].upf_addr.length;
memcpy(create_tunnel_req.upf_addr[pdu_sessions_done].buffer,
create_tunnel_req.outgoing_teid[pdu_sessions_done] = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].gtp_teid;
create_tunnel_req.dst_addr[pdu_sessions_done].length = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].upf_addr.length;
memcpy(create_tunnel_req.dst_addr[pdu_sessions_done].buffer,
NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].upf_addr.buffer,
sizeof(uint8_t)*20);
LOG_I(NR_RRC, "PDUSESSION SETUP: local index %d teid %u, pdusession id %d \n",
i,
create_tunnel_req.upf_NGu_teid[pdu_sessions_done],
create_tunnel_req.outgoing_teid[pdu_sessions_done],
create_tunnel_req.pdusession_id[pdu_sessions_done]);
inde_list[pdu_sessions_done] = i;
pdu_sessions_done++;
@@ -1053,7 +1055,7 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(
uint8_t nb_pdusessions_tosetup = NGAP_PDUSESSION_SETUP_REQ(msg_p).nb_pdusessions_tosetup;
pdu_sessions_done = 0;
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, GNB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0, 0);
for (int i = 0; i < NR_NB_RB_MAX - 3; i++) {
if(ue_context_p->ue_context.pduSession[i].status >= PDU_SESSION_STATUS_DONE)
continue;
@@ -1061,14 +1063,14 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(
ue_context_p->ue_context.pduSession[i].param = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done];
create_tunnel_req.pdusession_id[pdu_sessions_done] = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].pdusession_id;
create_tunnel_req.incoming_rb_id[pdu_sessions_done]= i+1;
create_tunnel_req.upf_NGu_teid[pdu_sessions_done] = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].gtp_teid;
memcpy(create_tunnel_req.upf_addr[pdu_sessions_done].buffer,
create_tunnel_req.outgoing_teid[pdu_sessions_done] = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].gtp_teid;
memcpy(create_tunnel_req.dst_addr[pdu_sessions_done].buffer,
NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].upf_addr.buffer,
sizeof(uint8_t)*20);
create_tunnel_req.upf_addr[pdu_sessions_done].length = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].upf_addr.length;
create_tunnel_req.dst_addr[pdu_sessions_done].length = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].upf_addr.length;
LOG_I(NR_RRC,"NGAP PDUSESSION SETUP REQ: local index %d teid %u, pdusession id %d \n",
i,
create_tunnel_req.upf_NGu_teid[pdu_sessions_done],
create_tunnel_req.outgoing_teid[pdu_sessions_done],
create_tunnel_req.pdusession_id[pdu_sessions_done]);
inde_list[pdu_sessions_done] = i;
pdu_sessions_done++;
+57 -23
View File
@@ -38,6 +38,7 @@
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/RRC/LTE/rrc_eNB_GTPV1U.h"
#include "executables/softmodem-common.h"
#include "executables/nr-softmodem.h"
#include <openair2/RRC/NR/rrc_gNB_UE_context.h>
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "UTIL/OSA/osa_defs.h"
@@ -123,6 +124,7 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, NR_UE_CapabilityRAT_ContainerL
if ( LOG_DEBUGFLAG(DEBUG_ASN1) && ueCapabilityRAT_Container_MRDC != NULL ) {
xer_fprint(stdout, &asn_DEF_NR_UE_MRDC_Capability, ue_context_p->ue_context.UE_Capability_MRDC);
}
LOG_A(NR_RRC, "Successfully decoded UE NR capabilities (NR and MRDC)\n");
rrc_add_nsa_user(rrc,ue_context_p, m);
}
@@ -142,6 +144,30 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
unsigned char *kUPenc = NULL;
unsigned char *kUPint = NULL;
int i;
// In case of phy-test and do-ra mode, read UE capabilities directly from file
if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1) {
NR_UE_NR_Capability_t* UE_Capability_nr = NULL;
char UE_NR_Capability_xer[65536];
FILE *f = NULL;
if (uecap_file)
f = fopen(uecap_file, "r");
if(f){
size_t size = fread(UE_NR_Capability_xer, 1, sizeof UE_NR_Capability_xer, f);
if (size == 0 || size == sizeof UE_NR_Capability_xer)
LOG_E(NR_RRC,"UE Capabilities XER file %s is too large (%ld)\n", uecap_file, size);
else {
UE_Capability_nr = CALLOC(1,sizeof(NR_UE_NR_Capability_t));
asn_dec_rval_t dec_rval = xer_decode(0, &asn_DEF_NR_UE_NR_Capability, (void *)&UE_Capability_nr, UE_NR_Capability_xer, size);
assert(dec_rval.code == RC_OK);
xer_fprint(stdout,&asn_DEF_NR_UE_NR_Capability,(void *)UE_Capability_nr);
}
}
else
LOG_E(NR_RRC,"Could not open UE Capabilities input file. Not handling OAI UE Capabilities.\n");
ue_context_p->ue_context.UE_Capability_nr = UE_Capability_nr;
}
// NR RRCReconfiguration
AssertFatal(rrc->Nb_ue < MAX_NR_RRC_UE_CONTEXTS,"cannot add another UE\n");
ue_context_p->ue_context.reconfig = calloc(1,sizeof(NR_RRCReconfiguration_t));
@@ -237,22 +263,26 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
}
if (ue_context_p->ue_context.spCellConfig) {
fill_default_reconfig(carrier->servingcellconfigcommon,
ue_context_p->ue_context.spCellConfig->spCellConfigDedicated,
reconfig_ies,
ue_context_p->ue_context.secondaryCellGroup,
carrier->pdsch_AntennaPorts,
carrier->do_CSIRS,
carrier->initial_csi_index[ue_context_p->local_uid + 1],
ue_context_p->local_uid);
ue_context_p->ue_context.spCellConfig->spCellConfigDedicated,
reconfig_ies,
ue_context_p->ue_context.secondaryCellGroup,
carrier->pdsch_AntennaPorts,
carrier->minRXTXTIME,
carrier->do_CSIRS,
carrier->do_SRS,
carrier->initial_csi_index[ue_context_p->local_uid + 1],
ue_context_p->local_uid);
} else {
fill_default_reconfig(carrier->servingcellconfigcommon,
NULL,
reconfig_ies,
ue_context_p->ue_context.secondaryCellGroup,
carrier->pdsch_AntennaPorts,
carrier->do_CSIRS,
carrier->initial_csi_index[ue_context_p->local_uid + 1],
ue_context_p->local_uid);
NULL,
reconfig_ies,
ue_context_p->ue_context.secondaryCellGroup,
carrier->pdsch_AntennaPorts,
carrier->minRXTXTIME,
carrier->do_CSIRS,
carrier->do_SRS,
carrier->initial_csi_index[ue_context_p->local_uid + 1],
ue_context_p->local_uid);
}
ue_context_p->ue_id_rnti = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity;
NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config));
@@ -290,14 +320,18 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
create_tunnel_req.num_tunnels = m->nb_e_rabs_tobeadded;
RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[rrc->module_id]->rrc_ue_head, ue_context_p);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0,rrc->module_id);
gtpv1u_create_s1u_tunnel(
ctxt.instance,
&create_tunnel_req,
&create_tunnel_resp);
rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
&ctxt,
&create_tunnel_resp,
&inde_list[0]);
memset(&create_tunnel_resp, 0, sizeof(create_tunnel_resp));
if (!IS_SOFTMODEM_NOS1) {
LOG_D(RRC, "Calling gtpv1u_create_s1u_tunnel()\n");
gtpv1u_create_s1u_tunnel(
ctxt.instance,
&create_tunnel_req,
&create_tunnel_resp);
rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
&ctxt,
&create_tunnel_resp,
&inde_list[0]);
}
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).nb_e_rabs_admitted_tobeadded = m->nb_e_rabs_tobeadded;
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).target_assoc_id = m->target_assoc_id;
@@ -335,7 +369,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
NULL,
(void *)CG_Config,
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer,
1024);
sizeof(X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer));
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer_size = (enc_rval.encoded+7)>>3;
itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(0), msg); //Check right id instead of hardcoding
} else if (get_softmodem_params()->do_ra || get_softmodem_params()->sa) {
+46 -16
View File
@@ -55,12 +55,19 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
int scg_id,
int servCellIndex,
int dl_antenna_ports,
int minRXTXTIME,
int do_csirs,
int do_srs,
int initial_csi_index,
int uid) {
AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n");
AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n");
// This assert will never happen in the current implementation because NUMBER_OF_UE_MAX = 4.
// However, if in the future NUMBER_OF_UE_MAX is increased, it will be necessary to improve the allocation of SRS resources,
// where the startPosition = 2 or 3 and sl160 = 17, 17, 27 ... 157 only give us 30 different allocations.
AssertFatal(uid>=0 && uid<30, "gNB cannot allocate the SRS resources\n");
uint64_t bitmap=0;
switch (servingcellconfigcommon->ssb_PositionsInBurst->present) {
case 1 :
@@ -482,10 +489,10 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
NR_PDSCH_TimeDomainResourceAllocation_t *pdschi;
for (int i=0;i<servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count;i++) {
pdschi= calloc(1,sizeof(*pdschi));
AssertFatal(servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0!=NULL,"element %d is null\n",i);
pdschi->k0 = calloc(1,sizeof(*pdschi->k0));
*pdschi->k0 = *servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0;
if(servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0){
pdschi->k0 = calloc(1,sizeof(*pdschi->k0));
*pdschi->k0 = *servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0;
}
pdschi->mappingType = servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->mappingType;
pdschi->startSymbolAndLength = servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength;
ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,pdschi);
@@ -796,13 +803,21 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
*srs_resset0_id=0;
ASN_SEQUENCE_ADD(&srs_resset0->srs_ResourceIdList->list,srs_resset0_id);
srs_Config->srs_ResourceToReleaseList=NULL;
srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_aperiodic;
srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic));
srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1;
srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL;
srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset));
*srs_resset0->resourceType.choice.aperiodic->slotOffset=2;
srs_resset0->resourceType.choice.aperiodic->ext1=NULL;
if(do_srs) {
srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_periodic;
srs_resset0->resourceType.choice.periodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.periodic));
srs_resset0->resourceType.choice.periodic->associatedCSI_RS = NULL;
} else {
srs_resset0->resourceType.present = NR_SRS_ResourceSet__resourceType_PR_aperiodic;
srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic));
srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1;
srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL;
srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset));
*srs_resset0->resourceType.choice.aperiodic->slotOffset=2;
srs_resset0->resourceType.choice.aperiodic->ext1=NULL;
}
srs_resset0->usage=NR_SRS_ResourceSet__usage_codebook;
srs_resset0->alpha = calloc(1,sizeof(*srs_resset0->alpha));
*srs_resset0->alpha = NR_Alpha_alpha1;
@@ -821,17 +836,28 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
srs_res0->transmissionComb.choice.n2=calloc(1,sizeof(*srs_res0->transmissionComb.choice.n2));
srs_res0->transmissionComb.choice.n2->combOffset_n2=0;
srs_res0->transmissionComb.choice.n2->cyclicShift_n2=0;
srs_res0->resourceMapping.startPosition=2;
srs_res0->resourceMapping.startPosition = 2 + uid%2;
srs_res0->resourceMapping.nrofSymbols=NR_SRS_Resource__resourceMapping__nrofSymbols_n1;
srs_res0->resourceMapping.repetitionFactor=NR_SRS_Resource__resourceMapping__repetitionFactor_n1;
srs_res0->freqDomainPosition=0;
srs_res0->freqDomainShift=0;
srs_res0->freqHopping.c_SRS = 0;
srs_res0->freqHopping.b_SRS=0;
srs_res0->freqHopping.b_hop=0;
srs_res0->freqHopping.c_SRS = rrc_get_max_nr_csrs(
NRRIV2BW(servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, 275),
srs_res0->freqHopping.b_SRS);
srs_res0->groupOrSequenceHopping=NR_SRS_Resource__groupOrSequenceHopping_neither;
srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic;
srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic));
if(do_srs) {
srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_periodic;
srs_res0->resourceType.choice.periodic=calloc(1,sizeof(*srs_res0->resourceType.choice.periodic));
srs_res0->resourceType.choice.periodic->periodicityAndOffset_p.present = NR_SRS_PeriodicityAndOffset_PR_sl160;
srs_res0->resourceType.choice.periodic->periodicityAndOffset_p.choice.sl160 = 17 + (uid>1)*10; // 17/17/.../147/157 are mixed slots
} else {
srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic;
srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic));
}
srs_res0->sequenceId=40;
srs_res0->spatialRelationInfo=calloc(1,sizeof(*srs_res0->spatialRelationInfo));
srs_res0->spatialRelationInfo->servingCellId=NULL;
@@ -945,7 +971,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
long *delay[8];
for (int i=0;i<8;i++) {
delay[i] = calloc(1,sizeof(*delay[i]));
*delay[i] = (i<6) ? (i+2) : 0;
*delay[i] = i+minRXTXTIME;
ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]);
}
pucch_Config->spatialRelationInfoToAddModList = calloc(1,sizeof(*pucch_Config->spatialRelationInfoToAddModList));
@@ -1348,7 +1374,9 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
NR_RRCReconfiguration_IEs_t *reconfig,
NR_CellGroupConfig_t *secondaryCellGroup,
int dl_antenna_ports,
int minRXTXTIME,
int do_csirs,
int do_srs,
int initial_csi_index,
int uid) {
AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n");
@@ -1363,7 +1391,9 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
1,
1,
dl_antenna_ports,
minRXTXTIME,
do_csirs,
do_srs,
initial_csi_index,
uid);