From 0768dda232c21da4608d1c9058baa64d991f70fa Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 20 Oct 2020 10:53:35 +0200 Subject: [PATCH 001/135] first rrc config of CSI_RS resource --- openair2/RRC/NR/rrc_gNB_reconfig.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 3bc851ad03..310c7d3615 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1038,7 +1038,35 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csi_MeasConfig->csi_IM_ResourceSetToReleaseList = NULL; csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList = NULL; csi_MeasConfig->nzp_CSI_RS_ResourceSetToReleaseList = NULL; - csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList = NULL; + + csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList = calloc(1,sizeof(*csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList)); + + NR_NZP_CSI_RS_Resource_t *nzpcsi0 = calloc(1,sizeof(*nzpcsi0)); + nzpcsi0->nzp_CSI_RS_ResourceId = 0; + NR_CSI_RS_ResourceMapping_t resourceMapping; + resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2; + resourceMapping.frequencyDomainAllocation.choice.row2.buf = calloc(2, sizeof(uint8_t)); + resourceMapping.frequencyDomainAllocation.choice.row2.size = 2; + resourceMapping.frequencyDomainAllocation.choice.row2.bits_unused = 4; + resourceMapping.frequencyDomainAllocation.choice.row2.buf[0]=0; + resourceMapping.frequencyDomainAllocation.choice.row2.buf[1]=16; + resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1; + resourceMapping.firstOFDMSymbolInTimeDomain = 6; + resourceMapping.firstOFDMSymbolInTimeDomain2 = NULL; + resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM; + resourceMapping.density.present = NR_CSI_RS_ResourceMapping__density_PR_one; + resourceMapping.density.choice.one = (NULL_t)0; + resourceMapping.freqBand.startingRB = 0; + resourceMapping.freqBand.nrofRBs = 104; + nzpcsi0->resourceMapping = resourceMapping; + nzpcsi0->powerControlOffset = 0; + nzpcsi0->powerControlOffsetSS = NULL; + nzpcsi0->scramblingID = 50; + nzpcsi0->periodicityAndOffset = calloc(1,sizeof(*nzpcsi0->periodicityAndOffset)); + nzpcsi0->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots320; + nzpcsi0->periodicityAndOffset->choice.slots320 = 0; + nzpcsi0->qcl_InfoPeriodicCSI_RS = NULL; + ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpcsi0); csi_MeasConfig->csi_SSB_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_SSB_ResourceSetToAddModList)); csi_MeasConfig->csi_SSB_ResourceSetToReleaseList = NULL; From 40d637938d60a0ff55fe77996654ad3d207489ce Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 21 Oct 2020 10:19:36 +0200 Subject: [PATCH 002/135] MAC function to schedule CSI-RS --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 6 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 208 +++++++++++++++++- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 10 + 3 files changed, 221 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index d83e72c118..32f3045c23 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -456,9 +456,11 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, // This schedule SR // TODO - // This schedule CSI measurement reporting - if (UE_info->active[UE_id]) + // This schedule CSI-RS transmission and measurement reporting + if (UE_info->active[UE_id]){ + nr_csirs_scheduling(module_idP, UE_id, frame, slot, slots_per_frame[*scc->ssbSubcarrierSpacing]); nr_csi_meas_reporting(module_idP, UE_id, frame, slot, num_slots_per_tdd, nr_ulmix_slots, slots_per_frame[*scc->ssbSubcarrierSpacing]); + } // This schedule RA procedure if not in phy_test mode // Otherwise already consider 5G already connected diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index b8f0545a84..e255f7edb3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1880,6 +1880,145 @@ void get_pdsch_to_harq_feedback(int Mod_idP, } +void nr_csirs_scheduling(int Mod_idP, + int UE_id, + frame_t frame, + sub_frame_t slot, + int n_slots_frame){ + + int CC_id = 0; + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; + NR_CSI_MeasConfig_t *csi_measconfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + NR_NZP_CSI_RS_Resource_t *nzpcsi; + int period, offset; + gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; + nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; + NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[sched_ctrl->active_bwp->bwp_Id-1]; + + AssertFatal(csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count>0,"NO CSI report configuration available"); + + for (int id = 0; id < csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count; id++){ + nzpcsi = csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.array[id]; + NR_CSI_RS_ResourceMapping_t resourceMapping = nzpcsi->resourceMapping; + csi_period_offset(NULL,nzpcsi,&period,&offset); + + if((frame*n_slots_frame+slot-offset)%period == 0) { + + nfapi_nr_dl_tti_request_pdu_t *dl_tti_csirs_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; + memset((void*)dl_tti_csirs_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_csirs_pdu->PDUType = NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE; + dl_tti_csirs_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_csi_rs_pdu)); + + nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *csirs_pdu_rel15 = &dl_tti_csirs_pdu->csi_rs_pdu.csi_rs_pdu_rel15; + + csirs_pdu_rel15->bwp_size = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); + csirs_pdu_rel15->bwp_start = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); + csirs_pdu_rel15->subcarrier_spacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; + if (bwp->bwp_Common->genericParameters.cyclicPrefix) + csirs_pdu_rel15->cyclic_prefix = *bwp->bwp_Common->genericParameters.cyclicPrefix; + else + csirs_pdu_rel15->cyclic_prefix = 0; + + csirs_pdu_rel15->start_rb = resourceMapping.freqBand.startingRB; + csirs_pdu_rel15->nr_of_rbs = resourceMapping.freqBand.nrofRBs; + csirs_pdu_rel15->csi_type = 1; // NZP-CSI-RS + csirs_pdu_rel15->symb_l0 = resourceMapping.firstOFDMSymbolInTimeDomain; + if (resourceMapping.firstOFDMSymbolInTimeDomain2) + csirs_pdu_rel15->symb_l1 = *resourceMapping.firstOFDMSymbolInTimeDomain2; + csirs_pdu_rel15->cdm_type = resourceMapping.cdm_Type; + csirs_pdu_rel15->freq_density = resourceMapping.density.present; + if ((resourceMapping.density.present == NR_CSI_RS_ResourceMapping__density_PR_dot5) + && (resourceMapping.density.choice.dot5 == NR_CSI_RS_ResourceMapping__density__dot5_evenPRBs)) + csirs_pdu_rel15->freq_density--; + csirs_pdu_rel15->scramb_id = nzpcsi->scramblingID; + csirs_pdu_rel15->power_control_offset = nzpcsi->powerControlOffset + 8; + if (nzpcsi->powerControlOffsetSS) + csirs_pdu_rel15->power_control_offset_ss = *nzpcsi->powerControlOffsetSS; + switch(resourceMapping.frequencyDomainAllocation.present){ + case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1: + csirs_pdu_rel15->row = 1; + csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>4)&0x0f; + break; + case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2: + csirs_pdu_rel15->row = 2; + csirs_pdu_rel15->freq_domain = (((resourceMapping.frequencyDomainAllocation.choice.row1.buf[1]>>4)&0x0f) | + ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]<<8)&0xf0)); + break; + case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row4: + csirs_pdu_rel15->row = 4; + csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>5)&0x0f; + break; + case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other: + csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>2)&0x0f; + // determining the row of table 7.4.1.5.3-1 in 38.211 + switch(resourceMapping.nrofPorts){ + case NR_CSI_RS_ResourceMapping__nrofPorts_p1: + break; + case NR_CSI_RS_ResourceMapping__nrofPorts_p2: + csirs_pdu_rel15->row = 3; + break; + case NR_CSI_RS_ResourceMapping__nrofPorts_p4: + csirs_pdu_rel15->row = 5; + break; + case NR_CSI_RS_ResourceMapping__nrofPorts_p8: + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) + csirs_pdu_rel15->row = 8; + else{ + int num_k = 0; + for (int k=0; k<6; k++) + num_k+=(((csirs_pdu_rel15->freq_domain)>>k)&0x01); + if(num_k==4) + csirs_pdu_rel15->row = 6; + else + csirs_pdu_rel15->row = 7; + } + break; + case NR_CSI_RS_ResourceMapping__nrofPorts_p12: + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) + csirs_pdu_rel15->row = 10; + else + csirs_pdu_rel15->row = 9; + break; + case NR_CSI_RS_ResourceMapping__nrofPorts_p16: + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) + csirs_pdu_rel15->row = 12; + else + csirs_pdu_rel15->row = 11; + break; + case NR_CSI_RS_ResourceMapping__nrofPorts_p24: + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) + csirs_pdu_rel15->row = 14; + else{ + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) + csirs_pdu_rel15->row = 15; + else + csirs_pdu_rel15->row = 13; + } + break; + case NR_CSI_RS_ResourceMapping__nrofPorts_p32: + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) + csirs_pdu_rel15->row = 17; + else{ + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) + csirs_pdu_rel15->row = 18; + else + csirs_pdu_rel15->row = 16; + } + break; + default: + AssertFatal(1==0,"Invalid number of ports in CSI-RS resource\n"); + } + break; + default: + AssertFatal(1==0,"Invalid freqency domain allocation in CSI-RS resource\n"); + } + dl_req->nPDUs++; + } + } +} + uint16_t nr_get_csi_bitlen(int Mod_idP, int UE_id, uint8_t csi_report_id) { @@ -1898,8 +2037,74 @@ uint16_t nr_get_csi_bitlen(int Mod_idP, void csi_period_offset(NR_CSI_ReportConfig_t *csirep, + NR_NZP_CSI_RS_Resource_t *nzpcsi, int *period, int *offset) { + if(nzpcsi != NULL) { + + NR_CSI_ResourcePeriodicityAndOffset_PR p_and_o = nzpcsi->periodicityAndOffset->present; + + switch(p_and_o){ + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots4: + *period = 4; + *offset = nzpcsi->periodicityAndOffset->choice.slots4; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots5: + *period = 5; + *offset = nzpcsi->periodicityAndOffset->choice.slots5; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots8: + *period = 8; + *offset = nzpcsi->periodicityAndOffset->choice.slots8; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots10: + *period = 10; + *offset = nzpcsi->periodicityAndOffset->choice.slots10; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots16: + *period = 16; + *offset = nzpcsi->periodicityAndOffset->choice.slots16; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots20: + *period = 20; + *offset = nzpcsi->periodicityAndOffset->choice.slots20; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots32: + *period = 32; + *offset = nzpcsi->periodicityAndOffset->choice.slots32; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots40: + *period = 40; + *offset = nzpcsi->periodicityAndOffset->choice.slots40; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots64: + *period = 64; + *offset = nzpcsi->periodicityAndOffset->choice.slots64; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots80: + *period = 80; + *offset = nzpcsi->periodicityAndOffset->choice.slots80; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots160: + *period = 160; + *offset = nzpcsi->periodicityAndOffset->choice.slots160; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots320: + *period = 320; + *offset = nzpcsi->periodicityAndOffset->choice.slots320; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots640: + *period = 640; + *offset = nzpcsi->periodicityAndOffset->choice.slots640; + break; + default: + AssertFatal(1==0,"No periodicity and offset found in CSI resource"); + } + + } + + if(csirep != NULL) { + NR_CSI_ReportPeriodicityAndOffset_PR p_and_o = csirep->reportConfigType.choice.periodic->reportSlotConfig.present; switch(p_and_o){ @@ -1946,6 +2151,7 @@ void csi_period_offset(NR_CSI_ReportConfig_t *csirep, default: AssertFatal(1==0,"No periodicity and offset resource found in CSI report"); } + } } @@ -2048,7 +2254,7 @@ void nr_csi_meas_reporting(int Mod_idP, AssertFatal(csirep->reportConfigType.choice.periodic!=NULL,"Only periodic CSI reporting is implemented currently"); int period, offset, sched_slot; - csi_period_offset(csirep,&period,&offset); + csi_period_offset(csirep,NULL,&period,&offset); sched_slot = (period+offset)%n_slots_frame; // prepare to schedule csi measurement reception according to 5.2.1.4 in 38.214 // preparation is done in first slot of tdd period diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 5f5a33eb18..5a342622fe 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -201,6 +201,12 @@ void nr_schedule_pucch(int Mod_idP, frame_t frameP, sub_frame_t slotP); +void nr_csirs_scheduling(int Mod_idP, + int UE_id, + frame_t frame, + sub_frame_t slot, + int n_slots_frame); + void nr_csi_meas_reporting(int Mod_idP, int UE_id, frame_t frameP, @@ -209,6 +215,10 @@ void nr_csi_meas_reporting(int Mod_idP, int ul_slots, int n_slots_frame); +void csi_period_offset(NR_CSI_ReportConfig_t *csirep, + NR_NZP_CSI_RS_Resource_t *nzpcsi, + int *period, int *offset); + void nr_acknack_scheduling(int Mod_idP, int UE_id, frame_t frameP, From 1894cf1ea4cc2c79e4a1d7abd306f0fac7a9bd11 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 21 Oct 2020 11:44:52 +0200 Subject: [PATCH 003/135] including vrb map in csi function --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index e255f7edb3..0cb5d71930 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1894,6 +1894,7 @@ void nr_csirs_scheduling(int Mod_idP, NR_NZP_CSI_RS_Resource_t *nzpcsi; int period, offset; gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; + uint8_t *vrb_map = RC.nrmac[Mod_idP]->common_channels[CC_id].vrb_map; nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[sched_ctrl->active_bwp->bwp_Id-1]; @@ -2015,6 +2016,8 @@ void nr_csirs_scheduling(int Mod_idP, AssertFatal(1==0,"Invalid freqency domain allocation in CSI-RS resource\n"); } dl_req->nPDUs++; + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] = 1; } } } From dde3e87938f7c3f92eb178033b8d3a104cdc0d7f Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 21 Oct 2020 17:28:12 +0200 Subject: [PATCH 004/135] handling csirs and calling the phy function --- openair1/PHY/NR_TRANSPORT/nr_csi_rs.c | 30 +++++++++--------- .../PHY/NR_TRANSPORT/nr_transport_proto.h | 9 +++--- openair1/PHY/defs_gNB.h | 8 +++++ openair1/SCHED_NR/fapi_nr_l1.c | 31 +++++++++++++++++-- openair1/SCHED_NR/fapi_nr_l1.h | 4 +++ openair1/SCHED_NR/phy_procedures_nr_gNB.c | 12 +++++++ openair2/COMMON/platform_constants.h | 1 + 7 files changed, 74 insertions(+), 21 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c index 8e2119e1d5..f767bdd5c5 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c +++ b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c @@ -25,13 +25,16 @@ //#define NR_CSIRS_DEBUG -int nr_generate_csi_rs(uint32_t **gold_csi_rs, - int32_t** txdataF, - int16_t amp, - NR_DL_FRAME_PARMS frame_parms, - nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params) -{ +void nr_generate_csi_rs(PHY_VARS_gNB *gNB, + int16_t amp, + nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params, + int slot){ + + NR_DL_FRAME_PARMS frame_parms=gNB->frame_parms; + uint32_t **gold_csi_rs = gNB->nr_gold_csi_rs[slot]; + int32_t **txdataF = gNB->common_vars.txdataF; + int txdataF_offset = (slot%2)*frame_parms.samples_per_slot_wCP; int16_t mod_csi[frame_parms.symbols_per_slot][NR_MAX_CSI_RS_LENGTH>>1]; uint16_t b = csi_params.freq_domain; uint16_t n, csi_bw, csi_start, p, k, l, mprime, na, kpn, csi_length; @@ -586,16 +589,17 @@ int nr_generate_csi_rs(uint32_t **gold_csi_rs, } // ZP CSI RS if (csi_params.csi_type == 2) { - ((int16_t*)txdataF[p])[(l*frame_parms.ofdm_symbol_size + k)<<1] = 0; - ((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = 0; + ((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1)+(2*txdataF_offset)] = 0; + ((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1)+1+(2*txdataF_offset)] = 0; } else { - ((int16_t*)txdataF[p])[(l*frame_parms.ofdm_symbol_size + k)<<1] = (beta*wt*wf*mod_csi[l][mprime<<1]) >> 15; - ((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (beta*wt*wf*mod_csi[l][(mprime<<1) + 1]) >> 15; + ((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1)+(2*txdataF_offset)] = (beta*wt*wf*mod_csi[l][mprime<<1]) >> 15; + ((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1)+1+(2*txdataF_offset)] = (beta*wt*wf*mod_csi[l][(mprime<<1) + 1]) >> 15; } #ifdef NR_CSIRS_DEBUG - printf("l,k (%d %d) seq. index %d \t port %d \t (%d,%d)\n",l,k-start_sc,mprime,p+3000,((int16_t*)txdataF[p])[(l*frame_parms.ofdm_symbol_size + k)<<1], - ((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1]); + printf("l,k (%d %d) seq. index %d \t port %d \t (%d,%d)\n",l,k-start_sc,mprime,p+3000, + ((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1)+(2*txdataF_offset)], + ((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1)+1+(2*txdataF_offset)]); #endif } } @@ -603,6 +607,4 @@ int nr_generate_csi_rs(uint32_t **gold_csi_rs, } } } - - return 0; } diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h index 27aa48128a..ec1c262d11 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h @@ -326,11 +326,10 @@ void init_prach_list(PHY_VARS_gNB *gNB); void init_prach_ru_list(RU_t *ru); void free_nr_ru_prach_entry(RU_t *ru, int prach_id); -int nr_generate_csi_rs(uint32_t **gold_csi_rs, - int32_t **txdataF, - int16_t amp, - NR_DL_FRAME_PARMS frame_parms, - nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params); +void nr_generate_csi_rs(PHY_VARS_gNB *gNB, + int16_t amp, + nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params, + int slot); void nr_decode_pucch1(int32_t **rxdataF, pucch_GroupHopping_t pucch_GroupHopping, diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 3d73483dfd..3fcc9541fe 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -118,6 +118,13 @@ typedef struct { nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu; } NR_gNB_PDCCH_t; +typedef struct { + uint8_t active; + int frame; + int slot; + nfapi_nr_dl_tti_csi_rs_pdu csirs_pdu; +} NR_gNB_CSIRS_t; + typedef struct { int frame; int slot; @@ -712,6 +719,7 @@ typedef struct PHY_VARS_gNB_s { NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX]; NR_gNB_PUCCH_t *pucch[NUMBER_OF_NR_PUCCH_MAX]; NR_gNB_PDCCH_t pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX]; + NR_gNB_CSIRS_t csirs_pdu[NUMBER_OF_NR_CSIRS_MAX]; NR_gNB_UL_PDCCH_t ul_pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX]; NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2]; // Nusers times two spatial streams NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX][2]; // [Nusers times][2 codewords] diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index 84490bfad4..e6176a87a1 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -98,10 +98,9 @@ void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB, nr_fill_dci(gNB,frame,slot,pdcch_pdu); - - } + void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu) { @@ -115,6 +114,28 @@ void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB, } + +void handle_nfapi_nr_csirs_pdu(PHY_VARS_gNB *gNB, + int frame, int slot, + nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu) { + + int found = 0; + + for (int id=0; idcsirs_pdu[id]; + if (csirs->active == 0) { + csirs->frame = frame; + csirs->slot = slot; + csirs->active = 1; + memcpy((void*)&csirs->csirs_pdu, (void*)csirs_pdu, sizeof(nfapi_nr_dl_tti_csi_rs_pdu)); + found = 1; + } + } + if (found == 0) + LOG_E(MAC,"CSI-RS list is full\n"); +} + + void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, uint8_t *sdu) @@ -184,6 +205,12 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ pdcch_received = 1; break; + case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE: + LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot); + handle_nfapi_nr_csirs_pdu(gNB, + frame, slot, + &dl_tti_pdu->csi_rs_pdu); + break; case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE: { diff --git a/openair1/SCHED_NR/fapi_nr_l1.h b/openair1/SCHED_NR/fapi_nr_l1.h index d66d6e7b24..cd4aa06623 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.h +++ b/openair1/SCHED_NR/fapi_nr_l1.h @@ -38,6 +38,10 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO); +void handle_nfapi_nr_csirs_pdu(PHY_VARS_gNB *gNB, + int frame, int slot, + nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu); + void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB, int frame, int subframe, nfapi_nr_dl_tti_pdcch_pdu *dcl_dl_pdu); diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 38ed59e18f..275d7050fa 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -197,6 +197,18 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0); } + + for (int i=0;icsirs_pdu[i]; + if ((csirs->active == 1) && + (csirs->frame == frame) && + (csirs->slot == slot) ) { + LOG_D(PHY, "CSI-RS generation started in frame %d.%d\n",frame,slot); + nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params = csirs->csirs_pdu.csi_rs_pdu_rel15; + nr_generate_csi_rs(gNB, AMP, csi_params, slot); + } + } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX+offset,0); } diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index af364437b8..1cdda40529 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -105,6 +105,7 @@ #define NUMBER_OF_NR_PUCCH_MAX 16 #define NUMBER_OF_NR_SR_MAX 16 #define NUMBER_OF_NR_PDCCH_MAX 16 +#define NUMBER_OF_NR_CSIRS_MAX 16 #define MAX_MANAGED_ENB_PER_MOBILE 2 #define MAX_MANAGED_GNB_PER_MOBILE 2 From cea71b473ce61f2444c8f52322c14a7737374ae6 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 22 Oct 2020 10:46:04 +0200 Subject: [PATCH 005/135] fixes for csi-rs amplitude --- openair1/PHY/NR_TRANSPORT/nr_csi_rs.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 2 ++ openair2/RRC/NR/rrc_gNB_reconfig.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c index f767bdd5c5..1888dcbeba 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c +++ b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c @@ -44,7 +44,7 @@ void nr_generate_csi_rs(PHY_VARS_gNB *gNB, int wf, wt, lp, kp, symb; uint8_t fi = 0; double rho, alpha; - uint32_t beta; + uint32_t beta = amp; AssertFatal(b!=0, "Invalid CSI frequency domain mapping: no bit selected in bitmap\n"); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 0cb5d71930..55c6afbb92 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1937,6 +1937,8 @@ void nr_csirs_scheduling(int Mod_idP, csirs_pdu_rel15->power_control_offset = nzpcsi->powerControlOffset + 8; if (nzpcsi->powerControlOffsetSS) csirs_pdu_rel15->power_control_offset_ss = *nzpcsi->powerControlOffsetSS; + else + csirs_pdu_rel15->power_control_offset_ss = 1; // 0 dB switch(resourceMapping.frequencyDomainAllocation.present){ case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1: csirs_pdu_rel15->row = 1; diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 310c7d3615..ac84afc510 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1060,7 +1060,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco resourceMapping.freqBand.nrofRBs = 104; nzpcsi0->resourceMapping = resourceMapping; nzpcsi0->powerControlOffset = 0; - nzpcsi0->powerControlOffsetSS = NULL; + nzpcsi0->powerControlOffsetSS=calloc(1,sizeof(*nzpcsi0->powerControlOffsetSS)); + *nzpcsi0->powerControlOffsetSS = NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0; nzpcsi0->scramblingID = 50; nzpcsi0->periodicityAndOffset = calloc(1,sizeof(*nzpcsi0->periodicityAndOffset)); nzpcsi0->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots320; From a83dc45c68ef97d9a1eeb7b1b7c06e3419af8ba2 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 27 Oct 2020 10:48:22 +0100 Subject: [PATCH 006/135] changes in logging for CSI RS and cleaning some other logging --- openair1/PHY/NR_TRANSPORT/nr_csi_rs.c | 2 +- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 22 +++++++++---------- openair1/SCHED_NR/fapi_nr_l1.c | 3 ++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 4 +++- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c index 1888dcbeba..150f57b174 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c +++ b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c @@ -23,7 +23,7 @@ #include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/MODULATION/nr_modulation.h" -//#define NR_CSIRS_DEBUG +#define NR_CSIRS_DEBUG void nr_generate_csi_rs(PHY_VARS_gNB *gNB, diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 1fd89ea568..1fa2786a63 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -412,7 +412,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0; uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); uci_pdu->harq->harq_list[0].harq_value = index&0x01; - LOG_I(PHY, "Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d\n", + LOG_D(PHY, "Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d\n", slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); @@ -427,7 +427,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2); uci_pdu->harq->harq_list[1].harq_value = index&0x01; uci_pdu->harq->harq_list[0].harq_value = (index>>1)&0x01; - LOG_I(PHY, "Slot %d HARQ values %d and %d with confidence level (0 is good, 1 is bad) %d\n", + LOG_D(PHY, "Slot %d HARQ values %d and %d with confidence level (0 is good, 1 is bad) %d\n", slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); @@ -1464,7 +1464,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, } } // cw loop corr_dB = dB_fixed64((uint64_t)corr); - LOG_I(PHY,"cw_ML %d, metric %d dB\n",cw_ML,corr_dB); + LOG_D(PHY,"cw_ML %d, metric %d dB\n",cw_ML,corr_dB); decodedPayload[0]=(uint64_t)cw_ML; } else { // polar coded case @@ -1519,11 +1519,11 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, if (cw==0) corr += ((int64_t)corr32_re[half_prb>>2][aa]*corr32_re[half_prb>>2][aa])+ ((int64_t)corr32_im[half_prb>>2][aa]*corr32_im[half_prb>>2][aa]); - + corr_re = ( corr32_re[half_prb>>2][aa]/(2*nc_group_size*4/2)+((int16_t*)(&prod_re[aa]))[0]); corr_im = ( corr32_im[half_prb>>2][aa]/(2*nc_group_size*4/2)+((int16_t*)(&prod_im[aa]))[0]); corr_tmp += corr_re*corr_re + corr_im*corr_im; - /* + LOG_D(PHY,"pucch2 half_prb %d cw %d (%d,%d) aa %d: (%d,%d,%d,%d,%d,%d,%d,%d)x(%d,%d,%d,%d,%d,%d,%d,%d) (%d,%d)+(%d,%d) = (%d,%d) => %d\n", half_prb,cw,cw&15,cw>>4,aa, ((int16_t*)&pucch2_polar_4bit[cw&15])[0],((int16_t*)&pucch2_polar_4bit[cw>>4])[0], @@ -1540,15 +1540,15 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, corr_re, corr_im, corr_tmp); - */ + } corr16 = _mm_set1_epi16((int16_t)(corr_tmp>>8)); - /* + LOG_D(PHY,"half_prb %d cw %d corr16 %d\n",half_prb,cw,corr_tmp>>8); - */ + llr_num = _mm_max_epi16(_mm_mullo_epi16(corr16,pucch2_polar_llr_num_lut[cw]),llr_num); llr_den = _mm_max_epi16(_mm_mullo_epi16(corr16,pucch2_polar_llr_den_lut[cw]),llr_den); - /* + LOG_D(PHY,"lut_num (%d,%d,%d,%d,%d,%d,%d,%d)\n", ((int16_t*)&pucch2_polar_llr_num_lut[cw])[0], ((int16_t*)&pucch2_polar_llr_num_lut[cw])[1], @@ -1558,7 +1558,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ((int16_t*)&pucch2_polar_llr_num_lut[cw])[5], ((int16_t*)&pucch2_polar_llr_num_lut[cw])[6], ((int16_t*)&pucch2_polar_llr_num_lut[cw])[7]); - + LOG_D(PHY,"llr_num (%d,%d,%d,%d,%d,%d,%d,%d)\n", ((int16_t*)&llr_num)[0], ((int16_t*)&llr_num)[1], @@ -1577,7 +1577,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ((int16_t*)&llr_den)[5], ((int16_t*)&llr_den)[6], ((int16_t*)&llr_den)[7]); - */ + } // compute llrs llrs[half_prb] = _mm_subs_epi16(llr_num,llr_den); diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index e6176a87a1..2b5e3bf32d 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -124,6 +124,7 @@ void handle_nfapi_nr_csirs_pdu(PHY_VARS_gNB *gNB, for (int id=0; idcsirs_pdu[id]; if (csirs->active == 0) { + LOG_I(PHY,"Frame %d Slot %d CSI_RS with ID %d is now active\n",frame,slot,id); csirs->frame = frame; csirs->slot = slot; csirs->active = 1; @@ -206,7 +207,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ break; case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE: - LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot); + LOG_I(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot); handle_nfapi_nr_csirs_pdu(gNB, frame, slot, &dl_tti_pdu->csi_rs_pdu); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 32f3045c23..28347eba01 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -372,7 +372,7 @@ void nr_schedule_pucch(int Mod_idP, memset(pucch_pdu,0,sizeof(nfapi_nr_pucch_pdu_t)); UL_tti_req->n_pdus+=1; - LOG_I(MAC,"Scheduling pucch reception for frame %d slot %d with (%d, %d, %d) (SR ACK, CSI) bits\n", + LOG_D(MAC,"Scheduling pucch reception for frame %d slot %d with (%d, %d, %d) (SR ACK, CSI) bits\n", frameP,slotP,O_sr,O_ack,curr_pucch->csi_bits); nr_configure_pucch(pucch_pdu, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 55c6afbb92..0101a9aa34 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1907,6 +1907,8 @@ void nr_csirs_scheduling(int Mod_idP, if((frame*n_slots_frame+slot-offset)%period == 0) { + LOG_I(MAC,"Scheduling CSI-RS in frame %d slot %d\n",frame,slot); + nfapi_nr_dl_tti_request_pdu_t *dl_tti_csirs_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset((void*)dl_tti_csirs_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); dl_tti_csirs_pdu->PDUType = NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE; @@ -2217,7 +2219,7 @@ void compute_csi_bitlen (NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_info_t UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; } - LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", + LOG_D (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d\n", UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); From 23164bd8ae21b03b05cd52621d30130a78a6a223 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 27 Oct 2020 10:58:22 +0100 Subject: [PATCH 007/135] bugfixes in handling csirs in fapi functions --- openair1/SCHED_NR/fapi_nr_l1.c | 1 + openair1/SCHED_NR/phy_procedures_nr_gNB.c | 1 + 2 files changed, 2 insertions(+) diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index 2b5e3bf32d..0756804168 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -130,6 +130,7 @@ void handle_nfapi_nr_csirs_pdu(PHY_VARS_gNB *gNB, csirs->active = 1; memcpy((void*)&csirs->csirs_pdu, (void*)csirs_pdu, sizeof(nfapi_nr_dl_tti_csi_rs_pdu)); found = 1; + break; } } if (found == 0) diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 275d7050fa..30144a1b87 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -206,6 +206,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, LOG_D(PHY, "CSI-RS generation started in frame %d.%d\n",frame,slot); nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params = csirs->csirs_pdu.csi_rs_pdu_rel15; nr_generate_csi_rs(gNB, AMP, csi_params, slot); + csirs->active = 0; } } From e8d4d6a1385296d7bebfb470c8302c58119f082a Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Mon, 2 Nov 2020 19:10:17 +0100 Subject: [PATCH 008/135] change in RRC for csi rsrp --- openair2/RRC/NR/rrc_gNB_reconfig.c | 35 +++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index ac84afc510..e767e809ac 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1036,7 +1036,18 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csi_MeasConfig->csi_IM_ResourceToReleaseList = NULL; csi_MeasConfig->csi_IM_ResourceSetToAddModList = NULL; csi_MeasConfig->csi_IM_ResourceSetToReleaseList = NULL; - csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList = NULL; + + csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList)); + NR_NZP_CSI_RS_ResourceSet_t *nzpcsirs0 = calloc(1,sizeof(*nzpcsirs0)); + nzpcsirs0->nzp_CSI_ResourceSetId = 0; + NR_NZP_CSI_RS_ResourceId_t *nzpid0 = calloc(1,sizeof(*nzpid0)); + *nzpid0 = 0; + ASN_SEQUENCE_ADD(&nzpcsirs0->nzp_CSI_RS_Resources,nzpid0); + nzpcsirs0->repetition = NULL; + nzpcsirs0->aperiodicTriggeringOffset = NULL; + nzpcsirs0->trs_Info = NULL; + ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list,nzpcsirs0); + csi_MeasConfig->nzp_CSI_RS_ResourceSetToReleaseList = NULL; csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList = calloc(1,sizeof(*csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList)); @@ -1069,10 +1080,11 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco nzpcsi0->qcl_InfoPeriodicCSI_RS = NULL; ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpcsi0); - csi_MeasConfig->csi_SSB_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_SSB_ResourceSetToAddModList)); + //csi_MeasConfig->csi_SSB_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_SSB_ResourceSetToAddModList)); + csi_MeasConfig->csi_SSB_ResourceSetToAddModList = NULL; csi_MeasConfig->csi_SSB_ResourceSetToReleaseList = NULL; - NR_CSI_SSB_ResourceSet_t *ssbresset0 = calloc(1,sizeof(*ssbresset0)); + /*NR_CSI_SSB_ResourceSet_t *ssbresset0 = calloc(1,sizeof(*ssbresset0)); ssbresset0->csi_SSB_ResourceSetId=0; if ((bitmap>>7)&0x01){ NR_SSB_Index_t *ssbresset00=calloc(1,sizeof(*ssbresset00)); @@ -1114,7 +1126,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco *ssbresset07=7; ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset07); } - ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list,ssbresset0); + ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list,ssbresset0);*/ csi_MeasConfig->csi_ResourceConfigToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_ResourceConfigToAddModList)); csi_MeasConfig->csi_ResourceConfigToReleaseList = NULL; @@ -1122,11 +1134,16 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csires0->csi_ResourceConfigId=0; csires0->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB)); - csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = NULL; + csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = NULL; + csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList)); + NR_NZP_CSI_RS_ResourceSetId_t *nzp0 = calloc(1,sizeof(*nzp0)); + *nzp0 = 0; + ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,nzp0); + /*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = NULL; csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList)); NR_CSI_SSB_ResourceSetId_t *ssbres00 = calloc(1,sizeof(*ssbres00)); *ssbres00 = 0; - ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list,ssbres00); + ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list,ssbres00);*/ csires0->bwp_Id = 1; csires0->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires0); @@ -1147,8 +1164,10 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pucchcsires1->uplinkBandwidthPartId=1; pucchcsires1->pucch_Resource=3; ASN_SEQUENCE_ADD(&csirep1->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); - csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP; - csirep1->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0; + csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP; + csirep1->reportQuantity.choice.cri_RSRP=(NULL_t)0; + /*csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP; + csirep1->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0;*/ csirep1->reportFreqConfiguration = calloc(1,sizeof(*csirep1->reportFreqConfiguration)); csirep1->reportFreqConfiguration->cqi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI; csirep1->reportFreqConfiguration->pmi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__pmi_FormatIndicator_widebandPMI; From 74f8337fe192d5229ab847bdaf1542005dd3438b Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 3 Nov 2020 10:33:18 +0100 Subject: [PATCH 009/135] cherry-picking changes for cri-rsrp bitlen from TCI_UCI branch --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 80 +++++++++++-------- 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 0101a9aa34..2f6be0bbe9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2038,7 +2038,7 @@ uint16_t nr_get_csi_bitlen(int Mod_idP, csi_bitlen = ((CSI_report_bitlen->cri_ssbri_bitlen * CSI_report_bitlen->nb_ssbri_cri) + CSI_report_bitlen->rsrp_bitlen +(CSI_report_bitlen->diff_rsrp_bitlen * (CSI_report_bitlen->nb_ssbri_cri -1 )) *UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report); - +printf("%d\n",csi_bitlen); return csi_bitlen; } @@ -2170,6 +2170,8 @@ void compute_csi_bitlen (NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_info_t NR_CSI_MeasConfig_t *csi_MeasConfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; NR_CSI_ResourceConfigId_t csi_ResourceConfigId; + struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = NULL; + for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; @@ -2181,55 +2183,67 @@ void compute_csi_bitlen (NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_info_t //Finding the CSI_RS or SSB Resources UE_info->csi_report_template[UE_id][csi_report_id].CSI_Resource_type= csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.present; if (NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB ==UE_info->csi_report_template[UE_id][csi_report_id].CSI_Resource_type){ - struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB; + nzp_CSI_RS_SSB = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB; UE_info->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report = nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count:0; UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = nzp_CSI_RS_SSB->csi_SSB_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count:0; } - if (0 != UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report){ - uint8_t nb_ssb_resources =0; - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) { ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig - if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { - if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; - else + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { + //if (0 != UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report) + uint8_t nb_resources =0; + + if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { + if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; + else /*! From Spec 38.331 * nrofReportedRS * The number (N) of measured RS resources to be reported per report setting in a non-group-based report. N <= N_max, where N_max is either 2 or 4 depending on UE * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. * When the field is absent the UE applies the value 1 */ - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 1; - }else - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 2; + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 1; + } + else + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 2; - nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - if (nb_ssb_resources){ - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - } - else{ - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; - } + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) + ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig + nb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; + break ; + } + } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) + ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 - LOG_D (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d\n", - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); + nb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; break ; } } + if (nb_resources) { + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_resources)); + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + } else { + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; + } + + LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); + } - if (0 != UE_info->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report){ - AssertFatal(1==0,"Currently configuring only SSB beamreporting."); - } break; } } From e7a3cb295e539d028888731642faf4db76dfda5b Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Mon, 9 Nov 2020 18:13:35 +0100 Subject: [PATCH 010/135] uint in corr for pucch rx --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 1fa2786a63..cdad497bf1 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -337,8 +337,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, #endif } } - int32_t corr_re,corr_im,temp,no_corr=0; - int32_t av_corr=0; + int32_t corr_re,corr_im; + uint32_t temp,no_corr=0; + uint32_t av_corr=0; int seq_index; for(i=0;i Date: Tue, 10 Nov 2020 14:14:44 +0100 Subject: [PATCH 011/135] using cell id as scrambling id for csi-rs --- openair1/PHY/INIT/nr_init.c | 2 +- openair1/PHY/NR_TRANSPORT/nr_csi_rs.c | 20 ++++++++++++++++++- .../PHY/NR_TRANSPORT/nr_transport_proto.h | 1 + openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- openair2/RRC/NR/rrc_gNB_reconfig.c | 2 +- 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 413228f021..1859bfb90a 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -196,7 +196,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, } } - nr_init_csi_rs(gNB, 0); // TODO scramblingID currently hardcoded to 0, to be taken from higher layer parameter scramblingID when implemented + nr_init_csi_rs(gNB, cfg->cell_config.phy_cell_id.value); // TODO scramblingID currently hardcoded to 0, to be taken from higher layer parameter scramblingID when implemented /// Transport init necessary for NR synchro init_nr_transport(gNB); diff --git a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c index 150f57b174..8f7837c15b 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c +++ b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c @@ -22,6 +22,7 @@ #include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/MODULATION/nr_modulation.h" +#include "PHY/NR_REFSIG/nr_refsig.h" #define NR_CSIRS_DEBUG @@ -29,12 +30,13 @@ void nr_generate_csi_rs(PHY_VARS_gNB *gNB, int16_t amp, nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params, + uint16_t cell_id, int slot){ NR_DL_FRAME_PARMS frame_parms=gNB->frame_parms; - uint32_t **gold_csi_rs = gNB->nr_gold_csi_rs[slot]; int32_t **txdataF = gNB->common_vars.txdataF; int txdataF_offset = (slot%2)*frame_parms.samples_per_slot_wCP; + uint32_t **gold_csi_rs = gNB->nr_gold_csi_rs[slot]; int16_t mod_csi[frame_parms.symbols_per_slot][NR_MAX_CSI_RS_LENGTH>>1]; uint16_t b = csi_params.freq_domain; uint16_t n, csi_bw, csi_start, p, k, l, mprime, na, kpn, csi_length; @@ -48,6 +50,22 @@ void nr_generate_csi_rs(PHY_VARS_gNB *gNB, AssertFatal(b!=0, "Invalid CSI frequency domain mapping: no bit selected in bitmap\n"); + // pre-computed for scrambling id equel to cell id + // if the scrambling id is not the cell id we need to re-initialize the rs + if (csi_params.scramb_id != cell_id) { + uint8_t reset; + uint32_t x1, x2; + uint32_t Nid = csi_params.scramb_id; + for (uint8_t symb=0; symbslot == slot) ) { LOG_D(PHY, "CSI-RS generation started in frame %d.%d\n",frame,slot); nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params = csirs->csirs_pdu.csi_rs_pdu_rel15; - nr_generate_csi_rs(gNB, AMP, csi_params, slot); + nr_generate_csi_rs(gNB, AMP, csi_params, gNB->gNB_config.cell_config.phy_cell_id.value, slot); csirs->active = 0; } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 2f6be0bbe9..af3a2b9d99 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2038,7 +2038,7 @@ uint16_t nr_get_csi_bitlen(int Mod_idP, csi_bitlen = ((CSI_report_bitlen->cri_ssbri_bitlen * CSI_report_bitlen->nb_ssbri_cri) + CSI_report_bitlen->rsrp_bitlen +(CSI_report_bitlen->diff_rsrp_bitlen * (CSI_report_bitlen->nb_ssbri_cri -1 )) *UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report); -printf("%d\n",csi_bitlen); + return csi_bitlen; } diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index e767e809ac..c84872ec45 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1073,7 +1073,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco nzpcsi0->powerControlOffset = 0; nzpcsi0->powerControlOffsetSS=calloc(1,sizeof(*nzpcsi0->powerControlOffsetSS)); *nzpcsi0->powerControlOffsetSS = NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0; - nzpcsi0->scramblingID = 50; + nzpcsi0->scramblingID = *servingcellconfigcommon->physCellId; nzpcsi0->periodicityAndOffset = calloc(1,sizeof(*nzpcsi0->periodicityAndOffset)); nzpcsi0->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots320; nzpcsi0->periodicityAndOffset->choice.slots320 = 0; From f7827a1d2b8e94d1618d7817ab810037198b169d Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 10 Nov 2020 16:39:41 +0100 Subject: [PATCH 012/135] fix for dword length in csi rs --- openair1/PHY/NR_REFSIG/nr_gold.c | 2 +- openair1/PHY/NR_TRANSPORT/nr_csi_rs.c | 69 +++++++++++++-------------- 2 files changed, 33 insertions(+), 38 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/nr_gold.c b/openair1/PHY/NR_REFSIG/nr_gold.c index b253e7e904..11e28a3046 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold.c +++ b/openair1/PHY/NR_REFSIG/nr_gold.c @@ -145,7 +145,7 @@ void nr_init_csi_rs(PHY_VARS_gNB* gNB, uint32_t Nid) reset = 1; x2 = ((1<<10) * (fp->symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid)); - for (uint32_t n=0; n>1)<>1)<>1)<>15; - break; - - case 1: - beta = amp; - break; + // assuming amp is the amplitude of SSB channels + switch (csi_params.power_control_offset_ss) { + case 0: + beta = (amp*ONE_OVER_SQRT2_Q15)>>15; + break; + case 1: + beta = amp; + break; + case 2: + beta = (amp*ONE_OVER_SQRT2_Q15)>>14; + break; + case 3: + beta = amp<<1; + break; + default: + AssertFatal(0==1, "Invalid SS power offset density index for CSI\n"); + } - case 2: - beta = (amp*ONE_OVER_SQRT2_Q15)>>14; - break; - - case 3: - beta = amp<<1; - break; - - default: - AssertFatal(0==1, "Invalid SS power offset density index for CSI\n"); - } - - for (lp=0; lp<=lprime; lp++){ - symb = csi_params.symb_l0; - nr_modulation(gold_csi_rs[symb+lp], csi_length, DMRS_MOD_ORDER, mod_csi[symb+lp]); - if ((csi_params.row == 5) || (csi_params.row == 7) || (csi_params.row == 11) || (csi_params.row == 13) || (csi_params.row == 16)) - nr_modulation(gold_csi_rs[symb+1], csi_length, DMRS_MOD_ORDER, mod_csi[symb+1]); - if ((csi_params.row == 14) || (csi_params.row == 13) || (csi_params.row == 16) || (csi_params.row == 17)) { - symb = csi_params.symb_l1; - nr_modulation(gold_csi_rs[symb+lp], csi_length, DMRS_MOD_ORDER, mod_csi[symb+lp]); - if ((csi_params.row == 13) || (csi_params.row == 16)) - nr_modulation(gold_csi_rs[symb+1], csi_length, DMRS_MOD_ORDER, mod_csi[symb+1]); - } - } - + for (lp=0; lp<=lprime; lp++){ + symb = csi_params.symb_l0; + nr_modulation(gold_csi_rs[symb+lp], csi_length, DMRS_MOD_ORDER, mod_csi[symb+lp]); + if ((csi_params.row == 5) || (csi_params.row == 7) || (csi_params.row == 11) || (csi_params.row == 13) || (csi_params.row == 16)) + nr_modulation(gold_csi_rs[symb+1], csi_length, DMRS_MOD_ORDER, mod_csi[symb+1]); + if ((csi_params.row == 14) || (csi_params.row == 13) || (csi_params.row == 16) || (csi_params.row == 17)) { + symb = csi_params.symb_l1; + nr_modulation(gold_csi_rs[symb+lp], csi_length, DMRS_MOD_ORDER, mod_csi[symb+lp]); + if ((csi_params.row == 13) || (csi_params.row == 16)) + nr_modulation(gold_csi_rs[symb+1], csi_length, DMRS_MOD_ORDER, mod_csi[symb+1]); + } + } } uint16_t start_sc = frame_parms.first_carrier_offset; From b05bfa04dbf9e15a121e6669e902d6f7ff00727f Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Mon, 16 Nov 2020 14:18:43 +0100 Subject: [PATCH 013/135] fix segmentation fault in csi-rs --- openair1/PHY/NR_TRANSPORT/nr_csi_rs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c index 0efd9b8fca..87edb7a157 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c +++ b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c @@ -37,7 +37,7 @@ void nr_generate_csi_rs(PHY_VARS_gNB *gNB, int32_t **txdataF = gNB->common_vars.txdataF; int txdataF_offset = (slot%2)*frame_parms.samples_per_slot_wCP; uint32_t **gold_csi_rs = gNB->nr_gold_csi_rs[slot]; - int16_t mod_csi[frame_parms.symbols_per_slot][NR_MAX_CSI_RS_LENGTH>>1]; + int16_t mod_csi[frame_parms.symbols_per_slot][NR_MAX_CSI_RS_LENGTH>>1] __attribute__((aligned(16)));; uint16_t b = csi_params.freq_domain; uint16_t n, csi_bw, csi_start, p, k, l, mprime, na, kpn, csi_length; uint8_t size, ports, kprime, lprime, i, gs; From 1ebc9a64e0c593cc668acd6d569d30cf01b26354 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 20 Nov 2020 10:22:10 +0100 Subject: [PATCH 014/135] uci mac functions in a new file --- cmake_targets/CMakeLists.txt | 1 + openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 55 -- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 94 --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 476 ------------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 662 ++++++++++++++++++ openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 4 + 6 files changed, 667 insertions(+), 625 deletions(-) create mode 100644 openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 193ab82d0e..a75be0a221 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1907,6 +1907,7 @@ set (MAC_NR_SRC ${NR_GNB_MAC_DIR}/gNB_scheduler_ulsch.c ${NR_GNB_MAC_DIR}/gNB_scheduler_primitives.c ${NR_GNB_MAC_DIR}/gNB_scheduler_phytest.c + ${NR_GNB_MAC_DIR}/gNB_scheduler_uci.c ${NR_GNB_MAC_DIR}/gNB_scheduler_RA.c ) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 28347eba01..74fa7a2074 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -337,61 +337,6 @@ void nr_schedule_pusch(int Mod_idP, } } - -void nr_schedule_pucch(int Mod_idP, - int UE_id, - int nr_ulmix_slots, - frame_t frameP, - sub_frame_t slotP) { - - uint16_t O_csi, O_ack, O_uci; - uint8_t O_sr = 0; // no SR in PUCCH implemented for now - NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon; - NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; - AssertFatal(UE_info->active[UE_id],"Cannot find UE_id %d is not active\n",UE_id); - - NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; - int bwp_id=1; - NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]; - nfapi_nr_ul_tti_request_t *UL_tti_req = &RC.nrmac[Mod_idP]->UL_tti_req[0]; - - NR_sched_pucch *curr_pucch; - - for (int k=0; kUE_sched_ctrl[UE_id].sched_pucch[k][l]; - O_ack = curr_pucch->dai_c; - O_csi = curr_pucch->csi_bits; - O_uci = O_ack + O_csi + O_sr; - if ((O_uci>0) && (frameP == curr_pucch->frame) && (slotP == curr_pucch->ul_slot)) { - UL_tti_req->SFN = curr_pucch->frame; - UL_tti_req->Slot = curr_pucch->ul_slot; - UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE; - UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pucch_pdu_t); - nfapi_nr_pucch_pdu_t *pucch_pdu = &UL_tti_req->pdus_list[UL_tti_req->n_pdus].pucch_pdu; - memset(pucch_pdu,0,sizeof(nfapi_nr_pucch_pdu_t)); - UL_tti_req->n_pdus+=1; - - LOG_D(MAC,"Scheduling pucch reception for frame %d slot %d with (%d, %d, %d) (SR ACK, CSI) bits\n", - frameP,slotP,O_sr,O_ack,curr_pucch->csi_bits); - - nr_configure_pucch(pucch_pdu, - scc, - ubwp, - UE_info->rnti[UE_id], - curr_pucch->resource_indicator, - O_csi, - O_ack, - O_sr); - - memset((void *) &UE_info->UE_sched_ctrl[UE_id].sched_pucch[k][l], - 0, - sizeof(NR_sched_pucch)); - } - } - } -} - bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { return (bitmap >> slot) & 0x01; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 74bef2920f..b31eee48f7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -343,100 +343,6 @@ int nr_generate_dlsch_pdu(module_id_t module_idP, return offset; } -void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, - nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, - nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, - NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats) { - - // TODO - int max_harq_rounds = 4; // TODO define macro - - if (uci_01 != NULL) { - // handle harq - int harq_idx_s = 0; - - // iterate over received harq bits - for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) { - // search for the right harq process - for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES; harq_idx++) { - // if the gNB received ack with a good confidence - if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { - if ((uci_01->harq->harq_list[harq_bit].harq_value == 1) && - (uci_01->harq->harq_confidence_level == 0)) { - // toggle NDI and reset round - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - } - else - sched_ctrl->harq_processes[harq_idx].round++; - sched_ctrl->harq_processes[harq_idx].is_waiting = 0; - harq_idx_s = harq_idx + 1; - // if the max harq rounds was reached - if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - stats->dlsch_errors++; - } - break; - } - // if feedback slot processing is aborted - else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && - (sched_ctrl->harq_processes[harq_idx].is_waiting)) { - sched_ctrl->harq_processes[harq_idx].round++; - if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - } - sched_ctrl->harq_processes[harq_idx].is_waiting = 0; - } - } - } - } - - - if (uci_234 != NULL) { - int harq_idx_s = 0; - int acknack; - - // iterate over received harq bits - for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { - acknack = ((uci_234->harq.harq_payload[harq_bit>>3])>>harq_bit)&0x01; - for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES-1; harq_idx++) { - // if the gNB received ack with a good confidence or if the max harq rounds was reached - if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { - // TODO add some confidence level for when there is no CRC - if ((uci_234->harq.harq_crc != 1) && acknack) { - // toggle NDI and reset round - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - } - else - sched_ctrl->harq_processes[harq_idx].round++; - sched_ctrl->harq_processes[harq_idx].is_waiting = 0; - harq_idx_s = harq_idx + 1; - // if the max harq rounds was reached - if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - stats->dlsch_errors++; - } - break; - } - // if feedback slot processing is aborted - else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && - (sched_ctrl->harq_processes[harq_idx].is_waiting)) { - sched_ctrl->harq_processes[harq_idx].round++; - if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { - sched_ctrl->harq_processes[harq_idx].ndi ^= 1; - sched_ctrl->harq_processes[harq_idx].round = 0; - } - sched_ctrl->harq_processes[harq_idx].is_waiting = 0; - } - } - } - } -} - int getNrOfSymbols(NR_BWP_Downlink_t *bwp, int tda) { struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index af3a2b9d99..c0a0d47905 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -931,84 +931,6 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, } -uint16_t compute_pucch_prb_size(uint8_t format, - uint8_t nr_prbs, - uint16_t O_tot, - uint16_t O_csi, - NR_PUCCH_MaxCodeRate_t *maxCodeRate, - uint8_t Qm, - uint8_t n_symb, - uint8_t n_re_ctrl) { - - uint16_t O_crc; - - if (O_tot<12) - O_crc = 0; - else{ - if (O_tot<20) - O_crc = 6; - else { - if (O_tot<360) - O_crc = 11; - else - AssertFatal(1==0,"Case for segmented PUCCH not yet implemented"); - } - } - - int rtimes100; - switch(*maxCodeRate){ - case NR_PUCCH_MaxCodeRate_zeroDot08 : - rtimes100 = 8; - break; - case NR_PUCCH_MaxCodeRate_zeroDot15 : - rtimes100 = 15; - break; - case NR_PUCCH_MaxCodeRate_zeroDot25 : - rtimes100 = 25; - break; - case NR_PUCCH_MaxCodeRate_zeroDot35 : - rtimes100 = 35; - break; - case NR_PUCCH_MaxCodeRate_zeroDot45 : - rtimes100 = 45; - break; - case NR_PUCCH_MaxCodeRate_zeroDot60 : - rtimes100 = 60; - break; - case NR_PUCCH_MaxCodeRate_zeroDot80 : - rtimes100 = 80; - break; - default : - AssertFatal(1==0,"Invalid MaxCodeRate"); - } - - float r = (float)rtimes100/100; - - if (O_csi == O_tot) { - if ((O_tot+O_csi)>(nr_prbs*n_re_ctrl*n_symb*Qm*r)) - AssertFatal(1==0,"MaxCodeRate %.2f can't support %d UCI bits and %d CRC bits with %d PRBs", - r,O_tot,O_crc,nr_prbs); - else - return nr_prbs; - } - - if (format==2){ - // TODO fix this for multiple CSI reports - for (int i=1; i<=nr_prbs; i++){ - if((O_tot+O_crc)<=(i*n_symb*Qm*n_re_ctrl*r) && - (O_tot+O_crc)>((i-1)*n_symb*Qm*n_re_ctrl*r)) - return i; - } - AssertFatal(1==0,"MaxCodeRate %.2f can't support %d UCI bits and %d CRC bits with at most %d PRBs", - r,O_tot,O_crc,nr_prbs); - } - else{ - AssertFatal(1==0,"Not yet implemented"); - } - -} - - void prepare_dci(NR_CellGroupConfig_t *secondaryCellGroup, dci_pdu_rel15_t *dci_pdu_rel15, nr_dci_format_t format, @@ -2026,404 +1948,6 @@ void nr_csirs_scheduling(int Mod_idP, } } -uint16_t nr_get_csi_bitlen(int Mod_idP, - int UE_id, - uint8_t csi_report_id) { - - uint16_t csi_bitlen =0; - NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; - CRI_SSBRI_RSRP_bitlen_t * CSI_report_bitlen = NULL; - - CSI_report_bitlen = &(UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0]); - csi_bitlen = ((CSI_report_bitlen->cri_ssbri_bitlen * CSI_report_bitlen->nb_ssbri_cri) + - CSI_report_bitlen->rsrp_bitlen +(CSI_report_bitlen->diff_rsrp_bitlen * - (CSI_report_bitlen->nb_ssbri_cri -1 )) *UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report); - - return csi_bitlen; -} - - -void csi_period_offset(NR_CSI_ReportConfig_t *csirep, - NR_NZP_CSI_RS_Resource_t *nzpcsi, - int *period, int *offset) { - - if(nzpcsi != NULL) { - - NR_CSI_ResourcePeriodicityAndOffset_PR p_and_o = nzpcsi->periodicityAndOffset->present; - - switch(p_and_o){ - case NR_CSI_ResourcePeriodicityAndOffset_PR_slots4: - *period = 4; - *offset = nzpcsi->periodicityAndOffset->choice.slots4; - break; - case NR_CSI_ResourcePeriodicityAndOffset_PR_slots5: - *period = 5; - *offset = nzpcsi->periodicityAndOffset->choice.slots5; - break; - case NR_CSI_ResourcePeriodicityAndOffset_PR_slots8: - *period = 8; - *offset = nzpcsi->periodicityAndOffset->choice.slots8; - break; - case NR_CSI_ResourcePeriodicityAndOffset_PR_slots10: - *period = 10; - *offset = nzpcsi->periodicityAndOffset->choice.slots10; - break; - case NR_CSI_ResourcePeriodicityAndOffset_PR_slots16: - *period = 16; - *offset = nzpcsi->periodicityAndOffset->choice.slots16; - break; - case NR_CSI_ResourcePeriodicityAndOffset_PR_slots20: - *period = 20; - *offset = nzpcsi->periodicityAndOffset->choice.slots20; - break; - case NR_CSI_ResourcePeriodicityAndOffset_PR_slots32: - *period = 32; - *offset = nzpcsi->periodicityAndOffset->choice.slots32; - break; - case NR_CSI_ResourcePeriodicityAndOffset_PR_slots40: - *period = 40; - *offset = nzpcsi->periodicityAndOffset->choice.slots40; - break; - case NR_CSI_ResourcePeriodicityAndOffset_PR_slots64: - *period = 64; - *offset = nzpcsi->periodicityAndOffset->choice.slots64; - break; - case NR_CSI_ResourcePeriodicityAndOffset_PR_slots80: - *period = 80; - *offset = nzpcsi->periodicityAndOffset->choice.slots80; - break; - case NR_CSI_ResourcePeriodicityAndOffset_PR_slots160: - *period = 160; - *offset = nzpcsi->periodicityAndOffset->choice.slots160; - break; - case NR_CSI_ResourcePeriodicityAndOffset_PR_slots320: - *period = 320; - *offset = nzpcsi->periodicityAndOffset->choice.slots320; - break; - case NR_CSI_ResourcePeriodicityAndOffset_PR_slots640: - *period = 640; - *offset = nzpcsi->periodicityAndOffset->choice.slots640; - break; - default: - AssertFatal(1==0,"No periodicity and offset found in CSI resource"); - } - - } - - if(csirep != NULL) { - - NR_CSI_ReportPeriodicityAndOffset_PR p_and_o = csirep->reportConfigType.choice.periodic->reportSlotConfig.present; - - switch(p_and_o){ - case NR_CSI_ReportPeriodicityAndOffset_PR_slots4: - *period = 4; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots4; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots5: - *period = 5; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots5; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots8: - *period = 8; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots8; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots10: - *period = 10; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots10; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots16: - *period = 16; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots16; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots20: - *period = 20; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots20; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots40: - *period = 40; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots40; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots80: - *period = 80; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots80; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots160: - *period = 160; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots160; - break; - case NR_CSI_ReportPeriodicityAndOffset_PR_slots320: - *period = 320; - *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320; - break; - default: - AssertFatal(1==0,"No periodicity and offset resource found in CSI report"); - } - } -} - - -//!TODO : same function can be written to handle csi_resources -void compute_csi_bitlen (NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_info_t *UE_info, int UE_id) { - uint8_t csi_report_id = 0; - uint8_t csi_resourceidx =0; - uint8_t csi_ssb_idx =0; - - NR_CSI_MeasConfig_t *csi_MeasConfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; - NR_CSI_ResourceConfigId_t csi_ResourceConfigId; - struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = NULL; - - for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ - csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; - UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; - - for ( csi_resourceidx = 0; csi_resourceidx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_resourceidx++) { - if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_ResourceConfigId != csi_ResourceConfigId) - continue; - else { - //Finding the CSI_RS or SSB Resources - UE_info->csi_report_template[UE_id][csi_report_id].CSI_Resource_type= csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.present; - if (NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB ==UE_info->csi_report_template[UE_id][csi_report_id].CSI_Resource_type){ - nzp_CSI_RS_SSB = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB; - - UE_info->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report = nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count:0; - UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = nzp_CSI_RS_SSB->csi_SSB_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count:0; - } - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { - //if (0 != UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report) - uint8_t nb_resources =0; - - if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == - csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { - if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; - else - /*! From Spec 38.331 - * nrofReportedRS - * The number (N) of measured RS resources to be reported per report setting in a non-group-based report. N <= N_max, where N_max is either 2 or 4 depending on UE - * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. - * When the field is absent the UE applies the value 1 - */ - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 1; - } - else - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 2; - - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) - ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig - nb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - break ; - } - } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) - ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 - - nb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; - break ; - } - } - if (nb_resources) { - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_resources)); - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - } else { - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; - } - - LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, - UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); - - } - break; - } - } - } -} - -void nr_csi_meas_reporting(int Mod_idP, - int UE_id, - frame_t frame, - sub_frame_t slot, - int slots_per_tdd, - int ul_slots, - int n_slots_frame) { - - NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; - NR_sched_pucch *curr_pucch; - NR_PUCCH_ResourceSet_t *pucchresset; - NR_CSI_ReportConfig_t *csirep; - NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; - NR_CSI_MeasConfig_t *csi_measconfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; - NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]; - NR_PUCCH_Config_t *pucch_Config = ubwp->bwp_Dedicated->pucch_Config->choice.setup; - - AssertFatal(csi_measconfig->csi_ReportConfigToAddModList->list.count>0,"NO CSI report configuration available"); - - for (int csi_report_id = 0; csi_report_id < csi_measconfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ - - csirep = csi_measconfig->csi_ReportConfigToAddModList->list.array[csi_report_id]; - - AssertFatal(csirep->reportConfigType.choice.periodic!=NULL,"Only periodic CSI reporting is implemented currently"); - int period, offset, sched_slot; - csi_period_offset(csirep,NULL,&period,&offset); - sched_slot = (period+offset)%n_slots_frame; - // prepare to schedule csi measurement reception according to 5.2.1.4 in 38.214 - // preparation is done in first slot of tdd period - if ( (frame%(period/n_slots_frame)==(offset/n_slots_frame)) && (slot==((sched_slot/slots_per_tdd)*slots_per_tdd))) { - - // we are scheduling pucch for csi in the first pucch occasion (this comes before ack/nack) - curr_pucch = &UE_info->UE_sched_ctrl[UE_id].sched_pucch[sched_slot-slots_per_tdd+ul_slots][0]; - - NR_PUCCH_CSI_Resource_t *pucchcsires = csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list.array[0]; - - int found = -1; - pucchresset = pucch_Config->resourceSetToAddModList->list.array[1]; // set with formats >1 - int n_list = pucchresset->resourceList.list.count; - for (int i=0; iresourceList.list.array[i] == pucchcsires->pucch_Resource) - found = i; - } - AssertFatal(found>-1,"CSI resource not found among PUCCH resources"); - - curr_pucch->resource_indicator = found; - - n_list = pucch_Config->resourceToAddModList->list.count; - - // going through the list of PUCCH resources to find the one indexed by resource_id - for (int i=0; iresourceToAddModList->list.array[i]; - if (pucchres->pucch_ResourceId == *pucchresset->resourceList.list.array[found]) { - switch(pucchres->format.present){ - case NR_PUCCH_Resource__format_PR_format2: - if (pucch_Config->format2->choice.setup->simultaneousHARQ_ACK_CSI == NULL) - curr_pucch->simultaneous_harqcsi = false; - else - curr_pucch->simultaneous_harqcsi = true; - break; - case NR_PUCCH_Resource__format_PR_format3: - if (pucch_Config->format3->choice.setup->simultaneousHARQ_ACK_CSI == NULL) - curr_pucch->simultaneous_harqcsi = false; - else - curr_pucch->simultaneous_harqcsi = true; - break; - case NR_PUCCH_Resource__format_PR_format4: - if (pucch_Config->format4->choice.setup->simultaneousHARQ_ACK_CSI == NULL) - curr_pucch->simultaneous_harqcsi = false; - else - curr_pucch->simultaneous_harqcsi = true; - break; - default: - AssertFatal(1==0,"Invalid PUCCH format type"); - } - } - } - curr_pucch->csi_bits += nr_get_csi_bitlen(Mod_idP,UE_id,csi_report_id); // TODO function to compute CSI meas report bit size - curr_pucch->frame = frame; - curr_pucch->ul_slot = sched_slot; - } - } -} - - -// function to update pucch scheduling parameters in UE list when a USS DL is scheduled -void nr_acknack_scheduling(int Mod_idP, - int UE_id, - frame_t frameP, - sub_frame_t slotP, - int slots_per_tdd, - int *pucch_id, - int *pucch_occ) { - - NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon; - NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; - NR_sched_pucch *curr_pucch; - int max_acknacks,pucch_res,first_ul_slot_tdd,k,i,l; - uint8_t pdsch_to_harq_feedback[8]; - int found = 0; - int nr_ulmix_slots = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; - if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0) - nr_ulmix_slots++; - - bool csi_pres=false; - for (k=0; kUE_sched_ctrl[UE_id].sched_pucch[k][0].csi_bits>0) - csi_pres=true; - } - - // As a preference always schedule ack nacks in PUCCH0 (max 2 per slots) - // Unless there is CSI meas reporting scheduled in the period to avoid conflicts in the same slot - if (csi_pres) - max_acknacks=10; - else - max_acknacks=2; - - // this is hardcoded for now as ue specific - NR_SearchSpace__searchSpaceType_PR ss_type = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - get_pdsch_to_harq_feedback(Mod_idP,UE_id,ss_type,pdsch_to_harq_feedback); - - // for each possible ul or mixed slot - for (k=0; kUE_sched_ctrl[UE_id].sched_pucch[k][l]; - //if it is possible to schedule acknack in current pucch (no exclusive csi pucch) - if ((curr_pucch->csi_bits == 0) || (curr_pucch->simultaneous_harqcsi==true)) { - // if there is free room in current pucch structure - if (curr_pucch->dai_c-1){ - curr_pucch->resource_indicator = pucch_res; - curr_pucch->frame = frameP; - // first pucch occasion in first UL or MIXED slot - first_ul_slot_tdd = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots; - i = 0; - while (i<8 && found == 0) { // look if timing indicator is among allowed values - if (pdsch_to_harq_feedback[i]==(first_ul_slot_tdd+k)-(slotP % slots_per_tdd)) - found = 1; - if (found == 0) i++; - } - if (found == 1) { - // computing slot in which pucch is scheduled - curr_pucch->dai_c++; - curr_pucch->ul_slot = first_ul_slot_tdd + k + (slotP - (slotP % slots_per_tdd)); - curr_pucch->timing_indicator = i; // index in the list of timing indicators - *pucch_id = k; - *pucch_occ = l; - return; - } - } - } - } - } - } - AssertFatal(1==0,"No Uplink slot available in accordance to allowed timing indicator\n"); -} - - -int get_pucch_resource(NR_UE_info_t *UE_info,int UE_id,int k,int l) { - - // to be updated later, for now simple implementation - // use the second allocation just in case there is csi in the first - // in that case use second resource (for a different symbol) see 9.2 in 38.213 - if (l==1) { - if (UE_info->UE_sched_ctrl[UE_id].sched_pucch[k][0].csi_bits==0) - return -1; - else - return 1; - } - else - return 0; - -} void find_aggregation_candidates(uint8_t *aggregation_level, uint8_t *nr_of_candidates, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c new file mode 100644 index 0000000000..bf77310372 --- /dev/null +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -0,0 +1,662 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file gNB_scheduler_uci.c + * \brief MAC procedures related to UCI + * \date 2020 + * \version 1.0 + * \company Eurecom + */ + +#include "LAYER2/MAC/mac.h" +#include "NR_MAC_gNB/nr_mac_gNB.h" +#include "NR_MAC_COMMON/nr_mac_extern.h" +#include "NR_MAC_gNB/mac_proto.h" +#include "common/ran_context.h" + +extern RAN_CONTEXT_t RC; + +void nr_schedule_pucch(int Mod_idP, + int UE_id, + int nr_ulmix_slots, + frame_t frameP, + sub_frame_t slotP) { + + uint16_t O_csi, O_ack, O_uci; + uint8_t O_sr = 0; // no SR in PUCCH implemented for now + NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon; + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + AssertFatal(UE_info->active[UE_id],"Cannot find UE_id %d is not active\n",UE_id); + + NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; + int bwp_id=1; + NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]; + nfapi_nr_ul_tti_request_t *UL_tti_req = &RC.nrmac[Mod_idP]->UL_tti_req[0]; + + NR_sched_pucch *curr_pucch; + + for (int k=0; kUE_sched_ctrl[UE_id].sched_pucch[k][l]; + O_ack = curr_pucch->dai_c; + O_csi = curr_pucch->csi_bits; + O_uci = O_ack + O_csi + O_sr; + if ((O_uci>0) && (frameP == curr_pucch->frame) && (slotP == curr_pucch->ul_slot)) { + UL_tti_req->SFN = curr_pucch->frame; + UL_tti_req->Slot = curr_pucch->ul_slot; + UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE; + UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pucch_pdu_t); + nfapi_nr_pucch_pdu_t *pucch_pdu = &UL_tti_req->pdus_list[UL_tti_req->n_pdus].pucch_pdu; + memset(pucch_pdu,0,sizeof(nfapi_nr_pucch_pdu_t)); + UL_tti_req->n_pdus+=1; + + LOG_D(MAC,"Scheduling pucch reception for frame %d slot %d with (%d, %d, %d) (SR ACK, CSI) bits\n", + frameP,slotP,O_sr,O_ack,curr_pucch->csi_bits); + + nr_configure_pucch(pucch_pdu, + scc, + ubwp, + UE_info->rnti[UE_id], + curr_pucch->resource_indicator, + O_csi, + O_ack, + O_sr); + + memset((void *) &UE_info->UE_sched_ctrl[UE_id].sched_pucch[k][l], + 0, + sizeof(NR_sched_pucch)); + } + } + } +} + + +//!TODO : same function can be written to handle csi_resources +void compute_csi_bitlen (NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_info_t *UE_info, int UE_id) { + uint8_t csi_report_id = 0; + uint8_t csi_resourceidx =0; + uint8_t csi_ssb_idx =0; + + NR_CSI_MeasConfig_t *csi_MeasConfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + NR_CSI_ResourceConfigId_t csi_ResourceConfigId; + struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = NULL; + + for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ + csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; + UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; + + for ( csi_resourceidx = 0; csi_resourceidx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_resourceidx++) { + if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_ResourceConfigId != csi_ResourceConfigId) + continue; + else { + //Finding the CSI_RS or SSB Resources + UE_info->csi_report_template[UE_id][csi_report_id].CSI_Resource_type= csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.present; + if (NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB ==UE_info->csi_report_template[UE_id][csi_report_id].CSI_Resource_type){ + nzp_CSI_RS_SSB = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB; + + UE_info->csi_report_template[UE_id][csi_report_id].nb_of_nzp_csi_report = nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count:0; + UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = nzp_CSI_RS_SSB->csi_SSB_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count:0; + } + + if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type || + NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { + //if (0 != UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report) + uint8_t nb_resources =0; + + if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == + csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.present ) { + if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; + else + /*! From Spec 38.331 + * nrofReportedRS + * The number (N) of measured RS resources to be reported per report setting in a non-group-based report. N <= N_max, where N_max is either 2 or 4 depending on UE + * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. + * When the field is absent the UE applies the value 1 + */ + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 1; + } + else + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].nb_ssbri_cri= 2; + + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type) { + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) + ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig + nb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; + break ; + } + } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ + for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.count; csi_ssb_idx++) { + if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == + *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) + ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 + + nb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; + break ; + } + } + if (nb_resources) { + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =ceil(log2 (nb_resources)); + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + } else { + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen =0; + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen = 0; + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; + } + + LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, + UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); + + } + break; + } + } + } +} + + +uint16_t nr_get_csi_bitlen(int Mod_idP, + int UE_id, + uint8_t csi_report_id) { + + uint16_t csi_bitlen =0; + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + CRI_SSBRI_RSRP_bitlen_t * CSI_report_bitlen = NULL; + + CSI_report_bitlen = &(UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0]); + csi_bitlen = ((CSI_report_bitlen->cri_ssbri_bitlen * CSI_report_bitlen->nb_ssbri_cri) + + CSI_report_bitlen->rsrp_bitlen +(CSI_report_bitlen->diff_rsrp_bitlen * + (CSI_report_bitlen->nb_ssbri_cri -1 )) *UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report); + + return csi_bitlen; +} + + +void nr_csi_meas_reporting(int Mod_idP, + int UE_id, + frame_t frame, + sub_frame_t slot, + int slots_per_tdd, + int ul_slots, + int n_slots_frame) { + + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + NR_sched_pucch *curr_pucch; + NR_PUCCH_ResourceSet_t *pucchresset; + NR_CSI_ReportConfig_t *csirep; + NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; + NR_CSI_MeasConfig_t *csi_measconfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]; + NR_PUCCH_Config_t *pucch_Config = ubwp->bwp_Dedicated->pucch_Config->choice.setup; + + AssertFatal(csi_measconfig->csi_ReportConfigToAddModList->list.count>0,"NO CSI report configuration available"); + + for (int csi_report_id = 0; csi_report_id < csi_measconfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ + + csirep = csi_measconfig->csi_ReportConfigToAddModList->list.array[csi_report_id]; + + AssertFatal(csirep->reportConfigType.choice.periodic!=NULL,"Only periodic CSI reporting is implemented currently"); + int period, offset, sched_slot; + csi_period_offset(csirep,NULL,&period,&offset); + sched_slot = (period+offset)%n_slots_frame; + // prepare to schedule csi measurement reception according to 5.2.1.4 in 38.214 + // preparation is done in first slot of tdd period + if ( (frame%(period/n_slots_frame)==(offset/n_slots_frame)) && (slot==((sched_slot/slots_per_tdd)*slots_per_tdd))) { + + // we are scheduling pucch for csi in the first pucch occasion (this comes before ack/nack) + curr_pucch = &UE_info->UE_sched_ctrl[UE_id].sched_pucch[sched_slot-slots_per_tdd+ul_slots][0]; + + NR_PUCCH_CSI_Resource_t *pucchcsires = csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list.array[0]; + + int found = -1; + pucchresset = pucch_Config->resourceSetToAddModList->list.array[1]; // set with formats >1 + int n_list = pucchresset->resourceList.list.count; + for (int i=0; iresourceList.list.array[i] == pucchcsires->pucch_Resource) + found = i; + } + AssertFatal(found>-1,"CSI resource not found among PUCCH resources"); + + curr_pucch->resource_indicator = found; + + n_list = pucch_Config->resourceToAddModList->list.count; + + // going through the list of PUCCH resources to find the one indexed by resource_id + for (int i=0; iresourceToAddModList->list.array[i]; + if (pucchres->pucch_ResourceId == *pucchresset->resourceList.list.array[found]) { + switch(pucchres->format.present){ + case NR_PUCCH_Resource__format_PR_format2: + if (pucch_Config->format2->choice.setup->simultaneousHARQ_ACK_CSI == NULL) + curr_pucch->simultaneous_harqcsi = false; + else + curr_pucch->simultaneous_harqcsi = true; + break; + case NR_PUCCH_Resource__format_PR_format3: + if (pucch_Config->format3->choice.setup->simultaneousHARQ_ACK_CSI == NULL) + curr_pucch->simultaneous_harqcsi = false; + else + curr_pucch->simultaneous_harqcsi = true; + break; + case NR_PUCCH_Resource__format_PR_format4: + if (pucch_Config->format4->choice.setup->simultaneousHARQ_ACK_CSI == NULL) + curr_pucch->simultaneous_harqcsi = false; + else + curr_pucch->simultaneous_harqcsi = true; + break; + default: + AssertFatal(1==0,"Invalid PUCCH format type"); + } + } + } + curr_pucch->csi_bits += nr_get_csi_bitlen(Mod_idP,UE_id,csi_report_id); // TODO function to compute CSI meas report bit size + curr_pucch->frame = frame; + curr_pucch->ul_slot = sched_slot; + } + } +} + + +void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, + nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, + nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, + NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats) { + + // TODO + int max_harq_rounds = 4; // TODO define macro + + if (uci_01 != NULL) { + // handle harq + int harq_idx_s = 0; + + // iterate over received harq bits + for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) { + // search for the right harq process + for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES; harq_idx++) { + // if the gNB received ack with a good confidence + if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { + if ((uci_01->harq->harq_list[harq_bit].harq_value == 1) && + (uci_01->harq->harq_confidence_level == 0)) { + // toggle NDI and reset round + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + } + else + sched_ctrl->harq_processes[harq_idx].round++; + sched_ctrl->harq_processes[harq_idx].is_waiting = 0; + harq_idx_s = harq_idx + 1; + // if the max harq rounds was reached + if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + stats->dlsch_errors++; + } + break; + } + // if feedback slot processing is aborted + else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && + (sched_ctrl->harq_processes[harq_idx].is_waiting)) { + sched_ctrl->harq_processes[harq_idx].round++; + if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + } + sched_ctrl->harq_processes[harq_idx].is_waiting = 0; + } + } + } + } + + if (uci_234 != NULL) { + int harq_idx_s = 0; + int acknack; + + // iterate over received harq bits + for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { + acknack = ((uci_234->harq.harq_payload[harq_bit>>3])>>harq_bit)&0x01; + for (int harq_idx = harq_idx_s; harq_idx < NR_MAX_NB_HARQ_PROCESSES-1; harq_idx++) { + // if the gNB received ack with a good confidence or if the max harq rounds was reached + if ((UL_info->slot-1) == sched_ctrl->harq_processes[harq_idx].feedback_slot) { + // TODO add some confidence level for when there is no CRC + if ((uci_234->harq.harq_crc != 1) && acknack) { + // toggle NDI and reset round + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + } + else + sched_ctrl->harq_processes[harq_idx].round++; + sched_ctrl->harq_processes[harq_idx].is_waiting = 0; + harq_idx_s = harq_idx + 1; + // if the max harq rounds was reached + if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + stats->dlsch_errors++; + } + break; + } + // if feedback slot processing is aborted + else if (((UL_info->slot-1) > sched_ctrl->harq_processes[harq_idx].feedback_slot) && + (sched_ctrl->harq_processes[harq_idx].is_waiting)) { + sched_ctrl->harq_processes[harq_idx].round++; + if (sched_ctrl->harq_processes[harq_idx].round == max_harq_rounds) { + sched_ctrl->harq_processes[harq_idx].ndi ^= 1; + sched_ctrl->harq_processes[harq_idx].round = 0; + } + sched_ctrl->harq_processes[harq_idx].is_waiting = 0; + } + } + } + } +} + + +// function to update pucch scheduling parameters in UE list when a USS DL is scheduled +void nr_acknack_scheduling(int Mod_idP, + int UE_id, + frame_t frameP, + sub_frame_t slotP, + int slots_per_tdd, + int *pucch_id, + int *pucch_occ) { + + NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon; + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + NR_sched_pucch *curr_pucch; + int max_acknacks,pucch_res,first_ul_slot_tdd,k,i,l; + uint8_t pdsch_to_harq_feedback[8]; + int found = 0; + int nr_ulmix_slots = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; + if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0) + nr_ulmix_slots++; + + bool csi_pres=false; + for (k=0; kUE_sched_ctrl[UE_id].sched_pucch[k][0].csi_bits>0) + csi_pres=true; + } + + // As a preference always schedule ack nacks in PUCCH0 (max 2 per slots) + // Unless there is CSI meas reporting scheduled in the period to avoid conflicts in the same slot + if (csi_pres) + max_acknacks=10; + else + max_acknacks=2; + + // this is hardcoded for now as ue specific + NR_SearchSpace__searchSpaceType_PR ss_type = NR_SearchSpace__searchSpaceType_PR_ue_Specific; + get_pdsch_to_harq_feedback(Mod_idP,UE_id,ss_type,pdsch_to_harq_feedback); + + // for each possible ul or mixed slot + for (k=0; kUE_sched_ctrl[UE_id].sched_pucch[k][l]; + //if it is possible to schedule acknack in current pucch (no exclusive csi pucch) + if ((curr_pucch->csi_bits == 0) || (curr_pucch->simultaneous_harqcsi==true)) { + // if there is free room in current pucch structure + if (curr_pucch->dai_c-1){ + curr_pucch->resource_indicator = pucch_res; + curr_pucch->frame = frameP; + // first pucch occasion in first UL or MIXED slot + first_ul_slot_tdd = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots; + i = 0; + while (i<8 && found == 0) { // look if timing indicator is among allowed values + if (pdsch_to_harq_feedback[i]==(first_ul_slot_tdd+k)-(slotP % slots_per_tdd)) + found = 1; + if (found == 0) i++; + } + if (found == 1) { + // computing slot in which pucch is scheduled + curr_pucch->dai_c++; + curr_pucch->ul_slot = first_ul_slot_tdd + k + (slotP - (slotP % slots_per_tdd)); + curr_pucch->timing_indicator = i; // index in the list of timing indicators + *pucch_id = k; + *pucch_occ = l; + return; + } + } + } + } + } + } + AssertFatal(1==0,"No Uplink slot available in accordance to allowed timing indicator\n"); +} + + +void csi_period_offset(NR_CSI_ReportConfig_t *csirep, + NR_NZP_CSI_RS_Resource_t *nzpcsi, + int *period, int *offset) { + + if(nzpcsi != NULL) { + + NR_CSI_ResourcePeriodicityAndOffset_PR p_and_o = nzpcsi->periodicityAndOffset->present; + + switch(p_and_o){ + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots4: + *period = 4; + *offset = nzpcsi->periodicityAndOffset->choice.slots4; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots5: + *period = 5; + *offset = nzpcsi->periodicityAndOffset->choice.slots5; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots8: + *period = 8; + *offset = nzpcsi->periodicityAndOffset->choice.slots8; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots10: + *period = 10; + *offset = nzpcsi->periodicityAndOffset->choice.slots10; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots16: + *period = 16; + *offset = nzpcsi->periodicityAndOffset->choice.slots16; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots20: + *period = 20; + *offset = nzpcsi->periodicityAndOffset->choice.slots20; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots32: + *period = 32; + *offset = nzpcsi->periodicityAndOffset->choice.slots32; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots40: + *period = 40; + *offset = nzpcsi->periodicityAndOffset->choice.slots40; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots64: + *period = 64; + *offset = nzpcsi->periodicityAndOffset->choice.slots64; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots80: + *period = 80; + *offset = nzpcsi->periodicityAndOffset->choice.slots80; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots160: + *period = 160; + *offset = nzpcsi->periodicityAndOffset->choice.slots160; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots320: + *period = 320; + *offset = nzpcsi->periodicityAndOffset->choice.slots320; + break; + case NR_CSI_ResourcePeriodicityAndOffset_PR_slots640: + *period = 640; + *offset = nzpcsi->periodicityAndOffset->choice.slots640; + break; + default: + AssertFatal(1==0,"No periodicity and offset found in CSI resource"); + } + + } + + if(csirep != NULL) { + + NR_CSI_ReportPeriodicityAndOffset_PR p_and_o = csirep->reportConfigType.choice.periodic->reportSlotConfig.present; + + switch(p_and_o){ + case NR_CSI_ReportPeriodicityAndOffset_PR_slots4: + *period = 4; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots4; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots5: + *period = 5; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots5; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots8: + *period = 8; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots8; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots10: + *period = 10; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots10; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots16: + *period = 16; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots16; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots20: + *period = 20; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots20; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots40: + *period = 40; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots40; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots80: + *period = 80; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots80; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots160: + *period = 160; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots160; + break; + case NR_CSI_ReportPeriodicityAndOffset_PR_slots320: + *period = 320; + *offset = csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320; + break; + default: + AssertFatal(1==0,"No periodicity and offset resource found in CSI report"); + } + } +} + + +int get_pucch_resource(NR_UE_info_t *UE_info,int UE_id,int k,int l) { + + // to be updated later, for now simple implementation + // use the second allocation just in case there is csi in the first + // in that case use second resource (for a different symbol) see 9.2 in 38.213 + if (l==1) { + if (UE_info->UE_sched_ctrl[UE_id].sched_pucch[k][0].csi_bits==0) + return -1; + else + return 1; + } + else + return 0; + +} + + +uint16_t compute_pucch_prb_size(uint8_t format, + uint8_t nr_prbs, + uint16_t O_tot, + uint16_t O_csi, + NR_PUCCH_MaxCodeRate_t *maxCodeRate, + uint8_t Qm, + uint8_t n_symb, + uint8_t n_re_ctrl) { + + uint16_t O_crc; + + if (O_tot<12) + O_crc = 0; + else{ + if (O_tot<20) + O_crc = 6; + else { + if (O_tot<360) + O_crc = 11; + else + AssertFatal(1==0,"Case for segmented PUCCH not yet implemented"); + } + } + + int rtimes100; + switch(*maxCodeRate){ + case NR_PUCCH_MaxCodeRate_zeroDot08 : + rtimes100 = 8; + break; + case NR_PUCCH_MaxCodeRate_zeroDot15 : + rtimes100 = 15; + break; + case NR_PUCCH_MaxCodeRate_zeroDot25 : + rtimes100 = 25; + break; + case NR_PUCCH_MaxCodeRate_zeroDot35 : + rtimes100 = 35; + break; + case NR_PUCCH_MaxCodeRate_zeroDot45 : + rtimes100 = 45; + break; + case NR_PUCCH_MaxCodeRate_zeroDot60 : + rtimes100 = 60; + break; + case NR_PUCCH_MaxCodeRate_zeroDot80 : + rtimes100 = 80; + break; + default : + AssertFatal(1==0,"Invalid MaxCodeRate"); + } + + float r = (float)rtimes100/100; + + if (O_csi == O_tot) { + if ((O_tot+O_csi)>(nr_prbs*n_re_ctrl*n_symb*Qm*r)) + AssertFatal(1==0,"MaxCodeRate %.2f can't support %d UCI bits and %d CRC bits with %d PRBs", + r,O_tot,O_crc,nr_prbs); + else + return nr_prbs; + } + + if (format==2){ + // TODO fix this for multiple CSI reports + for (int i=1; i<=nr_prbs; i++){ + if((O_tot+O_crc)<=(i*n_symb*Qm*n_re_ctrl*r) && + (O_tot+O_crc)>((i-1)*n_symb*Qm*n_re_ctrl*r)) + return i; + } + AssertFatal(1==0,"MaxCodeRate %.2f can't support %d UCI bits and %d CRC bits with at most %d PRBs", + r,O_tot,O_crc,nr_prbs); + } + else{ + AssertFatal(1==0,"Not yet implemented"); + } + +} diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 5a342622fe..2875dcebc1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -207,6 +207,10 @@ void nr_csirs_scheduling(int Mod_idP, sub_frame_t slot, int n_slots_frame); +void csi_period_offset(NR_CSI_ReportConfig_t *csirep, + NR_NZP_CSI_RS_Resource_t *nzpcsi, + int *period, int *offset); + void nr_csi_meas_reporting(int Mod_idP, int UE_id, frame_t frameP, From 45da2fd17e9d349bbe72ab6064807dd9ee806d4f Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 27 Nov 2020 17:23:32 +0100 Subject: [PATCH 015/135] fix printf k in csirs --- openair1/PHY/NR_TRANSPORT/nr_csi_rs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c index 87edb7a157..4563dfb95c 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c +++ b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c @@ -610,7 +610,7 @@ void nr_generate_csi_rs(PHY_VARS_gNB *gNB, ((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1)+1+(2*txdataF_offset)] = (beta*wt*wf*mod_csi[l][(mprime<<1) + 1]) >> 15; } #ifdef NR_CSIRS_DEBUG - printf("l,k (%d %d) seq. index %d \t port %d \t (%d,%d)\n",l,k-start_sc,mprime,p+3000, + printf("l,k (%d %d) seq. index %d \t port %d \t (%d,%d)\n",l,k,mprime,p+3000, ((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1)+(2*txdataF_offset)], ((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1)+1+(2*txdataF_offset)]); #endif From 465529ce4504f182a1b78f9dbe996411d6d7332d Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 22 Feb 2021 17:04:40 +0100 Subject: [PATCH 016/135] adapting scheduling csirs for multi UE (to be verified) --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 251 +++++++++--------- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 1 - 3 files changed, 129 insertions(+), 125 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 1c1ac64672..577a7ab67a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -422,7 +422,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, // TODO // Schedule CSI-RS transmission - //nr_csirs_scheduling(module_idP, UE_id, frame, slot, slots_per_frame[*scc->ssbSubcarrierSpacing]); + nr_csirs_scheduling(module_idP, frame, slot, nr_slots_per_frame[*scc->ssbSubcarrierSpacing]); // Schedule CSI measurement reporting: check in slot 0 for the whole frame if (slot == 0) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 5abae7486b..44834edbba 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1803,147 +1803,152 @@ void get_pdsch_to_harq_feedback(int Mod_idP, void nr_csirs_scheduling(int Mod_idP, - int UE_id, frame_t frame, sub_frame_t slot, int n_slots_frame){ int CC_id = 0; NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; - NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; - NR_CSI_MeasConfig_t *csi_measconfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; - NR_NZP_CSI_RS_Resource_t *nzpcsi; - int period, offset; + NR_list_t *UE_list = &UE_info->list; gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; - uint8_t *vrb_map = RC.nrmac[Mod_idP]->common_channels[CC_id].vrb_map; - nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; - NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[sched_ctrl->active_bwp->bwp_Id-1]; + uint16_t *vrb_map = gNB_mac->common_channels[CC_id].vrb_map; - AssertFatal(csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count>0,"NO CSI report configuration available"); + for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { - for (int id = 0; id < csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count; id++){ - nzpcsi = csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.array[id]; - NR_CSI_RS_ResourceMapping_t resourceMapping = nzpcsi->resourceMapping; - csi_period_offset(NULL,nzpcsi,&period,&offset); + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; + NR_CSI_MeasConfig_t *csi_measconfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; + NR_NZP_CSI_RS_Resource_t *nzpcsi; + int period, offset; - if((frame*n_slots_frame+slot-offset)%period == 0) { + nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; + NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[sched_ctrl->active_bwp->bwp_Id-1]; - LOG_I(MAC,"Scheduling CSI-RS in frame %d slot %d\n",frame,slot); + AssertFatal(csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count>0,"NO CSI report configuration available"); - nfapi_nr_dl_tti_request_pdu_t *dl_tti_csirs_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; - memset((void*)dl_tti_csirs_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); - dl_tti_csirs_pdu->PDUType = NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE; - dl_tti_csirs_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_csi_rs_pdu)); + for (int id = 0; id < csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count; id++){ + nzpcsi = csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.array[id]; + NR_CSI_RS_ResourceMapping_t resourceMapping = nzpcsi->resourceMapping; + csi_period_offset(NULL,nzpcsi,&period,&offset); - nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *csirs_pdu_rel15 = &dl_tti_csirs_pdu->csi_rs_pdu.csi_rs_pdu_rel15; + if((frame*n_slots_frame+slot-offset)%period == 0) { - csirs_pdu_rel15->bwp_size = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); - csirs_pdu_rel15->bwp_start = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); - csirs_pdu_rel15->subcarrier_spacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; - if (bwp->bwp_Common->genericParameters.cyclicPrefix) - csirs_pdu_rel15->cyclic_prefix = *bwp->bwp_Common->genericParameters.cyclicPrefix; - else - csirs_pdu_rel15->cyclic_prefix = 0; + LOG_I(MAC,"Scheduling CSI-RS in frame %d slot %d\n",frame,slot); - csirs_pdu_rel15->start_rb = resourceMapping.freqBand.startingRB; - csirs_pdu_rel15->nr_of_rbs = resourceMapping.freqBand.nrofRBs; - csirs_pdu_rel15->csi_type = 1; // NZP-CSI-RS - csirs_pdu_rel15->symb_l0 = resourceMapping.firstOFDMSymbolInTimeDomain; - if (resourceMapping.firstOFDMSymbolInTimeDomain2) - csirs_pdu_rel15->symb_l1 = *resourceMapping.firstOFDMSymbolInTimeDomain2; - csirs_pdu_rel15->cdm_type = resourceMapping.cdm_Type; - csirs_pdu_rel15->freq_density = resourceMapping.density.present; - if ((resourceMapping.density.present == NR_CSI_RS_ResourceMapping__density_PR_dot5) - && (resourceMapping.density.choice.dot5 == NR_CSI_RS_ResourceMapping__density__dot5_evenPRBs)) - csirs_pdu_rel15->freq_density--; - csirs_pdu_rel15->scramb_id = nzpcsi->scramblingID; - csirs_pdu_rel15->power_control_offset = nzpcsi->powerControlOffset + 8; - if (nzpcsi->powerControlOffsetSS) - csirs_pdu_rel15->power_control_offset_ss = *nzpcsi->powerControlOffsetSS; - else - csirs_pdu_rel15->power_control_offset_ss = 1; // 0 dB - switch(resourceMapping.frequencyDomainAllocation.present){ - case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1: - csirs_pdu_rel15->row = 1; - csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>4)&0x0f; - break; - case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2: - csirs_pdu_rel15->row = 2; - csirs_pdu_rel15->freq_domain = (((resourceMapping.frequencyDomainAllocation.choice.row1.buf[1]>>4)&0x0f) | - ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]<<8)&0xf0)); - break; - case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row4: - csirs_pdu_rel15->row = 4; - csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>5)&0x0f; - break; - case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other: - csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>2)&0x0f; - // determining the row of table 7.4.1.5.3-1 in 38.211 - switch(resourceMapping.nrofPorts){ - case NR_CSI_RS_ResourceMapping__nrofPorts_p1: - break; - case NR_CSI_RS_ResourceMapping__nrofPorts_p2: - csirs_pdu_rel15->row = 3; - break; - case NR_CSI_RS_ResourceMapping__nrofPorts_p4: - csirs_pdu_rel15->row = 5; - break; - case NR_CSI_RS_ResourceMapping__nrofPorts_p8: - if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) - csirs_pdu_rel15->row = 8; - else{ - int num_k = 0; - for (int k=0; k<6; k++) - num_k+=(((csirs_pdu_rel15->freq_domain)>>k)&0x01); - if(num_k==4) - csirs_pdu_rel15->row = 6; + nfapi_nr_dl_tti_request_pdu_t *dl_tti_csirs_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; + memset((void*)dl_tti_csirs_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_csirs_pdu->PDUType = NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE; + dl_tti_csirs_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_csi_rs_pdu)); + + nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *csirs_pdu_rel15 = &dl_tti_csirs_pdu->csi_rs_pdu.csi_rs_pdu_rel15; + + csirs_pdu_rel15->bwp_size = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); + csirs_pdu_rel15->bwp_start = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); + csirs_pdu_rel15->subcarrier_spacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; + if (bwp->bwp_Common->genericParameters.cyclicPrefix) + csirs_pdu_rel15->cyclic_prefix = *bwp->bwp_Common->genericParameters.cyclicPrefix; + else + csirs_pdu_rel15->cyclic_prefix = 0; + + csirs_pdu_rel15->start_rb = resourceMapping.freqBand.startingRB; + csirs_pdu_rel15->nr_of_rbs = resourceMapping.freqBand.nrofRBs; + csirs_pdu_rel15->csi_type = 1; // NZP-CSI-RS + csirs_pdu_rel15->symb_l0 = resourceMapping.firstOFDMSymbolInTimeDomain; + if (resourceMapping.firstOFDMSymbolInTimeDomain2) + csirs_pdu_rel15->symb_l1 = *resourceMapping.firstOFDMSymbolInTimeDomain2; + csirs_pdu_rel15->cdm_type = resourceMapping.cdm_Type; + csirs_pdu_rel15->freq_density = resourceMapping.density.present; + if ((resourceMapping.density.present == NR_CSI_RS_ResourceMapping__density_PR_dot5) + && (resourceMapping.density.choice.dot5 == NR_CSI_RS_ResourceMapping__density__dot5_evenPRBs)) + csirs_pdu_rel15->freq_density--; + csirs_pdu_rel15->scramb_id = nzpcsi->scramblingID; + csirs_pdu_rel15->power_control_offset = nzpcsi->powerControlOffset + 8; + if (nzpcsi->powerControlOffsetSS) + csirs_pdu_rel15->power_control_offset_ss = *nzpcsi->powerControlOffsetSS; + else + csirs_pdu_rel15->power_control_offset_ss = 1; // 0 dB + switch(resourceMapping.frequencyDomainAllocation.present){ + case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1: + csirs_pdu_rel15->row = 1; + csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>4)&0x0f; + break; + case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2: + csirs_pdu_rel15->row = 2; + csirs_pdu_rel15->freq_domain = (((resourceMapping.frequencyDomainAllocation.choice.row1.buf[1]>>4)&0x0f) | + ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]<<8)&0xf0)); + break; + case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row4: + csirs_pdu_rel15->row = 4; + csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>5)&0x0f; + break; + case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other: + csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>2)&0x0f; + // determining the row of table 7.4.1.5.3-1 in 38.211 + switch(resourceMapping.nrofPorts){ + case NR_CSI_RS_ResourceMapping__nrofPorts_p1: + break; + case NR_CSI_RS_ResourceMapping__nrofPorts_p2: + csirs_pdu_rel15->row = 3; + break; + case NR_CSI_RS_ResourceMapping__nrofPorts_p4: + csirs_pdu_rel15->row = 5; + break; + case NR_CSI_RS_ResourceMapping__nrofPorts_p8: + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) + csirs_pdu_rel15->row = 8; + else{ + int num_k = 0; + for (int k=0; k<6; k++) + num_k+=(((csirs_pdu_rel15->freq_domain)>>k)&0x01); + if(num_k==4) + csirs_pdu_rel15->row = 6; + else + csirs_pdu_rel15->row = 7; + } + break; + case NR_CSI_RS_ResourceMapping__nrofPorts_p12: + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) + csirs_pdu_rel15->row = 10; else - csirs_pdu_rel15->row = 7; - } - break; - case NR_CSI_RS_ResourceMapping__nrofPorts_p12: - if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) - csirs_pdu_rel15->row = 10; - else - csirs_pdu_rel15->row = 9; - break; - case NR_CSI_RS_ResourceMapping__nrofPorts_p16: - if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) - csirs_pdu_rel15->row = 12; - else - csirs_pdu_rel15->row = 11; - break; - case NR_CSI_RS_ResourceMapping__nrofPorts_p24: - if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) - csirs_pdu_rel15->row = 14; - else{ - if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) - csirs_pdu_rel15->row = 15; + csirs_pdu_rel15->row = 9; + break; + case NR_CSI_RS_ResourceMapping__nrofPorts_p16: + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) + csirs_pdu_rel15->row = 12; else - csirs_pdu_rel15->row = 13; - } - break; - case NR_CSI_RS_ResourceMapping__nrofPorts_p32: - if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) - csirs_pdu_rel15->row = 17; - else{ - if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) - csirs_pdu_rel15->row = 18; - else - csirs_pdu_rel15->row = 16; - } - break; - default: - AssertFatal(1==0,"Invalid number of ports in CSI-RS resource\n"); - } - break; - default: - AssertFatal(1==0,"Invalid freqency domain allocation in CSI-RS resource\n"); + csirs_pdu_rel15->row = 11; + break; + case NR_CSI_RS_ResourceMapping__nrofPorts_p24: + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) + csirs_pdu_rel15->row = 14; + else{ + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) + csirs_pdu_rel15->row = 15; + else + csirs_pdu_rel15->row = 13; + } + break; + case NR_CSI_RS_ResourceMapping__nrofPorts_p32: + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) + csirs_pdu_rel15->row = 17; + else{ + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) + csirs_pdu_rel15->row = 18; + else + csirs_pdu_rel15->row = 16; + } + break; + default: + AssertFatal(1==0,"Invalid number of ports in CSI-RS resource\n"); + } + break; + default: + AssertFatal(1==0,"Invalid freqency domain allocation in CSI-RS resource\n"); + } + dl_req->nPDUs++; + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] = 1; } - dl_req->nPDUs++; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) - vrb_map[rb] = 1; } } } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 046ab9a9e4..8aa70a5a0b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -183,7 +183,6 @@ void nr_schedule_pucch(int Mod_idP, sub_frame_t slotP); void nr_csirs_scheduling(int Mod_idP, - int UE_id, frame_t frame, sub_frame_t slot, int n_slots_frame); From 4e6fb20fe9e6903315ee012078cbbdf3acbe71e8 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 1 Mar 2021 09:15:23 +0100 Subject: [PATCH 017/135] adding symbol based vrb map for csirs --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 69 +++++++++++++++---- 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 44834edbba..7bb5fcbc75 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1871,15 +1871,21 @@ void nr_csirs_scheduling(int Mod_idP, case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1: csirs_pdu_rel15->row = 1; csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>4)&0x0f; + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); break; case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2: csirs_pdu_rel15->row = 2; csirs_pdu_rel15->freq_domain = (((resourceMapping.frequencyDomainAllocation.choice.row1.buf[1]>>4)&0x0f) | ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]<<8)&0xf0)); + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); break; case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row4: csirs_pdu_rel15->row = 4; csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>5)&0x0f; + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); break; case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other: csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>2)&0x0f; @@ -1889,53 +1895,92 @@ void nr_csirs_scheduling(int Mod_idP, break; case NR_CSI_RS_ResourceMapping__nrofPorts_p2: csirs_pdu_rel15->row = 3; + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); break; case NR_CSI_RS_ResourceMapping__nrofPorts_p4: csirs_pdu_rel15->row = 5; + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); break; case NR_CSI_RS_ResourceMapping__nrofPorts_p8: - if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) { csirs_pdu_rel15->row = 8; + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); + } else{ int num_k = 0; for (int k=0; k<6; k++) num_k+=(((csirs_pdu_rel15->freq_domain)>>k)&0x01); - if(num_k==4) + if(num_k==4) { csirs_pdu_rel15->row = 6; - else + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); + } + else { csirs_pdu_rel15->row = 7; + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); + } } break; case NR_CSI_RS_ResourceMapping__nrofPorts_p12: - if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) { csirs_pdu_rel15->row = 10; - else + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); + } + else { csirs_pdu_rel15->row = 9; + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); + } break; case NR_CSI_RS_ResourceMapping__nrofPorts_p16: if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) csirs_pdu_rel15->row = 12; else csirs_pdu_rel15->row = 11; + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); break; case NR_CSI_RS_ResourceMapping__nrofPorts_p24: - if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) { csirs_pdu_rel15->row = 14; + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1)); + } else{ - if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) { csirs_pdu_rel15->row = 15; - else + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= (7 << csirs_pdu_rel15->symb_l0); + } + else { csirs_pdu_rel15->row = 13; + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1)); + } } break; case NR_CSI_RS_ResourceMapping__nrofPorts_p32: - if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) { csirs_pdu_rel15->row = 17; + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1)); + } else{ - if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) + if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) { csirs_pdu_rel15->row = 18; - else + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= (7 << csirs_pdu_rel15->symb_l0); + } + else { csirs_pdu_rel15->row = 16; + for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + vrb_map[rb] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1)); + } } break; default: @@ -1946,8 +1991,6 @@ void nr_csirs_scheduling(int Mod_idP, AssertFatal(1==0,"Invalid freqency domain allocation in CSI-RS resource\n"); } dl_req->nPDUs++; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) - vrb_map[rb] = 1; } } } From 1eb4438742f0a43d0e919b767f1645870b7f08af Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 4 Mar 2021 09:02:09 +0100 Subject: [PATCH 018/135] bugfix in csirs vrb map occupation --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 7bb5fcbc75..63867bf7b1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1871,20 +1871,20 @@ void nr_csirs_scheduling(int Mod_idP, case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1: csirs_pdu_rel15->row = 1; csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>4)&0x0f; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); break; case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2: csirs_pdu_rel15->row = 2; csirs_pdu_rel15->freq_domain = (((resourceMapping.frequencyDomainAllocation.choice.row1.buf[1]>>4)&0x0f) | ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]<<8)&0xf0)); - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); break; case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row4: csirs_pdu_rel15->row = 4; csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>5)&0x0f; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); break; case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other: @@ -1895,18 +1895,18 @@ void nr_csirs_scheduling(int Mod_idP, break; case NR_CSI_RS_ResourceMapping__nrofPorts_p2: csirs_pdu_rel15->row = 3; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); break; case NR_CSI_RS_ResourceMapping__nrofPorts_p4: csirs_pdu_rel15->row = 5; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); break; case NR_CSI_RS_ResourceMapping__nrofPorts_p8: if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) { csirs_pdu_rel15->row = 8; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); } else{ @@ -1915,12 +1915,12 @@ void nr_csirs_scheduling(int Mod_idP, num_k+=(((csirs_pdu_rel15->freq_domain)>>k)&0x01); if(num_k==4) { csirs_pdu_rel15->row = 6; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); } else { csirs_pdu_rel15->row = 7; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); } } @@ -1928,12 +1928,12 @@ void nr_csirs_scheduling(int Mod_idP, case NR_CSI_RS_ResourceMapping__nrofPorts_p12: if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) { csirs_pdu_rel15->row = 10; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); } else { csirs_pdu_rel15->row = 9; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); } break; @@ -1942,24 +1942,24 @@ void nr_csirs_scheduling(int Mod_idP, csirs_pdu_rel15->row = 12; else csirs_pdu_rel15->row = 11; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= ((1 << csirs_pdu_rel15->symb_l0) | (2 << csirs_pdu_rel15->symb_l0)); break; case NR_CSI_RS_ResourceMapping__nrofPorts_p24: if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) { csirs_pdu_rel15->row = 14; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1)); } else{ if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) { csirs_pdu_rel15->row = 15; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= (7 << csirs_pdu_rel15->symb_l0); } else { csirs_pdu_rel15->row = 13; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1)); } } @@ -1967,18 +1967,18 @@ void nr_csirs_scheduling(int Mod_idP, case NR_CSI_RS_ResourceMapping__nrofPorts_p32: if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2) { csirs_pdu_rel15->row = 17; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1)); } else{ if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4) { csirs_pdu_rel15->row = 18; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= (7 << csirs_pdu_rel15->symb_l0); } else { csirs_pdu_rel15->row = 16; - for (int rb = csirs_pdu_rel15->start_rb; rb < csirs_pdu_rel15->nr_of_rbs; rb++) + for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= ((3 << csirs_pdu_rel15->symb_l0) | (3 << csirs_pdu_rel15->symb_l1)); } } From 75b3097f8a44c025cb31ccd6e481d34d4f1d5a99 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 15 Mar 2021 11:53:18 +0100 Subject: [PATCH 019/135] bugfix in csirs scheduling --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 63867bf7b1..34066db90f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1876,19 +1876,19 @@ void nr_csirs_scheduling(int Mod_idP, break; case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2: csirs_pdu_rel15->row = 2; - csirs_pdu_rel15->freq_domain = (((resourceMapping.frequencyDomainAllocation.choice.row1.buf[1]>>4)&0x0f) | - ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]<<8)&0xf0)); + csirs_pdu_rel15->freq_domain = (((resourceMapping.frequencyDomainAllocation.choice.row2.buf[1]>>4)&0x0f) | + ((resourceMapping.frequencyDomainAllocation.choice.row2.buf[0]<<8)&0xf0)); for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); break; case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row4: csirs_pdu_rel15->row = 4; - csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>5)&0x0f; + csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row4.buf[0])>>5)&0x0f; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); break; case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other: - csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>2)&0x0f; + csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.other.buf[0])>>2)&0x0f; // determining the row of table 7.4.1.5.3-1 in 38.211 switch(resourceMapping.nrofPorts){ case NR_CSI_RS_ResourceMapping__nrofPorts_p1: From c6df134b5d87eefb8c8924b5224d2b7ceb105a88 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 15 Mar 2021 17:23:36 +0100 Subject: [PATCH 020/135] another bugfix in csirs scheduling --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 34066db90f..be24c15c5f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1877,18 +1877,18 @@ void nr_csirs_scheduling(int Mod_idP, case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2: csirs_pdu_rel15->row = 2; csirs_pdu_rel15->freq_domain = (((resourceMapping.frequencyDomainAllocation.choice.row2.buf[1]>>4)&0x0f) | - ((resourceMapping.frequencyDomainAllocation.choice.row2.buf[0]<<8)&0xf0)); + ((resourceMapping.frequencyDomainAllocation.choice.row2.buf[0]<<8)&0xff0)); for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); break; case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row4: csirs_pdu_rel15->row = 4; - csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row4.buf[0])>>5)&0x0f; + csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row4.buf[0])>>5)&0x07; for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++) vrb_map[rb] |= (1 << csirs_pdu_rel15->symb_l0); break; case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other: - csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.other.buf[0])>>2)&0x0f; + csirs_pdu_rel15->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.other.buf[0])>>2)&0x3f; // determining the row of table 7.4.1.5.3-1 in 38.211 switch(resourceMapping.nrofPorts){ case NR_CSI_RS_ResourceMapping__nrofPorts_p1: From 0274e09690e16152c833fada1aa236a4c8932f55 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 18 Mar 2021 13:54:55 +0100 Subject: [PATCH 021/135] internal clock in testing conf files --- targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_enb.conf | 2 +- targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_enb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_enb.conf index d26ebcd590..6f6ff63438 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_enb.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_enb.conf @@ -263,7 +263,7 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 118; eNB_instances = [0]; - clock_src = "external"; + clock_src = "internal"; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf index c46ea98ec2..8bf788566a 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf @@ -264,7 +264,7 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 114; eNB_instances = [0]; - clock_src = "external"; + clock_src = "internal"; } ); From 6b391b327458694e284a5cfdb91cd39f7025eba7 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 22 Mar 2021 10:26:02 +0100 Subject: [PATCH 022/135] activating a log to print rsrp --- openair1/PHY/NR_TRANSPORT/nr_csi_rs.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c index 4563dfb95c..ac0eac8a79 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c +++ b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c @@ -24,7 +24,7 @@ #include "PHY/MODULATION/nr_modulation.h" #include "PHY/NR_REFSIG/nr_refsig.h" -#define NR_CSIRS_DEBUG +//#define NR_CSIRS_DEBUG void nr_generate_csi_rs(PHY_VARS_gNB *gNB, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index f11a73801c..b149a67cc0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -890,7 +890,7 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, /*reportQuantity must be considered according to the current scheduled CSI-ReportConfig if multiple CSI-ReportConfigs present*/ reportQuantity_type = UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type; - LOG_D(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); + LOG_D(PHY,"SFN/SF:%d/%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type || NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) { @@ -944,7 +944,10 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, *payload >>= 4; } UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; - LOG_D(MAC,"csi_payload size = %d, rsrp_id = %d\n",payload_size, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); + LOG_I(MAC,"csi_payload size = %d, rsrp_id = %d rsrp = %d\n", + payload_size, + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP, + get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP)); } } From db25430922b9da0e36da5c435f33d52b0725b82b Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 1 Apr 2021 10:40:52 +0200 Subject: [PATCH 023/135] csirep configuration for cri_RI_CQI --- openair2/RRC/NR/rrc_gNB_reconfig.c | 34 ++++++------------------------ 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 9323ec8c67..8503f671cd 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1223,45 +1223,23 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pucchcsires1->uplinkBandwidthPartId=1; pucchcsires1->pucch_Resource=3; ASN_SEQUENCE_ADD(&csirep1->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); - csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP; - csirep1->reportQuantity.choice.cri_RSRP=(NULL_t)0; + csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI; + csirep1->reportQuantity.choice.cri_RI_CQI=(NULL_t)0; /*csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP; csirep1->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0;*/ csirep1->reportFreqConfiguration = calloc(1,sizeof(*csirep1->reportFreqConfiguration)); - csirep1->reportFreqConfiguration->cqi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI; - csirep1->reportFreqConfiguration->pmi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__pmi_FormatIndicator_widebandPMI; + csirep1->reportFreqConfiguration->cqi_FormatIndicator = calloc(1,sizeof(*csirep1->reportFreqConfiguration->cqi_FormatIndicator)); + *csirep1->reportFreqConfiguration->cqi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI; + csirep1->reportFreqConfiguration->pmi_FormatIndicator=NULL; csirep1->reportFreqConfiguration->csi_ReportingBand=NULL; csirep1->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_configured; csirep1->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_configured; - csirep1->codebookConfig=calloc(1,sizeof(*csirep1->codebookConfig)); - csirep1->codebookConfig->codebookType.present = NR_CodebookConfig__codebookType_PR_type1; - csirep1->codebookConfig->codebookType.choice.type1 = calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1)); - csirep1->codebookConfig->codebookType.choice.type1->subType.present=NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel=calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel)); - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present=NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two= - calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two)); - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.size=1; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.bits_unused=2; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf=malloc(1); - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf[0]=0xfc; - //'111111'B - - - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.size=1; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.bits_unused=0; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf=malloc(1); - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]=0xc0; //'00000011'B - - csirep1->codebookConfig->codebookType.choice.type1->codebookMode=1; + csirep1->codebookConfig=NULL; csirep1->dummy = NULL; csirep1->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; csirep1->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled)); csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); *csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; - // this corresponds to: - //if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting. - csirep1->cqi_Table = calloc(1,sizeof(*csirep1->cqi_Table)); *csirep1->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table1; csirep1->subbandSize = NR_CSI_ReportConfig__subbandSize_value1; From 25756a40c7783498670b1d659c3046fc13794d63 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 7 Apr 2021 17:56:26 +0200 Subject: [PATCH 024/135] reworking function for csi meas report bitlen (still not complete) --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 522 +++++++++--------- 1 file changed, 251 insertions(+), 271 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index b149a67cc0..68d5e58b95 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -160,283 +160,263 @@ uint8_t number_of_bits_set (uint8_t buf,uint8_t * max_ri){ } -//!TODO : same function can be written to handle csi_resources -void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_info, int UE_id, module_id_t Mod_idP){ - uint8_t csi_report_id = 0; - uint8_t csi_resourceidx =0; - uint8_t csi_ssb_idx =0; - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; - NR_CSI_ResourceConfigId_t csi_ResourceConfigId; +void compute_rsrp_bitlen(struct NR_CSI_ReportConfig *csi_reportconfig, + uint8_t nb_resources, + nr_csi_report_t *csi_report){ - for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ - struct NR_CSI_ReportConfig *csi_reportconfig = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]; - nr_csi_report_t *csi_report = &UE_info->csi_report_template[UE_id][csi_report_id]; - csi_ResourceConfigId=csi_reportconfig->resourcesForChannelMeasurement; - reportQuantity_type = csi_reportconfig->reportQuantity.present; - csi_report->reportQuantity_type = reportQuantity_type; + if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == csi_reportconfig->groupBasedBeamReporting.present) { + if (NULL != csi_reportconfig->groupBasedBeamReporting.choice.disabled->nrofReportedRS) + csi_report->CSI_report_bitlen.nb_ssbri_cri = *(csi_reportconfig->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; + else + /*! From Spec 38.331 + * nrofReportedRS + * The number (N) of measured RS resources to be reported per report setting in a non-group-based report. N <= N_max, where N_max is either 2 or 4 depending on UE + * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. + * When the field is absent the UE applies the value 1 + */ + csi_report->CSI_report_bitlen.nb_ssbri_cri= 1; + } else + csi_report->CSI_report_bitlen.nb_ssbri_cri= 2; - for ( csi_resourceidx = 0; csi_resourceidx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_resourceidx++) { - struct NR_CSI_ResourceConfig *csi_resourceconfig = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]; - if ( csi_resourceconfig->csi_ResourceConfigId != csi_ResourceConfigId) - continue; - else { - uint8_t nb_ssb_resources =0; - //Finding the CSI_RS or SSB Resources - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) { - - if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == csi_reportconfig->groupBasedBeamReporting.present) { - if (NULL != csi_reportconfig->groupBasedBeamReporting.choice.disabled->nrofReportedRS) - csi_report->CSI_report_bitlen.nb_ssbri_cri = *(csi_reportconfig->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1; - else - /*! From Spec 38.331 - * nrofReportedRS - * The number (N) of measured RS resources to be reported per report setting in a non-group-based report. N <= N_max, where N_max is either 2 or 4 depending on UE - * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. - * When the field is absent the UE applies the value 1 - */ - csi_report->CSI_report_bitlen.nb_ssbri_cri= 1; - }else - csi_report->CSI_report_bitlen.nb_ssbri_cri= 2; - - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == csi_report->reportQuantity_type) { - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == - *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){ - - ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig - nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - csi_report->SSB_Index_list = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.array; - csi_report->CSI_Index_list = NULL; - break; - } - } - } else /*if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type)*/{ - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == - *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { - - ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 - nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; - csi_report->CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; - csi_report->SSB_Index_list = NULL; - break; - } - } - } - - if (nb_ssb_resources) { - csi_report->CSI_report_bitlen.cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); - csi_report->CSI_report_bitlen.rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - csi_report->CSI_report_bitlen.diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - } else { - csi_report->CSI_report_bitlen.cri_ssbri_bitlen =0; - csi_report->CSI_report_bitlen.rsrp_bitlen = 0; - csi_report->CSI_report_bitlen.diff_rsrp_bitlen =0; - } - - LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d\n", - csi_report->CSI_report_bitlen.cri_ssbri_bitlen, - csi_report->CSI_report_bitlen.rsrp_bitlen, - csi_report->CSI_report_bitlen.diff_rsrp_bitlen); - } - - uint8_t ri_restriction; - uint8_t ri_bitlen; - uint8_t nb_allowed_ri; - uint8_t max_ri; - - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type|| - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1==reportQuantity_type){ - - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_ResourceSetId == - *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { - ///For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 - nb_ssb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.count; - csi_report->CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_ssb_idx]->nzp_CSI_RS_Resources.list.array; - csi_report->SSB_Index_list = NULL; - } - break; - } - csi_report->csi_meas_bitlen.cri_bitlen=ceil(log2 (nb_ssb_resources)); - - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ - - switch (RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value) { - case 1:; - csi_report->csi_meas_bitlen.ri_bitlen=0; - break; - case 2: - /* From Spec 38.212 - * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator - * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, - * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause - * 5.2.2.2.1 [6, TS 38.214]. - * - * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to - * calculate RI for antennas equal or more than two. - * */ - AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); - - ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - - /* Replace dummy with the nrofCQIsPerReport from the CSIreport - config when equalent ASN structure present */ - if (0==*(csi_reportconfig->dummy)){ - nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - else{ - nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel - csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; - break; - case 4: - AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); - - ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - - /* Replace dummy with the nrofCQIsPerReport from the CSIreport - config when equalent ASN structure present */ - if (0==*(csi_reportconfig->dummy)){ - nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - else{ - nb_allowed_ri = number_of_bits_set(ri_restriction,&max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - ri_bitlen = ri_bitlen<2?ri_bitlen:2; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel - csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; - break; - case 6: - case 8: - AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); - - ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - - /* Replace dummy with the nrofCQIsPerReport from the CSIreport - config when equalent ASN structure present */ - if (0==*(csi_reportconfig->dummy)){ - nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0),&max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - else{ - nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; - break; - default: - AssertFatal(RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value>8,"Number of antennas %d are out of range", RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value); - } - } - csi_report->csi_meas_bitlen.li_bitlen=0; - csi_report->csi_meas_bitlen.cqi_bitlen=0; - csi_report->csi_meas_bitlen.pmi_x1_bitlen=0; - csi_report->csi_meas_bitlen.pmi_x2_bitlen=0; - } - - if( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type ){ - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ - - switch (RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value) { - case 1:; - csi_report->csi_meas_bitlen.li_bitlen=0; - break; - case 2: - case 4: - case 6: - case 8: - /* From Spec 38.212 - * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator - * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, - * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause - * 5.2.2.2.1 [6, TS 38.214]. - * - * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to - * calculate RI for antennas equal or more than two. - * */ - //! TODO: The bit length of LI is as follows LI = log2(RI), Need to confirm wheather we should consider maximum RI can be reported from ri_restricted - // or we should consider reported RI. If we need to consider reported RI for calculating LI bit length then we need to modify the code. - csi_report->csi_meas_bitlen.li_bitlen=ceil(log2(max_ri))<2?ceil(log2(max_ri)):2; - break; - default: - AssertFatal(RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value>8,"Number of antennas %d are out of range", RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value); - } - } - } - - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI==reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI==reportQuantity_type){ - - switch (RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value){ - case 1: - case 2: - case 4: - case 6: - case 8: - /* From Spec 38.212 - * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator - * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, - * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause - * 5.2.2.2.1 [6, TS 38.214]. - * - * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to - * calculate RI for antennas equal or more than two. - * */ - - if (max_ri > 4 && max_ri < 8){ - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ - if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_reportconfig->reportFreqConfiguration->cqi_FormatIndicator) - csi_report->csi_meas_bitlen.cqi_bitlen = 8; - else - csi_report->csi_meas_bitlen.cqi_bitlen = 4; - } - }else{ //This condition will work even for type1-multipanel. - if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_reportconfig->reportFreqConfiguration->cqi_FormatIndicator) - csi_report->csi_meas_bitlen.cqi_bitlen = 4; - else - csi_report->csi_meas_bitlen.cqi_bitlen = 2; - } - break; - default: - AssertFatal(RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value>8,"Number of antennas %d are out of range", RC.nrmac[Mod_idP]->config[0].carrier_config.num_tx_ant.value); - } - } - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI==reportQuantity_type){ - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ - switch (csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present){ - case NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two: - if (max_ri ==1) - csi_report->csi_meas_bitlen.pmi_x1_bitlen = 2; - else if (max_ri ==2) - csi_report->csi_meas_bitlen.pmi_x1_bitlen = 1; - break; - default: - AssertFatal(csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present!= - NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two, - "Not handled Yet %d", csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present); - break; - } - } - } - break; - } - } + if (nb_resources) { + csi_report->CSI_report_bitlen.cri_ssbri_bitlen =ceil(log2 (nb_resources)); + csi_report->CSI_report_bitlen.rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + csi_report->CSI_report_bitlen.diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + } else { + csi_report->CSI_report_bitlen.cri_ssbri_bitlen =0; + csi_report->CSI_report_bitlen.rsrp_bitlen = 0; + csi_report->CSI_report_bitlen.diff_rsrp_bitlen =0; } } +uint8_t compute_ri_bitlen(struct NR_CSI_ReportConfig *csi_reportconfig, + nr_csi_report_t *csi_report){ + + struct NR_CodebookConfig *codebookConfig = csi_reportconfig->codebookConfig; + uint8_t nb_allowed_ri, ri_restriction,ri_bitlen; + uint8_t max_ri = 0; + + if (codebookConfig == NULL) { + csi_report->csi_meas_bitlen.ri_bitlen=0; + return max_ri; + } + + // codebook type1 single panel + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==codebookConfig->codebookType.choice.type1->subType.present){ + struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *type1single = codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel; + if (type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two){ + // two antenna ports case + /* From Spec 38.212 + * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator + * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, + * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause + * 5.2.2.2.1 [6, TS 38.214]. + * + * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to + * calculate RI for antennas equal or more than two. + * */ + AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + + /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present */ + if (0==*(csi_reportconfig->dummy)){ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; + } + if (type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo){ + if (type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present == + NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction) { + // 4 ports + AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + + /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present*/ + if (0==*(csi_reportconfig->dummy)){ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction,&max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + ri_bitlen = ri_bitlen<2?ri_bitlen:2; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; + } + else { + // more than 4 ports + AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); + + ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; + + /* Replace dummy with the nrofCQIsPerReport from the CSIreport + config when equalent ASN structure present */ + if (0==*(csi_reportconfig->dummy)){ + nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0),&max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + else{ + nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); + ri_bitlen = ceil(log2(nb_allowed_ri)); + } + csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; + } + } + return max_ri; + } + else + AssertFatal(1==0,"Other configurations not yet implemented\n"); +} + +void compute_li_bitlen(struct NR_CSI_ReportConfig *csi_reportconfig, + uint8_t max_ri, + nr_csi_report_t *csi_report){ + + struct NR_CodebookConfig *codebookConfig = csi_reportconfig->codebookConfig; + if (codebookConfig == NULL) { + csi_report->csi_meas_bitlen.li_bitlen=0; + return; + } + // codebook type1 single panel + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==codebookConfig->codebookType.choice.type1->subType.present){ + /* From Spec 38.212 + * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator + * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, + * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause + * 5.2.2.2.1 [6, TS 38.214]. + * + * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to + * calculate RI for antennas equal or more than two. + */ + //! TODO: The bit length of LI is as follows LI = log2(RI), Need to confirm wheather we should consider maximum RI can be reported from ri_restricted + // or we should consider reported RI. If we need to consider reported RI for calculating LI bit length then we need to modify the code. + csi_report->csi_meas_bitlen.li_bitlen=ceil(log2(max_ri))<2?ceil(log2(max_ri)):2; + } + else + AssertFatal(1==0,"Other configurations not yet implemented\n"); +} + + +void compute_cqi_bitlen(struct NR_CSI_ReportConfig *csi_reportconfig, + uint8_t max_ri, + nr_csi_report_t *csi_report){ + + struct NR_CodebookConfig *codebookConfig = csi_reportconfig->codebookConfig; + struct NR_CSI_ReportConfig__reportFreqConfiguration *freq_config = csi_reportconfig->reportFreqConfiguration; + + if (*freq_config->cqi_FormatIndicator == NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI) { + csi_report->csi_meas_bitlen.cqi_bitlen = 4; + if(codebookConfig != NULL) { + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel == codebookConfig->codebookType.choice.type1->subType.present){ + struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *type1single = codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel; + if (type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo) { + if (type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present > + NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction) { + // more than 4 antenna ports + if (max_ri > 4) + csi_report->csi_meas_bitlen.cqi_bitlen += 4; // CQI for second TB + } + } + } + } + } + else + AssertFatal(1==0,"Sub-band CQI reporting not yet supported"); +} + +//!TODO : same function can be written to handle csi_resources +void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_info, int UE_id, module_id_t Mod_idP){ + uint8_t csi_report_id = 0; + uint8_t nb_resources = 0; + uint8_t max_ri = 0; + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; + NR_CSI_ResourceConfigId_t csi_ResourceConfigId; + struct NR_CSI_ResourceConfig *csi_resourceconfig; + + // for each CSI measurement report configuration (list of CSI-ReportConfig) + for (csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ + struct NR_CSI_ReportConfig *csi_reportconfig = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]; + // MAC structure for CSI measurement reports (per UE and per report) + nr_csi_report_t *csi_report = &UE_info->csi_report_template[UE_id][csi_report_id]; + // csi-ResourceConfigId of a CSI-ResourceConfig included in the configuration + // (either CSI-RS or SSB) + csi_ResourceConfigId = csi_reportconfig->resourcesForChannelMeasurement; + // looking for CSI-ResourceConfig + int found_resource = 0; + int csi_resourceidx = 0; + while (found_resource == 0 && csi_resourceidx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count) { + csi_resourceconfig = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_resourceidx]; + if ( csi_resourceconfig->csi_ResourceConfigId == csi_ResourceConfigId) + found_resource = 1; + csi_resourceidx++; + } + AssertFatal(found_resource==1,"Not able to found any CSI-ResourceConfig with csi-ResourceConfigId %ld\n", + csi_ResourceConfigId); + + long resourceType = csi_resourceconfig->resourceType; + + reportQuantity_type = csi_reportconfig->reportQuantity.present; + csi_report->reportQuantity_type = reportQuantity_type; + + // setting the CSI or SSB index list + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == csi_report->reportQuantity_type) { + for (int csi_idx = 0; csi_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_idx++) { + if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_idx]->csi_SSB_ResourceSetId == + *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){ + //We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig + nb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_idx]->csi_SSB_ResourceList.list.count; + csi_report->SSB_Index_list = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_idx]->csi_SSB_ResourceList.list.array; + csi_report->CSI_Index_list = NULL; + break; + } + } + } + else { + if (resourceType == NR_CSI_ResourceConfig__resourceType_periodic) { + for (int csi_idx = 0; csi_idx < csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.count; csi_idx++) { + if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_idx]->nzp_CSI_ResourceSetId == + *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { + //For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 + nb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_idx]->nzp_CSI_RS_Resources.list.count; + csi_report->CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_idx]->nzp_CSI_RS_Resources.list.array; + csi_report->SSB_Index_list = NULL; + break; + } + } + } + else AssertFatal(1==0,"Only periodic resource configuration currently supported\n"); + } + + // computation of bit length depending on the report type + switch(reportQuantity_type){ + case (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP): + compute_rsrp_bitlen(csi_reportconfig, nb_resources, csi_report); + break; + case (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP): + compute_rsrp_bitlen(csi_reportconfig, nb_resources, csi_report); + break; + case (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI): + csi_report->csi_meas_bitlen.cri_bitlen=ceil(log2(nb_resources)); + max_ri = compute_ri_bitlen(csi_reportconfig, csi_report); + compute_cqi_bitlen(csi_reportconfig, max_ri, csi_report); + break; + default: + AssertFatal(1==0,"Not yet supported CSI report quantity type"); + } + } +} + uint16_t nr_get_csi_bitlen(int Mod_idP, int UE_id, From 48b847cbd3395e9e64c47f4f4f21d9bc2330024d Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 23 Apr 2021 15:41:47 +0200 Subject: [PATCH 025/135] reworking extraction of csi meas report (first version) --- .../nfapi/public_inc/nfapi_nr_interface_scf.h | 6 +- openair1/SCHED_NR/fapi_nr_l1.c | 4 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 223 ++++++++++++------ openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 3 +- 4 files changed, 153 insertions(+), 83 deletions(-) diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h index 444140509c..28a4d75490 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h @@ -1571,8 +1571,7 @@ typedef struct { uint8_t csi_part1_crc; uint16_t csi_part1_bit_len; - //! fixme - uint8_t* csi_part1_payload;//uint8_t[ceil(csiPart1BitLen/8)] + uint8_t* csi_part1_payload; } nfapi_nr_csi_part1_pdu_t; @@ -1581,8 +1580,7 @@ typedef struct { uint8_t csi_part2_crc; uint16_t csi_part2_bit_len; - //! fixme - uint8_t* csi_part2_payload;//uint8_t[ceil(csiPart2BitLen/8)] + uint8_t* csi_part2_payload; } nfapi_nr_csi_part2_pdu_t; //table 3-63 diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index 048e99cbb1..545b9d329c 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -137,7 +137,7 @@ void handle_nfapi_nr_csirs_pdu(PHY_VARS_gNB *gNB, for (int id=0; idcsirs_pdu[id]; if (csirs->active == 0) { - LOG_I(PHY,"Frame %d Slot %d CSI_RS with ID %d is now active\n",frame,slot,id); + LOG_D(PHY,"Frame %d Slot %d CSI_RS with ID %d is now active\n",frame,slot,id); csirs->frame = frame; csirs->slot = slot; csirs->active = 1; @@ -219,7 +219,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ break; case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE: - LOG_I(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot); + LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot); handle_nfapi_nr_csirs_pdu(gNB, frame, slot, &dl_tti_pdu->csi_rs_pdu); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index cd59f8903f..5ffe45b32b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -375,7 +375,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_idx]->csi_SSB_ResourceSetId == *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){ //We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig - nb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_idx]->csi_SSB_ResourceList.list.count; + nb_resources = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_idx]->csi_SSB_ResourceList.list.count; csi_report->SSB_Index_list = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_idx]->csi_SSB_ResourceList.list.array; csi_report->CSI_Index_list = NULL; break; @@ -388,7 +388,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_idx]->nzp_CSI_ResourceSetId == *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { //For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212 - nb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_idx]->nzp_CSI_RS_Resources.list.count; + nb_resources = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_idx]->nzp_CSI_RS_Resources.list.count; csi_report->CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_idx]->nzp_CSI_RS_Resources.list.array; csi_report->SSB_Index_list = NULL; break; @@ -850,16 +850,120 @@ void reverse_n_bits(uint8_t *value, uint16_t bitlen) { } } -void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, - const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, - frame_t frame, - slot_t slot, - int UE_id, - module_id_t Mod_idP) { + +void evaluate_rsrp_report(NR_UE_info_t *UE_info, + NR_UE_sched_ctrl_t *sched_ctrl, + int UE_id, + uint8_t csi_report_id, + uint8_t *payload, + NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type){ + + uint8_t cri_ssbri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; + + /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report + * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE + * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set + * From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 + */ + + /** from 38.214 sec 5.2.1.4.2 + - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is + not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in + a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting + + - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE is not + required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a + single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB + resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with + multiple simultaneous spatial domain receive filter + */ + + int idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri; + + for (int csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { + if(cri_ssbri_bitlen > 1) + reverse_n_bits(payload, cri_ssbri_bitlen); + + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = + *(UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); + else + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = + *(UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); + + *payload >>= cri_ssbri_bitlen; + LOG_D(MAC,"SSB_index = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); + } + + reverse_n_bits(payload, 7); + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; + *payload >>= 7; + + for (int diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { + reverse_n_bits(payload,4); + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; + *payload >>= 4; + } + UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; + LOG_D(MAC,"rsrp_id = %d rsrp = %d\n", + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP, + get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP)); + +} + + +void evaluate_cri_report(uint8_t *payload, + uint8_t cri_bitlen, + NR_UE_sched_ctrl_t *sched_ctrl){ + + int idx = 0; // FIXME not sure about this index. Should it be the same as csi_report_id? + + uint8_t temp_cri = *payload & ((1<CSI_report[idx].choice.cri_ri_li_pmi_cqi_report.cri = temp_cri; + *payload >>= cri_bitlen; +} + +void evaluate_ri_report(uint8_t *payload, + uint8_t ri_bitlen, + NR_UE_sched_ctrl_t *sched_ctrl){ + + AssertFatal(1==0,"Evaluation of RI report not yet implemented\n"); +} + + +void evaluate_cqi_report(uint8_t *payload, + uint8_t cqi_bitlen, + NR_UE_sched_ctrl_t *sched_ctrl){ + + //TODO sub-band CQI report not yet implemented + int idx = 0; // FIXME not sure about this index. Should it be the same as csi_report_id? + uint8_t temp_cqi = *payload & ((1<<4)-1); + reverse_n_bits(&temp_cqi,4); + sched_ctrl->CSI_report[idx].choice.cri_ri_li_pmi_cqi_report.wb_cqi_1tb = temp_cqi; + *payload >>= 4; + LOG_I(MAC,"Wide-band CQI for the first TB %d\n", temp_cqi); + if (cqi_bitlen > 4) { + temp_cqi = *payload & ((1<<4)-1); + reverse_n_bits(&temp_cqi,4); + sched_ctrl->CSI_report[idx].choice.cri_ri_li_pmi_cqi_report.wb_cqi_2tb = temp_cqi; + *payload >>= 4; + LOG_D(MAC,"Wide-band CQI for the second TB %d\n", temp_cqi); + } +} + +void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig, + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, + frame_t frame, + slot_t slot, + int UE_id, + module_id_t Mod_idP) { /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - uint8_t idx = 0; - uint8_t payload_size = ceil(((double)uci_pdu->csi_part1.csi_part1_bit_len)/8); + NR_ServingCellConfigCommon_t *scc = + RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon; + const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; uint8_t *payload = uci_pdu->csi_part1.csi_part1_payload; NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; NR_UE_info_t *UE_info = &(RC.nrmac[Mod_idP]->UE_info); @@ -867,75 +971,42 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, uint8_t csi_report_id = 0; UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; - for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { - //Has to implement according to reportSlotConfig type - /*reportQuantity must be considered according to the current scheduled - CSI-ReportConfig if multiple CSI-ReportConfigs present*/ - reportQuantity_type = UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type; - LOG_D(PHY,"SFN/SF:%d/%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); - - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) { - uint8_t csi_ssb_idx = 0; - uint8_t diff_rsrp_idx = 0; - uint8_t cri_ssbri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; - - /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report - * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE - * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set - * From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 - */ - - /** from 38.214 sec 5.2.1.4.2 - - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is - not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in - a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting - - - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE is not - required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a - single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB - resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with - multiple simultaneous spatial domain receive filter - */ - - idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri; - - for (csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { - if(cri_ssbri_bitlen > 1) - reverse_n_bits(payload, cri_ssbri_bitlen); - - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); - else - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); - - *payload >>= cri_ssbri_bitlen; - LOG_D(PHY,"SSB_index = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); + for (csi_report_id = 0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { + uint8_t cri_bitlen = 0; + uint8_t ri_bitlen = 0; + uint8_t cqi_bitlen = 0; + NR_CSI_ReportConfig_t *csirep = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]; + int period, offset; + csi_period_offset(csirep, NULL, &period, &offset); + // verify if report with current id has been scheduled for this frame and slot + // -1 because this is processed 1 slot after the reception + if ((n_slots_frame*frame + slot - offset - 1)%period == 0) { + reportQuantity_type = UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type; + LOG_I(MAC,"SFN/SF:%d/%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); + switch(reportQuantity_type){ + case NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP: + evaluate_rsrp_report(UE_info,sched_ctrl,UE_id,csi_report_id,payload,reportQuantity_type); + break; + case NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP: + evaluate_rsrp_report(UE_info,sched_ctrl,UE_id,csi_report_id,payload,reportQuantity_type); + break; + case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI: + cri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cri_bitlen; + if(cri_bitlen) + evaluate_cri_report(payload,cri_bitlen,sched_ctrl); + ri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen; + if(ri_bitlen) + evaluate_ri_report(payload,ri_bitlen,sched_ctrl); + //TODO add zero padding bits when needed + cqi_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen; + if(cqi_bitlen) + evaluate_cqi_report(payload,ri_bitlen,sched_ctrl); + break; + default: + AssertFatal(1==0, "Invalid or not supported CSI measurement report\n"); } - - reverse_n_bits(payload, 7); - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; - *payload >>= 7; - - for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { - reverse_n_bits(payload,4); - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; - *payload >>= 4; - } - UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; - LOG_I(MAC,"csi_payload size = %d, rsrp_id = %d rsrp = %d\n", - payload_size, - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP, - get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP)); } } - - if ( !(reportQuantity_type)) - AssertFatal(reportQuantity_type, "reportQuantity is not configured"); - } void handle_nr_uci_pucch_0_1(module_id_t mod_id, diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index d9869e7a7b..8fa11c406a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -387,7 +387,8 @@ struct CRI_RI_LI_PMI_CQI { uint8_t li; uint8_t pmi_x1; uint8_t pmi_x2; - uint8_t cqi; + uint8_t wb_cqi_1tb; + uint8_t wb_cqi_2tb; }; typedef struct CRI_SSB_RSRP { From 844170d72badd07b6196cf40f69e72f5c6ea11c4 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 26 Apr 2021 10:05:46 +0200 Subject: [PATCH 026/135] fix for multibyte multi report payload --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 69 +++++++++---------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 5ffe45b32b..5011d45704 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -839,15 +839,11 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) { }//is-triggering_beam_switch }//tci handling -void reverse_n_bits(uint8_t *value, uint16_t bitlen) { - uint16_t j; - uint8_t i; - for(j = bitlen - 1,i = 0; j > i; j--, i++) { - if(((*value>>j)&1) != ((*value>>i)&1)) { - *value ^= (1<>((start_bit+i)%8))&0x01)<<(bitlen-i-1); + return rev_bits; } @@ -856,9 +852,11 @@ void evaluate_rsrp_report(NR_UE_info_t *UE_info, int UE_id, uint8_t csi_report_id, uint8_t *payload, + int *cumul_bits, NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type){ uint8_t cri_ssbri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; + uint16_t curr_payload; /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE @@ -882,28 +880,27 @@ void evaluate_rsrp_report(NR_UE_info_t *UE_info, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri; for (int csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { - if(cri_ssbri_bitlen > 1) - reverse_n_bits(payload, cri_ssbri_bitlen); + curr_payload = pickandreverse_bits(payload, cri_ssbri_bitlen, *cumul_bits); if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); + *(UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((curr_payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); else sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); + *(UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((curr_payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); - *payload >>= cri_ssbri_bitlen; + *cumul_bits += cri_ssbri_bitlen; LOG_D(MAC,"SSB_index = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); } - reverse_n_bits(payload, 7); - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; - *payload >>= 7; + curr_payload = pickandreverse_bits(payload, 7, *cumul_bits); + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = curr_payload & 0x7f; + *cumul_bits += 7; for (int diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { - reverse_n_bits(payload,4); - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; - *payload >>= 4; + curr_payload = pickandreverse_bits(payload, 4, *cumul_bits); + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = curr_payload & 0x0f; + *cumul_bits += 4; } UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; LOG_D(MAC,"rsrp_id = %d rsrp = %d\n", @@ -915,14 +912,13 @@ void evaluate_rsrp_report(NR_UE_info_t *UE_info, void evaluate_cri_report(uint8_t *payload, uint8_t cri_bitlen, + int cumul_bits, NR_UE_sched_ctrl_t *sched_ctrl){ int idx = 0; // FIXME not sure about this index. Should it be the same as csi_report_id? - uint8_t temp_cri = *payload & ((1<CSI_report[idx].choice.cri_ri_li_pmi_cqi_report.cri = temp_cri; - *payload >>= cri_bitlen; } void evaluate_ri_report(uint8_t *payload, @@ -935,20 +931,19 @@ void evaluate_ri_report(uint8_t *payload, void evaluate_cqi_report(uint8_t *payload, uint8_t cqi_bitlen, + int *cumul_bits, NR_UE_sched_ctrl_t *sched_ctrl){ //TODO sub-band CQI report not yet implemented int idx = 0; // FIXME not sure about this index. Should it be the same as csi_report_id? - uint8_t temp_cqi = *payload & ((1<<4)-1); - reverse_n_bits(&temp_cqi,4); + + uint8_t temp_cqi = pickandreverse_bits(payload, 4, *cumul_bits); sched_ctrl->CSI_report[idx].choice.cri_ri_li_pmi_cqi_report.wb_cqi_1tb = temp_cqi; - *payload >>= 4; + *cumul_bits += 4; LOG_I(MAC,"Wide-band CQI for the first TB %d\n", temp_cqi); if (cqi_bitlen > 4) { - temp_cqi = *payload & ((1<<4)-1); - reverse_n_bits(&temp_cqi,4); + temp_cqi = pickandreverse_bits(payload, 4, *cumul_bits); sched_ctrl->CSI_report[idx].choice.cri_ri_li_pmi_cqi_report.wb_cqi_2tb = temp_cqi; - *payload >>= 4; LOG_D(MAC,"Wide-band CQI for the second TB %d\n", temp_cqi); } } @@ -968,10 +963,10 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; NR_UE_info_t *UE_info = &(RC.nrmac[Mod_idP]->UE_info); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - uint8_t csi_report_id = 0; + int cumul_bits = 0; - UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; - for (csi_report_id = 0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { + for (int csi_report_id = 0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { + UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; uint8_t cri_bitlen = 0; uint8_t ri_bitlen = 0; uint8_t cqi_bitlen = 0; @@ -985,22 +980,24 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig, LOG_I(MAC,"SFN/SF:%d/%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); switch(reportQuantity_type){ case NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP: - evaluate_rsrp_report(UE_info,sched_ctrl,UE_id,csi_report_id,payload,reportQuantity_type); + evaluate_rsrp_report(UE_info,sched_ctrl,UE_id,csi_report_id,payload,&cumul_bits,reportQuantity_type); break; case NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP: - evaluate_rsrp_report(UE_info,sched_ctrl,UE_id,csi_report_id,payload,reportQuantity_type); + evaluate_rsrp_report(UE_info,sched_ctrl,UE_id,csi_report_id,payload,&cumul_bits,reportQuantity_type); break; case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI: cri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cri_bitlen; if(cri_bitlen) - evaluate_cri_report(payload,cri_bitlen,sched_ctrl); + evaluate_cri_report(payload,cri_bitlen,cumul_bits,sched_ctrl); + cumul_bits += cri_bitlen; ri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen; if(ri_bitlen) evaluate_ri_report(payload,ri_bitlen,sched_ctrl); + cumul_bits += ri_bitlen; //TODO add zero padding bits when needed cqi_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen; if(cqi_bitlen) - evaluate_cqi_report(payload,ri_bitlen,sched_ctrl); + evaluate_cqi_report(payload,cqi_bitlen,&cumul_bits,sched_ctrl); break; default: AssertFatal(1==0, "Invalid or not supported CSI measurement report\n"); From 518edc742c799128e8150044e91c81e1c5947d03 Mon Sep 17 00:00:00 2001 From: Eurecom Date: Thu, 29 Apr 2021 13:07:20 +0200 Subject: [PATCH 027/135] n300 fixes 50 MHz configuration --- cmake_targets/tools/build_helper | 1 + executables/nr-ru.c | 11 +++++++++++ openair1/SCHED_NR/phy_procedures_nr_gNB.c | 1 + openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 15 +++++++++++++++ .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 2 ++ openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 3 ++- 6 files changed, 32 insertions(+), 1 deletion(-) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 977827b0c9..39eb64d6e0 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -113,6 +113,7 @@ check_supported_distribution() { "rhel7.6") return 0 ;; "rhel7.7") return 0 ;; "rhel7.8") return 0 ;; + "rhel7.9") return 0 ;; "rhel8.2") return 0 ;; "rhel8.3") return 0 ;; "rhel8.4") return 0 ;; diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 9dbd025680..ae897f4a1c 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -861,6 +861,17 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) { cfg->tx_bw = 40e6; cfg->rx_bw = 40e6; } + } else if(N_RB == 133) { + if (fp->threequarter_fs) { + AssertFatal(1==0,"N_RB %d cannot use 3/4 sampling\n",N_RB); + } + else { + cfg->sample_rate=61.44e6; + cfg->samples_per_frame = 614400; + cfg->tx_bw = 50e6; + cfg->rx_bw = 50e6; + } + } else { AssertFatal(0==1,"N_RB %d not yet supported for numerology %d\n",N_RB,mu); } diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index b26c95fc4d..da32be2374 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -380,6 +380,7 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, // scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size switch (gNB->frame_parms.N_RB_DL) { case 106: timing_advance_update /= 16; break; + case 133: timing_advance_update /= 16; break; case 217: timing_advance_update /= 32; break; case 245: timing_advance_update /= 32; break; case 273: timing_advance_update /= 32; break; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 30a89cce77..ebec6b0cfe 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -753,6 +753,21 @@ void nr_schedule_ue_spec(module_id_t module_id, current_harq_pid, harq->round, harq->ndi); + if ((get_softmodem_params()->phy_test == 1) && (frame&127) == 0) + LOG_D(MAC, + "%4d.%2d RNTI %04x start %d RBs %d startSymbol %d nb_symbsol %d MCS %d TBS %d (%f Mbps) HARQ PID %d round %d NDI %d\n", + frame, + slot, + rnti, + sched_ctrl->rbStart, + sched_ctrl->rbSize, + startSymbolIndex, + nrOfSymbols, + sched_ctrl->mcs, + TBS,((double)TBS)*(1<uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing))/1000, + current_harq_pid, + harq->round, + harq->ndi); NR_BWP_Downlink_t *bwp = sched_ctrl->active_bwp; AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 6487f391b9..3ab10e4b5e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -370,6 +370,8 @@ void nr_preprocessor_phytest(module_id_t module_id, /* mark the corresponding RBs as used */ for (int rb = 0; rb < sched_ctrl->rbSize; rb++) vrb_map[rb + sched_ctrl->rbStart] = 1; + + if ((frame&127) == 0) LOG_I(MAC,"phytest: %d.%d DL mcs %d, DL rbStart %d, DL rbSize %d\n", frame, slot, sched_ctrl->mcs, rbStart,rbSize); } bool nr_ul_preprocessor_phytest(module_id_t module_id, diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 9c139624eb..b440ee44b1 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -38,6 +38,7 @@ #include +#include static nr_rlc_ue_manager_t *nr_rlc_ue_manager; /* TODO: handle time a bit more properly */ @@ -250,7 +251,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind( + buf_stat.retx_size + buf_stat.tx_size; } else { - LOG_W(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP); + if (get_softmodem_params()->phy_test == 0) LOG_W(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP); ret.bytes_in_buffer = 0; } From d74181aa19b1aed6fedd962a008da44f63589016 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 29 Apr 2021 14:57:48 +0200 Subject: [PATCH 028/135] fix after merge with develop --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index a200a4d532..27308ad5f6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -961,7 +961,6 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_info = &(RC.nrmac[Mod_idP]->UE_info); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; int cumul_bits = 0; - for (int csi_report_id = 0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; uint8_t cri_bitlen = 0; @@ -972,7 +971,7 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig, csi_period_offset(csirep, NULL, &period, &offset); // verify if report with current id has been scheduled for this frame and slot // -1 because this is processed 1 slot after the reception - if ((n_slots_frame*frame + slot - offset - 1)%period == 0) { + if ((n_slots_frame*frame + slot - offset)%period == 0) { reportQuantity_type = UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type; LOG_I(MAC,"SFN/SF:%d/%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); switch(reportQuantity_type){ From 6188e9e37f35abe19c14c2be56c3b399e27a8975 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 29 Apr 2021 14:58:59 +0200 Subject: [PATCH 029/135] fixing also the comment --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 27308ad5f6..0f917d89eb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -970,7 +970,6 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig, int period, offset; csi_period_offset(csirep, NULL, &period, &offset); // verify if report with current id has been scheduled for this frame and slot - // -1 because this is processed 1 slot after the reception if ((n_slots_frame*frame + slot - offset)%period == 0) { reportQuantity_type = UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type; LOG_I(MAC,"SFN/SF:%d/%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); From e2b68a99a9ebef163df8c59cef5f221762a81e1e Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Sun, 9 May 2021 12:44:55 +0200 Subject: [PATCH 030/135] CU/DU support for most recent changes. UE continues as far as in monolithic mode. Still to apply masterCellGroupConfig in DU from RRCReconfiguration. This has to be detected in DU and applied after decoding the RRC message intended for UE. --- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 170 +------------------ openair2/GNB_APP/gnb_app.c | 2 +- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 18 -- openair2/RRC/NR/MESSAGES/asn1_msg.c | 3 +- openair2/RRC/NR/nr_rrc_proto.h | 7 + openair2/RRC/NR/rrc_gNB.c | 71 +++++--- 6 files changed, 60 insertions(+), 211 deletions(-) diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 23e6b29217..92ce430bca 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -985,135 +985,6 @@ int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, msg->rrc_container_length); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - if (msg->srb_id == 1 || msg->srb_id == 2) { - struct rrc_gNB_ue_context_s* ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[instance], rnti); - - - NR_UL_DCCH_Message_t* ul_dcch_msg=NULL; - asn_dec_rval_t dec_rval; - dec_rval = uper_decode(NULL, - &asn_DEF_NR_UL_DCCH_Message, - (void**)&ul_dcch_msg, - &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header - msg->rrc_container_length, 0, 0); - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - LOG_E(F1AP, " Failed to decode UL-DCCH (%zu bytes)\n",dec_rval.consumed); - /* for rfsim, because UE send RRCSetupRequest in SRB1 */ - // NR_UL_CCCH_Message_t *ul_ccch_msg; - // dec_rval = uper_decode(NULL, - // &asn_DEF_NR_UL_CCCH_Message, - // (void**)&ul_ccch_msg, - // &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header - // msg->rrc_container_length, 0, 0); - // if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - // LOG_E(F1AP, " Failed to decode UL-CCCH (%zu bytes)\n",dec_rval.consumed); - // } else { - // LOG_I(F1AP, "decode UL-CCCH success \n"); - // LOG_I(F1AP, "Received message: present %d and c1 present %d\n", - // ul_ccch_msg->message.present, ul_ccch_msg->message.choice.c1->present); - - // if (ul_ccch_msg->message.present == NR_UL_CCCH_MessageType_PR_c1) { - // if (ul_ccch_msg->message.choice.c1->present == NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest) { - // LOG_I(F1AP, "[MSG] RRC Setup Request\n"); - - // } - // } - // } - } - else - LOG_I(F1AP, "Received message: present %d and c1 present %d\n", - ul_dcch_msg->message.present, ul_dcch_msg->message.choice.c1->present); - - if (ul_dcch_msg->message.present == NR_UL_DCCH_MessageType_PR_c1) { - - switch (ul_dcch_msg->message.choice.c1->present) { - case NR_UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */ - break; - - case NR_UL_DCCH_MessageType__c1_PR_measurementReport: - break; - - case NR_UL_DCCH_MessageType__c1_PR_rrcReconfigurationComplete: - LOG_I(F1AP, "[MSG] RRC UL rrcReconfigurationComplete\n"); - - /* CDRX: activated when RRC Connection Reconfiguration Complete is received */ -#if(0) - int UE_id_mac = find_nr_UE_id(instance, rnti); - - if (UE_id_mac == -1) { - LOG_E(F1AP, "Can't find UE_id(MAC) of UE rnti %x\n", rnti); - break; - } - - UE_sched_ctrl_t *UE_scheduling_control = &(RC.nrmac[instance]->UE_info.UE_sched_ctrl[UE_id_mac]); - - if (UE_scheduling_control->cdrx_waiting_ack == TRUE) { - UE_scheduling_control->cdrx_waiting_ack = FALSE; - UE_scheduling_control->cdrx_configured = TRUE; // Set to TRUE when RRC Connection Reconfiguration Complete is received - LOG_I(F1AP, "CDRX configuration activated after RRC Connection Reconfiguration Complete reception\n"); - } - /* End of CDRX processing */ -#endif - break; - - case NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete: - LOG_I(F1AP, "[MSG] RRC UL rrcSetupComplete \n"); - - if(!ue_context_p){ - LOG_E(F1AP, "Did not find the UE context associated with UE RNTOI %x, ue_context_p is NULL\n", rnti); - - } else { - LOG_I(F1AP, "Processing RRCSetupComplete UE %x\n", rnti); - ue_context_p->ue_context.Status = NR_RRC_CONNECTED; - } - break; - - case NR_UL_DCCH_MessageType__c1_PR_rrcReestablishmentComplete: - LOG_I(F1AP, "[MSG] RRC ReestablishmentComplete \n"); - break; - - case NR_UL_DCCH_MessageType__c1_PR_rrcResumeComplete: - LOG_I(F1AP, "[MSG] RRC ResumeComplete \n"); - break; - - case NR_UL_DCCH_MessageType__c1_PR_securityModeComplete: - LOG_I(F1AP, "[MSG] RRC securityModeComplete \n"); - break; - - case NR_UL_DCCH_MessageType__c1_PR_securityModeFailure: - LOG_I(F1AP, "[MSG] RRC securityModeFailure \n"); - break; - - case NR_UL_DCCH_MessageType__c1_PR_ulInformationTransfer: - LOG_I(F1AP, "[MSG] RRC UL Information Transfer \n"); - break; - - case NR_UL_DCCH_MessageType__c1_PR_locationMeasurementIndication: - break; - - case NR_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: - LOG_I(F1AP, "[MSG] RRC ueCapabilityInformation \n"); - break; - - case NR_UL_DCCH_MessageType__c1_PR_ueAssistanceInformation: - break; - - case NR_UL_DCCH_MessageType__c1_PR_failureInformation: - break; - - case NR_UL_DCCH_MessageType__c1_PR_scgFailureInformation: - break; - - case NR_UL_DCCH_MessageType__c1_PR_scgFailureInformationEUTRA: - break; - - default: - LOG_E(NR_RRC, "Unknown UL DCCH message type, present %d \n", ul_dcch_msg->message.choice.c1->present); - break; - } - } - } /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(F1AP, "Failed to encode F1 UL RRC MESSAGE TRANSFER \n"); @@ -1291,44 +1162,17 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, rrcSetup_ies->masterCellGroup.size,0,0); AssertFatal(dec_rval.code == RC_OK, "could not decode masterCellGroup\n"); - // configure MAC - rrc_mac_config_req_gNB(ctxt.module_id, - rrc->carrier.ssb_SubcarrierOffset, - rrc->carrier.pdsch_AntennaPorts, - rrc->carrier.pusch_AntennaPorts, - NULL, - 0, - ue_context_p->ue_context.rnti, - ue_context_p->ue_context.masterCellGroup - ); - // rrc_rlc_config_asn1_req - nr_rrc_rlc_config_asn1_req(&ctxt, - ue_context_p->ue_context.SRB_configList, - NULL, - NULL, - NULL, - NULL, - NULL); - // This should be somewhere in the f1ap_cudu_ue_inst_t - /*int macrlc_instance = 0; + apply_macrlc_config(rrc,ue_context_p,&ctxt); - rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[0], du_ue_f1ap_id); - struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[macrlc_instance],rnti); - */ - gNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; - AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n"); + 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*)ie->value.choice.RRCContainer.buf, - rrc_dl_sdu_len); // ie->value.choice.RRCContainer.size + memcpy((void*)ue_p->Srb0.Tx_buffer.Payload, + (void*)ie->value.choice.RRCContainer.buf, + rrc_dl_sdu_len); // ie->value.choice.RRCContainer.size - ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len; + ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len; - // NR_MAC_CellGroupConfig_t *mac_CellGroupConfig = NULL; - // if (cellGroupConfig->mac_CellGroupConfig) - // mac_CellGroupConfig = cellGroupConfig->mac_CellGroupConfig; - - // rrc_mac_config_req_gNB break; } // case diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 767a3c203b..d79d09d409 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -188,7 +188,7 @@ void *gNB_app_task(void *args_p) /* For the CU case the gNB registration with the AMF might have to take place after the F1 setup, as the PLMN info * can originate from the DU. */ - if (AMF_MODE_ENABLED && !NODE_IS_DU(RC.nrrrc[0]->node_type) && !NODE_IS_CU(RC.nrrrc[0]->node_type)) { + if (AMF_MODE_ENABLED && !NODE_IS_DU(RC.nrrrc[0]->node_type)) { /* Try to register each gNB */ //registered_gnb = 0; __attribute__((unused)) uint32_t register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 15ed2fcad1..e229e94e1d 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -48,7 +48,6 @@ extern RAN_CONTEXT_t RC; #include static nr_rlc_ue_manager_t *nr_rlc_ue_manager; -uint8_t ccch_flag = 1; /* TODO: handle time a bit more properly */ static uint64_t nr_rlc_current_time; @@ -490,23 +489,6 @@ rb_found: if (NODE_IS_DU(type) && is_srb == 1) { MessageDef *msg; - if (ccch_flag) { - /* for rfsim, because UE send RRCSetupRequest in SRB1 */ - LOG_I(RLC, "[MSG] RRC Setup Request\n"); - msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_INITIAL_UL_RRC_MESSAGE); - F1AP_INITIAL_UL_RRC_MESSAGE(msg).gNB_DU_ue_id = 0; - F1AP_INITIAL_UL_RRC_MESSAGE(msg).mcc = RC.nrrrc[0]->configuration.mcc[0]; - F1AP_INITIAL_UL_RRC_MESSAGE(msg).mnc = RC.nrrrc[0]->configuration.mnc[0]; - F1AP_INITIAL_UL_RRC_MESSAGE(msg).mnc_digit_length = RC.nrrrc[0]->configuration.mnc_digit_length[0]; - F1AP_INITIAL_UL_RRC_MESSAGE(msg).nr_cellid = RC.nrrrc[0]->nr_cellid; - F1AP_INITIAL_UL_RRC_MESSAGE(msg).crnti = ue->rnti; - F1AP_INITIAL_UL_RRC_MESSAGE(msg).rrc_container = (unsigned char *)buf; - F1AP_INITIAL_UL_RRC_MESSAGE(msg).rrc_container_length = size; - itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0), msg); - ccch_flag = 0; - return; - } - msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE); F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti; F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 47dadb9c23..4ab831ae90 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1358,7 +1358,6 @@ uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t)); fill_initial_cellGroupConfig(ue_context_pP->ue_context.rnti,cellGroupConfig,scc); - ue_p->masterCellGroup = cellGroupConfig; enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, @@ -1378,6 +1377,8 @@ uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, } } + ue_p->masterCellGroup = cellGroupConfig; + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout, &asn_DEF_NR_DL_CCCH_Message, (void *)&dl_ccch_msg); } diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 72165e97c9..bae0367eac 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -104,6 +104,13 @@ int generate_CG_Config(gNB_RRC_INST *rrc, NR_RRCReconfiguration_t *reconfig, NR_RadioBearerConfig_t *rbconfig); +void apply_macrlc_config(gNB_RRC_INST *rrc, + rrc_gNB_ue_context_t *const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP ); + +void apply_pdcp_config(rrc_gNB_ue_context_t *const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP ); + void rrc_gNB_generate_RRCSetup( const protocol_ctxt_t *const ctxt_pP, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 3225009652..d725a7ff79 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -379,6 +379,46 @@ rrc_gNB_get_next_transaction_identifier( return nr_rrc_transaction_identifier[gnb_mod_idP]; } +void apply_macrlc_config(gNB_RRC_INST *rrc, + rrc_gNB_ue_context_t *const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP ) { + + rrc_mac_config_req_gNB(rrc->module_id, + rrc->carrier.ssb_SubcarrierOffset, + rrc->carrier.pdsch_AntennaPorts, + rrc->carrier.pusch_AntennaPorts, + NULL, + 0, + ue_context_pP->ue_context.rnti, + ue_context_pP->ue_context.masterCellGroup + ); + nr_rrc_rlc_config_asn1_req(ctxt_pP, + ue_context_pP->ue_context.SRB_configList, + NULL, + NULL, + NULL, + ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList, + NULL); +} + +void apply_pdcp_config(rrc_gNB_ue_context_t *const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP ) { + + nr_rrc_pdcp_config_asn1_req(ctxt_pP, + ue_context_pP->ue_context.SRB_configList, + NULL, + NULL, + 0xff, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList); + +} + //----------------------------------------------------------------------------- void rrc_gNB_generate_RRCSetup( @@ -489,34 +529,9 @@ rrc_gNB_generate_RRCSetup( // ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0; // configure MAC - rrc_mac_config_req_gNB(rrc->module_id, - rrc->carrier.ssb_SubcarrierOffset, - rrc->carrier.pdsch_AntennaPorts, - rrc->carrier.pusch_AntennaPorts, - NULL, - 0, - ue_context_pP->ue_context.rnti, - ue_context_pP->ue_context.masterCellGroup - ); - nr_rrc_rlc_config_asn1_req(ctxt_pP, - ue_context_pP->ue_context.SRB_configList, - NULL, - NULL, - NULL, - ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList, - NULL); - nr_rrc_pdcp_config_asn1_req(ctxt_pP, - ue_context_pP->ue_context.SRB_configList, - NULL, - NULL, - 0xff, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList); + apply_macrlc_config(rrc,ue_context_pP,ctxt_pP); + + apply_pdcp_config(ue_context_pP,ctxt_pP); #endif } break; From 7ee6b61f4b69e1f960a29631d8b54f81eba330ad Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 10 May 2021 11:29:49 +0200 Subject: [PATCH 031/135] bug fixes --- cmake_targets/CMakeLists.txt | 2 +- common/utils/LOG/log.c | 2 +- openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 +- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 12 +++++++++++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index e7ef4c625b..775110a774 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -347,7 +347,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CU ######################### # set a flag for changes in the source code # these changes are related to hardcoded path to include .h files -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -O0 -DMALLOC_CHECK_=3") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -Og -DMALLOC_CHECK_=3") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3 -O2 -fno-delete-null-pointer-checks") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3") diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index 8029ba826b..d0a53a755b 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -460,7 +460,7 @@ int logInit (void) register_log_component("LOCALIZE","log",LOCALIZE); register_log_component("NAS","log",NAS); register_log_component("UDP","",UDP_); - register_log_component("GTPV1U","",GTPU); + register_log_component("GTPU","",GTPU); register_log_component("S1AP","",S1AP); register_log_component("F1AP","",F1AP); register_log_component("M2AP","",M2AP); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index 099ff37954..e75a3225e5 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -288,7 +288,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, } G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,rel15->nrOfLayers); - LOG_D(PHY,"dlsch coding A %d G %d (nb_rb %d, nb_symb_sch %d, nb_re_dmrs %d, length_dmrs %d, mod_order %d mod_order %d)\n", A,G, nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs,(int)mod_order); + LOG_D(PHY,"dlsch coding A %d G %d (nb_rb %d, nb_symb_sch %d, nb_re_dmrs %d, length_dmrs %d, mod_order %d)\n", A,G, nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs,(int)mod_order); if (A > 3824) { // Add 24-bit crc (polynomial A) to payload diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 658b526cef..a146c11f59 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -311,7 +311,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_t slot){ - protocol_ctxt_t ctxt; + protocol_ctxt_t ctxt={0}; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame, slot,module_idP); int nb_periods_per_frame; diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 90f8fec6a7..121652062a 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -700,7 +700,17 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP) { MessageDef *msg_p; int result; - protocol_ctxt_t ctxt; + protocol_ctxt_t ctxt={.module_id=0, + .enb_flag=1, + .instance=0, + .rnti=0, + .frame=-1, + .subframe=-1, + .eNB_index=0, + .configured=true, + .brOption=false + }; + while (1) { itti_poll_msg(ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, &msg_p); From 98e3afe7dbc58bae5ee53206d5aebcd65430a20c Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 10 May 2021 11:52:43 +0200 Subject: [PATCH 032/135] fix random crash (uninitialized memory) --- openair2/RRC/NR/rrc_gNB.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index d725a7ff79..58b0c18fa0 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -2808,7 +2808,16 @@ void *rrc_gnb_task(void *args_p) { int result; //SRB_INFO *srb_info_p; //int CC_id; - protocol_ctxt_t ctxt; + protocol_ctxt_t ctxt={.module_id=0, + .enb_flag=1, + .instance=0, + .rnti=0, + .frame=-1, + .subframe=-1, + .eNB_index=0, + .configured=true, + .brOption=false + }; itti_mark_task_ready(TASK_RRC_GNB); LOG_I(NR_RRC,"Entering main loop of NR_RRC message task\n"); @@ -3249,7 +3258,7 @@ rrc_gNB_generate_RRCRelease( GNB_RRC_DCCH_DATA_IND (message_p).size = size; itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); #else - if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { + if (NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) { MessageDef *m = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_RELEASE_CMD); F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; From 64cb9407ba9f287f5046db8caa1f82f27a85485f Mon Sep 17 00:00:00 2001 From: matzakos Date: Tue, 11 May 2021 22:19:55 +0200 Subject: [PATCH 033/135] Add support for Initial context setup request carrying PDU Session resource setup list -Apply patch from Fujitsu -Trigger dedicated RRC Reconfiguration with DRB and SRB2 configuration once the PDU session is established -Validation of control plane sequence with OAI CN and Nokia SA Box --- openair2/RRC/NR/nr_rrc_defs.h | 1 + openair2/RRC/NR/rrc_gNB.c | 59 ++++++++++---- openair2/RRC/NR/rrc_gNB_NGAP.c | 101 ++++++++++++++++++------ openair3/NGAP/ngap_gNB_handlers.c | 6 ++ openair3/NGAP/ngap_gNB_nas_procedures.c | 30 +++++-- 5 files changed, 150 insertions(+), 47 deletions(-) diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 1483693ac6..f6ab045c3b 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -381,6 +381,7 @@ typedef struct gNB_RRC_UE_s { uint32_t ue_reestablishment_timer_thres; uint8_t e_rab_release_command_flag; uint8_t pdu_session_release_command_flag; + uint8_t established_pdu_sessions_flag; uint32_t ue_rrc_inactivity_timer; int8_t reestablishment_xid; //------------------------------------------------------------------------------// diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 58b0c18fa0..5b53cff0f5 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -803,6 +803,22 @@ rrc_gNB_generate_defaultRRCReconfiguration( dedicatedNAS_MessageList = CALLOC(1, sizeof(struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList)); + /* Add all NAS PDUs to the list */ + for (int i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { + if (ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer != NULL) { + dedicatedNAS_Message = CALLOC(1, sizeof(NR_DedicatedNAS_Message_t)); + memset(dedicatedNAS_Message, 0, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(dedicatedNAS_Message, + (char *)ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.pdusession[i].param.nas_pdu.length); + ASN_SEQUENCE_ADD(&dedicatedNAS_MessageList->list, dedicatedNAS_Message); + } + + ue_context_pP->ue_context.pdusession[i].status = PDU_SESSION_STATUS_DONE; + LOG_D(NR_RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", + i, ue_context_pP->ue_context.pdusession[i].status, "PDU_SESSION_STATUS_DONE"); + } + if (ue_context_pP->ue_context.nas_pdu_flag == 1) { dedicatedNAS_Message = CALLOC(1, sizeof(NR_DedicatedNAS_Message_t)); memset(dedicatedNAS_Message, 0, sizeof(OCTET_STRING_t)); @@ -834,6 +850,15 @@ rrc_gNB_generate_defaultRRCReconfiguration( free(ue_context_pP->ue_context.nas_pdu.buffer); LOG_DUMPMSG(NR_RRC, DEBUG_RRC,(char *)buffer, size, "[MSG] RRC Reconfiguration\n"); + + /* Free all NAS PDUs */ + for (int i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { + if (ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer != NULL) { + free(ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer); + ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer = NULL; + } + } + LOG_I(NR_RRC, "[gNB %d] Frame %d, Logical Channel DL-DCCH, Generate NR_RRCReconfiguration (bytes %d, UE id %x)\n", ctxt_pP->module_id, ctxt_pP->frame, @@ -935,15 +960,14 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( /* Configure SRB2 */ SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid]; - if (*SRB_configList2) { - free(*SRB_configList2); + if (*SRB_configList2 == NULL) { + *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); + memset(*SRB_configList2, 0, sizeof(**SRB_configList2)); + SRB2_config = CALLOC(1, sizeof(*SRB2_config)); + SRB2_config->srb_Identity = 2; + ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config); + ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); } - *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); - memset(*SRB_configList2, 0, sizeof(**SRB_configList2)); - SRB2_config = CALLOC(1, sizeof(*SRB2_config)); - SRB2_config->srb_Identity = 2; - ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config); - ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); DRB_configList = &ue_context_pP->ue_context.DRB_configList; if (*DRB_configList) { @@ -2294,13 +2318,14 @@ rrc_gNB_decode_dcch( itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->instance, msg_delete_tunnels_p); //NGAP_PDUSESSION_RELEASE_RESPONSE rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(ctxt_pP, ue_context_p, xid); - } else { - rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(ctxt_pP, - ue_context_p, - ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete->rrc_TransactionIdentifier); + } else if (ue_context_p->ue_context.established_pdu_sessions_flag != 1) { + if (ue_context_p->ue_context.setup_pdu_sessions > 0) { + rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(ctxt_pP, + ue_context_p, + ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete->rrc_TransactionIdentifier); + } } } - if (first_rrcreconfiguration == 0){ first_rrcreconfiguration = 1; rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, ue_context_p); @@ -2581,7 +2606,13 @@ rrc_gNB_decode_dcch( ue_context_p, ul_dcch_msg); } - rrc_gNB_generate_defaultRRCReconfiguration(ctxt_pP, ue_context_p); + + if (ue_context_p->ue_context.established_pdu_sessions_flag == 1) { + rrc_gNB_generate_dedicatedRRCReconfiguration(ctxt_pP, ue_context_p); + } else { + rrc_gNB_generate_defaultRRCReconfiguration(ctxt_pP, ue_context_p); + } + break; case NR_UL_DCCH_MessageType__c1_PR_rrcReestablishmentComplete: diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index dc9a53acc2..c996b7af20 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -57,6 +57,8 @@ #include "RRC/NR/MESSAGES/asn1_msg.h" #include "NR_UERadioAccessCapabilityInformation.h" #include "NR_UE-CapabilityRAT-ContainerList.h" +#include "NGAP_Cause.h" +#include "NGAP_CauseRadioNetwork.h" #include "f1ap_messages_types.h" extern RAN_CONTEXT_t RC; @@ -506,6 +508,10 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ( rrc_gNB_ue_context_t *ue_context_p = NULL; protocol_ctxt_t ctxt; uint8_t pdu_sessions_done = 0; + gtpv1u_gnb_create_tunnel_req_t create_tunnel_req; + gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp; + uint8_t inde_list[NR_NB_RB_MAX - 3]= {0}; + int ret = 0; ue_initial_id = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).ue_initial_id; gNB_ue_ngap_id = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).gNB_ue_ngap_id; @@ -529,28 +535,64 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ( ue_context_p->ue_context.amf_ue_ngap_id = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).amf_ue_ngap_id; ue_context_p->ue_context.nas_pdu_flag = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nas_pdu_flag; - if (NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nb_of_pdusessions != 0) { - ue_context_p->ue_context.nb_of_pdusessions = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nb_of_pdusessions; + uint8_t nb_pdusessions_tosetup = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_pdusessions; + if (nb_pdusessions_tosetup != 0) { + memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t)); 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; - ue_context_p->ue_context.pdusession[i].status = PDU_SESSION_STATUS_NEW; - ue_context_p->ue_context.pdusession[i].param = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done]; - pdu_sessions_done++; + continue; + ue_context_p->ue_context.pdusession[i].status = PDU_SESSION_STATUS_NEW; + 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.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[i].upf_addr.length; + memcpy(create_tunnel_req.upf_addr[pdu_sessions_done].buffer, + NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[i].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[i], + create_tunnel_req.pdusession_id[i]); + inde_list[pdu_sessions_done] = i; + pdu_sessions_done++; - // TODO establish PDU SESSION - - if(pdu_sessions_done >= NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nb_of_pdusessions) { - break; - } + if(pdu_sessions_done >= nb_pdusessions_tosetup) { + break; + } } + + ue_context_p->ue_context.nb_of_pdusessions = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_pdusessions; + create_tunnel_req.rnti = ue_context_p->ue_context.rnti; + create_tunnel_req.num_tunnels = pdu_sessions_done; + + ret = gtpv1u_create_ngu_tunnel( + instance, + &create_tunnel_req, + &create_tunnel_resp); + if (ret != 0) { + LOG_E(NR_RRC,"rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ : gtpv1u_create_ngu_tunnel failed,start to release UE %x\n",ue_context_p->ue_context.rnti); + ue_context_p->ue_context.ue_release_timer_ng = 1; + ue_context_p->ue_context.ue_release_timer_thres_ng = 100; + ue_context_p->ue_context.ue_release_timer = 0; + ue_context_p->ue_context.ue_reestablishment_timer = 0; + ue_context_p->ue_context.ul_failure_timer = 20000; + ue_context_p->ue_context.ul_failure_timer = 0; + return (0); + } + + nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( + &ctxt, + &create_tunnel_resp, + &inde_list[0]); + ue_context_p->ue_context.setup_pdu_sessions += nb_pdusessions_tosetup; + ue_context_p->ue_context.established_pdu_sessions_flag = 1; } /* NAS PDU */ - ue_context_p->ue_context.nas_pdu_flag = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nas_pdu_flag; - if (ue_context_p->ue_context.nas_pdu_flag == 1) { - ue_context_p->ue_context.nas_pdu.length = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nas_pdu.length; - ue_context_p->ue_context.nas_pdu.buffer = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nas_pdu.buffer; + if (NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nas_pdu_flag == 1) { + ue_context_p->ue_context.nas_pdu_flag = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nas_pdu_flag; + ue_context_p->ue_context.nas_pdu.length = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nas_pdu.length; + ue_context_p->ue_context.nas_pdu.buffer = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nas_pdu.buffer; } /* security */ @@ -600,25 +642,34 @@ rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP( { MessageDef *msg_p = NULL; int pdusession; - int e_rabs_done = 0; - int e_rabs_failed = 0; + int pdu_sessions_done = 0; + int pdu_sessions_failed = 0; + int qos_flow_index = 0; msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, NGAP_INITIAL_CONTEXT_SETUP_RESP); NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).gNB_ue_ngap_id = ue_context_pP->ue_context.gNB_ue_ngap_id; for (pdusession = 0; pdusession < ue_context_pP->ue_context.nb_of_pdusessions; pdusession++) { - if (ue_context_pP->ue_context.pdusession[pdusession].status == E_RAB_STATUS_DONE) { - e_rabs_done++; + if (ue_context_pP->ue_context.pdusession[pdusession].status == PDU_SESSION_STATUS_DONE) { + pdu_sessions_done++; NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].pdusession_id = ue_context_pP->ue_context.pdusession[pdusession].param.pdusession_id; // TODO add other information from S1-U when it will be integrated NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].gtp_teid = ue_context_pP->ue_context.gnb_gtp_teid[pdusession]; memcpy(NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].gNB_addr.buffer , ue_context_pP->ue_context.gnb_gtp_addrs[pdusession].buffer, 20); NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].gNB_addr.length = 4; - ue_context_pP->ue_context.pdusession[pdusession].status = E_RAB_STATUS_ESTABLISHED; + ue_context_pP->ue_context.pdusession[pdusession].status = PDU_SESSION_STATUS_ESTABLISHED; + NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].nb_of_qos_flow = ue_context_pP->ue_context.pdusession[pdusession].param.nb_qos; + for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.pdusession[pdusession].param.nb_qos; qos_flow_index++) { + NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].associated_qos_flows[qos_flow_index].qfi = + ue_context_pP->ue_context.pdusession[pdusession].param.qos[qos_flow_index].qfi; + NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].associated_qos_flows[qos_flow_index].qos_flow_mapping_ind = QOSFLOW_MAPPING_INDICATION_DL; + } } else { - e_rabs_failed++; - ue_context_pP->ue_context.pdusession[pdusession].status = E_RAB_STATUS_FAILED; + pdu_sessions_failed++; + ue_context_pP->ue_context.pdusession[pdusession].status = PDU_SESSION_STATUS_FAILED; NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions_failed[pdusession].pdusession_id = ue_context_pP->ue_context.pdusession[pdusession].param.pdusession_id; // TODO add cause when it will be integrated + NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions_failed[pdusession].cause = NGAP_Cause_PR_radioNetwork; + NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions_failed[pdusession].cause_value = NGAP_CauseRadioNetwork_unknown_PDU_session_ID; } } @@ -631,9 +682,9 @@ rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP( MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_id_rnti, NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).gNB_ue_ngap_id, - e_rabs_done, e_rabs_failed); - NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_pdusessions = e_rabs_done; - NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_pdusessions_failed = e_rabs_failed; + pdu_sessions_done, pdu_sessions_failed); + NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_pdusessions = pdu_sessions_done; + NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_pdusessions_failed = pdu_sessions_failed; itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, msg_p); } diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index e398f8fa3e..38b6bcac3e 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -1030,6 +1030,12 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, /* Set the QOS informations */ NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].qfi = (uint8_t)qosFlowItem_p->qosFlowIdentifier; + if(qosFlowItem_p->qosFlowLevelQosParameters.qosCharacteristics.present == NGAP_QosCharacteristics_PR_nonDynamic5QI){ + if(qosFlowItem_p->qosFlowLevelQosParameters.qosCharacteristics.choice.nonDynamic5QI != NULL){ + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].fiveQI = + (uint64_t)qosFlowItem_p->qosFlowLevelQosParameters.qosCharacteristics.choice.nonDynamic5QI->fiveQI; + } + } NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].allocation_retention_priority.priority_level = qosFlowItem_p->qosFlowLevelQosParameters.allocationAndRetentionPriority.priorityLevelARP; diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c index 6b61643588..4e149d9e27 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -656,6 +656,7 @@ int ngap_gNB_initial_ctxt_resp( NGAP_InitialContextSetupResponse_t *out; NGAP_InitialContextSetupResponseIEs_t *ie; uint8_t *buffer = NULL; + uint8_t pdusessionTransfer_buffer[1000]; uint32_t length; int i; asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; @@ -729,7 +730,8 @@ int ngap_gNB_initial_ctxt_resp( pdusessionTransfer_p = (NGAP_PDUSessionResourceSetupResponseTransfer_t *)calloc(1, sizeof(NGAP_PDUSessionResourceSetupResponseTransfer_t)); pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.present = NGAP_UPTransportLayerInformation_PR_gTPTunnel; - + + pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel = (NGAP_GTPTunnel_t *)calloc(1, sizeof(NGAP_GTPTunnel_t)); GTP_TEID_TO_ASN1(initial_ctxt_resp_p->pdusessions[i].gtp_teid, &pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->gTP_TEID); pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf = malloc(initial_ctxt_resp_p->pdusessions[i].gNB_addr.length); @@ -757,17 +759,27 @@ int ngap_gNB_initial_ctxt_resp( ass_qos_item_p->qosFlowIdentifier = initial_ctxt_resp_p->pdusessions[i].associated_qos_flows[j].qfi; /* qosFlowMappingIndication */ - if(initial_ctxt_resp_p->pdusessions[i].associated_qos_flows[j].qos_flow_mapping_ind != QOSFLOW_MAPPING_INDICATION_NON) { - ass_qos_item_p->qosFlowMappingIndication = malloc(sizeof(*ass_qos_item_p->qosFlowMappingIndication)); - *ass_qos_item_p->qosFlowMappingIndication = initial_ctxt_resp_p->pdusessions[i].associated_qos_flows[j].qos_flow_mapping_ind; - } + //if(initial_ctxt_resp_p->pdusessions[i].associated_qos_flows[j].qos_flow_mapping_ind != QOSFLOW_MAPPING_INDICATION_NON) { + // ass_qos_item_p->qosFlowMappingIndication = malloc(sizeof(*ass_qos_item_p->qosFlowMappingIndication)); + // *ass_qos_item_p->qosFlowMappingIndication = initial_ctxt_resp_p->pdusessions[i].associated_qos_flows[j].qos_flow_mapping_ind; + // } ASN_SEQUENCE_ADD(&pdusessionTransfer_p->dLQosFlowPerTNLInformation.associatedQosFlowList.list, ass_qos_item_p); } memset(&res, 0, sizeof(res)); - res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, pdusessionTransfer_p); - item->pDUSessionResourceSetupResponseTransfer.buf = res.buffer; - item->pDUSessionResourceSetupResponseTransfer.size = res.result.encoded; + //res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, pdusessionTransfer_p); + //item->pDUSessionResourceSetupResponseTransfer.buf = res.buffer; + //item->pDUSessionResourceSetupResponseTransfer.size = res.result.encoded; + + xer_fprint(stdout, &asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, pdusessionTransfer_p); + memset(pdusessionTransfer_buffer, 0, 1000); + asn_enc_rval_t enc_rval = aper_encode_to_buffer(&asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, + NULL, + pdusessionTransfer_p, + pdusessionTransfer_buffer,1000); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); + item->pDUSessionResourceSetupResponseTransfer.buf = pdusessionTransfer_buffer; + item->pDUSessionResourceSetupResponseTransfer.size = enc_rval.encoded; ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, pdusessionTransfer_p); @@ -846,6 +858,8 @@ int ngap_gNB_initial_ctxt_resp( ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } + xer_fprint(stdout, &asn_DEF_NGAP_NGAP_PDU, &pdu); + if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) { NGAP_ERROR("Failed to encode InitialContextSetupResponse\n"); /* Encode procedure has failed... */ From 586fc52f8d992ddb92234149f10e6b0136196f4f Mon Sep 17 00:00:00 2001 From: Eurecom Date: Thu, 13 May 2021 09:09:09 +0200 Subject: [PATCH 034/135] 50 MHz formats, prach RX scaling --- openair1/PHY/NR_TRANSPORT/nr_dci.c | 1 - openair1/PHY/NR_TRANSPORT/nr_prach.c | 2 +- openair1/SCHED_NR/nr_prach_procedures.c | 6 ++++-- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index cf38aaa4bf..b7de182ab7 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -94,7 +94,6 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, * in time: by its first slot and its first symbol*/ const nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[d]; - LOG_D(PHY,"DCI pdu %d, rnti %x, aggregation %d CCE %d Scrambling_Id %x ScramblingRNTI %x PayloadSizeBits %d\n",d,dci_pdu->RNTI,dci_pdu->AggregationLevel,dci_pdu->CceIndex,dci_pdu->ScramblingId,dci_pdu->ScramblingRNTI,dci_pdu->PayloadSizeBits); cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex; cset_nsymb = pdcch_pdu_rel15->DurationSymbols; dci_idx = 0; diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index 34c647810d..638b0dff2c 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -882,7 +882,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, log2_ifft_size = 8; // compute energy and accumulate over receive antennas and repetitions for BR for (i=0;i<256;i++) - prach_ifft[i] += ((int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[(i<<1)] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)])>>10; + prach_ifft[i] += ((int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[(i<<1)] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)])/nb_rx; } if (LOG_DUMPFLAG(PRACH)) { diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index 533dbb8e1a..848b11dcde 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -114,23 +114,25 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { &max_preamble_delay[0] ); free_nr_prach_entry(gNB,prach_id); - LOG_D(PHY,"[RAPROC] Frame %d, slot %d, occasion %d (prachStartSymbol %d) : Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d)\n", + LOG_D(PHY,"[RAPROC] Frame %d, slot %d, occasion %d (prachStartSymbol %d) : Most likely preamble %d, energy %d.%d dB delay %d (prach_energy counter %d)\n", frame,slot,prach_oc,prachStartSymbol, max_preamble[0], max_preamble_energy[0]/10, + max_preamble_energy[0]%10, max_preamble_delay[0], gNB->prach_energy_counter); if ((gNB->prach_energy_counter == 100) && (max_preamble_energy[0] > gNB->measurements.prach_I0+gNB->prach_thres)) { - LOG_I(PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d start symbol %u freq index %u\n", + LOG_I(PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB (I0 %d, thres %d), delay %d start symbol %u freq index %u\n", gNB->Mod_id, frame, slot, max_preamble[0], max_preamble_energy[0]/10, max_preamble_energy[0]%10, + gNB->measurements.prach_I0,gNB->prach_thres, max_preamble_delay[0], prachStartSymbol, prach_pdu->num_ra); diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index b472d7a9ba..1014be0e44 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -680,7 +680,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot),gNB->pusch_thres); nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1); gNB->pusch_vars[ULSCH_id]->DTX=1; - stats->DTX++; + if (stats) stats->DTX++; return; } else gNB->pusch_vars[ULSCH_id]->DTX=0; From 4c3b718825c7c81cc22332a3baad8132be5cba0e Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Thu, 13 May 2021 09:11:34 +0200 Subject: [PATCH 035/135] commit before merge --- openair1/PHY/NR_TRANSPORT/nr_prach.c | 54 ++++++++++++++-------------- openair2/RRC/NR/MESSAGES/asn1_msg.c | 15 ++++---- 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index 34c647810d..88c95772e2 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -858,37 +858,37 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, memset(prachF, 0, sizeof(int16_t)*2*1024 ); if (LOG_DUMPFLAG(PRACH)) { - LOG_M("prach_rxF0.m","prach_rxF0",rxsigF[0],N_ZC,1,1); - LOG_M("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1); + LOG_M("prach_rxF0.m","prach_rxF0",rxsigF[0],N_ZC,1,1); + LOG_M("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1); } for (aa=0;aa>15); - prachF[offset+1] = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][offset+1] - (int32_t)Xu[offset+1]*rxsigF[aa][offset])>>15); - } + for (offset=0; offset<(N_ZC<<1); offset+=2) { + prachF[offset] = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][offset] + (int32_t)Xu[offset+1]*rxsigF[aa][offset+1])>>15); + prachF[offset+1] = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][offset+1] - (int32_t)Xu[offset+1]*rxsigF[aa][offset])>>15); + } - // Now do IFFT of size 1024 (N_ZC=839) or 256 (N_ZC=139) - if (N_ZC == 839) { - log2_ifft_size = 10; - idft(IDFT_1024,prachF,prach_ifft_tmp,1); - // compute energy and accumulate over receive antennas - for (i=0;i<2048;i++) - prach_ifft[i] += ((int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[i<<1] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)])>>10; - } else { - idft(IDFT_256,prachF,prach_ifft_tmp,1); - log2_ifft_size = 8; + // Now do IFFT of size 1024 (N_ZC=839) or 256 (N_ZC=139) + if (N_ZC == 839) { + log2_ifft_size = 10; + idft(IDFT_1024,prachF,prach_ifft_tmp,1); + // compute energy and accumulate over receive antennas + for (i=0;i<2048;i++) + prach_ifft[i] += ((int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[i<<1] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)])/nb_rx; + } else { + idft(IDFT_256,prachF,prach_ifft_tmp,1); + log2_ifft_size = 8; // compute energy and accumulate over receive antennas and repetitions for BR - for (i=0;i<256;i++) - prach_ifft[i] += ((int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[(i<<1)] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)])>>10; - } + for (i=0;i<256;i++) + prach_ifft[i] += ((int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[(i<<1)] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)])/nb_rx; + } - if (LOG_DUMPFLAG(PRACH)) { - if (aa==0) LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1); - if (aa==1) LOG_M("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1); - } + if (LOG_DUMPFLAG(PRACH)) { + if (aa==0) LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1); + if (aa==1) LOG_M("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1); + } }// antennas_rx } // new dft @@ -900,10 +900,10 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, lev = (int32_t)prach_ifft[(preamble_shift2+i)]; levdB = dB_fixed_times10(lev); if (levdB>*max_preamble_energy) { - LOG_D(PHY,"preamble_index %d, delay %d en %d dB > %d dB\n",preamble_index,i,levdB,*max_preamble_energy); - *max_preamble_energy = levdB; - *max_preamble_delay = i; // Note: This has to be normalized to the 30.72 Ms/s sampling rate - *max_preamble = preamble_index; + LOG_D(PHY,"preamble_index %d, delay %d en %d dB > %d dB\n",preamble_index,i,levdB,*max_preamble_energy); + *max_preamble_energy = levdB; + *max_preamble_delay = i; // Note: This has to be normalized to the 30.72 Ms/s sampling rate + *max_preamble = preamble_index; } } }// preamble_index diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 4ab831ae90..d2dc25decd 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1631,13 +1631,14 @@ uint16_t do_RRCReconfiguration( // *security_config->keyToUse = NR_SecurityConfig__keyToUse_master; ie = calloc(1, sizeof(NR_RRCReconfiguration_IEs_t)); - ie->radioBearerConfig = calloc(1, sizeof(NR_RadioBearerConfig_t)); - ie->radioBearerConfig->srb_ToAddModList = SRB_configList; - ie->radioBearerConfig->drb_ToAddModList = DRB_configList; - ie->radioBearerConfig->securityConfig = security_config; - ie->radioBearerConfig->srb3_ToRelease = NULL; - ie->radioBearerConfig->drb_ToReleaseList = DRB_releaseList; - + if (SRB_configList || DRB_configList) { + ie->radioBearerConfig = calloc(1, sizeof(NR_RadioBearerConfig_t)); + ie->radioBearerConfig->srb_ToAddModList = SRB_configList; + ie->radioBearerConfig->drb_ToAddModList = DRB_configList; + ie->radioBearerConfig->securityConfig = security_config; + ie->radioBearerConfig->srb3_ToRelease = NULL; + ie->radioBearerConfig->drb_ToReleaseList = DRB_releaseList; + } /******************** Secondary Cell Group ********************/ // rrc_gNB_carrier_data_t *carrier = &(gnb_rrc_inst->carrier); // fill_default_secondaryCellGroup( carrier->servingcellconfigcommon, From 1a8c9a562fa8263c1a2f734f436c7cac57d2acfb Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Fri, 14 May 2021 15:53:58 +0200 Subject: [PATCH 036/135] small changes for multiple lcid handling in gNB scheduler. PUSCH DTX handling and suspension of scheduling when UL failure is detected --- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 5 +- openair2/LAYER2/NR_MAC_gNB/config.c | 105 ++++++++++++++++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 6 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 15 ++- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 1 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 5 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 16 ++- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 6 +- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 + 9 files changed, 129 insertions(+), 32 deletions(-) diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 1014be0e44..fad1d79dd3 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -356,7 +356,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH } -void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag) { + void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag) { pthread_mutex_lock(&gNB->UL_INFO_mutex); @@ -675,9 +675,10 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot) + gNB->pusch_thres) { NR_gNB_SCH_STATS_t *stats=get_ulsch_stats(gNB,ulsch); - LOG_I(PHY, "PUSCH not detected in %d.%d (%d,%d,%d)\n",frame_rx,slot_rx, + LOG_D(PHY, "PUSCH not detected in %d.%d (%d,%d,%d)\n",frame_rx,slot_rx, dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot), dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot),gNB->pusch_thres); + gNB->pusch_vars[ULSCH_id]->ulsch_power_tot = gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot; nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1); gNB->pusch_vars[ULSCH_id]->DTX=1; if (stats) stats->DTX++; diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 64c18d969c..6bdd2ff06b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -54,6 +54,87 @@ extern RAN_CONTEXT_t RC; extern void mac_top_init_gNB(void); extern uint8_t nfapi_mode; +void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list, + struct NR_CellGroupConfig__rlc_BearerToReleaseList *rlc_bearer2release_list, + NR_UE_sched_ctrl_t *sched_ctrl) { + + if (rlc_bearer2add_list) + // keep lcids + for (int i=0;ilist.count;i++) { + sched_ctrl->lcid_mask |= (1<list.array[i]->logicalChannelIdentity); + LOG_I(NR_MAC,"Adding LCID %d (%s %d)\n", + (int)rlc_bearer2add_list->list.array[i]->logicalChannelIdentity, + rlc_bearer2add_list->list.array[i]->logicalChannelIdentity<4 ? "SRB" : "DRB", + (int)rlc_bearer2add_list->list.array[i]->logicalChannelIdentity); + } + if (rlc_bearer2release_list) + for (int i=0;ilist.count;i++) + sched_ctrl->lcid_mask |= (1<<*rlc_bearer2release_list->list.array[i]); + +} + + +void process_drx_Config(NR_UE_sched_ctrl_t *sched_ctrl,NR_SetupRelease_DRX_Config_t *drx_Config) { + if (!drx_Config) return; + AssertFatal(drx_Config->present != NR_SetupRelease_DRX_Config_PR_NOTHING, "Cannot have NR_SetupRelease_DRX_Config_PR_NOTHING\n"); + + if (drx_Config->present == NR_SetupRelease_DRX_Config_PR_setup) { + LOG_I(NR_MAC,"Adding DRX config\n"); + } + else { + LOG_I(NR_MAC,"Removing DRX config\n"); + } +} + +void process_schedulingRequestConfig(NR_UE_sched_ctrl_t *sched_ctrl,NR_SchedulingRequestConfig_t *schedulingRequestConfig) { + if (!schedulingRequestConfig) return; + + LOG_I(NR_MAC,"Adding SchedulingRequestconfig\n"); +} + +void process_bsrConfig(NR_UE_sched_ctrl_t *sched_ctrl,NR_BSR_Config_t *bsr_Config) { + if (!bsr_Config) return; + LOG_I(NR_MAC,"Adding BSR config\n"); +} + +void process_tag_Config(NR_UE_sched_ctrl_t *sched_ctrl,NR_TAG_Config_t *tag_Config) { + if (!tag_Config) return; + LOG_I(NR_MAC,"Adding TAG config\n"); +} + +void process_phr_Config(NR_UE_sched_ctrl_t *sched_ctrl,NR_SetupRelease_PHR_Config_t *phr_Config) { + if (!phr_Config) return; + AssertFatal(phr_Config->present != NR_SetupRelease_PHR_Config_PR_NOTHING, "Cannot have NR_SetupRelease_PHR_Config_PR_NOTHING\n"); + + if (phr_Config->present == NR_SetupRelease_PHR_Config_PR_setup) { + LOG_I(NR_MAC,"Adding PHR config\n"); + } + else { + LOG_I(NR_MAC,"Removing PHR config\n"); + } +} + +void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl) { + + AssertFatal(CellGroup, "CellGroup is null\n"); + NR_MAC_CellGroupConfig_t *mac_CellGroupConfig = CellGroup->mac_CellGroupConfig; + + + if (mac_CellGroupConfig) { + process_drx_Config(sched_ctrl,mac_CellGroupConfig->drx_Config); + process_schedulingRequestConfig(sched_ctrl,mac_CellGroupConfig->schedulingRequestConfig); + process_bsrConfig(sched_ctrl,mac_CellGroupConfig->bsr_Config); + process_tag_Config(sched_ctrl,mac_CellGroupConfig->tag_Config); + process_phr_Config(sched_ctrl,mac_CellGroupConfig->phr_Config); + } + else { + // apply defaults + + } + + process_rlcBearerConfig(CellGroup->rlc_BearerToAddModList,CellGroup->rlc_BearerToReleaseList,sched_ctrl); + +} void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) { nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[Mod_idP]->config[0]; @@ -339,9 +420,9 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, int pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc, - int add_ue, - uint32_t rnti, - NR_CellGroupConfig_t *CellGroup){ + int add_ue, + uint32_t rnti, + NR_CellGroupConfig_t *CellGroup) { if (scc != NULL ) { AssertFatal((scc->ssb_PositionsInBurst->present > 0) && (scc->ssb_PositionsInBurst->present < 4), "SSB Bitmap type %d is not valid\n",scc->ssb_PositionsInBurst->present); @@ -384,7 +465,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ssb_SubcarrierOffset, pdsch_AntennaPorts, pusch_AntennaPorts, - scc); + scc); LOG_E(NR_MAC, "%s() %s:%d RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req); // if in nFAPI mode @@ -409,12 +490,12 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, if (get_softmodem_params()->sa > 0) { NR_COMMON_channels_t *cc = &RC.nrmac[Mod_idP]->common_channels[0]; for (int n=0;nra[n].cfra = false; - cc->ra[n].rnti = 0; - cc->ra[n].preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES; - cc->ra[n].preambles.preamble_list = (uint8_t *) malloc(MAX_NUM_NR_PRACH_PREAMBLES*sizeof(uint8_t)); - for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++) - cc->ra[n].preambles.preamble_list[i] = i; + cc->ra[n].cfra = false; + cc->ra[n].rnti = 0; + cc->ra[n].preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES; + cc->ra[n].preambles.preamble_list = (uint8_t *) malloc(MAX_NUM_NR_PRACH_PREAMBLES*sizeof(uint8_t)); + for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++) + cc->ra[n].preambles.preamble_list[i] = i; } } } @@ -425,6 +506,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, if (add_ue == 1 && get_softmodem_params()->phy_test) { const int UE_id = add_new_nr_ue(Mod_idP, rnti, CellGroup); LOG_I(PHY,"Added new UE_id %d/%x with initial CellGroup\n",UE_id,rnti); + process_CellGroup(CellGroup,&UE_info->UE_sched_ctrl[UE_id]); } else if (add_ue == 1 && !get_softmodem_params()->phy_test) { const int CC_id = 0; NR_COMMON_channels_t *cc = &RC.nrmac[Mod_idP]->common_channels[CC_id]; @@ -440,7 +522,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, NR_RA_t *ra = &cc->ra[ra_index]; ra->CellGroup = CellGroup; if (CellGroup->spCellConfig && CellGroup->spCellConfig->reconfigurationWithSync && - CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated!=NULL) { + CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated!=NULL) { if (CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra != NULL) { ra->cfra = true; ra->rnti = rnti; @@ -472,6 +554,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, const int UE_id = find_nr_UE_id(Mod_idP,rnti); UE_info->CellGroup[UE_id] = CellGroup; LOG_I(NR_MAC,"Modified UE_id %d/%x with CellGroup\n",UE_id,rnti); + process_CellGroup(CellGroup,&UE_info->UE_sched_ctrl[UE_id]); } } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index a146c11f59..20f0bea3b2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -77,10 +77,12 @@ void dump_mac_stats(gNB_MAC_INST *gNB) stats->num_rsrp_meas = 0; stats->cumul_rsrp = 0 ; LOG_I(MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes); - LOG_I(MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_errors %d\n", + LOG_I(MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_DTX %d, ulsch_errors %d\n", UE_id, stats->ulsch_rounds[0], stats->ulsch_rounds[1], - stats->ulsch_rounds[2], stats->ulsch_rounds[3], stats->ulsch_errors); + stats->ulsch_rounds[2], stats->ulsch_rounds[3], + stats->ulsch_DTX, + stats->ulsch_errors); LOG_I(MAC, "UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n", UE_id, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index b6a924fb17..9d27620198 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -343,11 +343,11 @@ void nr_store_dlsch_buffer(module_id_t module_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; sched_ctrl->num_total_bytes = 0; - if (loop_dcch_dtch == DL_SCH_LCID_DCCH1) + if ((sched_ctrl->lcid_mask&(1<<4)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DCCH1) loop_dcch_dtch = DL_SCH_LCID_DTCH; - else if (loop_dcch_dtch == DL_SCH_LCID_DTCH) + else if ((sched_ctrl->lcid_mask&(1<<1)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DTCH) loop_dcch_dtch = DL_SCH_LCID_DCCH; - else if (loop_dcch_dtch == DL_SCH_LCID_DCCH) + else if ((sched_ctrl->lcid_mask&(1<<2)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DCCH) loop_dcch_dtch = DL_SCH_LCID_DCCH1; const int lcid = loop_dcch_dtch; @@ -374,11 +374,12 @@ void nr_store_dlsch_buffer(module_id_t module_id, && !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */ return; - LOG_I(NR_MAC, - "[%s][%d.%d], DTCH%d->DLSCH, RLC status %d bytes TA %d\n", + LOG_D(NR_MAC, + "[%s][%d.%d], %s%d->DLSCH, RLC status %d bytes TA %d\n", __func__, frame, slot, + lcid<4?"DCCH":"DTCH", lcid, sched_ctrl->rlc_status[lcid].bytes_in_buffer, sched_ctrl->ta_apply); @@ -722,6 +723,7 @@ void nr_schedule_ue_spec(module_id_t module_id, NR_list_t *UE_list = &UE_info->list; for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + if (sched_ctrl->ul_failure==1) continue; UE_info->mac_stats[UE_id].dlsch_current_bytes = 0; /* update TA and set ta_apply every 10 frames. @@ -825,7 +827,8 @@ void nr_schedule_ue_spec(module_id_t module_id, startSymbolIndex, nrOfSymbols, sched_ctrl->mcs, - TBS,((double)TBS)*(1<uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing))/1000, + TBS, + ((double)TBS)*(1<uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing)/1000, current_harq_pid, harq->round, harq->ndi); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 055f38d213..953422bb08 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1722,6 +1722,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG compute_csi_bitlen (CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, mod_idP); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; memset(sched_ctrl, 0, sizeof(*sched_ctrl)); + sched_ctrl->lcid_mask = 0; sched_ctrl->ta_frame = 0; sched_ctrl->ta_update = 31; sched_ctrl->ta_apply = false; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index b94dcced6e..ad6e90890c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -126,6 +126,7 @@ void nr_schedule_pucch(int Mod_idP, for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + if (sched_ctrl->ul_failure==1) continue; const int n = sizeof(sched_ctrl->sched_pucch) / sizeof(*sched_ctrl->sched_pucch); for (int i = 0; i < n; i++) { NR_sched_pucch_t *curr_pucch = &UE_info->UE_sched_ctrl[UE_id].sched_pucch[i]; @@ -975,7 +976,7 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, uci_01->ul_cqi, 30); - LOG_I(NR_MAC,"pucch tpc %d\n",sched_ctrl->tpc1); + LOG_D(NR_MAC,"pucch tpc %d\n",sched_ctrl->tpc1); NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; if (((uci_01->pduBitmap >> 1) & 0x01)) { @@ -1149,7 +1150,7 @@ bool nr_acknack_scheduling(int mod_id, } } - LOG_I(MAC,"1. DL slot %d, UL_ACK %d\n",slot,pucch->ul_slot); + LOG_D(MAC,"1. DL slot %d, UL_ACK %d\n",slot,pucch->ul_slot); /* if the UE's next PUCCH occasion is after the possible UL slots (within the * same frame) or wrapped around to the next frame, then we assume there is * no possible PUCCH allocation anymore */ diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 4f913a0c2d..1f0106124d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -305,11 +305,11 @@ void nr_process_mac_pdu( mac_subheader_len = 2; } - LOG_I(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len); - int UE_id = find_nr_UE_id(module_idP, rnti); - RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len; + LOG_I(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-%s %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid<4?"DCCH":"DTCH",rx_lcid, module_idP, mac_sdu_len); + int UE_id = find_nr_UE_id(module_idP, rnti); + RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len; #if defined(ENABLE_MAC_PAYLOAD_DEBUG) - log_dump(NR_MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n"); + log_dump(NR_MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n"); #endif @@ -507,7 +507,10 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if (UE_scheduling_control->sched_ul_bytes < 0) UE_scheduling_control->sched_ul_bytes = 0; } - if (ul_cqi < 128) UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt++; + if (ul_cqi <= 128) { + UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt++; + UE_info->mac_stats[UE_id].ulsch_DTX++; + } if (UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt >= pusch_failure_thres) { LOG_I(NR_MAC,"Detected UL Failure on PUSCH, stopping scheduling\n"); UE_info->UE_sched_ctrl[UE_id].ul_failure = 1; @@ -771,7 +774,7 @@ void pf_ul(module_id_t module_id, sched_pusch->mcs = mcs; sched_pusch->R = nr_get_code_rate_ul(mcs, ps->mcs_table); sched_pusch->Qm = nr_get_Qm_ul(mcs, ps->mcs_table); - LOG_W(NR_MAC, "Fixme: work around a NULL pointer (set in function nr_save_pusch_fields that is actually called)\n"); + LOG_D(NR_MAC, "Fixme: work around a NULL pointer (set in function nr_save_pusch_fields that is actually called)\n"); if (ps->pusch_Config && (ps->pusch_Config->tp_pi2BPSK && ((ps->mcs_table == 3 && mcs < 2) || (ps->mcs_table == 4 && mcs < 6)))) { sched_pusch->R >>= 1; @@ -1031,6 +1034,7 @@ void nr_schedule_ulsch(module_id_t module_id, const NR_list_t *UE_list = &UE_info->list; for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + if (sched_ctrl->ul_failure == 1) continue; UE_info->mac_stats[UE_id].ulsch_current_bytes = 0; /* dynamic PUSCH values (RB alloc, MCS, hence R, Qm, TBS) that change in * every TTI are pre-populated by the preprocessor and used below */ diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 18698635de..69a1ca7800 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -52,9 +52,9 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, int pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc, - int nsa_flag, - uint32_t rnti, - NR_CellGroupConfig_t *CellGroup + int nsa_flag, + uint32_t rnti, + NR_CellGroupConfig_t *CellGroup ); void clear_nr_nfapi_information(gNB_MAC_INST * gNB, diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 47864efb00..4ed6467fce 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -517,6 +517,7 @@ typedef struct { /// DL HARQ PID to use for this UE, or -1 for "any new" int8_t dl_harq_pid; + int lcid_mask; uint16_t ta_frame; int16_t ta_update; bool ta_apply; @@ -562,6 +563,7 @@ typedef struct { int dlsch_current_bytes; int ulsch_rounds[8]; int ulsch_errors; + int ulsch_DTX; int ulsch_total_bytes_scheduled; int ulsch_total_bytes_rx; int ulsch_current_bytes; From 16d9d33d046fa918b95e2f6e11bb71a214edeaa2 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 19 May 2021 09:58:48 +0200 Subject: [PATCH 037/135] Fix minor bugs and wrong reported trace --- common/utils/LOG/log.h | 1 + executables/main-ocp.c | 1 - openair2/RRC/NR/rrc_gNB_NGAP.c | 4 +- openair2/UTIL/OPT/README.txt | 9 ++- openair2/UTIL/OPT/opt.h | 11 ++- openair2/UTIL/OPT/packet-mac-lte.h | 123 +++++------------------------ openair2/UTIL/OPT/probe.c | 110 +++++++++++++++++++++----- openair3/NGAP/ngap_common.h | 6 +- openair3/NGAP/ngap_gNB_handlers.c | 8 +- 9 files changed, 137 insertions(+), 136 deletions(-) diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index 0cbae7ae2c..fa95d5a6fe 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -434,6 +434,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int # define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0) # define LOG_VAR(A,B) A B +# define T_ACTIVE(a) (0) # endif /* T_TRACER */ /* avoid warnings for variables only used in LOG macro's but set outside debug section */ #define GCC_NOTUSED __attribute__((unused)) diff --git a/executables/main-ocp.c b/executables/main-ocp.c index 962b738e25..0712dfbf57 100644 --- a/executables/main-ocp.c +++ b/executables/main-ocp.c @@ -73,7 +73,6 @@ int sync_var=-1; //!< protected by mutex \ref sync_mutex. int config_sync_var=-1; volatile int oai_exit = 0; double cpuf; -msc_interface_t msc_interface; THREAD_STRUCT thread_struct; uint16_t sf_ahead=4; diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index c996b7af20..5595f87d14 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -355,8 +355,8 @@ nr_rrc_pdcp_config_security( if (print_keys == 1 ) { print_keys =0; LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, ue_context_pP->ue_context.kgnb, 32,"\nKgNB:" ); - LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCenc, 32,"\nKRRCenc:" ); - LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCint, 32,"\nKRRCint:" ); + LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCenc, 16,"\nKRRCenc:" ); + LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCint, 16,"\nKRRCint:" ); } } diff --git a/openair2/UTIL/OPT/README.txt b/openair2/UTIL/OPT/README.txt index 2ac68f83fd..13ec727fd5 100644 --- a/openair2/UTIL/OPT/README.txt +++ b/openair2/UTIL/OPT/README.txt @@ -1,13 +1,14 @@ -How to configure wireshark for dissecting LTE protocols: +How to configure wireshark for dissecting LTE/NR protocols: - start the wireshark as a sudoers - goto analyze->enabled prototols - => enable mac_lte_udp and rlc_lte_udp + => enable mac_xxx_udp and rlc_xxx_udp (xxx is lte or nr) - goto edit/preferences and expand Protocols - select UDP and check "try heuristic sub-dissectors first" - - select MAC-LTE, and check all the options (checkboxes), and set the "which layer info to show in info column" to "MAC info" - - select RLC-LTE, and check all the options except the "May see RLC headers only", and + - select MAC-LTE (or MAC-NR), and check all the options (checkboxes), and set the "which layer info to show in info column" to "MAC info" + - select RLC-LTE (or NR), and check all the options except the "May see RLC headers only", and set the "call PDCP dissector for DRB PDUs" to "12-bit SN". Optionally you may select the sequence analysis for RLC AM/UM. + - select PDCP-LTE (or NR) How to use - start eNB or UE with option --opt.type wireshark diff --git a/openair2/UTIL/OPT/opt.h b/openair2/UTIL/OPT/opt.h index ab591d3a65..a3a790cf97 100644 --- a/openair2/UTIL/OPT/opt.h +++ b/openair2/UTIL/OPT/opt.h @@ -60,6 +60,12 @@ typedef uint32_t guint32; typedef guint8 gboolean; #include "packet-mac-lte.h" +#include "packet-rlc-lte.h" +#include "packet-pdcp-lte.h" +#include "packet-mac-nr.h" +#include "packet-rlc-nr.h" +#include "packet-pdcp-nr.h" + #include "mac_pcap.h" /* OPT parameters definitions */ @@ -107,9 +113,10 @@ typedef enum radio_type_e { */ extern int opt_enabled; -#define trace_pdu(x...) if (opt_enabled) trace_pdu_implementation(x) +#define trace_pdu(x...) if (opt_enabled) trace_pdu_implementation(0, x) +#define trace_NRpdu(x...) if (opt_enabled) trace_pdu_implementation(1, x) -void trace_pdu_implementation(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size, +void trace_pdu_implementation(int nr, int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size, int ueid, int rntiType, int rnti, uint16_t sysFrame, uint8_t subframe, int oob_event, int oob_event_value); diff --git a/openair2/UTIL/OPT/packet-mac-lte.h b/openair2/UTIL/OPT/packet-mac-lte.h index 2d36e02df4..33e987c4ab 100644 --- a/openair2/UTIL/OPT/packet-mac-lte.h +++ b/openair2/UTIL/OPT/packet-mac-lte.h @@ -15,7 +15,7 @@ * * SPDX-License-Identifier: BSD-2-Clause */ - + /* this is wireshark, commit: commit eda834b6e29c36e05a63a6056afa98390ff79357 Date: Wed Aug 22 14:36:20 2018 +0200 @@ -114,6 +114,7 @@ typedef struct mac_lte_info /* Timing info */ guint16 sysframeNumber; guint16 subframeNumber; + gboolean sfnSfInfoPresent; /* Optional field. More interesting for TDD (FDD is always -4 subframeNumber) */ gboolean subframeNumberOfGrantPresent; @@ -197,49 +198,27 @@ typedef struct mac_lte_info guint16 oob_rnti[MAX_SRs]; } mac_lte_info; - -typedef struct mac_lte_tap_info { - /* Info from context */ - guint16 rnti; - guint16 ueid; - guint8 rntiType; - guint8 isPredefinedData; - gboolean crcStatusValid; - mac_lte_crc_status crcStatus; - guint8 direction; - - guint8 isPHYRetx; - guint16 ueInTTI; - - nstime_t mac_lte_time; - - /* Number of bytes (which part is used depends upon context settings) */ - guint32 single_number_of_bytes; - guint32 bytes_for_lcid[11]; - guint32 sdus_for_lcid[11]; - guint8 number_of_rars; - guint8 number_of_paging_ids; - - /* Number of padding bytes includes padding subheaders and trailing padding */ - guint16 padding_bytes; - guint16 raw_length; -} mac_lte_tap_info; + /* 0 to 10 and 32 to 38 */ +#define MAC_LTE_DATA_LCID_COUNT_MAX 18 -/*****************************************************************/ -/* UDP framing format */ -/* ----------------------- */ -/* Several people have asked about dissecting MAC by framing */ -/* PDUs over IP. A suggested format over UDP has been created */ -/* and implemented by this dissector, using the definitions */ -/* below. A link to an example program showing you how to encode */ -/* these headers and send LTE MAC PDUs on a UDP socket is */ -/* provided at https://wiki.wireshark.org/MAC-LTE */ -/* */ -/* A heuristic dissector (enabled by a preference) will */ -/* recognise a signature at the beginning of these frames. */ -/*****************************************************************/ + +/* Accessor function to check if a frame was considered to be ReTx */ + +/**********************************************************************/ +/* UDP framing format */ +/* ----------------------- */ +/* Several people have asked about dissecting MAC by framing */ +/* PDUs over IP. A suggested format over UDP has been created */ +/* and implemented by this dissector, using the definitions */ +/* below. A link to an example program showing you how to encode */ +/* these headers and send LTE MAC PDUs on a UDP socket is */ +/* provided at https://gitlab.com/wireshark/wireshark/-/wikis/MAC-LTE */ +/* */ +/* A heuristic dissector (enabled by a preference) will */ +/* recognise a signature at the beginning of these frames. */ +/**********************************************************************/ /* Signature. Rather than try to define a port for this, or make the @@ -317,66 +296,4 @@ typedef struct mac_lte_tap_info { continues until the end of the frame) */ #define MAC_LTE_PAYLOAD_TAG 0x01 - -/* Type to store parameters for configuring LCID->RLC channel settings for DRB */ -/* Some are optional, and may not be seen (e.g. on reestablishment) */ -typedef struct drb_mapping_t -{ - guint16 ueid; /* Mandatory */ - guint8 drbid; /* Mandatory */ - gboolean lcid_present; - guint8 lcid; /* Part of LogicalChannelConfig - optional */ - gboolean rlcMode_present; - guint8 rlcMode; /* Part of RLC config - optional */ - gboolean rlc_ul_ext_li_field; /* Part of RLC config - optional */ - gboolean rlc_dl_ext_li_field; /* Part of RLC config - optional */ - gboolean rlc_ul_ext_am_sn; /* Part of RLC config - optional */ - gboolean rlc_dl_ext_am_sn; /* Part of RLC config - optional */ - gboolean um_sn_length_present; - guint8 um_sn_length; /* Part of RLC config - optional */ - gboolean ul_priority_present; - guint8 ul_priority; /* Part of LogicalChannelConfig - optional */ - gboolean pdcp_sn_size_present; - guint8 pdcp_sn_size; /* Part of pdcp-Config - optional */ -} drb_mapping_t; - - - -/* Dedicated DRX config. Used to verify that a sensible config is given. - Also, beginning to configure MAC with this config and (optionally) show - DRX config and state (cycles/timers) attached to each UL/DL PDU! */ -typedef struct drx_config_t { - gboolean configured; - guint32 frameNum; - guint32 previousFrameNum; - - guint32 onDurationTimer; - guint32 inactivityTimer; - guint32 retransmissionTimer; - guint32 longCycle; - guint32 cycleOffset; - /* Optional Short cycle */ - gboolean shortCycleConfigured; - guint32 shortCycle; - guint32 shortCycleTimer; -} drx_config_t; - -/* RRC can indicate whether simultaneous PUCCH/PUSCH is used */ -typedef enum { - SIMULT_PUCCH_PUSCH_PCELL = 0, - SIMULT_PUCCH_PUSCH_PSCELL -} simult_pucch_pusch_cell_type; -/* - * Editor modelines - http://www.wireshark.org/tools/modelines.html - * - * Local variables: - * c-basic-offset: 4 - * tab-width: 8 - * indent-tabs-mode: nil - * End: - * - * vi: set shiftwidth=4 tabstop=8 expandtab: - * :indentSize=4:tabSize=8:noTabs=true: - */ - #endif diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c index 3f416c9255..2966c4672c 100644 --- a/openair2/UTIL/OPT/probe.c +++ b/openair2/UTIL/OPT/probe.c @@ -128,12 +128,6 @@ typedef struct { opt_listener_t opt_listener; -static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType, - guint16 rnti, guint16 ueid, guint16 sysframeNumber, - guint8 isPredefinedData, guint8 retx, guint8 crcStatus, - guint8 oob_event, guint8 oob_event_value, - uint8_t *pdu_buffer, unsigned int pdu_buffer_size); - unsigned short checksum(unsigned short *ptr, int length) { int sum = 0; u_short answer = 0; @@ -152,7 +146,7 @@ unsigned short checksum(unsigned short *ptr, int length) { } /* Write an individual PDU (PCAP packet header + mac-context + mac-pdu) */ -static int MAC_LTE_PCAP_WritePDU(const uint8_t *PDU, +static int PCAP_WritePDU(const uint8_t *PDU, unsigned int length) { pcaprec_hdr_t packet_header; // IPv4 header @@ -288,7 +282,7 @@ int opt_create_listener_socket(char *ip_address, uint16_t port) { */ /* Add framing header to MAC PDU and send. */ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType, - guint16 rnti, guint16 ueid, guint16 sfnSf, + guint16 rnti, guint16 ueid, guint16 frame, guint16 subframe, guint8 isPredefinedData, guint8 retx, guint8 crcStatus, guint8 oob_event, guint8 oob_event_value, uint8_t *pdu_buffer, unsigned int pdu_buffer_size) { @@ -317,9 +311,9 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType, tmp16 = htons(ueid); memcpy(frameBuffer+frameOffset, &tmp16, 2); frameOffset += 2; - /* Subframe number */ + /* Subframe number */ frameBuffer[frameOffset++] = MAC_LTE_FRAME_SUBFRAME_TAG; - tmp16 = htons(sfnSf); // frame counter : this will give an expert info as wireshark expects SF and not F + tmp16 = htons((frame<<4)+subframe); // frame counter : this will give an expert info as wireshark expects SF and not F memcpy(frameBuffer+frameOffset, &tmp16, 2); frameOffset += 2; frameBuffer[frameOffset++] = MAC_LTE_CRC_STATUS_TAG; @@ -400,7 +394,72 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType, bytesSent = sendto(g_socksd, frameBuffer, frameOffset, 0, (const struct sockaddr *)&g_serv_addr, sizeof(g_serv_addr)); else - bytesSent = MAC_LTE_PCAP_WritePDU(frameBuffer, frameOffset); + bytesSent = PCAP_WritePDU(frameBuffer, frameOffset); + + if (bytesSent != frameOffset) { + LOG_W(OPT, "trace_pdu expected %d bytes, got %ld (errno=%d)\n", + frameOffset, bytesSent, errno); + //exit(1); + } +} + +static void SendFrameNR(guint8 radioType, guint8 direction, guint8 rntiType, + guint16 rnti, guint16 ueid, guint16 frame, guint16 subframe, + guint8 isPredefinedData, guint8 retx, guint8 crcStatus, + guint8 oob_event, guint8 oob_event_value, + uint8_t *pdu_buffer, unsigned int pdu_buffer_size) { + unsigned char frameBuffer[9000]; + unsigned int frameOffset; + ssize_t bytesSent; + frameOffset = 0; + uint16_t tmp16; + memcpy(frameBuffer+frameOffset, MAC_NR_START_STRING, + strlen(MAC_NR_START_STRING)); + frameOffset += strlen(MAC_NR_START_STRING); + /******************************************************************************/ + /* Now write out fixed fields (the mandatory elements of struct mac_lte_info) */ + frameBuffer[frameOffset++] = radioType; + frameBuffer[frameOffset++] = direction; + frameBuffer[frameOffset++] = rntiType; + /*************************************/ + /* Now optional fields */ + /* RNTI */ + frameBuffer[frameOffset++] = MAC_NR_RNTI_TAG; + tmp16 = htons(rnti); + memcpy(frameBuffer+frameOffset, &tmp16, 2); + frameOffset += 2; + /* UEId */ + frameBuffer[frameOffset++] = MAC_NR_UEID_TAG; + tmp16 = htons(ueid); + memcpy(frameBuffer+frameOffset, &tmp16, 2); + frameOffset += 2; + /* Subframe number */ + frameBuffer[frameOffset++] = MAC_NR_FRAME_SLOT_TAG; + tmp16 = htons(frame); // frame counter : this will give an expert info as wireshark expects SF and not F + memcpy(frameBuffer+frameOffset, &tmp16, 2); + frameOffset += 2; + tmp16 = htons(subframe); // frame counter : this will give an expert info as wireshark expects SF and not F + memcpy(frameBuffer+frameOffset, &tmp16, 2); + frameOffset += 2; + + /***************************************/ + /* Now write the MAC PDU */ + frameBuffer[frameOffset++] = MAC_NR_PAYLOAD_TAG; + + /* Append actual PDU */ + //memcpy(frameBuffer+frameOffset, g_PDUBuffer, g_PDUOffset); + //frameOffset += g_PDUOffset; + if (pdu_buffer != NULL) { + memcpy(frameBuffer+frameOffset, (void *)pdu_buffer, pdu_buffer_size); + frameOffset += pdu_buffer_size; + } + + if ( opt_type == OPT_WIRESHARK ) + /* Send out the data over the UDP socket */ + bytesSent = sendto(g_socksd, frameBuffer, frameOffset, 0, + (const struct sockaddr *)&g_serv_addr, sizeof(g_serv_addr)); + else + bytesSent = PCAP_WritePDU(frameBuffer, frameOffset); if (bytesSent != frameOffset) { LOG_W(OPT, "trace_pdu expected %d bytes, got %ld (errno=%d)\n", @@ -413,20 +472,23 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType, extern RAN_CONTEXT_t RC; #include /* Remote serveraddress (where Wireshark is running) */ -void trace_pdu_implementation(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size, +void trace_pdu_implementation(int nr, int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size, int ueid, int rntiType, int rnti, uint16_t sysFrameNumber, uint8_t subFrameNumber, int oob_event, int oob_event_value) { int radioType=FDD_RADIO; LOG_D(OPT,"sending packet to wireshark: direction=%s, size: %d, ueid: %d, rnti: %x, frame/sf: %d.%d\n", direction?"DL":"UL", pdu_buffer_size, ueid, rnti, sysFrameNumber,subFrameNumber); - if (RC.eNB && RC.eNB[0][0]!=NULL) - radioType=RC.eNB[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO; - else if (PHY_vars_UE_g && PHY_vars_UE_g[0][0] != NULL) - radioType=PHY_vars_UE_g[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO; - else { - LOG_E(OPT,"not a eNB neither a UE!!! \n"); - return; + if (nr) { + radioType=TDD_RADIO; + } else { + if (RC.eNB && RC.eNB[0][0]!=NULL) + radioType=RC.eNB[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO; + else if (PHY_vars_UE_g && PHY_vars_UE_g[0][0] != NULL) + radioType=PHY_vars_UE_g[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO; + else { + LOG_E(OPT,"not a 4G eNB neither a 4G UE!!! \n"); + } } switch (opt_type) { @@ -448,9 +510,17 @@ void trace_pdu_implementation(int direction, uint8_t *pdu_buffer, unsigned int p break; } + if (nr) + SendFrameNR( radioType, + (direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK : DIRECTION_UPLINK, + rntiType, rnti, ueid, sysFrameNumber, subFrameNumber, + 1, 0, 1, //guint8 isPredefinedData, guint8 retx, guint8 crcStatus + oob_event,oob_event_value, + pdu_buffer, pdu_buffer_size); + else SendFrame( radioType, (direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK : DIRECTION_UPLINK, - rntiType, rnti, ueid, (sysFrameNumber<<4) + subFrameNumber, + rntiType, rnti, ueid, sysFrameNumber, subFrameNumber, 1, 0, 1, //guint8 isPredefinedData, guint8 retx, guint8 crcStatus oob_event,oob_event_value, pdu_buffer, pdu_buffer_size); diff --git a/openair3/NGAP/ngap_common.h b/openair3/NGAP/ngap_common.h index 6803adb0dd..283dd2bffa 100644 --- a/openair3/NGAP/ngap_common.h +++ b/openair3/NGAP/ngap_common.h @@ -142,7 +142,11 @@ extern int asn1_xer_print; } \ } \ if (ie == NULL ) { \ - NGAP_ERROR("NGAP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL\n",__FILE__,__LINE__);\ + if (mandatory) {\ + NGAP_ERROR("NGAP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL (searching for ie: %ld)\n",__FILE__,__LINE__, IE_ID);\ + abort();\ + }\ + else NGAP_INFO("NGAP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL (searching for ie: %ld)\n",__FILE__,__LINE__, IE_ID);\ } \ } while(0) /** \brief Function callback prototype. diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index 38b6bcac3e..401695473c 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -657,6 +657,7 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id, case NGAP_CauseRadioNetwork_up_integrity_protection_not_possible: NGAP_WARN("Received NG Error indication NGAP_CauseRadioNetwork_up_integrity_protection_not_possible\n"); break; + case NGAP_CauseRadioNetwork_up_confidentiality_protection_not_possible: NGAP_WARN("Received NG Error indication NGAP_CauseRadioNetwork_up_confidentiality_protection_not_possible\n"); break; @@ -1069,13 +1070,14 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, //if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ NGAP_AllowedNSSAI_Item_t *allow_nssai_item_p = NULL; - - NGAP_WARN("AllowedNSSAI.list.count %d\n", ie != NULL ? ie->value.choice.AllowedNSSAI.list.count : 2); + //NGAP_DEBUG("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count); //DevAssert(ie->value.choice.AllowedNSSAI.list.count > 0); //DevAssert(ie->value.choice.AllowedNSSAI.list.count <= NGAP_maxnoofAllowedS_NSSAIs); if (ie == NULL) { + NGAP_WARN("AllowedNSSAI not present, forging 2 NSSAI\n"); + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_allowed_nssais = 2; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[0].sST = 01; @@ -1092,7 +1094,7 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[1].sD[1] = 00;//22; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[1].sD[2] = 01;//33; } else { - + NGAP_INFO("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count); NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_allowed_nssais = ie->value.choice.AllowedNSSAI.list.count; for(i = 0; i < ie->value.choice.AllowedNSSAI.list.count; i++) { From 9130197657b811d2df0d8e4daeab3a270ad06ace Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 19 May 2021 10:26:26 +0200 Subject: [PATCH 038/135] add wireshark header files --- executables/nr-gnb.c | 1 + openair2/RRC/NR/L2_nr_interface.c | 2 + openair2/UTIL/OPT/packet-mac-nr.h | 142 ++++++++ openair2/UTIL/OPT/packet-pdcp-lte.h | 172 +++++++++ openair2/UTIL/OPT/packet-pdcp-nr.h | 168 +++++++++ openair2/UTIL/OPT/packet-rlc-lte.h | 151 ++++++++ openair2/UTIL/OPT/packet-rlc-nr.h | 136 ++++++++ openair2/UTIL/OPT/packet-rohc.h | 72 ++++ targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 1 - ...b.sa.band78.fr1.106PRB.usrpb210.sabox.conf | 326 ++++++++++++++++++ 10 files changed, 1170 insertions(+), 1 deletion(-) create mode 100644 openair2/UTIL/OPT/packet-mac-nr.h create mode 100644 openair2/UTIL/OPT/packet-pdcp-lte.h create mode 100644 openair2/UTIL/OPT/packet-pdcp-nr.h create mode 100644 openair2/UTIL/OPT/packet-rlc-lte.h create mode 100644 openair2/UTIL/OPT/packet-rlc-nr.h create mode 100644 openair2/UTIL/OPT/packet-rohc.h create mode 100644 targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 5ee3287955..bc08bae5da 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -379,6 +379,7 @@ void init_gNB_Tpool(int inst) { sprintf(ul_pool+2+s_offset,",-1"); s_offset += 3; } + strcpy(ul_pool, "n"); initTpool(ul_pool, gNB->threadPool, false); // ULSCH decoder result FIFO gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 6b9ff4bdc4..f8cb75c74d 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -44,6 +44,7 @@ #include "NR_BCCH-BCH-Message.h" #include "rrc_gNB_UE_context.h" #include +#include extern RAN_CONTEXT_t RC; @@ -207,6 +208,7 @@ nr_rrc_data_req( message_p); LOG_I(NR_RRC,"send RRC_DCCH_DATA_REQ to PDCP\n"); + //trace_NRpdu(DIRECTION_DOWNLINK, message_buffer, sdu_sizeP, 0, WS_M_RNTI, ctxt_pP->rnti, ctxt_pP->frame, ctxt_pP->subframe,0, 0); /* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads * Ideally, PDCP would not neet to be triggered like this but react to ITTI * messages automatically */ diff --git a/openair2/UTIL/OPT/packet-mac-nr.h b/openair2/UTIL/OPT/packet-mac-nr.h new file mode 100644 index 0000000000..8a1627a8ef --- /dev/null +++ b/openair2/UTIL/OPT/packet-mac-nr.h @@ -0,0 +1,142 @@ +/* packet-mac-nr.h + * + * Martin Mathieson + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +/* radioType */ +#define FDD_RADIO 1 +#define TDD_RADIO 2 + +/* Direction */ +#define DIRECTION_UPLINK 0 +#define DIRECTION_DOWNLINK 1 + +/* rntiType */ +#define WS_NO_RNTI 0 +#define WS_P_RNTI 1 +#define WS_RA_RNTI 2 +#define WS_C_RNTI 3 +#define WS_SI_RNTI 4 +#define WS_CS_RNTI 5 + +/* Context info attached to each NR MAC frame */ +typedef struct mac_nr_info +{ + /* Needed for decode */ + guint8 radioType; + guint8 direction; + guint8 rntiType; + + /* Extra info to display */ + guint16 rnti; + guint16 ueid; + guint8 harqid; + + /* Will these be included in the ME PHR report? */ + guint8 phr_type2_othercell; + + /* Timing info */ + gboolean sfnSlotInfoPresent; + guint16 sysframeNumber; + guint16 slotNumber; + + /* Length of DL PDU or UL grant size in bytes */ + guint16 length; + +} mac_nr_info; + + +/*****************************************************************/ +/* UDP framing format */ +/* ----------------------- */ +/* Several people have asked about dissecting MAC by framing */ +/* PDUs over IP. A suggested format over UDP has been created */ +/* and implemented by this dissector, using the definitions */ +/* below. */ +/* */ +/* A heuristic dissector (enabled by a preference) will */ +/* recognise a signature at the beginning of these frames. */ +/*****************************************************************/ + + +/* Signature. Rather than try to define a port for this, or make the + port number a preference, frames will start with this string (with no + terminating NULL */ +#define MAC_NR_START_STRING "mac-nr" + +/* Fixed fields. This is followed by the following 3 mandatory fields: + - radioType (1 byte) + - direction (1 byte) + - rntiType (1 byte) + (where the allowed values are defined above */ + +/* Optional fields. Attaching this info to frames will allow you + to show you display/filter/plot/add-custom-columns on these fields, so should + be added if available. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag) */ + +#define MAC_NR_RNTI_TAG 0x02 +/* 2 bytes, network order */ + +#define MAC_NR_UEID_TAG 0x03 +/* 2 bytes, network order */ + +#define MAC_NR_FRAME_SUBFRAME_TAG 0x04 +/* 2 bytes, deprecated, do not use it */ + +#define MAC_NR_PHR_TYPE2_OTHERCELL_TAG 0x05 +/* 1 byte, TRUE/FALSE */ + +#define MAC_NR_HARQID 0x06 +/* 1 byte */ + +#define MAC_NR_FRAME_SLOT_TAG 0x07 +/* 4 bytes, network order, SFN is stored in the 2 first bytes and slot number in the 2 last bytes */ + +/* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU + continues until the end of the frame) */ +#define MAC_NR_PAYLOAD_TAG 0x01 + + +/* Type to store parameters for configuring LCID->RLC channel settings for DRB */ +/* Some are optional, and may not be seen (e.g. on reestablishment) */ +typedef struct nr_drb_mac_rlc_mapping_t +{ + gboolean active; + guint16 ueid; /* Mandatory */ + guint8 drbid; /* Mandatory */ + + gboolean lcid_present; + guint8 lcid; /* Part of LogicalChannelConfig - optional */ + gboolean rlcMode_present; + guint8 rlcMode; /* Part of RLC config - optional */ + + guint8 tempDirection; /* So know direction of next SN length... */ + + gboolean rlcUlSnLength_present; + guint8 rlcUlSnLength; /* Part of RLC config - optional */ + gboolean rlcDlSnLength_present; + guint8 rlcDlSnLength; /* Part of RLC config - optional */ +} nr_drb_mac_rlc_mapping_t; + + + +/* + * Editor modelines - https://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/openair2/UTIL/OPT/packet-pdcp-lte.h b/openair2/UTIL/OPT/packet-pdcp-lte.h new file mode 100644 index 0000000000..19a371011b --- /dev/null +++ b/openair2/UTIL/OPT/packet-pdcp-lte.h @@ -0,0 +1,172 @@ +/* packet-pdcp-lte.h + * + * Martin Mathieson + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + + + +/* Direction */ +#define DIRECTION_UPLINK 0 +#define DIRECTION_DOWNLINK 1 + +enum pdcp_plane +{ + SIGNALING_PLANE = 1, + USER_PLANE = 2 +}; + +typedef enum LogicalChannelType +{ + Channel_DCCH=1, + Channel_BCCH=2, + Channel_CCCH=3, + Channel_PCCH=4, + Channel_DCCH_NB=5, + Channel_BCCH_NB=6, + Channel_CCCH_NB=7, + Channel_PCCH_NB=8 +} LogicalChannelType; + +typedef enum +{ + BCH_TRANSPORT=1, + DLSCH_TRANSPORT=2 +} BCCHTransportType; + +#define PDCP_SN_LENGTH_5_BITS 5 +#define PDCP_SN_LENGTH_7_BITS 7 +#define PDCP_SN_LENGTH_12_BITS 12 +#define PDCP_SN_LENGTH_15_BITS 15 +#define PDCP_SN_LENGTH_18_BITS 18 + +enum lte_security_integrity_algorithm_e { eia0, eia1, eia2, eia3 }; +enum lte_security_ciphering_algorithm_e { eea0, eea1, eea2, eea3 }; + +typedef struct pdcp_lte_security_info_t +{ + guint32 configuration_frame; + gboolean seen_next_ul_pdu; /* i.e. have we seen SecurityModeResponse */ + enum lte_security_integrity_algorithm_e integrity; + enum lte_security_ciphering_algorithm_e ciphering; + + /* Store previous settings so can revert if get SecurityModeFailure */ + guint32 previous_configuration_frame; + enum lte_security_integrity_algorithm_e previous_integrity; + enum lte_security_ciphering_algorithm_e previous_ciphering; +} pdcp_lte_security_info_t; + + +/***********************************************************************/ +/* UDP framing format */ +/* ----------------------- */ +/* Several people have asked about dissecting PDCP by framing */ +/* PDUs over IP. A suggested format over UDP has been defined */ +/* and implemented by this dissector, using the definitions */ +/* below. A link to an example program showing you how to encode */ +/* these headers and send LTE PDCP PDUs on a UDP socket is */ +/* provided at https://gitlab.com/wireshark/wireshark/-/wikis/PDCP-LTE */ +/* */ +/* A heuristic dissecter (enabled by a preference) will */ +/* recognise a signature at the beginning of these frames. */ +/* Until someone is using this format, suggestions for changes */ +/* are welcome. */ +/***********************************************************************/ + + +/* Signature. Rather than try to define a port for this, or make the + port number a preference, frames will start with this string (with no + terminating NULL */ +#define PDCP_LTE_START_STRING "pdcp-lte" + +/* Fixed fields. This is followed by the following 3 mandatory fields: + - no_header_pdu (1 byte) + - plane (1 byte) + - rohc_compression ( byte) + (where the allowed values are defined above) */ + +/* Conditional field. This field is mandatory in case of User Plane PDCP PDU. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag). The allowed values are defined above. */ + +#define PDCP_LTE_SEQNUM_LENGTH_TAG 0x02 +/* 1 byte */ + +/* Optional fields. Attaching this info to frames will allow you + to show you display/filter/plot/add-custom-columns on these fields, so should + be added if available. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag) */ + +#define PDCP_LTE_DIRECTION_TAG 0x03 +/* 1 byte */ + +#define PDCP_LTE_LOG_CHAN_TYPE_TAG 0x04 +/* 1 byte */ + +#define PDCP_LTE_BCCH_TRANSPORT_TYPE_TAG 0x05 +/* 1 byte */ + +#define PDCP_LTE_ROHC_IP_VERSION_TAG 0x06 +/* 2 bytes, network order */ + +#define PDCP_LTE_ROHC_CID_INC_INFO_TAG 0x07 +/* 1 byte */ + +#define PDCP_LTE_ROHC_LARGE_CID_PRES_TAG 0x08 +/* 1 byte */ + +#define PDCP_LTE_ROHC_MODE_TAG 0x09 +/* 1 byte */ + +#define PDCP_LTE_ROHC_RND_TAG 0x0A +/* 1 byte */ + +#define PDCP_LTE_ROHC_UDP_CHECKSUM_PRES_TAG 0x0B +/* 1 byte */ + +#define PDCP_LTE_ROHC_PROFILE_TAG 0x0C +/* 2 bytes, network order */ + +#define PDCP_LTE_CHANNEL_ID_TAG 0x0D +/* 2 bytes, network order */ + +#define PDCP_LTE_UEID_TAG 0x0E +/* 2 bytes, network order */ + +/* PDCP PDU. Following this tag comes the actual PDCP PDU (there is no length, the PDU + continues until the end of the frame) */ +#define PDCP_LTE_PAYLOAD_TAG 0x01 + + + +/* Called by RRC, or other configuration protocols */ + +/* Function to configure ciphering & integrity algorithms */ +void set_pdcp_lte_security_algorithms(guint16 ueid, pdcp_lte_security_info_t *security_info); + +/* Function to indicate securityModeCommand did not complete */ +void set_pdcp_lte_security_algorithms_failed(guint16 ueid); + + +/* Called by external dissectors */ +void set_pdcp_lte_rrc_ciphering_key(guint16 ueid, const char *key); +void set_pdcp_lte_rrc_integrity_key(guint16 ueid, const char *key); +void set_pdcp_lte_up_ciphering_key(guint16 ueid, const char *key); + +/* + * Editor modelines - https://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/openair2/UTIL/OPT/packet-pdcp-nr.h b/openair2/UTIL/OPT/packet-pdcp-nr.h new file mode 100644 index 0000000000..79f784c1c3 --- /dev/null +++ b/openair2/UTIL/OPT/packet-pdcp-nr.h @@ -0,0 +1,168 @@ +/* packet-pdcp-nr.h + * + * Martin Mathieson + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + + +/* Direction */ +#define PDCP_NR_DIRECTION_UPLINK 0 +#define PDCP_NR_DIRECTION_DOWNLINK 1 + +enum pdcp_nr_plane +{ + NR_SIGNALING_PLANE = 1, + NR_USER_PLANE = 2 +}; + +typedef enum NRBearerType +{ + Bearer_DCCH=1, + Bearer_BCCH_BCH=2, + Bearer_BCCH_DL_SCH=3, + Bearer_CCCH=4, + Bearer_PCCH=5, +} NRBearerType; + + +#define PDCP_NR_SN_LENGTH_12_BITS 12 +#define PDCP_NR_SN_LENGTH_18_BITS 18 + +#define PDCP_NR_UL_SDAP_HEADER_PRESENT 0x01 +#define PDCP_NR_DL_SDAP_HEADER_PRESENT 0x02 + +enum nr_security_integrity_algorithm_e { nia0, nia1, nia2, nia3 }; +enum nr_security_ciphering_algorithm_e { nea0, nea1, nea2, nea3, nea_disabled=999}; + +typedef struct pdcp_nr_security_info_t +{ + guint32 configuration_frame; + gboolean seen_next_ul_pdu; /* i.e. have we seen SecurityModeResponse */ + enum nr_security_integrity_algorithm_e integrity; + enum nr_security_ciphering_algorithm_e ciphering; + + /* Store previous settings so can revert if get SecurityModeFailure */ + guint32 previous_configuration_frame; + enum nr_security_integrity_algorithm_e previous_integrity; + enum nr_security_ciphering_algorithm_e previous_ciphering; +} pdcp_nr_security_info_t; + + +/*****************************************************************/ +/* UDP framing format */ +/* ----------------------- */ +/* Several people have asked about dissecting PDCP by framing */ +/* PDUs over IP. A suggested format over UDP has been defined */ +/* and implemented by this dissector, using the definitions */ +/* below. */ +/* */ +/* A heuristic dissector (enabled by a preference) will */ +/* recognise a signature at the beginning of these frames. */ +/* Until someone is using this format, suggestions for changes */ +/* are welcome. */ +/*****************************************************************/ + + +/* Signature. Rather than try to define a port for this, or make the + port number a preference, frames will start with this string (with no + terminating NULL */ +#define PDCP_NR_START_STRING "pdcp-nr" + +/* Fixed fields: + - plane (1 byte) */ + +/* Conditional field. This field is mandatory in case of User Plane PDCP PDU. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag). The allowed values are defined above. */ + +#define PDCP_NR_SEQNUM_LENGTH_TAG 0x02 +/* 1 byte */ + +/* Optional fields. Attaching this info should be added if available. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag) */ + +#define PDCP_NR_DIRECTION_TAG 0x03 +/* 1 byte */ + +#define PDCP_NR_BEARER_TYPE_TAG 0x04 +/* 1 byte */ + +#define PDCP_NR_BEARER_ID_TAG 0x05 +/* 1 byte */ + +#define PDCP_NR_UEID_TAG 0x06 +/* 2 bytes, network order */ + +#define PDCP_NR_ROHC_COMPRESSION_TAG 0x07 +/* 0 byte */ + +/* N.B. The following ROHC values only have significance if rohc_compression + is in use for the current channel */ + +#define PDCP_NR_ROHC_IP_VERSION_TAG 0x08 +/* 1 byte */ + +#define PDCP_NR_ROHC_CID_INC_INFO_TAG 0x09 +/* 0 byte */ + +#define PDCP_NR_ROHC_LARGE_CID_PRES_TAG 0x0A +/* 0 byte */ + +#define PDCP_NR_ROHC_MODE_TAG 0x0B +/* 1 byte */ + +#define PDCP_NR_ROHC_RND_TAG 0x0C +/* 0 byte */ + +#define PDCP_NR_ROHC_UDP_CHECKSUM_PRES_TAG 0x0D +/* 0 byte */ + +#define PDCP_NR_ROHC_PROFILE_TAG 0x0E +/* 2 bytes, network order */ + +#define PDCP_NR_MACI_PRES_TAG 0x0F +/* 0 byte */ + +#define PDCP_NR_SDAP_HEADER_TAG 0x10 +/* 1 byte, bitmask with PDCP_NR_UL_SDAP_HEADER_PRESENT and/or PDCP_NR_DL_SDAP_HEADER_PRESENT */ + +#define PDCP_NR_CIPHER_DISABLED_TAG 0x11 +/* 0 byte */ + +/* PDCP PDU. Following this tag comes the actual PDCP PDU (there is no length, the PDU + continues until the end of the frame) */ +#define PDCP_NR_PAYLOAD_TAG 0x01 + + +/* Called by RRC, or other configuration protocols */ + +/* Function to configure ciphering & integrity algorithms */ +void set_pdcp_nr_security_algorithms(guint16 ueid, pdcp_nr_security_info_t *security_info); + +/* Function to indicate securityModeCommand did not complete */ +void set_pdcp_nr_security_algorithms_failed(guint16 ueid); + + +/* Called by external dissectors */ +void set_pdcp_nr_rrc_ciphering_key(guint16 ueid, const char *key); +void set_pdcp_nr_rrc_integrity_key(guint16 ueid, const char *key); +void set_pdcp_nr_up_ciphering_key(guint16 ueid, const char *key); +void set_pdcp_nr_up_integrity_key(guint16 ueid, const char *key); + +/* + * Editor modelines - https://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/openair2/UTIL/OPT/packet-rlc-lte.h b/openair2/UTIL/OPT/packet-rlc-lte.h new file mode 100644 index 0000000000..e5b03d5f8e --- /dev/null +++ b/openair2/UTIL/OPT/packet-rlc-lte.h @@ -0,0 +1,151 @@ +/* packet-rlc-lte.h + * + * Martin Mathieson + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef PACKET_RLC_LTE_H +#define PACKET_RLC_LTE_H + +/* rlcMode */ +#define RLC_TM_MODE 1 +#define RLC_UM_MODE 2 +#define RLC_AM_MODE 4 +#define RLC_PREDEF 8 + +/* direction */ +#define DIRECTION_UPLINK 0 +#define DIRECTION_DOWNLINK 1 + +/* priority ? */ + +/* channelType */ +#define CHANNEL_TYPE_CCCH 1 +#define CHANNEL_TYPE_BCCH_BCH 2 +#define CHANNEL_TYPE_PCCH 3 +#define CHANNEL_TYPE_SRB 4 +#define CHANNEL_TYPE_DRB 5 +#define CHANNEL_TYPE_BCCH_DL_SCH 6 +#define CHANNEL_TYPE_MCCH 7 +#define CHANNEL_TYPE_MTCH 8 + +/* sequenceNumberLength */ +#define UM_SN_LENGTH_5_BITS 5 +#define UM_SN_LENGTH_10_BITS 10 +#define AM_SN_LENGTH_10_BITS 10 +#define AM_SN_LENGTH_16_BITS 16 + + +typedef enum rlc_lte_nb_mode { + rlc_no_nb_mode = 0, + rlc_nb_mode = 1 +} rlc_lte_nb_mode; + + +/* Info attached to each LTE RLC frame */ +typedef struct rlc_lte_info +{ + guint8 rlcMode; + guint8 direction; + guint8 priority; + guint8 sequenceNumberLength; + guint16 ueid; + guint16 channelType; + guint16 channelId; /* for SRB: 1=SRB1, 2=SRB2, 3=SRB1bis; for DRB: DRB ID */ + guint16 pduLength; + gboolean extendedLiField; + rlc_lte_nb_mode nbMode; +} rlc_lte_info; + + +typedef struct rlc_lte_tap_info { + /* Info from context */ + guint8 rlcMode; + guint8 direction; + guint8 priority; + guint16 ueid; + guint16 channelType; + guint16 channelId; + guint16 pduLength; + guint8 sequenceNumberLength; + + nstime_t rlc_lte_time; + guint8 loggedInMACFrame; + guint16 sequenceNumber; + guint8 isResegmented; + guint8 isControlPDU; + guint16 ACKNo; + #define MAX_NACKs 128 + guint16 noOfNACKs; + guint16 NACKs[MAX_NACKs]; + + guint16 missingSNs; +} rlc_lte_tap_info; + + +/* Signature. Rather than try to define a port for this, or make the + port number a preference, frames will start with this string (with no + terminating NULL */ +#define RLC_LTE_START_STRING "rlc-lte" + +/* Fixed field. This is followed by the following 1 mandatory field: + - rlcMode (1 byte) + (where the allowed values are defined above */ + +/* Conditional field. This field is mandatory in case of RLC Unacknowledged mode. + In case of RLC Acknowledged mode, the field is optional (assume 10 bits by default). + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag). The allowed values are defined above. */ + +#define RLC_LTE_SN_LENGTH_TAG 0x02 +/* 1 byte */ + +/* Optional fields. Attaching this info to frames will allow you + to show you display/filter/plot/add-custom-columns on these fields, so should + be added if available. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag) */ + +#define RLC_LTE_DIRECTION_TAG 0x03 +/* 1 byte */ + +#define RLC_LTE_PRIORITY_TAG 0x04 +/* 1 byte */ + +#define RLC_LTE_UEID_TAG 0x05 +/* 2 bytes, network order */ + +#define RLC_LTE_CHANNEL_TYPE_TAG 0x06 +/* 2 bytes, network order */ + +#define RLC_LTE_CHANNEL_ID_TAG 0x07 +/* 2 bytes, network order */ + +#define RLC_LTE_EXT_LI_FIELD_TAG 0x08 +/* 0 byte, tag presence indicates that AM DRB PDU is using an extended LI field of 15 bits */ + +#define RLC_LTE_NB_MODE_TAG 0x09 +/* 1 byte containing rlc_lte_nb_mode enum value */ + +/* RLC PDU. Following this tag comes the actual RLC PDU (there is no length, the PDU + continues until the end of the frame) */ +#define RLC_LTE_PAYLOAD_TAG 0x01 + +#endif + +/* + * Editor modelines - https://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/openair2/UTIL/OPT/packet-rlc-nr.h b/openair2/UTIL/OPT/packet-rlc-nr.h new file mode 100644 index 0000000000..290eba1898 --- /dev/null +++ b/openair2/UTIL/OPT/packet-rlc-nr.h @@ -0,0 +1,136 @@ +/* packet-rlc-nr.h + * + * Pascal Quantin + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef PACKET_RLC_NR_H +#define PACKET_RLC_NR_H + +/* rlcMode */ +#define RLC_TM_MODE 1 +#define RLC_UM_MODE 2 +#define RLC_AM_MODE 4 + +/* direction */ +#define DIRECTION_UPLINK 0 +#define DIRECTION_DOWNLINK 1 + +/* bearerType */ +#define BEARER_TYPE_CCCH 1 +#define BEARER_TYPE_BCCH_BCH 2 +#define BEARER_TYPE_PCCH 3 +#define BEARER_TYPE_SRB 4 +#define BEARER_TYPE_DRB 5 +#define BEARER_TYPE_BCCH_DL_SCH 6 + +/* sequenceNumberLength */ +#define TM_SN_LENGTH_0_BITS 0 +#define UM_SN_LENGTH_6_BITS 6 +#define UM_SN_LENGTH_12_BITS 12 +#define AM_SN_LENGTH_12_BITS 12 +#define AM_SN_LENGTH_18_BITS 18 + +/* Info attached to each NR RLC frame */ +typedef struct rlc_nr_info +{ + guint8 rlcMode; + guint8 direction; + guint8 sequenceNumberLength; + guint8 bearerType; + guint8 bearerId; + guint16 ueid; + guint16 pduLength; +} rlc_nr_info; + +typedef struct nr_drb_rlc_pdcp_mapping_t +{ + gboolean active; + guint16 ueid; /* Mandatory */ + guint8 drbid; /* Mandatory */ + + gboolean pdcpUlSnLength_present; + guint8 pdcpUlSnLength; /* Part of PDCP config - optional */ + gboolean pdcpDlSnLength_present; + guint8 pdcpDlSnLength; /* Part of PDCP config - optional */ + gboolean pdcpUlSdap; + gboolean pdcpDlSdap; + gboolean pdcpIntegrityProtection; + gboolean pdcpCipheringDisabled; + +} nr_drb_rlc_pdcp_mapping_t; + +/* TODO: could probably merge this struct with above */ +typedef struct pdcp_ue_parameters { + guint32 id; + guint8 pdcp_sn_bits_ul; + guint8 pdcp_sn_bits_dl; + gboolean pdcp_sdap_ul; + gboolean pdcp_sdap_dl; + gboolean pdcp_integrity; + gboolean pdcp_ciphering_disabled; +} pdcp_bearer_parameters; + +/*****************************************************************/ +/* UDP framing format */ +/* ----------------------- */ +/* Several people have asked about dissecting RLC by framing */ +/* PDUs over IP. A suggested format over UDP has been defined */ +/* and implemented by this dissector, using the definitions */ +/* below. */ +/* */ +/* A heuristic dissector (enabled by a preference) will */ +/* recognise a signature at the beginning of these frames. */ +/*****************************************************************/ + + +/* Signature. Rather than try to define a port for this, or make the + port number a preference, frames will start with this string (with no + terminating NULL */ +#define RLC_NR_START_STRING "rlc-nr" + +/* Fixed field. This is followed by the following 2 mandatory field: + - rlcMode (1 byte) + - sequenceNumberLength (1 byte) + (where the allowed values are defined above) */ + +/* Optional fields. Attaching this info to frames will allow you + to show you display/filter/plot/add-custom-columns on these fields, so should + be added if available. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag) */ + +#define RLC_NR_DIRECTION_TAG 0x02 +/* 1 byte */ + +#define RLC_NR_UEID_TAG 0x03 +/* 2 bytes, network order */ + +#define RLC_NR_BEARER_TYPE_TAG 0x04 +/* 1 byte */ + +#define RLC_NR_BEARER_ID_TAG 0x05 +/* 1 byte */ + +/* RLC PDU. Following this tag comes the actual RLC PDU (there is no length, the PDU + continues until the end of the frame) */ +#define RLC_NR_PAYLOAD_TAG 0x01 + +#endif + +/* + * Editor modelines - https://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/openair2/UTIL/OPT/packet-rohc.h b/openair2/UTIL/OPT/packet-rohc.h new file mode 100644 index 0000000000..c6c807f687 --- /dev/null +++ b/openair2/UTIL/OPT/packet-rohc.h @@ -0,0 +1,72 @@ +/* packet-rohc.h + * Routines for RObust Header Compression (ROHC) dissection. + * + * Copyright 2011, Anders Broman + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * Ref: + * http://www.ietf.org/rfc/rfc3095.txt RObust Header Compression (ROHC): Framework and four profiles: RTP, UDP, ESP, and uncompressed + * http://datatracker.ietf.org/doc/rfc4815/ RObust Header Compression (ROHC): Corrections and Clarifications to RFC 3095 + * http://datatracker.ietf.org/doc/rfc5225/ RObust Header Compression Version 2 (ROHCv2): Profiles for RTP, UDP, IP, ESP and UDP-Lite + */ + +#ifndef PACKET_ROHC_H +#define PACKET_ROHC_H + +#define MAX_CID 15 + + /* ROHC Profiles */ +#define ROHC_PROFILE_UNCOMPRESSED 0 +#define ROHC_PROFILE_RTP 1 +#define ROHC_PROFILE_UDP 2 +#define ROHC_PROFILE_IP 4 +#define ROHC_PROFILE_UNKNOWN 0xFFFF + +enum rohc_mode +{ + MODE_NOT_SET = 0, + UNIDIRECTIONAL = 1, + OPTIMISTIC_BIDIRECTIONAL = 2, + RELIABLE_BIDIRECTIONAL = 3 +}; + +enum rohc_d_mode +{ + NO_CONTEXT = 1, + STATIC_CONTEXT = 2, + FULL_CONTEXT = 3 +}; +typedef struct rohc_info +{ + gboolean rohc_compression; + guint8 rohc_ip_version; + gboolean cid_inclusion_info; + gboolean large_cid_present; + enum rohc_mode mode; + gboolean rnd; + gboolean udp_checksum_present; + guint16 profile; + proto_item *last_created_item; +} rohc_info; + + +typedef struct rohc_context +{ + guint8 rohc_ip_version[MAX_CID+1]; + gboolean large_cid_present[MAX_CID+1]; + enum rohc_mode mode[MAX_CID+1]; + enum rohc_d_mode d_mode[MAX_CID+1]; + gboolean rnd[MAX_CID+1]; + gboolean udp_checkum_present[MAX_CID+1]; + guint16 profile[MAX_CID+1]; + gboolean rohc_context_init[MAX_CID+1]; + gint ir_frame_number[MAX_CID+1]; /* The frame number of the last IR packet seen */ + +} rohc_context; + +#endif /* PACKET_ROHC_H */ diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index c830aeb18e..351813e7c9 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -581,7 +581,6 @@ void *trx_usrp_write_thread(void * arg){ VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_USRP_SEND_RETURN, ret ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_THREAD, 0 ); - if(0) break; } return NULL; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf new file mode 100644 index 0000000000..9402e354fe --- /dev/null +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf @@ -0,0 +1,326 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({ + mcc = 450; + mnc = 05; + mnc_length = 2; + snssaiList = ( + { + sst = 1; + sd = 0xd143a5; // 0 false, else true + } + ); + + }); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 12; + searchSpaceZero = 0; + } + ); + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641280; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640008; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=27,L=48 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 12952; # 6366 12925 12956 28875 12952 +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_3 = 57; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 12952; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -96; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + amf_ip_address = ( { ipv4 = "192.168.5.233"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + ///X2 + enable_x2 = "no"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + target_enb_x2_ip_address = ( + { ipv4 = "CI_FR1_CTL_ENB_IP_ADDR"; + ipv6 = "192:168:30::17"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + GNB_INTERFACE_NAME_FOR_NG_AMF = "eth0"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.5.200/24"; + GNB_INTERFACE_NAME_FOR_NGU = "eth0"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.5.200/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "192.168.5.200/24"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; + #beamforming 1x4 matrix: + bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + clock_src = "internal"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + +rfsimulator : +{ + serveraddr = "server"; + serverport = "4043"; + options = (); #("saviq"); or/and "chanmod" + modelname = "AWGN"; + IQfile = "/tmp/rfsimulator.iqs"; +}; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + ngap_log_level ="debug"; + ngap_log_verbosity ="medium"; + }; + From d42e44ec28be32016cd18252bedc13613da6c88b Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 19 May 2021 12:02:29 +0200 Subject: [PATCH 039/135] revert thread configuration specific to test --- executables/nr-gnb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index bc08bae5da..f5e49b73b8 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -379,7 +379,7 @@ void init_gNB_Tpool(int inst) { sprintf(ul_pool+2+s_offset,",-1"); s_offset += 3; } - strcpy(ul_pool, "n"); + if (getenv("noThreads")) strcpy(ul_pool, "n"); initTpool(ul_pool, gNB->threadPool, false); // ULSCH decoder result FIFO gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); From 83688c964d5d20cf513894c39d06f93c2b860559 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 20 May 2021 09:53:52 +0200 Subject: [PATCH 040/135] rf calibration tool improvement --- common/utils/minimal_stub.c | 2 ++ openair1/PHY/TOOLS/calibration_test.c | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/common/utils/minimal_stub.c b/common/utils/minimal_stub.c index 86454fe53f..79e35bf7a6 100644 --- a/common/utils/minimal_stub.c +++ b/common/utils/minimal_stub.c @@ -1,4 +1,6 @@ +#ifndef T_TRACER int T_stdout; +#endif void exit_function(const char *file, const char *function, const int line, const char *s) { } diff --git a/openair1/PHY/TOOLS/calibration_test.c b/openair1/PHY/TOOLS/calibration_test.c index 982ca9d254..53baf83d41 100644 --- a/openair1/PHY/TOOLS/calibration_test.c +++ b/openair1/PHY/TOOLS/calibration_test.c @@ -10,12 +10,17 @@ unsigned int mmapped_dma=0; int single_thread_flag; uint32_t timing_advance; int8_t threequarter_fs; -int usrp_tx_thread; uint64_t downlink_frequency[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int opp_enabled; static double snr_dB=20; THREAD_STRUCT thread_struct; +uint32_t target_ul_mcs = 9; +uint32_t target_dl_mcs = 9; +uint64_t dlsch_slot_bitmap = (1<<1); +uint64_t ulsch_slot_bitmap = (1<<8); +uint32_t target_ul_bw = 50; +uint32_t target_dl_bw = 50; #include int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state) {return 0;} @@ -302,6 +307,9 @@ int main(int argc, char **argv) { void ** samplesRx = (void **)malloc16(antennas* sizeof(struct complex16 *) ); void ** samplesTx = (void **)malloc16(antennas* sizeof(struct complex16 *) ); + + int fd=open(getenv("rftestInputFile"),O_RDONLY); + AssertFatal(fd>=0,"%s",strerror(errno)); for (int i=0; i Date: Thu, 20 May 2021 14:37:58 +0200 Subject: [PATCH 041/135] Trigger DRB mac configuration (Fujitsu patch) --- openair2/RRC/NR/rrc_gNB.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 5b53cff0f5..b8361ae45f 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1003,7 +1003,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( memset(sdap_config, 0, sizeof(NR_SDAP_Config_t)); sdap_config->pdu_Session = ue_context_pP->ue_context.pdusession[i].param.pdusession_id; sdap_config->sdap_HeaderDL = NR_SDAP_Config__sdap_HeaderDL_absent; - sdap_config->sdap_HeaderUL = NR_SDAP_Config__sdap_HeaderUL_present; + sdap_config->sdap_HeaderUL = NR_SDAP_Config__sdap_HeaderUL_absent; sdap_config->defaultDRB = TRUE; sdap_config->mappedQoS_FlowsToAdd = calloc(1, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd)); memset(sdap_config->mappedQoS_FlowsToAdd, 0, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd)); @@ -1281,6 +1281,7 @@ rrc_gNB_process_RRCReconfigurationComplete( 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]; + gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; ue_context_pP->ue_context.ue_reestablishment_timer = 0; @@ -1321,6 +1322,15 @@ rrc_gNB_process_RRCReconfigurationComplete( ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList); /* Refresh SRBs/DRBs */ if (!NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) { + rrc_mac_config_req_gNB(rrc->module_id, + rrc->carrier.ssb_SubcarrierOffset, + rrc->carrier.pdsch_AntennaPorts, + rrc->carrier.pusch_AntennaPorts, + NULL, + 0, + ue_context_pP->ue_context.rnti, + ue_context_pP->ue_context.masterCellGroup + ); LOG_I(NR_RRC,"Configuring RLC DRBs/SRBs for UE %x\n",ue_context_pP->ue_context.rnti); nr_rrc_rlc_config_asn1_req(ctxt_pP, SRB_configList, // NULL, From 0ce2f477259893f85d5eeb6ddfaac05bb77c0da8 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 20 May 2021 18:47:28 +0200 Subject: [PATCH 042/135] add assertions in compute_csi_bitlen to avoid segmentation fault --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index bb9fb8e5f8..190572432f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -376,6 +376,8 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in // setting the CSI or SSB index list if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == csi_report->reportQuantity_type) { + AssertFatal(csi_MeasConfig->csi_SSB_ResourceSetToAddModList != NULL, + "Wrong settings! Report quantity is SSB-RSRP but csi_MeasConfig->csi_SSB_ResourceSetToAddModList is NULL\n"); for (int csi_idx = 0; csi_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_idx++) { if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_idx]->csi_SSB_ResourceSetId == *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){ @@ -389,6 +391,8 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in } else { if (resourceType == NR_CSI_ResourceConfig__resourceType_periodic) { + AssertFatal(csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList != NULL, + "Wrong settings! Report quantity requires CSI-RS but csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList is NULL\n"); for (int csi_idx = 0; csi_idx < csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.count; csi_idx++) { if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_idx]->nzp_CSI_ResourceSetId == *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) { From bccd61a262aab781cc0e3ef6b626657efff67d74 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 20 May 2021 19:02:39 +0200 Subject: [PATCH 043/135] adding non-PMI-portindication to config --- openair2/RRC/NR/rrc_gNB_reconfig.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 930dff5b23..d18bd4ffa4 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1271,7 +1271,11 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csirep1->cqi_Table = calloc(1,sizeof(*csirep1->cqi_Table)); *csirep1->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table1; csirep1->subbandSize = NR_CSI_ReportConfig__subbandSize_value1; - csirep1->non_PMI_PortIndication = NULL; + csirep1->non_PMI_PortIndication = calloc(1,sizeof(*csirep1->non_PMI_PortIndication)); + NR_PortIndexFor8Ranks_t *portindex1 = calloc(1,sizeof(*portindex1)); + portindex1->present = NR_PortIndexFor8Ranks_PR_portIndex1; + portindex1->choice.portIndex1 = (NULL_t)0; + ASN_SEQUENCE_ADD(&csirep1->non_PMI_PortIndication->list,portindex1); csirep1->ext1 = NULL; ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep1); From cf1b1257053c82954dce5f7fef4dfa5a693465ce Mon Sep 17 00:00:00 2001 From: Eurecom Date: Fri, 21 May 2021 08:52:12 +0200 Subject: [PATCH 044/135] minor change in logging --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index b6a924fb17..b84cb611e0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -825,7 +825,7 @@ void nr_schedule_ue_spec(module_id_t module_id, startSymbolIndex, nrOfSymbols, sched_ctrl->mcs, - TBS,((double)TBS)*(1<uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing))/1000, + TBS,((double)TBS)*(1<uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing)/1000, current_harq_pid, harq->round, harq->ndi); From c7ce307d70657a95a57790c51e09fe0bb874dd6b Mon Sep 17 00:00:00 2001 From: matzakos Date: Fri, 21 May 2021 11:57:26 +0200 Subject: [PATCH 045/135] Fix removing of gtp-u extension header --- openair3/ocp-gtpu/gtp_itf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 2862a4d906..b371c5c0d6 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -703,7 +703,7 @@ static int Gtpv1uHandleGpdu(int h, int offset=8; if( msgHdr->E || msgHdr->S ||msgHdr->PN) - offset+=4; + offset+=8; // This context is not good for gtp // frame, ... has no meaning From 01635a40f82e59770355a50bdac0a7aba53a3b5b Mon Sep 17 00:00:00 2001 From: matzakos Date: Wed, 26 May 2021 17:47:53 +0200 Subject: [PATCH 046/135] Enable DRB configuration for PDCP, RLC at OAI UE --- openair2/RRC/NR_UE/rrc_UE.c | 69 +++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 22 deletions(-) diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 6c693e08c2..bfd8d8faa4 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1265,6 +1265,9 @@ nr_rrc_ue_process_masterCellGroup( //TODO (resume all suspended radio bearers and resume SCG transmission for all radio bearers, if suspended) // NSA procedures } + if(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config == NULL){ + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config = malloc(sizeof(NR_CellGroupConfig_t)); + } if( cellGroupConfig->rlc_BearerToReleaseList != NULL){ @@ -1273,10 +1276,24 @@ nr_rrc_ue_process_masterCellGroup( if( cellGroupConfig->rlc_BearerToAddModList != NULL){ //TODO (perform the RLC bearer addition/modification as specified in 5.3.5.5.4) + if(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList != NULL){ + free(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList); + } + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList = calloc(1, sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList)); + memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList,cellGroupConfig->rlc_BearerToAddModList, + sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList)); } if( cellGroupConfig->mac_CellGroupConfig != NULL){ //TODO (configure the MAC entity of this cell group as specified in 5.3.5.5.5) + LOG_I(RRC, "Received mac_CellGroupConfig from gNB\n"); + if(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig != NULL){ + LOG_E(RRC, "UE RRC instance already contains mac CellGroupConfig which will be overwritten\n"); + free(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig); + } + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig = malloc(sizeof(struct NR_MAC_CellGroupConfig)); + memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig,cellGroupConfig->mac_CellGroupConfig, + sizeof(struct NR_MAC_CellGroupConfig)); } if( cellGroupConfig->sCellToReleaseList != NULL){ @@ -2132,28 +2149,28 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4)); // Refresh DRBs - // nr_rrc_pdcp_config_asn1_req(ctxt_pP, - // NULL, - // radioBearerConfig->drb_ToAddModList, - // NULL, - // NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | - // (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), - // NULL, - // NULL, - // kUPenc, - // NULL, - // NULL, - // NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB, - // NULL); + nr_rrc_pdcp_config_asn1_req(ctxt_pP, + NULL, + radioBearerConfig->drb_ToAddModList, + NULL, + NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | + (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), + NULL, + NULL, + kUPenc, + NULL, + NULL, + NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB, + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList); // Refresh DRBs - // nr_rrc_rlc_config_asn1_req(ctxt_pP, - // NULL, - // radioBearerConfig->drb_ToAddModList, - // NULL, - // NULL, - // NULL - // ); - } // drb_ToAddModList + nr_rrc_rlc_config_asn1_req(ctxt_pP, + NULL, + radioBearerConfig->drb_ToAddModList, + NULL, + NULL, + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList + ); + } // drb_ToAddModList // if (radioBearerConfig->drb_ToReleaseList != NULL) { for (i = 0; i < radioBearerConfig->drb_ToReleaseList->list.count; i++) { @@ -2188,9 +2205,17 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB // nr_rrc_ue_process_measConfig(ctxt_pP, gNB_index, ie->measConfig); } + if(ie->nonCriticalExtension->masterCellGroup!=NULL) { + nr_rrc_ue_process_masterCellGroup( + ctxt_pP, + gNB_index, + ie->nonCriticalExtension->masterCellGroup); + } + + if (ie->radioBearerConfig != NULL) { LOG_I(NR_RRC, "radio Bearer Configuration is present\n"); - // nr_sa_rrc_ue_process_radioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig); + nr_sa_rrc_ue_process_radioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig); } /* Check if there is dedicated NAS information to forward to NAS */ From f60e5997300ed949961bf5765005ffa7bfde9a7e Mon Sep 17 00:00:00 2001 From: matzakos Date: Wed, 26 May 2021 17:56:02 +0200 Subject: [PATCH 047/135] Enable IP TUN interface configuration upon reception of PDU Session Establishment Accept NAS message -User plane traffic validation with OAI UE and OAI CN: -Downlink ping initiated from the CN is received at the IP interface of the UE. However it seems that there is some packet corruption preventing the generaration of ping reply. -Uplink ping initiated from the UE reaches the OAI CN machine. However no ping reply is seen yet either. --- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 3 ++- openair3/NAS/NR_UE/nr_nas_msg_sim.c | 14 +++++++++++++- openair3/NAS/NR_UE/nr_nas_msg_sim.h | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 121652062a..aeefac8473 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -459,7 +459,8 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, int rb_id; int i; - if(IS_SOFTMODEM_NOS1){ + if(UE_NAS_USE_TUN){ + LOG_D(PDCP, "IP packet received, to be sent to UE TUN interface"); len = write(nas_sock_fd[0], buf, size); if (len != size) { LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index d862091776..dce5d45c69 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -38,7 +38,8 @@ #include "aka_functions.h" #include "secu_defs.h" #include "PduSessionEstablishRequest.h" -# include "intertask_interface.h" +#include "intertask_interface.h" +#include "openair2/RRC/NAS/nas_config.h" /*char netName[] = "5G:mnc093.mcc208.3gppnetwork.org"; char imsi[] = "2089300007487"; @@ -57,6 +58,7 @@ const uint8_t opc[16] = {0xc4, 0x24, 0x49, 0x36, 0x3b, 0xba, 0xd0, 0x2b, 0x66, 0 uint8_t *registration_request_buf; uint32_t registration_request_len; +extern char *baseNetAddress; static int nas_protected_security_header_encode( char *buffer, @@ -816,6 +818,16 @@ void *nas_nrue_task(void *args_p) LOG_I(NAS, "Send NAS_UPLINK_DATA_REQ message(PduSessionEstablishRequest)\n"); } } + else if((pdu_buffer + 16) != NULL){ + msg_type = *(pdu_buffer + 16); + if(msg_type == FGS_PDU_SESSION_ESTABLISHMENT_ACC){ + sprintf(baseNetAddress, "%d.%d", *(pdu_buffer + 39),*(pdu_buffer + 40)); + int third_octet = *(pdu_buffer + 41); + int fourth_octet = *(pdu_buffer + 42); + LOG_I(NAS, "Received PDU Session Establishment Accept\n"); + nas_config(1,third_octet,fourth_octet,"ue"); + } + } break; } diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.h b/openair3/NAS/NR_UE/nr_nas_msg_sim.h index 2f123a6f04..f80f8df61b 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.h +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.h @@ -59,6 +59,7 @@ // message type for 5GS session management #define FGS_PDU_SESSION_ESTABLISHMENT_REQ 0b11000001 /* 193= 0xc1 */ +#define FGS_PDU_SESSION_ESTABLISHMENT_ACC 0b11000010 /* 194= 0xc2 */ #define INITIAL_REGISTRATION 0b001 From dd92d7b6515bdd1e315fbedd69f24f4626c57c89 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 27 May 2021 17:36:54 +0200 Subject: [PATCH 048/135] rrc configuration for SSB and CSI RSRP measurements --- openair2/RRC/NR/rrc_gNB_reconfig.c | 80 +++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 24 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index aeb62f6806..06c4f846ba 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1172,11 +1172,10 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco nzpcsi0->qcl_InfoPeriodicCSI_RS = NULL; ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpcsi0); - //csi_MeasConfig->csi_SSB_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_SSB_ResourceSetToAddModList)); - csi_MeasConfig->csi_SSB_ResourceSetToAddModList = NULL; + csi_MeasConfig->csi_SSB_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_SSB_ResourceSetToAddModList)); csi_MeasConfig->csi_SSB_ResourceSetToReleaseList = NULL; - /*NR_CSI_SSB_ResourceSet_t *ssbresset0 = calloc(1,sizeof(*ssbresset0)); + NR_CSI_SSB_ResourceSet_t *ssbresset0 = calloc(1,sizeof(*ssbresset0)); ssbresset0->csi_SSB_ResourceSetId=0; NR_SSB_Index_t *ssbresset[64]; @@ -1187,7 +1186,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset[i]); } } - ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list,ssbresset0);*/ + ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list,ssbresset0); csi_MeasConfig->csi_ResourceConfigToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_ResourceConfigToAddModList)); csi_MeasConfig->csi_ResourceConfigToReleaseList = NULL; @@ -1195,20 +1194,26 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csires0->csi_ResourceConfigId=0; csires0->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB)); - csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = NULL; csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList)); NR_NZP_CSI_RS_ResourceSetId_t *nzp0 = calloc(1,sizeof(*nzp0)); *nzp0 = 0; ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,nzp0); - /*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = NULL; - csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList)); - NR_CSI_SSB_ResourceSetId_t *ssbres00 = calloc(1,sizeof(*ssbres00)); - *ssbres00 = 0; - ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list,ssbres00);*/ csires0->bwp_Id = 1; csires0->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires0); + NR_CSI_ResourceConfig_t *csires1 = calloc(1,sizeof(*csires1)); + csires1->csi_ResourceConfigId=1; + csires1->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; + csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB)); + csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = calloc(1,sizeof(*csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList)); + NR_CSI_SSB_ResourceSetId_t *ssbres00 = calloc(1,sizeof(*ssbres00)); + *ssbres00 = 0; + ASN_SEQUENCE_ADD(&csires1->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list,ssbres00); + csires1->bwp_Id = 1; + csires1->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; + ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires1); + csi_MeasConfig->csi_ReportConfigToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_ReportConfigToAddModList)); csi_MeasConfig->csi_ReportConfigToReleaseList = NULL; NR_CSI_ReportConfig_t *csirep1 = calloc(1,sizeof(*csirep1)); @@ -1220,18 +1225,15 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csirep1->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; csirep1->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep1->reportConfigType.choice.periodic)); csirep1->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; - csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 9 + (10 * uid) % 320; + csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 9 + (20 * uid) % 320; NR_PUCCH_CSI_Resource_t *pucchcsires1 = calloc(1,sizeof(*pucchcsires1)); pucchcsires1->uplinkBandwidthPartId=1; pucchcsires1->pucch_Resource=2; ASN_SEQUENCE_ADD(&csirep1->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); - csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI; - csirep1->reportQuantity.choice.cri_RI_CQI=(NULL_t)0; - /*csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP; - csirep1->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0;*/ + csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP; + csirep1->reportQuantity.choice.cri_RSRP=(NULL_t)0; csirep1->reportFreqConfiguration = calloc(1,sizeof(*csirep1->reportFreqConfiguration)); - csirep1->reportFreqConfiguration->cqi_FormatIndicator = calloc(1,sizeof(*csirep1->reportFreqConfiguration->cqi_FormatIndicator)); - *csirep1->reportFreqConfiguration->cqi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI; + csirep1->reportFreqConfiguration->cqi_FormatIndicator = NULL; csirep1->reportFreqConfiguration->pmi_FormatIndicator=NULL; csirep1->reportFreqConfiguration->csi_ReportingBand=NULL; csirep1->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_configured; @@ -1242,18 +1244,48 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csirep1->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled)); csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); *csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; - csirep1->cqi_Table = calloc(1,sizeof(*csirep1->cqi_Table)); - *csirep1->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table1; + csirep1->cqi_Table = NULL; csirep1->subbandSize = NR_CSI_ReportConfig__subbandSize_value1; - csirep1->non_PMI_PortIndication = calloc(1,sizeof(*csirep1->non_PMI_PortIndication)); - NR_PortIndexFor8Ranks_t *portindex1 = calloc(1,sizeof(*portindex1)); - portindex1->present = NR_PortIndexFor8Ranks_PR_portIndex1; - portindex1->choice.portIndex1 = (NULL_t)0; - ASN_SEQUENCE_ADD(&csirep1->non_PMI_PortIndication->list,portindex1); + csirep1->non_PMI_PortIndication = NULL; csirep1->ext1 = NULL; ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep1); + NR_CSI_ReportConfig_t *csirep2 = calloc(1,sizeof(*csirep2)); + csirep2->reportConfigId=1; + csirep2->carrier=NULL; + csirep2->resourcesForChannelMeasurement=1; + csirep2->csi_IM_ResourcesForInterference=NULL; + csirep2->nzp_CSI_RS_ResourcesForInterference=NULL; + csirep2->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; + csirep2->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep2->reportConfigType.choice.periodic)); + csirep2->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; + csirep2->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 19 + (20 * uid) % 320; + ASN_SEQUENCE_ADD(&csirep2->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); + csirep2->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP; + csirep2->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0; + csirep2->reportFreqConfiguration = calloc(1,sizeof(*csirep2->reportFreqConfiguration)); + csirep2->reportFreqConfiguration->cqi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI; + csirep2->reportFreqConfiguration->pmi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__pmi_FormatIndicator_widebandPMI; + csirep2->reportFreqConfiguration->csi_ReportingBand=NULL; + csirep2->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_configured; + csirep2->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_configured; + csirep2->codebookConfig= NULL; + + csirep2->dummy = NULL; + csirep2->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; + csirep2->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep2->groupBasedBeamReporting.choice.disabled)); + csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); + *csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; + + csirep2->cqi_Table = calloc(1,sizeof(*csirep2->cqi_Table)); + *csirep2->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table1; + csirep2->subbandSize = NR_CSI_ReportConfig__subbandSize_value1; + csirep2->non_PMI_PortIndication = NULL; + csirep2->ext1 = NULL; + + ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep2); + secondaryCellGroup->spCellConfig->spCellConfigDedicated->sCellDeactivationTimer=NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig=NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->tag_Id=0; From 9460c27589702c9c63cee1f8e0527afe950d791c Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 28 May 2021 18:58:51 +0200 Subject: [PATCH 049/135] current implementation does not allow 2 csi report in a frame, moving second one in the following frame --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 7 +++---- openair2/RRC/NR/rrc_gNB_reconfig.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 39f9847d11..413a57d2fd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -453,10 +453,9 @@ uint16_t nr_get_csi_bitlen(int Mod_idP, void nr_csi_meas_reporting(int Mod_idP, frame_t frame, - sub_frame_t slot) -{ - NR_ServingCellConfigCommon_t *scc = - RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon; + sub_frame_t slot) { + + NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon; const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 06c4f846ba..88c1154cca 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -1260,7 +1260,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csirep2->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; csirep2->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep2->reportConfigType.choice.periodic)); csirep2->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; - csirep2->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 19 + (20 * uid) % 320; + csirep2->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 29 + (20 * uid) % 320; ASN_SEQUENCE_ADD(&csirep2->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); csirep2->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP; csirep2->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0; From ac4670990c91ff979ff70faed53577fa51bfb19d Mon Sep 17 00:00:00 2001 From: Eurecom Date: Sun, 30 May 2021 23:14:12 +0200 Subject: [PATCH 050/135] handling for UL failure. added do_precoding flag to nr-ru procedures. testing with 2x2 N310. --- executables/nr-gnb.c | 2 +- executables/nr-ru.c | 1 + openair1/PHY/INIT/nr_init_ru.c | 3 +- openair1/PHY/NR_TRANSPORT/nr_ulsch.c | 4 +- openair1/SCHED_NR/nr_ru_procedures.c | 24 +- openair2/COMMON/rrc_messages_types.h | 1 + openair2/ENB_APP/enb_paramdef.h | 6 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 66 ++-- openair2/F1AP/f1ap_du_ue_context_management.c | 31 +- openair2/GNB_APP/gnb_config.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 42 ++- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 1 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 1 + openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 7 +- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 2 +- openair2/RRC/NR/L2_nr_interface.c | 20 ++ openair2/RRC/NR/rrc_gNB.c | 291 +++++++++++++++++- openair2/RRC/NR/rrc_gNB_NGAP.c | 16 +- openair2/RRC/NR/rrc_gNB_NGAP.h | 4 + targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 30 +- 20 files changed, 476 insertions(+), 78 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index f5e49b73b8..f07563bddb 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -354,7 +354,7 @@ void *nrL1_stats_thread(void *param) { while (!oai_exit) { sleep(1); fd=fopen("nrL1_stats.log","w"); - AssertFatal(fd!=NULL,"Cannot open ngL1_stats.log\n"); + AssertFatal(fd!=NULL,"Cannot open nrL1_stats.log\n"); dump_nr_I0_stats(fd,gNB); dump_pusch_stats(fd,gNB); // dump_uci_stats(fd,eNB,eNB->proc.L1_proc_tx.frame_tx); diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 6d5b0ec8a3..21fc63bf36 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -2072,6 +2072,7 @@ void RCconfig_RU(void) RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr); RC.ru[j]->if_frequency = *(RUParamList.paramarray[j][RU_IF_FREQUENCY].u64ptr); RC.ru[j]->if_freq_offset = *(RUParamList.paramarray[j][RU_IF_FREQ_OFFSET].iptr); + RC.ru[j]->do_precoding = *(RUParamList.paramarray[j][RU_DO_PRECODING].iptr); if (config_isparamset(RUParamList.paramarray[j], RU_BF_WEIGHTS_LIST_IDX)) { RC.ru[j]->nb_bfw = RUParamList.paramarray[j][RU_BF_WEIGHTS_LIST_IDX].numelt; diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index 2bd7d90620..ffc9f3b385 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -137,8 +137,9 @@ int nr_phy_init_RU(RU_t *ru) { ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); for (j=0; jnb_tx; j++) { ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); + AssertFatal(ru->bw_list[i],"ru->bw_list[%d] is null\n",i); for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = ru->bw_list[j][l_ind]; + ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind]; //printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j); l_ind++; } // for j diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c index e6b709b2aa..d50f5eb76c 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c @@ -150,9 +150,9 @@ void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB) { gNB->ulsch_stats[i].rnti, aa,gNB->ulsch_stats[i].power[aa]/10,gNB->ulsch_stats[i].power[aa]%10, aa,gNB->ulsch_stats[i].noise_power[aa]/10,gNB->ulsch_stats[i].noise_power[aa]%10); - else stroff+=sprintf(output+stroff," ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d\n", + else stroff+=sprintf(output+stroff," ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d\n", aa,gNB->ulsch_stats[i].power[aa]/10,gNB->ulsch_stats[i].power[aa]%10, - gNB->ulsch_stats[i].noise_power[aa]/10,gNB->ulsch_stats[i].noise_power[aa]%10); + aa,gNB->ulsch_stats[i].noise_power[aa]/10,gNB->ulsch_stats[i].noise_power[aa]%10); AssertFatal(stroff<(STATSTRLEN-1000),"Increase STATSTRLEN\n"); diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 1b2baf03f5..76d6e07db3 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -200,18 +200,17 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+j , 1); start_meas(&ru->txdataF_copy_stats); - if (ru->num_gNB == 1){ - gNB = ru->gNB_list[0]; - cfg = &gNB->gNB_config; + AssertFatal(ru->num_gNB==1,"num_gNB>1, help\n"); + gNB = ru->gNB_list[0]; + cfg = &gNB->gNB_config; - for(i=0; inb_tx; ++i){ - memcpy((void*)&ru->common.txdataF[i][j*fp->ofdm_symbol_size], - (void*)&gNB->common_vars.txdataF[i][j*fp->ofdm_symbol_size + txdataF_offset], - fp->ofdm_symbol_size*sizeof(int32_t)); + for(i=0; inb_tx; ++i){ + memcpy((void*)&ru->common.txdataF[i][j*fp->ofdm_symbol_size], + (void*)&gNB->common_vars.txdataF[i][j*fp->ofdm_symbol_size + txdataF_offset], + fp->ofdm_symbol_size*sizeof(int32_t)); - } + } - }//num_gNB == 1 stop_meas(&ru->txdataF_copy_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+j , 0); @@ -320,6 +319,13 @@ static void *nr_feptx_thread(void *param) { (void*)&ru->gNB_list[0]->common_vars.txdataF[0][txdataF_offset + l*fp->ofdm_symbol_size], (fp->samples_per_slot_wCP>>1)*sizeof(int32_t)); } + else if (ru->do_precoding == 0) { + int gNB_tx = ru->gNB_list[0]->frame_parms.nb_antennas_tx; + for (int aa=0;aanb_tx;aa++) + memcpy((void*)&ru->common.txdataF_BF[aa][l*fp->ofdm_symbol_size], + (void*)&ru->gNB_list[0]->common_vars.txdataF[aa%gNB_tx][txdataF_offset + l*fp->ofdm_symbol_size], + (fp->samples_per_slot_wCP>>1)*sizeof(int32_t)); + } else { bw = ru->beam_weights[0]; for(i=0; isymbols_per_slot>>1; ++i){ diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 64c42eaf0e..220ef60b3d 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -405,6 +405,7 @@ typedef struct NRRrcConfigurationReq_s { uint16_t mcc[PLMN_LIST_MAX_SIZE]; uint16_t mnc[PLMN_LIST_MAX_SIZE]; uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE]; + uint8_t num_plmn; NR_ServingCellConfigCommon_t *scc; NR_ServingCellConfig_t *scd; int ssb_SubcarrierOffset; diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index f26863414c..79e66881b5 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -98,6 +98,7 @@ typedef enum { #define CONFIG_STRING_RU_BF_WEIGHTS_LIST "bf_weights" #define CONFIG_STRING_RU_IF_FREQUENCY "if_freq" #define CONFIG_STRING_RU_IF_FREQ_OFFSET "if_offset" +#define CONFIG_STRING_RU_DO_PRECODING "do_precoding" #define RU_LOCAL_IF_NAME_IDX 0 #define RU_LOCAL_ADDRESS_IDX 1 @@ -127,7 +128,7 @@ typedef enum { #define RU_BF_WEIGHTS_LIST_IDX 25 #define RU_IF_FREQUENCY 26 #define RU_IF_FREQ_OFFSET 27 - +#define RU_DO_PRECODING 28 /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* RU configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -160,7 +161,8 @@ typedef enum { {CONFIG_STRING_RU_OTA_SYNC_ENABLE, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \ {CONFIG_STRING_RU_BF_WEIGHTS_LIST, NULL, 0, iptr:NULL, defintarrayval:DEFBFW, TYPE_INTARRAY, 0}, \ {CONFIG_STRING_RU_IF_FREQUENCY, NULL, 0, u64ptr:NULL, defuintval:0, TYPE_UINT64, 0}, \ - {CONFIG_STRING_RU_IF_FREQ_OFFSET, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ + {CONFIG_STRING_RU_IF_FREQ_OFFSET, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ + {CONFIG_STRING_RU_DO_PRECODING, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ } /*---------------------------------------------------------------------------------------------------------------------------------------*/ diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 85c992f757..54c61ad5bf 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -39,8 +39,10 @@ #include "rrc_extern.h" #include "rrc_eNB_UE_context.h" +#include "openair2/RRC/NR/rrc_gNB_UE_context.h" #include "rrc_eNB_S1AP.h" #include "rrc_eNB_GTPV1U.h" +#include "openair2/RRC/NR/rrc_gNB_NGAP.h" extern f1ap_setup_req_t *f1ap_du_data_from_du; extern f1ap_cudu_inst_t f1ap_cu_inst[MAX_eNB]; @@ -1024,35 +1026,55 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, // F1AP_CriticalityDiagnostics_IE_List } - struct rrc_eNB_ue_context_s *ue_context_p = - rrc_eNB_get_ue_context(RC.rrc[instance], rnti); protocol_ctxt_t ctxt; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, instance, ENB_FLAG_YES, rnti, 0, 0, instance); - if (ue_context_p) { - /* The following is normally done in the function rrc_rx_tx() */ - rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(instance, - ue_context_p->ue_context.eNB_ue_s1ap_id); + if (RC.nrrrc[instance]->node_type == ngran_gNB_CU) { + struct rrc_gNB_ue_context_s *ue_context_p = + rrc_gNB_get_ue_context(RC.nrrrc[instance], rnti); - rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(instance, ue_context_p); - // erase data of GTP tunnels in UE context - for (int e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { - ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0; - memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], - 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); - ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; + if (ue_context_p) { + MessageDef *msg = itti_alloc_new_message(TASK_CU_F1, 0, NGAP_UE_CONTEXT_RELEASE_COMPLETE); + NGAP_UE_CONTEXT_RELEASE_COMPLETE(msg).gNB_ue_ngap_id = ue_context_p->ue_context.gNB_ue_ngap_id; + itti_send_msg_to_task(TASK_NGAP, instance, msg); + + rrc_gNB_remove_ue_context(&ctxt, RC.nrrrc[instance], ue_context_p); + } else { + LOG_E(F1AP, "could not find ue_context of UE RNTI %x\n", rnti); } +#ifdef ITTI_SIM + return 0; +#endif - struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = - rrc_eNB_S1AP_get_ue_ids(RC.rrc[instance], 0, - ue_context_p->ue_context.eNB_ue_s1ap_id); - if (rrc_ue_s1ap_ids) - rrc_eNB_S1AP_remove_ue_ids(RC.rrc[instance], rrc_ue_s1ap_ids); - - /* trigger UE release in RRC */ - rrc_eNB_remove_ue_context(&ctxt, RC.rrc[instance], ue_context_p); } else { - LOG_E(F1AP, "could not find ue_context of UE RNTI %x\n", rnti); + struct rrc_eNB_ue_context_s *ue_context_p = + rrc_eNB_get_ue_context(RC.rrc[instance], rnti); + + if (ue_context_p) { + /* The following is normally done in the function rrc_rx_tx() */ + rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(instance, + ue_context_p->ue_context.eNB_ue_s1ap_id); + + rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(instance, ue_context_p); + // erase data of GTP tunnels in UE context + for (int e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { + ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0; + memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], + 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); + ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; + } + + struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = + rrc_eNB_S1AP_get_ue_ids(RC.rrc[instance], 0, + ue_context_p->ue_context.eNB_ue_s1ap_id); + if (rrc_ue_s1ap_ids) + rrc_eNB_S1AP_remove_ue_ids(RC.rrc[instance], rrc_ue_s1ap_ids); + + /* trigger UE release in RRC */ + rrc_eNB_remove_ue_context(&ctxt, RC.rrc[instance], ue_context_p); + } else { + LOG_E(F1AP, "could not find ue_context of UE RNTI %x\n", rnti); + } } pdcp_remove_UE(&ctxt); diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 51bf7da32d..8bb3b53bb0 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -38,6 +38,8 @@ #include "rrc_extern.h" #include "rrc_eNB_UE_context.h" +#include "openair2/RRC/NR/rrc_gNB_UE_context.h" +#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" // undefine C_RNTI from // openair1/PHY/LTE_TRANSPORT/transport_common.h which @@ -662,11 +664,21 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, rnti, ctxt.rnti); int UE_out_of_sync = 0; - for (int n = 0; n < MAX_MOBILES_PER_ENB; ++n) { - if (RC.mac[instance]->UE_info.active[n] == TRUE - && rnti == UE_RNTI(instance, n)) { - UE_out_of_sync = RC.mac[instance]->UE_info.UE_sched_ctrl[n].ul_out_of_sync; - break; + if (RC.nrrrc[instance]->node_type == ngran_gNB_DU) { + for (int n = 0; n < MAX_MOBILES_PER_GNB; ++n) { + if (RC.nrmac[instance]->UE_info.active[n] == TRUE + && rnti == RC.nrmac[instance]->UE_info.rnti[n]) { + UE_out_of_sync = 0; + break; + } + } + } else { + for (int n = 0; n < MAX_MOBILES_PER_ENB; ++n) { + if (RC.mac[instance]->UE_info.active[n] == TRUE + && rnti == UE_RNTI(instance, n)) { + UE_out_of_sync = RC.mac[instance]->UE_info.UE_sched_ctrl[n].ul_out_of_sync; + break; + } } } @@ -716,6 +728,15 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, } } + if (RC.nrrrc[instance]->node_type == ngran_gNB_DU) { + // struct rrc_gNB_ue_context_s *ue_context_p; + + f1ap_ue_context_release_cplt_t cplt; + cplt.rnti = ctxt.rnti; + DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance, &cplt); + return 0; + } + struct rrc_eNB_ue_context_s *ue_context_p; ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id], ctxt.rnti); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 8eb9670934..643dd0096c 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1026,7 +1026,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n", PLMNParamList.numelt); - RRC_CONFIGURATION_REQ(msg_p).num_plmn = PLMNParamList.numelt; + NRRRC_CONFIGURATION_REQ(msg_p).num_plmn = PLMNParamList.numelt; for (int l = 0; l < PLMNParamList.numelt; ++l) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 20f0bea3b2..9f790d30be 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -55,46 +55,56 @@ #include "nfapi/oai_integration/vendor_ext.h" #include "executables/nr-softmodem.h" +#include +#include + uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 }; void clear_mac_stats(gNB_MAC_INST *gNB) { memset((void*)gNB->UE_info.mac_stats,0,MAX_MOBILES_PER_GNB*sizeof(NR_mac_stats_t)); } - +#define MACSTATSSTRLEN 16384 void dump_mac_stats(gNB_MAC_INST *gNB) { NR_UE_info_t *UE_info = &gNB->UE_info; int num = 1; + FILE *fd=fopen("nrMAC_stats.log","w"); + AssertFatal(fd!=NULL,"Cannot open nrMAC_stats.log, error %s\n",strerror(errno)); + char output[MACSTATSSTRLEN]; + memset(output,0,MACSTATSSTRLEN); + int stroff=0; for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { - LOG_I(MAC, "UE ID %d RNTI %04x (%d/%d)\n", UE_id, UE_info->rnti[UE_id], num++, UE_info->num_UEs); + stroff = sprintf(output,"UE ID %d RNTI %04x (%d/%d)\n", UE_id, UE_info->rnti[UE_id], num++, UE_info->num_UEs); NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0; - LOG_I(MAC, "UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d, average RSRP %d (%d meas)\n", + stroff+=sprintf(output+stroff,"UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d, average RSRP %d (%d meas)\n", UE_id, stats->dlsch_rounds[0], stats->dlsch_rounds[1], stats->dlsch_rounds[2], stats->dlsch_rounds[3], stats->dlsch_errors, avg_rsrp, stats->num_rsrp_meas); stats->num_rsrp_meas = 0; stats->cumul_rsrp = 0 ; - LOG_I(MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes); - LOG_I(MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_DTX %d, ulsch_errors %d\n", - UE_id, - stats->ulsch_rounds[0], stats->ulsch_rounds[1], - stats->ulsch_rounds[2], stats->ulsch_rounds[3], - stats->ulsch_DTX, - stats->ulsch_errors); - LOG_I(MAC, - "UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n", - UE_id, - stats->ulsch_total_bytes_scheduled, stats->ulsch_total_bytes_rx); + stroff+=sprintf(output+stroff,"UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes); + stroff+=sprintf(output+stroff,"UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_DTX %d, ulsch_errors %d\n", + UE_id, + stats->ulsch_rounds[0], stats->ulsch_rounds[1], + stats->ulsch_rounds[2], stats->ulsch_rounds[3], + stats->ulsch_DTX, + stats->ulsch_errors); + stroff+=sprintf(output+stroff, + "UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n", + UE_id, + stats->ulsch_total_bytes_scheduled, stats->ulsch_total_bytes_rx); for (int lc_id = 0; lc_id < 63; lc_id++) { if (stats->lc_bytes_tx[lc_id] > 0) - LOG_I(MAC, "UE %d: LCID %d: %d bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]); + stroff+=sprintf(output+stroff, "UE %d: LCID %d: %d bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]); if (stats->lc_bytes_rx[lc_id] > 0) - LOG_I(MAC, "UE %d: LCID %d: %d bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]); + stroff+=sprintf(output+stroff, "UE %d: LCID %d: %d bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]); } } print_meas(&gNB->eNB_scheduler, "DL & UL scheduling timing stats", NULL, NULL); + if (stroff>0) fprintf(fd,"%s",output); + fclose(fd); } void clear_nr_nfapi_information(gNB_MAC_INST * gNB, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 9d27620198..89ef8e1426 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -457,6 +457,7 @@ void pf_dl(module_id_t module_id, for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { if (UE_info->Msg4_ACKed[UE_id] != true) continue; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + if (sched_ctrl->ul_failure==1) continue; int bwp_Id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0; NR_BWP_DownlinkDedicated_t *bwp_Dedicated=NULL; if (sched_ctrl->active_bwp) bwp_Dedicated = sched_ctrl->active_bwp->bwp_Dedicated; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 1f0106124d..9affac70f7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -514,6 +514,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if (UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt >= pusch_failure_thres) { LOG_I(NR_MAC,"Detected UL Failure on PUSCH, stopping scheduling\n"); UE_info->UE_sched_ctrl[UE_id].ul_failure = 1; + nr_mac_eNB_rrc_ul_failure(gnb_mod_idP,CC_idP,frameP,slotP,rntiP); } } } else if(sduP) { diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 63d7934aab..acf3f87117 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -905,7 +905,7 @@ boolean_t nr_rrc_pdcp_config_asn1_req( //ctxt_pP->configured != 2 || //srb2add_list == NULL || //drb2add_list != NULL || - drb2release_list != NULL || + //drb2release_list != NULL || //security_modeP != 255 || //kRRCenc != NULL || //kRRCint != NULL || @@ -935,6 +935,10 @@ boolean_t nr_rrc_pdcp_config_asn1_req( if (kRRCint != NULL) { /* todo */ } + + if (drb2release_list != NULL) { + // TODO + } free(kRRCenc); free(kRRCint); @@ -1202,6 +1206,7 @@ static boolean_t pdcp_data_req_drb( if (rb == NULL) { LOG_E(PDCP, "%s:%d:%s: no DRB found (rnti %d, rb_id %ld)\n", __FILE__, __LINE__, __FUNCTION__, rnti, rb_id); + nr_pdcp_manager_unlock(nr_pdcp_ue_manager); return 0; } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 9373b03668..02fb0c625c 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -918,7 +918,7 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt if (drb2release_listP != NULL) { LOG_E(RLC, "%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); + //exit(1); } if (srb2add_listP != NULL) { diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index f8cb75c74d..329bc0479f 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -364,3 +364,23 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, return 0; } + +void nr_mac_eNB_rrc_ul_failure(const module_id_t Mod_instP, + const int CC_idP, + 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_I(RRC,"Frame %d, Subframe %d: UE %x UL failure, activating timer\n",frameP,subframeP,rntiP); + + if(ue_context_p->ue_context.ul_failure_timer == 0) + ue_context_p->ue_context.ul_failure_timer=1; + } else { + LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP); + } +} diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index b8361ae45f..4cd79cb134 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -2830,8 +2830,290 @@ void rrc_gNB_process_dc_overall_timeout(const module_id_t gnb_mod_idP, x2ap_ENDC rrc_remove_nsa_user(rrc, m->rnti); } +unsigned int mask_flip(unsigned int x) { + return((((x>>8) + (x<<8))&0xffff)>>6); +} + +unsigned int get_dl_bw_mask(gNB_RRC_INST *rrc,NR_UE_NR_Capability_t *cap) { + + + int common_band = *rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + int common_scs = rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + for (int i=0;irf_Parameters.supportedBandListNR.list.count;i++) { + NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[i]; + if (bandNRinfo->bandNR == common_band) { + if (common_band < 257) { // FR1 + switch (common_scs) { + case NR_SubcarrierSpacing_kHz15 : + if (bandNRinfo->channelBWs_DL && + bandNRinfo->channelBWs_DL->choice.fr1 && + bandNRinfo->channelBWs_DL->choice.fr1->scs_15kHz) + return(mask_flip((unsigned int)*(uint16_t*)bandNRinfo->channelBWs_DL->choice.fr1->scs_15kHz->buf)); + break; + case NR_SubcarrierSpacing_kHz30 : + if (bandNRinfo->channelBWs_DL && + bandNRinfo->channelBWs_DL->choice.fr1 && + bandNRinfo->channelBWs_DL->choice.fr1->scs_30kHz) + return(mask_flip((unsigned int)*(uint16_t*)bandNRinfo->channelBWs_DL->choice.fr1->scs_30kHz->buf)); + break; + case NR_SubcarrierSpacing_kHz60 : + if (bandNRinfo->channelBWs_DL && + bandNRinfo->channelBWs_DL->choice.fr1 && + bandNRinfo->channelBWs_DL->choice.fr1->scs_60kHz) + return(mask_flip((unsigned int)*(uint16_t*)bandNRinfo->channelBWs_DL->choice.fr1->scs_60kHz->buf)); + break; + } + } + else { + switch (common_scs) { + case NR_SubcarrierSpacing_kHz60 : + if (bandNRinfo->channelBWs_DL && + bandNRinfo->channelBWs_DL->choice.fr2 && + bandNRinfo->channelBWs_DL->choice.fr2->scs_60kHz) + return(mask_flip((unsigned int)*(uint16_t*)bandNRinfo->channelBWs_DL->choice.fr2->scs_60kHz->buf)); + break; + case NR_SubcarrierSpacing_kHz120 : + if (bandNRinfo->channelBWs_DL && + bandNRinfo->channelBWs_DL->choice.fr2 && + bandNRinfo->channelBWs_DL->choice.fr2->scs_120kHz) + return(mask_flip((unsigned int)*(uint16_t*)bandNRinfo->channelBWs_DL->choice.fr2->scs_120kHz->buf)); + break; + } + } + } + } + return(0); +} + +unsigned int get_ul_bw_mask(gNB_RRC_INST *rrc,NR_UE_NR_Capability_t *cap) { + + + int common_band = *rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]; + int common_scs = rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + for (int i=0;irf_Parameters.supportedBandListNR.list.count;i++) { + NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[i]; + if (bandNRinfo->bandNR == common_band) { + if (common_band < 257) { // FR1 + switch (common_scs) { + case NR_SubcarrierSpacing_kHz15 : + if (bandNRinfo->channelBWs_UL && + bandNRinfo->channelBWs_UL->choice.fr1 && + bandNRinfo->channelBWs_UL->choice.fr1->scs_15kHz) + return(mask_flip((unsigned int)*(uint16_t*)bandNRinfo->channelBWs_UL->choice.fr1->scs_15kHz->buf)); + break; + case NR_SubcarrierSpacing_kHz30 : + if (bandNRinfo->channelBWs_UL && + bandNRinfo->channelBWs_UL->choice.fr1 && + bandNRinfo->channelBWs_UL->choice.fr1->scs_30kHz) + return(mask_flip((unsigned int)*(uint16_t*)bandNRinfo->channelBWs_UL->choice.fr1->scs_30kHz->buf)); + break; + case NR_SubcarrierSpacing_kHz60 : + if (bandNRinfo->channelBWs_UL && + bandNRinfo->channelBWs_UL->choice.fr1 && + bandNRinfo->channelBWs_UL->choice.fr1->scs_60kHz) + return(mask_flip((unsigned int)*(uint16_t*)bandNRinfo->channelBWs_UL->choice.fr1->scs_60kHz->buf)); + break; + } + } + else { + switch (common_scs) { + case NR_SubcarrierSpacing_kHz60 : + if (bandNRinfo->channelBWs_UL && + bandNRinfo->channelBWs_UL->choice.fr2 && + bandNRinfo->channelBWs_UL->choice.fr2->scs_60kHz) + return(mask_flip((unsigned int)*(uint16_t*)bandNRinfo->channelBWs_UL->choice.fr2->scs_60kHz->buf)); + break; + case NR_SubcarrierSpacing_kHz120 : + if (bandNRinfo->channelBWs_UL && + bandNRinfo->channelBWs_UL->choice.fr2 && + bandNRinfo->channelBWs_UL->choice.fr2->scs_120kHz) + return(mask_flip((unsigned int)*(uint16_t*)bandNRinfo->channelBWs_UL->choice.fr2->scs_120kHz->buf)); + break; + } + } + } + } + return(0); +} + +int is_dl_256QAM_supported(gNB_RRC_INST *rrc,NR_UE_NR_Capability_t *cap) { + int common_band = *rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + int common_scs = rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + if (common_band>256) { + for (int i=0;irf_Parameters.supportedBandListNR.list.count;i++) { + NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[i]; + if (bandNRinfo->bandNR == common_band && !bandNRinfo->pdsch_256QAM_FR2) return (0); + } + } + else if (cap->phy_Parameters.phy_ParametersFR1 && !cap->phy_Parameters.phy_ParametersFR1->pdsch_256QAM_FR1) return(0); + + // check featureSet + NR_FeatureSets_t *fs=cap->featureSets; + if (fs) { + // go through DL feature sets and look for one with current SCS + for (int i=0;ifeatureSetsDownlinkPerCC->list.count;i++) { + if (fs->featureSetsDownlinkPerCC->list.array[i]->supportedSubcarrierSpacingDL == common_scs && + fs->featureSetsDownlinkPerCC->list.array[i]->supportedModulationOrderDL && + *fs->featureSetsDownlinkPerCC->list.array[i]->supportedModulationOrderDL == NR_ModulationOrder_qam256) return(1); + } + } + return(0); +} + +int is_ul_256QAM_supported(gNB_RRC_INST *rrc,NR_UE_NR_Capability_t *cap) { + int common_band = *rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]; + int common_scs = rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + for (int i=0;irf_Parameters.supportedBandListNR.list.count;i++) { + NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[i]; + if (bandNRinfo->bandNR == common_band && !bandNRinfo->pusch_256QAM) return (0); + } + + // check featureSet + NR_FeatureSets_t *fs=cap->featureSets; + if (fs) { + // go through UL feature sets and look for one with current SCS + for (int i=0;ifeatureSetsUplinkPerCC->list.count;i++) { + if (fs->featureSetsUplinkPerCC->list.array[i]->supportedSubcarrierSpacingUL == common_scs && + fs->featureSetsUplinkPerCC->list.array[i]->supportedModulationOrderUL && + *fs->featureSetsUplinkPerCC->list.array[i]->supportedModulationOrderUL == NR_ModulationOrder_qam256) return(1); + } + } + return(0); +} + +int get_ul_mimo_layersCB(gNB_RRC_INST *rrc,NR_UE_NR_Capability_t *cap) { + int common_scs = rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + + // check featureSet + NR_FeatureSets_t *fs=cap->featureSets; + if (fs) { + // go through UL feature sets and look for one with current SCS + for (int i=0;ifeatureSetsUplinkPerCC->list.count;i++) { + if (fs->featureSetsUplinkPerCC->list.array[i]->supportedSubcarrierSpacingUL == common_scs && + fs->featureSetsUplinkPerCC->list.array[i]->mimo_CB_PUSCH && + fs->featureSetsUplinkPerCC->list.array[i]->mimo_CB_PUSCH->maxNumberMIMO_LayersCB_PUSCH) + return(1<<*fs->featureSetsUplinkPerCC->list.array[i]->mimo_CB_PUSCH->maxNumberMIMO_LayersCB_PUSCH); + } + } + return(1); +} + +int get_ul_mimo_layers(gNB_RRC_INST *rrc,NR_UE_NR_Capability_t *cap) { + int common_scs = rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + + // check featureSet + NR_FeatureSets_t *fs=cap->featureSets; + if (fs) { + // go through UL feature sets and look for one with current SCS + for (int i=0;ifeatureSetsUplinkPerCC->list.count;i++) { + if (fs->featureSetsUplinkPerCC->list.array[i]->supportedSubcarrierSpacingUL == common_scs && + fs->featureSetsUplinkPerCC->list.array[i]->maxNumberMIMO_LayersNonCB_PUSCH) + return(1<<*fs->featureSetsUplinkPerCC->list.array[i]->maxNumberMIMO_LayersNonCB_PUSCH); + } + } + return(1); +} + +int get_dl_mimo_layers(gNB_RRC_INST *rrc,NR_UE_NR_Capability_t *cap) { + int common_scs = rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + + // check featureSet + NR_FeatureSets_t *fs=cap->featureSets; + if (fs) { + // go through UL feature sets and look for one with current SCS + for (int i=0;ifeatureSetsDownlinkPerCC->list.count;i++) { + if (fs->featureSetsUplinkPerCC->list.array[i]->supportedSubcarrierSpacingUL == common_scs && + fs->featureSetsDownlinkPerCC->list.array[i]->maxNumberMIMO_LayersPDSCH) + return(2<<*fs->featureSetsDownlinkPerCC->list.array[i]->maxNumberMIMO_LayersPDSCH); + } + } + return(1); +} void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { MessageDef *msg; + int id; + rrc_gNB_ue_context_t *ue_context_p = NULL; + FILE *fd=fopen("nrRRCstats.log","w"); + RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head)) { + ctxt_pP->rnti = ue_context_p->ue_id_rnti; + + if (fd) { + if (ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence == TRUE) { + fprintf(fd,"NR RRC UE rnti %x: S-TMSI %x failure timer %d/8\n", + ue_context_p->ue_id_rnti, + ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.fiveg_tmsi, + ue_context_p->ue_context.ul_failure_timer); + } else { + fprintf(fd,"NR RRC UE rnti %x failure timer %d/8\n", + ue_context_p->ue_id_rnti, + ue_context_p->ue_context.ul_failure_timer); + } + + if (ue_context_p->ue_context.UE_Capability_nr) { + fprintf(fd,"NR RRC UE cap: BW DL %x. BW UL %x, 256 QAM DL %s, 256 QAM UL %s, DL MIMO Layers %d UL MIMO Layers (CB) %d UL MIMO Layers (nonCB) %d\n", + get_dl_bw_mask(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr), + get_ul_bw_mask(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr), + is_dl_256QAM_supported(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr) == 1 ? "yes" : "no", + is_ul_256QAM_supported(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr) == 1 ? "yes" : "no", + get_dl_mimo_layers(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr), + get_ul_mimo_layersCB(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr), + get_ul_mimo_layers(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr)); + } + } + if (ue_context_p->ue_context.ul_failure_timer > 0) { + ue_context_p->ue_context.ul_failure_timer++; + + if (ue_context_p->ue_context.ul_failure_timer >= 20000) { + // remove UE after 20 seconds after MAC (or else) has indicated UL failure + LOG_I(RRC, "Removing UE %x instance, because of uplink failure timer timeout\n", + ue_context_p->ue_context.rnti); + if(ue_context_p->ue_context.Status >= NR_RRC_CONNECTED){ + rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_REQ( + ctxt_pP->module_id, + ue_context_p, + NGAP_CAUSE_RADIO_NETWORK, + 30); + }else{ + mac_remove_nr_ue(ctxt_pP->module_id, ctxt_pP->rnti); + rrc_rlc_remove_ue(ctxt_pP); + pdcp_remove_UE(ctxt_pP); + + /* remove RRC UE Context */ + ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rnti); + if (ue_context_p) { + rrc_gNB_remove_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], ue_context_p); + LOG_I(NR_RRC, "remove UE %x \n", ctxt_pP->rnti); + } + } + break; // break RB_FOREACH + } + } + + if (ue_context_p->ue_context.ue_release_timer_rrc > 0) { + ue_context_p->ue_context.ue_release_timer_rrc++; + + if (ue_context_p->ue_context.ue_release_timer_rrc >= ue_context_p->ue_context.ue_release_timer_thres_rrc) { + LOG_I(NR_RRC, "Removing UE %x instance after UE_CONTEXT_RELEASE_Complete (ue_release_timer_rrc timeout)\n", + ue_context_p->ue_context.rnti); + ue_context_p->ue_context.ue_release_timer_rrc = 0; + + mac_remove_nr_ue(ctxt_pP->module_id, ctxt_pP->rnti); + rrc_rlc_remove_ue(ctxt_pP); + pdcp_remove_UE(ctxt_pP); + + /* remove RRC UE Context */ + ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rnti); + if (ue_context_p) { + rrc_gNB_remove_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], ue_context_p); + LOG_I(NR_RRC, "remove UE %x \n", ctxt_pP->rnti); + } + + break; // break RB_FOREACH + } + } + } + + fclose(fd); /* send a tick to x2ap */ if (is_x2ap_enabled()){ @@ -3267,6 +3549,8 @@ rrc_gNB_generate_RRCRelease( size = do_NR_RRCRelease(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; + ue_context_pP->ue_context.ue_release_timer_rrc = 0; LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate RRCRelease (bytes %d)\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -3300,11 +3584,13 @@ rrc_gNB_generate_RRCRelease( itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); #else if (NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) { + uint8_t *message_buffer = itti_malloc (TASK_RRC_GNB, TASK_CU_F1, size); + memcpy (message_buffer, buffer, size); MessageDef *m = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_RELEASE_CMD); F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release - F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = buffer; + F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = message_buffer; F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = size; itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, m); } else { @@ -3315,6 +3601,9 @@ rrc_gNB_generate_RRCRelease( size, buffer, PDCP_TRANSMISSION_MODE_CONTROL); + + rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE(ctxt_pP->instance, ue_context_pP->ue_context.gNB_ue_ngap_id); + ue_context_pP->ue_context.ue_release_timer_rrc = 1; } #endif } diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 5595f87d14..deae7387d0 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -788,7 +788,6 @@ rrc_gNB_process_NGAP_DOWNLINK_NAS( struct rrc_gNB_ue_context_s *ue_context_p = NULL; protocol_ctxt_t ctxt; memset(&ctxt, 0, sizeof(protocol_ctxt_t)); - MessageDef *message_p; ue_initial_id = NGAP_DOWNLINK_NAS (msg_p).ue_initial_id; gNB_ue_ngap_id = NGAP_DOWNLINK_NAS (msg_p).gNB_ue_ngap_id; @@ -878,6 +877,7 @@ rrc_gNB_process_NGAP_DOWNLINK_NAS( { // rrc_mac_config_req_gNB #ifdef ITTI_SIM + MessageDef *message_p; uint8_t *message_buffer; message_buffer = itti_malloc (TASK_RRC_GNB, TASK_RRC_UE_SIM, length); memcpy (message_buffer, buffer, length); @@ -1229,11 +1229,25 @@ rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_COMMAND( return -1; } else { ue_context_p->ue_context.ue_release_timer_ng = 0; + ue_context_p->ue_context.ue_release_timer_thres_rrc = 1000; PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); + ctxt.eNB_index = 0; rrc_gNB_generate_RRCRelease(&ctxt, ue_context_p); return 0; } } + +void rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE( + instance_t instance, + uint32_t gNB_ue_ngap_id) { + MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, MSC_NGAP_GNB, NULL, 0, + "0 NGAP_UE_CONTEXT_RELEASE_COMPLETE gNB_ue_ngap_id 0x%06"PRIX32" ", + gNB_ue_ngap_id); + MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, NGAP_UE_CONTEXT_RELEASE_COMPLETE); + NGAP_UE_CONTEXT_RELEASE_COMPLETE(msg).gNB_ue_ngap_id = gNB_ue_ngap_id; + itti_send_msg_to_task(TASK_NGAP, instance, msg); +} + //------------------------------------------------------------------------------ /* * Remove UE ids (ue_initial_id and ng_id) from hashtables. diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.h b/openair2/RRC/NR/rrc_gNB_NGAP.h index f13c468f94..8779d62ff6 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.h +++ b/openair2/RRC/NR/rrc_gNB_NGAP.h @@ -129,6 +129,10 @@ rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_COMMAND( instance_t instance ); +void rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE( + instance_t instance, + uint32_t gNB_ue_ngap_id); + void rrc_gNB_NGAP_remove_ue_ids( gNB_RRC_INST *const rrc_instance_pP, diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index 351813e7c9..c0ff438fd0 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -633,30 +633,30 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp int16x8_t buff_tmp[2][nsamps2]; #endif - if (cc>1) { + samples_received=0; + while (samples_received != nsamps) { + + if (cc>1) { // receive multiple channels (e.g. RF A and RF B) - std::vector buff_ptrs; + std::vector buff_ptrs; - for (int i=0; irx_stream->recv(buff_ptrs, nsamps, s->rx_md); - } else { + samples_received += s->rx_stream->recv(buff_ptrs, nsamps, s->rx_md); + } else { // receive a single channel (e.g. from connector RF A) - samples_received=0; - while (samples_received != nsamps) { samples_received += s->rx_stream->recv((void*)((int32_t*)buff_tmp[0]+samples_received), nsamps-samples_received, s->rx_md); - - if ((s->wait_for_first_pps == 0) && (s->rx_md.error_code!=uhd::rx_metadata_t::ERROR_CODE_NONE)) - break; - - if ((s->wait_for_first_pps == 1) && (samples_received != nsamps)) { - printf("sleep...\n"); //usleep(100); - } } - if (samples_received == nsamps) s->wait_for_first_pps=0; + if ((s->wait_for_first_pps == 0) && (s->rx_md.error_code!=uhd::rx_metadata_t::ERROR_CODE_NONE)) + break; + + if ((s->wait_for_first_pps == 1) && (samples_received != nsamps)) { + printf("sleep...\n"); //usleep(100); + } } + if (samples_received == nsamps) s->wait_for_first_pps=0; // bring RX data into 12 LSBs for softmodem RX for (int i=0; i Date: Tue, 1 Jun 2021 09:48:20 +0200 Subject: [PATCH 051/135] testing with 2x2 and 4x4 with N310, small modifications in nr_ru_procedures and usrp_lib.cpp for multiple antennas --- executables/nr-ru.c | 2 + openair1/PHY/INIT/nr_init_ru.c | 56 ++++++++++---------- openair1/SCHED_NR/nr_ru_procedures.c | 26 ++++----- targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 18 +++---- 4 files changed, 53 insertions(+), 49 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 21fc63bf36..b3acde7e99 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1397,6 +1397,7 @@ void *ru_thread( void *param ) { } } + // At this point, all information for subframe has been received on FH interface res = pullTpool(gNB->resp_L1, gNB->threadPool); syncMsg = (processingData_L1_t *)NotifiedFifoData(res); @@ -1409,6 +1410,7 @@ void *ru_thread( void *param ) { res->key = proc->tti_rx; pushTpool(gNB->threadPool, res); + } printf( "Exiting ru_thread \n"); diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index ffc9f3b385..e711da6437 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -121,37 +121,39 @@ int nr_phy_init_RU(RU_t *ru) { RC.nb_nr_L1_inst,NUMBER_OF_gNB_MAX); LOG_E(PHY,"[INIT] %s() RC.nb_nr_L1_inst:%d \n", __FUNCTION__, RC.nb_nr_L1_inst); - - int beam_count = 0; - if (ru->nb_tx>1) {//Enable beamforming when nb_tx > 1 - for (p=0;pnb_log_antennas;p++) { - //if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0 - beam_count++; - } - AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx)); - - int l_ind = 0; - for (i=0; ido_precoding == 1) { + int beam_count = 0; + if (ru->nb_tx>1) {//Enable beamforming when nb_tx > 1 for (p=0;pnb_log_antennas;p++) { + //if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0 + beam_count++; + } + AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx)); + + int l_ind = 0; + for (i=0; inb_log_antennas;p++) { //if ((fp->L_ssb >> (63-p)) & 0x01) { - ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); - for (j=0; jnb_tx; j++) { - ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); - AssertFatal(ru->bw_list[i],"ru->bw_list[%d] is null\n",i); - for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind]; + ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); + for (j=0; jnb_tx; j++) { + ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); + AssertFatal(ru->bw_list[i],"ru->bw_list[%d] is null\n",i); + for (re=0; reofdm_symbol_size; re++) + ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind]; //printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j); - l_ind++; - } // for j - //} - } // for p - } //for i - } + l_ind++; + } // for j + //} + } // for p + } //for i + } - ru->common.beam_id = (uint8_t**)malloc16_clear(ru->nb_tx*sizeof(uint8_t*)); - for(i=0; i< ru->nb_tx; ++i) { - ru->common.beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t)); - memset(ru->common.beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame); + ru->common.beam_id = (uint8_t**)malloc16_clear(ru->nb_tx*sizeof(uint8_t*)); + for(i=0; i< ru->nb_tx; ++i) { + ru->common.beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t)); + memset(ru->common.beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame); + } } } // !=IF5 diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 76d6e07db3..d9f482ad13 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -305,15 +305,16 @@ static void *nr_feptx_thread(void *param) { ////////////precoding//////////// VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->index+1 , 1); - start_meas(&ru->precoding_stats); + if (aa==0 && l==0) start_meas(&ru->precoding_stats); - for(i=0; inb_log_antennas; ++i) { - memcpy((void*) &ru->common.beam_id[i][slot*fp->symbols_per_slot+l], - (void*) &ru->gNB_list[0]->common_vars.beam_id[i][slot*fp->symbols_per_slot+l], - (fp->symbols_per_slot>>1)*sizeof(uint8_t)); + if (ru->do_precoding == 1) { + for(i=0; inb_log_antennas; ++i) { + memcpy((void*) &ru->common.beam_id[i][slot*fp->symbols_per_slot+l], + (void*) &ru->gNB_list[0]->common_vars.beam_id[i][slot*fp->symbols_per_slot+l], + (fp->symbols_per_slot>>1)*sizeof(uint8_t)); + } } - if (ru->nb_tx == 1 && ru->nb_log_antennas == 1) { memcpy((void*)&ru->common.txdataF_BF[0][l*fp->ofdm_symbol_size], (void*)&ru->gNB_list[0]->common_vars.txdataF[0][txdataF_offset + l*fp->ofdm_symbol_size], @@ -321,10 +322,9 @@ static void *nr_feptx_thread(void *param) { } else if (ru->do_precoding == 0) { int gNB_tx = ru->gNB_list[0]->frame_parms.nb_antennas_tx; - for (int aa=0;aanb_tx;aa++) - memcpy((void*)&ru->common.txdataF_BF[aa][l*fp->ofdm_symbol_size], - (void*)&ru->gNB_list[0]->common_vars.txdataF[aa%gNB_tx][txdataF_offset + l*fp->ofdm_symbol_size], - (fp->samples_per_slot_wCP>>1)*sizeof(int32_t)); + memcpy((void*)&ru->common.txdataF_BF[aa][l*fp->ofdm_symbol_size], + (void*)&ru->gNB_list[0]->common_vars.txdataF[aa%gNB_tx][txdataF_offset + l*fp->ofdm_symbol_size], + (fp->samples_per_slot_wCP>>1)*sizeof(int32_t)); } else { bw = ru->beam_weights[0]; @@ -340,13 +340,13 @@ static void *nr_feptx_thread(void *param) { txdataF_offset);//here } } - stop_meas(&ru->precoding_stats); + if (aa==0 && l==0) stop_meas(&ru->precoding_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->index+1 , 0); ////////////FEPTX//////////// - start_meas(&ru->ofdm_mod_stats); + if (aa==0 && l==0) start_meas(&ru->ofdm_mod_stats); nr_feptx0(ru,slot,start,fp->symbols_per_slot>>1,aa); - stop_meas(&ru->ofdm_mod_stats); + if (aa==0 && l==0) stop_meas(&ru->ofdm_mod_stats); if (release_thread(&feptx->mutex_feptx,&feptx->instance_cnt_feptx,"NR feptx thread")<0) break; diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index c0ff438fd0..8335f3b63e 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -385,14 +385,14 @@ static int trx_usrp_write(openair0_device *device, #if defined(__x86_64) || defined(__i386__) #ifdef __AVX2__ nsamps2 = (nsamps+7)>>3; - __m256i buff_tx[8][nsamps2]; + __m256i buff_tx[cc<2?2:cc][nsamps2]; #else nsamps2 = (nsamps+3)>>2; - __m128i buff_tx[8][nsamps2]; + __m128i buff_tx[cc<2?2:cc][nsamps2]; #endif #elif defined(__arm__) nsamps2 = (nsamps+3)>>2; - int16x8_t buff_tx[8][nsamps2]; + int16x8_t buff_tx[cc<2?2:cc][nsamps2]; #else #error Unsupported CPU architecture, USRP device cannot be built #endif @@ -522,14 +522,14 @@ void *trx_usrp_write_thread(void * arg){ #if defined(__x86_64) || defined(__i386__) #ifdef __AVX2__ nsamps2 = (nsamps+7)>>3; - __m256i buff_tx[8][nsamps2]; + __m256i buff_tx[cc<2?2:cc][nsamps2]; #else nsamps2 = (nsamps+3)>>2; - __m128i buff_tx[8][nsamps2]; + __m128i buff_tx[cc<2?2:cc][nsamps2]; #endif #elif defined(__arm__) nsamps2 = (nsamps+3)>>2; - int16x8_t buff_tx[8][nsamps2]; + int16x8_t buff_tx[cc<2?2:cc][nsamps2]; #else #error Unsupported CPU architecture, USRP device cannot be built #endif @@ -623,14 +623,14 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp #if defined(__x86_64) || defined(__i386__) #ifdef __AVX2__ nsamps2 = (nsamps+7)>>3; - __m256i buff_tmp[2][nsamps2]; + __m256i buff_tmp[cc<2 ? 2 : cc][nsamps2]; #else nsamps2 = (nsamps+3)>>2; - __m128i buff_tmp[2][nsamps2]; + __m128i buff_tmp[cc<2 ? 2 : cc][nsamps2]; #endif #elif defined(__arm__) nsamps2 = (nsamps+3)>>2; - int16x8_t buff_tmp[2][nsamps2]; + int16x8_t buff_tmp[cc<2 ? 2 : cc][nsamps2]; #endif samples_received=0; From 6749c5f762473de983d2e0ae791a885ed1a464f2 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 10 Jun 2021 13:11:56 +0200 Subject: [PATCH 052/135] Make more accurate sctp socket failure messages --- openair3/SCTP/sctp_eNB_task.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index af49c5c350..045c4e2c16 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -1026,7 +1026,14 @@ sctp_eNB_read_from_socket( break; default: - SCTP_WARN("unhandled: SCTP_ASSOC_CHANGE to %d\n", sctp_assoc_changed->sac_state); + if ( sctp_assoc_changed->sac_state == SCTP_SHUTDOWN_COMP) + SCTP_WARN("SCTP_ASSOC_CHANGE to SSCTP_SHUTDOWN_COMP\n"); + if ( sctp_assoc_changed->sac_state == SCTP_RESTART) + SCTP_WARN("SCTP_ASSOC_CHANGE to SCTP_RESTART\n"); + if ( sctp_assoc_changed->sac_state == SCTP_CANT_STR_ASSOC) + SCTP_ERROR("SCTP_ASSOC_CHANGE to SCTP_CANT_STR_ASSOC\n"); + if ( sctp_assoc_changed->sac_state == SCTP_COMM_LOST) + SCTP_ERROR("SCTP_ASSOC_CHANGE to SCTP_COMM_LOST\n"); break; } } From 1b62c91532d53e78606f8fe27c8840988217c83f Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 14 Jun 2021 16:32:29 +0200 Subject: [PATCH 053/135] add configurable USIM --- cmake_targets/CMakeLists.txt | 125 +++------------ cmake_targets/build_oai | 3 - .../install_external_packages.ubuntu20 | 16 +- executables/nr-uesoftmodem.c | 4 - openair1/PHY/NR_UE_TRANSPORT/nr_prach.c | 2 +- openair1/PHY/defs_nr_UE.h | 1 + openair2/RRC/NR_UE/rrc_UE.c | 17 ++- openair3/NAS/COMMON/IES/FGSMobileIdentity.c | 21 ++- openair3/NAS/COMMON/IES/FGSMobileIdentity.h | 2 +- openair3/NAS/COMMON/NR_NAS_defs.h | 1 + openair3/NAS/NR_UE/nr_nas_msg_sim.c | 142 ++++++++++-------- openair3/NAS/NR_UE/nr_nas_msg_sim.h | 4 +- openair3/UICC/usim_interface.c | 11 +- 13 files changed, 142 insertions(+), 207 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 775110a774..b1f5fb5ab3 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -997,7 +997,6 @@ add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION w add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE") add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE") add_boolean_option(ITTI_SIM False "enable itti simulator") -add_boolean_option(RFSIM_NAS False "enable rfsim nas") ######################## # Include order ########################## @@ -2443,108 +2442,6 @@ set (libnas_utils_OBJS ${NAS_SRC}COMMON/UTIL/OctetString.c ) -if(NAS_UE) - set(libnas_ue_api_OBJS - ${NAS_SRC}UE/API/USER/at_command.c - ${NAS_SRC}UE/API/USER/at_error.c - ${NAS_SRC}UE/API/USER/at_response.c - ${NAS_SRC}UE/API/USER/user_api.c - ${NAS_SRC}UE/API/USER/user_indication.c - ${NAS_SRC}UE/API/USIM/aka_functions.c - ${NAS_SRC}UE/API/USIM/usim_api.c - ) - set(libnas_ue_emm_OBJS - ${NAS_SRC}UE/EMM/Attach.c - ${NAS_SRC}UE/EMM/Authentication.c - ${NAS_SRC}UE/EMM/Detach.c - ${NAS_SRC}UE/EMM/emm_main.c - ${NAS_SRC}UE/EMM/EmmStatusHdl.c - ${NAS_SRC}UE/EMM/Identification.c - ${NAS_SRC}UE/EMM/IdleMode.c - ${NAS_SRC}UE/EMM/LowerLayer.c - ${NAS_SRC}UE/EMM/SecurityModeControl.c - ${NAS_SRC}UE/EMM/ServiceRequestHdl.c - ${NAS_SRC}UE/EMM/TrackingAreaUpdate.c - ) - set(libnas_ue_emm_sap_OBJS - ${NAS_SRC}UE/EMM/SAP/emm_as.c - ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttachNeeded.c - ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c - ${NAS_SRC}UE/EMM/SAP/EmmDeregistered.c - ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredInitiated.c - ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredLimitedService.c - ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c - ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoImsi.c - ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNormalService.c - ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredPlmnSearch.c - ${NAS_SRC}UE/EMM/SAP/emm_esm.c - ${NAS_SRC}UE/EMM/SAP/emm_fsm.c - ${NAS_SRC}UE/EMM/SAP/EmmNull.c - ${NAS_SRC}UE/EMM/SAP/emm_recv.c - ${NAS_SRC}UE/EMM/SAP/emm_reg.c - ${NAS_SRC}UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c - ${NAS_SRC}UE/EMM/SAP/EmmRegistered.c - ${NAS_SRC}UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c - ${NAS_SRC}UE/EMM/SAP/EmmRegisteredInitiated.c - ${NAS_SRC}UE/EMM/SAP/EmmRegisteredLimitedService.c - ${NAS_SRC}UE/EMM/SAP/EmmRegisteredNoCellAvailable.c - ${NAS_SRC}UE/EMM/SAP/EmmRegisteredNormalService.c - ${NAS_SRC}UE/EMM/SAP/EmmRegisteredPlmnSearch.c - ${NAS_SRC}UE/EMM/SAP/EmmRegisteredUpdateNeeded.c - ${NAS_SRC}UE/EMM/SAP/emm_sap.c - ${NAS_SRC}UE/EMM/SAP/emm_send.c - ${NAS_SRC}UE/EMM/SAP/EmmServiceRequestInitiated.c - ${NAS_SRC}UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c - ) - set (libnas_ue_esm_OBJS - ${NAS_SRC}UE/ESM/DedicatedEpsBearerContextActivation.c - ${NAS_SRC}UE/ESM/DefaultEpsBearerContextActivation.c - ${NAS_SRC}UE/ESM/EpsBearerContextDeactivation.c - ${NAS_SRC}UE/ESM/esm_ebr.c - ${NAS_SRC}UE/ESM/esm_ebr_context.c - ${NAS_SRC}UE/ESM/esm_ip.c - ${NAS_SRC}UE/ESM/esm_main.c - ${NAS_SRC}UE/ESM/esm_pt.c - ${NAS_SRC}UE/ESM/EsmStatusHdl.c - ${NAS_SRC}UE/ESM/PdnConnectivity.c - ${NAS_SRC}UE/ESM/PdnDisconnect.c - ) - set(libnas_ue_esm_sap_OBJS - ${NAS_SRC}UE/ESM/SAP/esm_recv.c - ${NAS_SRC}UE/ESM/SAP/esm_send.c - ${NAS_SRC}UE/ESM/SAP/esm_sap.c - ) - add_library(LIB_NAS_UE - ${NAS_SRC}UE/nas_itti_messaging.c - ${NAS_SRC}UE/nas_network.c - ${NAS_SRC}UE/nas_parser.c - ${NAS_SRC}UE/nas_proc.c - ${NAS_SRC}UE/nas_user.c - ${libnas_api_OBJS} - ${libnas_ue_api_OBJS} - ${libnas_emm_msg_OBJS} - ${libnas_esm_msg_OBJS} - ${libnas_ies_OBJS} - ${libnas_utils_OBJS} - ${libnas_ue_emm_OBJS} - ${libnas_ue_emm_sap_OBJS} - ${libnas_ue_esm_OBJS} - ${libnas_ue_esm_sap_OBJS} - ) - add_dependencies(LIB_NAS_UE rrc_flag) - set(NAS_UE_LIB LIB_NAS_UE) - - include_directories(${NAS_SRC}UE) - include_directories(${NAS_SRC}UE/API/USER) - include_directories(${NAS_SRC}UE/API/USIM) - include_directories(${NAS_SRC}UE/EMM) - include_directories(${NAS_SRC}UE/EMM/SAP) - include_directories(${NAS_SRC}UE/ESM) - include_directories(${NAS_SRC}UE/ESM/SAP) -endif() - - -#if(ITTI_SIM OR RFSIM_NAS) set(libnas_ue_api_OBJS ${NAS_SRC}UE/API/USER/at_command.c ${NAS_SRC}UE/API/USER/at_error.c @@ -2662,6 +2559,27 @@ endif() add_dependencies(LIB_NAS_SIMUE rrc_flag) set(NAS_SIM_LIB LIB_NAS_SIMUE) + add_library(LIB_NAS_UE + ${NAS_SRC}UE/nas_itti_messaging.c + ${NAS_SRC}UE/nas_network.c + ${NAS_SRC}UE/nas_parser.c + ${NAS_SRC}UE/nas_proc.c + ${NAS_SRC}UE/nas_user.c + ${libnas_api_OBJS} + ${libnas_ue_api_OBJS} + ${libnas_emm_msg_OBJS} + ${libnas_esm_msg_OBJS} + ${libnas_ies_OBJS} + ${libnas_utils_OBJS} + ${libnas_ue_emm_OBJS} + ${libnas_ue_emm_sap_OBJS} + ${libnas_ue_esm_OBJS} + ${libnas_ue_esm_sap_OBJS} + ) + add_dependencies(LIB_NAS_UE rrc_flag) + set(NAS_UE_LIB LIB_NAS_UE) + + include_directories(${NAS_SRC}NR_UE) include_directories(${NAS_SRC}UE) include_directories(${NAS_SRC}UE/API/USER) @@ -2670,7 +2588,6 @@ endif() include_directories(${NAS_SRC}UE/EMM/SAP) include_directories(${NAS_SRC}UE/ESM) include_directories(${NAS_SRC}UE/ESM/SAP) -#endif() # nbiot add_definitions("-DNUMBER_OF_UE_MAX_NB_IoT=16") diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 358053a060..0579d00d0f 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -68,7 +68,6 @@ USRP_REC_PLAY="False" BUILD_ECLIPSE=0 NR="False" ITTI_SIM="False" -RFSIM_NAS="False" SANITIZE_ADDRESS="False" OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope msc" trap handle_ctrl_c INT @@ -264,7 +263,6 @@ function main() { nrUE=1 NR="True" rfsimNas=1 - RFSIM_NAS="True" echo_info "Will compile NR UE" shift;; --mu) @@ -619,7 +617,6 @@ function main() { echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file - echo "set ( RFSIM_NAS $RFSIM_NAS )" >> $cmake_file echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file cd $DIR/$build_dir/build diff --git a/cmake_targets/install_external_packages.ubuntu20 b/cmake_targets/install_external_packages.ubuntu20 index 4b1cda42f8..95293198b9 100755 --- a/cmake_targets/install_external_packages.ubuntu20 +++ b/cmake_targets/install_external_packages.ubuntu20 @@ -159,16 +159,8 @@ install_protobuf_from_source(){ #cd protobuf-2.6.1/ rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 wget --tries=3 --retry-connrefused https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz - tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $(id -u) --group $(id -g) --no-same-owner - cd protobuf-3.3.0/ - else - export LD_LIBRARY_PATH=/usr/local/lib #protoc needs to know where toclook for shared libs - rm -rf /tmp/protobuf - git clone --depth=1 --branch=v3.3.0 https://github.com/protocolbuffers/protobuf.git /tmp/protobuf - cd /tmp/protobuf - git submodule update --init --recursive - ./autogen.sh - fi + tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner "$USER" --group "$(groups | cut -d" " -f1)" --no-same-owner + cd protobuf-3.3.0/ || exit ./configure echo "Compiling protobuf" make -j"$(nproc)" @@ -339,6 +331,10 @@ check_install_ubuntu_packages() { $SUDO apt install -y software-properties-common case "$(get_distribution_release)" in "ubuntu20.04") + specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev" + LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" + LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" + ;; "ubuntu21.04") specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev" LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 531c1bbf4b..1b0eefd078 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -87,9 +87,7 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "executables/softmodem-common.h" #include "executables/thread-common.h" -#if defined(ITTI_SIM) || defined(RFSIM_NAS) #include "nr_nas_msg_sim.h" -#endif extern const char *duplex_mode[]; THREAD_STRUCT thread_struct; @@ -193,12 +191,10 @@ int create_tasks_nrue(uint32_t ue_nb) { LOG_E(NR_RRC, "Create task for RRC UE failed\n"); return -1; } -#if defined(ITTI_SIM) || defined(RFSIM_NAS) if (itti_create_task (TASK_NAS_NRUE, nas_nrue_task, NULL) < 0) { LOG_E(NR_RRC, "Create task for NAS UE failed\n"); return -1; } -#endif } itti_wait_ready(0); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 12ac8ced47..a3f3b52fbe 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -83,11 +83,11 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ mu = nrUE_config->prach_config.prach_sub_c_spacing; restricted_set = prach_pdu->restricted_set; rootSequenceIndex = prach_pdu->root_seq_id; + fd_occasion = 0; n_ra_prb = nrUE_config->prach_config.num_prach_fd_occasions_list[fd_occasion].k1,//prach_pdu->freq_msg1; NCS = prach_pdu->num_cs; prach_fmt_id = prach_pdu->prach_format; preamble_index = prach_resources->ra_PreambleIndex; - fd_occasion = 0; prach_len = 0; dftlen = 0; first_nonzero_root_idx = 0; diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index bf0a7bc9e5..63d57cae66 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -1071,6 +1071,7 @@ typedef struct { #endif int dl_stats[5]; + void * uicc; } PHY_VARS_NR_UE; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index bfd8d8faa4..aa9c0190e7 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -69,9 +69,7 @@ #include "SIMULATION/TOOLS/sim.h" // for taus #include -#if defined(ITTI_SIM) || defined(RFSIM_NAS) #include "nr_nas_msg_sim.h" -#endif NR_UE_RRC_INST_t *NR_UE_rrc_inst; /* NAS Attach request with IMSI */ @@ -1349,14 +1347,21 @@ static void rrc_ue_generate_RRCSetupComplete( AssertFatal(1==0,"2 > csi_MeasConfig is not null\n"); if (AMF_MODE_ENABLED) { -#if defined(ITTI_SIM) || defined(RFSIM_NAS) +#if defined(ITTI_SIM) as_nas_info_t initialNasMsg; - generateRegistrationRequest(&initialNasMsg); + generateRegistrationRequest(&initialNasMsg, ctxt_pP->module_id); nas_msg = (char*)initialNasMsg.data; nas_msg_length = initialNasMsg.length; #else - nas_msg = (char *) NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data; - nas_msg_length = NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length; + if (get_softmodem_params()->sa) { + as_nas_info_t initialNasMsg; + generateRegistrationRequest(&initialNasMsg, ctxt_pP->module_id); + nas_msg = (char*)initialNasMsg.data; + nas_msg_length = initialNasMsg.length; + } else { + nas_msg = (char *) NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data; + nas_msg_length = NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length; + } #endif } else { nas_msg = nr_nas_attach_req_imsi; diff --git a/openair3/NAS/COMMON/IES/FGSMobileIdentity.c b/openair3/NAS/COMMON/IES/FGSMobileIdentity.c index e3204b4c0c..5f920105f9 100644 --- a/openair3/NAS/COMMON/IES/FGSMobileIdentity.c +++ b/openair3/NAS/COMMON/IES/FGSMobileIdentity.c @@ -194,23 +194,23 @@ static int encode_guti_5gs_mobile_identity(Guti5GSMobileIdentity_t *guti, uint8_ static int encode_suci_5gs_mobile_identity(Suci5GSMobileIdentity_t *suci, uint8_t *buffer) { uint32_t encoded = 0; - *(buffer + encoded) = 0x00 | (suci->supiformat << 4) | (suci->typeofidentity); + *(buffer + encoded) = (suci->supiformat << 4) | (suci->typeofidentity); encoded++; - *(buffer + encoded) = 0x00 | ((suci->mccdigit2 & 0xf) << 4) | + *(buffer + encoded) = ((suci->mccdigit2 & 0xf) << 4) | (suci->mccdigit1 & 0xf); encoded++; - *(buffer + encoded) = 0x00 | ((suci->mncdigit3 & 0xf) << 4) | + *(buffer + encoded) = ((suci->mncdigit3 & 0xf) << 4) | (suci->mccdigit3 & 0xf); encoded++; - *(buffer + encoded) = 0x00 | ((suci->mncdigit2 & 0xf) << 4) | + *(buffer + encoded) = ((suci->mncdigit2 & 0xf) << 4) | (suci->mncdigit1 & 0xf); encoded++; - *(buffer + encoded) = 0x00 | ((suci->routingindicatordigit2 & 0xf) << 4) | + *(buffer + encoded) = ((suci->routingindicatordigit2 & 0xf) << 4) | (suci->routingindicatordigit1 & 0xf); encoded++; - *(buffer + encoded) = 0x00 | ((suci->routingindicatordigit4 & 0xf) << 4) | + *(buffer + encoded) = ((suci->routingindicatordigit4 & 0xf) << 4) | (suci->routingindicatordigit3 & 0xf); encoded++; @@ -220,8 +220,15 @@ static int encode_suci_5gs_mobile_identity(Suci5GSMobileIdentity_t *suci, uint8_ *(buffer + encoded) = suci->homenetworkpki; encoded++; - IES_ENCODE_U32(buffer, encoded, suci->schemeoutput); + char *ptr=suci->schemeoutput; + while ( ptr < suci->schemeoutput+strlen(suci->schemeoutput) ) { + buffer[encoded]=((*(ptr+1)-'0')<<4) | (*(ptr) -'0'); + encoded++; + ptr+=2; + } + if (strlen(suci->schemeoutput)%2 == 1) + buffer[encoded++]=((*(ptr-1)-'0')) | 0xF0; return encoded; } diff --git a/openair3/NAS/COMMON/IES/FGSMobileIdentity.h b/openair3/NAS/COMMON/IES/FGSMobileIdentity.h index a673a86dd1..7968bc3300 100644 --- a/openair3/NAS/COMMON/IES/FGSMobileIdentity.h +++ b/openair3/NAS/COMMON/IES/FGSMobileIdentity.h @@ -64,7 +64,7 @@ typedef struct { uint8_t spare6:1; uint8_t protectionschemeId:4; uint8_t homenetworkpki; - uint32_t schemeoutput; + char schemeoutput[32]; } Suci5GSMobileIdentity_t; typedef struct { diff --git a/openair3/NAS/COMMON/NR_NAS_defs.h b/openair3/NAS/COMMON/NR_NAS_defs.h index 906c0cf504..54ac8c037e 100644 --- a/openair3/NAS/COMMON/NR_NAS_defs.h +++ b/openair3/NAS/COMMON/NR_NAS_defs.h @@ -387,5 +387,6 @@ void processNAS(void *msg, NRUEcontext_t *UE); int identityRequest(void **msg, NRUEcontext_t *UE); int authenticationRequest(void **msg, NRUEcontext_t *UE); int securityModeCommand(void **msg, NRUEcontext_t *UE); +void servingNetworkName(uint8_t *msg, char * imsiStr, int nmc_size); #endif diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index dce5d45c69..2ea39a78f0 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -40,25 +40,30 @@ #include "PduSessionEstablishRequest.h" #include "intertask_interface.h" #include "openair2/RRC/NAS/nas_config.h" - -/*char netName[] = "5G:mnc093.mcc208.3gppnetwork.org"; -char imsi[] = "2089300007487"; -// USIM_API_K: 5122250214c33e723a5dd523fc145fc0 -uint8_t k[16] = {0x51, 0x22, 0x25, 0x02, 0x14,0xc3, 0x3e, 0x72, 0x3a, 0x5d, 0xd5, 0x23, 0xfc, 0x14, 0x5f, 0xc0}; -// OPC: 981d464c7c52eb6e5036234984ad0bcf -const uint8_t opc[16] = {0x98, 0x1d, 0x46, 0x4c,0x7c,0x52,0xeb, 0x6e, 0x50, 0x36, 0x23, 0x49, 0x84, 0xad, 0x0b, 0xcf};*/ +#include +#include +#include -char netName[] = "5G:mnc099.mcc208.3gppnetwork.org"; -char imsi[] = "2089900007487"; //"208990100001100"; +//char netName[] = "5G:mnc099.mcc208.3gppnetwork.org"; +//char imsi[] = "2089900007487"; //"208990100001100"; // USIM_API_K: fe c8 6b a6 eb 70 7e d0 89 05 75 7b 1b b4 4b 8f -uint8_t k[16] = {0xfe, 0xc8, 0x6b, 0xa6, 0xeb, 0x70, 0x7e, 0xd0, 0x89, 0x05, 0x75, 0x7b, 0x1b, 0xb4, 0x4b, 0x8f}; +//uint8_t k[16] = {0xfe, 0xc8, 0x6b, 0xa6, 0xeb, 0x70, 0x7e, 0xd0, 0x89, 0x05, 0x75, 0x7b, 0x1b, 0xb4, 0x4b, 0x8f}; // OPC: c4 24 49 36 3b ba d0 2b 66 d1 6b c9 75 d7 7c c1 -const uint8_t opc[16] = {0xc4, 0x24, 0x49, 0x36, 0x3b, 0xba, 0xd0, 0x2b, 0x66, 0xd1, 0x6b, 0xc9, 0x75, 0xd7, 0x7c, 0xc1}; +//const uint8_t opc[16] = {0xc4, 0x24, 0x49, 0x36, 0x3b, 0xba, 0xd0, 0x2b, 0x66, 0xd1, 0x6b, 0xc9, 0x75, 0xd7, 0x7c, 0xc1}; uint8_t *registration_request_buf; uint32_t registration_request_len; -extern char *baseNetAddress; +extern char *baseNetAddress; + +static uicc_t * checkUicc(int Mod_id) { + if (!PHY_vars_UE_g[Mod_id][0]->uicc) { + char uiccName[64]; + sprintf(uiccName,"uicc%d", Mod_id); + PHY_vars_UE_g[Mod_id][0]->uicc=(void*)init_uicc(uiccName); + } + return (uicc_t*) PHY_vars_UE_g[Mod_id][0]->uicc; +} static int nas_protected_security_header_encode( char *buffer, @@ -163,11 +168,11 @@ int mm_msg_encode(MM_msg *mm_msg, uint8_t *buffer, uint32_t len) { LOG_FUNC_RETURN (header_result + encode_result); } -void transferRES(uint8_t ck[16], uint8_t ik[16], uint8_t *input, uint8_t rand[16], uint8_t *output) { - uint8_t S[100]; +void transferRES(uint8_t ck[16], uint8_t ik[16], uint8_t *input, uint8_t rand[16], uint8_t *output, uicc_t* uicc) { + uint8_t S[100]={0}; S[0] = 0x6B; - int netNamesize = strlen(netName); - memcpy(&S[1], netName, netNamesize); + servingNetworkName (S+1, uicc->imsiStr, uicc->nmc_size); + int netNamesize = strlen((char*)S+1); S[1 + netNamesize] = (netNamesize & 0xff00) >> 8; S[2 + netNamesize] = (netNamesize & 0x00ff); for (int i = 0; i < 16; i++) @@ -204,14 +209,15 @@ void transferRES(uint8_t ck[16], uint8_t ik[16], uint8_t *input, uint8_t rand[16 output[i] = out[16 + i]; } -void derive_kausf(uint8_t ck[16], uint8_t ik[16], uint8_t sqn[6], uint8_t kausf[32]) { - uint8_t S[100]; +void derive_kausf(uint8_t ck[16], uint8_t ik[16], uint8_t sqn[6], uint8_t kausf[32], uicc_t *uicc) { + uint8_t S[100]={0}; uint8_t key[32]; - int netNamesize = strlen(netName); + memcpy(&key[0], ck, 16); memcpy(&key[16], ik, 16); //KEY S[0] = 0x6A; - memcpy(&S[1], netName, netNamesize); + servingNetworkName (S+1, uicc->imsiStr, uicc->nmc_size); + int netNamesize = strlen((char*)S+1); S[1 + netNamesize] = (uint8_t)((netNamesize & 0xff00) >> 8); S[2 + netNamesize] = (uint8_t)(netNamesize & 0x00ff); for (int i = 0; i < 6; i++) { @@ -222,21 +228,21 @@ void derive_kausf(uint8_t ck[16], uint8_t ik[16], uint8_t sqn[6], uint8_t kausf[ kdf(key, 32, S, 11 + netNamesize, kausf, 32); } -void derive_kseaf(uint8_t kausf[32], uint8_t kseaf[32]) { - uint8_t S[100]; - int netNamesize = strlen(netName); +void derive_kseaf(uint8_t kausf[32], uint8_t kseaf[32], uicc_t *uicc) { + uint8_t S[100]={0}; S[0] = 0x6C; //FC - memcpy(&S[1], netName, netNamesize); + servingNetworkName (S+1, uicc->imsiStr, uicc->nmc_size); + int netNamesize = strlen((char*)S+1); S[1 + netNamesize] = (uint8_t)((netNamesize & 0xff00) >> 8); S[2 + netNamesize] = (uint8_t)(netNamesize & 0x00ff); kdf(kausf, 32, S, 3 + netNamesize, kseaf, 32); } -void derive_kamf(uint8_t *kseaf, uint8_t *kamf, uint16_t abba) { - int imsiLen = strlen(imsi); +void derive_kamf(uint8_t *kseaf, uint8_t *kamf, uint16_t abba, uicc_t* uicc) { + int imsiLen = strlen(uicc->imsiStr); uint8_t S[100]; S[0] = 0x6D; //FC = 0x6D - memcpy(&S[1], imsi, imsiLen); + memcpy(&S[1], uicc->imsiStr, imsiLen ); S[1 + imsiLen] = (uint8_t)((imsiLen & 0xff00) >> 8); S[2 + imsiLen] = (uint8_t)(imsiLen & 0x00ff); S[3 + imsiLen] = abba & 0x00ff; @@ -262,11 +268,11 @@ void derive_knas(algorithm_type_dist_t nas_alg_type, uint8_t nas_alg_id, uint8_t knas_int[i] = out[16 + i]; } -void generateRegistrationRequest(as_nas_info_t *initialNasMsg) { +void generateRegistrationRequest(as_nas_info_t *initialNasMsg, int Mod_id) { int size = sizeof(mm_msg_header_t); - fgs_nas_message_t nas_msg; - memset(&nas_msg, 0, sizeof(fgs_nas_message_t)); + fgs_nas_message_t nas_msg={0}; MM_msg *mm_msg; + uicc_t * uicc=checkUicc(Mod_id); mm_msg = &nas_msg.plain.mm_msg; // set header @@ -291,26 +297,31 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) { mm_msg->registration_request.fgsmobileidentity.guti.amfpointer = 0; mm_msg->registration_request.fgsmobileidentity.guti.amfsetid = 1016; mm_msg->registration_request.fgsmobileidentity.guti.tmsi = 10; - mm_msg->registration_request.fgsmobileidentity.guti.mncdigit1 = 9; - mm_msg->registration_request.fgsmobileidentity.guti.mncdigit2 = 9; - mm_msg->registration_request.fgsmobileidentity.guti.mncdigit3 = 0xf; - mm_msg->registration_request.fgsmobileidentity.guti.mccdigit1 = 2; - mm_msg->registration_request.fgsmobileidentity.guti.mccdigit2 = 0; - mm_msg->registration_request.fgsmobileidentity.guti.mccdigit3 = 8; + mm_msg->registration_request.fgsmobileidentity.guti.mncdigit1 = + uicc->nmc_size==2 ? uicc->imsiStr[3]-'0' : uicc->imsiStr[4]-'0'; + mm_msg->registration_request.fgsmobileidentity.guti.mncdigit2 = + uicc->nmc_size==2 ? uicc->imsiStr[4]-'0' : uicc->imsiStr[5]-'0'; + mm_msg->registration_request.fgsmobileidentity.guti.mncdigit3 = + uicc->nmc_size==2 ? 0xf : uicc->imsiStr[3]-'0'; + mm_msg->registration_request.fgsmobileidentity.guti.mccdigit1 = uicc->imsiStr[0]-'0'; + mm_msg->registration_request.fgsmobileidentity.guti.mccdigit2 = uicc->imsiStr[1]-'0'; + mm_msg->registration_request.fgsmobileidentity.guti.mccdigit3 = uicc->imsiStr[2]-'0'; size += 13; } else { mm_msg->registration_request.fgsmobileidentity.suci.typeofidentity = FGS_MOBILE_IDENTITY_SUCI; - mm_msg->registration_request.fgsmobileidentity.suci.mncdigit1 = 9; - mm_msg->registration_request.fgsmobileidentity.suci.mncdigit2 = 9; - mm_msg->registration_request.fgsmobileidentity.suci.mncdigit3 = 0xf; - mm_msg->registration_request.fgsmobileidentity.suci.mccdigit1 = 2; - mm_msg->registration_request.fgsmobileidentity.suci.mccdigit2 = 0; - mm_msg->registration_request.fgsmobileidentity.suci.mccdigit3 = 8; - mm_msg->registration_request.fgsmobileidentity.suci.schemeoutput = 0x4778; - - size += 14; + mm_msg->registration_request.fgsmobileidentity.suci.mncdigit1 = + uicc->nmc_size==2 ? uicc->imsiStr[3]-'0' : uicc->imsiStr[4]-'0'; + mm_msg->registration_request.fgsmobileidentity.suci.mncdigit2 = + uicc->nmc_size==2 ? uicc->imsiStr[4]-'0' : uicc->imsiStr[5]-'0'; + mm_msg->registration_request.fgsmobileidentity.suci.mncdigit3 = + uicc->nmc_size==2 ? 0xf : uicc->imsiStr[3]-'0'; + mm_msg->registration_request.fgsmobileidentity.suci.mccdigit1 = uicc->imsiStr[0]-'0'; + mm_msg->registration_request.fgsmobileidentity.suci.mccdigit2 = uicc->imsiStr[1]-'0'; + mm_msg->registration_request.fgsmobileidentity.suci.mccdigit3 = uicc->imsiStr[2]-'0'; + memcpy(mm_msg->registration_request.fgsmobileidentity.suci.schemeoutput, uicc->imsiStr+3+uicc->nmc_size, strlen(uicc->imsiStr) - (3+uicc->nmc_size)); + size += sizeof(Suci5GSMobileIdentity_t); } mm_msg->registration_request.presencemask |= REGISTRATION_REQUEST_5GMM_CAPABILITY_PRESENT; @@ -337,7 +348,7 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) { } -void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype) { +void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype, uicc_t* uicc) { int size = sizeof(mm_msg_header_t); fgs_nas_message_t nas_msg; memset(&nas_msg, 0, sizeof(fgs_nas_message_t)); @@ -359,15 +370,17 @@ void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype size += 1; if(identitytype == FGS_MOBILE_IDENTITY_SUCI){ mm_msg->fgs_identity_response.fgsmobileidentity.suci.typeofidentity = FGS_MOBILE_IDENTITY_SUCI; - mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit1 = 9; - mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit2 = 9; - mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit3 = 0xf; - mm_msg->fgs_identity_response.fgsmobileidentity.suci.mccdigit1 = 2; - mm_msg->fgs_identity_response.fgsmobileidentity.suci.mccdigit2 = 0; - mm_msg->fgs_identity_response.fgsmobileidentity.suci.mccdigit3 = 8; - mm_msg->fgs_identity_response.fgsmobileidentity.suci.schemeoutput = 0x4778; - - size += 14; + mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit1 = + uicc->nmc_size==2 ? uicc->imsiStr[3]-'0' : uicc->imsiStr[4]-'0'; + mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit2 = + uicc->nmc_size==2 ? uicc->imsiStr[4]-'0' : uicc->imsiStr[5]-'0'; + mm_msg->fgs_identity_response.fgsmobileidentity.suci.mncdigit3 = + uicc->nmc_size==2? 0xF : uicc->imsiStr[3]-'0'; + mm_msg->fgs_identity_response.fgsmobileidentity.suci.mccdigit1 = uicc->imsiStr[0]-'0'; + mm_msg->fgs_identity_response.fgsmobileidentity.suci.mccdigit2 = uicc->imsiStr[1]-'0'; + mm_msg->fgs_identity_response.fgsmobileidentity.suci.mccdigit3 = uicc->imsiStr[2]-'0'; + memcpy(mm_msg->registration_request.fgsmobileidentity.suci.schemeoutput, uicc->imsiStr+3+uicc->nmc_size, strlen(uicc->imsiStr) - (3+uicc->nmc_size)); + size += sizeof(Suci5GSMobileIdentity_t); } // encode the message @@ -378,7 +391,7 @@ void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype } OctetString knas_int; -void generateAuthenticationResp(as_nas_info_t *initialNasMsg, uint8_t *buf){ +static void generateAuthenticationResp(as_nas_info_t *initialNasMsg, uint8_t *buf, uicc_t *uicc){ uint8_t ak[6]; @@ -396,9 +409,9 @@ void generateAuthenticationResp(as_nas_info_t *initialNasMsg, uint8_t *buf){ uint8_t resTemp[16]; uint8_t ck[16], ik[16], output[16]; - f2345(k, rand, resTemp, ck, ik, ak, opc); + f2345(uicc->key, rand, resTemp, ck, ik, ak, uicc->opc); - transferRES(ck, ik, resTemp, rand, output); + transferRES(ck, ik, resTemp, rand, output, uicc); // get knas_int knas_int.length = 16; @@ -407,9 +420,9 @@ void generateAuthenticationResp(as_nas_info_t *initialNasMsg, uint8_t *buf){ sqn[index] = buf[26+index]; } - derive_kausf(ck, ik, sqn, kausf); - derive_kseaf(kausf, kseaf); - derive_kamf(kseaf, kamf, 0x0000); + derive_kausf(ck, ik, sqn, kausf, uicc); + derive_kseaf(kausf, kseaf, uicc); + derive_kamf(kseaf, kamf, 0x0000, uicc); derive_knas(0x02, 2, kamf, knas_int.value); printf("kausf:"); @@ -703,6 +716,7 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){ } } + void *nas_nrue_task(void *args_p) { MessageDef *msg_p; @@ -722,6 +736,8 @@ void *nas_nrue_task(void *args_p) if (msg_p != NULL) { instance = msg_p->ittiMsgHeader.originInstance; Mod_id = instance ; + uicc_t *uicc=checkUicc(Mod_id); + if (instance == INSTANCE_DEFAULT) { printf("%s:%d: FATAL: instance is INSTANCE_DEFAULT, should not happen.\n", __FILE__, __LINE__); @@ -869,10 +885,10 @@ void *nas_nrue_task(void *args_p) switch(msg_type){ case FGS_IDENTITY_REQUEST: - generateIdentityResponse(&initialNasMsg,*(pdu_buffer+3)); + generateIdentityResponse(&initialNasMsg,*(pdu_buffer+3), uicc); break; case FGS_AUTHENTICATION_REQUEST: - generateAuthenticationResp(&initialNasMsg, pdu_buffer); + generateAuthenticationResp(&initialNasMsg, pdu_buffer, uicc); break; case FGS_SECURITY_MODE_COMMAND: generateSecurityModeComplete(&initialNasMsg); diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.h b/openair3/NAS/NR_UE/nr_nas_msg_sim.h index f80f8df61b..f730b20a55 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.h +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.h @@ -115,9 +115,7 @@ typedef union { fgs_nas_message_plain_t plain; } fgs_nas_message_t; -void generateRegistrationRequest(as_nas_info_t *initialNasMsg); -void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype); -void generateAuthenticationResp(as_nas_info_t *initialNasMsg, uint8_t *buf); +void generateRegistrationRequest(as_nas_info_t *initialNasMsg, int Mod_id); void generateSecurityModeComplete(as_nas_info_t *initialNasMsg); void generateRegistrationComplete(as_nas_info_t *initialNasMsg, SORTransparentContainer *sortransparentcontainer); void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg); diff --git a/openair3/UICC/usim_interface.c b/openair3/UICC/usim_interface.c index 15a4e2e540..059802269f 100644 --- a/openair3/UICC/usim_interface.c +++ b/openair3/UICC/usim_interface.c @@ -20,6 +20,7 @@ * For more information about the OpenAirInterface (OAI) Software Alliance: * contact@openairinterface.org */ +#include #include #include @@ -34,10 +35,10 @@ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define UICC_PARAMS_DESC {\ - {"imsi", "USIM IMSI\n", 0, strptr:&(uicc->imsiStr), defstrval:"", TYPE_STRING, 0 },\ + {"imsi", "USIM IMSI\n", 0, strptr:&(uicc->imsiStr), defstrval:"2089900007487", TYPE_STRING, 0 },\ {"nmc_size" "number of digits in NMC", 0, iptr:&(uicc->nmc_size), defintval:2, TYPE_INT, 0 },\ - {"key", "USIM Ki\n", 0, strptr:&(uicc->keyStr), defstrval:"", TYPE_STRING, 0 },\ - {"opc", "USIM OPc\n", 0, strptr:&(uicc->opcStr), defstrval:"", TYPE_STRING, 0 },\ + {"key", "USIM Ki\n", 0, strptr:&(uicc->keyStr), defstrval:"fec86ba6eb707ed08905757b1bb44b8f", TYPE_STRING, 0 },\ + {"opc", "USIM OPc\n", 0, strptr:&(uicc->opcStr), defstrval:"c42449363bbad02b66d16bc975d77cc1", TYPE_STRING, 0 },\ {"amf", "USIM amf\n", 0, strptr:&(uicc->amfStr), defstrval:"8000", TYPE_STRING, 0 },\ {"sqn", "USIM sqn\n", 0, strptr:&(uicc->sqnStr), defstrval:"000000", TYPE_STRING, 0 },\ }; @@ -45,7 +46,7 @@ const char *hexTable="0123456789abcdef"; static inline uint8_t mkDigit(unsigned char in) { for (int i=0; i<16; i++) - if (in==hexTable[i]) + if (tolower(in)==hexTable[i]) return i; LOG_E(SIM,"Impossible hexa input: %c\n",in); return 0; @@ -65,7 +66,7 @@ uicc_t *init_uicc(char *sectionName) { // we can read the IMSI from the USIM // key, OPc, sqn, amf don't need to be read from the true USIM int ret = config_get( uicc_params,sizeof(uicc_params)/sizeof(paramdef_t),sectionName); - AssertFatal(ret >= 0, "configuration couldn't be performed"); + AssertFatal(ret >= 0, "configuration couldn't be performed for uicc name: %s", sectionName); LOG_I(SIM, "UICC simulation: IMSI=%s, Ki=%s, OPc=%s\n", uicc->imsiStr, uicc->keyStr, uicc->opcStr); to_hex(uicc->keyStr,uicc->key, sizeof(uicc->key) ); to_hex(uicc->opcStr,uicc->opc, sizeof(uicc->opc) ); From 015ba5f076453ad07fa7323f6ce264ba4f7982a1 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 16 Jun 2021 10:41:45 +0200 Subject: [PATCH 054/135] fix arry size bug --- cmake_targets/install_external_packages.ubuntu20 | 16 ++++++---------- common/utils/utils.h | 1 + openair1/PHY/NR_UE_TRANSPORT/nr_prach.c | 2 +- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 4 ++-- openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h | 2 +- openair3/SCTP/sctp_eNB_task.c | 9 ++++++++- openair3/ocp-gtpu/gtp_itf.cpp | 7 +++++-- 7 files changed, 24 insertions(+), 17 deletions(-) diff --git a/cmake_targets/install_external_packages.ubuntu20 b/cmake_targets/install_external_packages.ubuntu20 index 4b1cda42f8..95293198b9 100755 --- a/cmake_targets/install_external_packages.ubuntu20 +++ b/cmake_targets/install_external_packages.ubuntu20 @@ -159,16 +159,8 @@ install_protobuf_from_source(){ #cd protobuf-2.6.1/ rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 wget --tries=3 --retry-connrefused https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz - tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $(id -u) --group $(id -g) --no-same-owner - cd protobuf-3.3.0/ - else - export LD_LIBRARY_PATH=/usr/local/lib #protoc needs to know where toclook for shared libs - rm -rf /tmp/protobuf - git clone --depth=1 --branch=v3.3.0 https://github.com/protocolbuffers/protobuf.git /tmp/protobuf - cd /tmp/protobuf - git submodule update --init --recursive - ./autogen.sh - fi + tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner "$USER" --group "$(groups | cut -d" " -f1)" --no-same-owner + cd protobuf-3.3.0/ || exit ./configure echo "Compiling protobuf" make -j"$(nproc)" @@ -339,6 +331,10 @@ check_install_ubuntu_packages() { $SUDO apt install -y software-properties-common case "$(get_distribution_release)" in "ubuntu20.04") + specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev" + LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" + LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" + ;; "ubuntu21.04") specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev" LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" diff --git a/common/utils/utils.h b/common/utils/utils.h index da7c453b03..16631586c4 100644 --- a/common/utils/utils.h +++ b/common/utils/utils.h @@ -7,6 +7,7 @@ extern "C" { #endif +#define sizeofArray(a) (sizeof(a)/sizeof(*(a))) void *calloc_or_fail(size_t size); void *malloc_or_fail(size_t size); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 12ac8ced47..a3f3b52fbe 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -83,11 +83,11 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ mu = nrUE_config->prach_config.prach_sub_c_spacing; restricted_set = prach_pdu->restricted_set; rootSequenceIndex = prach_pdu->root_seq_id; + fd_occasion = 0; n_ra_prb = nrUE_config->prach_config.num_prach_fd_occasions_list[fd_occasion].k1,//prach_pdu->freq_msg1; NCS = prach_pdu->num_cs; prach_fmt_id = prach_pdu->prach_format; preamble_index = prach_resources->ra_PreambleIndex; - fd_occasion = 0; prach_len = 0; dftlen = 0; first_nonzero_root_idx = 0; diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index acf3f87117..c9d7cf7696 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -549,7 +549,7 @@ static void deliver_sdu_srb(void *_ue, nr_pdcp_entity_t *entity, int srb_id; int i; - for (i = 0; i < 3; i++) { + for (i = 0; i < sizeofArray(ue->srb) ; i++) { if (entity == ue->srb[i]) { srb_id = i+1; goto srb_found; @@ -592,7 +592,7 @@ static void deliver_pdu_srb(void *_ue, nr_pdcp_entity_t *entity, int i; mem_block_t *memblock; - for (i = 0; i < 3; i++) { + for (i = 0; i < sizeofArray(ue->srb) ; i++) { if (entity == ue->srb[i]) { srb_id = i+1; goto srb_found; diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h index 3329f856b7..742e0e84be 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h @@ -28,7 +28,7 @@ typedef void nr_pdcp_ue_manager_t; typedef struct nr_pdcp_ue_t { int rnti; - nr_pdcp_entity_t *srb[2]; + nr_pdcp_entity_t *srb[3]; nr_pdcp_entity_t *drb[5]; } nr_pdcp_ue_t; diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index af49c5c350..045c4e2c16 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -1026,7 +1026,14 @@ sctp_eNB_read_from_socket( break; default: - SCTP_WARN("unhandled: SCTP_ASSOC_CHANGE to %d\n", sctp_assoc_changed->sac_state); + if ( sctp_assoc_changed->sac_state == SCTP_SHUTDOWN_COMP) + SCTP_WARN("SCTP_ASSOC_CHANGE to SSCTP_SHUTDOWN_COMP\n"); + if ( sctp_assoc_changed->sac_state == SCTP_RESTART) + SCTP_WARN("SCTP_ASSOC_CHANGE to SCTP_RESTART\n"); + if ( sctp_assoc_changed->sac_state == SCTP_CANT_STR_ASSOC) + SCTP_ERROR("SCTP_ASSOC_CHANGE to SCTP_CANT_STR_ASSOC\n"); + if ( sctp_assoc_changed->sac_state == SCTP_COMM_LOST) + SCTP_ERROR("SCTP_ASSOC_CHANGE to SCTP_COMM_LOST\n"); break; } } diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index b371c5c0d6..ee95787b06 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -277,12 +277,15 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r to.sin_family = AF_INET; to.sin_port = htons(tmp.outgoing_port); to.sin_addr.s_addr = tmp.outgoing_ip_addr; + + char ip4[INET_ADDRSTRLEN]; + //char ip6[INET6_ADDRSTRLEN]; LOG_D(GTPU,"sending end packet to %s\n", inet_ntoa(to.sin_addr) ); if (sendto(compatInst(instance), (void *)&msgHdr, sizeof(msgHdr), 0,(struct sockaddr *)&to, sizeof(to) ) != sizeof(msgHdr)) { LOG_E(GTPU, - "[SD %ld] Failed to send data to " IPV4_ADDR " on port %d, buffer size %lu\n", - compatInst(instance), IPV4_ADDR_FORMAT(tmp.outgoing_ip_addr), tmp.outgoing_port, sizeof(msgHdr)); + "[SD %ld] Failed to send data to %s on port %d, buffer size %lu\n", + compatInst(instance), inet_ntop(AF_INET, &tmp.outgoing_ip_addr, ip4, INET_ADDRSTRLEN), tmp.outgoing_port, sizeof(msgHdr)); } } From c224ca8f6cec3d2751a710a9d02238696ff0ec87 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 16 Jun 2021 10:43:57 +0200 Subject: [PATCH 055/135] fix srb error --- common/utils/utils.h | 1 + openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 4 ++-- openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h | 2 +- openair3/ocp-gtpu/gtp_itf.cpp | 19 +++++++++++++++---- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/common/utils/utils.h b/common/utils/utils.h index da7c453b03..16631586c4 100644 --- a/common/utils/utils.h +++ b/common/utils/utils.h @@ -7,6 +7,7 @@ extern "C" { #endif +#define sizeofArray(a) (sizeof(a)/sizeof(*(a))) void *calloc_or_fail(size_t size); void *malloc_or_fail(size_t size); diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index acf3f87117..c9d7cf7696 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -549,7 +549,7 @@ static void deliver_sdu_srb(void *_ue, nr_pdcp_entity_t *entity, int srb_id; int i; - for (i = 0; i < 3; i++) { + for (i = 0; i < sizeofArray(ue->srb) ; i++) { if (entity == ue->srb[i]) { srb_id = i+1; goto srb_found; @@ -592,7 +592,7 @@ static void deliver_pdu_srb(void *_ue, nr_pdcp_entity_t *entity, int i; mem_block_t *memblock; - for (i = 0; i < 3; i++) { + for (i = 0; i < sizeofArray(ue->srb) ; i++) { if (entity == ue->srb[i]) { srb_id = i+1; goto srb_found; diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h index 3329f856b7..742e0e84be 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h @@ -28,7 +28,7 @@ typedef void nr_pdcp_ue_manager_t; typedef struct nr_pdcp_ue_t { int rnti; - nr_pdcp_entity_t *srb[2]; + nr_pdcp_entity_t *srb[3]; nr_pdcp_entity_t *drb[5]; } nr_pdcp_ue_t; diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index b371c5c0d6..6d563f6387 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -277,12 +277,18 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r to.sin_family = AF_INET; to.sin_port = htons(tmp.outgoing_port); to.sin_addr.s_addr = tmp.outgoing_ip_addr; + + char ip4[INET_ADDRSTRLEN]; + char ip6[INET6_ADDRSTRLEN]; LOG_D(GTPU,"sending end packet to %s\n", inet_ntoa(to.sin_addr) ); if (sendto(compatInst(instance), (void *)&msgHdr, sizeof(msgHdr), 0,(struct sockaddr *)&to, sizeof(to) ) != sizeof(msgHdr)) { + char ip4[INET_ADDRSTRLEN]; + char ip6[INET6_ADDRSTRLEN]; + LOG_E(GTPU, - "[SD %ld] Failed to send data to " IPV4_ADDR " on port %d, buffer size %lu\n", - compatInst(instance), IPV4_ADDR_FORMAT(tmp.outgoing_ip_addr), tmp.outgoing_port, sizeof(msgHdr)); + "[SD %ld] Failed to send data to %s on port %d, buffer size %lu\n", + compatInst(instance), inet_ntop(AF_INET, &tmp.outgoing_ip_addr, ip4, INET_ADDRSTRLEN), tmp.outgoing_port, sizeof(msgHdr)); } } @@ -438,10 +444,15 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int bearer_id, teid tmp->outgoing_port=port; tmp->teid_outgoing= outgoing_teid; pthread_mutex_unlock(&globGtp.gtp_lock); - LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %d, teid for UL %d\n", + char ip4[INET_ADDRSTRLEN]; + char ip6[INET6_ADDRSTRLEN]; + + LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %d, teid for UL %d to remote IPv4: %s, IPv6 %s\n", rnti, tmp->teid_incoming, - tmp->teid_outgoing); + tmp->teid_outgoing, + inet_ntop(AF_INET,(void*)&tmp->outgoing_ip_addr, ip4,INET_ADDRSTRLEN ), + inet_ntop(AF_INET6,(void*)&tmp->outgoing_ip6_addr.s6_addr, ip6, INET6_ADDRSTRLEN)); return incoming_teid; } From 3a662d95f53a4f3d53b26d14c9b74a3a3d974183 Mon Sep 17 00:00:00 2001 From: Masayuki Harada Date: Mon, 21 Jun 2021 18:52:05 +0900 Subject: [PATCH 056/135] Move memory for USIM information to UICC. --- openair3/NAS/NR_UE/nr_nas_msg_sim.c | 8 -------- openair3/UICC/usim_interface.c | 15 +++++++++++++++ openair3/UICC/usim_interface.h | 1 + 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index 2ea39a78f0..08fe4a3840 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -56,14 +56,6 @@ uint8_t *registration_request_buf; uint32_t registration_request_len; extern char *baseNetAddress; -static uicc_t * checkUicc(int Mod_id) { - if (!PHY_vars_UE_g[Mod_id][0]->uicc) { - char uiccName[64]; - sprintf(uiccName,"uicc%d", Mod_id); - PHY_vars_UE_g[Mod_id][0]->uicc=(void*)init_uicc(uiccName); - } - return (uicc_t*) PHY_vars_UE_g[Mod_id][0]->uicc; -} static int nas_protected_security_header_encode( char *buffer, diff --git a/openair3/UICC/usim_interface.c b/openair3/UICC/usim_interface.c index 059802269f..0973d75082 100644 --- a/openair3/UICC/usim_interface.c +++ b/openair3/UICC/usim_interface.c @@ -24,6 +24,7 @@ #include #include +extern uint16_t NB_UE_INST; #define UICC_SECTION "uicc" #define UICC_CONFIG_HELP_OPTIONS " list of comma separated options to interface a simulated (real UICC to be developped). Available options: \n"\ @@ -43,6 +44,8 @@ {"sqn", "USIM sqn\n", 0, strptr:&(uicc->sqnStr), defstrval:"000000", TYPE_STRING, 0 },\ }; +static uicc_t** uiccArray=NULL; + const char *hexTable="0123456789abcdef"; static inline uint8_t mkDigit(unsigned char in) { for (int i=0; i<16; i++) @@ -91,3 +94,15 @@ void uicc_milenage_generate(uint8_t *autn, uicc_t *uicc) { log_dump(SIM,autn,sizeof(autn), LOG_DUMP_CHAR,"milenage output autn:"); } +uicc_t * checkUicc(int Mod_id) { + AssertFatal(Mod_id < NB_UE_INST, "Mod_id must be less than NB_UE_INST. Mod_id:%d NB_UE_INST:%d", Mod_id,NB_UE_INST); + if(uiccArray==NULL){ + uiccArray=(uicc_t **)calloc(1,sizeof(uicc_t*)*NB_UE_INST); + } + if (!uiccArray[Mod_id]) { + char uiccName[64]; + sprintf(uiccName,"uicc%d", Mod_id); + uiccArray[Mod_id]=(void*)init_uicc(uiccName); + } + return (uicc_t*) uiccArray[Mod_id]; +} diff --git a/openair3/UICC/usim_interface.h b/openair3/UICC/usim_interface.h index e8f241c1e8..ee489fa875 100644 --- a/openair3/UICC/usim_interface.h +++ b/openair3/UICC/usim_interface.h @@ -68,4 +68,5 @@ typedef struct { */ uicc_t *init_uicc(char *sectionName); void uicc_milenage_generate(uint8_t * autn, uicc_t *uicc); +uicc_t * checkUicc(int Mod_id); #endif From a88c33b148255657bec3d66d7bb2dec8752ab3b8 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 21 Jun 2021 12:56:57 +0200 Subject: [PATCH 057/135] fix array overflow and wrong LCID --- openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c | 3 +++ openair2/COMMON/f1ap_messages_types.h | 2 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_du_rrc_message_transfer.h | 2 +- openair2/F1AP/f1ap_du_task.c | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 25 ++++++------------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 4 +++ openair2/RRC/LTE/rrc_eNB_GTPV1U.c | 2 +- openair2/RRC/NR/L2_nr_interface.c | 2 -- openair2/RRC/NR/MESSAGES/asn1_msg.c | 2 +- openair3/ocp-gtpu/gtp_itf.cpp | 9 +++++-- 11 files changed, 27 insertions(+), 28 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index e75a3225e5..e1b5e7d586 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -44,6 +44,7 @@ #include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/LOG/log.h" #include +#include //#define DEBUG_DLSCH_CODING //#define DEBUG_DLSCH_FREE 1 @@ -266,6 +267,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN); A = rel15->TBSize[0]<<3; + if ( dlsch->rnti != SI_RNTI ) + trace_NRpdu(DIRECTION_DOWNLINK, a, rel15->TBSize[0], 0, WS_C_RNTI, dlsch->rnti, frame, slot,0, 0); NR_gNB_SCH_STATS_t *stats=NULL; int first_free=-1; diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index ecfde8d38b..c2fb4a9cf7 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -299,7 +299,7 @@ typedef struct f1ap_initial_ul_rrc_message_s { uint16_t crnti; uint8_t *rrc_container; int rrc_container_length; - uint8_t *du2cu_rrc_container; + int8_t *du2cu_rrc_container; int du2cu_rrc_container_length; } f1ap_initial_ul_rrc_message_t; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 92ce430bca..00392c07a7 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -799,7 +799,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, rnti_t rntiP, const uint8_t *sduP, sdu_size_t sdu_lenP, - const uint8_t *sdu2P, + const int8_t *sdu2P, sdu_size_t sdu2_lenP) { F1AP_F1AP_PDU_t pdu; F1AP_InitialULRRCMessageTransfer_t *out; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index 0bb6371fe8..bb2bf020b8 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -50,7 +50,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, rnti_t rntiP, const uint8_t *sduP, sdu_size_t sdu_lenP, - const uint8_t *sdu2P, + const int8_t *sdu2P, sdu_size_t sdu2_lenP); #endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */ diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 726d5629f8..676aba54a2 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -190,7 +190,7 @@ void *F1AP_DU_task(void *arg) { DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,msg->crnti, msg->rrc_container, msg->rrc_container_length, - msg->du2cu_rrc_container, + (char*)msg->du2cu_rrc_container, msg->du2cu_rrc_container_length ); break; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 1ca5956ee5..2569559d29 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1012,7 +1012,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in //Give the first byte a dummy value (a value not corresponding to any valid LCID based on 38.321, Table 6.2.1-2) //in order to distinguish the PHY random packets at the MAC layer of the gNB receiver from the normal packets that should //have a valid LCID (nr_process_mac_pdu function) - ulsch_input_buffer[0] = 0x31; + ulsch_input_buffer[0] = UL_SCH_LCID_PADDING; for (int i = 1; i < TBS_bytes; i++) { ulsch_input_buffer[i] = (unsigned char) rand(); @@ -1914,6 +1914,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s } // if is_nr_UL_slot } +#define MAX_LCID 8 //Fixme: also defined in LCID table uint8_t nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t subframe, uint8_t eNB_index, @@ -1921,16 +1922,15 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t total_rlc_pdu_header_len = 0; int16_t buflen_remain = 0; uint8_t lcid = 0; - uint16_t sdu_lengths[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - uint8_t sdu_lcids[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + uint16_t sdu_lengths[MAX_LCID] = { 0 }; + uint8_t sdu_lcids[MAX_LCID] = { 0 }; uint16_t payload_offset = 0, num_sdus = 0; uint8_t ulsch_sdus[MAX_ULSCH_PAYLOAD_BYTES]; uint16_t sdu_length_total = 0; //unsigned short post_padding = 0; NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP); - rlc_buffer_occupancy_t lcid_buffer_occupancy_old = - 0, lcid_buffer_occupancy_new = 0; + rlc_buffer_occupancy_t lcid_buffer_occupancy_new = 0; LOG_D(NR_MAC, "[UE %d] MAC PROCESS UL TRANSPORT BLOCK at frame%d subframe %d TBS=%d\n", module_idP, frameP, subframe, buflen); @@ -1940,12 +1940,9 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, // Check for DCCH first // TO DO: Multiplex in the order defined by the logical channel prioritization for (lcid = UL_SCH_LCID_SRB1; - lcid < NR_MAX_NUM_LCID; lcid++) { + lcid < MAX_LCID; lcid++) { - lcid_buffer_occupancy_old = mac_rlc_get_buffer_occupancy_ind(module_idP, mac->crnti, eNB_index, frameP, subframe, ENB_FLAG_NO, lcid); - lcid_buffer_occupancy_new = lcid_buffer_occupancy_old; - - if(lcid_buffer_occupancy_new){ + if( mac_rlc_get_buffer_occupancy_ind(module_idP, mac->crnti, eNB_index, frameP, subframe, ENB_FLAG_NO, lcid) ) { buflen_remain = buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE); @@ -1983,14 +1980,6 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, num_sdus++; } - /* Get updated BO after multiplexing this PDU */ - lcid_buffer_occupancy_new = mac_rlc_get_buffer_occupancy_ind(module_idP, - mac->crnti, - eNB_index, - frameP, - subframe, - ENB_FLAG_NO, - lcid); buflen_remain = buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 9affac70f7..9104393f36 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -32,6 +32,8 @@ #include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "executables/softmodem-common.h" #include "common/utils/nr/nr_common.h" +#include + //38.321 Table 6.1.3.1-1 const uint32_t NR_SHORT_BSR_TABLE[32] = { @@ -83,6 +85,8 @@ void nr_process_mac_pdu( LOG_E(NR_MAC, "%s() UE_id == -1\n",__func__); return; } + trace_NRpdu(DIRECTION_UPLINK, pduP, mac_pdu_len ,UE_id, WS_C_RNTI, rnti, frameP, 0,0, 0); + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; // For both DL/UL-SCH // Except: diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c index 6683d91556..3bdf4f4e71 100644 --- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c +++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c @@ -249,7 +249,7 @@ boolean_t gtpv_data_req_new ( return result; } else { /* It is from from epc message */ /* in the source enb, UE in RRC_HO_EXECUTION mode */ - MessageDef *msg; + //MessageDef *msg; // ????? return true; } diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 329bc0479f..5a540f1c66 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -44,7 +44,6 @@ #include "NR_BCCH-BCH-Message.h" #include "rrc_gNB_UE_context.h" #include -#include extern RAN_CONTEXT_t RC; @@ -208,7 +207,6 @@ nr_rrc_data_req( message_p); LOG_I(NR_RRC,"send RRC_DCCH_DATA_REQ to PDCP\n"); - //trace_NRpdu(DIRECTION_DOWNLINK, message_buffer, sdu_sizeP, 0, WS_M_RNTI, ctxt_pP->rnti, ctxt_pP->frame, ctxt_pP->subframe,0, 0); /* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads * Ideally, PDCP would not neet to be triggered like this but react to ITTI * messages automatically */ diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index d2dc25decd..d257d02070 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1034,7 +1034,7 @@ void fill_initial_SpCellConfig(rnti_t rnti, AssertFatal(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing==NR_SubcarrierSpacing_kHz30, "SCS != 30kHz\n"); AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity==NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5, - "TDD period != 5ms : %d\n",scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity); + "TDD period != 5ms : %ld\n",scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity); schedulingRequestResourceConfig->periodicityAndOffset->choice.sl40 = 10*((rnti>>1)&3) + (rnti&2); schedulingRequestResourceConfig->resource = calloc(1,sizeof(*schedulingRequestResourceConfig->resource)); diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index ee95787b06..a882bc34c9 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -441,10 +441,15 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int bearer_id, teid tmp->outgoing_port=port; tmp->teid_outgoing= outgoing_teid; pthread_mutex_unlock(&globGtp.gtp_lock); - LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %d, teid for UL %d\n", + char ip4[INET_ADDRSTRLEN]; + char ip6[INET6_ADDRSTRLEN]; + + LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %d, teid for UL %d to remote IPv4: %s, IPv6 %s\n", rnti, tmp->teid_incoming, - tmp->teid_outgoing); + tmp->teid_outgoing, + inet_ntop(AF_INET,(void*)&tmp->outgoing_ip_addr, ip4,INET_ADDRSTRLEN ), + inet_ntop(AF_INET6,(void*)&tmp->outgoing_ip6_addr.s6_addr, ip6, INET6_ADDRSTRLEN)); return incoming_teid; } From df21836f1dc885dd880e51e35ecfc86c8d3b99cc Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Mon, 21 Jun 2021 18:46:58 +0200 Subject: [PATCH 058/135] removed stats file generation for RRC temporarily --- common/utils/ocp_itti/intertask_interface.cpp | 2 +- openair2/RRC/NR/rrc_gNB.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index c774da57e6..4e5323aec9 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -136,7 +136,7 @@ extern "C" { LOG_E(TMR,"Queue for %s task contains %ld messages\n", itti_get_task_name(destination_task_id), s ); if ( s > 50 ) - LOG_I(TMR,"Queue for %s task size: %ld\n",itti_get_task_name(destination_task_id), s+1); + LOG_I(TMR,"Queue for %s task size: %ld (last message %s)\n",itti_get_task_name(destination_task_id), s+1,ITTI_MSG_NAME(message)); t->message_queue.insert(t->message_queue.begin(), message); eventfd_t sem_counter = 1; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 4cd79cb134..6cb797a2fc 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3033,7 +3033,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { MessageDef *msg; int id; rrc_gNB_ue_context_t *ue_context_p = NULL; - FILE *fd=fopen("nrRRCstats.log","w"); + FILE *fd=NULL;//fopen("nrRRCstats.log","w"); RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head)) { ctxt_pP->rnti = ue_context_p->ue_id_rnti; @@ -3113,7 +3113,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { } } - fclose(fd); + if (fd) fclose(fd); /* send a tick to x2ap */ if (is_x2ap_enabled()){ From aef67d03100eaa113d614e35524dc9e7c696fe9e Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 21 Jun 2021 21:01:59 +0200 Subject: [PATCH 059/135] fix merge NR_SA_F1AP_5GRECORDS and fix warnings, a regression in UE (LCID lopp) --- executables/nr-gnb.c | 1 + openair1/PHY/LTE_TRANSPORT/transport_common.h | 16 ---------------- openair1/PHY/NR_TRANSPORT/nr_ulsch.h | 1 + .../PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 1 - openair1/PHY/NR_UE_TRANSPORT/nr_prach.c | 2 +- openair1/PHY/defs_nr_UE.h | 1 - openair1/SCHED_NR_UE/pucch_uci_ue_nr.c | 6 +++--- openair2/COMMON/platform_types.h | 12 ++---------- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 7 ------- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 7 ------- openair2/F1AP/f1ap_du_ue_context_management.c | 7 ------- openair2/GNB_APP/gnb_app.c | 1 + openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 5 +++++ openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 18 +++++++++--------- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 -- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 3 ++- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 1 - openair2/RRC/LTE/L2_interface.c | 2 -- openair2/RRC/NR/L2_nr_interface.c | 1 + openair2/UTIL/OPT/probe.c | 4 ++++ openair3/NAS/NR_UE/nr_nas_msg_sim.c | 9 --------- openair3/UICC/usim_interface.h | 1 + openair3/ocp-gtpu/gtp_itf.cpp | 3 --- 24 files changed, 32 insertions(+), 81 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index f07563bddb..ff7d15a96d 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -86,6 +86,7 @@ #include "T.h" #include "nfapi/oai_integration/vendor_ext.h" #include +#include //#define DEBUG_THREADS 1 //#define USRP_DEBUG 1 diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common.h b/openair1/PHY/LTE_TRANSPORT/transport_common.h index ab2921c2b9..fbdac0e7fb 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_common.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_common.h @@ -65,22 +65,6 @@ #define MAX_NUM_CHANNEL_BITS (14*1200*6) // 14 symbols, 1200 REs, 12 bits/RE #define MAX_NUM_RE (14*1200) -#if !defined(SI_RNTI) - #define SI_RNTI (rnti_t)0xffff - #define SI_RNTI_MBMS (rnti_t)0xfff9 -#endif -#if !defined(M_RNTI) - #define M_RNTI (rnti_t)0xfffd -#endif -#if !defined(P_RNTI) - #define P_RNTI (rnti_t)0xfffe -#endif -#if !defined(CBA_RNTI) - #define CBA_RNTI (rnti_t)0xfff4 -#endif -#if !defined(C_RNTI) - #define C_RNTI (rnti_t)0x1234 -#endif // These are the codebook indexes according to Table 6.3.4.2.3-1 of 36.211 //1 layer #define PMI_2A_11 0 diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.h b/openair1/PHY/NR_TRANSPORT/nr_ulsch.h index 2ca8e24af1..80c10d74b1 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.h +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.h @@ -91,6 +91,7 @@ int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type); void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB); +void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB); void clear_pusch_stats(PHY_VARS_gNB *gNB); NR_gNB_SCH_STATS_t *get_ulsch_stats(PHY_VARS_gNB *gNB,NR_gNB_ULSCH_t *ulsch); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 032b277030..197201155e 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -1218,7 +1218,6 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, rel15_ul); nr_gnb_measurements(gNB, ulsch_id, harq_pid, symbol); - int num_symb = rel15_ul->nr_of_symbols; for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { if (symbol == rel15_ul->start_symbol_index) { gNB->pusch_vars[ulsch_id]->ulsch_power[aarx]=0; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index a3f3b52fbe..2b28cbb161 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -66,7 +66,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ uint8_t Mod_id, fd_occasion, preamble_index, restricted_set, not_found; uint16_t rootSequenceIndex, prach_fmt_id, NCS, *prach_root_sequence_map, preamble_offset = 0; - uint16_t preamble_shift = 0, preamble_index0, n_shift_ra, n_shift_ra_bar, d_start, numshift, N_ZC, u, offset, offset2, first_nonzero_root_idx; + uint16_t preamble_shift = 0, preamble_index0, n_shift_ra, n_shift_ra_bar, d_start=INT16_MAX, numshift, N_ZC, u, offset, offset2, first_nonzero_root_idx; int16_t prach_tmp[98304*2*4] __attribute__((aligned(32))); int16_t Ncp = 0, amp, *prach, *prach2, *prachF, *Xu; diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 63d57cae66..bf0a7bc9e5 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -1071,7 +1071,6 @@ typedef struct { #endif int dl_stats[5]; - void * uicc; } PHY_VARS_NR_UE; diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c index f69a78a935..0db8c2785d 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c @@ -567,7 +567,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ int occ_Index = 0; NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid]->harq_ack; - int BWPsize,BWPstart; + int BWPsize,BWPstart=INT_MAX; if (select_pucch_resource(ue, mac, gNB_id, N_UCI, pucch_resource_indicator, &initial_pucch_id, &pucch_resource_set, &pucch_resource_id, harq_status) == TRUE) { /* use of initial pucch configuration provided by system information 1 */ @@ -1290,8 +1290,8 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8 if (resource_set_found == TRUE) { if (pucch_resource_indicator < MAX_PUCCH_RESOURCE_INDICATOR) { // Verify that the value of pucch_resource_indicator is valid - struct NR_PUCCH_Config__resourceSetToAddModList *resourceSetToAddModList; - struct NR_PUCCH_Config__resourceToAddModList *resourceToAddModList; + struct NR_PUCCH_Config__resourceSetToAddModList *resourceSetToAddModList=NULL; + struct NR_PUCCH_Config__resourceToAddModList *resourceToAddModList=NULL; if (bwp_id > 0 && mac->ULbwp[bwp_id-1]) { AssertFatal(mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList!=NULL,"mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList is null\n"); resourceSetToAddModList = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList; diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h index d425b9e7d7..23b33dd8b1 100644 --- a/openair2/COMMON/platform_types.h +++ b/openair2/COMMON/platform_types.h @@ -195,21 +195,13 @@ typedef uint8_t mme_code_t; typedef uint32_t m_tmsi_t; //Random UE identity length = 40 bits -#if ! defined(NOT_A_RANDOM_UE_IDENTITY) #define NOT_A_RANDOM_UE_IDENTITY (uint64_t)0xFFFFFFFF -#endif -#if ! defined(NOT_A_RNTI) #define NOT_A_RNTI (rnti_t)0 -#endif -#if ! defined(M_RNTI) #define M_RNTI (rnti_t)0xFFFD -#endif -#if ! defined(P_RNTI) #define P_RNTI (rnti_t)0xFFFE -#endif -#if ! defined(SI_RNTI) #define SI_RNTI (rnti_t)0xFFFF -#endif +#define CBA_RNTI (rnti_t)0xfff4 +#define OAI_C_RNTI (rnti_t)0x1234 typedef enum config_action_e { CONFIG_ACTION_NULL = 0, CONFIG_ACTION_ADD = 1, diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 2a029a3ac5..1129d67643 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -38,13 +38,6 @@ #include "common/ran_context.h" #include "openair3/UTILS/conversions.h" -// undefine C_RNTI from -// openair1/PHY/LTE_TRANSPORT/transport_common.h which -// replaces in ie->value.choice.C_RNTI, causing -// a compile error -#undef C_RNTI - - // Bing Kai: create CU and DU context, and put all the information there. uint64_t du_ue_f1ap_id = 0; uint32_t f1ap_assoc_id = 0; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 00392c07a7..770a321347 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -56,13 +56,6 @@ #include "intertask_interface.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h" -// undefine C_RNTI from -// openair1/PHY/LTE_TRANSPORT/transport_common.h which -// replaces in ie->value.choice.C_RNTI, causing -// a compile error - -#undef C_RNTI - extern f1ap_setup_req_t *f1ap_du_data; extern RAN_CONTEXT_t RC; extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB]; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 8bb3b53bb0..81fdd0c35f 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -41,13 +41,6 @@ #include "openair2/RRC/NR/rrc_gNB_UE_context.h" #include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" -// undefine C_RNTI from -// openair1/PHY/LTE_TRANSPORT/transport_common.h which -// replaces in ie->value.choice.C_RNTI, causing -// a compile error - -#undef C_RNTI - extern f1ap_setup_req_t *f1ap_du_data; extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB]; extern RAN_CONTEXT_t RC; diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index d79d09d409..7fe2ad9632 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -46,6 +46,7 @@ #include "f1ap_cu_task.h" #include "f1ap_du_task.h" #include "nfapi/oai_integration/vendor_ext.h" +#include extern unsigned char NB_gNB_INST; extern RAN_CONTEXT_t RC; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index c6cb0341ac..e62801f7ad 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -169,4 +169,9 @@ uint8_t get_transformPrecoding(const NR_BWP_UplinkCommon_t *initialUplinkBWP, int rnti_type, uint8_t configuredGrant); +void nr_mac_eNB_rrc_ul_failure(const module_id_t Mod_instP, + const int CC_idP, + const frame_t frameP, + const sub_frame_t subframeP, + const rnti_t rntiP) ; #endif diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 2569559d29..78178be388 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1941,9 +1941,9 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, // TO DO: Multiplex in the order defined by the logical channel prioritization for (lcid = UL_SCH_LCID_SRB1; lcid < MAX_LCID; lcid++) { + lcid_buffer_occupancy_new = mac_rlc_get_buffer_occupancy_ind(module_idP, mac->crnti, eNB_index, frameP, subframe, ENB_FLAG_NO, lcid); - if( mac_rlc_get_buffer_occupancy_ind(module_idP, mac->crnti, eNB_index, frameP, subframe, ENB_FLAG_NO, lcid) ) { - + if(lcid_buffer_occupancy_new) { buflen_remain = buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE); LOG_I(NR_MAC, @@ -1953,7 +1953,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, buflen, sdu_length_total, total_rlc_pdu_header_len, buflen_remain); // ,nr_ue_mac_inst->scheduling_info.BSR_bytes[nr_ue_mac_inst->scheduling_info.LCGID[lcid]] - while(buflen_remain > 0 && lcid_buffer_occupancy_new){ + while(buflen_remain > 0 && lcid_buffer_occupancy_new){ sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, mac->crnti, @@ -1980,13 +1980,14 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, num_sdus++; } + /* Get updated BO after multiplexing this PDU */ + lcid_buffer_occupancy_new = mac_rlc_get_buffer_occupancy_ind(module_idP,mac->crnti,eNB_index,frameP, subframe, ENB_FLAG_NO, lcid); buflen_remain = buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE); - } + } + } } -} - // Generate ULSCH PDU if (num_sdus>0) { payload_offset = nr_generate_ulsch_pdu(ulsch_sdus, @@ -2001,9 +2002,8 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, 0, // long_bsr 0, // post_padding buflen); // TBS in bytes - } - else - return 0; + } else + return 0; // Padding: fill remainder of ULSCH with 0 if (buflen - payload_offset > 0){ diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 1fec37edfe..9eb36b1dc6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1138,7 +1138,6 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra gNB_MAC_INST *nr_mac = RC.nrmac[module_idP]; NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id]; - NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; if (ra->Msg4_frame == frameP && ra->Msg4_slot == slotP ) { @@ -1301,7 +1300,6 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra // look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially // important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them - const int bwpid = bwp ? bwp->bwp_Id : 0; const int coresetid = coreset->controlResourceSetId; nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid]; if (!pdcch_pdu_rel15) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 953422bb08..4820eae3be 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1881,7 +1881,7 @@ void get_pdsch_to_harq_feedback(int Mod_idP, if (CellGroup && CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList) ubwp = CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]; - NR_SearchSpace_t *ss; + NR_SearchSpace_t *ss=NULL; // common search type uses DCI format 1_0 if (ss_type == NR_SearchSpace__searchSpaceType_PR_common) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 9104393f36..26eb2ec7c2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -85,7 +85,8 @@ void nr_process_mac_pdu( LOG_E(NR_MAC, "%s() UE_id == -1\n",__func__); return; } - trace_NRpdu(DIRECTION_UPLINK, pduP, mac_pdu_len ,UE_id, WS_C_RNTI, rnti, frameP, 0,0, 0); + if ( pduP[0] != UL_SCH_LCID_PADDING ) + trace_NRpdu(DIRECTION_UPLINK, pduP, mac_pdu_len ,UE_id, WS_C_RNTI, rnti, frameP, 0,0, 0); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; // For both DL/UL-SCH diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 02fb0c625c..e7d771562c 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -38,7 +38,6 @@ #include "common/ran_context.h" #include "NR_UL-CCCH-Message.h" -#undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace #include "openair2/F1AP/f1ap_du_rrc_message_transfer.h" #include "openair2/LAYER2/PROTO_AGENT/proto_agent.h" diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index cd99ddfedc..09c3fdd768 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -49,8 +49,6 @@ #include "intertask_interface.h" #include "flexran_agent_extern.h" -#undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace -//#include "f1ap_du_rrc_message_transfer.h" #include "openair2/F1AP/f1ap_du_rrc_message_transfer.h" extern RAN_CONTEXT_t RC; diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 5a540f1c66..1b5c35f0f8 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -44,6 +44,7 @@ #include "NR_BCCH-BCH-Message.h" #include "rrc_gNB_UE_context.h" #include +#include extern RAN_CONTEXT_t RC; diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c index 2966c4672c..e64f7724c6 100644 --- a/openair2/UTIL/OPT/probe.c +++ b/openair2/UTIL/OPT/probe.c @@ -441,6 +441,10 @@ static void SendFrameNR(guint8 radioType, guint8 direction, guint8 rntiType, tmp16 = htons(subframe); // frame counter : this will give an expert info as wireshark expects SF and not F memcpy(frameBuffer+frameOffset, &tmp16, 2); frameOffset += 2; + if (direction == 0 ) { //ulink + frameBuffer[frameOffset++] = MAC_NR_PHR_TYPE2_OTHERCELL_TAG; + frameBuffer[frameOffset++] = 0; + } /***************************************/ /* Now write the MAC PDU */ diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index 08fe4a3840..4d687401ff 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -44,19 +44,10 @@ #include #include - -//char netName[] = "5G:mnc099.mcc208.3gppnetwork.org"; -//char imsi[] = "2089900007487"; //"208990100001100"; -// USIM_API_K: fe c8 6b a6 eb 70 7e d0 89 05 75 7b 1b b4 4b 8f -//uint8_t k[16] = {0xfe, 0xc8, 0x6b, 0xa6, 0xeb, 0x70, 0x7e, 0xd0, 0x89, 0x05, 0x75, 0x7b, 0x1b, 0xb4, 0x4b, 0x8f}; -// OPC: c4 24 49 36 3b ba d0 2b 66 d1 6b c9 75 d7 7c c1 -//const uint8_t opc[16] = {0xc4, 0x24, 0x49, 0x36, 0x3b, 0xba, 0xd0, 0x2b, 0x66, 0xd1, 0x6b, 0xc9, 0x75, 0xd7, 0x7c, 0xc1}; - uint8_t *registration_request_buf; uint32_t registration_request_len; extern char *baseNetAddress; - static int nas_protected_security_header_encode( char *buffer, const fgs_nas_message_security_header_t *header, diff --git a/openair3/UICC/usim_interface.h b/openair3/UICC/usim_interface.h index ee489fa875..44c27c772e 100644 --- a/openair3/UICC/usim_interface.h +++ b/openair3/UICC/usim_interface.h @@ -66,6 +66,7 @@ typedef struct { /* * Read the configuration file, section name variable to be able to manage several UICC */ +uicc_t *checkUicc(int Mod_id); uicc_t *init_uicc(char *sectionName); void uicc_milenage_generate(uint8_t * autn, uicc_t *uicc); uicc_t * checkUicc(int Mod_id); diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 1ed71d1564..a882bc34c9 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -283,9 +283,6 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r LOG_D(GTPU,"sending end packet to %s\n", inet_ntoa(to.sin_addr) ); if (sendto(compatInst(instance), (void *)&msgHdr, sizeof(msgHdr), 0,(struct sockaddr *)&to, sizeof(to) ) != sizeof(msgHdr)) { - char ip4[INET_ADDRSTRLEN]; - char ip6[INET6_ADDRSTRLEN]; - LOG_E(GTPU, "[SD %ld] Failed to send data to %s on port %d, buffer size %lu\n", compatInst(instance), inet_ntop(AF_INET, &tmp.outgoing_ip_addr, ip4, INET_ADDRSTRLEN), tmp.outgoing_port, sizeof(msgHdr)); From 75e999572fc03e0cfd002717e9ae89d3146469f1 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 22 Jun 2021 14:26:25 +0200 Subject: [PATCH 060/135] add DLinformationTransfer in nrUE, process SRB!=1 in UE (instead of discard), change struct member pdusession into pduSession to increase code readability (another struct contains also pdusession in lower case) --- openair2/RRC/NR/nr_rrc_defs.h | 2 +- openair2/RRC/NR/rrc_gNB.c | 84 ++++++++++++------------- openair2/RRC/NR/rrc_gNB_NGAP.c | 92 ++++++++++++++-------------- openair2/RRC/NR/rrc_gNB_UE_context.c | 2 +- openair2/RRC/NR_UE/rrc_UE.c | 1 - openair3/NAS/NR_UE/nr_nas_msg_sim.c | 20 +++++- openair3/NAS/NR_UE/nr_nas_msg_sim.h | 1 + 7 files changed, 109 insertions(+), 93 deletions(-) diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index f6ab045c3b..0e86566563 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -356,7 +356,7 @@ typedef struct gNB_RRC_UE_s { /* list of e_rab to be setup by RRC layers */ /* list of pdu session to be setup by RRC layers */ e_rab_param_t e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB]; - pdu_session_param_t pdusession[NR_NB_RB_MAX];//[NGAP_MAX_PDU_SESSION]; + pdu_session_param_t pduSession[NR_NB_RB_MAX];//[NGAP_MAX_PDU_SESSION]; //release e_rabs uint8_t nb_release_of_e_rabs; e_rab_failed_t e_rabs_release_failed[S1AP_MAX_E_RAB]; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 6cb797a2fc..b738aeb237 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -805,18 +805,18 @@ rrc_gNB_generate_defaultRRCReconfiguration( /* Add all NAS PDUs to the list */ for (int i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { - if (ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer != NULL) { + if (ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer != NULL) { dedicatedNAS_Message = CALLOC(1, sizeof(NR_DedicatedNAS_Message_t)); memset(dedicatedNAS_Message, 0, sizeof(OCTET_STRING_t)); OCTET_STRING_fromBuf(dedicatedNAS_Message, - (char *)ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer, - ue_context_pP->ue_context.pdusession[i].param.nas_pdu.length); + (char *)ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.pduSession[i].param.nas_pdu.length); ASN_SEQUENCE_ADD(&dedicatedNAS_MessageList->list, dedicatedNAS_Message); } - ue_context_pP->ue_context.pdusession[i].status = PDU_SESSION_STATUS_DONE; + ue_context_pP->ue_context.pduSession[i].status = PDU_SESSION_STATUS_DONE; LOG_D(NR_RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", - i, ue_context_pP->ue_context.pdusession[i].status, "PDU_SESSION_STATUS_DONE"); + i, ue_context_pP->ue_context.pduSession[i].status, "PDU_SESSION_STATUS_DONE"); } if (ue_context_pP->ue_context.nas_pdu_flag == 1) { @@ -853,9 +853,9 @@ rrc_gNB_generate_defaultRRCReconfiguration( /* Free all NAS PDUs */ for (int i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { - if (ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer != NULL) { - free(ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer); - ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer = NULL; + if (ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer != NULL) { + free(ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer); + ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer = NULL; } } @@ -990,7 +990,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( break; } - if (ue_context_pP->ue_context.pdusession[i].status >= PDU_SESSION_STATUS_DONE) { + if (ue_context_pP->ue_context.pduSession[i].status >= PDU_SESSION_STATUS_DONE) { continue; } @@ -1001,15 +1001,15 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( // sdap_Config sdap_config = CALLOC(1, sizeof(NR_SDAP_Config_t)); memset(sdap_config, 0, sizeof(NR_SDAP_Config_t)); - sdap_config->pdu_Session = ue_context_pP->ue_context.pdusession[i].param.pdusession_id; + sdap_config->pdu_Session = ue_context_pP->ue_context.pduSession[i].param.pdusession_id; sdap_config->sdap_HeaderDL = NR_SDAP_Config__sdap_HeaderDL_absent; sdap_config->sdap_HeaderUL = NR_SDAP_Config__sdap_HeaderUL_absent; sdap_config->defaultDRB = TRUE; sdap_config->mappedQoS_FlowsToAdd = calloc(1, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd)); memset(sdap_config->mappedQoS_FlowsToAdd, 0, sizeof(struct NR_SDAP_Config__mappedQoS_FlowsToAdd)); - for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.pdusession[i].param.nb_qos; qos_flow_index++) { - qfi = ue_context_pP->ue_context.pdusession[i].param.qos[qos_flow_index].qfi; + for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.pduSession[i].param.nb_qos; qos_flow_index++) { + qfi = ue_context_pP->ue_context.pduSession[i].param.qos[qos_flow_index].qfi; ASN_SEQUENCE_ADD(&sdap_config->mappedQoS_FlowsToAdd->list, &qfi); } sdap_config->mappedQoS_FlowsToRelease = NULL; @@ -1039,8 +1039,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( DRB_config->pdcp_Config->ext1 = NULL; // Reference TS23501 Table 5.7.4-1: Standardized 5QI to QoS characteristics mapping - for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.pdusession[i].param.nb_qos; qos_flow_index++) { - switch (ue_context_pP->ue_context.pdusession[i].param.qos[qos_flow_index].fiveQI) { + for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.pduSession[i].param.nb_qos; qos_flow_index++) { + switch (ue_context_pP->ue_context.pduSession[i].param.qos[qos_flow_index].fiveQI) { case 1: //100ms case 2: //150ms case 3: //50ms @@ -1054,9 +1054,9 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( break; default: - LOG_E(NR_RRC,"not supported 5qi %lu\n", ue_context_pP->ue_context.pdusession[i].param.qos[qos_flow_index].fiveQI); - ue_context_pP->ue_context.pdusession[i].status = PDU_SESSION_STATUS_FAILED; - ue_context_pP->ue_context.pdusession[i].xid = xid; + LOG_E(NR_RRC,"not supported 5qi %lu\n", ue_context_pP->ue_context.pduSession[i].param.qos[qos_flow_index].fiveQI); + ue_context_pP->ue_context.pduSession[i].status = PDU_SESSION_STATUS_FAILED; + ue_context_pP->ue_context.pduSession[i].xid = xid; pdu_sessions_done++; free(DRB_config); continue; @@ -1066,18 +1066,18 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); - ue_context_pP->ue_context.pdusession[i].status = PDU_SESSION_STATUS_DONE; - ue_context_pP->ue_context.pdusession[i].xid = xid; + ue_context_pP->ue_context.pduSession[i].status = PDU_SESSION_STATUS_DONE; + ue_context_pP->ue_context.pduSession[i].xid = xid; - if (ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer != NULL) { + if (ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer != NULL) { dedicatedNAS_Message = CALLOC(1, sizeof(NR_DedicatedNAS_Message_t)); memset(dedicatedNAS_Message, 0, sizeof(OCTET_STRING_t)); OCTET_STRING_fromBuf(dedicatedNAS_Message, - (char *)ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer, - ue_context_pP->ue_context.pdusession[i].param.nas_pdu.length); + (char *)ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.pduSession[i].param.nas_pdu.length); ASN_SEQUENCE_ADD(&dedicatedNAS_MessageList->list, dedicatedNAS_Message); - LOG_I(NR_RRC,"add NAS info with size %d (pdusession id %d)\n",ue_context_pP->ue_context.pdusession[i].param.nas_pdu.length, i); + LOG_I(NR_RRC,"add NAS info with size %d (pdusession id %d)\n",ue_context_pP->ue_context.pduSession[i].param.nas_pdu.length, i); } else { // TODO LOG_E(NR_RRC,"no NAS info (pdusession id %d)\n", i); @@ -1108,10 +1108,10 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( /* Free all NAS PDUs */ for (i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { - if (ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer != NULL) { + if (ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer != NULL) { /* Free the NAS PDU buffer and invalidate it */ - free(ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer); - ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer = NULL; + free(ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer); + ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer = NULL; } } @@ -1180,7 +1180,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( *DRB_Release_configList2 = CALLOC(1, sizeof(**DRB_Release_configList2)); for(i = 0; i < NB_RB_MAX; i++) { - if((ue_context_pP->ue_context.pdusession[i].status == PDU_SESSION_STATUS_TORELEASE) && ue_context_pP->ue_context.pdusession[i].xid == xid) { + if((ue_context_pP->ue_context.pduSession[i].status == PDU_SESSION_STATUS_TORELEASE) && ue_context_pP->ue_context.pduSession[i].xid == xid) { DRB_release = CALLOC(1, sizeof(NR_DRB_Identity_t)); *DRB_release = i+1; ASN_SEQUENCE_ADD(&(*DRB_Release_configList2)->list, DRB_release); @@ -1646,13 +1646,13 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( memset(&create_tunnel_req, 0, sizeof(create_tunnel_req)); for ( j = 0, i = 0; i < NB_RB_MAX; i++) { - 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.upf_NGu_teid[j] = ue_context_pP->ue_context.pdusession[i].param.gtp_teid; + 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.upf_NGu_teid[j] = ue_context_pP->ue_context.pduSession[i].param.gtp_teid; memcpy(create_tunnel_req.upf_addr[j].buffer, - ue_context_pP->ue_context.pdusession[i].param.upf_addr.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.upf_addr[j].length = ue_context_pP->ue_context.pduSession[i].param.upf_addr.length; j++; } } @@ -1712,10 +1712,10 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( /* TODO parameters yet to process ... */ /* TODO should test if pdu session are Ok before! */ - ue_context_pP->ue_context.pdusession[i].status = PDU_SESSION_STATUS_DONE; - ue_context_pP->ue_context.pdusession[i].xid = xid; + ue_context_pP->ue_context.pduSession[i].status = PDU_SESSION_STATUS_DONE; + ue_context_pP->ue_context.pduSession[i].xid = xid; LOG_D(NR_RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", - i, ue_context_pP->ue_context.pdusession[i].status, "PDU_SESSION_STATUS_DONE"); + i, ue_context_pP->ue_context.pduSession[i].status, "PDU_SESSION_STATUS_DONE"); } memset(buffer, 0, RRC_BUF_SIZE); @@ -1736,10 +1736,10 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( /* Free all NAS PDUs */ for (i = 0; i < ue_context_pP->ue_context.nb_of_pdusessions; i++) { - if (ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer != NULL) { + if (ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer != NULL) { /* Free the NAS PDU buffer and invalidate it */ - free(ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer); - ue_context_pP->ue_context.pdusession[i].param.nas_pdu.buffer = NULL; + free(ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer); + ue_context_pP->ue_context.pduSession[i].param.nas_pdu.buffer = NULL; } } @@ -2072,10 +2072,10 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, ue_context_p->ue_context.reestablishment_xid); for (uint8_t pdusessionid = 0; pdusessionid < ue_context_p->ue_context.nb_of_pdusessions; pdusessionid++) { - if (ue_context_p->ue_context.pdusession[pdusessionid].status == PDU_SESSION_STATUS_DONE) { - ue_context_p->ue_context.pdusession[pdusessionid].status = PDU_SESSION_STATUS_ESTABLISHED; + if (ue_context_p->ue_context.pduSession[pdusessionid].status == PDU_SESSION_STATUS_DONE) { + ue_context_p->ue_context.pduSession[pdusessionid].status = PDU_SESSION_STATUS_ESTABLISHED; } else { - ue_context_p->ue_context.pdusession[pdusessionid].status = PDU_SESSION_STATUS_FAILED; + ue_context_p->ue_context.pduSession[pdusessionid].status = PDU_SESSION_STATUS_FAILED; } } } @@ -2316,7 +2316,7 @@ rrc_gNB_decode_dcch( GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; for(i = 0; i < NB_RB_MAX; i++) { - if(xid == ue_context_p->ue_context.pdusession[i].xid) { + if(xid == ue_context_p->ue_context.pduSession[i].xid) { GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).pdusession_id[GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_pdusession++] = ue_context_p->ue_context.gnb_gtp_psi[i]; ue_context_p->ue_context.gnb_gtp_teid[i] = 0; diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index deae7387d0..3f37061484 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -539,20 +539,20 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ( if (nb_pdusessions_tosetup != 0) { memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t)); for (int i = 0; i < NR_NB_RB_MAX - 3; i++) { - if(ue_context_p->ue_context.pdusession[i].status >= PDU_SESSION_STATUS_DONE) + if(ue_context_p->ue_context.pduSession[i].status >= PDU_SESSION_STATUS_DONE) continue; - ue_context_p->ue_context.pdusession[i].status = PDU_SESSION_STATUS_NEW; - ue_context_p->ue_context.pdusession[i].param = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done]; + ue_context_p->ue_context.pduSession[i].status = PDU_SESSION_STATUS_NEW; + 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.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[i].upf_addr.length; + 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, - NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[i].upf_addr.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[i], - create_tunnel_req.pdusession_id[i]); + create_tunnel_req.upf_NGu_teid[pdu_sessions_done], + create_tunnel_req.pdusession_id[pdu_sessions_done]); inde_list[pdu_sessions_done] = i; pdu_sessions_done++; @@ -649,24 +649,24 @@ rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP( NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).gNB_ue_ngap_id = ue_context_pP->ue_context.gNB_ue_ngap_id; for (pdusession = 0; pdusession < ue_context_pP->ue_context.nb_of_pdusessions; pdusession++) { - if (ue_context_pP->ue_context.pdusession[pdusession].status == PDU_SESSION_STATUS_DONE) { + if (ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_DONE) { pdu_sessions_done++; - NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].pdusession_id = ue_context_pP->ue_context.pdusession[pdusession].param.pdusession_id; + NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].pdusession_id = ue_context_pP->ue_context.pduSession[pdusession].param.pdusession_id; // TODO add other information from S1-U when it will be integrated NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].gtp_teid = ue_context_pP->ue_context.gnb_gtp_teid[pdusession]; memcpy(NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].gNB_addr.buffer , ue_context_pP->ue_context.gnb_gtp_addrs[pdusession].buffer, 20); NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].gNB_addr.length = 4; - ue_context_pP->ue_context.pdusession[pdusession].status = PDU_SESSION_STATUS_ESTABLISHED; - NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].nb_of_qos_flow = ue_context_pP->ue_context.pdusession[pdusession].param.nb_qos; - for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.pdusession[pdusession].param.nb_qos; qos_flow_index++) { + ue_context_pP->ue_context.pduSession[pdusession].status = PDU_SESSION_STATUS_ESTABLISHED; + NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].nb_of_qos_flow = ue_context_pP->ue_context.pduSession[pdusession].param.nb_qos; + for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.pduSession[pdusession].param.nb_qos; qos_flow_index++) { NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].associated_qos_flows[qos_flow_index].qfi = - ue_context_pP->ue_context.pdusession[pdusession].param.qos[qos_flow_index].qfi; + ue_context_pP->ue_context.pduSession[pdusession].param.qos[qos_flow_index].qfi; NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions[pdusession].associated_qos_flows[qos_flow_index].qos_flow_mapping_ind = QOSFLOW_MAPPING_INDICATION_DL; } } else { pdu_sessions_failed++; - ue_context_pP->ue_context.pdusession[pdusession].status = PDU_SESSION_STATUS_FAILED; - NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions_failed[pdusession].pdusession_id = ue_context_pP->ue_context.pdusession[pdusession].param.pdusession_id; + ue_context_pP->ue_context.pduSession[pdusession].status = PDU_SESSION_STATUS_FAILED; + NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions_failed[pdusession].pdusession_id = ue_context_pP->ue_context.pduSession[pdusession].param.pdusession_id; // TODO add cause when it will be integrated NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions_failed[pdusession].cause = NGAP_Cause_PR_radioNetwork; NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).pdusessions_failed[pdusession].cause_value = NGAP_CauseRadioNetwork_unknown_PDU_session_ID; @@ -957,10 +957,10 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP( for (pdusession = 0; pdusession < ue_context_pP->ue_context.setup_pdu_sessions; pdusession++) { // if (xid == ue_context_pP->ue_context.pdusession[pdusession].xid) { - if (ue_context_pP->ue_context.pdusession[pdusession].status == PDU_SESSION_STATUS_DONE) { - NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].pdusession_id = ue_context_pP->ue_context.pdusession[pdusession].param.pdusession_id; + if (ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_DONE) { + NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].pdusession_id = ue_context_pP->ue_context.pduSession[pdusession].param.pdusession_id; // NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].pdusession_id = 1; - NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].nb_of_qos_flow = ue_context_pP->ue_context.pdusession[pdusession].param.nb_qos; + NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].nb_of_qos_flow = ue_context_pP->ue_context.pduSession[pdusession].param.nb_qos; NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].gtp_teid = ue_context_pP->ue_context.gnb_gtp_teid[pdusession]; NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].gNB_addr.pdu_session_type = PDUSessionType_ipv4; NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].gNB_addr.length = ue_context_pP->ue_context.gnb_gtp_addrs[pdusession].length; @@ -968,13 +968,13 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP( ue_context_pP->ue_context.gnb_gtp_addrs[pdusession].buffer, sizeof(uint8_t)*20); for (qos_flow_index = 0; qos_flow_index < NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].nb_of_qos_flow; qos_flow_index++) { NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].associated_qos_flows[qos_flow_index].qfi = - ue_context_pP->ue_context.pdusession[pdusession].param.qos[qos_flow_index].qfi; + ue_context_pP->ue_context.pduSession[pdusession].param.qos[qos_flow_index].qfi; NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].associated_qos_flows[qos_flow_index].qos_flow_mapping_ind = QOSFLOW_MAPPING_INDICATION_DL; } - ue_context_pP->ue_context.pdusession[pdusession].status = PDU_SESSION_STATUS_ESTABLISHED; + ue_context_pP->ue_context.pduSession[pdusession].status = PDU_SESSION_STATUS_ESTABLISHED; LOG_I (NR_RRC,"gnb_gtp_addr (msg index %d, pdu_sessions index %d, status %d, xid %d): nb_of_pdusessions %d, pdusession_id %d, teid: %u, addr: %d.%d.%d.%d \n ", - pdu_sessions_done, pdusession, ue_context_pP->ue_context.pdusession[pdusession].status, xid, + pdu_sessions_done, pdusession, ue_context_pP->ue_context.pduSession[pdusession].status, xid, ue_context_pP->ue_context.nb_of_pdusessions, NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].pdusession_id, NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gtp_teid, @@ -983,12 +983,12 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP( NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gNB_addr.buffer[2], NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gNB_addr.buffer[3]); pdu_sessions_done++; - } else if ((ue_context_pP->ue_context.pdusession[pdusession].status == PDU_SESSION_STATUS_NEW) || - (ue_context_pP->ue_context.pdusession[pdusession].status == PDU_SESSION_STATUS_ESTABLISHED)) { + } else if ((ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_NEW) || + (ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_ESTABLISHED)) { LOG_D (NR_RRC,"PDU-SESSION is NEW or already ESTABLISHED\n"); } else { /* to be improved */ - ue_context_pP->ue_context.pdusession[pdusession].status = PDU_SESSION_STATUS_FAILED; - NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions_failed[pdu_sessions_failed].pdusession_id = ue_context_pP->ue_context.pdusession[pdusession].param.pdusession_id; + ue_context_pP->ue_context.pduSession[pdusession].status = PDU_SESSION_STATUS_FAILED; + NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions_failed[pdu_sessions_failed].pdusession_id = ue_context_pP->ue_context.pduSession[pdusession].param.pdusession_id; pdu_sessions_failed++; // TODO add cause when it will be integrated } @@ -1017,7 +1017,7 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP( } for(int i = 0; i < NB_RB_MAX; i++) { - ue_context_pP->ue_context.pdusession[i].xid = -1; + ue_context_pP->ue_context.pduSession[i].xid = -1; } return; @@ -1063,20 +1063,20 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ( PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, ue_context_p->ue_context.rnti, 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) + if(ue_context_p->ue_context.pduSession[i].status >= PDU_SESSION_STATUS_DONE) continue; - ue_context_p->ue_context.pdusession[i].status = PDU_SESSION_STATUS_NEW; - ue_context_p->ue_context.pdusession[i].param = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done]; + ue_context_p->ue_context.pduSession[i].status = PDU_SESSION_STATUS_NEW; + 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.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, - NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[i].upf_addr.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[i].upf_addr.length; + create_tunnel_req.upf_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[i], - create_tunnel_req.pdusession_id[i]); + create_tunnel_req.upf_NGu_teid[pdu_sessions_done], + create_tunnel_req.pdusession_id[pdu_sessions_done]); inde_list[pdu_sessions_done] = i; pdu_sessions_done++; @@ -1144,7 +1144,7 @@ rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_REQ( NGAP_UE_CONTEXT_RELEASE_REQ(msg_context_release_req_p).cause_value = cause_valueP; NGAP_UE_CONTEXT_RELEASE_REQ(msg_context_release_req_p).nb_of_pdusessions = ue_context_pP->ue_context.setup_pdu_sessions; for (int pdusession = 0; pdusession < ue_context_pP->ue_context.setup_pdu_sessions; pdusession++) { - NGAP_UE_CONTEXT_RELEASE_REQ(msg_context_release_req_p).pdusessions[pdusession].pdusession_id = ue_context_pP->ue_context.pdusession[pdusession].param.pdusession_id; + NGAP_UE_CONTEXT_RELEASE_REQ(msg_context_release_req_p).pdusessions[pdusession].pdusession_id = ue_context_pP->ue_context.pduSession[pdusession].param.pdusession_id; } itti_send_msg_to_task(TASK_NGAP, GNB_MODULE_ID_TO_INSTANCE(gnb_mod_idP), msg_context_release_req_p); } @@ -1357,12 +1357,12 @@ rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE( NGAP_PDUSESSION_RELEASE_RESPONSE (msg_p).gNB_ue_ngap_id = ue_context_pP->ue_context.gNB_ue_ngap_id; for (int i = 0; i < NB_RB_MAX; i++) { - if (xid == ue_context_pP->ue_context.pdusession[i].xid) { + if (xid == ue_context_pP->ue_context.pduSession[i].xid) { NGAP_PDUSESSION_RELEASE_RESPONSE (msg_p).pdusession_release[pdu_sessions_released].pdusession_id = - ue_context_pP->ue_context.pdusession[i].param.pdusession_id; + ue_context_pP->ue_context.pduSession[i].param.pdusession_id; pdu_sessions_released++; //clear - memset(&ue_context_pP->ue_context.pdusession[i], 0, sizeof(pdu_session_param_t)); + memset(&ue_context_pP->ue_context.pduSession[i], 0, sizeof(pdu_session_param_t)); } } @@ -1378,7 +1378,7 @@ rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE( //clear xid for(int i = 0; i < NB_RB_MAX; i++) { - ue_context_pP->ue_context.pdusession[i].xid = -1; + ue_context_pP->ue_context.pduSession[i].xid = -1; } //clear release pdusessions @@ -1439,7 +1439,7 @@ rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND( } for (i = 0; i < NR_NB_RB_MAX; i++) { - if (pdusession_release_params[pdusession].pdusession_id == ue_context_p->ue_context.pdusession[i].param.pdusession_id) { + if (pdusession_release_params[pdusession].pdusession_id == ue_context_p->ue_context.pduSession[i].param.pdusession_id) { b_existed = 1; break; } @@ -1453,13 +1453,13 @@ rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND( ue_context_p->ue_context.pdusessions_release_failed[ue_context_p->ue_context.nb_release_of_pdusessions].cause_value = 30; ue_context_p->ue_context.nb_release_of_pdusessions++; } else { - if(ue_context_p->ue_context.pdusession[i].status == PDU_SESSION_STATUS_FAILED) { - ue_context_p->ue_context.pdusession[i].xid = xid; + if(ue_context_p->ue_context.pduSession[i].status == PDU_SESSION_STATUS_FAILED) { + ue_context_p->ue_context.pduSession[i].xid = xid; continue; - } else if(ue_context_p->ue_context.pdusession[i].status == PDU_SESSION_STATUS_ESTABLISHED) { - LOG_I(NR_RRC, "RELEASE pdusession %d \n", ue_context_p->ue_context.pdusession[i].param.pdusession_id); - ue_context_p->ue_context.pdusession[i].status = PDU_SESSION_STATUS_TORELEASE; - ue_context_p->ue_context.pdusession[i].xid = xid; + } else if(ue_context_p->ue_context.pduSession[i].status == PDU_SESSION_STATUS_ESTABLISHED) { + LOG_I(NR_RRC, "RELEASE pdusession %d \n", ue_context_p->ue_context.pduSession[i].param.pdusession_id); + ue_context_p->ue_context.pduSession[i].status = PDU_SESSION_STATUS_TORELEASE; + ue_context_p->ue_context.pduSession[i].xid = xid; pdusession_release_drb++; } else { // pdusession_id status NG @@ -1483,7 +1483,7 @@ rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND( GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; for(i = 0; i < NB_RB_MAX; i++) { - if(xid == ue_context_p->ue_context.pdusession[i].xid) { + if(xid == ue_context_p->ue_context.pduSession[i].xid) { GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).pdusession_id[GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_pdusession++] = ue_context_p->ue_context.gnb_gtp_psi[i]; ue_context_p->ue_context.gnb_gtp_teid[i] = 0; memset(&ue_context_p->ue_context.gnb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.gnb_gtp_addrs[i])); diff --git a/openair2/RRC/NR/rrc_gNB_UE_context.c b/openair2/RRC/NR/rrc_gNB_UE_context.c index 988db09cc1..eb7559f69d 100644 --- a/openair2/RRC/NR/rrc_gNB_UE_context.c +++ b/openair2/RRC/NR/rrc_gNB_UE_context.c @@ -135,7 +135,7 @@ rrc_gNB_allocate_new_UE_context( for(int i = 0; i < NB_RB_MAX; i++) { new_p->ue_context.e_rab[i].xid = -1; - new_p->ue_context.pdusession[i].xid = -1; + new_p->ue_context.pduSession[i].xid = -1; new_p->ue_context.modify_e_rab[i].xid = -1; } diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index aa9c0190e7..1ac21c3584 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -2303,7 +2303,6 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB if (Srb_id != 1) { LOG_E(NR_RRC,"[UE %d] Frame %d: Received message on DL-DCCH (SRB%ld), should not have ...\n", ctxt_pP->module_id, ctxt_pP->frame, Srb_id); - return -1; } else { LOG_D(NR_RRC, "Received message on SRB%ld\n", Srb_id); } diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index 4d687401ff..f69231cc18 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -612,6 +612,19 @@ void generateRegistrationComplete(as_nas_info_t *initialNasMsg, SORTransparentCo } } +void decodeDownlinkNASTransport(as_nas_info_t *initialNasMsg, uint8_t * pdu_buffer){ + uint8_t msg_type = *(pdu_buffer + 16); + if(msg_type == FGS_PDU_SESSION_ESTABLISHMENT_ACC){ + sprintf(baseNetAddress, "%d.%d", *(pdu_buffer + 39),*(pdu_buffer + 40)); + int third_octet = *(pdu_buffer + 41); + int fourth_octet = *(pdu_buffer + 42); + LOG_I(NAS, "Received PDU Session Establishment Accept\n"); + nas_config(1,third_octet,fourth_octet,"ue"); + } else { + LOG_E(NAS, "Received unexpected message in DLinformationTransfer %d\n", msg_type); + } +} + void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){ //wait send RegistrationComplete usleep(100*150); @@ -850,8 +863,7 @@ void *nas_nrue_task(void *args_p) Mod_id, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data); - as_nas_info_t initialNasMsg; - memset(&initialNasMsg, 0, sizeof(as_nas_info_t)); + as_nas_info_t initialNasMsg={0}; pdu_buffer = NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data; if((pdu_buffer + 1) != NULL){ @@ -876,6 +888,10 @@ void *nas_nrue_task(void *args_p) case FGS_SECURITY_MODE_COMMAND: generateSecurityModeComplete(&initialNasMsg); break; + case FGS_DOWNLINK_NAS_TRANSPORT: + decodeDownlinkNASTransport(&initialNasMsg, pdu_buffer); + break; + default: LOG_W(NR_RRC,"unknow message type %d\n",msg_type); break; diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.h b/openair3/NAS/NR_UE/nr_nas_msg_sim.h index f730b20a55..348c27ecc8 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.h +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.h @@ -56,6 +56,7 @@ #define FGS_SECURITY_MODE_COMMAND 0b01011101 /* 93 = 0x5d */ #define FGS_SECURITY_MODE_COMPLETE 0b01011110 /* 94 = 0x5e */ #define FGS_UPLINK_NAS_TRANSPORT 0b01100111 /* 103= 0x67 */ +#define FGS_DOWNLINK_NAS_TRANSPORT 0b01101000 /* 104= 0x68 */ // message type for 5GS session management #define FGS_PDU_SESSION_ESTABLISHMENT_REQ 0b11000001 /* 193= 0xc1 */ From 17775c7ecc02bf09d2a78ea3ee15b0489a6c3658 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 22 Jun 2021 15:58:28 +0200 Subject: [PATCH 061/135] fix DRB bug in DL --- openair3/ocp-gtpu/gtp_itf.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index a882bc34c9..d5fe7a08ee 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -409,7 +409,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int bearer_id, teid inst->te2ue_mapping[incoming_teid].rnti=rnti; - inst->te2ue_mapping[incoming_teid].rb_id= outgoing_teid; + inst->te2ue_mapping[incoming_teid].rb_id= bearer_id; inst->te2ue_mapping[incoming_teid].callBack=callBack; @@ -545,6 +545,7 @@ int gtpv1u_update_ngu_tunnel( const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP, const rnti_t prior_rnti ) { + AssertFatal( false, "to be developped\n"); return GTPNOK; } From aa9837395e4a608e6ed5cddc03f48d7d22d8bd4a Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 23 Jun 2021 09:46:53 +0200 Subject: [PATCH 062/135] force UE DRB no integrity --- openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c | 5 +++-- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c index 6898d4ff71..1c430ce0a1 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c @@ -66,8 +66,9 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, header_size = 3; } /* SRBs always have MAC-I, even if integrity is not active */ - if (entity->has_integrity - || entity->type == NR_PDCP_SRB) { + if ( // FIXME: DRB creation is with integrity, but we don't receive it + // entity->has_integrity || + entity->type == NR_PDCP_SRB) { integrity_size = 4; } else { integrity_size = 0; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index e7d771562c..a43e36529b 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -425,7 +425,7 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size) int is_enb; /* is it SRB? */ - for (i = 0; i < 2; i++) { + for (i = 0; i < sizeofArray(ue->srb); i++) { if (entity == ue->srb[i]) { is_srb = 1; rb_id = i+1; @@ -434,7 +434,7 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size) } /* maybe DRB? */ - for (i = 0; i < 5; i++) { + for (i = 0; i < sizeofArray(ue->drb) ; i++) { if (entity == ue->drb[i]) { is_srb = 0; rb_id = i+1; From 64e58a4300a98e04028637ccf6cc19392903eede Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 23 Jun 2021 21:41:56 +0200 Subject: [PATCH 063/135] dirty fixes that fix the UL malformed packets (detected in wireshark), and also internally memory corrpution --- .../PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c | 3 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 93 ++++++------------- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 9 +- openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c | 6 +- openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c | 2 +- openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c | 2 +- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 3 +- openair2/RRC/NR_UE/rrc_UE.c | 2 +- 8 files changed, 44 insertions(+), 76 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c index 1adc81d556..d3cc8d5df4 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c @@ -40,6 +40,7 @@ #include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h" +#include //#define DEBUG_ULSCH_CODING @@ -256,7 +257,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, Ilbrm = 0; Tbslbrm = 950984; //max tbs Coderate = 0.0; - + trace_NRpdu(DIRECTION_UPLINK, harq_process->a, harq_process->pusch_pdu.pusch_data.tb_size, 0, WS_C_RNTI, 0, 0, 0,0, 0); /////////// ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 8a75406166..b06064f4c7 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2117,22 +2117,19 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, uint16_t buflen) { NR_MAC_SUBHEADER_FIXED *mac_pdu_ptr = (NR_MAC_SUBHEADER_FIXED *) pdu; - unsigned char last_size = 0, i, mac_header_control_elements[16], *ce_ptr, bsr = 0; - int mac_ce_size; - uint16_t offset = 0; LOG_D(MAC, "[UE] Generating ULSCH PDU : num_sdus %d\n", num_sdus); #ifdef DEBUG_HEADER_PARSING - for (i = 0; i < num_sdus; i++) + for (int i = 0; i < num_sdus; i++) LOG_D(MAC, "[UE] MAC subPDU %d (lcid %d length %d bytes \n", i, sdu_lcids[i], sdu_lengths[i]); #endif // Generating UL MAC subPDUs including MAC SDU and subheader - for (i = 0; i < num_sdus; i++) { + for (int i = 0; i < num_sdus; i++) { LOG_D(MAC, "[UE] Generating UL MAC subPDUs for SDU with lenght %d ( num_sdus %d )\n", sdu_lengths[i], num_sdus); if (sdu_lcids[i] != UL_SCH_LCID_CCCH){ @@ -2141,23 +2138,21 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->F = 0; ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->LCID = sdu_lcids[i]; ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->L = (unsigned char) sdu_lengths[i]; - last_size = 2; + mac_pdu_ptr += sizeof(NR_MAC_SUBHEADER_SHORT); } else { ((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->R = 0; ((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->F = 1; ((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->LCID = sdu_lcids[i]; ((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->L1 = ((unsigned short) sdu_lengths[i] >> 8) & 0x7f; ((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->L2 = (unsigned short) sdu_lengths[i] & 0xff; - last_size = 3; + mac_pdu_ptr += sizeof(NR_MAC_SUBHEADER_LONG); } } else { // UL CCCH SDU - ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->R = 0; - ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->LCID = sdu_lcids[i]; - last_size = 1; + mac_pdu_ptr->R = 0; + mac_pdu_ptr->LCID = sdu_lcids[i]; + mac_pdu_ptr ++; } - mac_pdu_ptr += last_size; - // cycle through SDUs, compute each relevant and place ulsch_buffer in memcpy((void *) mac_pdu_ptr, (void *) sdus_payload, sdu_lengths[i]); sdus_payload += sdu_lengths[i]; @@ -2166,8 +2161,6 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, // Generating UL MAC subPDUs including MAC CEs (MAC CE and subheader) - ce_ptr = &mac_header_control_elements[0]; - if (power_headroom) { // MAC CE fixed subheader mac_pdu_ptr->R = 0; @@ -2175,17 +2168,11 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, mac_pdu_ptr++; // PHR MAC CE (1 octet) - ((NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr)->PH = power_headroom; - ((NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr)->R1 = 0; - ((NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr)->PCMAX = 0; // todo - ((NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr)->R2 = 0; - - mac_ce_size = sizeof(NR_SINGLE_ENTRY_PHR_MAC_CE); - - // Copying bytes for PHR MAC CEs to the mac pdu pointer - memcpy((void *) mac_pdu_ptr, (void *) ce_ptr, mac_ce_size); - ce_ptr += mac_ce_size; - mac_pdu_ptr += (unsigned char) mac_ce_size; + ((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_pdu_ptr)->PH = power_headroom; + ((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_pdu_ptr)->R1 = 0; + ((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_pdu_ptr)->PCMAX = 0; // todo + ((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_pdu_ptr)->R2 = 0; + mac_pdu_ptr += sizeof(NR_SINGLE_ENTRY_PHR_MAC_CE); } if (crnti) { @@ -2195,13 +2182,8 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, mac_pdu_ptr++; // C-RNTI MAC CE (2 octets) - * (uint16_t *) ce_ptr = crnti; - mac_ce_size = sizeof(uint16_t); - - // Copying bytes for CRNTI MAC CE to the mac pdu pointer - memcpy((void *) mac_pdu_ptr, (void *) ce_ptr, mac_ce_size); - ce_ptr += mac_ce_size; - mac_pdu_ptr += (unsigned char) mac_ce_size; + * (uint16_t *) mac_pdu_ptr = crnti; + mac_pdu_ptr += sizeof(uint16_t); } if (truncated_bsr) { @@ -2211,11 +2193,9 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, mac_pdu_ptr++; // Short truncated BSR MAC CE (1 octet) - ((NR_BSR_SHORT_TRUNCATED *) ce_ptr)-> Buffer_size = truncated_bsr; - ((NR_BSR_SHORT_TRUNCATED *) ce_ptr)-> LcgID = 0; // todo - mac_ce_size = sizeof(NR_BSR_SHORT_TRUNCATED); - - bsr = 1 ; + ((NR_BSR_SHORT_TRUNCATED *) mac_pdu_ptr)-> Buffer_size = truncated_bsr; + ((NR_BSR_SHORT_TRUNCATED *) mac_pdu_ptr)-> LcgID = 0; // todo + mac_pdu_ptr+= sizeof(NR_BSR_SHORT_TRUNCATED); } else if (short_bsr) { // MAC CE fixed subheader mac_pdu_ptr->R = 0; @@ -2223,11 +2203,9 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, mac_pdu_ptr++; // Short truncated BSR MAC CE (1 octet) - ((NR_BSR_SHORT *) ce_ptr)->Buffer_size = short_bsr; - ((NR_BSR_SHORT *) ce_ptr)->LcgID = 0; // todo - mac_ce_size = sizeof(NR_BSR_SHORT); - - bsr = 1 ; + ((NR_BSR_SHORT *) mac_pdu_ptr)->Buffer_size = short_bsr; + ((NR_BSR_SHORT *) mac_pdu_ptr)->LcgID = 0; // todo + mac_pdu_ptr+= sizeof(NR_BSR_SHORT); } else if (long_bsr) { // MAC CE variable subheader // todo ch 6.1.3.1. TS 38.321 @@ -2243,36 +2221,19 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, // ((NR_BSR_LONG *) ce_ptr)->LCGID0 = 0; // mac_ce_size = sizeof(NR_BSR_LONG); // size is variable } - - if (bsr){ - // Copying bytes for BSR MAC CE to the mac pdu pointer - memcpy((void *) mac_pdu_ptr, (void *) ce_ptr, mac_ce_size); - ce_ptr += mac_ce_size; - mac_pdu_ptr += (unsigned char) mac_ce_size; - } - - // compute offset before adding padding (if necessary) - offset = ((unsigned char *) mac_pdu_ptr - pdu); - uint16_t padding_bytes = 0; +// compute offset before adding padding (if necessary) + int padding_bytes = 0; if(buflen > 0) // If the buflen is provided - padding_bytes = buflen - offset; - + padding_bytes = buflen + pdu - (unsigned char *) mac_pdu_ptr; + AssertFatal(padding_bytes>=0,""); // Compute final offset for padding - if (post_padding > 0 || padding_bytes>0) { + if (post_padding || padding_bytes>0) { ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->R = 0; ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->LCID = UL_SCH_LCID_PADDING; mac_pdu_ptr++; - } else { - // no MAC subPDU with padding - } - - // compute final offset - offset = ((unsigned char *) mac_pdu_ptr - pdu); - - //printf("Offset %d \n", ((unsigned char *) mac_pdu_ptr - pdu)); - - return offset; + } + return (uint8_t *)mac_pdu_ptr-pdu; } ///////////////////////////////////// diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 78178be388..61a1b54be0 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1962,7 +1962,9 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ENB_FLAG_NO, MBMS_FLAG_NO, lcid, - buflen_remain, + buflen_remain-MAX_RLC_SDU_SUBHEADER_SIZE, + //Fixme: Laurent I removed MAX_RLC_SDU_SUBHEADER_SIZE because else we get out the buffer silently + // the interface with nr_generate_ulsch_pdu() looks over complex and not CPU optimized (char *)&ulsch_sdus[sdu_length_total],0, 0); @@ -1981,9 +1983,10 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, } /* Get updated BO after multiplexing this PDU */ - lcid_buffer_occupancy_new = mac_rlc_get_buffer_occupancy_ind(module_idP,mac->crnti,eNB_index,frameP, subframe, ENB_FLAG_NO, lcid); + lcid_buffer_occupancy_new = + mac_rlc_get_buffer_occupancy_ind(module_idP,mac->crnti,eNB_index,frameP, subframe, ENB_FLAG_NO, lcid); buflen_remain = - buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE); + buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE); } } } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c index 1c430ce0a1..2717ab9a9b 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c @@ -65,9 +65,11 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, buffer[2]; header_size = 3; } + // FIXME: DRB creation is with integrity, but we don't receive it + if ( entity->type != NR_PDCP_SRB ) + entity->has_integrity=0; /* SRBs always have MAC-I, even if integrity is not active */ - if ( // FIXME: DRB creation is with integrity, but we don't receive it - // entity->has_integrity || + if ( entity->has_integrity || entity->type == NR_PDCP_SRB) { integrity_size = 4; } else { diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index 000c764e8f..08f5b11c23 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -1529,7 +1529,7 @@ static int tx_list_size(nr_rlc_entity_am_t *entity, { int ret = 0; - while (l != NULL) { + while (l != NULL && ret < maxsize) { ret += compute_pdu_header_size(entity, l) + l->size; l = l->next; } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c index 4ef952667d..f967c3c543 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c @@ -497,7 +497,7 @@ static int tx_list_size(nr_rlc_entity_um_t *entity, { int ret = 0; - while (l != NULL) { + while (l != NULL && ret < maxsize) { ret += compute_pdu_header_size(entity, l) + l->size; l = l->next; } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index a43e36529b..b2d29a88c6 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -323,7 +323,8 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind( * reports '> 81338368' (table 6.1.3.1-2). Passing 100000000 is thus * more than enough. */ - buf_stat = rb->buffer_status(rb, 100000000); + // Fixme : Laurent reduced size for CPU saving + buf_stat = rb->buffer_status(rb, 10000000); ret = buf_stat.status_size + buf_stat.retx_size + buf_stat.tx_size; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 1ac21c3584..140574e310 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1264,7 +1264,7 @@ nr_rrc_ue_process_masterCellGroup( // NSA procedures } if(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config == NULL){ - NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config = malloc(sizeof(NR_CellGroupConfig_t)); + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config = calloc(1,sizeof(NR_CellGroupConfig_t)); } From 408d05c68259411f68635a51924456b6e2d1e3cf Mon Sep 17 00:00:00 2001 From: matzakos Date: Sun, 27 Jun 2021 10:34:37 +0200 Subject: [PATCH 064/135] Configure PDCP entity for UE DRB with no integrity and ciphering to comply with configuration at gNB -To be revisited if we want to enable integrity and ciphering for DRBs --- openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c | 3 --- openair2/RRC/NR_UE/rrc_UE.c | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c index 2717ab9a9b..21e35a54a0 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c @@ -65,9 +65,6 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, buffer[2]; header_size = 3; } - // FIXME: DRB creation is with integrity, but we don't receive it - if ( entity->type != NR_PDCP_SRB ) - entity->has_integrity=0; /* SRBs always have MAC-I, even if integrity is not active */ if ( entity->has_integrity || entity->type == NR_PDCP_SRB) { diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 140574e310..b338a46e72 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -2158,8 +2158,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB NULL, radioBearerConfig->drb_ToAddModList, NULL, - NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | - (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), + 0, NULL, NULL, kUPenc, From 282fe1063e64c4f375db1f9a5b67b9130791edb4 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 30 Jun 2021 18:48:45 +0100 Subject: [PATCH 065/135] Fix build --- openair2/F1AP/dummy_enb.c | 37 +++---------------- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 1 + openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 1 + openair2/RRC/NR/rrc_gNB.c | 4 +- 4 files changed, 9 insertions(+), 34 deletions(-) diff --git a/openair2/F1AP/dummy_enb.c b/openair2/F1AP/dummy_enb.c index ee98b9ec46..fe6dfb6a06 100644 --- a/openair2/F1AP/dummy_enb.c +++ b/openair2/F1AP/dummy_enb.c @@ -20,42 +20,15 @@ */ #include "COMMON/platform_types.h" -#include "COMMON/platform_constants.h" #include "common/ran_context.h" - #include "common/utils/LOG/log.h" -#include "common/utils/LOG/vcd_signal_dumper.h" - #include "NR_BCCH-BCH-Message.h" #include "NR_ServingCellConfigCommon.h" - -#include "LAYER2/NR_MAC_gNB/mac_proto.h" -#include "SCHED_NR/phy_frame_config_nr.h" - #include "NR_MIB.h" -#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" -#include "../../../../nfapi/oai_integration/vendor_ext.h" -/* Softmodem params */ -#include "executables/softmodem-common.h" +void apply_macrlc_config(gNB_RRC_INST *rrc, + rrc_gNB_ue_context_t *const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP ) { +abort(); +} -int rrc_mac_config_req_gNB(module_id_t Mod_idP, - int ssb_SubcarrierOffset, - int pdsch_AntennaPorts, - int pusch_AntennaPorts, - NR_ServingCellConfigCommon_t *scc, - int add_ue, - uint32_t rnti, - NR_CellGroupConfig_t *CellGroup){ -abort(); -return 0; -} -rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP, - const NR_SRB_ToAddModList_t * const srb2add_listP, - const NR_DRB_ToAddModList_t * const drb2add_listP, - const NR_DRB_ToReleaseList_t * const drb2release_listP, - const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, - struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list){ -abort(); -return 0; -} diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index b438f040be..0c8f566fd6 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -1116,6 +1116,7 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, RC.nrrrc[ctxt.module_id], ctxt.rnti); + gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; if (srb_id == 0) { NR_DL_CCCH_Message_t* dl_ccch_msg=NULL; asn_dec_rval_t dec_rval; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 5d4b6316d9..5b69bbbbb5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1329,6 +1329,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra // look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially // important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them + const int bwpid = bwp ? bwp->bwp_Id : 0; const int coresetid = coreset->controlResourceSetId; nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid]; if (!pdcch_pdu_rel15) { diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 88196c385c..8ad6b5c8e6 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -414,7 +414,7 @@ void apply_pdcp_config(rrc_gNB_ue_context_t *const ue_context_pP, NULL, NULL, NULL, - ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList); + get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL); } @@ -3027,8 +3027,8 @@ int get_dl_mimo_layers(gNB_RRC_INST *rrc,NR_UE_NR_Capability_t *cap) { return(1); } void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { + MessageDef *msg; - int id; rrc_gNB_ue_context_t *ue_context_p = NULL; FILE *fd=NULL;//fopen("nrRRCstats.log","w"); RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head)) { From dcfec657df0e7abc2ff958441574abb94040e4d8 Mon Sep 17 00:00:00 2001 From: luispereira87 Date: Thu, 1 Jul 2021 15:02:59 +0100 Subject: [PATCH 066/135] Fix BWPstart and BWPsize for bwp_Dedicated --- openair1/SCHED_NR_UE/pucch_uci_ue_nr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c index 5db6935f98..2067a0c63b 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c @@ -619,9 +619,11 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ mac->ULbwp[bwp_id-1] && mac->ULbwp[bwp_id-1]->bwp_Dedicated && mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config && - mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup) - pucch_Config = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup; - else if (bwp_id==0 && + mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup) { + pucch_Config = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup; + BWPsize = NRRIV2BW(mac->ULbwp[bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth,MAX_BWP_SIZE); + BWPstart = NRRIV2PRBOFFSET(mac->ULbwp[bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth,MAX_BWP_SIZE); + } else if (bwp_id==0 && mac->cg && mac->cg->spCellConfig && mac->cg->spCellConfig->spCellConfigDedicated && From 081a2879290d6fa806a4746f7dcfc28cc5e9c255 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Fri, 2 Jul 2021 21:36:02 +0100 Subject: [PATCH 067/135] Fix gNB downlink MAC short/long header accordingly with RLC buffer size --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 45 +++++++++++++------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index f1ad5817e9..18cd8ebde4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1102,12 +1102,18 @@ void nr_schedule_ue_spec(module_id_t module_id, if (sched_ctrl->num_total_bytes > 0) { tbs_size_t len = 0; while (size > 3) { - // we do not know how much data we will get from RLC, i.e., whether it - // will be longer than 256B or not. Therefore, reserve space for long header, then - // fetch data, then fill real length - NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf; - buf += 3; - size -= 3; + + // Reserve space for short or long header. + // Check if data from RLC is equal or longer than 256B or not. + // Data from RLC was checked before, in function nr_store_dlsch_buffer + uint8_t *header = buf; + if (sched_ctrl->num_total_bytes >= 256) { + buf += sizeof(NR_MAC_SUBHEADER_LONG); + size -= sizeof(NR_MAC_SUBHEADER_LONG); + } else { + buf += sizeof(NR_MAC_SUBHEADER_SHORT); + size -= sizeof(NR_MAC_SUBHEADER_SHORT); + } /* limit requested number of bytes to what preprocessor specified, or * such that TBS is full */ @@ -1137,19 +1143,32 @@ void nr_schedule_ue_spec(module_id_t module_id, if (len == 0) break; - header->R = 0; - header->F = 1; - header->LCID = lcid; - header->L1 = (len >> 8) & 0xff; - header->L2 = len & 0xff; + if (sched_ctrl->num_total_bytes >= 256) { + ((NR_MAC_SUBHEADER_LONG *) header)->R = 0; + ((NR_MAC_SUBHEADER_LONG *) header)->F = 1; + ((NR_MAC_SUBHEADER_LONG *) header)->LCID = lcid; + ((NR_MAC_SUBHEADER_LONG *) header)->L1 = (len >> 8) & 0xff; + ((NR_MAC_SUBHEADER_LONG *) header)->L2 = len & 0xff; + } else { + ((NR_MAC_SUBHEADER_SHORT *) header)->R = 0; + ((NR_MAC_SUBHEADER_SHORT *) header)->F = 0; + ((NR_MAC_SUBHEADER_SHORT *) header)->LCID = lcid; + ((NR_MAC_SUBHEADER_SHORT *) header)->L = len & 0xff; + } + size -= len; buf += len; dlsch_total_bytes += len; } if (len == 0) { /* RLC did not have data anymore, mark buffer as unused */ - buf -= 3; - size += 3; + if (sched_ctrl->num_total_bytes >= 256) { + buf -= sizeof(NR_MAC_SUBHEADER_LONG); + size += sizeof(NR_MAC_SUBHEADER_LONG); + } else { + buf -= sizeof(NR_MAC_SUBHEADER_SHORT); + size += sizeof(NR_MAC_SUBHEADER_SHORT); + } } } else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra || get_softmodem_params()->sa) { From 88d7ad11a287721c8558482701077db80d2c27ae Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Sat, 3 Jul 2021 08:54:16 +0100 Subject: [PATCH 068/135] Improved fix gNB downlink MAC short/long header accordingly with RLC buffer size --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 18cd8ebde4..fdfc603cfa 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1101,19 +1101,21 @@ void nr_schedule_ue_spec(module_id_t module_id, int dlsch_total_bytes = 0; if (sched_ctrl->num_total_bytes > 0) { tbs_size_t len = 0; - while (size > 3) { + + // Check MAC header short/long format and size + // Check if data from RLC is equal or longer than 256B or not. + // Data from RLC was checked before, in function nr_store_dlsch_buffer + int header_size = sizeof(NR_MAC_SUBHEADER_SHORT); + if (sched_ctrl->num_total_bytes >= 256) { + header_size = sizeof(NR_MAC_SUBHEADER_LONG); + } + + while (size > header_size) { // Reserve space for short or long header. - // Check if data from RLC is equal or longer than 256B or not. - // Data from RLC was checked before, in function nr_store_dlsch_buffer uint8_t *header = buf; - if (sched_ctrl->num_total_bytes >= 256) { - buf += sizeof(NR_MAC_SUBHEADER_LONG); - size -= sizeof(NR_MAC_SUBHEADER_LONG); - } else { - buf += sizeof(NR_MAC_SUBHEADER_SHORT); - size -= sizeof(NR_MAC_SUBHEADER_SHORT); - } + buf += header_size; + size -= header_size; /* limit requested number of bytes to what preprocessor specified, or * such that TBS is full */ @@ -1143,7 +1145,7 @@ void nr_schedule_ue_spec(module_id_t module_id, if (len == 0) break; - if (sched_ctrl->num_total_bytes >= 256) { + if (header_size == sizeof(NR_MAC_SUBHEADER_LONG)) { ((NR_MAC_SUBHEADER_LONG *) header)->R = 0; ((NR_MAC_SUBHEADER_LONG *) header)->F = 1; ((NR_MAC_SUBHEADER_LONG *) header)->LCID = lcid; @@ -1162,13 +1164,8 @@ void nr_schedule_ue_spec(module_id_t module_id, } if (len == 0) { /* RLC did not have data anymore, mark buffer as unused */ - if (sched_ctrl->num_total_bytes >= 256) { - buf -= sizeof(NR_MAC_SUBHEADER_LONG); - size += sizeof(NR_MAC_SUBHEADER_LONG); - } else { - buf -= sizeof(NR_MAC_SUBHEADER_SHORT); - size += sizeof(NR_MAC_SUBHEADER_SHORT); - } + buf -= header_size; + size += header_size; } } else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra || get_softmodem_params()->sa) { From 5da8195d232d50b859e0005838dc3b7cc5854846 Mon Sep 17 00:00:00 2001 From: Luis Pereira Date: Tue, 6 Jul 2021 09:44:03 +0000 Subject: [PATCH 069/135] Revert "Improved fix gNB downlink MAC short/long header accordingly with RLC buffer size" This reverts commit 88d7ad11a287721c8558482701077db80d2c27ae --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index fdfc603cfa..18cd8ebde4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1101,21 +1101,19 @@ void nr_schedule_ue_spec(module_id_t module_id, int dlsch_total_bytes = 0; if (sched_ctrl->num_total_bytes > 0) { tbs_size_t len = 0; - - // Check MAC header short/long format and size - // Check if data from RLC is equal or longer than 256B or not. - // Data from RLC was checked before, in function nr_store_dlsch_buffer - int header_size = sizeof(NR_MAC_SUBHEADER_SHORT); - if (sched_ctrl->num_total_bytes >= 256) { - header_size = sizeof(NR_MAC_SUBHEADER_LONG); - } - - while (size > header_size) { + while (size > 3) { // Reserve space for short or long header. + // Check if data from RLC is equal or longer than 256B or not. + // Data from RLC was checked before, in function nr_store_dlsch_buffer uint8_t *header = buf; - buf += header_size; - size -= header_size; + if (sched_ctrl->num_total_bytes >= 256) { + buf += sizeof(NR_MAC_SUBHEADER_LONG); + size -= sizeof(NR_MAC_SUBHEADER_LONG); + } else { + buf += sizeof(NR_MAC_SUBHEADER_SHORT); + size -= sizeof(NR_MAC_SUBHEADER_SHORT); + } /* limit requested number of bytes to what preprocessor specified, or * such that TBS is full */ @@ -1145,7 +1143,7 @@ void nr_schedule_ue_spec(module_id_t module_id, if (len == 0) break; - if (header_size == sizeof(NR_MAC_SUBHEADER_LONG)) { + if (sched_ctrl->num_total_bytes >= 256) { ((NR_MAC_SUBHEADER_LONG *) header)->R = 0; ((NR_MAC_SUBHEADER_LONG *) header)->F = 1; ((NR_MAC_SUBHEADER_LONG *) header)->LCID = lcid; @@ -1164,8 +1162,13 @@ void nr_schedule_ue_spec(module_id_t module_id, } if (len == 0) { /* RLC did not have data anymore, mark buffer as unused */ - buf -= header_size; - size += header_size; + if (sched_ctrl->num_total_bytes >= 256) { + buf -= sizeof(NR_MAC_SUBHEADER_LONG); + size += sizeof(NR_MAC_SUBHEADER_LONG); + } else { + buf -= sizeof(NR_MAC_SUBHEADER_SHORT); + size += sizeof(NR_MAC_SUBHEADER_SHORT); + } } } else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra || get_softmodem_params()->sa) { From 6cc98eba85121a27aadb9b233926f7ec5ce3c721 Mon Sep 17 00:00:00 2001 From: Luis Pereira Date: Tue, 6 Jul 2021 09:44:37 +0000 Subject: [PATCH 070/135] Revert "Fix gNB downlink MAC short/long header accordingly with RLC buffer size" This reverts commit 081a2879290d6fa806a4746f7dcfc28cc5e9c255 --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 45 ++++++------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 18cd8ebde4..f1ad5817e9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1102,18 +1102,12 @@ void nr_schedule_ue_spec(module_id_t module_id, if (sched_ctrl->num_total_bytes > 0) { tbs_size_t len = 0; while (size > 3) { - - // Reserve space for short or long header. - // Check if data from RLC is equal or longer than 256B or not. - // Data from RLC was checked before, in function nr_store_dlsch_buffer - uint8_t *header = buf; - if (sched_ctrl->num_total_bytes >= 256) { - buf += sizeof(NR_MAC_SUBHEADER_LONG); - size -= sizeof(NR_MAC_SUBHEADER_LONG); - } else { - buf += sizeof(NR_MAC_SUBHEADER_SHORT); - size -= sizeof(NR_MAC_SUBHEADER_SHORT); - } + // we do not know how much data we will get from RLC, i.e., whether it + // will be longer than 256B or not. Therefore, reserve space for long header, then + // fetch data, then fill real length + NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf; + buf += 3; + size -= 3; /* limit requested number of bytes to what preprocessor specified, or * such that TBS is full */ @@ -1143,32 +1137,19 @@ void nr_schedule_ue_spec(module_id_t module_id, if (len == 0) break; - if (sched_ctrl->num_total_bytes >= 256) { - ((NR_MAC_SUBHEADER_LONG *) header)->R = 0; - ((NR_MAC_SUBHEADER_LONG *) header)->F = 1; - ((NR_MAC_SUBHEADER_LONG *) header)->LCID = lcid; - ((NR_MAC_SUBHEADER_LONG *) header)->L1 = (len >> 8) & 0xff; - ((NR_MAC_SUBHEADER_LONG *) header)->L2 = len & 0xff; - } else { - ((NR_MAC_SUBHEADER_SHORT *) header)->R = 0; - ((NR_MAC_SUBHEADER_SHORT *) header)->F = 0; - ((NR_MAC_SUBHEADER_SHORT *) header)->LCID = lcid; - ((NR_MAC_SUBHEADER_SHORT *) header)->L = len & 0xff; - } - + header->R = 0; + header->F = 1; + header->LCID = lcid; + header->L1 = (len >> 8) & 0xff; + header->L2 = len & 0xff; size -= len; buf += len; dlsch_total_bytes += len; } if (len == 0) { /* RLC did not have data anymore, mark buffer as unused */ - if (sched_ctrl->num_total_bytes >= 256) { - buf -= sizeof(NR_MAC_SUBHEADER_LONG); - size += sizeof(NR_MAC_SUBHEADER_LONG); - } else { - buf -= sizeof(NR_MAC_SUBHEADER_SHORT); - size += sizeof(NR_MAC_SUBHEADER_SHORT); - } + buf -= 3; + size += 3; } } else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra || get_softmodem_params()->sa) { From 2cea4c4c87135cf58d5780863b1d3ab095a97367 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Tue, 6 Jul 2021 10:57:32 +0100 Subject: [PATCH 071/135] Compute TBS and rbSize considering always MAC long header --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index f1ad5817e9..08cd9df89c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -691,8 +691,7 @@ void pf_dl(module_id_t module_id, sched_pdsch->pucch_allocation = alloc; uint32_t TBS = 0; uint16_t rbSize; - const int oh = 2 + (sched_ctrl->num_total_bytes >= 256) - + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); + const int oh = 3 + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); nr_find_nb_rb(sched_pdsch->Qm, sched_pdsch->R, ps->nrOfSymbols, From 06a8ec98934cd9f0420f054d7ed415aa51fc3fef Mon Sep 17 00:00:00 2001 From: luispereira87 Date: Tue, 6 Jul 2021 20:33:18 +0100 Subject: [PATCH 072/135] Temporary fix: avoid mixed slots in initialUplinkBWP --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 9ed57353ed..b0c5fe2f4a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1201,6 +1201,10 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t if (!is_xlsch_in_slot(nr_mac->ulsch_slot_bitmap[sched_slot / 64], sched_slot)) return false; + // FIXME: Uplink is failing - Avoid mixed slots in initialUplinkBWP + if ((sched_ctrl->active_ubwp == NULL) && (sched_slot == 7 || sched_slot == 17)) + return false; + sched_ctrl->sched_pusch.slot = sched_slot; sched_ctrl->sched_pusch.frame = sched_frame; for (UE_id = UE_info->list.next[UE_id]; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { From 214b44885daf4548ad2c1cbded719564010d66f4 Mon Sep 17 00:00:00 2001 From: Luis Pereira Date: Wed, 7 Jul 2021 15:27:38 +0000 Subject: [PATCH 073/135] Revert "Temporary fix: avoid mixed slots in initialUplinkBWP" This reverts commit 06a8ec98934cd9f0420f054d7ed415aa51fc3fef --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index b0c5fe2f4a..9ed57353ed 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1201,10 +1201,6 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t if (!is_xlsch_in_slot(nr_mac->ulsch_slot_bitmap[sched_slot / 64], sched_slot)) return false; - // FIXME: Uplink is failing - Avoid mixed slots in initialUplinkBWP - if ((sched_ctrl->active_ubwp == NULL) && (sched_slot == 7 || sched_slot == 17)) - return false; - sched_ctrl->sched_pusch.slot = sched_slot; sched_ctrl->sched_pusch.frame = sched_frame; for (UE_id = UE_info->list.next[UE_id]; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { From 65bf29eecc4c23ba5c4a5c5458c1b79ab3104ee0 Mon Sep 17 00:00:00 2001 From: luispereira87 Date: Wed, 7 Jul 2021 16:34:29 +0100 Subject: [PATCH 074/135] Fix uplink retransmission information --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 9ed57353ed..465994e532 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -847,16 +847,6 @@ bool allocate_ul_retransmission(module_id_t module_id, NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_sched_pusch_t *retInfo = &sched_ctrl->ul_harq_processes[harq_pid].sched_pusch; - NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; - - // frame/slot in sched_pusch has been set previously. In the following, we - // overwrite the information in the retransmission information before storing - // as the new scheduling instruction - retInfo->frame = sched_ctrl->sched_pusch.frame; - retInfo->slot = sched_ctrl->sched_pusch.slot; - - // Get previous PUSCH filed info - sched_ctrl->sched_pusch = *retInfo; NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters : &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; int rbStart = sched_ctrl->active_ubwp ? NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE) : 0; @@ -924,6 +914,15 @@ bool allocate_ul_retransmission(module_id_t module_id, return false; } + /* frame/slot in sched_pusch has been set previously. In the following, we + * overwrite the information in the retransmission information before storing + * as the new scheduling instruction */ + retInfo->frame = sched_ctrl->sched_pusch.frame; + retInfo->slot = sched_ctrl->sched_pusch.slot; + /* Get previous PSUCH field info */ + sched_ctrl->sched_pusch = *retInfo; + NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; + LOG_D(MAC, "%4d.%2d Allocate UL retransmission UE %d/RNTI %04x sched %4d.%2d (%d RBs)\n", frame, From 8743f58d231df175206e260d9b1d78472829b7d6 Mon Sep 17 00:00:00 2001 From: luispereira87 Date: Wed, 7 Jul 2021 18:25:31 +0100 Subject: [PATCH 075/135] Improve schedule msg3 and fix tda for mixed slots --- .../gnb.band78.sa.fr1.106PRB.usrpb210.conf | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 15 +++++++++------ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 +- .../CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf | 6 +++--- .../CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf | 6 +++--- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf index 494be845a6..f2da2e9fe3 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf @@ -142,7 +142,7 @@ gNBs = initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - initialULBWPstartSymbolAndLength_1 = 69; # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 52; # this is SS=10 L=4 initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 5b69bbbbb5..014ebdbdd5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -704,21 +704,24 @@ void nr_get_Msg3alloc(module_id_t module_id, ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList: scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + uint8_t k2 = 0; for (int i=0; ilist.count; i++) { startSymbolAndLength = pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols); // we want to transmit in the uplink symbols of mixed slot if (NrOfSymbols == scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols) { - ra->Msg3_tda_id = i; - break; + k2 = *pusch_TimeDomainAllocationList->list.array[i]->k2; + temp_slot = current_slot + k2 + DELTA[mu]; // msg3 slot according to 8.3 in 38.213 + ra->Msg3_slot = temp_slot%nr_slots_per_frame[mu]; + if (is_xlsch_in_slot(RC.nrmac[module_id]->ulsch_slot_bitmap[ra->Msg3_slot / 64], ra->Msg3_slot)) { + ra->Msg3_tda_id = i; + break; + } } } + AssertFatal(ra->Msg3_tda_id<16,"Unable to find Msg3 time domain allocation in list\n"); - uint8_t k2 = *pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->k2; - - temp_slot = current_slot + k2 + DELTA[mu]; // msg3 slot according to 8.3 in 38.213 - ra->Msg3_slot = temp_slot%nr_slots_per_frame[mu]; if (nr_slots_per_frame[mu]>temp_slot) ra->Msg3_frame = current_frame; else diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 465994e532..cfd032e3d8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -969,7 +969,7 @@ void pf_ul(module_id_t module_id, gNB_MAC_INST *nrmac = RC.nrmac[module_id]; NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon; NR_UE_info_t *UE_info = &nrmac->UE_info; - const int min_rb = 5; + const int min_rb = 16; float coeff_ue[MAX_MOBILES_PER_GNB]; // UEs that could be scheduled int ue_array[MAX_MOBILES_PER_GNB]; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index 00c92d75a2..164830f97b 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -1,4 +1,4 @@ -Active_gNBs = ( "gNB-Eurecom-DU"); +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; @@ -7,7 +7,7 @@ gNBs = { ////////// Identification parameters: gNB_ID = 0xe00; - gNB_name = "gNB-Eurecom-DU"; + gNB_name = "gNB-Eurecom-5GNRBox"; // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; @@ -142,7 +142,7 @@ gNBs = initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - initialULBWPstartSymbolAndLength_1 = 69; # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 52; # this is SS=10 L=4 initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index bd0678e344..1ec5f74cfb 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -1,4 +1,4 @@ -Active_gNBs = ( "gNB-Eurecom-DU"); +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; @@ -7,7 +7,7 @@ gNBs = { ////////// Identification parameters: gNB_ID = 0xe00; - gNB_name = "gNB-Eurecom-DU"; + gNB_name = "gNB-Eurecom-5GNRBox"; // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; @@ -142,7 +142,7 @@ gNBs = initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - initialULBWPstartSymbolAndLength_1 = 69; # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 52; # this is SS=10 L=4 initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; From 38e3517029bacd706fc75290c9e3c664d989ca2e Mon Sep 17 00:00:00 2001 From: luispereira87 Date: Wed, 7 Jul 2021 19:11:33 +0100 Subject: [PATCH 076/135] Fix build warning --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 5 ++++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 014ebdbdd5..68d62e910a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -697,7 +697,10 @@ void nr_get_Msg3alloc(module_id_t module_id, int mu = ubwp ? ubwp->bwp_Common->genericParameters.subcarrierSpacing : scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; - int StartSymbolIndex, NrOfSymbols, startSymbolAndLength, temp_slot; + int StartSymbolIndex = 0; + int NrOfSymbols = 0; + int startSymbolAndLength = 0; + int temp_slot = 0; ra->Msg3_tda_id = 16; // initialization to a value above limit NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList= ubwp ? diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index cfd032e3d8..4f007aec50 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -969,7 +969,7 @@ void pf_ul(module_id_t module_id, gNB_MAC_INST *nrmac = RC.nrmac[module_id]; NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon; NR_UE_info_t *UE_info = &nrmac->UE_info; - const int min_rb = 16; + const int min_rb = 20; float coeff_ue[MAX_MOBILES_PER_GNB]; // UEs that could be scheduled int ue_array[MAX_MOBILES_PER_GNB]; From 9c571bd933e8764a7acd94d8c28c6cdaf5d5663e Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 8 Jul 2021 18:38:49 +0100 Subject: [PATCH 077/135] Fix segmentation fault in nr-ru --- executables/nr-ru.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 40c20fc8b1..088c636c7a 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -746,9 +746,9 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { // currently we switch beams every 10 slots (should = 1 TDD period in FR2) and we take the beam index of the first symbol of the first slot of this period int beam=0; if (slot%10==0) { - if (ru->common.beam_id[0][slot*fp->symbols_per_slot] < 8) { - beam = ru->common.beam_id[0][slot*fp->symbols_per_slot] | 8; - } + if ( ru->common.beam_id && (ru->common.beam_id[0][slot*fp->symbols_per_slot] < 8)) { + beam = ru->common.beam_id[0][slot*fp->symbols_per_slot] | 8; + } } /* if (slot==0 || slot==40) beam=0|8; From 7821a12998df2cbb0c0d348a925f50d005bd87a6 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 8 Jul 2021 19:57:03 +0100 Subject: [PATCH 078/135] Fix is_xlsch_in_slot --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index e32e01cc89..d9e9b9d8f3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -341,7 +341,7 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { if (slot>64) return false; //quickfix for FR2 where there are more than 64 slots (bitmap to be removed) - return (bitmap >> slot) & 0x01; + return (bitmap & (1 << (slot % 64))) != 0; } void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, From b19d39682861d569d0574d86de520a39bf83ba46 Mon Sep 17 00:00:00 2001 From: Roberto Louro Magueta Date: Fri, 9 Jul 2021 11:34:01 +0000 Subject: [PATCH 079/135] Revert "Fix is_xlsch_in_slot" This reverts commit 7821a12998df2cbb0c0d348a925f50d005bd87a6 --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index d9e9b9d8f3..e32e01cc89 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -341,7 +341,7 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { if (slot>64) return false; //quickfix for FR2 where there are more than 64 slots (bitmap to be removed) - return (bitmap & (1 << (slot % 64))) != 0; + return (bitmap >> slot) & 0x01; } void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, From 3c9ca36651e45df9635a41a0276d815e1a8eff1b Mon Sep 17 00:00:00 2001 From: rmagueta Date: Fri, 9 Jul 2021 13:22:30 +0100 Subject: [PATCH 080/135] Fix fill slot bitmap for FR2 --- openair2/LAYER2/NR_MAC_gNB/config.c | 8 ++++---- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 87cc7851ff..9428853037 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -489,12 +489,12 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, /* FIXME: it seems there is a problem with slot 0/10/slots right after UL: * we just get retransmissions. Thus, do not schedule such slots in DL */ if (slot % nr_slots_period != 0) - RC.nrmac[Mod_idP]->dlsch_slot_bitmap[slot / 64] |= ((slot % nr_slots_period) < nr_dlmix_slots) << (slot % 64); - RC.nrmac[Mod_idP]->ulsch_slot_bitmap[slot / 64] |= ((slot % nr_slots_period) >= nr_ulstart_slot) << (slot % 64); + RC.nrmac[Mod_idP]->dlsch_slot_bitmap[slot / 64] |= (uint64_t)((slot % nr_slots_period) < nr_dlmix_slots) << (slot % 64); + RC.nrmac[Mod_idP]->ulsch_slot_bitmap[slot / 64] |= (uint64_t)((slot % nr_slots_period) >= nr_ulstart_slot) << (slot % 64); LOG_D(NR_MAC, "slot %d DL %d UL %d\n", slot, - (RC.nrmac[Mod_idP]->dlsch_slot_bitmap[slot / 64] & (1 << (slot % 64))) != 0, - (RC.nrmac[Mod_idP]->ulsch_slot_bitmap[slot / 64] & (1 << (slot % 64))) != 0); + (RC.nrmac[Mod_idP]->dlsch_slot_bitmap[slot / 64] & ((uint64_t)1 << (slot % 64))) != 0, + (RC.nrmac[Mod_idP]->ulsch_slot_bitmap[slot / 64] & ((uint64_t)1 << (slot % 64))) != 0); } if (get_softmodem_params()->phy_test) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index e32e01cc89..3a704c2093 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -340,7 +340,7 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { - if (slot>64) return false; //quickfix for FR2 where there are more than 64 slots (bitmap to be removed) + if (slot>=64) return false; //quickfix for FR2 where there are more than 64 slots (bitmap to be removed) return (bitmap >> slot) & 0x01; } From ba122c9cb429a7f10100c787de8abedd81729400 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Fri, 9 Jul 2021 15:59:19 +0100 Subject: [PATCH 081/135] Fix max_association_period for FDD --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 68d62e910a..fa4a8d9bdb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -215,7 +215,7 @@ void find_SSB_and_RO_available(module_id_t module_idP) { } cc->total_prach_occasions_per_config_period = total_RA_occasions; - for(int i=1; (1 << (i-1)) < max_association_period; i++) { + for(int i=1; (1 << (i-1)) <= max_association_period; i++) { cc->max_association_period = (1 <<(i-1)); total_RA_occasions = total_RA_occasions * cc->max_association_period; if(total_RA_occasions >= (int) (num_active_ssb/num_ssb_per_RO)) { From 02e20e9021fa024cc335cc687490776941048ee8 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Fri, 9 Jul 2021 20:18:49 +0100 Subject: [PATCH 082/135] Fix frequencyDomainResources for coreset0 --- openair2/RRC/NR/rrc_gNB_reconfig.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index f3241e3185..b7e9c7c467 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -61,8 +61,15 @@ void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0, NR_ServingCellC // frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B, if(coreset0->frequencyDomainResources.buf == NULL) coreset0->frequencyDomainResources.buf = calloc(1,6); - coreset0->frequencyDomainResources.buf[0] = 0xff; - coreset0->frequencyDomainResources.buf[1] = 0; + int curr_bwp = NRRIV2BW(servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + if (curr_bwp < 48) + coreset0->frequencyDomainResources.buf[0] = 0xf0; + else + coreset0->frequencyDomainResources.buf[0] = 0xff; + if (curr_bwp < 96) + coreset0->frequencyDomainResources.buf[1] = 0; + else + coreset0->frequencyDomainResources.buf[1] = 0xff; coreset0->frequencyDomainResources.buf[2] = 0; coreset0->frequencyDomainResources.buf[3] = 0; coreset0->frequencyDomainResources.buf[4] = 0; From af0d7dabbae7a7fa441ff8ebeac92e32955c8421 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Fri, 9 Jul 2021 20:32:54 +0100 Subject: [PATCH 083/135] Temporary fix for prach_thres --- openair2/GNB_APP/L1_nr_paramdef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/GNB_APP/L1_nr_paramdef.h b/openair2/GNB_APP/L1_nr_paramdef.h index fd22e92730..8a41ac8a88 100644 --- a/openair2/GNB_APP/L1_nr_paramdef.h +++ b/openair2/GNB_APP/L1_nr_paramdef.h @@ -66,7 +66,7 @@ {CONFIG_STRING_L1_REMOTE_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:100, TYPE_UINT, 0}, \ -{CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:200, TYPE_UINT, 0}, \ +{CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:250, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:50, TYPE_UINT, 0} \ } #define L1_CC_IDX 0 From 389a8e58be481a0861db2ba4c5c1e97cd8ef8476 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Sat, 10 Jul 2021 02:17:36 +0100 Subject: [PATCH 084/135] Revert security_mode for phy-test --- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 8b46bc9c5f..2f16abfe80 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -1032,7 +1032,7 @@ void nr_DRB_preconfiguration(uint16_t crnti) (NR_SRB_ToAddModList_t *) NULL, rbconfig->drb_ToAddModList , rbconfig->drb_ToReleaseList, - 0xff, + 0, NULL, NULL, NULL, From bc528d0c73efde5df057181b297cff7ea8f30913 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 12 Jul 2021 13:22:38 +0200 Subject: [PATCH 085/135] fix wireshark interface headers --- openair2/UTIL/OPT/opt.h | 7 +- openair2/UTIL/OPT/packet-mac-lte.h | 299 --------- openair2/UTIL/OPT/packet-mac-nr.h | 142 ---- openair2/UTIL/OPT/packet-pdcp-lte.h | 172 ----- openair2/UTIL/OPT/packet-pdcp-nr.h | 168 ----- openair2/UTIL/OPT/packet-rlc-lte.h | 151 ----- openair2/UTIL/OPT/packet-rlc-nr.h | 136 ---- openair2/UTIL/OPT/wireshark_headers.h | 895 ++++++++++++++++++++++++++ 8 files changed, 896 insertions(+), 1074 deletions(-) delete mode 100644 openair2/UTIL/OPT/packet-mac-lte.h delete mode 100644 openair2/UTIL/OPT/packet-mac-nr.h delete mode 100644 openair2/UTIL/OPT/packet-pdcp-lte.h delete mode 100644 openair2/UTIL/OPT/packet-pdcp-nr.h delete mode 100644 openair2/UTIL/OPT/packet-rlc-lte.h delete mode 100644 openair2/UTIL/OPT/packet-rlc-nr.h create mode 100644 openair2/UTIL/OPT/wireshark_headers.h diff --git a/openair2/UTIL/OPT/opt.h b/openair2/UTIL/OPT/opt.h index a3a790cf97..ae6a3eb2a6 100644 --- a/openair2/UTIL/OPT/opt.h +++ b/openair2/UTIL/OPT/opt.h @@ -59,12 +59,7 @@ typedef uint16_t guint16; typedef uint32_t guint32; typedef guint8 gboolean; -#include "packet-mac-lte.h" -#include "packet-rlc-lte.h" -#include "packet-pdcp-lte.h" -#include "packet-mac-nr.h" -#include "packet-rlc-nr.h" -#include "packet-pdcp-nr.h" +#include #include "mac_pcap.h" diff --git a/openair2/UTIL/OPT/packet-mac-lte.h b/openair2/UTIL/OPT/packet-mac-lte.h deleted file mode 100644 index 33e987c4ab..0000000000 --- a/openair2/UTIL/OPT/packet-mac-lte.h +++ /dev/null @@ -1,299 +0,0 @@ -/* packet-mac-lte.h - * - * Martin Mathieson - * - * Wireshark - Network traffic analyzer - * By Gerald Combs - * Copyright 1998 Gerald Combs - * - * SPDX-License-Identifier: GPL-2.0-or-later - * - * This header file may also be distributed under - * the terms of the BSD Licence as follows: - * - * Copyright (C) 2009 Martin Mathieson. All rights reserved. - * - * SPDX-License-Identifier: BSD-2-Clause - */ - - /* - this is wireshark, commit: commit eda834b6e29c36e05a63a6056afa98390ff79357 - Date: Wed Aug 22 14:36:20 2018 +0200 - modified to be used in OpenAir to create the LTE MAC/RLC encapsulated in UDP as per Wireshark feature - */ - -#ifndef __UTIL_OPT_PACKET_MAC_LTE__H__ -#define __UTIL_OPT_PACKET_MAC_LTE__H__ - -#include "ws_symbol_export.h" - -/** data structure to hold time values with nanosecond resolution*/ -typedef struct { - time_t secs; - int nsecs; -} nstime_t; - - -/* radioType */ -#define FDD_RADIO 1 -#define TDD_RADIO 2 - -/* Direction */ -#define DIRECTION_UPLINK 0 -#define DIRECTION_DOWNLINK 1 - -/* rntiType */ -#define WS_NO_RNTI 0 -#define WS_P_RNTI 1 -#define WS_RA_RNTI 2 -#define WS_C_RNTI 3 -#define WS_SI_RNTI 4 -#define WS_SPS_RNTI 5 -#define WS_M_RNTI 6 -#define WS_SL_BCH_RNTI 7 -#define WS_SL_RNTI 8 -#define WS_SC_RNTI 9 -#define WS_G_RNTI 10 - -typedef enum mac_lte_oob_event { - ltemac_send_preamble, - ltemac_send_sr, - ltemac_sr_failure -} mac_lte_oob_event; - -typedef enum mac_lte_dl_retx { - dl_retx_no, - dl_retx_yes, - dl_retx_unknown -} mac_lte_dl_retx; - -typedef enum mac_lte_crc_status { - crc_fail = 0, - crc_success = 1, - crc_high_code_rate = 2, - crc_pdsch_lost = 3, - crc_duplicate_nonzero_rv = 4, - crc_false_dci = 5 -} mac_lte_crc_status; - -/* N.B. for SCellIndex-r13 extends to 31 */ -typedef enum mac_lte_carrier_id { - carrier_id_primary, - carrier_id_secondary_1, - carrier_id_secondary_2, - carrier_id_secondary_3, - carrier_id_secondary_4, - carrier_id_secondary_5, - carrier_id_secondary_6, - carrier_id_secondary_7 -} mac_lte_carrier_id; - -typedef enum mac_lte_ce_mode { - no_ce_mode = 0, - ce_mode_a = 1, - ce_mode_b = 2 -} mac_lte_ce_mode; - -typedef enum mac_lte_nb_mode { - no_nb_mode = 0, - nb_mode = 1 -} mac_lte_nb_mode; - -/* Context info attached to each LTE MAC frame */ -typedef struct mac_lte_info -{ - /* Needed for decode */ - guint8 radioType; - guint8 direction; - guint8 rntiType; - - /* Extra info to display */ - guint16 rnti; - guint16 ueid; - - /* Timing info */ - guint16 sysframeNumber; - guint16 subframeNumber; - gboolean sfnSfInfoPresent; - - /* Optional field. More interesting for TDD (FDD is always -4 subframeNumber) */ - gboolean subframeNumberOfGrantPresent; - guint16 subframeNumberOfGrant; - - /* Flag set only if doing PHY-level data test - i.e. there may not be a - well-formed MAC PDU so just show as raw data */ - gboolean isPredefinedData; - - /* Length of DL PDU or UL grant size in bytes */ - guint16 length; - - /* 0=newTx, 1=first-retx, etc */ - guint8 reTxCount; - guint8 isPHICHNACK; /* FALSE=PDCCH retx grant, TRUE=PHICH NACK */ - - /* UL only. Indicates if the R10 extendedBSR-Sizes parameter is set */ - gboolean isExtendedBSRSizes; - - /* UL only. Indicates if the R10 simultaneousPUCCH-PUSCH parameter is set for PCell */ - gboolean isSimultPUCCHPUSCHPCell; - - /* UL only. Indicates if the R10 extendedBSR-Sizes parameter is set for PSCell */ - gboolean isSimultPUCCHPUSCHPSCell; - - /* Status of CRC check. For UE it is DL only. For eNodeB it is UL - only. For an analyzer, it is present for both DL and UL. */ - gboolean crcStatusValid; - mac_lte_crc_status crcStatus; - - /* Carrier ID */ - mac_lte_carrier_id carrierId; - - /* DL only. Is this known to be a retransmission? */ - mac_lte_dl_retx dl_retx; - - /* DL only. CE mode to be used for RAR decoding */ - mac_lte_ce_mode ceMode; - - /* DL and UL. NB-IoT mode of the UE */ - mac_lte_nb_mode nbMode; - - /* UL only, for now used for CE mode A RAR decoding */ - guint8 nUlRb; - - /* More Physical layer info (see direction above for which side of union to use) */ - union { - struct mac_lte_ul_phy_info - { - guint8 present; /* Remaining UL fields are present and should be displayed */ - guint8 modulation_type; - guint8 tbs_index; - guint8 resource_block_length; - guint8 resource_block_start; - guint8 harq_id; - gboolean ndi; - } ul_info; - struct mac_lte_dl_phy_info - { - guint8 present; /* Remaining DL fields are present and should be displayed */ - guint8 dci_format; - guint8 resource_allocation_type; - guint8 aggregation_level; - guint8 mcs_index; - guint8 redundancy_version_index; - guint8 resource_block_length; - guint8 harq_id; - gboolean ndi; - guint8 transport_block; /* 0..1 */ - } dl_info; - } detailed_phy_info; - - /* Relating to out-of-band events */ - /* N.B. dissector will only look to these fields if length is 0... */ - mac_lte_oob_event oob_event; - guint8 rapid; - guint8 rach_attempt_number; - #define MAX_SRs 20 - guint16 number_of_srs; - guint16 oob_ueid[MAX_SRs]; - guint16 oob_rnti[MAX_SRs]; -} mac_lte_info; - - /* 0 to 10 and 32 to 38 */ -#define MAC_LTE_DATA_LCID_COUNT_MAX 18 - - - - -/* Accessor function to check if a frame was considered to be ReTx */ - -/**********************************************************************/ -/* UDP framing format */ -/* ----------------------- */ -/* Several people have asked about dissecting MAC by framing */ -/* PDUs over IP. A suggested format over UDP has been created */ -/* and implemented by this dissector, using the definitions */ -/* below. A link to an example program showing you how to encode */ -/* these headers and send LTE MAC PDUs on a UDP socket is */ -/* provided at https://gitlab.com/wireshark/wireshark/-/wikis/MAC-LTE */ -/* */ -/* A heuristic dissector (enabled by a preference) will */ -/* recognise a signature at the beginning of these frames. */ -/**********************************************************************/ - - -/* Signature. Rather than try to define a port for this, or make the - port number a preference, frames will start with this string (with no - terminating NULL */ -#define MAC_LTE_START_STRING "mac-lte" - -/* Fixed fields. This is followed by the following 3 mandatory fields: - - radioType (1 byte) - - direction (1 byte) - - rntiType (1 byte) - (where the allowed values are defined above */ - -/* Optional fields. Attaching this info to frames will allow you - to show you display/filter/plot/add-custom-columns on these fields, so should - be added if available. - The format is to have the tag, followed by the value (there is no length field, - it's implicit from the tag) */ - -#define MAC_LTE_RNTI_TAG 0x02 -/* 2 bytes, network order */ - -#define MAC_LTE_UEID_TAG 0x03 -/* 2 bytes, network order */ - -#define MAC_LTE_FRAME_SUBFRAME_TAG 0x04 -/* 2 bytes, network order, SFN is stored in 12 MSB and SF in 4 LSB */ - -#define MAC_LTE_PREDEFINED_DATA_TAG 0x05 -/* 1 byte */ - -#define MAC_LTE_RETX_TAG 0x06 -/* 1 byte */ - -#define MAC_LTE_CRC_STATUS_TAG 0x07 -/* 1 byte */ - -#define MAC_LTE_EXT_BSR_SIZES_TAG 0x08 -/* 0 byte */ - -#define MAC_LTE_SEND_PREAMBLE_TAG 0x09 -/* 2 bytes, RAPID value (1 byte) followed by RACH attempt number (1 byte) */ - -#define MAC_LTE_CARRIER_ID_TAG 0x0A -/* 1 byte */ - -#define MAC_LTE_PHY_TAG 0x0B -/* variable length, length (1 byte) then depending on direction - in UL: modulation type (1 byte), TBS index (1 byte), RB length (1 byte), - RB start (1 byte), HARQ id (1 byte), NDI (1 byte) - in DL: DCI format (1 byte), resource allocation type (1 byte), aggregation level (1 byte), - MCS index (1 byte), redundancy version (1 byte), resource block length (1 byte), - HARQ id (1 byte), NDI (1 byte), TB (1 byte), DL reTx (1 byte) */ - -#define MAC_LTE_SIMULT_PUCCH_PUSCH_PCELL_TAG 0x0C -/* 0 byte */ - -#define MAC_LTE_SIMULT_PUCCH_PUSCH_PSCELL_TAG 0x0D -/* 0 byte */ - -#define MAC_LTE_CE_MODE_TAG 0x0E -/* 1 byte containing mac_lte_ce_mode enum value */ - -#define MAC_LTE_NB_MODE_TAG 0x0F -/* 1 byte containing mac_lte_nb_mode enum value */ - -#define MAC_LTE_N_UL_RB_TAG 0x10 -/* 1 byte containing the number of UL resource blocks: 6, 15, 25, 50, 75 or 100 */ - -#define MAC_LTE_SR_TAG 0x11 -/* 2 bytes for the number of items, followed by that number of ueid, rnti (2 bytes each) */ - - -/* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU - continues until the end of the frame) */ -#define MAC_LTE_PAYLOAD_TAG 0x01 - -#endif diff --git a/openair2/UTIL/OPT/packet-mac-nr.h b/openair2/UTIL/OPT/packet-mac-nr.h deleted file mode 100644 index 8a1627a8ef..0000000000 --- a/openair2/UTIL/OPT/packet-mac-nr.h +++ /dev/null @@ -1,142 +0,0 @@ -/* packet-mac-nr.h - * - * Martin Mathieson - * - * Wireshark - Network traffic analyzer - * By Gerald Combs - * Copyright 1998 Gerald Combs - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -/* radioType */ -#define FDD_RADIO 1 -#define TDD_RADIO 2 - -/* Direction */ -#define DIRECTION_UPLINK 0 -#define DIRECTION_DOWNLINK 1 - -/* rntiType */ -#define WS_NO_RNTI 0 -#define WS_P_RNTI 1 -#define WS_RA_RNTI 2 -#define WS_C_RNTI 3 -#define WS_SI_RNTI 4 -#define WS_CS_RNTI 5 - -/* Context info attached to each NR MAC frame */ -typedef struct mac_nr_info -{ - /* Needed for decode */ - guint8 radioType; - guint8 direction; - guint8 rntiType; - - /* Extra info to display */ - guint16 rnti; - guint16 ueid; - guint8 harqid; - - /* Will these be included in the ME PHR report? */ - guint8 phr_type2_othercell; - - /* Timing info */ - gboolean sfnSlotInfoPresent; - guint16 sysframeNumber; - guint16 slotNumber; - - /* Length of DL PDU or UL grant size in bytes */ - guint16 length; - -} mac_nr_info; - - -/*****************************************************************/ -/* UDP framing format */ -/* ----------------------- */ -/* Several people have asked about dissecting MAC by framing */ -/* PDUs over IP. A suggested format over UDP has been created */ -/* and implemented by this dissector, using the definitions */ -/* below. */ -/* */ -/* A heuristic dissector (enabled by a preference) will */ -/* recognise a signature at the beginning of these frames. */ -/*****************************************************************/ - - -/* Signature. Rather than try to define a port for this, or make the - port number a preference, frames will start with this string (with no - terminating NULL */ -#define MAC_NR_START_STRING "mac-nr" - -/* Fixed fields. This is followed by the following 3 mandatory fields: - - radioType (1 byte) - - direction (1 byte) - - rntiType (1 byte) - (where the allowed values are defined above */ - -/* Optional fields. Attaching this info to frames will allow you - to show you display/filter/plot/add-custom-columns on these fields, so should - be added if available. - The format is to have the tag, followed by the value (there is no length field, - it's implicit from the tag) */ - -#define MAC_NR_RNTI_TAG 0x02 -/* 2 bytes, network order */ - -#define MAC_NR_UEID_TAG 0x03 -/* 2 bytes, network order */ - -#define MAC_NR_FRAME_SUBFRAME_TAG 0x04 -/* 2 bytes, deprecated, do not use it */ - -#define MAC_NR_PHR_TYPE2_OTHERCELL_TAG 0x05 -/* 1 byte, TRUE/FALSE */ - -#define MAC_NR_HARQID 0x06 -/* 1 byte */ - -#define MAC_NR_FRAME_SLOT_TAG 0x07 -/* 4 bytes, network order, SFN is stored in the 2 first bytes and slot number in the 2 last bytes */ - -/* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU - continues until the end of the frame) */ -#define MAC_NR_PAYLOAD_TAG 0x01 - - -/* Type to store parameters for configuring LCID->RLC channel settings for DRB */ -/* Some are optional, and may not be seen (e.g. on reestablishment) */ -typedef struct nr_drb_mac_rlc_mapping_t -{ - gboolean active; - guint16 ueid; /* Mandatory */ - guint8 drbid; /* Mandatory */ - - gboolean lcid_present; - guint8 lcid; /* Part of LogicalChannelConfig - optional */ - gboolean rlcMode_present; - guint8 rlcMode; /* Part of RLC config - optional */ - - guint8 tempDirection; /* So know direction of next SN length... */ - - gboolean rlcUlSnLength_present; - guint8 rlcUlSnLength; /* Part of RLC config - optional */ - gboolean rlcDlSnLength_present; - guint8 rlcDlSnLength; /* Part of RLC config - optional */ -} nr_drb_mac_rlc_mapping_t; - - - -/* - * Editor modelines - https://www.wireshark.org/tools/modelines.html - * - * Local variables: - * c-basic-offset: 4 - * tab-width: 8 - * indent-tabs-mode: nil - * End: - * - * vi: set shiftwidth=4 tabstop=8 expandtab: - * :indentSize=4:tabSize=8:noTabs=true: - */ diff --git a/openair2/UTIL/OPT/packet-pdcp-lte.h b/openair2/UTIL/OPT/packet-pdcp-lte.h deleted file mode 100644 index 19a371011b..0000000000 --- a/openair2/UTIL/OPT/packet-pdcp-lte.h +++ /dev/null @@ -1,172 +0,0 @@ -/* packet-pdcp-lte.h - * - * Martin Mathieson - * Wireshark - Network traffic analyzer - * By Gerald Combs - * Copyright 1998 Gerald Combs - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - - - -/* Direction */ -#define DIRECTION_UPLINK 0 -#define DIRECTION_DOWNLINK 1 - -enum pdcp_plane -{ - SIGNALING_PLANE = 1, - USER_PLANE = 2 -}; - -typedef enum LogicalChannelType -{ - Channel_DCCH=1, - Channel_BCCH=2, - Channel_CCCH=3, - Channel_PCCH=4, - Channel_DCCH_NB=5, - Channel_BCCH_NB=6, - Channel_CCCH_NB=7, - Channel_PCCH_NB=8 -} LogicalChannelType; - -typedef enum -{ - BCH_TRANSPORT=1, - DLSCH_TRANSPORT=2 -} BCCHTransportType; - -#define PDCP_SN_LENGTH_5_BITS 5 -#define PDCP_SN_LENGTH_7_BITS 7 -#define PDCP_SN_LENGTH_12_BITS 12 -#define PDCP_SN_LENGTH_15_BITS 15 -#define PDCP_SN_LENGTH_18_BITS 18 - -enum lte_security_integrity_algorithm_e { eia0, eia1, eia2, eia3 }; -enum lte_security_ciphering_algorithm_e { eea0, eea1, eea2, eea3 }; - -typedef struct pdcp_lte_security_info_t -{ - guint32 configuration_frame; - gboolean seen_next_ul_pdu; /* i.e. have we seen SecurityModeResponse */ - enum lte_security_integrity_algorithm_e integrity; - enum lte_security_ciphering_algorithm_e ciphering; - - /* Store previous settings so can revert if get SecurityModeFailure */ - guint32 previous_configuration_frame; - enum lte_security_integrity_algorithm_e previous_integrity; - enum lte_security_ciphering_algorithm_e previous_ciphering; -} pdcp_lte_security_info_t; - - -/***********************************************************************/ -/* UDP framing format */ -/* ----------------------- */ -/* Several people have asked about dissecting PDCP by framing */ -/* PDUs over IP. A suggested format over UDP has been defined */ -/* and implemented by this dissector, using the definitions */ -/* below. A link to an example program showing you how to encode */ -/* these headers and send LTE PDCP PDUs on a UDP socket is */ -/* provided at https://gitlab.com/wireshark/wireshark/-/wikis/PDCP-LTE */ -/* */ -/* A heuristic dissecter (enabled by a preference) will */ -/* recognise a signature at the beginning of these frames. */ -/* Until someone is using this format, suggestions for changes */ -/* are welcome. */ -/***********************************************************************/ - - -/* Signature. Rather than try to define a port for this, or make the - port number a preference, frames will start with this string (with no - terminating NULL */ -#define PDCP_LTE_START_STRING "pdcp-lte" - -/* Fixed fields. This is followed by the following 3 mandatory fields: - - no_header_pdu (1 byte) - - plane (1 byte) - - rohc_compression ( byte) - (where the allowed values are defined above) */ - -/* Conditional field. This field is mandatory in case of User Plane PDCP PDU. - The format is to have the tag, followed by the value (there is no length field, - it's implicit from the tag). The allowed values are defined above. */ - -#define PDCP_LTE_SEQNUM_LENGTH_TAG 0x02 -/* 1 byte */ - -/* Optional fields. Attaching this info to frames will allow you - to show you display/filter/plot/add-custom-columns on these fields, so should - be added if available. - The format is to have the tag, followed by the value (there is no length field, - it's implicit from the tag) */ - -#define PDCP_LTE_DIRECTION_TAG 0x03 -/* 1 byte */ - -#define PDCP_LTE_LOG_CHAN_TYPE_TAG 0x04 -/* 1 byte */ - -#define PDCP_LTE_BCCH_TRANSPORT_TYPE_TAG 0x05 -/* 1 byte */ - -#define PDCP_LTE_ROHC_IP_VERSION_TAG 0x06 -/* 2 bytes, network order */ - -#define PDCP_LTE_ROHC_CID_INC_INFO_TAG 0x07 -/* 1 byte */ - -#define PDCP_LTE_ROHC_LARGE_CID_PRES_TAG 0x08 -/* 1 byte */ - -#define PDCP_LTE_ROHC_MODE_TAG 0x09 -/* 1 byte */ - -#define PDCP_LTE_ROHC_RND_TAG 0x0A -/* 1 byte */ - -#define PDCP_LTE_ROHC_UDP_CHECKSUM_PRES_TAG 0x0B -/* 1 byte */ - -#define PDCP_LTE_ROHC_PROFILE_TAG 0x0C -/* 2 bytes, network order */ - -#define PDCP_LTE_CHANNEL_ID_TAG 0x0D -/* 2 bytes, network order */ - -#define PDCP_LTE_UEID_TAG 0x0E -/* 2 bytes, network order */ - -/* PDCP PDU. Following this tag comes the actual PDCP PDU (there is no length, the PDU - continues until the end of the frame) */ -#define PDCP_LTE_PAYLOAD_TAG 0x01 - - - -/* Called by RRC, or other configuration protocols */ - -/* Function to configure ciphering & integrity algorithms */ -void set_pdcp_lte_security_algorithms(guint16 ueid, pdcp_lte_security_info_t *security_info); - -/* Function to indicate securityModeCommand did not complete */ -void set_pdcp_lte_security_algorithms_failed(guint16 ueid); - - -/* Called by external dissectors */ -void set_pdcp_lte_rrc_ciphering_key(guint16 ueid, const char *key); -void set_pdcp_lte_rrc_integrity_key(guint16 ueid, const char *key); -void set_pdcp_lte_up_ciphering_key(guint16 ueid, const char *key); - -/* - * Editor modelines - https://www.wireshark.org/tools/modelines.html - * - * Local variables: - * c-basic-offset: 4 - * tab-width: 8 - * indent-tabs-mode: nil - * End: - * - * vi: set shiftwidth=4 tabstop=8 expandtab: - * :indentSize=4:tabSize=8:noTabs=true: - */ diff --git a/openair2/UTIL/OPT/packet-pdcp-nr.h b/openair2/UTIL/OPT/packet-pdcp-nr.h deleted file mode 100644 index 79f784c1c3..0000000000 --- a/openair2/UTIL/OPT/packet-pdcp-nr.h +++ /dev/null @@ -1,168 +0,0 @@ -/* packet-pdcp-nr.h - * - * Martin Mathieson - * Wireshark - Network traffic analyzer - * By Gerald Combs - * Copyright 1998 Gerald Combs - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - - -/* Direction */ -#define PDCP_NR_DIRECTION_UPLINK 0 -#define PDCP_NR_DIRECTION_DOWNLINK 1 - -enum pdcp_nr_plane -{ - NR_SIGNALING_PLANE = 1, - NR_USER_PLANE = 2 -}; - -typedef enum NRBearerType -{ - Bearer_DCCH=1, - Bearer_BCCH_BCH=2, - Bearer_BCCH_DL_SCH=3, - Bearer_CCCH=4, - Bearer_PCCH=5, -} NRBearerType; - - -#define PDCP_NR_SN_LENGTH_12_BITS 12 -#define PDCP_NR_SN_LENGTH_18_BITS 18 - -#define PDCP_NR_UL_SDAP_HEADER_PRESENT 0x01 -#define PDCP_NR_DL_SDAP_HEADER_PRESENT 0x02 - -enum nr_security_integrity_algorithm_e { nia0, nia1, nia2, nia3 }; -enum nr_security_ciphering_algorithm_e { nea0, nea1, nea2, nea3, nea_disabled=999}; - -typedef struct pdcp_nr_security_info_t -{ - guint32 configuration_frame; - gboolean seen_next_ul_pdu; /* i.e. have we seen SecurityModeResponse */ - enum nr_security_integrity_algorithm_e integrity; - enum nr_security_ciphering_algorithm_e ciphering; - - /* Store previous settings so can revert if get SecurityModeFailure */ - guint32 previous_configuration_frame; - enum nr_security_integrity_algorithm_e previous_integrity; - enum nr_security_ciphering_algorithm_e previous_ciphering; -} pdcp_nr_security_info_t; - - -/*****************************************************************/ -/* UDP framing format */ -/* ----------------------- */ -/* Several people have asked about dissecting PDCP by framing */ -/* PDUs over IP. A suggested format over UDP has been defined */ -/* and implemented by this dissector, using the definitions */ -/* below. */ -/* */ -/* A heuristic dissector (enabled by a preference) will */ -/* recognise a signature at the beginning of these frames. */ -/* Until someone is using this format, suggestions for changes */ -/* are welcome. */ -/*****************************************************************/ - - -/* Signature. Rather than try to define a port for this, or make the - port number a preference, frames will start with this string (with no - terminating NULL */ -#define PDCP_NR_START_STRING "pdcp-nr" - -/* Fixed fields: - - plane (1 byte) */ - -/* Conditional field. This field is mandatory in case of User Plane PDCP PDU. - The format is to have the tag, followed by the value (there is no length field, - it's implicit from the tag). The allowed values are defined above. */ - -#define PDCP_NR_SEQNUM_LENGTH_TAG 0x02 -/* 1 byte */ - -/* Optional fields. Attaching this info should be added if available. - The format is to have the tag, followed by the value (there is no length field, - it's implicit from the tag) */ - -#define PDCP_NR_DIRECTION_TAG 0x03 -/* 1 byte */ - -#define PDCP_NR_BEARER_TYPE_TAG 0x04 -/* 1 byte */ - -#define PDCP_NR_BEARER_ID_TAG 0x05 -/* 1 byte */ - -#define PDCP_NR_UEID_TAG 0x06 -/* 2 bytes, network order */ - -#define PDCP_NR_ROHC_COMPRESSION_TAG 0x07 -/* 0 byte */ - -/* N.B. The following ROHC values only have significance if rohc_compression - is in use for the current channel */ - -#define PDCP_NR_ROHC_IP_VERSION_TAG 0x08 -/* 1 byte */ - -#define PDCP_NR_ROHC_CID_INC_INFO_TAG 0x09 -/* 0 byte */ - -#define PDCP_NR_ROHC_LARGE_CID_PRES_TAG 0x0A -/* 0 byte */ - -#define PDCP_NR_ROHC_MODE_TAG 0x0B -/* 1 byte */ - -#define PDCP_NR_ROHC_RND_TAG 0x0C -/* 0 byte */ - -#define PDCP_NR_ROHC_UDP_CHECKSUM_PRES_TAG 0x0D -/* 0 byte */ - -#define PDCP_NR_ROHC_PROFILE_TAG 0x0E -/* 2 bytes, network order */ - -#define PDCP_NR_MACI_PRES_TAG 0x0F -/* 0 byte */ - -#define PDCP_NR_SDAP_HEADER_TAG 0x10 -/* 1 byte, bitmask with PDCP_NR_UL_SDAP_HEADER_PRESENT and/or PDCP_NR_DL_SDAP_HEADER_PRESENT */ - -#define PDCP_NR_CIPHER_DISABLED_TAG 0x11 -/* 0 byte */ - -/* PDCP PDU. Following this tag comes the actual PDCP PDU (there is no length, the PDU - continues until the end of the frame) */ -#define PDCP_NR_PAYLOAD_TAG 0x01 - - -/* Called by RRC, or other configuration protocols */ - -/* Function to configure ciphering & integrity algorithms */ -void set_pdcp_nr_security_algorithms(guint16 ueid, pdcp_nr_security_info_t *security_info); - -/* Function to indicate securityModeCommand did not complete */ -void set_pdcp_nr_security_algorithms_failed(guint16 ueid); - - -/* Called by external dissectors */ -void set_pdcp_nr_rrc_ciphering_key(guint16 ueid, const char *key); -void set_pdcp_nr_rrc_integrity_key(guint16 ueid, const char *key); -void set_pdcp_nr_up_ciphering_key(guint16 ueid, const char *key); -void set_pdcp_nr_up_integrity_key(guint16 ueid, const char *key); - -/* - * Editor modelines - https://www.wireshark.org/tools/modelines.html - * - * Local variables: - * c-basic-offset: 4 - * tab-width: 8 - * indent-tabs-mode: nil - * End: - * - * vi: set shiftwidth=4 tabstop=8 expandtab: - * :indentSize=4:tabSize=8:noTabs=true: - */ diff --git a/openair2/UTIL/OPT/packet-rlc-lte.h b/openair2/UTIL/OPT/packet-rlc-lte.h deleted file mode 100644 index e5b03d5f8e..0000000000 --- a/openair2/UTIL/OPT/packet-rlc-lte.h +++ /dev/null @@ -1,151 +0,0 @@ -/* packet-rlc-lte.h - * - * Martin Mathieson - * Wireshark - Network traffic analyzer - * By Gerald Combs - * Copyright 1998 Gerald Combs - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -#ifndef PACKET_RLC_LTE_H -#define PACKET_RLC_LTE_H - -/* rlcMode */ -#define RLC_TM_MODE 1 -#define RLC_UM_MODE 2 -#define RLC_AM_MODE 4 -#define RLC_PREDEF 8 - -/* direction */ -#define DIRECTION_UPLINK 0 -#define DIRECTION_DOWNLINK 1 - -/* priority ? */ - -/* channelType */ -#define CHANNEL_TYPE_CCCH 1 -#define CHANNEL_TYPE_BCCH_BCH 2 -#define CHANNEL_TYPE_PCCH 3 -#define CHANNEL_TYPE_SRB 4 -#define CHANNEL_TYPE_DRB 5 -#define CHANNEL_TYPE_BCCH_DL_SCH 6 -#define CHANNEL_TYPE_MCCH 7 -#define CHANNEL_TYPE_MTCH 8 - -/* sequenceNumberLength */ -#define UM_SN_LENGTH_5_BITS 5 -#define UM_SN_LENGTH_10_BITS 10 -#define AM_SN_LENGTH_10_BITS 10 -#define AM_SN_LENGTH_16_BITS 16 - - -typedef enum rlc_lte_nb_mode { - rlc_no_nb_mode = 0, - rlc_nb_mode = 1 -} rlc_lte_nb_mode; - - -/* Info attached to each LTE RLC frame */ -typedef struct rlc_lte_info -{ - guint8 rlcMode; - guint8 direction; - guint8 priority; - guint8 sequenceNumberLength; - guint16 ueid; - guint16 channelType; - guint16 channelId; /* for SRB: 1=SRB1, 2=SRB2, 3=SRB1bis; for DRB: DRB ID */ - guint16 pduLength; - gboolean extendedLiField; - rlc_lte_nb_mode nbMode; -} rlc_lte_info; - - -typedef struct rlc_lte_tap_info { - /* Info from context */ - guint8 rlcMode; - guint8 direction; - guint8 priority; - guint16 ueid; - guint16 channelType; - guint16 channelId; - guint16 pduLength; - guint8 sequenceNumberLength; - - nstime_t rlc_lte_time; - guint8 loggedInMACFrame; - guint16 sequenceNumber; - guint8 isResegmented; - guint8 isControlPDU; - guint16 ACKNo; - #define MAX_NACKs 128 - guint16 noOfNACKs; - guint16 NACKs[MAX_NACKs]; - - guint16 missingSNs; -} rlc_lte_tap_info; - - -/* Signature. Rather than try to define a port for this, or make the - port number a preference, frames will start with this string (with no - terminating NULL */ -#define RLC_LTE_START_STRING "rlc-lte" - -/* Fixed field. This is followed by the following 1 mandatory field: - - rlcMode (1 byte) - (where the allowed values are defined above */ - -/* Conditional field. This field is mandatory in case of RLC Unacknowledged mode. - In case of RLC Acknowledged mode, the field is optional (assume 10 bits by default). - The format is to have the tag, followed by the value (there is no length field, - it's implicit from the tag). The allowed values are defined above. */ - -#define RLC_LTE_SN_LENGTH_TAG 0x02 -/* 1 byte */ - -/* Optional fields. Attaching this info to frames will allow you - to show you display/filter/plot/add-custom-columns on these fields, so should - be added if available. - The format is to have the tag, followed by the value (there is no length field, - it's implicit from the tag) */ - -#define RLC_LTE_DIRECTION_TAG 0x03 -/* 1 byte */ - -#define RLC_LTE_PRIORITY_TAG 0x04 -/* 1 byte */ - -#define RLC_LTE_UEID_TAG 0x05 -/* 2 bytes, network order */ - -#define RLC_LTE_CHANNEL_TYPE_TAG 0x06 -/* 2 bytes, network order */ - -#define RLC_LTE_CHANNEL_ID_TAG 0x07 -/* 2 bytes, network order */ - -#define RLC_LTE_EXT_LI_FIELD_TAG 0x08 -/* 0 byte, tag presence indicates that AM DRB PDU is using an extended LI field of 15 bits */ - -#define RLC_LTE_NB_MODE_TAG 0x09 -/* 1 byte containing rlc_lte_nb_mode enum value */ - -/* RLC PDU. Following this tag comes the actual RLC PDU (there is no length, the PDU - continues until the end of the frame) */ -#define RLC_LTE_PAYLOAD_TAG 0x01 - -#endif - -/* - * Editor modelines - https://www.wireshark.org/tools/modelines.html - * - * Local variables: - * c-basic-offset: 4 - * tab-width: 8 - * indent-tabs-mode: nil - * End: - * - * vi: set shiftwidth=4 tabstop=8 expandtab: - * :indentSize=4:tabSize=8:noTabs=true: - */ diff --git a/openair2/UTIL/OPT/packet-rlc-nr.h b/openair2/UTIL/OPT/packet-rlc-nr.h deleted file mode 100644 index 290eba1898..0000000000 --- a/openair2/UTIL/OPT/packet-rlc-nr.h +++ /dev/null @@ -1,136 +0,0 @@ -/* packet-rlc-nr.h - * - * Pascal Quantin - * Wireshark - Network traffic analyzer - * By Gerald Combs - * Copyright 1998 Gerald Combs - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -#ifndef PACKET_RLC_NR_H -#define PACKET_RLC_NR_H - -/* rlcMode */ -#define RLC_TM_MODE 1 -#define RLC_UM_MODE 2 -#define RLC_AM_MODE 4 - -/* direction */ -#define DIRECTION_UPLINK 0 -#define DIRECTION_DOWNLINK 1 - -/* bearerType */ -#define BEARER_TYPE_CCCH 1 -#define BEARER_TYPE_BCCH_BCH 2 -#define BEARER_TYPE_PCCH 3 -#define BEARER_TYPE_SRB 4 -#define BEARER_TYPE_DRB 5 -#define BEARER_TYPE_BCCH_DL_SCH 6 - -/* sequenceNumberLength */ -#define TM_SN_LENGTH_0_BITS 0 -#define UM_SN_LENGTH_6_BITS 6 -#define UM_SN_LENGTH_12_BITS 12 -#define AM_SN_LENGTH_12_BITS 12 -#define AM_SN_LENGTH_18_BITS 18 - -/* Info attached to each NR RLC frame */ -typedef struct rlc_nr_info -{ - guint8 rlcMode; - guint8 direction; - guint8 sequenceNumberLength; - guint8 bearerType; - guint8 bearerId; - guint16 ueid; - guint16 pduLength; -} rlc_nr_info; - -typedef struct nr_drb_rlc_pdcp_mapping_t -{ - gboolean active; - guint16 ueid; /* Mandatory */ - guint8 drbid; /* Mandatory */ - - gboolean pdcpUlSnLength_present; - guint8 pdcpUlSnLength; /* Part of PDCP config - optional */ - gboolean pdcpDlSnLength_present; - guint8 pdcpDlSnLength; /* Part of PDCP config - optional */ - gboolean pdcpUlSdap; - gboolean pdcpDlSdap; - gboolean pdcpIntegrityProtection; - gboolean pdcpCipheringDisabled; - -} nr_drb_rlc_pdcp_mapping_t; - -/* TODO: could probably merge this struct with above */ -typedef struct pdcp_ue_parameters { - guint32 id; - guint8 pdcp_sn_bits_ul; - guint8 pdcp_sn_bits_dl; - gboolean pdcp_sdap_ul; - gboolean pdcp_sdap_dl; - gboolean pdcp_integrity; - gboolean pdcp_ciphering_disabled; -} pdcp_bearer_parameters; - -/*****************************************************************/ -/* UDP framing format */ -/* ----------------------- */ -/* Several people have asked about dissecting RLC by framing */ -/* PDUs over IP. A suggested format over UDP has been defined */ -/* and implemented by this dissector, using the definitions */ -/* below. */ -/* */ -/* A heuristic dissector (enabled by a preference) will */ -/* recognise a signature at the beginning of these frames. */ -/*****************************************************************/ - - -/* Signature. Rather than try to define a port for this, or make the - port number a preference, frames will start with this string (with no - terminating NULL */ -#define RLC_NR_START_STRING "rlc-nr" - -/* Fixed field. This is followed by the following 2 mandatory field: - - rlcMode (1 byte) - - sequenceNumberLength (1 byte) - (where the allowed values are defined above) */ - -/* Optional fields. Attaching this info to frames will allow you - to show you display/filter/plot/add-custom-columns on these fields, so should - be added if available. - The format is to have the tag, followed by the value (there is no length field, - it's implicit from the tag) */ - -#define RLC_NR_DIRECTION_TAG 0x02 -/* 1 byte */ - -#define RLC_NR_UEID_TAG 0x03 -/* 2 bytes, network order */ - -#define RLC_NR_BEARER_TYPE_TAG 0x04 -/* 1 byte */ - -#define RLC_NR_BEARER_ID_TAG 0x05 -/* 1 byte */ - -/* RLC PDU. Following this tag comes the actual RLC PDU (there is no length, the PDU - continues until the end of the frame) */ -#define RLC_NR_PAYLOAD_TAG 0x01 - -#endif - -/* - * Editor modelines - https://www.wireshark.org/tools/modelines.html - * - * Local variables: - * c-basic-offset: 4 - * tab-width: 8 - * indent-tabs-mode: nil - * End: - * - * vi: set shiftwidth=4 tabstop=8 expandtab: - * :indentSize=4:tabSize=8:noTabs=true: - */ diff --git a/openair2/UTIL/OPT/wireshark_headers.h b/openair2/UTIL/OPT/wireshark_headers.h new file mode 100644 index 0000000000..27d8753ffe --- /dev/null +++ b/openair2/UTIL/OPT/wireshark_headers.h @@ -0,0 +1,895 @@ +/* packet-mac-lte.h + * + * Martin Mathieson + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * Copyright (C) 2009 Martin Mathieson. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause + */ + + /* + this is wireshark, commit: commit eda834b6e29c36e05a63a6056afa98390ff79357 + Date: Wed Aug 22 14:36:20 2018 +0200 + modified to be used in OpenAir to create the LTE MAC/RLC encapsulated in UDP as per Wireshark feature + */ + +#ifndef __UTIL_OPT_PACKET_MAC_LTE__H__ +#define __UTIL_OPT_PACKET_MAC_LTE__H__ + +/** data structure to hold time values with nanosecond resolution*/ +typedef struct { + time_t secs; + int nsecs; +} nstime_t; + + +/* radioType */ +#define FDD_RADIO 1 +#define TDD_RADIO 2 + +/* Direction */ +#define DIRECTION_UPLINK 0 +#define DIRECTION_DOWNLINK 1 + +/* rntiType */ +#define WS_NO_RNTI 0 +#define WS_P_RNTI 1 +#define WS_RA_RNTI 2 +#define WS_C_RNTI 3 +#define WS_SI_RNTI 4 +#define WS_SPS_RNTI 5 +#define WS_M_RNTI 6 +#define WS_SL_BCH_RNTI 7 +#define WS_SL_RNTI 8 +#define WS_SC_RNTI 9 +#define WS_G_RNTI 10 + +#define WS_CS_RNTI 5 + +typedef enum mac_lte_oob_event { + ltemac_send_preamble, + ltemac_send_sr, + ltemac_sr_failure +} mac_lte_oob_event; + +typedef enum mac_lte_dl_retx { + dl_retx_no, + dl_retx_yes, + dl_retx_unknown +} mac_lte_dl_retx; + +typedef enum mac_lte_crc_status { + crc_fail = 0, + crc_success = 1, + crc_high_code_rate = 2, + crc_pdsch_lost = 3, + crc_duplicate_nonzero_rv = 4, + crc_false_dci = 5 +} mac_lte_crc_status; + +/* N.B. for SCellIndex-r13 extends to 31 */ +typedef enum mac_lte_carrier_id { + carrier_id_primary, + carrier_id_secondary_1, + carrier_id_secondary_2, + carrier_id_secondary_3, + carrier_id_secondary_4, + carrier_id_secondary_5, + carrier_id_secondary_6, + carrier_id_secondary_7 +} mac_lte_carrier_id; + +typedef enum mac_lte_ce_mode { + no_ce_mode = 0, + ce_mode_a = 1, + ce_mode_b = 2 +} mac_lte_ce_mode; + +typedef enum mac_lte_nb_mode { + no_nb_mode = 0, + nb_mode = 1 +} mac_lte_nb_mode; + +/* Context info attached to each LTE MAC frame */ +typedef struct mac_lte_info +{ + /* Needed for decode */ + guint8 radioType; + guint8 direction; + guint8 rntiType; + + /* Extra info to display */ + guint16 rnti; + guint16 ueid; + + /* Timing info */ + guint16 sysframeNumber; + guint16 subframeNumber; + gboolean sfnSfInfoPresent; + + /* Optional field. More interesting for TDD (FDD is always -4 subframeNumber) */ + gboolean subframeNumberOfGrantPresent; + guint16 subframeNumberOfGrant; + + /* Flag set only if doing PHY-level data test - i.e. there may not be a + well-formed MAC PDU so just show as raw data */ + gboolean isPredefinedData; + + /* Length of DL PDU or UL grant size in bytes */ + guint16 length; + + /* 0=newTx, 1=first-retx, etc */ + guint8 reTxCount; + guint8 isPHICHNACK; /* FALSE=PDCCH retx grant, TRUE=PHICH NACK */ + + /* UL only. Indicates if the R10 extendedBSR-Sizes parameter is set */ + gboolean isExtendedBSRSizes; + + /* UL only. Indicates if the R10 simultaneousPUCCH-PUSCH parameter is set for PCell */ + gboolean isSimultPUCCHPUSCHPCell; + + /* UL only. Indicates if the R10 extendedBSR-Sizes parameter is set for PSCell */ + gboolean isSimultPUCCHPUSCHPSCell; + + /* Status of CRC check. For UE it is DL only. For eNodeB it is UL + only. For an analyzer, it is present for both DL and UL. */ + gboolean crcStatusValid; + mac_lte_crc_status crcStatus; + + /* Carrier ID */ + mac_lte_carrier_id carrierId; + + /* DL only. Is this known to be a retransmission? */ + mac_lte_dl_retx dl_retx; + + /* DL only. CE mode to be used for RAR decoding */ + mac_lte_ce_mode ceMode; + + /* DL and UL. NB-IoT mode of the UE */ + mac_lte_nb_mode nbMode; + + /* UL only, for now used for CE mode A RAR decoding */ + guint8 nUlRb; + + /* More Physical layer info (see direction above for which side of union to use) */ + union { + struct mac_lte_ul_phy_info + { + guint8 present; /* Remaining UL fields are present and should be displayed */ + guint8 modulation_type; + guint8 tbs_index; + guint8 resource_block_length; + guint8 resource_block_start; + guint8 harq_id; + gboolean ndi; + } ul_info; + struct mac_lte_dl_phy_info + { + guint8 present; /* Remaining DL fields are present and should be displayed */ + guint8 dci_format; + guint8 resource_allocation_type; + guint8 aggregation_level; + guint8 mcs_index; + guint8 redundancy_version_index; + guint8 resource_block_length; + guint8 harq_id; + gboolean ndi; + guint8 transport_block; /* 0..1 */ + } dl_info; + } detailed_phy_info; + + /* Relating to out-of-band events */ + /* N.B. dissector will only look to these fields if length is 0... */ + mac_lte_oob_event oob_event; + guint8 rapid; + guint8 rach_attempt_number; + #define MAX_SRs 20 + guint16 number_of_srs; + guint16 oob_ueid[MAX_SRs]; + guint16 oob_rnti[MAX_SRs]; +} mac_lte_info; + + /* 0 to 10 and 32 to 38 */ +#define MAC_LTE_DATA_LCID_COUNT_MAX 18 +#define MAC_LTE_START_STRING "mac-lte" + +/* Fixed fields. This is followed by the following 3 mandatory fields: + - radioType (1 byte) + - direction (1 byte) + - rntiType (1 byte) + (where the allowed values are defined above */ + +/* Optional fields. Attaching this info to frames will allow you + to show you display/filter/plot/add-custom-columns on these fields, so should + be added if available. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag) */ + +#define MAC_LTE_RNTI_TAG 0x02 +/* 2 bytes, network order */ + +#define MAC_LTE_UEID_TAG 0x03 +/* 2 bytes, network order */ + +#define MAC_LTE_FRAME_SUBFRAME_TAG 0x04 +/* 2 bytes, network order, SFN is stored in 12 MSB and SF in 4 LSB */ + +#define MAC_LTE_PREDEFINED_DATA_TAG 0x05 +/* 1 byte */ + +#define MAC_LTE_RETX_TAG 0x06 +/* 1 byte */ + +#define MAC_LTE_CRC_STATUS_TAG 0x07 +/* 1 byte */ + +#define MAC_LTE_EXT_BSR_SIZES_TAG 0x08 +/* 0 byte */ + +#define MAC_LTE_SEND_PREAMBLE_TAG 0x09 +/* 2 bytes, RAPID value (1 byte) followed by RACH attempt number (1 byte) */ + +#define MAC_LTE_CARRIER_ID_TAG 0x0A +/* 1 byte */ + +#define MAC_LTE_PHY_TAG 0x0B +/* variable length, length (1 byte) then depending on direction + in UL: modulation type (1 byte), TBS index (1 byte), RB length (1 byte), + RB start (1 byte), HARQ id (1 byte), NDI (1 byte) + in DL: DCI format (1 byte), resource allocation type (1 byte), aggregation level (1 byte), + MCS index (1 byte), redundancy version (1 byte), resource block length (1 byte), + HARQ id (1 byte), NDI (1 byte), TB (1 byte), DL reTx (1 byte) */ + +#define MAC_LTE_SIMULT_PUCCH_PUSCH_PCELL_TAG 0x0C +/* 0 byte */ + +#define MAC_LTE_SIMULT_PUCCH_PUSCH_PSCELL_TAG 0x0D +/* 0 byte */ + +#define MAC_LTE_CE_MODE_TAG 0x0E +/* 1 byte containing mac_lte_ce_mode enum value */ + +#define MAC_LTE_NB_MODE_TAG 0x0F +/* 1 byte containing mac_lte_nb_mode enum value */ + +#define MAC_LTE_N_UL_RB_TAG 0x10 +/* 1 byte containing the number of UL resource blocks: 6, 15, 25, 50, 75 or 100 */ + +#define MAC_LTE_SR_TAG 0x11 +/* 2 bytes for the number of items, followed by that number of ueid, rnti (2 bytes each) */ + + +/* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU + continues until the end of the frame) */ +#define MAC_LTE_PAYLOAD_TAG 0x01 + +/* rlcMode */ +#define RLC_TM_MODE 1 +#define RLC_UM_MODE 2 +#define RLC_AM_MODE 4 +#define RLC_PREDEF 8 + +/* priority ? */ + +/* channelType */ +#define CHANNEL_TYPE_CCCH 1 +#define CHANNEL_TYPE_BCCH_BCH 2 +#define CHANNEL_TYPE_PCCH 3 +#define CHANNEL_TYPE_SRB 4 +#define CHANNEL_TYPE_DRB 5 +#define CHANNEL_TYPE_BCCH_DL_SCH 6 +#define CHANNEL_TYPE_MCCH 7 +#define CHANNEL_TYPE_MTCH 8 + +/* sequenceNumberLength */ +#define UM_SN_LENGTH_5_BITS 5 +#define UM_SN_LENGTH_10_BITS 10 +#define AM_SN_LENGTH_10_BITS 10 +#define AM_SN_LENGTH_16_BITS 16 + + +typedef enum rlc_lte_nb_mode { + rlc_no_nb_mode = 0, + rlc_nb_mode = 1 +} rlc_lte_nb_mode; + + +/* Info attached to each LTE RLC frame */ +typedef struct rlc_lte_info +{ + guint8 rlcMode; + guint8 direction; + guint8 priority; + guint8 sequenceNumberLength; + guint16 ueid; + guint16 channelType; + guint16 channelId; /* for SRB: 1=SRB1, 2=SRB2, 3=SRB1bis; for DRB: DRB ID */ + guint16 pduLength; + gboolean extendedLiField; + rlc_lte_nb_mode nbMode; +} rlc_lte_info; + + +typedef struct rlc_lte_tap_info { + /* Info from context */ + guint8 rlcMode; + guint8 direction; + guint8 priority; + guint16 ueid; + guint16 channelType; + guint16 channelId; + guint16 pduLength; + guint8 sequenceNumberLength; + + nstime_t rlc_lte_time; + guint8 loggedInMACFrame; + guint16 sequenceNumber; + guint8 isResegmented; + guint8 isControlPDU; + guint16 ACKNo; + #define MAX_NACKs 128 + guint16 noOfNACKs; + guint16 NACKs[MAX_NACKs]; + + guint16 missingSNs; +} rlc_lte_tap_info; + + +/* Signature. Rather than try to define a port for this, or make the + port number a preference, frames will start with this string (with no + terminating NULL */ +#define RLC_LTE_START_STRING "rlc-lte" + +/* Fixed field. This is followed by the following 1 mandatory field: + - rlcMode (1 byte) + (where the allowed values are defined above */ + +/* Conditional field. This field is mandatory in case of RLC Unacknowledged mode. + In case of RLC Acknowledged mode, the field is optional (assume 10 bits by default). + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag). The allowed values are defined above. */ + +#define RLC_LTE_SN_LENGTH_TAG 0x02 +/* 1 byte */ + +/* Optional fields. Attaching this info to frames will allow you + to show you display/filter/plot/add-custom-columns on these fields, so should + be added if available. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag) */ + +#define RLC_LTE_DIRECTION_TAG 0x03 +/* 1 byte */ + +#define RLC_LTE_PRIORITY_TAG 0x04 +/* 1 byte */ + +#define RLC_LTE_UEID_TAG 0x05 +/* 2 bytes, network order */ + +#define RLC_LTE_CHANNEL_TYPE_TAG 0x06 +/* 2 bytes, network order */ + +#define RLC_LTE_CHANNEL_ID_TAG 0x07 +/* 2 bytes, network order */ + +#define RLC_LTE_EXT_LI_FIELD_TAG 0x08 +/* 0 byte, tag presence indicates that AM DRB PDU is using an extended LI field of 15 bits */ + +#define RLC_LTE_NB_MODE_TAG 0x09 +/* 1 byte containing rlc_lte_nb_mode enum value */ + +/* RLC PDU. Following this tag comes the actual RLC PDU (there is no length, the PDU + continues until the end of the frame) */ +#define RLC_LTE_PAYLOAD_TAG 0x01 + +enum pdcp_plane +{ + SIGNALING_PLANE = 1, + USER_PLANE = 2 +}; + +typedef enum LogicalChannelType +{ + Channel_DCCH=1, + Channel_BCCH=2, + Channel_CCCH=3, + Channel_PCCH=4, + Channel_DCCH_NB=5, + Channel_BCCH_NB=6, + Channel_CCCH_NB=7, + Channel_PCCH_NB=8 +} LogicalChannelType; + +typedef enum +{ + BCH_TRANSPORT=1, + DLSCH_TRANSPORT=2 +} BCCHTransportType; + +#define PDCP_SN_LENGTH_5_BITS 5 +#define PDCP_SN_LENGTH_7_BITS 7 +#define PDCP_SN_LENGTH_12_BITS 12 +#define PDCP_SN_LENGTH_15_BITS 15 +#define PDCP_SN_LENGTH_18_BITS 18 + +enum lte_security_integrity_algorithm_e { eia0, eia1, eia2, eia3 }; +enum lte_security_ciphering_algorithm_e { eea0, eea1, eea2, eea3 }; + +typedef struct pdcp_lte_security_info_t +{ + guint32 configuration_frame; + gboolean seen_next_ul_pdu; /* i.e. have we seen SecurityModeResponse */ + enum lte_security_integrity_algorithm_e integrity; + enum lte_security_ciphering_algorithm_e ciphering; + + /* Store previous settings so can revert if get SecurityModeFailure */ + guint32 previous_configuration_frame; + enum lte_security_integrity_algorithm_e previous_integrity; + enum lte_security_ciphering_algorithm_e previous_ciphering; +} pdcp_lte_security_info_t; + + +/***********************************************************************/ +/* UDP framing format */ +/* ----------------------- */ +/* Several people have asked about dissecting PDCP by framing */ +/* PDUs over IP. A suggested format over UDP has been defined */ +/* and implemented by this dissector, using the definitions */ +/* below. A link to an example program showing you how to encode */ +/* these headers and send LTE PDCP PDUs on a UDP socket is */ +/* provided at https://gitlab.com/wireshark/wireshark/-/wikis/PDCP-LTE */ +/* */ +/* A heuristic dissecter (enabled by a preference) will */ +/* recognise a signature at the beginning of these frames. */ +/* Until someone is using this format, suggestions for changes */ +/* are welcome. */ +/***********************************************************************/ + + +/* Signature. Rather than try to define a port for this, or make the + port number a preference, frames will start with this string (with no + terminating NULL */ +#define PDCP_LTE_START_STRING "pdcp-lte" + +/* Fixed fields. This is followed by the following 3 mandatory fields: + - no_header_pdu (1 byte) + - plane (1 byte) + - rohc_compression ( byte) + (where the allowed values are defined above) */ + +/* Conditional field. This field is mandatory in case of User Plane PDCP PDU. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag). The allowed values are defined above. */ + +#define PDCP_LTE_SEQNUM_LENGTH_TAG 0x02 +/* 1 byte */ + +/* Optional fields. Attaching this info to frames will allow you + to show you display/filter/plot/add-custom-columns on these fields, so should + be added if available. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag) */ + +#define PDCP_LTE_DIRECTION_TAG 0x03 +/* 1 byte */ + +#define PDCP_LTE_LOG_CHAN_TYPE_TAG 0x04 +/* 1 byte */ + +#define PDCP_LTE_BCCH_TRANSPORT_TYPE_TAG 0x05 +/* 1 byte */ + +#define PDCP_LTE_ROHC_IP_VERSION_TAG 0x06 +/* 2 bytes, network order */ + +#define PDCP_LTE_ROHC_CID_INC_INFO_TAG 0x07 +/* 1 byte */ + +#define PDCP_LTE_ROHC_LARGE_CID_PRES_TAG 0x08 +/* 1 byte */ + +#define PDCP_LTE_ROHC_MODE_TAG 0x09 +/* 1 byte */ + +#define PDCP_LTE_ROHC_RND_TAG 0x0A +/* 1 byte */ + +#define PDCP_LTE_ROHC_UDP_CHECKSUM_PRES_TAG 0x0B +/* 1 byte */ + +#define PDCP_LTE_ROHC_PROFILE_TAG 0x0C +/* 2 bytes, network order */ + +#define PDCP_LTE_CHANNEL_ID_TAG 0x0D +/* 2 bytes, network order */ + +#define PDCP_LTE_UEID_TAG 0x0E +/* 2 bytes, network order */ + +/* PDCP PDU. Following this tag comes the actual PDCP PDU (there is no length, the PDU + continues until the end of the frame) */ +#define PDCP_LTE_PAYLOAD_TAG 0x01 + + + +/* Called by RRC, or other configuration protocols */ + +/* Function to configure ciphering & integrity algorithms */ +void set_pdcp_lte_security_algorithms(guint16 ueid, pdcp_lte_security_info_t *security_info); + +/* Function to indicate securityModeCommand did not complete */ +void set_pdcp_lte_security_algorithms_failed(guint16 ueid); + + +/* Called by external dissectors */ +void set_pdcp_lte_rrc_ciphering_key(guint16 ueid, const char *key); +void set_pdcp_lte_rrc_integrity_key(guint16 ueid, const char *key); +void set_pdcp_lte_up_ciphering_key(guint16 ueid, const char *key); + + + +/* Context info attached to each NR MAC frame */ +typedef struct mac_nr_info +{ + /* Needed for decode */ + guint8 radioType; + guint8 direction; + guint8 rntiType; + + /* Extra info to display */ + guint16 rnti; + guint16 ueid; + guint8 harqid; + + /* Will these be included in the ME PHR report? */ + guint8 phr_type2_othercell; + + /* Timing info */ + gboolean sfnSlotInfoPresent; + guint16 sysframeNumber; + guint16 slotNumber; + + /* Length of DL PDU or UL grant size in bytes */ + guint16 length; + +} mac_nr_info; + + +/*****************************************************************/ +/* UDP framing format */ +/* ----------------------- */ +/* Several people have asked about dissecting MAC by framing */ +/* PDUs over IP. A suggested format over UDP has been created */ +/* and implemented by this dissector, using the definitions */ +/* below. */ +/* */ +/* A heuristic dissector (enabled by a preference) will */ +/* recognise a signature at the beginning of these frames. */ +/*****************************************************************/ + + +/* Signature. Rather than try to define a port for this, or make the + port number a preference, frames will start with this string (with no + terminating NULL */ +#define MAC_NR_START_STRING "mac-nr" + +/* Fixed fields. This is followed by the following 3 mandatory fields: + - radioType (1 byte) + - direction (1 byte) + - rntiType (1 byte) + (where the allowed values are defined above */ + +/* Optional fields. Attaching this info to frames will allow you + to show you display/filter/plot/add-custom-columns on these fields, so should + be added if available. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag) */ + +#define MAC_NR_RNTI_TAG 0x02 +/* 2 bytes, network order */ + +#define MAC_NR_UEID_TAG 0x03 +/* 2 bytes, network order */ + +#define MAC_NR_FRAME_SUBFRAME_TAG 0x04 +/* 2 bytes, deprecated, do not use it */ + +#define MAC_NR_PHR_TYPE2_OTHERCELL_TAG 0x05 +/* 1 byte, TRUE/FALSE */ + +#define MAC_NR_HARQID 0x06 +/* 1 byte */ + +#define MAC_NR_FRAME_SLOT_TAG 0x07 +/* 4 bytes, network order, SFN is stored in the 2 first bytes and slot number in the 2 last bytes */ + +/* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU + continues until the end of the frame) */ +#define MAC_NR_PAYLOAD_TAG 0x01 + + +/* Type to store parameters for configuring LCID->RLC channel settings for DRB */ +/* Some are optional, and may not be seen (e.g. on reestablishment) */ +typedef struct nr_drb_mac_rlc_mapping_t +{ + gboolean active; + guint16 ueid; /* Mandatory */ + guint8 drbid; /* Mandatory */ + + gboolean lcid_present; + guint8 lcid; /* Part of LogicalChannelConfig - optional */ + gboolean rlcMode_present; + guint8 rlcMode; /* Part of RLC config - optional */ + + guint8 tempDirection; /* So know direction of next SN length... */ + + gboolean rlcUlSnLength_present; + guint8 rlcUlSnLength; /* Part of RLC config - optional */ + gboolean rlcDlSnLength_present; + guint8 rlcDlSnLength; /* Part of RLC config - optional */ +} nr_drb_mac_rlc_mapping_t; + +/* rlcMode */ +#define RLC_TM_MODE 1 +#define RLC_UM_MODE 2 +#define RLC_AM_MODE 4 + +/* bearerType */ +#define BEARER_TYPE_CCCH 1 +#define BEARER_TYPE_BCCH_BCH 2 +#define BEARER_TYPE_PCCH 3 +#define BEARER_TYPE_SRB 4 +#define BEARER_TYPE_DRB 5 +#define BEARER_TYPE_BCCH_DL_SCH 6 + +/* sequenceNumberLength */ +#define TM_SN_LENGTH_0_BITS 0 +#define UM_SN_LENGTH_6_BITS 6 +#define UM_SN_LENGTH_12_BITS 12 +#define AM_SN_LENGTH_12_BITS 12 +#define AM_SN_LENGTH_18_BITS 18 + +/* Info attached to each NR RLC frame */ +typedef struct rlc_nr_info +{ + guint8 rlcMode; + guint8 direction; + guint8 sequenceNumberLength; + guint8 bearerType; + guint8 bearerId; + guint16 ueid; + guint16 pduLength; +} rlc_nr_info; + +typedef struct nr_drb_rlc_pdcp_mapping_t +{ + gboolean active; + guint16 ueid; /* Mandatory */ + guint8 drbid; /* Mandatory */ + + gboolean pdcpUlSnLength_present; + guint8 pdcpUlSnLength; /* Part of PDCP config - optional */ + gboolean pdcpDlSnLength_present; + guint8 pdcpDlSnLength; /* Part of PDCP config - optional */ + gboolean pdcpUlSdap; + gboolean pdcpDlSdap; + gboolean pdcpIntegrityProtection; + gboolean pdcpCipheringDisabled; + +} nr_drb_rlc_pdcp_mapping_t; + +/* TODO: could probably merge this struct with above */ +typedef struct pdcp_ue_parameters { + guint32 id; + guint8 pdcp_sn_bits_ul; + guint8 pdcp_sn_bits_dl; + gboolean pdcp_sdap_ul; + gboolean pdcp_sdap_dl; + gboolean pdcp_integrity; + gboolean pdcp_ciphering_disabled; +} pdcp_bearer_parameters; + +/*****************************************************************/ +/* UDP framing format */ +/* ----------------------- */ +/* Several people have asked about dissecting RLC by framing */ +/* PDUs over IP. A suggested format over UDP has been defined */ +/* and implemented by this dissector, using the definitions */ +/* below. */ +/* */ +/* A heuristic dissector (enabled by a preference) will */ +/* recognise a signature at the beginning of these frames. */ +/*****************************************************************/ + + +/* Signature. Rather than try to define a port for this, or make the + port number a preference, frames will start with this string (with no + terminating NULL */ +#define RLC_NR_START_STRING "rlc-nr" + +/* Fixed field. This is followed by the following 2 mandatory field: + - rlcMode (1 byte) + - sequenceNumberLength (1 byte) + (where the allowed values are defined above) */ + +/* Optional fields. Attaching this info to frames will allow you + to show you display/filter/plot/add-custom-columns on these fields, so should + be added if available. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag) */ + +#define RLC_NR_DIRECTION_TAG 0x02 +/* 1 byte */ + +#define RLC_NR_UEID_TAG 0x03 +/* 2 bytes, network order */ + +#define RLC_NR_BEARER_TYPE_TAG 0x04 +/* 1 byte */ + +#define RLC_NR_BEARER_ID_TAG 0x05 +/* 1 byte */ + +/* RLC PDU. Following this tag comes the actual RLC PDU (there is no length, the PDU + continues until the end of the frame) */ +#define RLC_NR_PAYLOAD_TAG 0x01 + +enum pdcp_nr_plane +{ + NR_SIGNALING_PLANE = 1, + NR_USER_PLANE = 2 +}; + +typedef enum NRBearerType +{ + Bearer_DCCH=1, + Bearer_BCCH_BCH=2, + Bearer_BCCH_DL_SCH=3, + Bearer_CCCH=4, + Bearer_PCCH=5, +} NRBearerType; + + +#define PDCP_NR_SN_LENGTH_12_BITS 12 +#define PDCP_NR_SN_LENGTH_18_BITS 18 + +#define PDCP_NR_UL_SDAP_HEADER_PRESENT 0x01 +#define PDCP_NR_DL_SDAP_HEADER_PRESENT 0x02 + +enum nr_security_integrity_algorithm_e { nia0, nia1, nia2, nia3 }; +enum nr_security_ciphering_algorithm_e { nea0, nea1, nea2, nea3, nea_disabled=999}; + +typedef struct pdcp_nr_security_info_t +{ + guint32 configuration_frame; + gboolean seen_next_ul_pdu; /* i.e. have we seen SecurityModeResponse */ + enum nr_security_integrity_algorithm_e integrity; + enum nr_security_ciphering_algorithm_e ciphering; + + /* Store previous settings so can revert if get SecurityModeFailure */ + guint32 previous_configuration_frame; + enum nr_security_integrity_algorithm_e previous_integrity; + enum nr_security_ciphering_algorithm_e previous_ciphering; +} pdcp_nr_security_info_t; + + +/*****************************************************************/ +/* UDP framing format */ +/* ----------------------- */ +/* Several people have asked about dissecting PDCP by framing */ +/* PDUs over IP. A suggested format over UDP has been defined */ +/* and implemented by this dissector, using the definitions */ +/* below. */ +/* */ +/* A heuristic dissector (enabled by a preference) will */ +/* recognise a signature at the beginning of these frames. */ +/* Until someone is using this format, suggestions for changes */ +/* are welcome. */ +/*****************************************************************/ + + +/* Signature. Rather than try to define a port for this, or make the + port number a preference, frames will start with this string (with no + terminating NULL */ +#define PDCP_NR_START_STRING "pdcp-nr" + +/* Fixed fields: + - plane (1 byte) */ + +/* Conditional field. This field is mandatory in case of User Plane PDCP PDU. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag). The allowed values are defined above. */ + +#define PDCP_NR_SEQNUM_LENGTH_TAG 0x02 +/* 1 byte */ + +/* Optional fields. Attaching this info should be added if available. + The format is to have the tag, followed by the value (there is no length field, + it's implicit from the tag) */ + +#define PDCP_NR_DIRECTION_TAG 0x03 +/* 1 byte */ + +#define PDCP_NR_BEARER_TYPE_TAG 0x04 +/* 1 byte */ + +#define PDCP_NR_BEARER_ID_TAG 0x05 +/* 1 byte */ + +#define PDCP_NR_UEID_TAG 0x06 +/* 2 bytes, network order */ + +#define PDCP_NR_ROHC_COMPRESSION_TAG 0x07 +/* 0 byte */ + +/* N.B. The following ROHC values only have significance if rohc_compression + is in use for the current channel */ + +#define PDCP_NR_ROHC_IP_VERSION_TAG 0x08 +/* 1 byte */ + +#define PDCP_NR_ROHC_CID_INC_INFO_TAG 0x09 +/* 0 byte */ + +#define PDCP_NR_ROHC_LARGE_CID_PRES_TAG 0x0A +/* 0 byte */ + +#define PDCP_NR_ROHC_MODE_TAG 0x0B +/* 1 byte */ + +#define PDCP_NR_ROHC_RND_TAG 0x0C +/* 0 byte */ + +#define PDCP_NR_ROHC_UDP_CHECKSUM_PRES_TAG 0x0D +/* 0 byte */ + +#define PDCP_NR_ROHC_PROFILE_TAG 0x0E +/* 2 bytes, network order */ + +#define PDCP_NR_MACI_PRES_TAG 0x0F +/* 0 byte */ + +#define PDCP_NR_SDAP_HEADER_TAG 0x10 +/* 1 byte, bitmask with PDCP_NR_UL_SDAP_HEADER_PRESENT and/or PDCP_NR_DL_SDAP_HEADER_PRESENT */ + +#define PDCP_NR_CIPHER_DISABLED_TAG 0x11 +/* 0 byte */ + +/* PDCP PDU. Following this tag comes the actual PDCP PDU (there is no length, the PDU + continues until the end of the frame) */ +#define PDCP_NR_PAYLOAD_TAG 0x01 + + +/* Called by RRC, or other configuration protocols */ + +/* Function to configure ciphering & integrity algorithms */ +void set_pdcp_nr_security_algorithms(guint16 ueid, pdcp_nr_security_info_t *security_info); + +/* Function to indicate securityModeCommand did not complete */ +void set_pdcp_nr_security_algorithms_failed(guint16 ueid); + + +/* Called by external dissectors */ +void set_pdcp_nr_rrc_ciphering_key(guint16 ueid, const char *key); +void set_pdcp_nr_rrc_integrity_key(guint16 ueid, const char *key); +void set_pdcp_nr_up_ciphering_key(guint16 ueid, const char *key); +void set_pdcp_nr_up_integrity_key(guint16 ueid, const char *key); + +/* + * Editor modelines - https://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ +#endif From 4f873e9a268cc335ea0762f65ee9081992fcf370 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 12 Jul 2021 15:44:16 +0100 Subject: [PATCH 086/135] Fix IP packet received at gNB, to be sent to TUN interface --- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 2f16abfe80..6078882601 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -445,8 +445,8 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, int rb_id; int i; - if(UE_NAS_USE_TUN){ - LOG_D(PDCP, "IP packet received, to be sent to UE TUN interface"); + if(IS_SOFTMODEM_NOS1 || UE_NAS_USE_TUN){ + LOG_D(PDCP, "IP packet received, to be sent to TUN interface"); len = write(nas_sock_fd[0], buf, size); if (len != size) { LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); From b98836940ace7f33816bef032a2ef378c7943d61 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Tue, 13 Jul 2021 12:00:25 +0100 Subject: [PATCH 087/135] Change log levels --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 +- openair2/RRC/NR/L2_nr_interface.c | 7 +++---- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 5625cdebb4..d12e5b6f0a 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -169,7 +169,7 @@ uint8_t get_transformPrecoding(const NR_BWP_UplinkCommon_t *initialUplinkBWP, int rnti_type, uint8_t configuredGrant); -void nr_mac_eNB_rrc_ul_failure(const module_id_t Mod_instP, +void nr_mac_gNB_rrc_ul_failure(const module_id_t Mod_instP, const int CC_idP, const frame_t frameP, const sub_frame_t subframeP, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 4d05a75b37..51a01f9302 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -390,7 +390,7 @@ void nr_preprocessor_phytest(module_id_t module_id, for (int rb = 0; rb < sched_pdsch->rbSize; rb++) vrb_map[rb + sched_pdsch->rbStart] = 1; - if ((frame&127) == 0) LOG_I(MAC,"phytest: %d.%d DL mcs %d, DL rbStart %d, DL rbSize %d\n", frame, slot, sched_pdsch->mcs, rbStart,rbSize); + if ((frame&127) == 0) LOG_D(MAC,"phytest: %d.%d DL mcs %d, DL rbStart %d, DL rbSize %d\n", frame, slot, sched_pdsch->mcs, rbStart,rbSize); } uint32_t target_ul_mcs = 9; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index b002607088..678927acfd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -668,7 +668,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if (UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt >= pusch_failure_thres) { LOG_D(NR_MAC,"Detected UL Failure on PUSCH, stopping scheduling\n"); UE_info->UE_sched_ctrl[UE_id].ul_failure = 1; - nr_mac_eNB_rrc_ul_failure(gnb_mod_idP,CC_idP,frameP,slotP,rntiP); + nr_mac_gNB_rrc_ul_failure(gnb_mod_idP,CC_idP,frameP,slotP,rntiP); } } } else if(sduP) { diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index fe843d99ef..8a6e164999 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -365,7 +365,7 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, return 0; } -void nr_mac_eNB_rrc_ul_failure(const module_id_t Mod_instP, +void nr_mac_gNB_rrc_ul_failure(const module_id_t Mod_instP, const int CC_idP, const frame_t frameP, const sub_frame_t subframeP, @@ -376,11 +376,10 @@ void nr_mac_eNB_rrc_ul_failure(const module_id_t Mod_instP, rntiP); if (ue_context_p != NULL) { - LOG_I(RRC,"Frame %d, Subframe %d: UE %x UL failure, activating timer\n",frameP,subframeP,rntiP); - + LOG_D(RRC,"Frame %d, Subframe %d: UE %x UL failure, activating timer\n",frameP,subframeP,rntiP); if(ue_context_p->ue_context.ul_failure_timer == 0) ue_context_p->ue_context.ul_failure_timer=1; } else { - LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP); + LOG_D(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP); } } From a8a5146029ef8ab0c25f30dccf67757f1dc42651 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Tue, 13 Jul 2021 18:08:57 +0100 Subject: [PATCH 088/135] Add noS1 flag in gnb_phytest_usrp_run --- ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml | 2 +- ci-scripts/xml_files/gnb_phytest_usrp_run.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml index b1e9697be2..56b246b148 100644 --- a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml +++ b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml @@ -33,7 +33,7 @@ Initialize_eNB Initialize gNB USRP - -O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test + -O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test --noS1 NR diff --git a/ci-scripts/xml_files/gnb_phytest_usrp_run.xml b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml index 9e798afdc4..3df99bed42 100644 --- a/ci-scripts/xml_files/gnb_phytest_usrp_run.xml +++ b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml @@ -33,7 +33,7 @@ Initialize_eNB Initialize gNB USRP - -O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test -q -U 787200 -T 106 -t 28 -D 130175 -m 28 -M 106 + -O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test --noS1 -q -U 787200 -T 106 -t 28 -D 130175 -m 28 -M 106 NR From 7758e8acfc10f8d52d6fa71ed928c8fe9db2c9fc Mon Sep 17 00:00:00 2001 From: rmagueta Date: Tue, 13 Jul 2021 18:48:38 +0100 Subject: [PATCH 089/135] Revert min_rb to 5 and avoid mixed slots for initialUplinkBWP --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 678927acfd..b7438fd927 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -853,7 +853,7 @@ bool allocate_ul_retransmission(module_id_t module_id, const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); const uint8_t num_dmrs_cdm_grps_no_data = sched_ctrl->active_bwp ? 1 : 2; - const int tda = sched_ctrl->active_ubwp ? RC.nrmac[module_id]->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 1; + const int tda = sched_ctrl->active_ubwp ? RC.nrmac[module_id]->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 0; if (tda == retInfo->time_domain_allocation) { /* Check the resource is enough for retransmission */ while (rbStart < bwpSize && !rballoc_mask[rbStart]) @@ -969,7 +969,7 @@ void pf_ul(module_id_t module_id, gNB_MAC_INST *nrmac = RC.nrmac[module_id]; NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon; NR_UE_info_t *UE_info = &nrmac->UE_info; - const int min_rb = 20; + const int min_rb = 5; float coeff_ue[MAX_MOBILES_PER_GNB]; // UEs that could be scheduled int ue_array[MAX_MOBILES_PER_GNB]; @@ -1045,7 +1045,7 @@ void pf_ul(module_id_t module_id, const uint8_t num_dmrs_cdm_grps_no_data = sched_ctrl->active_ubwp ? 1 : 2; const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; const int dci_format = sched_ctrl->active_ubwp ? (f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0) : NR_UL_DCI_FORMAT_0_0; - const int tda = sched_ctrl->active_ubwp ? nrmac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 1; + const int tda = sched_ctrl->active_ubwp ? nrmac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 0; if (ps->time_domain_allocation != tda || ps->dci_format != dci_format || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) @@ -1141,7 +1141,7 @@ void pf_ul(module_id_t module_id, const uint8_t num_dmrs_cdm_grps_no_data = sched_ctrl->active_ubwp ? 1 : 2; const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; const int dci_format = sched_ctrl->active_ubwp ? (f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0) : NR_UL_DCI_FORMAT_0_0; - const int tda = sched_ctrl->active_ubwp ? nrmac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 1; + const int tda = sched_ctrl->active_ubwp ? nrmac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 0; if (ps->time_domain_allocation != tda || ps->dci_format != dci_format || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) @@ -1191,15 +1191,23 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t * schedule now (slot + k2 is not UL slot) */ int UE_id = UE_info->list.head; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - const int tda = sched_ctrl->active_ubwp ? nr_mac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 1; + const int tda = sched_ctrl->active_ubwp ? nr_mac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 0; if (tda < 0) return false; int K2 = get_K2(scc, sched_ctrl->active_ubwp, tda, mu); const int sched_frame = frame + (slot + K2 >= nr_slots_per_frame[mu]); const int sched_slot = (slot + K2) % nr_slots_per_frame[mu]; + if (!is_xlsch_in_slot(nr_mac->ulsch_slot_bitmap[sched_slot / 64], sched_slot)) return false; + bool is_mixed_slot = is_xlsch_in_slot(nr_mac->dlsch_slot_bitmap[sched_slot / 64], sched_slot) && + is_xlsch_in_slot(nr_mac->ulsch_slot_bitmap[sched_slot / 64], sched_slot); + + // FIXME: Avoid mixed slots for initialUplinkBWP + if (sched_ctrl->active_ubwp==NULL && is_mixed_slot) + return false; + sched_ctrl->sched_pusch.slot = sched_slot; sched_ctrl->sched_pusch.frame = sched_frame; for (UE_id = UE_info->list.next[UE_id]; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { From 88cec72b02c2d2d3f347c82ea3955824cb141010 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 14 Jul 2021 16:15:47 +0200 Subject: [PATCH 090/135] avoid segmentation fault in scheduling csirs for sa --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 831dd2381a..dfb716a704 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2054,11 +2054,15 @@ void nr_csirs_scheduling(int Mod_idP, for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { - NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id]; - NR_CSI_MeasConfig_t *csi_measconfig = CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; NR_NZP_CSI_RS_Resource_t *nzpcsi; int period, offset; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id]; + + if (!CellGroup || !CellGroup->spCellConfig || !CellGroup->spCellConfig->spCellConfigDedicated || + !CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig) continue; + + NR_CSI_MeasConfig_t *csi_measconfig = CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; NR_BWP_Downlink_t *bwp=CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[sched_ctrl->active_bwp->bwp_Id-1]; From a2450bb4b7b4eb3169094101d8cf9979946b23c8 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 14 Jul 2021 15:30:07 +0100 Subject: [PATCH 091/135] Protect some xer_fprints by an if --- executables/nr-ru.c | 2 -- openair1/SCHED_NR/nr_ru_procedures.c | 12 ++++++------ openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 4 +++- openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c | 2 +- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 1 + openair2/RRC/NR_UE/rrc_UE.c | 10 ++++++---- openair3/NGAP/ngap_gNB_nas_procedures.c | 9 +++++++-- 7 files changed, 24 insertions(+), 16 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 088c636c7a..be6d13daad 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1386,7 +1386,6 @@ void *ru_thread( void *param ) { } } - // At this point, all information for subframe has been received on FH interface res = pullTpool(gNB->resp_L1, gNB->threadPool); syncMsg = (processingData_L1_t *)NotifiedFifoData(res); @@ -1399,7 +1398,6 @@ void *ru_thread( void *param ) { res->key = proc->tti_rx; pushTpool(gNB->threadPool, res); - } printf( "Exiting ru_thread \n"); diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index c8e047d849..827e986f1b 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -306,16 +306,16 @@ static void *nr_feptx_thread(void *param) { if (ru->do_precoding == 1) { for(i=0; inb_log_antennas; ++i) { - memcpy((void*) &ru->common.beam_id[i][slot*fp->symbols_per_slot+l], - (void*) &ru->gNB_list[0]->common_vars.beam_id[i][slot*fp->symbols_per_slot+l], - (fp->symbols_per_slot>>1)*sizeof(uint8_t)); + memcpy((void*) &ru->common.beam_id[i][slot*fp->symbols_per_slot+l], + (void*) &ru->gNB_list[0]->common_vars.beam_id[i][slot*fp->symbols_per_slot+l], + (fp->symbols_per_slot>>1)*sizeof(uint8_t)); } } if (ru->nb_tx == 1 && ru->nb_log_antennas == 1) { - memcpy((void*)&ru->common.txdataF_BF[0][l*fp->ofdm_symbol_size], - (void*)&ru->gNB_list[0]->common_vars.txdataF[0][txdataF_offset + l*fp->ofdm_symbol_size], - (fp->samples_per_slot_wCP>>1)*sizeof(int32_t)); + memcpy((void*)&ru->common.txdataF_BF[0][l*fp->ofdm_symbol_size], + (void*)&ru->gNB_list[0]->common_vars.txdataF[0][txdataF_offset + l*fp->ofdm_symbol_size], + (fp->samples_per_slot_wCP>>1)*sizeof(int32_t)); } else if (ru->do_precoding == 0) { int gNB_tx = ru->gNB_list[0]->frame_parms.nb_antennas_tx; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 81d2d2c794..6a9734dd75 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2188,7 +2188,7 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->F = 0; ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->LCID = sdu_lcids[i]; ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->L = (unsigned char) sdu_lengths[i]; - mac_pdu_ptr += sizeof(NR_MAC_SUBHEADER_SHORT); + mac_pdu_ptr += sizeof(NR_MAC_SUBHEADER_SHORT); } else { ((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->R = 0; ((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->F = 1; @@ -2276,7 +2276,9 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, if(buflen > 0) // If the buflen is provided padding_bytes = buflen + pdu - (unsigned char *) mac_pdu_ptr; + AssertFatal(padding_bytes>=0,""); + // Compute final offset for padding if (post_padding || padding_bytes>0) { ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->R = 0; diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c index b1be1f65da..0b5d0ad486 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c @@ -66,7 +66,7 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, } /* SRBs always have MAC-I, even if integrity is not active */ - if ( entity->has_integrity || entity->type == NR_PDCP_SRB) { + if (entity->has_integrity || entity->type == NR_PDCP_SRB) { integrity_size = 4; } else { integrity_size = 0; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 97ae065904..fb657bf5a8 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -47,6 +47,7 @@ extern RAN_CONTEXT_t RC; #include #include + static nr_rlc_ue_manager_t *nr_rlc_ue_manager; /* TODO: handle time a bit more properly */ diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index feaf1a0a95..36087379fc 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1257,7 +1257,10 @@ nr_rrc_ue_process_masterCellGroup( (void **)&cellGroupConfig, (uint8_t *)masterCellGroup->buf, masterCellGroup->size, 0, 0); - xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)cellGroupConfig); + + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *) cellGroupConfig); + } if( cellGroupConfig->spCellConfig != NULL && cellGroupConfig->spCellConfig->reconfigurationWithSync != NULL){ //TODO (perform Reconfiguration with sync according to 5.3.5.5.2) @@ -2200,7 +2203,6 @@ nr_rrc_ue_establish_srb2( ie->nonCriticalExtension->masterCellGroup); } - if (ie->radioBearerConfig != NULL) { LOG_I(NR_RRC, "radio Bearer Configuration is present\n"); nr_sa_rrc_ue_process_radioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig); @@ -2304,9 +2306,9 @@ nr_rrc_ue_establish_srb2( return -1; } - // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message,(void *)dl_dcch_msg); - // } + } if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) { switch (dl_dcch_msg->message.choice.c1->present) { diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c index 4e149d9e27..8efab98dfa 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -771,7 +771,10 @@ int ngap_gNB_initial_ctxt_resp( //item->pDUSessionResourceSetupResponseTransfer.buf = res.buffer; //item->pDUSessionResourceSetupResponseTransfer.size = res.result.encoded; - xer_fprint(stdout, &asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, pdusessionTransfer_p); + if (asn1_xer_print) { + xer_fprint(stdout, &asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, pdusessionTransfer_p); + } + memset(pdusessionTransfer_buffer, 0, 1000); asn_enc_rval_t enc_rval = aper_encode_to_buffer(&asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, NULL, @@ -858,7 +861,9 @@ int ngap_gNB_initial_ctxt_resp( ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } - xer_fprint(stdout, &asn_DEF_NGAP_NGAP_PDU, &pdu); + if (asn1_xer_print) { + xer_fprint(stdout, &asn_DEF_NGAP_NGAP_PDU, &pdu); + } if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) { NGAP_ERROR("Failed to encode InitialContextSetupResponse\n"); From 78b3292c9c9eb77df5881f13d8f4730b29640108 Mon Sep 17 00:00:00 2001 From: Luis Pereira Date: Thu, 15 Jul 2021 09:02:18 +0000 Subject: [PATCH 092/135] Revert "Add noS1 flag in gnb_phytest_usrp_run" This reverts commit a8a5146029ef8ab0c25f30dccf67757f1dc42651 --- ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml | 2 +- ci-scripts/xml_files/gnb_phytest_usrp_run.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml index 56b246b148..b1e9697be2 100644 --- a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml +++ b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml @@ -33,7 +33,7 @@ Initialize_eNB Initialize gNB USRP - -O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test --noS1 + -O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test NR diff --git a/ci-scripts/xml_files/gnb_phytest_usrp_run.xml b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml index 3df99bed42..9e798afdc4 100644 --- a/ci-scripts/xml_files/gnb_phytest_usrp_run.xml +++ b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml @@ -33,7 +33,7 @@ Initialize_eNB Initialize gNB USRP - -O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test --noS1 -q -U 787200 -T 106 -t 28 -D 130175 -m 28 -M 106 + -O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test -q -U 787200 -T 106 -t 28 -D 130175 -m 28 -M 106 NR From f2b52ba3da36d63fadc9c00a795ebf29543d96ae Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 15 Jul 2021 10:35:54 +0100 Subject: [PATCH 093/135] Revert some xer_fprints --- openair2/RRC/NR_UE/rrc_UE.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 36087379fc..c988ec9b80 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1257,10 +1257,7 @@ nr_rrc_ue_process_masterCellGroup( (void **)&cellGroupConfig, (uint8_t *)masterCellGroup->buf, masterCellGroup->size, 0, 0); - - if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *) cellGroupConfig); - } + xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)cellGroupConfig); if( cellGroupConfig->spCellConfig != NULL && cellGroupConfig->spCellConfig->reconfigurationWithSync != NULL){ //TODO (perform Reconfiguration with sync according to 5.3.5.5.2) @@ -2306,9 +2303,9 @@ nr_rrc_ue_establish_srb2( return -1; } - if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message,(void *)dl_dcch_msg); - } + // } if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) { switch (dl_dcch_msg->message.choice.c1->present) { From ff7cc7ec1b9ec22b769337481ffdeb83ddd83fd0 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 15 Jul 2021 12:59:15 +0100 Subject: [PATCH 094/135] Add ulsch_max_slots_inactivity to SA config files --- .../conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf | 11 ++++++----- .../CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf | 11 ++++++----- .../CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf | 11 ++++++----- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf index f2da2e9fe3..0efc071c91 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf @@ -225,11 +225,12 @@ gNBs = ); MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + ulsch_max_slots_inactivity = 100; + } ); L1s = ( diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index 164830f97b..ac1f36c8b7 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -225,11 +225,12 @@ gNBs = ); MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + ulsch_max_slots_inactivity = 100; + } ); L1s = ( diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 1ec5f74cfb..1bada161a1 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -225,11 +225,12 @@ gNBs = ); MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + ulsch_max_slots_inactivity = 100; + } ); L1s = ( From a30b86cb45bdced2ee65fe6ba1723d53cfd763d4 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 15 Jul 2021 18:55:51 +0100 Subject: [PATCH 095/135] Update NSA config file --- ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf index 205922af0c..86293f2297 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf @@ -126,7 +126,7 @@ gNBs = initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 + initialULBWPstartSymbolAndLength_1 = 52; # this is SS=10 L=4 initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; From fd9e0b64eff0ef9b1bc649c637c33ab027e09ada Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 16 Jul 2021 07:33:14 +0000 Subject: [PATCH 096/135] Update FEATURE_SET.md --- doc/FEATURE_SET.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/FEATURE_SET.md b/doc/FEATURE_SET.md index 2171fc2f1f..263a57a04a 100644 --- a/doc/FEATURE_SET.md +++ b/doc/FEATURE_SET.md @@ -279,7 +279,7 @@ The following features are valid for the gNB and the 5G-NR UE. * Generation of NR-PDSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc). - Single symbol DMRS, DMRS-TypeA-Position Pos2, DMRS configuration type 1 - PDSCH mapping type A -* NR-CSI Generation of sequence at PHY (**under integration**) +* NR-CSIRS Generation of sequence at PHY * NR-PUSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc). * NR-PUCCH - Format 0 (2 bits, mainly for ACK/NACK) @@ -309,6 +309,7 @@ The following features are valid for the gNB and the 5G-NR UE. - MAC <-> PHY data interface using FAPI P7 interface for BCH PDU, DCI PDU, PDSCH PDU - Scheduler procedures for SIB1 - Scheduler procedures for RA +- Scheduler procedures for CSI-RS - MAC downlink scheduler (fixed allocations) - MAC header generation (including timing advance) - ACK / NACK handling and HARQ procedures for downlink @@ -339,7 +340,6 @@ The following features are valid for the gNB and the 5G-NR UE. * Generation of NR-PDSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc). - Single symbol DMRS, DMRS-TypeA-Position Pos2, DMRS configuration type 1 - PDSCH mapping type A -* NR-CSI Generation of sequence at PHY (**under integration**) * NR-PUSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc). * NR-PUCCH - Format 0 (2 bits, mainly for ACK/NACK) From bb9c3ca173192a2b7a268b6b216006361e1288af Mon Sep 17 00:00:00 2001 From: Parminder Singh Date: Fri, 16 Jul 2021 09:36:36 +0200 Subject: [PATCH 097/135] ue->high_speed_flag is removed from UE channel estimation - This flag is always set to 1, furthermore with multiple DMRS symbols configuration very recent DMRS containing symbol shall be for channel estimation. --- openair1/PHY/INIT/nr_init_ue.c | 3 -- .../nr_dl_channel_estimation.c | 31 ++++--------------- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 8 ++--- .../PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 13 ++++---- openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c | 10 ++---- .../NR_UE_TRANSPORT/nr_transport_proto_ue.h | 13 ++++---- openair1/PHY/defs_nr_UE.h | 4 +-- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 13 +++----- openair1/SIMULATION/NR_PHY/pbchsim.c | 13 ++++---- 9 files changed, 37 insertions(+), 71 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index a9c71d1582..014fccca43 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -468,9 +468,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, else ue->pdsch_config_dedicated->p_a = dB0; - // set channel estimation to do linear interpolation in time - ue->high_speed_flag = 1; - ue->ch_est_alpha = 24576; // enable MIB/SIB decoding by default ue->decode_MIB = 1; ue->decode_SIB = 1; diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 909d0b8954..3fedf9a663 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -224,10 +224,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier; if (ssb_offset>= ue->frame_parms.ofdm_symbol_size) ssb_offset-=ue->frame_parms.ofdm_symbol_size; - if (ue->high_speed_flag == 0) // use second channel estimate position for temporary storage - ch_offset = ue->frame_parms.ofdm_symbol_size ; - else - ch_offset = ue->frame_parms.ofdm_symbol_size*symbol; + ch_offset = ue->frame_parms.ofdm_symbol_size*symbol; AssertFatal(dmrss >= 0 && dmrss < 3, "symbol %d is illegal for PBCH DM-RS \n", @@ -285,10 +282,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset]; memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size)); - if (ue->high_speed_flag==0) // multiply previous channel estimate by ch_est_alpha - multadd_complex_vector_real_scalar(dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), - ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), - 1,ue->frame_parms.ofdm_symbol_size); + #ifdef DEBUG_CH printf("pbch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL); printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset); @@ -492,11 +486,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, int **dl_ch_estimates =ue->pdcch_vars[proc->thread_id][eNB_offset]->dl_ch_estimates; int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; - - if (ue->high_speed_flag == 0) // use second channel estimate position for temporary storage - ch_offset = ue->frame_parms.ofdm_symbol_size ; - else - ch_offset = ue->frame_parms.ofdm_symbol_size*symbol; + ch_offset = ue->frame_parms.ofdm_symbol_size*symbol; symbol_offset = ue->frame_parms.ofdm_symbol_size*symbol; @@ -531,10 +521,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset]; memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size)); - if (ue->high_speed_flag==0) // multiply previous channel estimate by ch_est_alpha - multadd_complex_vector_real_scalar(dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), - ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), - 1,ue->frame_parms.ofdm_symbol_size); + #ifdef DEBUG_PDCCH printf("pdcch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL); printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset); @@ -679,10 +666,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, int **dl_ch_estimates =ue->pdsch_vars[proc->thread_id][eNB_offset]->dl_ch_estimates; int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; - if (ue->high_speed_flag == 0) - ch_offset = ue->frame_parms.ofdm_symbol_size; - else - ch_offset = ue->frame_parms.ofdm_symbol_size*symbol; + ch_offset = ue->frame_parms.ofdm_symbol_size*symbol; symbol_offset = ue->frame_parms.ofdm_symbol_size*symbol; @@ -800,10 +784,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, dl_ch = (int16_t *)&dl_ch_estimates[p*ue->frame_parms.nb_antennas_rx+aarx][ch_offset]; memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size)); - if (ue->high_speed_flag==0) // multiply previous channel estimate by ch_est_alpha - multadd_complex_vector_real_scalar(dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), - ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), - 1,ue->frame_parms.ofdm_symbol_size); + #ifdef DEBUG_PDSCH printf("ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL); printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 2046c13eaa..0cbe4dc085 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -390,11 +390,11 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); #if DISABLE_LOG_X - printf("[AbsSFN %u.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n", - frame,nr_slot_rx,slot,symbol,ue->high_speed_flag,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + printf("[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n", + frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); #else - LOG_I(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n", - frame,nr_slot_rx,slot,symbol,ue->high_speed_flag,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + LOG_I(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n", + frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); #endif #endif diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index df35f14869..a91dec343a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -161,13 +161,12 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini #endif ret = nr_rx_pbch(ue, - proc, - ue->pbch_vars[0], - frame_parms, - 0, - temp_ptr->i_ssb, - SISO, - ue->high_speed_flag); + proc, + ue->pbch_vars[0], + frame_parms, + 0, + temp_ptr->i_ssb, + SISO); temp_ptr=temp_ptr->next_ssb; } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index f0e6e9984b..05264014ed 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -54,7 +54,6 @@ uint16_t nr_pbch_extract(int **rxdataF, int **dl_ch_estimates_ext, uint32_t symbol, uint32_t s_offset, - uint32_t high_speed_flag, NR_DL_FRAME_PARMS *frame_parms) { uint16_t rb; uint8_t i,j,aarx; @@ -138,10 +137,7 @@ uint16_t nr_pbch_extract(int **rxdataF, } } - if (high_speed_flag == 1) - dl_ch0 = &dl_ch_estimates[aarx][((symbol+s_offset)*(frame_parms->ofdm_symbol_size))]; - else - dl_ch0 = &dl_ch_estimates[aarx][0]; + dl_ch0 = &dl_ch_estimates[aarx][((symbol+s_offset)*(frame_parms->ofdm_symbol_size))]; //printf("dl_ch0 addr %p\n",dl_ch0); dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*20*12]; @@ -420,8 +416,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, NR_DL_FRAME_PARMS *frame_parms, uint8_t gNB_id, uint8_t i_ssb, - MIMO_mode_t mimo_mode, - uint32_t high_speed_flag) { + MIMO_mode_t mimo_mode) { NR_UE_COMMON *nr_ue_common_vars = &ue->common_vars; int max_h=0; @@ -470,7 +465,6 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, nr_ue_pbch_vars->dl_ch_estimates_ext, symbol, symbol_offset, - high_speed_flag, frame_parms); #ifdef DEBUG_PBCH LOG_I(PHY,"[PHY] PBCH Symbol %d ofdm size %d\n",symbol, frame_parms->ofdm_symbol_size ); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index 1e7e10def7..47093b6e3b 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -1166,13 +1166,12 @@ int rx_sss(PHY_VARS_NR_UE *phy_vars_ue,int32_t *tot_metric,uint8_t *flip_max,uin \returns number of tx antennas or -1 if error */ int nr_rx_pbch( PHY_VARS_NR_UE *ue, - UE_nr_rxtx_proc_t *proc, - NR_UE_PBCH *nr_ue_pbch_vars, - NR_DL_FRAME_PARMS *frame_parms, - uint8_t eNB_id, - uint8_t i_ssb, - MIMO_mode_t mimo_mode, - uint32_t high_speed_flag); + UE_nr_rxtx_proc_t *proc, + NR_UE_PBCH *nr_ue_pbch_vars, + NR_DL_FRAME_PARMS *frame_parms, + uint8_t eNB_id, + uint8_t i_ssb, + MIMO_mode_t mimo_mode); int nr_pbch_detection(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index e3c0737838..cf08b3d214 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -859,9 +859,9 @@ typedef struct { uint32_t X_u[64][839]; - uint32_t high_speed_flag; + uint32_t perfect_ce; - int16_t ch_est_alpha; + int generate_ul_signal[NUMBER_OF_CONNECTED_gNB_MAX]; UE_NR_SCAN_INFO_t scan_info[NB_BANDS_MAX]; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index e3d4c54f5a..998db6400f 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -354,12 +354,11 @@ void nr_ue_pbch_procedures(uint8_t gNB_id, LOG_D(PHY,"[UE %d] Frame %d Slot %d, Trying PBCH (NidCell %d, gNB_id %d)\n",ue->Mod_id,frame_rx,nr_slot_rx,ue->frame_parms.Nid_cell,gNB_id); ret = nr_rx_pbch(ue, proc, - ue->pbch_vars[gNB_id], - &ue->frame_parms, - gNB_id, - (ue->frame_parms.ssb_index)&7, - SISO, - ue->high_speed_flag); + ue->pbch_vars[gNB_id], + &ue->frame_parms, + gNB_id, + (ue->frame_parms.ssb_index)&7, + SISO); if (ret==0) { @@ -788,8 +787,6 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ } #endif } - if ( ue->high_speed_flag == 0 ) //for slow speed case only estimate the channel once per slot - break; } } diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 548b76db69..448e1e7799 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -706,13 +706,12 @@ int main(int argc, char **argv) } ret = nr_rx_pbch(UE, - &proc, - UE->pbch_vars[0], - frame_parms, - 0, - ssb_index%8, - SISO, - UE->high_speed_flag); + &proc, + UE->pbch_vars[0], + frame_parms, + 0, + ssb_index%8, + SISO); if (ret==0) { //UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically From abef7f0b081fb3f9ef52f4324b4e5b1e73334ba1 Mon Sep 17 00:00:00 2001 From: Roberto Louro Magueta Date: Fri, 16 Jul 2021 15:34:53 +0000 Subject: [PATCH 098/135] Revert "Temporary fix for prach_thres" This reverts commit af0d7dabbae7a7fa441ff8ebeac92e32955c8421 --- openair2/GNB_APP/L1_nr_paramdef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/GNB_APP/L1_nr_paramdef.h b/openair2/GNB_APP/L1_nr_paramdef.h index 8a41ac8a88..fd22e92730 100644 --- a/openair2/GNB_APP/L1_nr_paramdef.h +++ b/openair2/GNB_APP/L1_nr_paramdef.h @@ -66,7 +66,7 @@ {CONFIG_STRING_L1_REMOTE_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:100, TYPE_UINT, 0}, \ -{CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:250, TYPE_UINT, 0}, \ +{CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:200, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:50, TYPE_UINT, 0} \ } #define L1_CC_IDX 0 From 64c28bf9ac44900fc4247650aba97484644e085a Mon Sep 17 00:00:00 2001 From: rmagueta Date: Fri, 16 Jul 2021 16:50:51 +0100 Subject: [PATCH 099/135] Normalization of energy over ifft and receive antennas --- openair1/PHY/NR_TRANSPORT/nr_prach.c | 34 +++++++++++++++++++--------- openair2/GNB_APP/L1_nr_paramdef.h | 2 +- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index bf944e27aa..000348ae87 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -872,24 +872,36 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, // Now do IFFT of size 1024 (N_ZC=839) or 256 (N_ZC=139) if (N_ZC == 839) { - log2_ifft_size = 10; idft(IDFT_1024,prachF,prach_ifft_tmp,1); // compute energy and accumulate over receive antennas - for (i=0;i<2048;i++) - prach_ifft[i] += ((int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[i<<1] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)])/nb_rx; + for (i=0;i<1024;i++) + prach_ifft[i] += (int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[i<<1] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)]; } else { idft(IDFT_256,prachF,prach_ifft_tmp,1); log2_ifft_size = 8; - // compute energy and accumulate over receive antennas and repetitions for BR - for (i=0;i<256;i++) - prach_ifft[i] += ((int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[(i<<1)] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)])/nb_rx; - } + // compute energy and accumulate over receive antennas and repetitions for BR + for (i=0;i<256;i++) + prach_ifft[i] += (int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[(i<<1)] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)]; + } + + if (LOG_DUMPFLAG(PRACH)) { + if (aa==0) LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1); + if (aa==1) LOG_M("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1); + } - if (LOG_DUMPFLAG(PRACH)) { - if (aa==0) LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1); - if (aa==1) LOG_M("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1); - } }// antennas_rx + + // Normalization of energy over ifft and receive antennas + if (N_ZC == 839) { + log2_ifft_size = 10; + for (i=0;i<1024;i++) + prach_ifft[i] = (prach_ifft[i]>>log2_ifft_size)/nb_rx; + } else { + log2_ifft_size = 8; + for (i=0;i<256;i++) + prach_ifft[i] = (prach_ifft[i]>>log2_ifft_size)/nb_rx; + } + } // new dft // check energy in nth time shift, for diff --git a/openair2/GNB_APP/L1_nr_paramdef.h b/openair2/GNB_APP/L1_nr_paramdef.h index fd22e92730..fc2bca19d5 100644 --- a/openair2/GNB_APP/L1_nr_paramdef.h +++ b/openair2/GNB_APP/L1_nr_paramdef.h @@ -66,7 +66,7 @@ {CONFIG_STRING_L1_REMOTE_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:100, TYPE_UINT, 0}, \ -{CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:200, TYPE_UINT, 0}, \ +{CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:150, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:50, TYPE_UINT, 0} \ } #define L1_CC_IDX 0 From 9c010e3056fb6b13625f91511a26fab0047258ab Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Sat, 17 Jul 2021 22:25:07 +0100 Subject: [PATCH 100/135] Apply patch for gNB ulsch retransmission scheduler --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index b7438fd927..a49b6f58a1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -144,7 +144,7 @@ void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ub if ((symb_pucch & symb_tda_mi) == 0 && (symb_ulMixed & symb_tda_mi) == symb_tda_mi) { tdaMi = 1; } else { - LOG_E(MAC, + LOG_E(NR_MAC, "TDA index 1 UL overlaps with PUCCH or is not entirely in mixed slot (symb_pucch %x symb_ulMixed %x symb_tda_mi %x), won't schedule UL mixed slot\n", symb_pucch, symb_ulMixed, @@ -168,7 +168,7 @@ void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ub } if (k2 < tdd->nrofUplinkSlots) - LOG_W(MAC, + LOG_W(NR_MAC, "k2 %d < tdd->nrofUplinkSlots %ld: not all UL slots can be scheduled\n", k2, tdd->nrofUplinkSlots); @@ -331,7 +331,7 @@ void nr_process_mac_pdu(module_id_t module_idP, sched_ctrl->ph = PH - 32 + (PH - 54); /* 38.133 Table10.1.18.1-1 */ sched_ctrl->pcmax = PCMAX - 29; - LOG_D(MAC, "SINGLE ENTRY PHR R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n", + LOG_D(NR_MAC, "SINGLE ENTRY PHR R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n", phr->R1, PH, sched_ctrl->ph, phr->R2, PCMAX, sched_ctrl->pcmax); break; @@ -817,7 +817,7 @@ bool nr_UE_is_to_be_scheduled(module_id_t mod_id, int CC_id, int UE_id, frame_t * (3) or we did not schedule it in more than 10 frames */ const bool has_data = sched_ctrl->estimated_ul_buffer > sched_ctrl->sched_ul_bytes; const bool high_inactivity = diff >= nrmac->ulsch_max_slots_inactivity; - LOG_D(MAC, + LOG_D(NR_MAC, "%4d.%2d UL inactivity %d slots has_data %d SR %d\n", frame, slot, @@ -854,12 +854,13 @@ bool allocate_ul_retransmission(module_id_t module_id, const uint8_t num_dmrs_cdm_grps_no_data = sched_ctrl->active_bwp ? 1 : 2; const int tda = sched_ctrl->active_ubwp ? RC.nrmac[module_id]->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 0; + LOG_D(NR_MAC,"retInfo->time_domain_allocation = %d, tda = %d\n", retInfo->time_domain_allocation, tda); if (tda == retInfo->time_domain_allocation) { /* Check the resource is enough for retransmission */ while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; - if (rbStart + retInfo->rbSize >= bwpSize) { - LOG_D(MAC, "cannot allocate retransmission of UE %d/RNTI %04x: no resources\n", UE_id, UE_info->rnti[UE_id]); + if (rbStart + retInfo->rbSize > bwpSize) { + LOG_W(NR_MAC, "cannot allocate retransmission of UE %d/RNTI %04x: no resources (rbStart %d, retInfo->rbSize %d, bwpSize %d\n", UE_id, UE_info->rnti[UE_id], rbStart, retInfo->rbSize, bwpSize); return false; } /* check whether we need to switch the TDA allocation since tha last @@ -871,7 +872,7 @@ bool allocate_ul_retransmission(module_id_t module_id, || ps->dci_format != dci_format || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); - LOG_D(MAC, "%s(): retransmission keeping TDA %d and TBS %d\n", __func__, tda, retInfo->tb_size); + LOG_D(NR_MAC, "%s(): retransmission keeping TDA %d and TBS %d\n", __func__, tda, retInfo->tb_size); } else { /* the retransmission will use a different time domain allocation, check * that we have enough resources */ @@ -895,10 +896,10 @@ bool allocate_ul_retransmission(module_id_t module_id, &new_tbs, &new_rbSize); if (!success || new_tbs != retInfo->tb_size) { - LOG_D(MAC, "%s(): new TBsize %d of new TDA does not match old TBS %d\n", __func__, new_tbs, retInfo->tb_size); + LOG_D(NR_MAC, "%s(): new TBsize %d of new TDA does not match old TBS %d\n", __func__, new_tbs, retInfo->tb_size); return false; /* the maximum TBsize we might have is smaller than what we need */ } - LOG_D(MAC, "%s(): retransmission with TDA %d->%d and TBS %d -> %d\n", __func__, retInfo->time_domain_allocation, tda, retInfo->tb_size, new_tbs); + LOG_D(NR_MAC, "%s(): retransmission with TDA %d->%d and TBS %d -> %d\n", __func__, retInfo->time_domain_allocation, tda, retInfo->tb_size, new_tbs); /* we can allocate it. Overwrite the time_domain_allocation, the number * of RBs, and the new TB size. The rest is done below */ retInfo->tb_size = new_tbs; @@ -910,7 +911,7 @@ bool allocate_ul_retransmission(module_id_t module_id, /* Find free CCE */ bool freeCCE = find_free_CCE(module_id, slot, UE_id); if (!freeCCE) { - LOG_D(MAC, "%4d.%2d no free CCE for retransmission UL DCI UE %04x\n", frame, slot, UE_info->rnti[UE_id]); + LOG_D(NR_MAC, "%4d.%2d no free CCE for retransmission UL DCI UE %04x\n", frame, slot, UE_info->rnti[UE_id]); return false; } @@ -923,7 +924,7 @@ bool allocate_ul_retransmission(module_id_t module_id, sched_ctrl->sched_pusch = *retInfo; NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; - LOG_D(MAC, + LOG_D(NR_MAC, "%4d.%2d Allocate UL retransmission UE %d/RNTI %04x sched %4d.%2d (%d RBs)\n", frame, slot, @@ -999,7 +1000,7 @@ void pf_ul(module_id_t module_id, bool r = allocate_ul_retransmission( module_id, frame, slot, rballoc_mask, &n_rb_sched, UE_id, sched_pusch->ul_harq_pid); if (!r) { - LOG_D(MAC, "%4d.%2d UL retransmission UE RNTI %04x can NOT be allocated\n", frame, slot, UE_info->rnti[UE_id]); + LOG_D(NR_MAC, "%4d.%2d UL retransmission UE RNTI %04x can NOT be allocated\n", frame, slot, UE_info->rnti[UE_id]); continue; } /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */ @@ -1030,7 +1031,7 @@ void pf_ul(module_id_t module_id, if (max_num_ue < 0) return; - LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb,rbStart); + LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb, rbStart); while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; if (rbStart + min_rb >= bwpSize) { LOG_W(NR_MAC, "cannot allocate continuous UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n", @@ -1162,7 +1163,7 @@ void pf_ul(module_id_t module_id, &rbSize); sched_pusch->rbSize = rbSize; sched_pusch->tb_size = TBS; - LOG_D(MAC,"rbSize %d, TBS %d, est buf %d, sched_ul %d, B %d\n", + LOG_D(NR_MAC,"rbSize %d, TBS %d, est buf %d, sched_ul %d, B %d\n", rbSize, sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B); /* Mark the corresponding RBs as used */ From 1ec50d4d2c739c51c052a768fecdc41ac011a573 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 16 Jul 2021 16:23:03 +0200 Subject: [PATCH 101/135] fix(oai-lte-ue): unrestrict socket in nas init. Fix running with a docker Ubuntu container Signed-off-by: Raphael Defosseux --- .../4g_rfsimulator/docker-compose.yml | 272 ++++++++++++++++++ .../yaml_files/4g_rfsimulator/oai_db.cql | 93 ++++++ docker/Dockerfile.eNB.ubuntu18 | 1 + docker/Dockerfile.lteUE.ubuntu18 | 1 + openair3/NAS/UE/nas_parser.c | 5 +- openair3/NAS/UE/nas_parser.h | 2 +- 6 files changed, 369 insertions(+), 5 deletions(-) create mode 100644 ci-scripts/yaml_files/4g_rfsimulator/docker-compose.yml create mode 100644 ci-scripts/yaml_files/4g_rfsimulator/oai_db.cql diff --git a/ci-scripts/yaml_files/4g_rfsimulator/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator/docker-compose.yml new file mode 100644 index 0000000000..d8be6679b1 --- /dev/null +++ b/ci-scripts/yaml_files/4g_rfsimulator/docker-compose.yml @@ -0,0 +1,272 @@ +version: '3.8' + +services: + cassandra: + image: cassandra:2.1 + container_name: rfsim4g-cassandra + networks: + private_net: + ipv4_address: 192.168.68.2 + environment: + CASSANDRA_CLUSTER_NAME: "OAI HSS Cluster" + CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch + healthcheck: + test: /bin/bash -c "nodetool status" + interval: 10s + timeout: 5s + retries: 5 + + db_init: + image: cassandra:2.1 + container_name: rfsim4g-db-init + depends_on: [cassandra] + deploy: + restart_policy: + condition: on-failure + max_attempts: 10 + networks: + private_net: + ipv4_address: 192.168.68.4 + volumes: + - ./oai_db.cql:/home/oai_db.cql + entrypoint: /bin/bash -c "cqlsh --file /home/oai_db.cql 192.168.68.2 && echo 'OK'" + + oai_hss: + image: oai-hss:develop-2021-06-14 + container_name: rfsim4g-oai-hss + privileged: true + depends_on: [cassandra] + networks: + private_net: + ipv4_address: 192.168.68.3 + public_net: + ipv4_address: 192.168.61.2 + environment: + REALM: openairinterface.org + HSS_FQDN: hss.openairinterface.org + PREFIX: /openair-hss/etc + cassandra_Server_IP: 192.168.68.2 + OP_KEY: 1006020f0a478bf6b699f15c062e42b3 + LTE_K: fec86ba6eb707ed08905757b1bb44b8f + APN1: oai.ipv4 + APN2: internet + FIRST_IMSI: 208960100000001 + NB_USERS: 10 + healthcheck: + test: /bin/bash -c "pgrep oai_hss" + interval: 10s + timeout: 5s + retries: 5 + + oai_mme: + image: oai-mme:production + container_name: rfsim4g-oai-mme + privileged: true + depends_on: [oai_hss] + networks: + public_net: + ipv4_address: 192.168.61.3 + environment: + REALM: openairinterface.org + PREFIX: /openair-mme/etc + INSTANCE: 1 + PID_DIRECTORY: /var/run + HSS_IP_ADDR: 192.168.61.2 + HSS_HOSTNAME: hss + HSS_FQDN: hss.openairinterface.org + HSS_REALM: openairinterface.org + MCC: '208' + MNC: '96' + MME_GID: 32768 + MME_CODE: 3 + TAC_0: 1 + TAC_1: 2 + TAC_2: 3 + MME_FQDN: mme.openairinterface.org + MME_S6A_IP_ADDR: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S1_MME: eth0 + MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S11: eth0 + MME_IPV4_ADDRESS_FOR_S11: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S10: lo + MME_IPV4_ADDRESS_FOR_S10: 127.0.0.10 + OUTPUT: CONSOLE + SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.4 + PEER_MME_IPV4_ADDRESS_FOR_S10_0: 0.0.0.0 + PEER_MME_IPV4_ADDRESS_FOR_S10_1: 0.0.0.0 + MCC_SGW_0: '208' + MNC3_SGW_0: '096' + TAC_LB_SGW_0: '01' + TAC_HB_SGW_0: '00' + MCC_MME_0: '208' + MNC3_MME_0: '096' + TAC_LB_MME_0: '02' + TAC_HB_MME_0: '00' + MCC_MME_1: '208' + MNC3_MME_1: '096' + TAC_LB_MME_1: '03' + TAC_HB_MME_1: '00' + TAC_LB_SGW_TEST_0: '03' + TAC_HB_SGW_TEST_0: '00' + SGW_IPV4_ADDRESS_FOR_S11_TEST_0: 0.0.0.0 + healthcheck: + test: /bin/bash -c "pgrep oai_mme" + interval: 10s + timeout: 5s + retries: 5 + + oai_spgwc: + image: oai-spgwc:develop-2021-06-14 + privileged: true + depends_on: [oai_mme] + container_name: rfsim4g-oai-spgwc + networks: + public_net: + ipv4_address: 192.168.61.4 + environment: + TZ: Europe/Paris + SGW_INTERFACE_NAME_FOR_S11: eth0 + PGW_INTERFACE_NAME_FOR_SX: eth0 + DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129 + DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 + PUSH_PROTOCOL_OPTION: 'true' + APN_NI_1: oai.ipv4 + APN_NI_2: oai.ipv4_2 + DEFAULT_APN_NI_1: oai.ipv4 + UE_IP_ADDRESS_POOL_1: '12.0.0.2 - 12.0.0.254' + UE_IP_ADDRESS_POOL_2: '12.1.1.2 - 12.1.1.254' + MCC: '208' + MNC: '96' + MNC03: '096' + TAC: 1 + GW_ID: 1 + REALM: openairinterface.org + healthcheck: + test: /bin/bash -c "pgrep oai_spgwc" + interval: 10s + timeout: 5s + retries: 5 + + oai_spgwu: + image: oai-spgwu-tiny:develop-2021-06-14 + privileged: true + container_name: rfsim4g-oai-spgwu-tiny + depends_on: [oai_spgwc] + networks: + public_net: + ipv4_address: 192.168.61.5 + environment: + TZ: Europe/Paris + PID_DIRECTORY: /var/run + INSTANCE: 1 + SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP: eth0 + PGW_INTERFACE_NAME_FOR_SGI: eth0 + SGW_INTERFACE_NAME_FOR_SX: eth0 + SPGWC0_IP_ADDRESS: 192.168.61.4 + NETWORK_UE_IP: '12.0.0.0/24' + NETWORK_UE_NAT_OPTION: 'yes' + MCC: '208' + MNC: '96' + MNC03: '096' + TAC: 1 + GW_ID: 1 + REALM: openairinterface.org + healthcheck: + test: /bin/bash -c "pgrep oai_spgwu" + interval: 10s + timeout: 5s + retries: 5 + + flexran_rtc: + image: flexran-rtc:production + privileged: true + container_name: rfsim4g-flexran-rtc + networks: + public_net: + ipv4_address: 192.168.61.10 + healthcheck: + test: /bin/bash -c "pgrep rt_controller" + interval: 10s + timeout: 5s + retries: 5 + + trf_gen: + image: trf-gen:production + privileged: true + container_name: rfsim4g-trf-gen + networks: + public_net: + ipv4_address: 192.168.61.11 + entrypoint: /bin/bash -c "ip route add 12.0.0.0/24 via 192.168.61.5 dev eth0; sleep infinity" + healthcheck: + test: /bin/bash -c "ping -c 2 192.168.61.5" + interval: 10s + timeout: 5s + retries: 5 + + enb: + image: oai-enb:develop + privileged: true + container_name: rfsim4g-oai-enb + networks: + public_net: + ipv4_address: 192.168.61.20 + environment: + TZ: Europe/Paris + USE_FDD_MONO: 'yes' + RFSIMULATOR: enb + ENB_NAME: eNB-rf-sim + MCC: '208' + MNC: '96' + MNC_LENGTH: 2 + TAC: 1 + UTRA_BAND_ID: 7 + DL_FREQUENCY_IN_MHZ: 2680 + UL_FREQUENCY_OFFSET_IN_MHZ: 120 + NID_CELL: 10 + NB_PRB: 25 + MME_S1C_IP_ADDRESS: 192.168.61.3 + ENB_S1C_IF_NAME: eth0 + ENB_S1C_IP_ADDRESS: 192.168.61.20 + ENB_S1U_IF_NAME: eth0 + ENB_S1U_IP_ADDRESS: 192.168.61.20 + ENB_X2_IP_ADDRESS: 192.168.61.20 + FLEXRAN_ENABLED: 'no' + FLEXRAN_INTERFACE_NAME: eth0 + FLEXRAN_IPV4_ADDRESS: 192.168.61.10 + USE_ADDITIONAL_OPTIONS: --rfsim + + oai_ue0: + image: oai-lte-ue:develop + privileged: true + container_name: rfsim4g-oai-lte-ue0 + networks: + public_net: + ipv4_address: 192.168.61.30 + expose: + - "10000" + environment: + TZ: Europe/Paris + HOSTNAME: oai_ue0 + RFSIMULATOR: 192.168.61.20 + MCC: '208' + MNC: '96' + SHORT_IMSI: '0100000001' + LTE_KEY: 'fec86ba6eb707ed08905757b1bb44b8f' + OPC: 'c42449363bbad02b66d16bc975d77cc1' + MSISDN: '001011234561010' + HPLMN: 20896 + USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --nokrnmod 1 + +networks: + private_net: + name: rfsim4g-oai-private-net + ipam: + config: + - subnet: 192.168.68.0/26 + public_net: + name: rfsim4g-oai-public-net + ipam: + config: + - subnet: 192.168.61.0/26 + diff --git a/ci-scripts/yaml_files/4g_rfsimulator/oai_db.cql b/ci-scripts/yaml_files/4g_rfsimulator/oai_db.cql new file mode 100644 index 0000000000..2be0a8e2e9 --- /dev/null +++ b/ci-scripts/yaml_files/4g_rfsimulator/oai_db.cql @@ -0,0 +1,93 @@ +CREATE KEYSPACE IF NOT EXISTS vhss WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': '1'}; + +CREATE TABLE IF NOT EXISTS vhss.users_imsi ( + imsi text PRIMARY KEY, + access_restriction int, + idmmeidentity int, + imei text, + imei_sv text, + key text, + lipa_permissions text, + mme_cap int, + mmehost text, + mmeidentity_idmmeidentity int, + mmerealm text, + ms_ps_status text, + msisdn bigint, + niddvalidity text, + nir_dest_host text, + nir_dest_realm text, + opc text, + pgw_id int, + rand text, + rfsp_index varint, + sqn bigint, + subscription_data text, + ue_reachability varint, + urrp_mme varint, + user_identifier text, + visited_plmnid text); + +CREATE TABLE IF NOT EXISTS vhss.msisdn_imsi ( + msisdn bigint PRIMARY KEY, + imsi text +); + +CREATE TABLE IF NOT EXISTS vhss.global_ids ( + table_name text PRIMARY KEY, + id counter); + +CREATE TABLE IF NOT EXISTS vhss.mmeidentity_host ( + mmehost text PRIMARY KEY, + idmmeidentity int, + mmerealm text, + ue_reachability varint, + mmeisdn text); + +CREATE TABLE IF NOT EXISTS vhss.mmeidentity ( + idmmeidentity int PRIMARY KEY, + mmehost text, + mmerealm text, + ue_reachability varint, + mmeisdn text); + +CREATE TABLE IF NOT EXISTS vhss.events ( + scef_id text, + scef_ref_id bigint, + extid text, + monitoring_event_configuration text, + monitoring_type int, + msisdn bigint, + user_identifier text, + primary key (scef_id, scef_ref_id) +); + +CREATE TABLE IF NOT EXISTS vhss.events_msisdn ( + msisdn bigint, + scef_id text, + scef_ref_id bigint, + primary key (msisdn, scef_id, scef_ref_id) +); + +CREATE TABLE IF NOT EXISTS vhss.events_extid ( + extid text, + scef_id text, + scef_ref_id bigint, + primary key (extid, scef_id, scef_ref_id) +); + +CREATE TABLE IF NOT EXISTS vhss.extid ( + extid text primary key +); + +CREATE TABLE IF NOT EXISTS vhss.extid_imsi ( + extid text, + imsi text, + primary key (extid, imsi) +); + +CREATE TABLE IF NOT EXISTS vhss.extid_imsi_xref ( + imsi text, + extid text, + primary key (imsi, extid) +); diff --git a/docker/Dockerfile.eNB.ubuntu18 b/docker/Dockerfile.eNB.ubuntu18 index 1f276094d5..2954d3fb18 100644 --- a/docker/Dockerfile.eNB.ubuntu18 +++ b/docker/Dockerfile.eNB.ubuntu18 @@ -60,6 +60,7 @@ RUN apt-get update && \ net-tools \ iputils-ping \ iproute2 \ + iperf \ libyaml-0-2 && \ # Install UHD driver from ettus ppa # At time of writing, it is 3.14 diff --git a/docker/Dockerfile.lteUE.ubuntu18 b/docker/Dockerfile.lteUE.ubuntu18 index 6575a81899..fcd16f0c15 100644 --- a/docker/Dockerfile.lteUE.ubuntu18 +++ b/docker/Dockerfile.lteUE.ubuntu18 @@ -61,6 +61,7 @@ RUN apt-get update && \ net-tools \ iputils-ping \ iproute2 \ + iperf \ libyaml-0-2 && \ # Install UHD driver from ettus ppa # At time of writing, it is 3.14 diff --git a/openair3/NAS/UE/nas_parser.c b/openair3/NAS/UE/nas_parser.c index beba47f64a..94c61b654c 100644 --- a/openair3/NAS/UE/nas_parser.c +++ b/openair3/NAS/UE/nas_parser.c @@ -86,10 +86,7 @@ static parser_command_line_t nasParserCommandLine = { "-trace", "", "Logging trace level\t\t", NAS_PARSER_DEFAULT_TRACE_LEVEL }, - { - "-uhost", "", "User app layer's hostname\t", - NAS_PARSER_DEFAULT_USER_HOSTNAME - }, + {"-uhost", "", "User app layer's hostname\t", "NULL"}, { "-nhost", "", "Network layer's hostname\t", NAS_PARSER_DEFAULT_NETWORK_HOSTNAME diff --git a/openair3/NAS/UE/nas_parser.h b/openair3/NAS/UE/nas_parser.h index 0924654e3f..1c97dbdaf1 100644 --- a/openair3/NAS/UE/nas_parser.h +++ b/openair3/NAS/UE/nas_parser.h @@ -55,7 +55,7 @@ Description NAS command line parser #define NAS_PARSER_DEFAULT_UE_ID "1" /* User application layer default hostname */ -#define NAS_PARSER_DEFAULT_USER_HOSTNAME "localhost" +#define NAS_PARSER_DEFAULT_USER_HOSTNAME NULL /* User application layer default port number */ #define NAS_PARSER_DEFAULT_USER_PORT_NUMBER "10000" From f89d367ad4d22e9fd009d92d1c80cbfd5eda167a Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 16 Jul 2021 14:51:47 +0200 Subject: [PATCH 102/135] CI: adding bsd exception Signed-off-by: Raphael Defosseux --- ci-scripts/checkCodingFormattingRules.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci-scripts/checkCodingFormattingRules.sh b/ci-scripts/checkCodingFormattingRules.sh index 3a2fcbb02c..45cf08aa9a 100755 --- a/ci-scripts/checkCodingFormattingRules.sh +++ b/ci-scripts/checkCodingFormattingRules.sh @@ -76,8 +76,8 @@ then do IS_NFAPI=`echo $FILE | egrep -c "nfapi/open-nFAPI|nfapi/oai_integration/vendor_ext" || true` IS_OAI_LICENCE_PRESENT=`egrep -c "OAI Public License" $FILE || true` - IS_BSD_LICENCE_PRESENT=`egrep -c "the terms of the BSD Licence" $FILE || true` - IS_EXCEPTION=`echo $FILE | egrep -c "common/utils/collection/tree.h|common/utils/collection/queue.h|common/utils/itti_analyzer/common/queue.h|openair3/UTILS/tree.h|openair3/UTILS/queue.h|openair3/GTPV1-U/nw-gtpv1u|openair2/UTIL/OPT/ws_|openair3/NAS/COMMON/milenage.h" || true` + IS_BSD_LICENCE_PRESENT=`egrep -c "the terms of the BSD Licence|License-Identifier: BSD-2-Clause" $FILE || true` + IS_EXCEPTION=`echo $FILE | egrep -c "common/utils/collection/tree.h|common/utils/collection/queue.h|common/utils/itti_analyzer/common/queue.h|openair3/UTILS/tree.h|openair3/UTILS/queue.h|openair3/GTPV1-U/nw-gtpv1u|openair2/UTIL/OPT/ws_|openair2/UTIL/OPT/packet-rohc.h|openair3/NAS/COMMON/milenage.h" || true` if [ $IS_OAI_LICENCE_PRESENT -eq 0 ] && [ $IS_BSD_LICENCE_PRESENT -eq 0 ] then if [ $IS_NFAPI -eq 0 ] && [ $IS_EXCEPTION -eq 0 ] @@ -197,8 +197,8 @@ do then IS_NFAPI=`echo $FULLFILE | egrep -c "nfapi/open-nFAPI|nfapi/oai_integration/vendor_ext" || true` IS_OAI_LICENCE_PRESENT=`egrep -c "OAI Public License" $FULLFILE || true` - IS_BSD_LICENCE_PRESENT=`egrep -c "the terms of the BSD Licence" $FULLFILE || true` - IS_EXCEPTION=`echo $FULLFILE | egrep -c "common/utils/collection/tree.h|common/utils/collection/queue.h|common/utils/itti_analyzer/common/queue.h|openair3/UTILS/tree.h|openair3/UTILS/queue.h|openair3/GTPV1-U/nw-gtpv1u|openair2/UTIL/OPT/ws_|openair3/NAS/COMMON/milenage.h" || true` + IS_BSD_LICENCE_PRESENT=`egrep -c "the terms of the BSD Licence|License-Identifier: BSD-2-Clause" $FULLFILE || true` + IS_EXCEPTION=`echo $FULLFILE | egrep -c "common/utils/collection/tree.h|common/utils/collection/queue.h|common/utils/itti_analyzer/common/queue.h|openair3/UTILS/tree.h|openair3/UTILS/queue.h|openair3/GTPV1-U/nw-gtpv1u|openair2/UTIL/OPT/ws_|openair2/UTIL/OPT/packet-rohc.h|openair3/NAS/COMMON/milenage.h" || true` if [ $IS_OAI_LICENCE_PRESENT -eq 0 ] && [ $IS_BSD_LICENCE_PRESENT -eq 0 ] then if [ $IS_NFAPI -eq 0 ] && [ $IS_EXCEPTION -eq 0 ] From a6d53823a3df3c72f04af3e237cff5c271c1d0d5 Mon Sep 17 00:00:00 2001 From: hardy Date: Mon, 19 Jul 2021 14:42:39 +0200 Subject: [PATCH 103/135] nsa 2x2 test implem --- ci-scripts/ci_ueinfra.yaml | 15 + .../enb.band38.nsa_2x2.100PRB.usrpn310.conf | 280 ++++++++++++++++ .../gnb.band78.nsa_2x2.106PRB.usrpn310.conf | 298 ++++++++++++++++++ ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml | 142 +++++++++ 4 files changed, 735 insertions(+) create mode 100644 ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf create mode 100644 ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf create mode 100644 ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml diff --git a/ci-scripts/ci_ueinfra.yaml b/ci-scripts/ci_ueinfra.yaml index 67331fdfb2..a21f00fe40 100644 --- a/ci-scripts/ci_ueinfra.yaml +++ b/ci-scripts/ci_ueinfra.yaml @@ -13,6 +13,21 @@ idefix: HostUsername : oaicicd HostPassword : oaicicd HostSourceCodePath : none +nrmodule2_quectel: + ID: nrmodule2_quectel + State : enabled + Kind : quectel + Process : + Name : quectel-CM + Cmd : /home/nrmodule2/quectel-CM/quectel-CM -s oai.ipv4 -4 + WakeupScript : ci_ctl_qtel.py /dev/ttyUSB7 wup + DetachScript : ci_ctl_qtel.py /dev/ttyUSB7 detach + PLMN : 20899 + UENetwork : wwan1 + HostIPAddress : 192.168.18.189 + HostUsername : nrmodule2 + HostPassword : linux + HostSourceCodePath : none dummy: ID: '' State : '' diff --git a/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf new file mode 100644 index 0000000000..637cc30d80 --- /dev/null +++ b/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf @@ -0,0 +1,280 @@ +Active_eNBs = ( "eNB-Eurecom-B38"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB-Eurecom-B38"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ( { mcc = 208; mnc = 99; mnc_length = 2; } ); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "3GPP_eNODEB"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "TDD"; + tdd_config = 1; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 38; + downlink_frequency = 2605000000L; + uplink_frequency_offset = 0; + Nid_cell = 0; + N_RB_DL = 100; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 2; + nb_antennas_rx = 2; + tx_gain = 90; + rx_gain = 125; + pbch_repetition = "FALSE"; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 0; + pucch_nCS_AN = 0; + pucch_n1_AN = 0; + pdsch_referenceSignalPower = -29; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -96; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -104; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 1; + + //Parameters for SIB18 + rxPool_sc_CP_Len = "normal"; + rxPool_sc_Period = "sf40"; + rxPool_data_CP_Len = "normal"; + rxPool_ResourceConfig_prb_Num = 20; + rxPool_ResourceConfig_prb_Start = 5; + rxPool_ResourceConfig_prb_End = 44; + rxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + rxPool_ResourceConfig_offsetIndicator_choice = 0; + rxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; +/* rxPool_dataHoppingConfig_hoppingParameter = 0; + rxPool_dataHoppingConfig_numSubbands = "ns1"; + rxPool_dataHoppingConfig_rbOffset = 0; + rxPool_commTxResourceUC-ReqAllowed = "TRUE"; +*/ + // Parameters for SIB19 + discRxPool_cp_Len = "normal" + discRxPool_discPeriod = "rf32" + discRxPool_numRetx = 1; + discRxPool_numRepetition = 2; + discRxPool_ResourceConfig_prb_Num = 5; + discRxPool_ResourceConfig_prb_Start = 3; + discRxPool_ResourceConfig_prb_End = 21; + discRxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + discRxPool_ResourceConfig_offsetIndicator_choice = 0; + discRxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.61.195"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + enable_measurement_reports = "no"; + + ///X2 + enable_x2 = "yes"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eno1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.193"; + ENB_INTERFACE_NAME_FOR_S1U = "eno1"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.18.193"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + ENB_IPV4_ADDRESS_FOR_X2C = "192.168.18.193"; + ENB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + phy_test_mode = 0; + scheduler_mode = "fairRR"; + bler_target_upper = 20.0; + bler_target_lower = 10.0; + max_ul_rb_index = 24; + puSch10xSnr = 100; + puCch10xSnr = 150; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + prach_dtx_threshold = 200; + pucch1_dtx_threshold = 5 + pucch1ab_dtx_threshold =0; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 2 + nb_rx = 2 + att_tx = 0 + att_rx = 0; + bands = [38]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + sdr_addrs = "mgmt_addr=192.168.18.241,addr=192.168.20.2,second_addr=192.168.10.2"; + + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + +NETWORK_CONTROLLER : +{ + FLEXRAN_ENABLED = "no"; + FLEXRAN_INTERFACE_NAME = "lo"; + FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; + FLEXRAN_PORT = 2210; + FLEXRAN_CACHE = "/mnt/oai_agent_cache"; + FLEXRAN_AWAIT_RECONF = "no"; +}; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf new file mode 100644 index 0000000000..50515c14c5 --- /dev/null +++ b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf @@ -0,0 +1,298 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 31; //0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 2; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 84 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641272; //641032; #641968; 641968=start of ssb at 3600MHz + 82 RBs 641032=center of SSB at center of cell + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=84,L=13 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6368; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 + + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6368; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -100; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 5; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; //15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, + +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 2; # used for UL slot + initialULBWPmappingType_0 = 1 + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 + + initialULBWPk2_1 = 2; # used for mixed slot + initialULBWPmappingType_1 = 1; + initialULBWPstartSymbolAndLength_1 = 24; # this is SS=10 L=2 + + initialULBWPk2_2 = 7; # used for Msg.3 during RA + initialULBWPmappingType_2 = 1; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; #0x80; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; //8; //7; + nrofDownlinkSymbols = 6; //0; //6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; //0; //4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + amf_ip_address = ( { ipv4 = "192.168.61.195"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + ///X2 + enable_x2 = "yes"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + target_enb_x2_ip_address = ( + { ipv4 = "192.168.18.193"; + ipv6 = "192:168:30::17"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_NG_AMF = "eth0"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.18.194/24"; + GNB_INTERFACE_NAME_FOR_NGU = "eth0"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.18.194/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "192.168.18.194/24"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + prach_dtx_threshold = 100; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 2 + nb_rx = 2 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + bf_weights = [0x00007fff, 0x00007fff]; + #clock_src = "external"; + sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + //parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + +security = { + # preferred ciphering algorithms + # the first one of the list that an UE supports in chosen + # valid values: nea0, nea1, nea2, nea3 + ciphering_algorithms = ( "nea0", "nea2" ); + + # preferred integrity algorithms + # the first one of the list that an UE supports in chosen + # valid values: nia0, nia1, nia2, nia3 + integrity_algorithms = ( "nia0" ); +}; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml new file mode 100644 index 0000000000..076799e543 --- /dev/null +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml @@ -0,0 +1,142 @@ + + + TEST-NSA-FR1-TM1 + NSA Ping DL UL with QUECTEL + tasks + 1 + + 030000 + 040000 + 000002 + 010000 + 000001 + 010002 + 080001 + 080000 + + + + + Initialize_UE + Initialize Quectel + nrmodule2_quectel + yes + + + + + Terminate_UE + Terminate Quectel + nrmodule2_quectel + + + + + Initialize_eNB + Initialize eNB + -O ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf + 0 + 0 + lte + yes + + + + + Initialize_eNB + Initialize gNB + -O ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf -q + 1 + 1 + nr + + + + IdleSleep + Sleep + 5 + + + + IdleSleep + Sleep + 20 + + + + + Ping + Ping: 20pings in 20sec + nrmodule2_quectel + -c 20 + 50 + + + + Ping + Ping: 100pings in 20sec + nrmodule2_quectel + -c 100 -i 0.2 + 50 + + + + Iperf + iperf (DL/20Mbps/UDP)(60 sec)(single-ue profile) + -u -b 20M -t 60 + DL + nrmodule2_quectel + 50 + single-ue + + + + Iperf + iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile) + -u -b 3M -t 60 + UL + nrmodule2_quectel + 50 + single-ue + + + + + Terminate_eNB + Terminate eNB + 0 + 0 + lte + + + + Terminate_eNB + Terminate gNB + 1 + 1 + nr + + + + From 6b028522bdb27f365ff0327ec29190f8a63c9ed1 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 19 Jul 2021 14:22:00 +0100 Subject: [PATCH 104/135] Fix warning after merge --- openair1/PHY/INIT/nr_init_ru.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index e04197d48a..097c2b3ad2 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -142,8 +142,8 @@ int nr_phy_init_RU(RU_t *ru) { AssertFatal(ru->bw_list[i],"ru->bw_list[%d] is null\n",i); for (re=0; reofdm_symbol_size; re++) ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind]; - //printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j); - l_ind++; + //printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j); + l_ind++; } // for j //} } // for p From 756ec666e8ec8193bd7f47a27148ee57913426a5 Mon Sep 17 00:00:00 2001 From: hardy Date: Tue, 20 Jul 2021 09:32:34 +0200 Subject: [PATCH 105/135] epc docker compose fix for testing --- .../yaml_files/fr1_epc_tim/docker-compose.yml | 95 ++++---- .../fr1_epc_tim/docker-compose.yml.orig | 203 ++++++++++++++++++ 2 files changed, 252 insertions(+), 46 deletions(-) create mode 100644 ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml.orig diff --git a/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml b/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml index 28ae154838..782664c5fd 100644 --- a/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml +++ b/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml @@ -28,7 +28,7 @@ services: private_net: ipv4_address: 192.168.68.4 volumes: - - ./oai_db.cql:/home/oai_db.cql + - ../../component/oai-hss/src/hss_rel14/db/oai_db.cql:/home/oai_db.cql entrypoint: /bin/bash -c "cqlsh --file /home/oai_db.cql 192.168.68.2 && echo 'OK'" oai_hss: @@ -40,18 +40,19 @@ services: private_net: ipv4_address: 192.168.68.3 public_net: - ipv4_address: 192.168.61.2 + ipv4_address: 192.168.61.194 environment: + TZ: Europe/Paris REALM: openairinterface.org HSS_FQDN: hss.openairinterface.org PREFIX: /openair-hss/etc cassandra_Server_IP: 192.168.68.2 OP_KEY: 1006020f0a478bf6b699f15c062e42b3 - LTE_K: fec86ba6eb707ed08905757b1bb44b8f + LTE_K: FEC86BA6EB707ED08905757B1BB44B8F APN1: oai.ipv4 - APN2: internet - FIRST_IMSI: 222010100001120 - NB_USERS: 10 + APN2: oai2.ipv4 + FIRST_IMSI: 208990100001127 + NB_USERS: 5 healthcheck: test: /bin/bash -c "pgrep oai_hss" interval: 10s @@ -65,45 +66,46 @@ services: depends_on: [oai_hss] networks: public_net: - ipv4_address: 192.168.61.3 + ipv4_address: 192.168.61.195 environment: + TZ: Europe/Paris REALM: openairinterface.org PREFIX: /openair-mme/etc INSTANCE: 1 PID_DIRECTORY: /var/run - HSS_IP_ADDR: 192.168.61.2 + HSS_IP_ADDR: 192.168.61.194 HSS_HOSTNAME: hss HSS_FQDN: hss.openairinterface.org HSS_REALM: openairinterface.org - MCC: '222' - MNC: '01' + MCC: '208' + MNC: '99' MME_GID: 32768 MME_CODE: 3 TAC_0: 1 TAC_1: 2 TAC_2: 3 MME_FQDN: mme.openairinterface.org - MME_S6A_IP_ADDR: 192.168.61.3 + MME_S6A_IP_ADDR: 192.168.61.195 MME_INTERFACE_NAME_FOR_S1_MME: eth0 - MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.3 + MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.195 MME_INTERFACE_NAME_FOR_S11: eth0 - MME_IPV4_ADDRESS_FOR_S11: 192.168.61.3 + MME_IPV4_ADDRESS_FOR_S11: 192.168.61.195 MME_INTERFACE_NAME_FOR_S10: lo MME_IPV4_ADDRESS_FOR_S10: 127.0.0.10 OUTPUT: CONSOLE - SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.4 + SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.196 PEER_MME_IPV4_ADDRESS_FOR_S10_0: 0.0.0.0 PEER_MME_IPV4_ADDRESS_FOR_S10_1: 0.0.0.0 - MCC_SGW_0: '222' - MNC3_SGW_0: '001' + MCC_SGW_0: '208' + MNC3_SGW_0: '099' TAC_LB_SGW_0: '01' TAC_HB_SGW_0: '00' - MCC_MME_0: '222' - MNC3_MME_0: '001' + MCC_MME_0: '208' + MNC3_MME_0: '099' TAC_LB_MME_0: '02' TAC_HB_MME_0: '00' - MCC_MME_1: '222' - MNC3_MME_1: '001' + MCC_MME_1: '208' + MNC3_MME_1: '099' TAC_LB_MME_1: '03' TAC_HB_MME_1: '00' TAC_LB_SGW_TEST_0: '03' @@ -122,18 +124,25 @@ services: container_name: prod-oai-spgwc networks: public_net: - ipv4_address: 192.168.61.4 + ipv4_address: 192.168.61.196 environment: - PID_DIRECTORY: /var/run + TZ: Europe/Paris SGW_INTERFACE_NAME_FOR_S11: eth0 - SGW_IP_FOR_S5_S8_CP: 127.0.0.11/8 - PGW_IP_FOR_S5_S8_CP: 127.0.0.12/8 PGW_INTERFACE_NAME_FOR_SX: eth0 - DEFAULT_APN: oai.ipv4 DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 - UE_IP_ADDRESS_POOL: '12.1.1.2 - 12.1.1.254' - PUSH_PROTOCOL_OPTION: 'yes' + PUSH_PROTOCOL_OPTION: 'true' + APN_NI_1: oai.ipv4 + APN_NI_2: oai2.ipv4 + DEFAULT_APN_NI_1: oai.ipv4 + UE_IP_ADDRESS_POOL_1: '12.1.1.2 - 12.1.1.254' + UE_IP_ADDRESS_POOL_2: '12.0.0.2 - 12.0.0.254' + MCC: '208' + MNC: '99' + MNC03: '099' + TAC: 1 + GW_ID: 1 + REALM: openairinterface.org healthcheck: test: /bin/bash -c "pgrep oai_spgwc" interval: 10s @@ -147,45 +156,39 @@ services: depends_on: [oai_spgwc] networks: public_net: - ipv4_address: 192.168.61.5 + ipv4_address: 192.168.61.197 environment: + TZ: Europe/Paris PID_DIRECTORY: /var/run INSTANCE: 1 SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP: eth0 PGW_INTERFACE_NAME_FOR_SGI: eth0 SGW_INTERFACE_NAME_FOR_SX: eth0 - SPGWC0_IP_ADDRESS: 192.168.61.4 + SPGWC0_IP_ADDRESS: 192.168.61.196 NETWORK_UE_IP: '12.1.1.0/24' NETWORK_UE_NAT_OPTION: 'yes' + MCC: '208' + MNC: '99' + MNC03: '099' + TAC: 1 + GW_ID: 1 + REALM: openairinterface.org healthcheck: test: /bin/bash -c "pgrep oai_spgwu" interval: 10s timeout: 5s retries: 5 - flexran_rtc: - image: flexran-rtc:production - privileged: true - container_name: prod-flexran-rtc - networks: - public_net: - ipv4_address: 192.168.61.10 - healthcheck: - test: /bin/bash -c "pgrep rt_controller" - interval: 10s - timeout: 5s - retries: 5 - trf_gen: image: trf-gen:production privileged: true container_name: prod-trf-gen networks: public_net: - ipv4_address: 192.168.61.11 - entrypoint: /bin/bash -c "ip route add 12.1.1.0/24 via 192.168.61.5 dev eth0; sleep infinity" + ipv4_address: 192.168.61.200 + entrypoint: /bin/bash -c "ip route add 12.1.1.0/24 via 192.168.61.197 dev eth0; sleep infinity" healthcheck: - test: /bin/bash -c "ping -c 2 192.168.61.5" + test: /bin/bash -c "ping -c 2 192.168.61.197" interval: 10s timeout: 5s retries: 5 @@ -200,4 +203,4 @@ networks: name: prod-oai-public-net ipam: config: - - subnet: 192.168.61.0/26 + - subnet: 192.168.61.192/26 diff --git a/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml.orig b/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml.orig new file mode 100644 index 0000000000..28ae154838 --- /dev/null +++ b/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml.orig @@ -0,0 +1,203 @@ +version: '3.8' + +services: + cassandra: + image: cassandra:2.1 + container_name: prod-cassandra + networks: + private_net: + ipv4_address: 192.168.68.2 + environment: + CASSANDRA_CLUSTER_NAME: "OAI HSS Cluster" + CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch + healthcheck: + test: /bin/bash -c "nodetool status" + interval: 10s + timeout: 5s + retries: 5 + + db_init: + image: cassandra:2.1 + container_name: prod-db-init + depends_on: [cassandra] + deploy: + restart_policy: + condition: on-failure + max_attempts: 10 + networks: + private_net: + ipv4_address: 192.168.68.4 + volumes: + - ./oai_db.cql:/home/oai_db.cql + entrypoint: /bin/bash -c "cqlsh --file /home/oai_db.cql 192.168.68.2 && echo 'OK'" + + oai_hss: + image: oai-hss:production + container_name: prod-oai-hss + privileged: true + depends_on: [cassandra] + networks: + private_net: + ipv4_address: 192.168.68.3 + public_net: + ipv4_address: 192.168.61.2 + environment: + REALM: openairinterface.org + HSS_FQDN: hss.openairinterface.org + PREFIX: /openair-hss/etc + cassandra_Server_IP: 192.168.68.2 + OP_KEY: 1006020f0a478bf6b699f15c062e42b3 + LTE_K: fec86ba6eb707ed08905757b1bb44b8f + APN1: oai.ipv4 + APN2: internet + FIRST_IMSI: 222010100001120 + NB_USERS: 10 + healthcheck: + test: /bin/bash -c "pgrep oai_hss" + interval: 10s + timeout: 5s + retries: 5 + + oai_mme: + image: oai-mme:production + container_name: prod-oai-mme + privileged: true + depends_on: [oai_hss] + networks: + public_net: + ipv4_address: 192.168.61.3 + environment: + REALM: openairinterface.org + PREFIX: /openair-mme/etc + INSTANCE: 1 + PID_DIRECTORY: /var/run + HSS_IP_ADDR: 192.168.61.2 + HSS_HOSTNAME: hss + HSS_FQDN: hss.openairinterface.org + HSS_REALM: openairinterface.org + MCC: '222' + MNC: '01' + MME_GID: 32768 + MME_CODE: 3 + TAC_0: 1 + TAC_1: 2 + TAC_2: 3 + MME_FQDN: mme.openairinterface.org + MME_S6A_IP_ADDR: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S1_MME: eth0 + MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S11: eth0 + MME_IPV4_ADDRESS_FOR_S11: 192.168.61.3 + MME_INTERFACE_NAME_FOR_S10: lo + MME_IPV4_ADDRESS_FOR_S10: 127.0.0.10 + OUTPUT: CONSOLE + SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.4 + PEER_MME_IPV4_ADDRESS_FOR_S10_0: 0.0.0.0 + PEER_MME_IPV4_ADDRESS_FOR_S10_1: 0.0.0.0 + MCC_SGW_0: '222' + MNC3_SGW_0: '001' + TAC_LB_SGW_0: '01' + TAC_HB_SGW_0: '00' + MCC_MME_0: '222' + MNC3_MME_0: '001' + TAC_LB_MME_0: '02' + TAC_HB_MME_0: '00' + MCC_MME_1: '222' + MNC3_MME_1: '001' + TAC_LB_MME_1: '03' + TAC_HB_MME_1: '00' + TAC_LB_SGW_TEST_0: '03' + TAC_HB_SGW_TEST_0: '00' + SGW_IPV4_ADDRESS_FOR_S11_TEST_0: 0.0.0.0 + healthcheck: + test: /bin/bash -c "pgrep oai_mme" + interval: 10s + timeout: 5s + retries: 5 + + oai_spgwc: + image: oai-spgwc:production + privileged: true + depends_on: [oai_mme] + container_name: prod-oai-spgwc + networks: + public_net: + ipv4_address: 192.168.61.4 + environment: + PID_DIRECTORY: /var/run + SGW_INTERFACE_NAME_FOR_S11: eth0 + SGW_IP_FOR_S5_S8_CP: 127.0.0.11/8 + PGW_IP_FOR_S5_S8_CP: 127.0.0.12/8 + PGW_INTERFACE_NAME_FOR_SX: eth0 + DEFAULT_APN: oai.ipv4 + DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129 + DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 + UE_IP_ADDRESS_POOL: '12.1.1.2 - 12.1.1.254' + PUSH_PROTOCOL_OPTION: 'yes' + healthcheck: + test: /bin/bash -c "pgrep oai_spgwc" + interval: 10s + timeout: 5s + retries: 5 + + oai_spgwu: + image: oai-spgwu-tiny:production + privileged: true + container_name: prod-oai-spgwu-tiny + depends_on: [oai_spgwc] + networks: + public_net: + ipv4_address: 192.168.61.5 + environment: + PID_DIRECTORY: /var/run + INSTANCE: 1 + SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP: eth0 + PGW_INTERFACE_NAME_FOR_SGI: eth0 + SGW_INTERFACE_NAME_FOR_SX: eth0 + SPGWC0_IP_ADDRESS: 192.168.61.4 + NETWORK_UE_IP: '12.1.1.0/24' + NETWORK_UE_NAT_OPTION: 'yes' + healthcheck: + test: /bin/bash -c "pgrep oai_spgwu" + interval: 10s + timeout: 5s + retries: 5 + + flexran_rtc: + image: flexran-rtc:production + privileged: true + container_name: prod-flexran-rtc + networks: + public_net: + ipv4_address: 192.168.61.10 + healthcheck: + test: /bin/bash -c "pgrep rt_controller" + interval: 10s + timeout: 5s + retries: 5 + + trf_gen: + image: trf-gen:production + privileged: true + container_name: prod-trf-gen + networks: + public_net: + ipv4_address: 192.168.61.11 + entrypoint: /bin/bash -c "ip route add 12.1.1.0/24 via 192.168.61.5 dev eth0; sleep infinity" + healthcheck: + test: /bin/bash -c "ping -c 2 192.168.61.5" + interval: 10s + timeout: 5s + retries: 5 + +networks: + private_net: + name: prod-oai-private-net + ipam: + config: + - subnet: 192.168.68.0/26 + public_net: + name: prod-oai-public-net + ipam: + config: + - subnet: 192.168.61.0/26 From 71e8ed80867df0648977e3c13fc4cba488b3830e Mon Sep 17 00:00:00 2001 From: hardy Date: Tue, 20 Jul 2021 15:21:12 +0200 Subject: [PATCH 106/135] changed path of cql as it is copied locally in the same folder as yaml --- ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml b/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml index 782664c5fd..73a6b3a1ff 100644 --- a/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml +++ b/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml @@ -28,7 +28,7 @@ services: private_net: ipv4_address: 192.168.68.4 volumes: - - ../../component/oai-hss/src/hss_rel14/db/oai_db.cql:/home/oai_db.cql + - ./oai_db.cql:/home/oai_db.cql entrypoint: /bin/bash -c "cqlsh --file /home/oai_db.cql 192.168.68.2 && echo 'OK'" oai_hss: From a052e1b719d4a3c947a48e745c86bd0c7b9d3382 Mon Sep 17 00:00:00 2001 From: hardy Date: Tue, 20 Jul 2021 17:27:59 +0200 Subject: [PATCH 107/135] update conf files for CI --- .../enb.band38.nsa_2x2.100PRB.usrpn310.conf | 8 ++++---- .../gnb.band78.nsa_2x2.106PRB.usrpn310.conf | 14 ++++++-------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf index 637cc30d80..db0802fdd7 100644 --- a/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf @@ -171,7 +171,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.61.195"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -190,11 +190,11 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eno1"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.193"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eno1"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.18.193"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.18.193"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; } diff --git a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf index 50515c14c5..24dbdbd74b 100644 --- a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf @@ -9,13 +9,11 @@ gNBs = gNB_ID = 0xe00; cell_type = "CELL_MACRO_GNB"; - gNB_name = "gNB-Eurecom-5GNRBox"; // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - - plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); + plmn_list = ({mcc = 208; mnc = 99; mnc_length = 2;}); tr_s_preference = "local_mac" @@ -188,7 +186,7 @@ gNBs = ////////// MME parameters: - amf_ip_address = ( { ipv4 = "192.168.61.195"; + amf_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -202,7 +200,7 @@ gNBs = t_dc_prep = 1000; /* unit: millisecond */ t_dc_overall = 2000; /* unit: millisecond */ target_enb_x2_ip_address = ( - { ipv4 = "192.168.18.193"; + { ipv4 = "CI_FR1_CTL_ENB_IP_ADDR"; ipv6 = "192:168:30::17"; preference = "ipv4"; } @@ -212,11 +210,11 @@ gNBs = { GNB_INTERFACE_NAME_FOR_NG_AMF = "eth0"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.18.194/24"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "CI_GNB_IP_ADDR"; GNB_INTERFACE_NAME_FOR_NGU = "eth0"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.18.194/24"; + GNB_IPV4_ADDRESS_FOR_NGU = "CI_GNB_IP_ADDR"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 - GNB_IPV4_ADDRESS_FOR_X2C = "192.168.18.194/24"; + GNB_IPV4_ADDRESS_FOR_X2C = "CI_GNB_IP_ADDR"; GNB_PORT_FOR_X2C = 36422; # Spec 36422 }; } From 59f4cfd92acc833428870c6a6a8e1f6db19ef825 Mon Sep 17 00:00:00 2001 From: hardy Date: Wed, 21 Jul 2021 08:19:46 +0200 Subject: [PATCH 108/135] [CI] for gNB Phy test : update of the execution timings ref values, according to the latest developments --- ci-scripts/datalog_rt_stats.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-scripts/datalog_rt_stats.yaml b/ci-scripts/datalog_rt_stats.yaml index 3680d2a19b..548caa0bdd 100644 --- a/ci-scripts/datalog_rt_stats.yaml +++ b/ci-scripts/datalog_rt_stats.yaml @@ -10,15 +10,15 @@ ColNames : Ref : feprx : 60.0 feptx_prec : 8.0 - feptx_ofdm : 85.0 + feptx_ofdm : 50.0 feptx_total : 75.0 L1 Tx processing : 300.0 DLSCH encoding : 230.0 L1 Rx processing : 175.0 PUSCH inner-receiver : 100.0 PUSCH decoding : 140.0 - DL & UL scheduling timing stats : 15.0 - UL Indication : 20.0 + DL & UL scheduling timing stats : 37.0 + UL Indication : 38.0 Threshold : feprx : 1.25 feptx_prec : 1.25 From f6e03218606982adc3f58273534ca8f2fb08ec6f Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Fri, 9 Jul 2021 16:55:23 +0200 Subject: [PATCH 109/135] hack: do not use BCH RBs for DL scheduling in subframe 0 The problem is that when using those RBs with MCS 28 we may exceed the code rate 0.93 and according to 36.213 7.1.7 the UE may skip decoding PDSCH entirely in this case. This is a hack. The real solution is to check that the code rate is below 0.93 for each scheduling decision and, I don't know, reduce the MCS if the code rate is above, so that in the end it is below. That means that we need a proper resource grid for the configuration of the eNB and this is not an easy thing (at least from my point of view) given all the possible configurations for the eNB, so I prefer not to do it rather than do something incorrect, thus this hack. The problem of this hack is that we won't use all the available RBs for scheduling, potentially reducing the maximum throughput achievable. To be fixed properly at some time, by someone who understands fully the resource grid and all the possible combinations (fdd/tdd, number of antennas, whatever else). --- openair2/LAYER2/MAC/eNB_scheduler.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 4e063d2207..ea7b5a9a81 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -586,6 +586,23 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, memset(cc[CC_id].vrb_map_UL, 0, 100); cc[CC_id].mcch_active = 0; clear_nfapi_information(RC.mac[module_idP], CC_id, frameP, subframeP); + + /* hack: skip BCH RBs in subframe 0 for DL scheduling, + * because with high MCS we may exceed code rate 0.93 + * when using those RBs (36.213 7.1.7 says the UE may + * skip decoding if the code rate is higher than 0.93) + * TODO: remove this hack, deal with physical bits properly + * i.e. reduce MCS in the scheduler if code rate > 0.93 + */ + if (subframeP == 0) { + int i; + int bw = cc[CC_id].mib->message.dl_Bandwidth; + /* start and count defined for RBs: 6, 15, 25, 50, 75, 100 */ + int start[6] = { 0, 4, 9, 22, 34, 47 }; + int count[6] = { 6, 7, 7, 6, 7, 6 }; + for (i = 0; i < count[bw]; i++) + cc[CC_id].vrb_map[start[bw] + i] = 1; + } } /* Refresh UE list based on UEs dropped by PHY in previous subframe */ From 4a2c0b1eff78fc4ebc1c4f94b6861390b11a3d08 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Tue, 13 Jul 2021 16:17:07 +0200 Subject: [PATCH 110/135] bugfix: fix allocation of RBGs for retransmission When there is a retransmission, we want to use the same number of RBs. The RBs are allocated by groups (RBGs). In some cases (like a cell with 25 PRBs), the last RBG contains less RBs. So in case of a retransmission, if this last RBG was used before we need to reuse it to have the same number of RBs. If not, we will use more RBs for the retransmission than the previous transmission. In an experiment with two UEs (quectel modules) it was seen that when a retransmission happens with a different number of RBs then the UE is not happy at all, leading to way more NACKs in the harq processes than should happen (actually the first NACK was not a NACK at all, but the eNB did interpret it as a NACK; so the next transmission should simply be discarded by the UE that successfully received the first transmission; instead the UE fails to decode the data and sends a NACK, a real one this time). Maybe it's not the correct solution, but it improve things, there are much less NACKs. --- openair2/LAYER2/MAC/pre_processor.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index bb892c7efe..bb969668d6 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -113,10 +113,29 @@ bool try_allocate_harq_retransmission(module_id_t Mod_id, LOG_D(MAC, "cannot allocate UE %d: no CCE can be allocated\n", UE_id); return false; } + /* if nb_rb is not multiple of RBGsize, then last RBG must be free + * (it will be allocated just below) + */ + if (nb_rb % RBGsize && !rbgalloc_mask[N_RBG-1]) { + LOG_E(MAC, "retransmission: last RBG already allocated (this should not happen)\n"); + return false; + } ue_ctrl->pre_dci_dl_pdu_idx = idx; // retransmissions: directly allocate *n_rbg_sched -= nb_rbg; ue_ctrl->pre_nb_available_rbs[CC_id] += nb_rb; + if (nb_rb % RBGsize) { + /* special case: if nb_rb is not multiple of RBGsize, then allocate last RBG. + * If we instead allocated another RBG then we will retransmit with more + * RBs and the UE will not accept it. + * (This has been seen in a test with cots UEs, if not true, then change + * code as needed.) + * At this point rbgalloc_mask[N_RBG-1] == 1 due to the test above. + */ + ue_ctrl->rballoc_sub_UE[CC_id][N_RBG-1] = 1; + rbgalloc_mask[N_RBG-1] = 0; + nb_rbg--; + } for (; nb_rbg > 0; start_rbg++) { if (!rbgalloc_mask[start_rbg]) continue; From 618e33aca01a642a3e5192e64f0bdabc68b1934b Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 22 Jul 2021 09:16:10 +0200 Subject: [PATCH 111/135] adding check for ul failure in nr_csi_meas_reporting --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 66fb8a50eb..79d8ce64e6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -467,6 +467,7 @@ void nr_csi_meas_reporting(int Mod_idP, for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { const NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + if (sched_ctrl->ul_failure==1 && get_softmodem_params()->phy_test==0) continue; if (!CellGroup || !CellGroup->spCellConfig || !CellGroup->spCellConfig->spCellConfigDedicated || !CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig) continue; const NR_CSI_MeasConfig_t *csi_measconfig = CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; From c72ac04f63502b675db6997d2124d92d38589d85 Mon Sep 17 00:00:00 2001 From: hardy Date: Thu, 22 Jul 2021 11:34:41 +0200 Subject: [PATCH 112/135] remove nasmesh compile ; nokrnmod =1 by default --- cmake_targets/build_oai | 14 -------------- executables/softmodem-common.c | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 7e7556248e..c9390d67ce 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -683,21 +683,7 @@ function main() { $build_dir coding \ libcoding.so $dbin/libcoding.so - #check if we run inside a container or not - #IS_CONTAINER variable is defined in build_helper file - #compile nasmesh and rb_tool only if NOT running in a container - if [ $IS_CONTAINER -eq 0 ] - then - compilations \ - $build_dir nasmesh \ - CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko - compilations \ - $build_dir rb_tool \ - rb_tool $dbin/rb_tool - - cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin - fi #IS_CONTAINER fi fi fi diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index fa6b674765..e10515ea1a 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -89,7 +89,7 @@ void get_common_options(uint32_t execmask) { uint32_t online_log_messages=0; uint32_t glog_level=0 ; uint32_t start_telnetsrv = 0, start_telnetclt = 0; - uint32_t noS1 = 0, nokrnmod = 0, nonbiot = 0; + uint32_t noS1 = 0, nokrnmod = 1, nonbiot = 0; uint32_t rfsim = 0, basicsim = 0, do_forms = 0; char *logmem_filename = NULL; paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ; From 17f466a9bf5e0bdb456c518f9efb92deb54deac7 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 22 Jul 2021 10:50:44 +0100 Subject: [PATCH 113/135] Fix define MACRLC idx that overlaps --- openair2/GNB_APP/MACRLC_nr_paramdef.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/GNB_APP/MACRLC_nr_paramdef.h b/openair2/GNB_APP/MACRLC_nr_paramdef.h index bf8b32f591..aca88b9ea7 100644 --- a/openair2/GNB_APP/MACRLC_nr_paramdef.h +++ b/openair2/GNB_APP/MACRLC_nr_paramdef.h @@ -107,9 +107,9 @@ #define MACRLC_LOCAL_S_PORTD_IDX 15 #define MACRLC_REMOTE_S_PORTD_IDX 16 #define MACRLC_ULSCH_MAX_SLOTS_INACTIVITY 17 -#define MACRLC_PUSCHTARGETSNRX10_IDX 17 -#define MACRLC_PUCCHTARGETSNRX10_IDX 18 -#define MACRLC_PUCCHFAILURETHRES_IDX 19 -#define MACRLC_PUSCHFAILURETHRES_IDX 20 +#define MACRLC_PUSCHTARGETSNRX10_IDX 18 +#define MACRLC_PUCCHTARGETSNRX10_IDX 19 +#define MACRLC_PUCCHFAILURETHRES_IDX 20 +#define MACRLC_PUSCHFAILURETHRES_IDX 21 /*---------------------------------------------------------------------------------------------------------------------------------------------------------*/ #endif From 95372bd2dadb1ba24b2a2c302052869cc92f3a58 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 22 Jul 2021 10:51:49 +0100 Subject: [PATCH 114/135] Fix RNTI selection for CFRA --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index fa4a8d9bdb..1d3f69d876 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1539,8 +1539,10 @@ void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t ra->state = RA_IDLE; ra->timing_offset = 0; ra->RRC_timer = 20; - ra->rnti = 0; ra->msg3_round = 0; + if(ra->cfra == false) { + ra->rnti = 0; + } } From a038df0459e1a9acbe360b90722263eb6d2eb634 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 22 Jul 2021 10:55:46 +0100 Subject: [PATCH 115/135] Discard Random Access when max number of users is achieved --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 17c7bb92eb..fbd8a4b5ca 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -711,7 +711,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, current_rnti); if( (frameP==ra->Msg3_frame) && (slotP==ra->Msg3_slot) ) { - LOG_W(NR_MAC, "Random Access %i failed at state %i (TC_RNTI %04x RNTI %04x\n", i, ra->state,ra->rnti,current_rnti); + LOG_W(NR_MAC, "Random Access %i failed at state %i (TC_RNTI %04x RNTI %04x)\n", i, ra->state,ra->rnti,current_rnti); nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); } @@ -722,6 +722,13 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, int UE_id=-1; UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->CellGroup); + if (UE_id<0) { + LOG_W(NR_MAC, "Random Access %i discarded at state %i (TC_RNTI %04x RNTI %04x): max number of users achieved!\n", i, ra->state,ra->rnti,current_rnti); + nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); + return; + } + UE_info->UE_beam_index[UE_id] = ra->beam_id; // re-initialize ta update variables after RA procedure completion From 7c61f6d96982b0a98aa8d367721d95e350063a08 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 22 Jul 2021 11:13:14 +0100 Subject: [PATCH 116/135] Fix pusch_TargetSNRx10 and pucch_TargetSNRx10 in configuration files --- ci-scripts/conf_files/benetel-5g.conf | 14 ++++++-------- .../gnb.band261.tm1.32PRB.usrpn300.conf | 14 +++++++------- .../gnb.band78.sa.fr1.106PRB.usrpb210.conf | 10 ++++++---- .../gnb.band78.tm1.fr1.106PRB.usrpb210.conf | 15 +++++++-------- .../gnb.band78.tm1.fr1.106PRB.usrpn310.conf | 15 +++++++-------- .../PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf | 14 ++++++-------- .../CONF/gnb.band257.tm1.32PRB.usrpn300.conf | 12 ++++++------ .../CONF/gnb.band257.tm1.32PRB.usrpx300.conf | 12 ++++++------ .../CONF/gnb.band261.tm1.32PRB.usrpn300.conf | 12 ++++++------ .../GENERIC-LTE-EPC/CONF/testing_gnb.conf | 12 ++++++------ .../GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf | 12 ++++++------ .../CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf | 10 ++++++---- .../CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf | 10 ++++++---- .../gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf | 10 ++++++---- 14 files changed, 87 insertions(+), 85 deletions(-) diff --git a/ci-scripts/conf_files/benetel-5g.conf b/ci-scripts/conf_files/benetel-5g.conf index 9adead3a68..47898aad15 100644 --- a/ci-scripts/conf_files/benetel-5g.conf +++ b/ci-scripts/conf_files/benetel-5g.conf @@ -24,10 +24,6 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; - #pusch_TargetSNRx10 = 200; - #pucch_TargetSNRx10 = 200; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 200; servingCellConfigCommon = ( { @@ -232,10 +228,12 @@ gNBs = MACRLCs = ( { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + } ); L1s = ( diff --git a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf index e7dd563e45..a4d9985dca 100644 --- a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf @@ -24,8 +24,6 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 200; servingCellConfigCommon = ( { @@ -227,11 +225,13 @@ gNBs = MACRLCs = ( { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - ulsch_max_slots_inactivity = 1; - } + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + ulsch_max_slots_inactivity = 1; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + } ); L1s = ( diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf index 0efc071c91..73e583c3d2 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf @@ -226,10 +226,12 @@ gNBs = MACRLCs = ( { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - ulsch_max_slots_inactivity = 100; + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + ulsch_max_slots_inactivity = 100; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; } ); diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf index 86293f2297..7a8e694a63 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf @@ -23,9 +23,6 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 200; - servingCellConfigCommon = ( { @@ -224,11 +221,13 @@ gNBs = ); MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + } ); L1s = ( diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf index cb3e69faf3..b981b27f53 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf @@ -23,9 +23,6 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 200; - servingCellConfigCommon = ( { @@ -231,11 +228,13 @@ gNBs = ); MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + } ); L1s = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf index cc44ffd27b..b260eaa58d 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf @@ -25,10 +25,6 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; - #pusch_TargetSNRx10 = 200; - #pucch_TargetSNRx10 = 200; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 200; servingCellConfigCommon = ( { @@ -233,10 +229,12 @@ gNBs = MACRLCs = ( { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + } ); L1s = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf index e0b721bf5e..ef171bf0a9 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf @@ -24,8 +24,6 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 200; servingCellConfigCommon = ( { @@ -226,10 +224,12 @@ gNBs = MACRLCs = ( { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + } ); L1s = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf index bf581f78ba..360b75c67d 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf @@ -24,8 +24,6 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 200; servingCellConfigCommon = ( { @@ -210,10 +208,12 @@ gNBs = MACRLCs = ( { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + } ); L1s = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf index a2233b72bc..834060b071 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf @@ -24,8 +24,6 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 200; servingCellConfigCommon = ( { @@ -224,10 +222,12 @@ gNBs = MACRLCs = ( { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + } ); L1s = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf index c7ffc1a29a..54947450c0 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf @@ -24,8 +24,6 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 200; servingCellConfigCommon = ( { @@ -224,10 +222,12 @@ gNBs = MACRLCs = ( { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + } ); L1s = ( diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf index febf152387..463b7d6d06 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf @@ -24,8 +24,6 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 200; servingCellConfigCommon = ( { @@ -240,10 +238,12 @@ gNBs = MACRLCs = ( { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + } ); L1s = ( diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index ac1f36c8b7..1a28ebb950 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -226,10 +226,12 @@ gNBs = MACRLCs = ( { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - ulsch_max_slots_inactivity = 100; + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + ulsch_max_slots_inactivity = 100; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; } ); diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 1bada161a1..718038657b 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -226,10 +226,12 @@ gNBs = MACRLCs = ( { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - ulsch_max_slots_inactivity = 100; + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + ulsch_max_slots_inactivity = 100; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; } ); diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf index 9402e354fe..9892f97467 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf @@ -255,10 +255,12 @@ gNBs = MACRLCs = ( { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + } ); L1s = ( From 244a7a9a3d4ad355bc8d89a4fbca4709a550b6d2 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 22 Jul 2021 11:59:37 +0200 Subject: [PATCH 117/135] feat(ci): adding support for 5G Core (sabox only for the moment) Signed-off-by: Raphael Defosseux --- ci-scripts/epc.py | 94 ++++++++++++++++++------ ci-scripts/main.py | 5 ++ ci-scripts/xml_class_list.yml | 4 +- ci-scripts/xml_files/sa_cn5g_closure.xml | 37 ++++++++++ ci-scripts/xml_files/sa_cn5g_start.xml | 38 ++++++++++ 5 files changed, 154 insertions(+), 24 deletions(-) create mode 100644 ci-scripts/xml_files/sa_cn5g_closure.xml create mode 100644 ci-scripts/xml_files/sa_cn5g_start.xml diff --git a/ci-scripts/epc.py b/ci-scripts/epc.py index cd5a747654..1c202438d2 100644 --- a/ci-scripts/epc.py +++ b/ci-scripts/epc.py @@ -62,6 +62,7 @@ class EPCManagement(): self.PcapFileName = '' self.testCase_id = '' self.MmeIPAddress = '' + self.AmfIPAddress = '' self.containerPrefix = 'prod' self.mmeConfFile = 'mme.conf' self.yamlPath = '' @@ -76,7 +77,7 @@ class EPCManagement(): HELP.GenericHelp(CONST.Version) HELP.EPCSrvHelp(self.IPAddress, self.UserName, self.Password, self.SourceCodePath, self.Type) sys.exit('Insufficient EPC Parameters') - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): logging.debug('Using the OAI EPC Release 14 Cassandra-based HSS in Docker') @@ -120,7 +121,7 @@ class EPCManagement(): HELP.GenericHelp(CONST.Version) HELP.EPCSrvHelp(self.IPAddress, self.UserName, self.Password, self.SourceCodePath, self.Type) sys.exit('Insufficient EPC Parameters') - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): logging.debug('Using the OAI EPC Release 14 MME in Docker') @@ -161,7 +162,7 @@ class EPCManagement(): return # Only in case of Docker containers, MME IP address is not the EPC HOST IP address if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) mySSH.command('docker inspect --format="MME_IP_ADDR = {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" ' + self.containerPrefix + '-oai-mme', '\$', 5) result = re.search('MME_IP_ADDR = (?P[0-9\.]+)', mySSH.getBefore()) @@ -177,7 +178,7 @@ class EPCManagement(): HELP.GenericHelp(CONST.Version) HELP.EPCSrvHelp(self.IPAddress, self.UserName, self.Password, self.SourceCodePath, self.Type) sys.exit('Insufficient EPC Parameters') - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): logging.debug('Using the OAI EPC Release 14 SPGW-CUPS in Docker') @@ -211,9 +212,40 @@ class EPCManagement(): mySSH.close() HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK) + def Initialize5GCN(self, HTML): + if self.IPAddress == '' or self.UserName == '' or self.Password == '' or self.SourceCodePath == '' or self.Type == '': + HELP.GenericHelp(CONST.Version) + HELP.EPCSrvHelp(self.IPAddress, self.UserName, self.Password, self.SourceCodePath, self.Type) + sys.exit('Insufficient EPC Parameters') + mySSH = SSH.SSHConnection() + mySSH.open(self.IPAddress, self.UserName, self.Password) + if re.match('ltebox', self.Type, re.IGNORECASE): + logging.debug('Using the sabox simulated HSS') + mySSH.command('if [ -d ' + self.SourceCodePath + '/scripts ]; then echo ' + self.Password + ' | sudo -S rm -Rf ' + self.SourceCodePath + '/scripts ; fi', '\$', 5) + mySSH.command('mkdir -p ' + self.SourceCodePath + '/scripts', '\$', 5) + mySSH.command('cd /opt/hss_sim0609', '\$', 5) + mySSH.command('echo ' + self.Password + ' | sudo -S rm -f hss.log', '\$', 5) + mySSH.command('echo ' + self.Password + ' | sudo -S echo "Starting sudo session" && sudo su -c "screen -dm -S simulated_5g_hss ./start_5g_hss"', '\$', 5) + logging.debug('Using the sabox') + mySSH.command('cd /opt/ltebox/tools', '\$', 5) + mySSH.command('echo ' + self.Password + ' | sudo -S ./start_sabox', '\$', 5) + else: + logging.error('This option should not occur!') + mySSH.close() + HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK) + + def SetAmfIPAddress(self): + # Not an error if we don't need an 5GCN + if self.IPAddress == '' or self.UserName == '' or self.Password == '' or self.SourceCodePath == '' or self.Type == '': + return + if self.IPAddress == 'none': + return + if re.match('ltebox', self.Type, re.IGNORECASE): + self.MmeIPAddress = self.IPAddress + def CheckHSSProcess(self, status_queue): try: - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): mySSH.command('docker top ' + self.containerPrefix + '-oai-hss', '\$', 5) @@ -238,7 +270,7 @@ class EPCManagement(): def CheckMMEProcess(self, status_queue): try: - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): mySSH.command('docker top ' + self.containerPrefix + '-oai-mme', '\$', 5) @@ -251,11 +283,11 @@ class EPCManagement(): elif re.match('OAI', self.Type, re.IGNORECASE): result = re.search('\/bin\/bash .\/run_', mySSH.getBefore()) elif re.match('ltebox', self.Type, re.IGNORECASE): - result = re.search('mme', mySSH.getBefore()) + result = re.search('mme|amf', mySSH.getBefore()) else: logging.error('This should not happen!') if result is None: - logging.debug('\u001B[1;37;41m MME Process Not Found! \u001B[0m') + logging.debug('\u001B[1;37;41m MME|AMF Process Not Found! \u001B[0m') status_queue.put(CONST.MME_PROCESS_FAILED) else: status_queue.put(CONST.MME_PROCESS_OK) @@ -265,7 +297,7 @@ class EPCManagement(): def CheckSPGWProcess(self, status_queue): try: - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): mySSH.command('docker top ' + self.containerPrefix + '-oai-spgwc', '\$', 5) @@ -281,11 +313,11 @@ class EPCManagement(): result = re.search('\/bin\/bash .\/run_', mySSH.getBefore()) elif re.match('ltebox', self.Type, re.IGNORECASE): mySSH.command('stdbuf -o0 ps -aux | grep --color=never xGw | grep -v grep', '\$', 5) - result = re.search('xGw', mySSH.getBefore()) + result = re.search('xGw|upf', mySSH.getBefore()) else: logging.error('This should not happen!') if result is None: - logging.debug('\u001B[1;37;41m SPGW Process Not Found! \u001B[0m') + logging.debug('\u001B[1;37;41m SPGW|UPF Process Not Found! \u001B[0m') status_queue.put(CONST.SPGW_PROCESS_FAILED) else: status_queue.put(CONST.SPGW_PROCESS_OK) @@ -294,7 +326,7 @@ class EPCManagement(): os.kill(os.getppid(),signal.SIGUSR1) def TerminateHSS(self, HTML): - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-hss /bin/bash -c "killall --signal SIGINT oai_hss tshark"', '\$', 5) @@ -322,14 +354,14 @@ class EPCManagement(): mySSH.command('cd ' + self.SourceCodePath, '\$', 5) mySSH.command('cd scripts', '\$', 5) time.sleep(1) - mySSH.command('echo ' + self.Password + ' | sudo -S killall --signal SIGKILL hss_sim', '\$', 5) + mySSH.command('echo ' + self.Password + ' | sudo -S screen -S simulated_hss -X quit', '\$', 5) else: logging.error('This should not happen!') mySSH.close() HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) def TerminateMME(self, HTML): - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-mme /bin/bash -c "killall --signal SIGINT oai_mme tshark"', '\$', 5) @@ -355,7 +387,7 @@ class EPCManagement(): HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) def TerminateSPGW(self, HTML): - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwc /bin/bash -c "killall --signal SIGINT oai_spgwc tshark"', '\$', 5) @@ -397,6 +429,22 @@ class EPCManagement(): mySSH.close() HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) + def Terminate5GCN(self, HTML): + mySSH = SSH.SSHConnection() + mySSH.open(self.IPAddress, self.UserName, self.Password) + if re.match('ltebox', self.Type, re.IGNORECASE): + mySSH.command('cd /opt/ltebox/tools', '\$', 5) + mySSH.command('echo ' + self.Password + ' | sudo -S ./stop_sabox', '\$', 5) + time.sleep(1) + mySSH.command('cd ' + self.SourceCodePath, '\$', 5) + mySSH.command('cd scripts', '\$', 5) + time.sleep(1) + mySSH.command('echo ' + self.Password + ' | sudo -S screen -S simulated_5g_hss -X quit', '\$', 5) + else: + logging.error('This should not happen!') + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) + def DeployEpc(self, HTML): logging.debug('Trying to deploy') if not re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): @@ -408,7 +456,7 @@ class EPCManagement(): HELP.GenericHelp(CONST.Version) HELP.EPCSrvHelp(self.IPAddress, self.UserName, self.Password, self.SourceCodePath, self.Type) sys.exit('Insufficient EPC Parameters') - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) mySSH.command('docker-compose --version', '\$', 5) result = re.search('docker-compose version 1', mySSH.getBefore()) @@ -502,7 +550,7 @@ class EPCManagement(): logging.debug('Trying to undeploy') # No check down, we suppose everything done before. - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) # Recovering logs and pcap files mySSH.command('cd ' + self.SourceCodePath + '/logs', '\$', 5) @@ -546,7 +594,7 @@ class EPCManagement(): HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER) def LogCollectHSS(self): - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) mySSH.command('rm -f hss.log.zip', '\$', 5) @@ -576,7 +624,7 @@ class EPCManagement(): mySSH.close() def LogCollectMME(self): - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) mySSH.command('rm -f mme.log.zip', '\$', 5) @@ -597,13 +645,13 @@ class EPCManagement(): mySSH.command('echo ' + self.Password + ' | sudo -S rm mme*.log', '\$', 5) elif re.match('ltebox', self.Type, re.IGNORECASE): mySSH.command('cp /opt/ltebox/var/log/*Log.0 .', '\$', 5) - mySSH.command('zip mme.log.zip mmeLog.0 s1apcLog.0 s1apsLog.0 s11cLog.0 libLog.0 s1apCodecLog.0', '\$', 60) + mySSH.command('zip mme.log.zip mmeLog.0 s1apcLog.0 s1apsLog.0 s11cLog.0 libLog.0 s1apCodecLog.0 amfLog.0 ngapcLog.0 ngapcommonLog.0 ngapsLog.0', '\$', 60) else: logging.error('This option should not occur!') mySSH.close() def LogCollectSPGW(self): - mySSH = SSH.SSHConnection() + mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) mySSH.command('rm -f spgw.log.zip', '\$', 5) @@ -625,8 +673,8 @@ class EPCManagement(): mySSH.command('zip spgw.log.zip spgw*.log', '\$', 60) mySSH.command('echo ' + self.Password + ' | sudo -S rm spgw*.log', '\$', 5) elif re.match('ltebox', self.Type, re.IGNORECASE): - mySSH.command('cp /opt/ltebox/var/log/xGwLog.0 .', '\$', 5) - mySSH.command('zip spgw.log.zip xGwLog.0', '\$', 60) + mySSH.command('cp /opt/ltebox/var/log/*Log.0 .', '\$', 5) + mySSH.command('zip spgw.log.zip xGwLog.0 upfLog.0', '\$', 60) else: logging.error('This option should not occur!') mySSH.close() diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 0718ee6396..fd8f664ecf 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -659,6 +659,7 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re if (EPC.IPAddress != '') and (EPC.IPAddress != 'none'): CiTestObj.CheckFlexranCtrlInstallation(RAN,EPC,CONTAINERS) EPC.SetMmeIPAddress() + EPC.SetAmfIPAddress() #get the list of tests to be done todo_tests=[] @@ -775,6 +776,10 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re EPC.InitializeSPGW(HTML) elif action == 'Terminate_SPGW': EPC.TerminateSPGW(HTML) + elif action == 'Initialize_5GCN': + EPC.Initialize5GCN(HTML) + elif action == 'Terminate_5GCN': + EPC.Terminate5GCN(HTML) elif action == 'Deploy_EPC': EPC.DeployEpc(HTML) elif action == 'Undeploy_EPC': diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml index 2282e101e5..a43e5b79c0 100755 --- a/ci-scripts/xml_class_list.yml +++ b/ci-scripts/xml_class_list.yml @@ -27,6 +27,8 @@ - Terminate_MME - Initialize_SPGW - Terminate_SPGW + - Initialize_5GCN + - Terminate_5GCN - Initialize_CatM_module - Terminate_CatM_module - Attach_CatM_module @@ -38,4 +40,4 @@ - Deploy_Object - Undeploy_Object - Cppcheck_Analysis - - Deploy_Run_PhySim \ No newline at end of file + - Deploy_Run_PhySim diff --git a/ci-scripts/xml_files/sa_cn5g_closure.xml b/ci-scripts/xml_files/sa_cn5g_closure.xml new file mode 100644 index 0000000000..7174da3b7b --- /dev/null +++ b/ci-scripts/xml_files/sa_cn5g_closure.xml @@ -0,0 +1,37 @@ + + + cn5g-closure + CN5G-Closure + log-out + +060000 + + + + + Terminate_5GCN + Terminate 5G Core + + + diff --git a/ci-scripts/xml_files/sa_cn5g_start.xml b/ci-scripts/xml_files/sa_cn5g_start.xml new file mode 100644 index 0000000000..a524610569 --- /dev/null +++ b/ci-scripts/xml_files/sa_cn5g_start.xml @@ -0,0 +1,38 @@ + + + cn5g-start-tab + CN5G-Start + log-in + + 000100 + + + + + + Initialize_5GCN + Initialize 5G Core + + + From 67bccd8c80b2e6293e417dc48d1e0b61c0d3b9c4 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 22 Jul 2021 11:36:52 +0100 Subject: [PATCH 118/135] Fix handling failure of CFRA procedure for OAI UE --- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 35 +++++++------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 7c54c85632..5d9126ad69 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -789,46 +789,35 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot){ } -// Handlig failure of RA procedure @ MAC layer +// Handling failure of RA procedure @ MAC layer // according to section 5 of 3GPP TS 38.321 version 16.2.1 Release 16 // todo: // - complete handling of received contention-based RA preamble -// - 2-step RA implementation void nr_ra_failed(uint8_t mod_id, uint8_t CC_id, NR_PRACH_RESOURCES_t *prach_resources, frame_t frame, int slot) { NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); RA_config_t *ra = &mac->ra; ra->first_Msg3 = 1; - ra->ra_PreambleIndex = -1; + ra->ra_PreambleIndex = -1; ra->generate_nr_prach = RA_FAILED; ra->ra_state = RA_UE_IDLE; prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER++; - if(prach_resources->RA_TYPE == RA_4STEP){ + if (prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER == ra->preambleTransMax + 1){ - if (prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER == ra->preambleTransMax + 1){ + LOG_D(MAC, "In %s: [UE %d][%d.%d] Maximum number of RACH attempts (%d) reached, selecting backoff time...\n", + __FUNCTION__, mod_id, frame, slot, ra->preambleTransMax); - LOG_D(MAC, "In %s: [UE %d][%d.%d] Maximum number of RACH attempts (%d) reached, selecting backoff time...\n", __FUNCTION__, mod_id, frame, slot, ra->preambleTransMax); - - ra->RA_backoff_cnt = rand() % (prach_resources->RA_PREAMBLE_BACKOFF + 1); - - prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER = 1; - prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP += 2; // 2 dB increment - prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = nr_get_Po_NOMINAL_PUSCH(prach_resources, mod_id, CC_id); - - } else { - - // Resetting RA window - nr_get_RA_window(mac); - - } - - } else if (prach_resources->RA_TYPE == RA_2STEP){ - - LOG_E(MAC, "Missing implementation of RA failure handling for 2-step RA...\n"); + ra->RA_backoff_cnt = rand() % (prach_resources->RA_PREAMBLE_BACKOFF + 1); + prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER = 1; + prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP += 2; // 2 dB increment + prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = nr_get_Po_NOMINAL_PUSCH(prach_resources, mod_id, CC_id); + } else { + // Resetting RA window + nr_get_RA_window(mac); } } From 1beffd1ecc34e18a17319e81204bb92d6176523c Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 22 Jul 2021 14:05:10 +0100 Subject: [PATCH 119/135] Remove the MAC and RRC context after UL failure when gNB is not connected to CN5G --- openair2/RRC/NR/rrc_gNB.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 8ad6b5c8e6..6ef8149bb1 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3070,7 +3070,10 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { ue_context_p, NGAP_CAUSE_RADIO_NETWORK, 30); - }else{ + } + + // Remove here the MAC and RRC context when RRC is not connected or gNB is not connected to CN5G + if(ue_context_p->ue_context.StatusRrc < NR_RRC_CONNECTED || ue_context_p->ue_context.gNB_ue_ngap_id == 0) { mac_remove_nr_ue(ctxt_pP->module_id, ctxt_pP->rnti); rrc_rlc_remove_ue(ctxt_pP); pdcp_remove_UE(ctxt_pP); @@ -3082,6 +3085,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { LOG_I(NR_RRC, "remove UE %x \n", ctxt_pP->rnti); } } + break; // break RB_FOREACH } } From 1c907e922f209510cc48460e1427e990058235a8 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 23 Jul 2021 10:29:41 +0200 Subject: [PATCH 120/135] fix(ci): removed the 2 log expected by nasmesh and rbtool builds Signed-off-by: Raphael Defosseux --- ci-scripts/oai-ci-vm-tool | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ci-scripts/oai-ci-vm-tool b/ci-scripts/oai-ci-vm-tool index d8f088b707..f0c9f9e5f0 100755 --- a/ci-scripts/oai-ci-vm-tool +++ b/ci-scripts/oai-ci-vm-tool @@ -170,20 +170,20 @@ function setvar_usage { # for compatibility reasons function variant__v1__enb_usrp { - NB_PATTERN_FILES=9 + NB_PATTERN_FILES=7 BUILD_OPTIONS="--eNB -w USRP --mu" VM_MEMORY=3072 } function variant__v2__basic_sim { - NB_PATTERN_FILES=13 + NB_PATTERN_FILES=11 BUILD_OPTIONS="--eNB --UE" VM_MEMORY=8192 RUN_OPTIONS="complex" } function variant__v3__phy_sim { - NB_PATTERN_FILES=13 + NB_PATTERN_FILES=11 BUILD_OPTIONS="--phy_simulators" VM_MEMORY=8192 VM_DISK=20 @@ -200,28 +200,28 @@ function variant__v4__cppcheck { function variant__v5__gnb_usrp { VM_MEMORY=10240 VM_CPU=8 - NB_PATTERN_FILES=9 + NB_PATTERN_FILES=7 BUILD_OPTIONS="--gNB -w USRP" } function variant__v6__nr_ue_usrp { VM_MEMORY=4096 VM_CPU=4 - NB_PATTERN_FILES=9 + NB_PATTERN_FILES=7 BUILD_OPTIONS="--nrUE -w USRP" } function variant__v7__enb_ethernet { VM_MEMORY=4096 ARCHIVES_LOC=enb_eth - NB_PATTERN_FILES=9 + NB_PATTERN_FILES=7 BUILD_OPTIONS="--eNB -w USRP" } function variant__v8__ue_ethernet { VM_MEMORY=4096 ARCHIVES_LOC=ue_eth - NB_PATTERN_FILES=13 + NB_PATTERN_FILES=11 BUILD_OPTIONS="--UE -w USRP" } From 03edcdeceb65a5ad096deb28e7b48a47f75c5977 Mon Sep 17 00:00:00 2001 From: hardy Date: Fri, 23 Jul 2021 11:46:02 +0200 Subject: [PATCH 121/135] make module log storage configurable --- ci-scripts/ci_ueinfra.yaml | 2 ++ ci-scripts/cls_module_ue.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ci-scripts/ci_ueinfra.yaml b/ci-scripts/ci_ueinfra.yaml index a21f00fe40..619e8fba15 100644 --- a/ci-scripts/ci_ueinfra.yaml +++ b/ci-scripts/ci_ueinfra.yaml @@ -7,6 +7,7 @@ idefix: Cmd : /home/oaicicd/quectel-CM/quectel-CM -s oai.ipv4 -4 WakeupScript : ci_ctl_qtel.py /dev/ttyUSB2 wup DetachScript : ci_ctl_qtel.py /dev/ttyUSB2 detach + LogStore : /media/usb-drive/ci_qlogs PLMN : 22201 UENetwork : wwan0 HostIPAddress : 192.168.18.188 @@ -22,6 +23,7 @@ nrmodule2_quectel: Cmd : /home/nrmodule2/quectel-CM/quectel-CM -s oai.ipv4 -4 WakeupScript : ci_ctl_qtel.py /dev/ttyUSB7 wup DetachScript : ci_ctl_qtel.py /dev/ttyUSB7 detach + LogStore : /media/ci_qlogs PLMN : 20899 UENetwork : wwan1 HostIPAddress : 192.168.18.189 diff --git a/ci-scripts/cls_module_ue.py b/ci-scripts/cls_module_ue.py index 75b628fd1f..90908e0a90 100644 --- a/ci-scripts/cls_module_ue.py +++ b/ci-scripts/cls_module_ue.py @@ -163,12 +163,12 @@ class Module_UE: now=datetime.now() now_string = now.strftime("%Y%m%d-%H%M") source='ci_qlog' - destination='/media/usb-drive/ci_qlogs/ci_qlog_'+now_string+'.zip' + destination= self.LogStore + '/ci_qlog_'+now_string+'.zip' #qlog artifact is zipped into the target folder mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S zip -r '+destination+' '+source+' &','\$', 10) mySSH.close() #post action : log cleaning to make sure enough space is reserved for the next run - Log_Mgt=cls_log_mgt.Log_Mgt(self.HostIPAddress, self.HostPassword, "/media/usb-drive/ci_qlogs") + Log_Mgt=cls_log_mgt.Log_Mgt(self.HostIPAddress, self.HostPassword, self.LogStore) Log_Mgt.LogRotation() else: destination="" From 165b406839e91b4a436cce457fcbef3d47e64b3b Mon Sep 17 00:00:00 2001 From: rmagueta Date: Fri, 23 Jul 2021 13:12:35 +0100 Subject: [PATCH 122/135] Avoid segmentation fault for LTE --- openair2/LAYER2/MAC/eNB_scheduler_primitives.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index bd3c428828..d53e0cadd3 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -1985,10 +1985,13 @@ find_UE_id(module_id_t mod_idP, { int UE_id; UE_info_t *UE_info = &RC.mac[mod_idP]->UE_info; + if(!UE_info) + return -1; for (UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) { if (UE_info->active[UE_id] == TRUE) { - if (UE_info->UE_template[UE_PCCID(mod_idP, UE_id)][UE_id].rnti == rntiP) { + int CC_id = UE_PCCID(mod_idP, UE_id); + if (CC_id>=0 && CC_idUE_template[CC_id][UE_id].rnti == rntiP) { return UE_id; } } From e241fb5034372b1aa5a204d5a59141c384a252ac Mon Sep 17 00:00:00 2001 From: hardy Date: Fri, 23 Jul 2021 16:31:43 +0200 Subject: [PATCH 123/135] fix ssh remote access to UE module --- ci-scripts/cls_module_ue.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-scripts/cls_module_ue.py b/ci-scripts/cls_module_ue.py index 90908e0a90..1c0c05aeae 100644 --- a/ci-scripts/cls_module_ue.py +++ b/ci-scripts/cls_module_ue.py @@ -62,7 +62,7 @@ class Module_UE: #this method checks if the specified Process is running on the server hosting the module #if not it will be started def CheckCMProcess(self): - HOST=self.HostIPAddress + HOST=self.HostUsername+'@'+self.HostIPAddress COMMAND="ps aux | grep " + self.Process['Name'] + " | grep -v grep " logging.debug(COMMAND) ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) @@ -80,7 +80,7 @@ class Module_UE: mySSH.close() #checking the process time.sleep(5) - HOST=self.HostIPAddress + HOST=self.HostUsername+'@'+self.HostIPAddress COMMAND="ps aux | grep " + self.Process['Name'] + " | grep -v grep " logging.debug(COMMAND) ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) @@ -104,7 +104,7 @@ class Module_UE: #this method retrieves the Module IP address (not the Host IP address) def GetModuleIPAddress(self): - HOST=self.HostIPAddress + HOST=self.HostUsername+'@'+self.HostIPAddress response= [] tentative = 3 while (len(response)==0) and (tentative>0): From 22e1f0c220ef0c58deb0f2bf014c3e3793e3940f Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 26 Jul 2021 08:48:28 +0200 Subject: [PATCH 124/135] fix(ci): fix build HTML report Signed-off-by: Raphael Defosseux --- ci-scripts/reportBuildLocally.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh index eab005c740..8b6db9261a 100755 --- a/ci-scripts/reportBuildLocally.sh +++ b/ci-scripts/reportBuildLocally.sh @@ -576,8 +576,6 @@ function report_build { summary_table_row "RF Simulator - Release 15" ./archives/enb_eth/rfsimulator.Rel15.txt "Built target rfsimulator" ./enb_eth_row5.html summary_table_row "TCP OAI Bridge - Release 15" ./archives/enb_eth/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./enb_eth_row6.html summary_table_row "OAI USRP device if - Release 15" ./archives/enb_eth/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./enb_eth_row7.html - summary_table_row "NASMESH - Release 15" ./archives/enb_eth/nasmesh.Rel15.txt "Built target nasmesh" ./enb_eth_row8.html - summary_table_row "RB Tool - Release 15" ./archives/enb_eth/rb_tool.Rel15.txt "Built target rb_tool" ./enb_eth_row9.html summary_table_footer summary_table_header "OAI Build: 4G LTE UE -- USRP option" ./archives/ue_eth @@ -600,9 +598,7 @@ function report_build { summary_table_row "Coding - Release 15" ./archives/basic_sim/coding.Rel15.txt "Built target coding" ./basic_sim_row3.html summary_table_row "Conf 2 UE data - Release 15" ./archives/basic_sim/conf2uedata.Rel15.txt "Built target conf2uedata" ./basic_sim_row4.html summary_table_row "OAI ETHERNET transport - Release 15" ./archives/basic_sim/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./basic_sim_row5.html - summary_table_row "NASMESH - Release 15" ./archives/basic_sim/nasmesh.Rel15.txt "Built target nasmesh" ./basic_sim_row6.html summary_table_row "Parameters Lib Config - Release 15" ./archives/basic_sim/params_libconfig.Rel15.txt "Built target params_libconfig" ./basic_sim_row7.html - summary_table_row "RB Tool - Release 15" ./archives/basic_sim/rb_tool.Rel15.txt "Built target rb_tool" ./basic_sim_row8.html summary_table_row "RF Simulator - Release 15" ./archives/basic_sim/rfsimulator.Rel15.txt "Built target rfsimulator" ./basic_sim_row9.html summary_table_row "TCP Bridge - Release 15" ./archives/basic_sim/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./basic_sim_row10.html summary_table_row "UE IP - Release 15" ./archives/basic_sim/ue_ip.Rel15.txt "Built target ue_ip" ./basic_sim_row11.html @@ -617,9 +613,7 @@ function report_build { summary_table_row "Coding - Release 15" ./archives/gnb_usrp/coding.Rel15.txt "Built target coding" ./gnb_usrp_row2.html summary_table_row "OAI USRP device if - Release 15" ./archives/gnb_usrp/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./gnb_usrp_row3.html summary_table_row "OAI ETHERNET transport - Release 15" ./archives/gnb_usrp/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./gnb_usrp_row4.html - summary_table_row "NASMESH - Release 15" ./archives/gnb_usrp/nasmesh.Rel15.txt "Built target nasmesh" ./gnb_usrp_row5.html summary_table_row "Parameters Lib Config - Release 15" ./archives/gnb_usrp/params_libconfig.Rel15.txt "Built target params_libconfig" ./gnb_usrp_row6.html - summary_table_row "RB Tool - Release 15" ./archives/gnb_usrp/rb_tool.Rel15.txt "Built target rb_tool" ./gnb_usrp_row7.html summary_table_footer fi @@ -630,9 +624,7 @@ function report_build { summary_table_row "Coding - Release 15" ./archives/nr_ue_usrp/coding.Rel15.txt "Built target coding" ./nr_ue_usrp_row2.html summary_table_row "OAI USRP device if - Release 15" ./archives/nr_ue_usrp/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./nr_ue_usrp_row3.html summary_table_row "OAI ETHERNET transport - Release 15" ./archives/nr_ue_usrp/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./nr_ue_usrp_row4.html - summary_table_row "NASMESH - Release 15" ./archives/nr_ue_usrp/nasmesh.Rel15.txt "Built target nasmesh" ./nr_ue_usrp_row5.html summary_table_row "Parameters Lib Config - Release 15" ./archives/nr_ue_usrp/params_libconfig.Rel15.txt "Built target params_libconfig" ./nr_ue_usrp_row6.html - summary_table_row "RB Tool - Release 15" ./archives/nr_ue_usrp/rb_tool.Rel15.txt "Built target rb_tool" ./nr_ue_usrp_row7.html summary_table_footer fi @@ -652,7 +644,7 @@ function report_build { echo " " >> ./build_results.html echo "
" >> ./build_results.html - if [ -f ./enb_eth_row1.html ] || [ -f ./enb_eth_row2.html ] || [ -f ./enb_eth_row3.html ] || [ -f ./enb_eth_row4.html ] || [ -f ./enb_eth_row5.html ] || [ -f ./enb_eth_row6.html ] || [ -f ./enb_eth_row7.html ] || [ -f ./enb_eth_row8.html ] || [ -f ./enb_eth_row9.html ] + if [ -f ./enb_eth_row1.html ] || [ -f ./enb_eth_row2.html ] || [ -f ./enb_eth_row3.html ] || [ -f ./enb_eth_row4.html ] || [ -f ./enb_eth_row5.html ] || [ -f ./enb_eth_row6.html ] || [ -f ./enb_eth_row7.html ] then for DETAILS_TABLE in `ls ./enb_eth_row*.html` do From 515a30a6369d6c89a6b6b5d981c65c6696ae174d Mon Sep 17 00:00:00 2001 From: hardy Date: Mon, 26 Jul 2021 17:32:28 +0200 Subject: [PATCH 125/135] fix avg file size computation when folder is empty --- ci-scripts/cls_log_mgt.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ci-scripts/cls_log_mgt.py b/ci-scripts/cls_log_mgt.py index 36e7d51a4b..786df47e92 100644 --- a/ci-scripts/cls_log_mgt.py +++ b/ci-scripts/cls_log_mgt.py @@ -72,12 +72,15 @@ class Log_Mgt: COMMAND="ls -rtl "+ self.path ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) result = ssh.stdout.readlines() - total_size=0 - for i in range(1,len(result)): - s=result[i].decode('utf-8').rstrip() - tmp=s.split() - total_size+=int(tmp[4]) #get filesize - return math.floor(total_size/(len(result)-1)) #compute average file/artifact size + if len(result)>1: #at least 1 file present + total_size=0 + for i in range(1,len(result)): + s=result[i].decode('utf-8').rstrip() + tmp=s.split() + total_size+=int(tmp[4]) #get filesize + return math.floor(total_size/(len(result)-1)) #compute average file/artifact size + else:#empty,no files + return 0 #-----------------$ From bd5ac98793e54acc96596f98943076db5af482a5 Mon Sep 17 00:00:00 2001 From: hardy Date: Mon, 26 Jul 2021 17:35:22 +0200 Subject: [PATCH 126/135] add ping to testcase --- ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml index 076799e543..da2f81c42e 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml @@ -31,6 +31,8 @@ 000002 010000 000001 + 050000 + 000001 010002 080001 080000 From 017b362359c5435b54989100baf2330e4abd03ac Mon Sep 17 00:00:00 2001 From: hardy Date: Tue, 27 Jul 2021 11:53:09 +0200 Subject: [PATCH 127/135] added reboot control of Eth USRP --- ci-scripts/main.py | 1 + ci-scripts/ran.py | 12 ++++++++++++ ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml | 2 ++ 3 files changed, 15 insertions(+) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 0718ee6396..82fa4757d7 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -155,6 +155,7 @@ def GetParametersFromXML(action): RAN.eNB_Trace=test.findtext('eNB_Trace') RAN.Initialize_eNB_args=test.findtext('Initialize_eNB_args') eNB_instance=test.findtext('eNB_instance') + RAN.USRPIPAddress=test.findtext('USRP_IPAddress') if (eNB_instance is None): RAN.eNB_instance=0 else: diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 470572f2ff..258ec48c50 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -94,6 +94,7 @@ class RANManagement(): self.runtime_stats= '' self.datalog_rt_stats={} self.eNB_Trace = '' #if 'yes', Tshark will be launched at initialization + self.USRPIPAddress = '' @@ -341,6 +342,17 @@ class RANManagement(): self.testCase_id = HTML.testCase_id mySSH = SSH.SSHConnection() + #reboot USRP if requested in xml + if self.USRPIPAddress!='': + logging.debug('USRP '+ self.USRPIPAddress +'reboot request') + mySSH.open(lIpAddr, lUserName, lPassWord) + cmd2usrp='ssh root@'+self.USRPIPAddress+' reboot' + mySSH.command2(cmd2usrp,1) + mySSH.close() + logging.debug('Waiting for USRP to be ready') + time.sleep(120) + + if (self.pStatus < 0): HTML.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' ' + self.Initialize_eNB_args, 'KO', self.pStatus) HTML.CreateHtmlTabFooter(False) diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml index da2f81c42e..a8e385b854 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml @@ -62,6 +62,7 @@ 0 lte yes + 192.168.18.241 @@ -72,6 +73,7 @@ 1 1 nr + 192.168.18.240 From 65aa1305476b99ca35b9d58df9f8f1d725d30b27 Mon Sep 17 00:00:00 2001 From: hardy Date: Tue, 27 Jul 2021 16:47:43 +0200 Subject: [PATCH 128/135] sa xml testcase (basic) --- ci-scripts/xml_files/fr1_sa_quectel.xml | 124 ++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 ci-scripts/xml_files/fr1_sa_quectel.xml diff --git a/ci-scripts/xml_files/fr1_sa_quectel.xml b/ci-scripts/xml_files/fr1_sa_quectel.xml new file mode 100644 index 0000000000..90c911f86d --- /dev/null +++ b/ci-scripts/xml_files/fr1_sa_quectel.xml @@ -0,0 +1,124 @@ + + + TEST-NSA-FR1-TM1 + NSA Ping DL UL with QUECTEL + tasks + 1 + + 040000 + 000002 + 010000 + 000001 + 050000 + 000001 + 010002 + 080000 + + + + + Initialize_UE + Initialize Quectel + nrmodule2_quectel + yes + + + + + Terminate_UE + Terminate Quectel + nrmodule2_quectel + + + + + Initialize_eNB + Initialize gNB + -O ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf -q + 1 + 1 + nr + 192.168.18.240 + + + + IdleSleep + Sleep + 5 + + + + IdleSleep + Sleep + 20 + + + + + Ping + Ping: 20pings in 20sec + nrmodule2_quectel + -c 20 + 50 + + + + Ping + Ping: 100pings in 20sec + nrmodule2_quectel + -c 100 -i 0.2 + 50 + + + + Iperf + iperf (DL/20Mbps/UDP)(60 sec)(single-ue profile) + -u -b 20M -t 60 + DL + nrmodule2_quectel + 50 + single-ue + + + + Iperf + iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile) + -u -b 3M -t 60 + UL + nrmodule2_quectel + 50 + single-ue + + + + + Terminate_eNB + Terminate gNB + 1 + 1 + nr + + + + From de6d928d1f5626607b568f6ee94e09090051006d Mon Sep 17 00:00:00 2001 From: hardy Date: Tue, 27 Jul 2021 17:37:09 +0200 Subject: [PATCH 129/135] fix remote access for LogRotation method --- ci-scripts/cls_log_mgt.py | 13 +++++++------ ci-scripts/cls_module_ue.py | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ci-scripts/cls_log_mgt.py b/ci-scripts/cls_log_mgt.py index 786df47e92..7fb45ed3ea 100644 --- a/ci-scripts/cls_log_mgt.py +++ b/ci-scripts/cls_log_mgt.py @@ -25,7 +25,7 @@ #--------------------------------------------------------------------- #USAGE: -# log=Log_Mgt(IPAddress,Password,Path) +# log=Log_Mgt(Username,IPAddress,Password,Path) # log.LogRotation() @@ -38,7 +38,8 @@ import math class Log_Mgt: - def __init__(self,IPAddress,Password,Path): + def __init__(self,Username, IPAddress,Password,Path): + self.Username=Username self.IPAddress=IPAddress self.Password=Password self.path=Path @@ -49,7 +50,7 @@ class Log_Mgt: def __CheckAvailSpace(self): - HOST=self.IPAddress + HOST=self.Username+'@'+self.IPAddress COMMAND="df "+ self.path ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) result = ssh.stdout.readlines() @@ -58,7 +59,7 @@ class Log_Mgt: return tmp[3] #return avail space from the line def __GetOldestFile(self): - HOST=self.IPAddress + HOST=self.Username+'@'+self.IPAddress COMMAND="ls -rtl "+ self.path #-rtl will bring oldest file on top ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) result = ssh.stdout.readlines() @@ -68,7 +69,7 @@ class Log_Mgt: def __AvgSize(self): - HOST=self.IPAddress + HOST=self.Username+'@'+self.IPAddress COMMAND="ls -rtl "+ self.path ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) result = ssh.stdout.readlines() @@ -94,7 +95,7 @@ class Log_Mgt: logging.debug("Avail Space : " + str(avail_space) + " / Artifact Avg Size : " + str(avg_size)) if avail_space < 2*avg_size: #reserved space is 2x artifact file ; oldest file will be deleted oldestfile=self.__GetOldestFile() - HOST=self.IPAddress + HOST=self.Username+'@'+self.IPAddress COMMAND="echo " + self.Password + " | sudo -S rm "+ self.path + "/" + oldestfile logging.debug(COMMAND) ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) diff --git a/ci-scripts/cls_module_ue.py b/ci-scripts/cls_module_ue.py index 1c0c05aeae..96d4e0310e 100644 --- a/ci-scripts/cls_module_ue.py +++ b/ci-scripts/cls_module_ue.py @@ -168,7 +168,7 @@ class Module_UE: mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S zip -r '+destination+' '+source+' &','\$', 10) mySSH.close() #post action : log cleaning to make sure enough space is reserved for the next run - Log_Mgt=cls_log_mgt.Log_Mgt(self.HostIPAddress, self.HostPassword, self.LogStore) + Log_Mgt=cls_log_mgt.Log_Mgt(self.HostUsername,self.HostIPAddress, self.HostPassword, self.LogStore) Log_Mgt.LogRotation() else: destination="" From dabf5c8b5566d26a2b8447de3f51a88b836acbcd Mon Sep 17 00:00:00 2001 From: hardy Date: Tue, 27 Jul 2021 17:50:35 +0200 Subject: [PATCH 130/135] fix ping target address for module, depending on EPC type --- ci-scripts/cls_oaicitest.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 73141aa9b7..15b28cbe99 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -1536,8 +1536,13 @@ class OaiCiTest(): SSH.command('cat ' + EPC.SourceCodePath + '/scripts/ping_' + self.testCase_id + '_' + device_id + '.log', '\$', 5) else: #launch from Module SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) + #target address is different depending on EPC type + if re.match('OAI-Rel14-Docker', EPC.Type, re.IGNORECASE): + Target = EPC.MmeIPAddress + else: + Target = EPC.IPAddress #ping from module NIC rather than IP address to make sure round trip is over the air - cmd = 'ping -I ' + Module_UE.UENetwork + ' ' + self.ping_args + ' ' + EPC.IPAddress + ' 2>&1 > ping_' + self.testCase_id + '_' + self.ue_id + '.log' + cmd = 'ping -I ' + Module_UE.UENetwork + ' ' + self.ping_args + ' ' + Target + ' 2>&1 > ping_' + self.testCase_id + '_' + self.ue_id + '.log' SSH.command(cmd,'\$',int(ping_time[0])*1.5) #copy the ping log file to have it locally for analysis (ping stats) SSH.copyin(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword, 'ping_' + self.testCase_id + '_' + self.ue_id + '.log', '.') From 087a2da298089e0d652d1021ea4e220489f7c3c3 Mon Sep 17 00:00:00 2001 From: hardy Date: Wed, 28 Jul 2021 11:06:23 +0200 Subject: [PATCH 131/135] SA test pipeline udpate --- ...=> gnb.band78.sa.fr1.106PRB.usrpn310.conf} | 19 ++++--- ci-scripts/ran.py | 24 +++++---- ci-scripts/xml_files/fr1_gnb_build.xml | 50 +++++++++++++++++++ ci-scripts/xml_files/fr1_sa_quectel.xml | 15 +++--- 4 files changed, 84 insertions(+), 24 deletions(-) rename ci-scripts/conf_files/{gnb.band78.sa.fr1.106PRB.usrpb210.conf => gnb.band78.sa.fr1.106PRB.usrpn310.conf} (95%) create mode 100644 ci-scripts/xml_files/fr1_gnb_build.xml diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf similarity index 95% rename from ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf rename to ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf index 0efc071c91..db190f177d 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -12,8 +12,8 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; plmn_list = ({ - mcc = 222; - mnc = 01; + mcc = 208; + mnc = 99; mnc_length = 2; snssaiList = ( { @@ -226,10 +226,12 @@ gNBs = MACRLCs = ( { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - ulsch_max_slots_inactivity = 100; + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + ulsch_max_slots_inactivity = 100; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; } ); @@ -250,11 +252,12 @@ RUs = ( att_rx = 0; bands = [7]; max_pdschReferenceSignalPower = -27; - max_rxgain = 114; + max_rxgain = 81; eNB_instances = [0]; #beamforming 1x4 matrix: bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; - clock_src = "internal"; + #clock_src = "external"; + sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 258ec48c50..5e3d8e388f 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -357,16 +357,20 @@ class RANManagement(): HTML.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' ' + self.Initialize_eNB_args, 'KO', self.pStatus) HTML.CreateHtmlTabFooter(False) sys.exit(1) - #Get pcap on S1 and X2 eNB interface, if enabled in the xml - #will not work for gNB at this stage - if ((self.air_interface[self.eNB_instance] == 'lte-softmodem') or (self.air_interface[self.eNB_instance] == 'ocp-enb')) and self.eNB_Trace=='yes': + + #Get pcap on enb and/or gnb if enabled in the xml + if self.eNB_Trace=='yes': + if ((self.air_interface[self.eNB_instance] == 'lte-softmodem') or (self.air_interface[self.eNB_instance] == 'ocp-enb')): + pcapfile_prefix="enb_" + else: + pcapfile_prefix="gnb_" mySSH.open(lIpAddr, lUserName, lPassWord) mySSH.command('ip addr show | awk -f /tmp/active_net_interfaces.awk | egrep -v "lo|tun"', '\$', 5) result = re.search('interfaceToUse=(?P[a-zA-Z0-9\-\_]+)done', mySSH.getBefore()) if result is not None: eth_interface = result.group('eth_interface') logging.debug('\u001B[1m Launching tshark on interface ' + eth_interface + '\u001B[0m') - pcapfile = 'enb_' + self.testCase_id + '_s1x2log.pcap' + pcapfile = pcapfile_prefix + self.testCase_id + '_log.pcap' mySSH.command('echo ' + lPassWord + ' | sudo -S rm -f /tmp/' + pcapfile , '\$', 5) mySSH.command('echo $USER; nohup sudo -E tshark -i ' + eth_interface + ' -w /tmp/' + pcapfile + ' 2>&1 &','\$', 5) mySSH.close() @@ -684,10 +688,11 @@ class RANManagement(): mySSH.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) mySSH.command('cd ' + self.eNBSourceCodePath, '\$', 5) mySSH.command('cd cmake_targets', '\$', 5) - mySSH.command('echo ' + self.eNBPassword + ' | sudo -S mv /tmp/enb_*_s1x2log.pcap .','\$',20) + mySSH.command('echo ' + self.eNBPassword + ' | sudo -S mv /tmp/enb_*.pcap .','\$',20) + mySSH.command('echo ' + self.eNBPassword + ' | sudo -S mv /tmp/gnb_*.pcap .','\$',20) mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm -f enb.log.zip', '\$', 5) - mySSH.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip enb*.log core* enb_*record.raw enb_*.pcap enb_*txt physim_*.log *stats.log', '\$', 60) - mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap enb_*txt physim_*.log *stats.log', '\$', 5) + mySSH.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip enb*.log core* enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log', '\$', 60) + mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log', '\$', 5) mySSH.close() def AnalyzeLogFile_eNB(self, eNBlogFile, HTML): @@ -933,8 +938,9 @@ class RANManagement(): if result is not None: #remove 1- all useless char before relevant info 2- trailing char line=line.replace('[0m','') - tmp=re.match(rf'^.*?(\b{k}\b.*)',line.rstrip()) #from python 3.6 we can use literal string interpolation for the variable k, using rf' in the regex - real_time_stats[k]=tmp.group(1) + tmp=re.match(rf'^.*?(\b{k}\b.*)',line.rstrip()) #from python 3.6 we can use literal string interpolation for the variable k, using rf' in the regex + if tmp!=None: #with ULULULUULULULLLL at the head of the line, we skip it + real_time_stats[k]=tmp.group(1) #count "problem receiving samples" msg result = re.search('\[PHY\]\s+problem receiving samples', str(line)) diff --git a/ci-scripts/xml_files/fr1_gnb_build.xml b/ci-scripts/xml_files/fr1_gnb_build.xml new file mode 100644 index 0000000000..d0c91f407d --- /dev/null +++ b/ci-scripts/xml_files/fr1_gnb_build.xml @@ -0,0 +1,50 @@ + + + build-tab + Build + wrench + + 000001 + 000002 + + + + + Build_eNB + Build gNB + -w USRP -c --gNB --ninja + 0 + 0 + True + True + + + + WaitEndBuild_eNB + Wait for end of Build gNB + 0 + 0 + + + diff --git a/ci-scripts/xml_files/fr1_sa_quectel.xml b/ci-scripts/xml_files/fr1_sa_quectel.xml index 90c911f86d..4c8fba0611 100644 --- a/ci-scripts/xml_files/fr1_sa_quectel.xml +++ b/ci-scripts/xml_files/fr1_sa_quectel.xml @@ -21,8 +21,8 @@ --> - TEST-NSA-FR1-TM1 - NSA Ping DL UL with QUECTEL + TEST-SA-FR1-TM1 + SA Ping DL UL with QUECTEL tasks 1 @@ -55,10 +55,11 @@ Initialize_eNB Initialize gNB - -O ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf -q - 1 - 1 + -O ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf --sa -q + 0 + 0 nr + yes 192.168.18.240 @@ -115,8 +116,8 @@ Terminate_eNB Terminate gNB - 1 - 1 + 0 + 0 nr From 3cfb169b374e35788e12b39d5a87bebb2b63bc3a Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 29 Jul 2021 08:29:27 +0200 Subject: [PATCH 132/135] fix(build): protobuf location has changed Signed-off-by: Raphael Defosseux --- cmake_targets/install_external_packages.ubuntu20 | 4 ++-- cmake_targets/tools/build_helper | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake_targets/install_external_packages.ubuntu20 b/cmake_targets/install_external_packages.ubuntu20 index 95293198b9..f0314ca575 100755 --- a/cmake_targets/install_external_packages.ubuntu20 +++ b/cmake_targets/install_external_packages.ubuntu20 @@ -154,11 +154,11 @@ install_protobuf_from_source(){ cd /tmp || exit echo "Downloading protobuf" #rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1 - #wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz + #wget https://github.com/protocolbuffers/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz #tar -xzvf protobuf-2.6.1.tar.gz --owner $USER --group $USER --no-same-owner #cd protobuf-2.6.1/ rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 - wget --tries=3 --retry-connrefused https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz + wget --tries=3 --retry-connrefused https://github.com/protocolbuffers/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner "$USER" --group "$(groups | cut -d" " -f1)" --no-same-owner cd protobuf-3.3.0/ || exit ./configure diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 9880b66685..d3fcf615e2 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -256,14 +256,14 @@ install_protobuf_from_source(){ cd /tmp echo "Downloading protobuf" #rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1 - #wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz + #wget https://github.com/protocolbuffers/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz #tar -xzvf protobuf-2.6.1.tar.gz --owner $USER --group $USER --no-same-owner #cd protobuf-2.6.1/ if [ $IS_CONTAINER -eq 0 ] then rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 - wget --tries=3 --retry-connrefused https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz + wget --tries=3 --retry-connrefused https://github.com/protocolbuffers/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $(id -u) --group $(id -g) --no-same-owner cd protobuf-3.3.0/ else From 58825cd92abf7b19dded0d42064bb38cc405e540 Mon Sep 17 00:00:00 2001 From: hardy Date: Thu, 29 Jul 2021 09:42:58 +0200 Subject: [PATCH 133/135] fix USRP address detection in xml --- ci-scripts/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 82fa4757d7..694a5fc446 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -155,7 +155,11 @@ def GetParametersFromXML(action): RAN.eNB_Trace=test.findtext('eNB_Trace') RAN.Initialize_eNB_args=test.findtext('Initialize_eNB_args') eNB_instance=test.findtext('eNB_instance') - RAN.USRPIPAddress=test.findtext('USRP_IPAddress') + USRPIPAddress=test.findtext('USRP_IPAddress') + if USRPIPAddress is None: + RAN.USRPIPAddress='' + else: + RAN.USRPIPAddress=USRPIPAddress if (eNB_instance is None): RAN.eNB_instance=0 else: From 6b6215e6289b249549b5881d8b6b3d526fc63b95 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 27 Jul 2021 11:12:02 +0200 Subject: [PATCH 134/135] fix(ci): adding detection of timed-out run on the physims on cluster Signed-off-by: Raphael Defosseux --- ci-scripts/cls_physim1.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 1c82526831..131aa01c4c 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -245,7 +245,7 @@ class PhySim: isFinished = False # doing a deep copy! tmpPodNames = podNames.copy() - while(count < 28 and isFinished == False): + while(count < 32 and isFinished == False): time.sleep(60) for podName in tmpPodNames: mySSH.command2(f'oc logs --tail=1 {podName} 2>&1', 6, silent=True) @@ -257,6 +257,8 @@ class PhySim: count += 1 if isFinished: logging.debug('\u001B[1m PhySim test is Complete\u001B[0m') + else: + logging.error('\u001B[1m PhySim test Timed-out!\u001B[0m') # Getting the logs of each executables running in individual pods for podName in podNames: @@ -279,15 +281,18 @@ class PhySim: mySSH.command('oc logout', '\$', 6) mySSH.close() self.AnalyzeLogFile_phySim(HTML) - if self.testStatus: + if self.testStatus and isFinished: HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult) logging.info('\u001B[1m Physical Simulator Pass\u001B[0m') else: RAN.prematureExit = True - HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ALL_PROCESSES_OK) + if isFinished: + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ALL_PROCESSES_OK) + else: + HTML.CreateHtmlTestRow('Some test(s) timed-out!', 'KO', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult) - logging.info('\u001B[1m Physical Simulator Fail\u001B[0m') + logging.error('\u001B[1m Physical Simulator Fail\u001B[0m') def AnalyzeLogFile_phySim(self, HTML): lIpAddr = self.eNBIPAddress From efc696cce989d7434604cacc1a77790f5fdda70c Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 3 Aug 2021 15:32:24 +0200 Subject: [PATCH 135/135] fix(ci): split 4G RF sim / 5G RF sim into 2 stages - Fix the SA RF test (wrong conf file) - No more copy of RAW files in SA - Fix no-detection of failures on RA Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-gitlab | 20 ++++++++++ ci-scripts/oai-ci-vm-tool | 5 +++ ci-scripts/reportTestLocally.sh | 16 +++++--- ci-scripts/runTestOnVM.sh | 65 ++++++++++++++++++++++++--------- 4 files changed, 82 insertions(+), 24 deletions(-) diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index 576ae7b055..6b53230c09 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -384,6 +384,26 @@ pipeline { } } } + stage ("Test 5G RF simulator") { + when { + expression {doMandatoryTests} + } + steps { + lock (vmResource) { + script { + timeout (time: 40, unit: 'MINUTES') { + try { + gitlabCommitStatus(name: "Test 5G RF-sim") { + sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant rf5g-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + } + } catch (Exception e) { + currentBuild.result = 'FAILURE' + } + } + } + } + } + } stage ("Test L2 simulator") { when { expression {doFullTestsuite} diff --git a/ci-scripts/oai-ci-vm-tool b/ci-scripts/oai-ci-vm-tool index f0c9f9e5f0..5ee653c8e1 100755 --- a/ci-scripts/oai-ci-vm-tool +++ b/ci-scripts/oai-ci-vm-tool @@ -247,6 +247,11 @@ function variant__v22__l2_sim { RUN_OPTIONS="complex" } +function variant__v23__rf5g_sim { + ARCHIVES_LOC=rf5g_sim + RUN_OPTIONS="complex" +} + # Following function lists all variant__v__ functions # and set the VARIANTS_SHORT and VARIANTS_LONG arrays from # the function names diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh index 7290507b4e..19fac7fd78 100755 --- a/ci-scripts/reportTestLocally.sh +++ b/ci-scripts/reportTestLocally.sh @@ -717,7 +717,11 @@ function report_test { done echo " " >> ./test_simulator_results.html echo "
" >> ./test_simulator_results.html + fi + ARCHIVES_LOC=archives/rf5g_sim/test + if [ -d $ARCHIVES_LOC ] + then echo "

5G NR RF Simulator Check

" >> ./test_simulator_results.html if [ -f $ARCHIVES_LOC/test_final_status.log ] @@ -762,9 +766,9 @@ function report_test { echo " " >> ./test_simulator_results.html if [[ $CN_CONFIG =~ .*wS1.* ]] then - echo " Test with EPC (aka withS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html + echo " Test with CN5G : ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html else - echo " Test without EPC (aka noS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html + echo " Test without CN5G : ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html fi echo " " >> ./test_simulator_results.html @@ -837,9 +841,9 @@ function report_test { echo " " >> ./test_simulator_results.html if [[ $CN_CONFIG =~ .*wS1.* ]] then - echo " Test with EPC (aka withS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html + echo " Test with CN5G : ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html else - echo " Test without EPC (aka noS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html + echo " Test without CN5G : ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html fi echo " " >> ./test_simulator_results.html @@ -907,9 +911,9 @@ function report_test { echo " " >> ./test_simulator_results.html if [[ $CN_CONFIG =~ .*wS1.* ]] then - echo " Test with EPC (aka withS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html + echo " Test with CN5G : ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html else - echo " Test without EPC (aka noS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html + echo " Test without CN5G : ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html fi echo " " >> ./test_simulator_results.html diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index 058d64b0ba..de696cdc64 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -1355,8 +1355,11 @@ function start_rf_sim_gnb { ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR < $1 rm $1 # Copy the RAW files from the gNB run for the NR-UE - scp -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/ran_build/build/rbconfig.raw . - scp -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/ran_build/build/reconfig.raw . + if [ $LOC_RA_SA_TEST -ne 2 ] + then + scp -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/ran_build/build/rbconfig.raw . + scp -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/ran_build/build/reconfig.raw . + fi } function start_rf_sim_nr_ue { @@ -1371,8 +1374,11 @@ function start_rf_sim_nr_ue { local LOC_RA_SA_TEST=$8 # Copy the RAW files from the gNB run - scp -o StrictHostKeyChecking=no rbconfig.raw ubuntu@$LOC_NR_UE_VM_IP_ADDR:/home/ubuntu/tmp - scp -o StrictHostKeyChecking=no reconfig.raw ubuntu@$LOC_NR_UE_VM_IP_ADDR:/home/ubuntu/tmp + if [ $LOC_RA_SA_TEST -ne 2 ] + then + scp -o StrictHostKeyChecking=no rbconfig.raw ubuntu@$LOC_NR_UE_VM_IP_ADDR:/home/ubuntu/tmp + scp -o StrictHostKeyChecking=no reconfig.raw ubuntu@$LOC_NR_UE_VM_IP_ADDR:/home/ubuntu/tmp + fi echo "echo \"sudo apt-get --yes --quiet install daemon \"" > $1 echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1 @@ -1380,8 +1386,12 @@ function start_rf_sim_nr_ue { echo "export RFSIMULATOR=${LOC_GNB_VM_IP_ADDR}" >> $1 echo "echo \"cd /home/ubuntu/tmp/cmake_targets/ran_build/build/\"" >> $1 echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 - echo "sudo cp /home/ubuntu/tmp/r*config.raw /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 - echo "sudo chmod 666 /home/ubuntu/tmp/cmake_targets/ran_build/build/r*config.raw" >> $1 + echo "sudo rm -f /home/ubuntu/tmp/cmake_targets/ran_build/build/r*config.raw" >> $1 + if [ $LOC_RA_SA_TEST -ne 2 ] + then + echo "sudo cp /home/ubuntu/tmp/r*config.raw /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 + echo "sudo chmod 666 /home/ubuntu/tmp/cmake_targets/ran_build/build/r*config.raw" >> $1 + fi echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 if [ $LOC_S1_CONFIGURATION -eq 0 ] then @@ -1472,11 +1482,13 @@ function run_test_on_vm { UE_VM_CMDS=${UE_VM_NAME}_cmds.txt echo "UE_VM_NAME = $UE_VM_NAME" echo "UE_VM_CMD_FILE = $UE_VM_CMDS" - GNB_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#gnb-usrp#" -e "s#rf-sim#gnb-usrp#"` + elif [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf5g-sim.* )) ]] + then + GNB_VM_NAME=`echo $VM_NAME | sed -e "s#rf5g-sim#gnb-usrp#"` GNB_VM_CMDS=${GNB_VM_NAME}_cmds.txt echo "GNB_VM_NAME = $GNB_VM_NAME" echo "GNB_VM_CMD_FILE = $GNB_VM_CMDS" - NR_UE_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#nr-ue-usrp#" -e "s#rf-sim#nr-ue-usrp#"` + NR_UE_VM_NAME=`echo $VM_NAME | sed -e "s#rf5g-sim#nr-ue-usrp#"` NR_UE_VM_CMDS=${UE_VM_NAME}_cmds.txt echo "NR_UE_VM_NAME = $NR_UE_VM_NAME" echo "NR_UE_VM_CMD_FILE = $NR_UE_VM_CMDS" @@ -1505,6 +1517,8 @@ function run_test_on_vm { UE_VM_IP_ADDR=`uvt-kvm ip $UE_VM_NAME` echo "$UE_VM_NAME has for IP addr = $UE_VM_IP_ADDR" + elif [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf5g-sim.* )) ]] + then echo "############################################################" echo "Waiting for GNB VM to be started" echo "############################################################" @@ -2239,14 +2253,23 @@ function run_test_on_vm { fi - if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]] + if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf5g-sim.* ]] then + PING_STATUS=0 + IPERF_STATUS=0 + NR_STATUS=0 + if [ -d $ARCHIVES_LOC ] + then + rm -Rf $ARCHIVES_LOC + fi + mkdir --parents $ARCHIVES_LOC + echo "############################################################" echo "SA TEST" echo "############################################################" #SA test, attention : has a different config file from the rest of the test CN_CONFIG="noS1" - CONF_FILE=gnb.band78.sa.fr1.106PRB.usrpb210.conf + CONF_FILE=gnb.band78.sa.fr1.106PRB.usrpn310.conf S1_NOS1_CFG=0 PRB=106 FREQUENCY=3510 @@ -2257,7 +2280,6 @@ function run_test_on_vm { fi local try_cnt=0 - NR_STATUS=0 ######### start of SA TEST loop while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI @@ -2314,6 +2336,7 @@ function run_test_on_vm { echo "try_cnt = " $try_cnt try_cnt=$((try_cnt+1)) else + echo "SA test OK" try_cnt=$((try_cnt+10)) fi done @@ -2339,14 +2362,14 @@ function run_test_on_vm { fi local try_cnt=0 - NR_STATUS=0 ######### start of RA TEST loop + RA_FR2_STATUS=0 while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI do SYNC_STATUS=0 - RA_FR2_STATUS=0 + RA_STATUS=0 rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}*ra_fr2_test.log echo "############################################################" @@ -2390,12 +2413,15 @@ function run_test_on_vm { # Proper check to be done when RA test is working! check_ra_result $ARCHIVES_LOC/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC/$CURRENT_NR_UE_LOG_FILE - if [ $RA_FR2_STATUS -ne 0 ] + if [ $RA_STATUS -ne 0 ] then echo "RA FR2 test NOT OK" echo "try_cnt = " $try_cnt try_cnt=$((try_cnt+1)) + RA_FR2_STATUS=-1 else + echo "RA FR2 test OK" + RA_FR2_STATUS=0 try_cnt=$((try_cnt+10)) fi done @@ -2439,8 +2465,8 @@ function run_test_on_vm { FREQUENCY=3510 fi + RA_FR1_STATUS=0 local try_cnt=0 - NR_STATUS=0 while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI do @@ -2493,8 +2519,11 @@ function run_test_on_vm { then echo "RA FR1 test NOT OK" echo "try_cnt = " $try_cnt + RA_FR1_STATUS=-1 try_cnt=$((try_cnt+1)) else + echo "RA FR1 test OK" + RA_FR1_STATUS=0 try_cnt=$((try_cnt+10)) fi done @@ -2629,17 +2658,17 @@ function run_test_on_vm { if [ $SA_STATUS -ne 0 ]; then NR_STATUS=-1; fi if [ $RA_FR2_STATUS -ne 0 ]; then NR_STATUS=-1; fi - if [ $RA_STATUS -ne 0 ]; then NR_STATUS=-1; fi + if [ $RA_FR1_STATUS -ne 0 ]; then NR_STATUS=-1; fi if [ $SYNC_STATUS -ne 0 ]; then NR_STATUS=-1; fi if [ $PING_STATUS -ne 0 ]; then NR_STATUS=-1; fi if [ $IPERF_STATUS -ne 0 ]; then NR_STATUS=-1; fi if [ $NR_STATUS -eq 0 ] then echo "5G-NR RFSIM seems OK" - echo "5G-NR: TEST_OK" >> $ARCHIVES_LOC/test_final_status.log + echo "5G-NR: TEST_OK" > $ARCHIVES_LOC/test_final_status.log else echo "5G-NR RFSIM seems to FAIL" - echo "5G-NR: TEST_KO" >> $ARCHIVES_LOC/test_final_status.log + echo "5G-NR: TEST_KO" > $ARCHIVES_LOC/test_final_status.log STATUS=-1 fi fi