From ed1c87b59816b3979146f5d33bd33f0f6d597a1f Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 14 Mar 2022 17:53:57 +0100 Subject: [PATCH 01/39] commit before rebase --- cmake_targets/phy_simulators | 1 - common/utils/lte/ue_power.c | 6 +- executables/nr-uesoftmodem.c | 9 +- .../PHY/NR_ESTIMATION/nr_measurements_gNB.c | 23 ++--- openair1/PHY/NR_TRANSPORT/nr_dci.c | 2 +- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 92 +++++++++++-------- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 9 +- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 8 +- openair1/PHY/TOOLS/dB_routines.h | 35 ------- openair1/PHY/TOOLS/tools_defs.h | 22 +++-- openair1/SCHED/sched_common_vars.h | 1 + openair1/SCHED_NR_UE/harq_nr.c | 64 ++++--------- openair2/LAYER2/MAC/config.c | 5 - openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 1 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 3 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 24 ++--- targets/RT/USER/lte-ue.c | 12 +-- 17 files changed, 125 insertions(+), 192 deletions(-) delete mode 120000 cmake_targets/phy_simulators delete mode 100644 openair1/PHY/TOOLS/dB_routines.h diff --git a/cmake_targets/phy_simulators b/cmake_targets/phy_simulators deleted file mode 120000 index 2a12e92f3e..0000000000 --- a/cmake_targets/phy_simulators +++ /dev/null @@ -1 +0,0 @@ -ran_build/ \ No newline at end of file diff --git a/common/utils/lte/ue_power.c b/common/utils/lte/ue_power.c index b377abf2ff..aaa2826275 100644 --- a/common/utils/lte/ue_power.c +++ b/common/utils/lte/ue_power.c @@ -33,10 +33,8 @@ #include #include #include "PHY/defs_eNB.h" -#include "PHY/TOOLS/dB_routines.h" - -extern int16_t hundred_times_delta_TF[100]; -extern uint16_t hundred_times_log10_NPRB[100]; +#include +#include int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, int ncp, uint8_t use_srs) { diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 76c21bb422..649b68631b 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -241,14 +241,17 @@ nrUE_params_t *get_nrUE_params(void) { } /* initialie thread pools used for NRUE processing paralleliation */ void init_tpools(uint8_t nun_dlsch_threads) { - char *params = NULL; - params = calloc(1,(NR_RX_NB_TH*NR_NB_TH_SLOT*3)+1); + char params[NR_RX_NB_TH*NR_NB_TH_SLOT*3+1]; for (int i=0; iframe_parms; NR_gNB_COMMON *common_vars = &gNB->common_vars; PHY_MEASUREMENTS_gNB *measurements = &gNB->measurements; - int rb, offset, offset0, nb_symb[275], len; - int32_t *ul_ch; - - LOG_D(PHY,"slot %d Doing I0 for first_symb %d, num_symb %d\n",slot,first_symb,num_symb); + int rb, nb_symb[275]={0}; + + memset(measurements->n0_subband_power, 0, sizeof(measurements->n0_subband_power)); + for (int s=first_symb;s<(first_symb+num_symb);s++) { for (rb=0; rbN_RB_UL; rb++) { - - if (s==first_symb) { - nb_symb[rb]=0; - for (int aarx=0; aarxnb_antennas_rx;aarx++) - measurements->n0_subband_power[aarx][rb]=0; - } - offset0 = (slot&3)*(frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size) + (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size; + int offset0 = (slot&3)*(frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size) + + (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size; if ((gNB->rb_mask_ul[s][rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe nb_symb[rb]++; for (int aarx=0; aarxnb_antennas_rx; aarx++) { - offset = offset0 + (s*frame_parms->ofdm_symbol_size); - ul_ch = &common_vars->rxdataF[aarx][offset]; - len = 12; + int offset = offset0 + (s*frame_parms->ofdm_symbol_size); + int32_t *ul_ch = &common_vars->rxdataF[aarx][offset]; + int len = 12; if (((frame_parms->N_RB_UL&1) == 1) && (rb==(frame_parms->N_RB_UL>>1))) { len=6; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 0af56ba706..ae96eb26bc 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -132,7 +132,7 @@ void nr_generate_dci(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15, polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI, 1, NR_POLAR_DCI_MESSAGE_TYPE, dci_pdu->PayloadSizeBits, dci_pdu->AggregationLevel); -#ifdef DEBUG_CHANNEL_CODING +#if 1 printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,pdcch_pdu_rel15->dci_pdu->AggregationLevel); printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n", ((uint64_t*)dci_pdu->Payload)[0], ((uint64_t*)dci_pdu->Payload)[1]); diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 50c3b62f50..17f145b98a 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -243,7 +243,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, * x(l*12+n) = r_u_v_alpha_delta(n) */ // the value of u,v (delta always 0 for PUCCH) has to be calculated according to TS 38.211 Subclause 6.3.2.2.1 - uint8_t u[2]={0,0},v[2]={0,0}; + uint8_t u[2]={0},v[2]={0}; // x_n contains the sequence r_u_v_alpha_delta(n) @@ -262,7 +262,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, AssertFatal(pucch_pdu->nr_of_symbols < 3,"nr_of_symbols %d not allowed\n",pucch_pdu->nr_of_symbols); - uint32_t re_offset[2]={0,0}; + uint32_t re_offset[2]={0}; uint8_t l2; const int16_t *x_re[2],*x_im[2]; @@ -271,16 +271,11 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, x_re[1] = table_5_2_2_2_2_Re[u[1]]; x_im[1] = table_5_2_2_2_2_Im[u[1]]; - int16_t xr[1+frame_parms->nb_antennas_rx][1+pucch_pdu->nr_of_symbols][24] __attribute__((aligned(32))); + c64_t xr[frame_parms->nb_antennas_rx][pucch_pdu->nr_of_symbols][12] __attribute__((aligned(32))); + memset(xr, 0, sizeof(xr)); int64_t xrtmag=0,xrtmag_next=0; uint8_t maxpos=0; uint8_t index=0; - for (int l=0; lnr_of_symbols; l++) { - for (int aarx=0;aarxnb_antennas_rx;aarx++) { - memset((void*)xr[aarx][l],0,24*sizeof(int16_t)); - } - } - int n2; for (int l=0; lnr_of_symbols; l++) { l2 = l+pucch_pdu->start_symbol_index; @@ -289,23 +284,23 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, re_offset[l]-=frame_parms->ofdm_symbol_size; AssertFatal(re_offset[l]+12 < frame_parms->ofdm_symbol_size,"pucch straddles DC carrier, handle this!\n"); - int16_t *r; for (int aa=0;aanb_antennas_rx;aa++) { - r=(int16_t*)&rxdataF[aa][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[l]]; - n2=0; - for (n=0;n<12;n++,n2+=2) { - xr[aa][l][n2] +=(int16_t)(((int32_t)x_re[l][n]*r[n2]+(int32_t)x_im[l][n]*r[n2+1])>>15); - xr[aa][l][n2+1]+=(int16_t)(((int32_t)x_re[l][n]*r[n2+1]-(int32_t)x_im[l][n]*r[n2])>>15); + c16_t *r=(c16_t*)&rxdataF[aa][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[l]]; + for (n=0;n<12;n++) { + xr[aa][l][n].r +=(int32_t)x_re[l][n]*r[n].r+(int32_t)x_im[l][n]*r[n].i; + xr[aa][l][n].i +=(int32_t)x_re[l][n]*r[n].i-(int32_t)x_im[l][n]*r[n].r; #ifdef DEBUG_NR_PUCCH_RX - printf("x (%d,%d), r%d.%d (%d,%d), xr (%d,%d)\n", - x_re[l][n],x_im[l][n],l2,re_offset[l],r[n2],r[n2+1],xr[aa][l][n2],xr[aa][l][n2+1]); + printf("x (%d,%d), r%d.%d (%d,%d), xr (%lld,%lld)\n", + x_re[l][n],x_im[l][n],l2,re_offset[l],r[n].r,r[n].i,xr[aa][l][n].r,xr[aa][l][n].i); #endif } + xr[aa][l][n].r>>=15; + xr[aa][l][n].i>>=15; } } - int32_t corr_re[1+frame_parms->nb_antennas_rx][2]; - int32_t corr_im[1+frame_parms->nb_antennas_rx][2]; + int64_t corr_re[frame_parms->nb_antennas_rx][2]; + int64_t corr_im[frame_parms->nb_antennas_rx][2]; //int32_t no_corr = 0; int seq_index = 0; int64_t temp; @@ -322,19 +317,19 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, for (int aa=0;aanb_antennas_rx;aa++) { corr_re[aa][l]=0; corr_im[aa][l]=0; - - n2=0; - for (n=0;n<12;n++,n2+=2) { - corr_re[aa][l]+=(xr[aa][l][n2]*idft12_re[seq_index][n]+xr[aa][l][n2+1]*idft12_im[seq_index][n])>>15; - corr_im[aa][l]+=(xr[aa][l][n2]*idft12_im[seq_index][n]-xr[aa][l][n2+1]*idft12_re[seq_index][n])>>15; + for (n=0;n<12;n++) { + corr_re[aa][l]+=xr[aa][l][n].r*idft12_re[seq_index][n]+xr[aa][l][n].i*idft12_im[seq_index][n]; + corr_im[aa][l]+=xr[aa][l][n].r*idft12_im[seq_index][n]-xr[aa][l][n].i*idft12_re[seq_index][n]; } + corr_re[aa][l]>>=15; + corr_im[aa][l]>>=15; } } - LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%d,%d)=>%f\n", + LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%ld,%ld)=>%f\n", mcs[i],seq_index,corr_re[0][0],corr_im[0][0], 10*log10((double)corr_re[0][0]*corr_re[0][0] + (double)corr_im[0][0]*corr_im[0][0])); if (pucch_pdu->nr_of_symbols==2) - LOG_D(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%d,%d)=>%f\n", + LOG_D(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%ld,%ld)=>%f\n", mcs[i],seq_index,corr_re[0][1],corr_im[0][1], 10*log10((double)corr_re[0][1]*corr_re[0][1] + (double)corr_im[0][1]*corr_im[0][1])); if (pucch_pdu->freq_hop_flag == 0) { @@ -392,7 +387,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_stats->pucch0_n01 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]]; LOG_D(PHY,"n00[%d] = %d, n01[%d] = %d\n",prb_offset[0],uci_stats->pucch0_n00,prb_offset[1],uci_stats->pucch0_n01); // estimate CQI for MAC (from antenna port 0 only) - int max_n0 = uci_stats->pucch0_n00>uci_stats->pucch0_n01 ? uci_stats->pucch0_n00:uci_stats->pucch0_n01; + int max_n0 = max(gNB->measurements.n0_subband_power_tot_dB[prb_offset[0]], + gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]]); int SNRtimes10,sigenergy=0; for (int aa=0;aanb_antennas_rx;aa++) sigenergy += signal_energy_nodc(&rxdataF[aa][soffset+ @@ -407,8 +403,16 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_stats->pucch0_thres = gNB->pucch0_thres; /* + (10*max_n0);*/ bool no_conf=false; if (nr_sequences>1) { - if (xrtmag_dBtimes10 < (50+xrtmag_next_dBtimes10) || SNRtimes10 < uci_stats->pucch0_thres) + if (xrtmag_dBtimes10 < (50+xrtmag_next_dBtimes10) || SNRtimes10 < gNB->pucch0_thres) { no_conf=true; + LOG_W(PHY,"%d.%d PUCCH bad confidence: %d threshold, %d, %d, %d\n", + frame, slot, + uci_stats->pucch0_thres, + SNRtimes10, + xrtmag_dBtimes10, + xrtmag_next_dBtimes10); + abort(); + } } gNB->bad_pucch += no_conf; // first bit of bitmap for sr presence and second bit for acknack presence @@ -422,7 +426,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, if (pucch_pdu->bit_len_harq==0) { uci_pdu->harq = NULL; uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); - uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0; + uci_pdu->sr->sr_confidence_level = no_conf; uci_stats->pucch0_sr_trials++; if (xrtmag_dBtimes10>(10*gNB->measurements.n0_power_tot_dB)) { uci_pdu->sr->sr_indication = 1; @@ -434,17 +438,19 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, else if (pucch_pdu->bit_len_harq==1) { uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); uci_pdu->harq->num_harq = 1; - 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_confidence_level = no_conf; + uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(sizeof *uci_pdu->harq->harq_list); uci_pdu->harq->harq_list[0].harq_value = !(index&0x01); - LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad) xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", - frame,slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos); + LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ %s with confidence level %s xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n", + frame,slot,uci_pdu->harq->harq_list[0].harq_value==0?"ACK":"NACK", + uci_pdu->harq->harq_confidence_level==0?"good":"bad", + xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); - uci_pdu->sr->sr_indication = (index>1) ? 1 : 0; - uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0; + uci_pdu->sr->sr_indication = (index>1); + uci_pdu->sr->sr_confidence_level = no_conf; uci_stats->pucch0_positive_SR++; } uci_stats->pucch01_trials++; @@ -452,17 +458,23 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, else { uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); uci_pdu->harq->num_harq = 2; - uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0; - uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2); + uci_pdu->harq->harq_confidence_level = no_conf; + uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2 * sizeof( *uci_pdu->harq->harq_list)); uci_pdu->harq->harq_list[1].harq_value = !(index&0x01); uci_pdu->harq->harq_list[0].harq_value = !((index>>1)&0x01); - LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d and %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", - frame,slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,gNB->ulsch_stats[0].sync_pos); + LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values (%s, %s) with confidence level %s, xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", + frame,slot, + uci_pdu->harq->harq_list[1].harq_value == 0 ? "ACK" : "NACK", + uci_pdu->harq->harq_list[0].harq_value == 0 ? "ACK" : "NACK", + uci_pdu->harq->harq_confidence_level == 0 ? "good" : "bad", + xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0, + uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi, + SNRtimes10,gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr->sr_indication = (index>3) ? 1 : 0; - uci_pdu->sr->sr_confidence_level = (no_conf) ? 1 : 0; + uci_pdu->sr->sr_confidence_level = no_conf; } } } diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 5e18f6cc6d..9f0e1bea71 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -817,6 +817,10 @@ void nr_pdcch_unscrambling(int16_t *z, if (((s >> (i % 32)) & 1) == 1) z2[i] = -z[i]; else z2[i]=z[i]; } + printf("Encoded Payload (length:%d dwords):\n", length>>5); + + for (int i=0; i>5; i++) + printf("[%d]->0x%08x \t", i, z2[i]); } @@ -868,6 +872,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, int L = rel15->L[j]; // Loop over possible DCI lengths + for (int k = 0; k < rel15->num_dci_options; k++) { // skip this candidate if we've already found one with the // same rnti and format at a different aggregation level @@ -902,8 +907,8 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L); n_rnti = rel15->rnti; - LOG_D(PHY, "(%i.%i) dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d)\n", - proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length); + LOG_D(PHY, "(%i.%i) dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx )\n", + proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length, *(unsigned long long*)dci_estimation); if (crc == n_rnti) { LOG_D(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx)\n", proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length,*(unsigned long long*)dci_estimation); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 54b7c34608..bf9cfaaa70 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -172,6 +172,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint memset(dlsch->harq_processes[i]->d[r],0,5*8448); else exit_flag=2; + } } else { exit_flag=1; @@ -299,17 +300,14 @@ void nr_processDLSegment(void* arg) { K_bits_F = Kr-harq_process->F; t_nrLDPC_time_stats procTime = {0}; - t_nrLDPC_time_stats* p_procTime = &procTime ; t_nrLDPC_procBuf **p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf; - int16_t w[5*8448]; - memset(w,0,(5*8448)*sizeof(short)); - start_meas(&rdata->ts_deinterleave); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN); + int16_t w[E]; nr_deinterleaving_ldpc(E, Qm, w, // [hna] w is e @@ -397,7 +395,7 @@ void nr_processDLSegment(void* arg) { (int8_t *)&pl[0], llrProcBuf, p_nrLDPC_procBuf[r], - p_procTime); + &procTime); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_OUT); // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int diff --git a/openair1/PHY/TOOLS/dB_routines.h b/openair1/PHY/TOOLS/dB_routines.h deleted file mode 100644 index 185913cf5b..0000000000 --- a/openair1/PHY/TOOLS/dB_routines.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 - */ - -/* - * dB_routines.h - * - * Created on: Nov 12, 2013 - * Author: winckel - */ - -#ifndef DB_ROUTINES_H_ -#define DB_ROUTINES_H_ - -int16_t dB_fixed_times10(uint32_t x); -int16_t dB_fixed_x10(uint32_t x); - -#endif /* DB_ROUTINES_H_ */ diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index 966e93440e..13ce9d85c7 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -39,26 +39,30 @@ extern "C" { #define CEILIDIV(a,b) ((a+b-1)/b) #define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1)) -struct complexd { +typedef struct complexd { double r; double i; -}; +} cd_t; -struct complexf { +typedef struct complexf { float r; float i; -}; +} cf_t; -struct complex16 { +typedef struct complex16 { int16_t r; int16_t i; -}; +} c16_t; -struct complex32 { +typedef struct complex32 { int32_t r; int32_t i; -}; - +} c32_t; + +typedef struct complex64 { + int64_t r; + int64_t i; +} c64_t; //cmult_sv.h /*!\fn void multadd_real_vector_complex_scalar(int16_t *x,int16_t *alpha,int16_t *y,uint32_t N) diff --git a/openair1/SCHED/sched_common_vars.h b/openair1/SCHED/sched_common_vars.h index 2cae2aa96f..8886e0d576 100644 --- a/openair1/SCHED/sched_common_vars.h +++ b/openair1/SCHED/sched_common_vars.h @@ -20,6 +20,7 @@ */ #include +#include // This is the formula from Section 5.1.1.1 in 36.213 100*10*log10((2^(MPR*Ks)-1)), where MPR is in the range [0,6] and Ks=1.25 diff --git a/openair1/SCHED_NR_UE/harq_nr.c b/openair1/SCHED_NR_UE/harq_nr.c index 4afe5f41d3..6508e2568e 100644 --- a/openair1/SCHED_NR_UE/harq_nr.c +++ b/openair1/SCHED_NR_UE/harq_nr.c @@ -339,55 +339,23 @@ void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ndi, int dl_harq->first_rx = 1; } else{ - switch(rv){ - case 0: - dl_harq->round = 0; + LOG_D(PHY,"receive harq process: %p harqPid=%d, rv=%d, ndi=%d, rntiType=%d, DCIndi=%d\n", + dl_harq, harq_pid, rv, ndi, rnti_type, dl_harq->DCINdi); + AssertFatal(rv<4 && rv>=0, "invalid redondancy version %d\n", rv); + if (rv!=0 && dl_harq->ack == DL_NACK) + LOG_D(PHY,"New transmission on a harq pid (%d) never acknowledged\n", harq_pid); + if (rv==0 && ndi == dl_harq->DCINdi ) + LOG_D(PHY,"Missed previous DCI detections. redondancy version is new transmission, but ndi doesn't toogle\n"); + dl_harq->first_rx = (rv==0); + const int rounds[4]={0,3,1,2}; + dl_harq->round = rounds[rv]; dl_harq->status = ACTIVE; - dl_harq->first_rx = 1; - if (dl_harq->DCINdi == ndi) - LOG_E(PHY,"Warning! rv %d indicates new transmission but new ndi %d is the same as old ndi %d\n",rv,ndi,dl_harq->DCINdi); + if (rv!=0 && dl_harq->DCINdi != ndi ) + LOG_E(PHY,"Missed previous DCI detections. redondancy version (%d) is retransmission, but ndi toogle\n", rv); + if (rv!=0 && dl_harq->ack != DL_NACK) + LOG_E(PHY,"Missed previous DCI detections. redondancy version (%d) is retransmission, but status is not DL_NACK\n", rv); dl_harq->DCINdi = ndi; - break; - case 1: - dl_harq->round = 3; - dl_harq->status = ACTIVE; - dl_harq->first_rx = 0; - if (dl_harq->DCINdi != ndi) { - LOG_E(PHY,"Missed previous DCI detections. NDI toggled but rv %d does not correspond to first reception\n",rv); - dl_harq->first_rx = 1; - dl_harq->DCINdi = ndi; - } - else if (dl_harq->ack == 1) - dl_harq->status = SCH_IDLE; - break; - case 2: - dl_harq->round = 1; - dl_harq->status = ACTIVE; - dl_harq->first_rx = 0; - if (dl_harq->DCINdi != ndi) { - LOG_E(PHY,"Missed previous DCI detections. NDI toggled but rv %d does not correspond to first reception\n",rv); - dl_harq->first_rx = 1; - dl_harq->DCINdi = ndi; - } - else if (dl_harq->ack == 1) - dl_harq->status = SCH_IDLE; - break; - case 3: - dl_harq->round = 2; - dl_harq->status = ACTIVE; - dl_harq->first_rx = 0; - if (dl_harq->DCINdi != ndi) { - LOG_E(PHY,"Missed previous DCI detections. NDI toggled but rv %d does not correspond to first reception\n",rv); - dl_harq->first_rx = 1; - dl_harq->DCINdi = ndi; - } - else if (dl_harq->ack == 1) - dl_harq->status = SCH_IDLE; - break; - default: - AssertFatal(1==0,"Invalid value for rv %d\n",rv); - } - } - + //dl_harq->status = SCH_IDLE; + } } diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 209275acb3..d22485d23f 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -58,11 +58,6 @@ extern int l2_init_eNB(void); extern void mac_top_init_eNB(void); extern void mac_init_cell_params(int Mod_idP,int CC_idP); - -int32_t **rxdata; -int32_t **txdata; - - typedef struct eutra_bandentry_s { int16_t band; uint32_t ul_min; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index c57736990c..0c339ee70a 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2092,6 +2092,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac, pucch->is_common = current_harq->is_common; current_harq->active = false; current_harq->ack_received = false; + LOG_D(PHY,"%d.%d Sent %d ack on harq pid %d\n", frame, slot, current_harq->ack, dl_harq_pid); } } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index cedc78097e..fad5643370 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -811,6 +811,7 @@ static void handle_dl_harq(module_id_t mod_id, stats->dlsch_errors++; LOG_D(NR_MAC, "retransmission error for UE %d (total %"PRIu64")\n", UE_id, stats->dlsch_errors); } else { + LOG_D(PHY,"NACK for: pid %d, ue %x\n",harq_pid, UE_id); add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].retrans_dl_harq, harq_pid); harq->round++; } @@ -1442,7 +1443,7 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, DevAssert(harq->is_waiting); const int8_t pid = sched_ctrl->feedback_dl_harq.head; remove_front_nr_list(&sched_ctrl->feedback_dl_harq); - LOG_D(NR_MAC,"bit %d pid %d ack/nack %d\n",harq_bit,pid,harq_value); + LOG_D(NR_MAC,"%d.%d bit %d pid %d ack/nack %d\n",frame, slot, harq_bit,pid,harq_value); handle_dl_harq(mod_id, UE_id, pid, harq_value == 0 && harq_confidence == 0); if (harq_confidence == 1) UE_info->mac_stats[UE_id].pucch0_DTX++; } diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index f7323010cb..99897f9060 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -78,13 +78,13 @@ void nrue_init_standalone_socket(int tx_port, int rx_port) int sd = socket(server_address.sin_family, SOCK_DGRAM, 0); if (sd < 0) { - LOG_E(MAC, "Socket creation error standalone PNF\n"); + LOG_E(NR_MAC, "Socket creation error standalone PNF\n"); return; } if (inet_pton(server_address.sin_family, stub_eth_params.remote_addr, &server_address.sin_addr) <= 0) { - LOG_E(MAC, "Invalid standalone PNF Address\n"); + LOG_E(NR_MAC, "Invalid standalone PNF Address\n"); close(sd); return; } @@ -92,7 +92,7 @@ void nrue_init_standalone_socket(int tx_port, int rx_port) // Using connect to use send() instead of sendto() if (connect(sd, (struct sockaddr *)&server_address, addr_len) < 0) { - LOG_E(MAC, "Connection to standalone PNF failed: %s\n", strerror(errno)); + LOG_E(NR_MAC, "Connection to standalone PNF failed: %s\n", strerror(errno)); close(sd); return; } @@ -118,7 +118,7 @@ void nrue_init_standalone_socket(int tx_port, int rx_port) if (bind(sd, (struct sockaddr *)&server_address, addr_len) < 0) { - LOG_E(MAC, "Connection to standalone PNF failed: %s\n", strerror(errno)); + LOG_E(NR_MAC, "Connection to standalone PNF failed: %s\n", strerror(errno)); close(sd); return; } @@ -603,10 +603,6 @@ static void copy_ul_tti_data_req_to_dl_info(nr_downlink_indication_t *dl_info, n pdu_0_1->harq->num_harq = 1; pdu_0_1->harq->harq_confidence_level = 0; pdu_0_1->harq->harq_list = CALLOC(pdu_0_1->harq->num_harq, sizeof(*pdu_0_1->harq->harq_list)); - for (int k = 0; k < pdu_0_1->harq->num_harq; k++) - { - pdu_0_1->harq->harq_list[k].harq_value = 0; - } } } LOG_I(NR_MAC, "We have dequeued the previously filled uci_ind and updated the snf/slot to %d/%d.\n", @@ -986,7 +982,7 @@ void *nrue_standalone_pnf_task(void *context) if (sem_post(&sfn_slot_semaphore) != 0) { - LOG_E(MAC, "sem_post() error\n"); + LOG_E(NR_MAC, "sem_post() error\n"); abort(); } } @@ -1062,7 +1058,7 @@ void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nac } else { //shouldn't get here - LOG_E(MAC, "Trying to process acknack for an inactive harq process (%d)\n", harq_pid); + LOG_E(NR_MAC, "Trying to process acknack for an inactive harq process (%d)\n", harq_pid); } } @@ -1121,9 +1117,9 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ } else { // UL indication after reception of DCI or DL PDU if (dl_info && dl_info->dci_ind && dl_info->dci_ind->number_of_dcis) { - LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][DCI_IND]\n"); + LOG_D(NR_MAC,"[L2][IF MODULE][DL INDICATION][DCI_IND]\n"); for (int i = 0; i < dl_info->dci_ind->number_of_dcis; i++) { - LOG_D(MAC,">>>NR_IF_Module i=%d, dl_info->dci_ind->number_of_dcis=%d\n",i,dl_info->dci_ind->number_of_dcis); + LOG_D(NR_MAC,">>>NR_IF_Module i=%d, dl_info->dci_ind->number_of_dcis=%d\n",i,dl_info->dci_ind->number_of_dcis); nr_scheduled_response_t scheduled_response; int8_t ret = handle_dci(dl_info->module_id, dl_info->cc_id, @@ -1137,7 +1133,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ /* The check below filters out UL_DCIs (format 7) which are being processed as DL_DCIs. */ if (dci_index->dci_format == 7 && mac->ra.ra_state == RA_SUCCEEDED) { LOG_D(NR_MAC, "We are filtering a UL_DCI to prevent it from being treated like a DL_DCI\n"); - break; + continue; } dci_pdu_rel15_t *def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[dci_index->dci_format]; g_harq_pid = def_dci_pdu_rel15->harq_pid; @@ -1160,7 +1156,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ for (int i=0; irx_ind->number_pdus; ++i) { - LOG_D(MAC, "In %s sending DL indication to MAC. 1 PDU type %d of %d total number of PDUs \n", + LOG_D(NR_MAC, "In %s sending DL indication to MAC. 1 PDU type %d of %d total number of PDUs \n", __FUNCTION__, dl_info->rx_ind->rx_indication_body[i].pdu_type, dl_info->rx_ind->number_pdus); diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 25da395b90..13a09db5a3 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -93,9 +93,6 @@ extern uint16_t sf_ahead; void ue_stub_rx_handler(unsigned int, char *); -int32_t **rxdata; -int32_t **txdata; - int timer_subframe = 0; int timer_frame = 0; SF_ticking *phy_stub_ticking = NULL; @@ -2498,23 +2495,18 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, AssertFatal( phy_vars_ue[CC_id] !=0, ""); frame_parms = &(phy_vars_ue[CC_id]->frame_parms); // replace RX signal buffers with mmaped HW versions - rxdata = (int32_t **)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t *) ); - txdata = (int32_t **)malloc16( frame_parms->nb_antennas_tx*sizeof(int32_t *) ); - for (i=0; inb_antennas_rx; i++) { LOG_I(PHY, "Mapping UE CC_id %d, rx_ant %d, freq %lu on card %d, chain %d\n", CC_id, i, downlink_frequency[CC_id][i], phy_vars_ue[CC_id]->rf_map.card, (phy_vars_ue[CC_id]->rf_map.chain)+i ); free( phy_vars_ue[CC_id]->common_vars.rxdata[i] ); - rxdata[i] = (int32_t *)malloc16_clear( 307200*sizeof(int32_t) ); - phy_vars_ue[CC_id]->common_vars.rxdata[i] = rxdata[i]; // what about the "-N_TA_offset" ? // N_TA offset for TDD + phy_vars_ue[CC_id]->common_vars.rxdata[i] = malloc16_clear( 307200*sizeof(int32_t) ); // what about the "-N_TA_offset" ? // N_TA offset for TDD } for (i=0; inb_antennas_tx; i++) { LOG_I(PHY, "Mapping UE CC_id %d, tx_ant %d, freq %lu on card %d, chain %d\n", CC_id, i, downlink_frequency[CC_id][i], phy_vars_ue[CC_id]->rf_map.card, (phy_vars_ue[CC_id]->rf_map.chain)+i ); free( phy_vars_ue[CC_id]->common_vars.txdata[i] ); - txdata[i] = (int32_t *)malloc16_clear( 307200*sizeof(int32_t) ); - phy_vars_ue[CC_id]->common_vars.txdata[i] = txdata[i]; + phy_vars_ue[CC_id]->common_vars.txdata[i] = malloc16_clear( 307200*sizeof(int32_t) ); } // rxdata[x] points now to the same memory region as phy_vars_ue[CC_id]->common_vars.rxdata[x] From 42c16795454fdaaed2617ac32e4eada3ec71318f Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 15 Mar 2022 14:23:25 +0100 Subject: [PATCH 02/39] remove one global --- openair1/PHY/INIT/nr_init_ue.c | 2 -- openair1/PHY/NR_TRANSPORT/nr_dci.c | 3 +- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 28 +++++++++++-------- .../NR_UE_TRANSPORT/nr_transport_proto_ue.h | 7 +++-- openair1/PHY/defs_nr_UE.h | 3 -- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 5 ++-- 6 files changed, 25 insertions(+), 23 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 75315187d9..5a3c2569da 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -404,7 +404,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ue->pdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); - ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear( 4*2*100*12 ); ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); @@ -574,7 +573,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) free_and_zero(ue->pdcch_vars[th_id][gNB_id]->llr); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->llr16); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->wbar); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->e_rx); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext); free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rho); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index ae96eb26bc..9876dfca86 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -132,7 +132,8 @@ void nr_generate_dci(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15, polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI, 1, NR_POLAR_DCI_MESSAGE_TYPE, dci_pdu->PayloadSizeBits, dci_pdu->AggregationLevel); -#if 1 +#ifdef DEBUG_CHANNEL_CODING +//debug dump dci printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,pdcch_pdu_rel15->dci_pdu->AggregationLevel); printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n", ((uint64_t*)dci_pdu->Payload)[0], ((uint64_t*)dci_pdu->Payload)[1]); diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 9f0e1bea71..66422a9dfa 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -83,7 +83,7 @@ char nr_dci_format_string[8][30] = { //static const int16_t conjugate[8]__attribute__((aligned(32))) = {-1,1,-1,1,-1,1,-1,1}; -void nr_pdcch_demapping_deinterleaving(uint32_t *llr, +static void nr_pdcch_demapping_deinterleaving(uint32_t *llr, uint32_t *z, uint8_t coreset_time_dur, uint8_t start_symbol, @@ -685,7 +685,8 @@ void nr_pdcch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms, int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, - fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) { + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, + int16_t e_rx[4*2*100*12] ) { uint32_t frame = proc->frame_rx; uint32_t slot = proc->nr_slot_rx; @@ -772,7 +773,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, LOG_D(PHY,"we enter nr_pdcch_demapping_deinterleaving(), number of candidates %d\n",rel15->number_of_candidates); nr_pdcch_demapping_deinterleaving((uint32_t *) pdcch_vars->llr, - (uint32_t *) pdcch_vars->e_rx, + (uint32_t *) e_rx, rel15->coreset.duration, rel15->coreset.StartSymbolIndex, n_rb, @@ -791,7 +792,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, -void nr_pdcch_unscrambling(int16_t *z, +void nr_pdcch_unscrambling(int16_t e_rx[4*2*100*12], uint16_t scrambling_RNTI, uint32_t length, uint16_t pdcch_DMRS_scrambling_id, @@ -814,13 +815,15 @@ void nr_pdcch_unscrambling(int16_t *z, reset = 0; } - if (((s >> (i % 32)) & 1) == 1) z2[i] = -z[i]; - else z2[i]=z[i]; + if (((s >> (i % 32)) & 1) == 1) + z2[i] = -e_rx[i]; + else + z2[i]=e_rx[i]; } - printf("Encoded Payload (length:%d dwords):\n", length>>5); + printf("Encoded Payload (length:%d dwords):\n", length); - for (int i=0; i>5; i++) - printf("[%d]->0x%08x \t", i, z2[i]); + for (int i=0; i0x%x \t", i, z2[i]); } @@ -855,7 +858,8 @@ static uint16_t nr_dci_false_detection(uint64_t *dci, return x; } -uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, +uint8_t nr_dci_decoding_procedure(int16_t e_rx[4*2*100*12], + PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, fapi_nr_dci_indication_t *dci_ind, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) { @@ -891,10 +895,10 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, LOG_D(PHY, "Trying DCI candidate %d of %d number of candidates, CCE %d (%d), L %d, length %d, format %s\n", j, rel15->number_of_candidates, CCEind, e_rx_cand_idx, L, dci_length,nr_dci_format_string[rel15->dci_format_options[k]]); - nr_pdcch_unscrambling(&pdcch_vars->e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e); + nr_pdcch_unscrambling(&e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e); #ifdef DEBUG_DCI_DECODING - uint32_t *z = (uint32_t *) &pdcch_vars->e_rx[e_rx_cand_idx]; + uint32_t *z = (uint32_t *) &e_rx[e_rx_cand_idx]; for (int index_z = 0; index_z < L*6; index_z++){ for (int i=0; i<9; i++) { LOG_D(PHY,"z[%d]=(%d,%d) \n", (9*index_z + i), *(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i])); 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 aac59a7da1..945eb5df0f 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -1105,8 +1105,8 @@ uint32_t dlsch_decoding_emul(PHY_VARS_NR_UE *phy_vars_ue, int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, - fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15); - + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, + int16_t e_rx[4*2*100*12]); /*! \brief Extract PSS and SSS resource elements @param phy_vars_ue Pointer to UE variables @@ -1667,7 +1667,8 @@ uint8_t get_prach_prb_offset(NR_DL_FRAME_PARMS *frame_parms, #include -uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, +uint8_t nr_dci_decoding_procedure(int16_t e_rx[4*2*100*12], + PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, fapi_nr_dci_indication_t *dci_ind, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15); diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 04080e7215..3762107d5d 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -611,9 +611,6 @@ typedef struct { /// \brief \f$\overline{w}\f$ from 36-211. /// - first index: ? [0..48*N_RB_DL[ int16_t *wbar; - /// \brief PDCCH/DCI e-sequence (input to rate matching). - /// - first index: ? [0..96*N_RB_DL[ - int16_t *e_rx; /// Total number of PDU errors (diagnostic mode) uint32_t dci_errors; /// Total number of PDU received diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index ddddcd09e2..52fa0d4b2f 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -500,7 +500,8 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, start_meas(&ue->dlsch_rx_pdcch_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_IN); - nr_rx_pdcch(ue, proc, rel15); + int16_t e_rx[4*2*100*12]={0}; + nr_rx_pdcch(ue, proc, rel15, e_rx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_OUT); @@ -511,7 +512,7 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, n_ss); #endif - dci_cnt = nr_dci_decoding_procedure(ue, proc, dci_ind, rel15); + dci_cnt = nr_dci_decoding_procedure(e_rx, ue, proc, dci_ind, rel15); #ifdef NR_PDCCH_SCHED_DEBUG LOG_I(PHY,"<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Ending function nr_dci_decoding_procedure() -> dci_cnt=%u\n",dci_cnt); From a7e7d05da340aa0aadb134a49773071e3e159c8e Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 16 Mar 2022 21:23:53 +0100 Subject: [PATCH 03/39] fix difficult to read code --- executables/nr-gnb.c | 1 + executables/nr-uesoftmodem.c | 10 +- .../PHY/LTE_ESTIMATION/lte_est_freq_offset.c | 18 +-- openair1/PHY/LTE_ESTIMATION/lte_sync_time.c | 22 +-- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 2 +- .../LTE_TRANSPORT/transport_common_proto.h | 2 +- openair1/PHY/LTE_UE_TRANSPORT/get_pmi.c | 2 +- .../PHY/LTE_UE_TRANSPORT/transport_proto_ue.h | 10 -- openair1/PHY/NR_REFSIG/pss_nr.h | 6 - openair1/PHY/NR_REFSIG/ptrs_nr.c | 6 +- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 46 +++--- openair1/PHY/NR_TRANSPORT/nr_dlsch.h | 4 +- openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c | 12 +- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 3 +- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 6 +- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 12 +- .../NR_UE_TRANSPORT/nr_transport_proto_ue.h | 10 -- openair1/PHY/NR_UE_TRANSPORT/pss_nr.c | 75 ++++------ openair1/PHY/TOOLS/angle.c | 2 +- openair1/PHY/TOOLS/cadd_sv.c | 2 +- openair1/PHY/TOOLS/cadd_vv.c | 2 +- openair1/PHY/TOOLS/calibration_test.c | 10 +- openair1/PHY/TOOLS/nr_phy_scope.c | 2 +- openair1/SIMULATION/NR_PHY/dlschsim.c | 2 +- openair1/SIMULATION/NR_PHY/pucchsim.c | 2 +- .../unit_tests/src/frame_config_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/harq_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/pbch_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/pss_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/pss_util_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/pss_util_test.h | 2 +- .../unit_tests/src/pucch_uci_generator_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/pucch_uci_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/srs_test.c | 2 +- .../NR_UE_PHY/unit_tests/src/sss_test.c | 2 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac.h | 15 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 128 +++++----------- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 3 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 6 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 79 ++++------ .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 137 ++++++------------ openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 2 +- openair2/RRC/NR/rrc_gNB_NGAP.c | 6 +- openair3/NAS/NR_UE/nr_nas_msg_sim.c | 2 +- targets/ARCH/rfsimulator/apply_channelmod.c | 6 +- targets/ARCH/rfsimulator/rfsimulator.h | 4 +- targets/ARCH/rfsimulator/simulator.c | 8 +- targets/RT/USER/lte-ue.c | 2 +- 49 files changed, 258 insertions(+), 431 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 4793ef4e95..b6c95de4ce 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -458,6 +458,7 @@ void init_gNB_Tpool(int inst) { for (int i=0; i < 2; i++) { notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0,gNB->L1_tx_out,tx_func); processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx); + memset(msgDataTx,0, sizeof(processingData_L1tx_t)); init_DLSCH_struct(gNB, msgDataTx); memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t)); pushNotifiedFIFO(gNB->L1_tx_free,msgL1Tx); // to unblock the process in the beginning diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 649b68631b..82ba86ea63 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -241,16 +241,16 @@ nrUE_params_t *get_nrUE_params(void) { } /* initialie thread pools used for NRUE processing paralleliation */ void init_tpools(uint8_t nun_dlsch_threads) { - char params[NR_RX_NB_TH*NR_NB_TH_SLOT*3+1]; + char params[NR_RX_NB_TH*NR_NB_TH_SLOT*3+1]={0}; for (int i=0; iN_RB_DL/2 - 1)*12,dl_ch_shift); //omega = dot_product(dl_ch,dl_ch_prev,frame_parms->ofdm_symbol_size,15); - omega_cpx.r = ((struct complex16*) &omega)->r; - omega_cpx.i = ((struct complex16*) &omega)->i; + omega_cpx.r = ((c16_t*) &omega)->r; + omega_cpx.i = ((c16_t*) &omega)->i; dl_ch = (int16_t *)&dl_ch_estimates[aa][(((frame_parms->N_RB_DL/2) + 1)*12) + ch_offset]; @@ -155,8 +155,8 @@ int lte_est_freq_offset(int **dl_ch_estimates, // calculate omega = angle(conj(dl_ch)*dl_ch_prev)) omega = dot_product(dl_ch,dl_ch_prev,((frame_parms->N_RB_DL/2) - 1)*12,dl_ch_shift); - omega_cpx.r += ((struct complex16*) &omega)->r; - omega_cpx.i += ((struct complex16*) &omega)->i; + omega_cpx.r += ((c16_t*) &omega)->r; + omega_cpx.i += ((c16_t*) &omega)->i; // phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r); phase_offset += atan2((double)omega_cpx.i,(double)omega_cpx.r); @@ -195,7 +195,7 @@ int lte_mbsfn_est_freq_offset(int **dl_ch_estimates, { int ch_offset, omega, dl_ch_shift; - struct complex16 *omega_cpx; + c16_t *omega_cpx; double phase_offset; int freq_offset_est; unsigned char aa; @@ -234,7 +234,7 @@ int lte_mbsfn_est_freq_offset(int **dl_ch_estimates, // printf("Computing freq_offset\n"); omega = dot_product(dl_ch,dl_ch_prev,(frame_parms->N_RB_DL/2 - 1)*12,dl_ch_shift); //omega = dot_product(dl_ch,dl_ch_prev,frame_parms->ofdm_symbol_size,15); - omega_cpx = (struct complex16*) ω + omega_cpx = (c16_t*) ω // printf("omega (%d,%d)\n",omega_cpx->r,omega_cpx->i); @@ -247,8 +247,8 @@ int lte_mbsfn_est_freq_offset(int **dl_ch_estimates, // calculate omega = angle(conj(dl_ch)*dl_ch_prev)) omega = dot_product(dl_ch,dl_ch_prev,((frame_parms->N_RB_DL/2) - 1)*12,dl_ch_shift); - omega_cpx->r += ((struct complex16*) &omega)->r; - omega_cpx->i += ((struct complex16*) &omega)->i; + omega_cpx->r += ((c16_t*) &omega)->r; + omega_cpx->i += ((c16_t*) &omega)->i; // phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r); phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r); // printf("omega (%d,%d) -> %f\n",omega_cpx->r,omega_cpx->i,phase_offset); diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c index 1fbc8b7ef2..b21f526fcc 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c @@ -34,9 +34,9 @@ // Note: this is for prototype of generate_drs_pusch (OTA synchronization of RRUs) #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" -static struct complex16 *primary_synch0_time __attribute__((aligned(32))); -static struct complex16 *primary_synch1_time __attribute__((aligned(32))); -static struct complex16 *primary_synch2_time __attribute__((aligned(32))); +static c16_t *primary_synch0_time __attribute__((aligned(32))); +static c16_t *primary_synch1_time __attribute__((aligned(32))); +static c16_t *primary_synch2_time __attribute__((aligned(32))); static void doIdft(int size, short *in, short *out) { switch (size) { @@ -67,7 +67,7 @@ static void doIdft(int size, short *in, short *out) { } } -static void copyPrimary( struct complex16 *out, struct complex16 *in, int ofdmSize) { +static void copyPrimary( c16_t *out, struct complex16 *in, int ofdmSize) { int k=ofdmSize-36; for (int i=0; i<72; i++) { @@ -83,20 +83,20 @@ static void copyPrimary( struct complex16 *out, struct complex16 *in, int ofdmSi } int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) { // LTE_UE_COMMON *common_vars - struct complex16 syncF_tmp[2048]__attribute__((aligned(32)))= {{0}}; + c16_t syncF_tmp[2048]__attribute__((aligned(32)))= {{0}}; int sz=frame_parms->ofdm_symbol_size*sizeof(*primary_synch0_time); - AssertFatal( NULL != (primary_synch0_time = (struct complex16 *)malloc16(sz)),""); + AssertFatal( NULL != (primary_synch0_time = (c16_t *)malloc16(sz)),""); bzero(primary_synch0_time,sz); - AssertFatal( NULL != (primary_synch1_time = (struct complex16 *)malloc16(sz)),""); + AssertFatal( NULL != (primary_synch1_time = (c16_t *)malloc16(sz)),""); bzero(primary_synch1_time,sz); - AssertFatal( NULL != (primary_synch2_time = (struct complex16 *)malloc16(sz)),""); + AssertFatal( NULL != (primary_synch2_time = (c16_t *)malloc16(sz)),""); bzero(primary_synch2_time,sz); // generate oversampled sync_time sequences - copyPrimary( syncF_tmp, (struct complex16 *) primary_synch0, frame_parms->ofdm_symbol_size); + copyPrimary( syncF_tmp, (c16_t *) primary_synch0, frame_parms->ofdm_symbol_size); doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch0_time); - copyPrimary( syncF_tmp, (struct complex16 *) primary_synch1, frame_parms->ofdm_symbol_size); + copyPrimary( syncF_tmp, (c16_t *) primary_synch1, frame_parms->ofdm_symbol_size); doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch1_time); - copyPrimary( syncF_tmp, (struct complex16 *) primary_synch2, frame_parms->ofdm_symbol_size); + copyPrimary( syncF_tmp, (c16_t *) primary_synch2, frame_parms->ofdm_symbol_size); doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch2_time); if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){ diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index c6b312cc61..de21b7f4e2 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -2237,7 +2237,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, int P1_SHIFT[13],P2_SHIFT[13]; int offset,nushiftmod3; - uint8_t get_pmi_temp; + int get_pmi_temp; MIMO_mode_t mimo_mode = -1; uint8_t mprime=0,Ns; diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h index af8e63c3ed..e6240a4e78 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h @@ -299,7 +299,7 @@ uint64_t pmi2hex_2Ar1(uint32_t pmi); uint64_t pmi2hex_2Ar2(uint32_t pmi); -uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb); +uint8_t get_pmi(int N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb); // DL power control functions double get_pa_dB(uint8_t pa); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/get_pmi.c b/openair1/PHY/LTE_UE_TRANSPORT/get_pmi.c index 7bbe8e8942..6ab2ad9fdd 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/get_pmi.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/get_pmi.c @@ -21,7 +21,7 @@ #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" -uint8_t get_pmi(uint8_t N_RB_DL, MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb) +uint8_t get_pmi(int N_RB_DL, MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb) { /* MIMO_mode_t mode = dlsch_harq->mimo_mode; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h index c5d096ceb7..bdfe0b8d07 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h +++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h @@ -1550,16 +1550,6 @@ uint64_t cqi2hex(uint32_t cqi); uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs); - -/** \brief This routine extracts a single subband PMI from a bitmap coming from UCI or the pmi_extend function - @param N_RB_DL number of resource blocks - @param mimo_mode - @param pmi_alloc subband PMI bitmap - @param rb resource block for which to extract PMI - @returns subband PMI -*/ -uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb); - int get_nCCE_offset_l1(int *CCE_table, const unsigned char L, const int nCCE, diff --git a/openair1/PHY/NR_REFSIG/pss_nr.h b/openair1/PHY/NR_REFSIG/pss_nr.h index b32d48a2e9..c65ca3799d 100644 --- a/openair1/PHY/NR_REFSIG/pss_nr.h +++ b/openair1/PHY/NR_REFSIG/pss_nr.h @@ -113,12 +113,6 @@ EXTERN int16_t *primary_synchro_time_nr[NUMBER_PSS_SEQUENCE] #endif ; -EXTERN int64_t *pss_corr_ue[NUMBER_PSS_SEQUENCE] -#ifdef INIT_VARIABLES_PSS_NR_H -= { NULL, NULL, NULL} -#endif -; - /* profiling structure */ EXTERN time_stats_t generic_time[TIME_LAST]; diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index 40a6a56611..68134eb02d 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -268,8 +268,8 @@ void nr_ptrs_cpe_estimation(uint8_t K_ptrs, return; } uint16_t sc_per_symbol = (nb_rb + K_ptrs - 1)/K_ptrs; - struct complex16 ptrs_p[(1 + sc_per_symbol/4)*4]; - struct complex16 dmrs_comp_p[(1 + sc_per_symbol/4)*4]; + c16_t ptrs_p[(1 + sc_per_symbol/4)*4]; + c16_t dmrs_comp_p[(1 + sc_per_symbol/4)*4]; double abs = 0.0; double real = 0.0; double imag = 0.0; @@ -422,7 +422,7 @@ void get_slope_from_estimates(uint8_t start, uint8_t end, int16_t *est_p, double /* estimate from slope */ void ptrs_estimate_from_slope(int16_t *error_est, double *slope_p, uint8_t start, uint8_t end) { - struct complex16 *error=(struct complex16 *) error_est; + c16_t *error=(struct complex16 *) error_est; for(uint8_t i = 1; i< (end -start);i++) { error[start+i].r = error[start].r + (int16_t)(i * slope_p[0]);// real error[start+i].i = error[start].i + (int16_t)(i * slope_p[1]); //imag diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 876d6cc83a..e4fe9b8371 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -98,7 +98,6 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, uint16_t nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs*dmrs_len-xOverhead)*rel15->rbSize*rel15->nrOfLayers; uint8_t Qm = rel15->qamModOrder[0]; uint32_t encoded_length = nb_re*Qm; - uint32_t scrambled_output[rel15->NrOfCodewords][(encoded_length>>5)+1]; int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(16))); /* PTRS */ @@ -125,7 +124,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, start_meas(dlsch_encoding_stats); if (nr_dlsch_encoding(gNB, - harq->pdu, frame, slot, dlsch, frame_parms,output,tinput,tprep,tparity,toutput, + frame, slot, harq, frame_parms,output,tinput,tprep,tparity,toutput, dlsch_rate_matching_stats, dlsch_interleaving_stats, dlsch_segmentation_stats) == -1) @@ -148,46 +147,41 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, #endif /// scrambling - start_meas(dlsch_scrambling_stats); for (int q=0; qNrOfCodewords; q++) { - memset((void*)scrambled_output[q], 0, ((encoded_length>>5)+1)*sizeof(uint32_t)); + uint32_t scrambled_output[encoded_length]; + start_meas(dlsch_scrambling_stats); nr_pdsch_codeword_scrambling(output, encoded_length, q, rel15->dataScramblingId, rel15->rnti, - scrambled_output[q]); - } - - stop_meas(dlsch_scrambling_stats); + scrambled_output); + stop_meas(dlsch_scrambling_stats); + #ifdef DEBUG_DLSCH - printf("PDSCH scrambling:\n"); - for (int i=0; i>8; i++) { - for (int j=0; j<8; j++) - printf("0x%08x\t", scrambled_output[0][(i<<3)+j]); - printf("\n"); - } + printf("PDSCH scrambling:\n"); + for (int i=0; i>8; i++) { + for (int j=0; j<8; j++) + printf("0x%08x\t", scrambled_output[(i<<3)+j]); + printf("\n"); + } #endif - - /// Modulation start_meas(dlsch_modulation_stats); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PDSCH_MODULATION, 1); - for (int q=0; qNrOfCodewords; q++) - nr_modulation(scrambled_output[q], + nr_modulation(scrambled_output, encoded_length, Qm, mod_symbs[q]); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PDSCH_MODULATION, 0); stop_meas(dlsch_modulation_stats); #ifdef DEBUG_DLSCH - printf("PDSCH Modulation: Qm %d(%d)\n", Qm, nb_re); - for (int i=0; i>3; i++) { - for (int j=0; j<8; j++) { - printf("%d %d\t", mod_symbs[0][((i<<3)+j)<<1], mod_symbs[0][(((i<<3)+j)<<1)+1]); + printf("PDSCH Modulation: Qm %d(%d)\n", Qm, nb_re); + for (int i=0; i>3; i++) { + for (int j=0; j<8; j++) { + printf("%d %d\t", mod_symbs[0][((i<<3)+j)<<1], mod_symbs[0][(((i<<3)+j)<<1)+1]); + } + printf("\n"); } - printf("\n"); - } #endif + } start_meas(&gNB->dlsch_layer_mapping_stats); /// Layer mapping diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h index 28676b49f2..daa4ed1723 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h @@ -78,9 +78,9 @@ int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type); NR_gNB_SCH_STATS_t *find_nr_dlsch_stats(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type); int nr_dlsch_encoding(PHY_VARS_gNB *gNB, - unsigned char *a,int frame, + int frame, uint8_t slot, - NR_gNB_DLSCH_t *dlsch, + NR_DL_gNB_HARQ_t *harq, NR_DL_FRAME_PARMS* frame_parms, unsigned char * output, time_stats_t *tinput, diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index 229f59032e..bf33457aaa 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -286,10 +286,9 @@ void ldpc8blocks( void *p) { } int nr_dlsch_encoding(PHY_VARS_gNB *gNB, - unsigned char *a, int frame, uint8_t slot, - NR_gNB_DLSCH_t *dlsch, + NR_DL_gNB_HARQ_t *harq, NR_DL_FRAME_PARMS *frame_parms, unsigned char * output, time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput, @@ -298,13 +297,12 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, encoder_implemparams_t impp; impp.output=output; unsigned int crc=1; - NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15; - impp.Zc = &dlsch->harq_process.Z; + impp.Zc = &harq->Z; float Coderate = 0.0; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN); uint32_t A = rel15->TBSize[0]<<3; - + unsigned char *a=harq->pdu; if ( rel15->rnti != SI_RNTI) trace_NRpdu(DIRECTION_DOWNLINK, a, rel15->TBSize[0], 0, WS_C_RNTI, rel15->rnti, frame, slot,0, 0); @@ -317,14 +315,14 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, stats=&gNB->dlsch_stats[i]; } - if (gNB->dlsch_stats[i].rnti == dlsch->rnti) { + if (gNB->dlsch_stats[i].rnti == rel15->rnti) { stats=&gNB->dlsch_stats[i]; break; } } if (stats) { - stats->rnti = dlsch->rnti; + stats->rnti = rel15->rnti; stats->total_bytes_tx += rel15->TBSize[0]; stats->current_RI = rel15->nrOfLayers; stats->current_Qm = rel15->qamModOrder[0]; diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 17f145b98a..eda53e1c84 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -405,13 +405,12 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, if (nr_sequences>1) { if (xrtmag_dBtimes10 < (50+xrtmag_next_dBtimes10) || SNRtimes10 < gNB->pucch0_thres) { no_conf=true; - LOG_W(PHY,"%d.%d PUCCH bad confidence: %d threshold, %d, %d, %d\n", + LOG_D(PHY,"%d.%d PUCCH bad confidence: %d threshold, %d, %d, %d\n", frame, slot, uci_stats->pucch0_thres, SNRtimes10, xrtmag_dBtimes10, xrtmag_next_dBtimes10); - abort(); } } gNB->bad_pucch += no_conf; diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 66422a9dfa..5b0544bf21 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -820,10 +820,6 @@ void nr_pdcch_unscrambling(int16_t e_rx[4*2*100*12], else z2[i]=e_rx[i]; } - printf("Encoded Payload (length:%d dwords):\n", length); - - for (int i=0; i0x%x \t", i, z2[i]); } @@ -898,7 +894,7 @@ uint8_t nr_dci_decoding_procedure(int16_t e_rx[4*2*100*12], nr_pdcch_unscrambling(&e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e); #ifdef DEBUG_DCI_DECODING - uint32_t *z = (uint32_t *) &e_rx[e_rx_cand_idx]; + uint32_t *z = (uint32_t *) &pdcch_vars->e_rx[e_rx_cand_idx]; for (int index_z = 0; index_z < L*6; index_z++){ for (int i=0; i<9; i++) { LOG_D(PHY,"z[%d]=(%d,%d) \n", (9*index_z + i), *(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i])); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index bf9cfaaa70..6163a95e5c 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -168,8 +168,6 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint dlsch->harq_processes[i]->d[r] = (int16_t *)malloc16(5*8448*sizeof(int16_t)); if (dlsch->harq_processes[i]->c[r]) memset(dlsch->harq_processes[i]->c[r],0,1056); - if (dlsch->harq_processes[i]->d[r]) - memset(dlsch->harq_processes[i]->d[r],0,5*8448); else exit_flag=2; @@ -326,12 +324,12 @@ void nr_processDLSegment(void* arg) { harq_process->rvidx, harq_process->round); */ //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_IN); - + int16_t d[5*8448]; if (nr_rate_matching_ldpc_rx(Ilbrm, Tbslbrm, p_decoderParms->BG, p_decoderParms->Z, - harq_process->d[r], + d, w, harq_process->C, harq_process->rvidx, @@ -353,7 +351,7 @@ void nr_processDLSegment(void* arg) { LOG_D(PHY,"decoder input(segment %u) :",r); for (int i=0; id[r][i]); + LOG_D(PHY,"%d : %d\n",i,d[i]); LOG_D(PHY,"\n"); } @@ -379,9 +377,9 @@ void nr_processDLSegment(void* arg) { //set Filler bits memset((&z[0]+K_bits_F),127,harq_process->F*sizeof(int16_t)); //Move coded bits before filler bits - memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bits_F-2*harq_process->Z)*sizeof(int16_t)); + memcpy((&z[0]+2*harq_process->Z),d,(K_bits_F-2*harq_process->Z)*sizeof(int16_t)); //skip filler bits - memcpy((&z[0]+Kr),harq_process->d[r]+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t)); + memcpy((&z[0]+Kr),d+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t)); //Saturate coded bits before decoding into 8 bits values for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++) { 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 945eb5df0f..ead5ec2da5 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -1480,16 +1480,6 @@ uint64_t cqi2hex(uint32_t cqi); uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs); - -/** \brief This routine extracts a single subband PMI from a bitmap coming from UCI or the pmi_extend function - @param N_RB_DL number of resource blocks - @param mimo_mode - @param pmi_alloc subband PMI bitmap - @param rb resource block for which to extract PMI - @returns subband PMI -*/ -uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb); - int get_nCCE_offset_l1(int *CCE_table, const unsigned char L, const int nCCE, diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c index 54712cb64e..13ed436273 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c @@ -381,7 +381,6 @@ void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue) int sizePss = LENGTH_PSS_NR * IQ_SIZE; /* complex value i & q signed 16 bits */ int size = ofdm_symbol_size * IQ_SIZE; /* i and q samples signed 16 bits */ int16_t *p = NULL; - int64_t *q = NULL; AssertFatal(ofdm_symbol_size > 127, "illegal ofdm_symbol_size %d\n",ofdm_symbol_size); for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) { @@ -410,17 +409,6 @@ void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue) assert(0); } - size = sizeof(int64_t)*(frame_parms_ue->samples_per_frame + (2*ofdm_symbol_size)); - q = (int64_t*)malloc16(size); - if (q != NULL) { - pss_corr_ue[i] = q; - bzero( pss_corr_ue[i], size); - } - else { - LOG_E(PHY,"Fatal memory allocation problem \n"); - assert(0); - } - generate_pss_nr(frame_parms_ue,i); } } @@ -443,7 +431,6 @@ void free_context_pss_nr(void) free_and_zero(primary_synchro_nr[i]); free_and_zero(primary_synchro_nr2[i]); free_and_zero(primary_synchro_time_nr[i]); - free_and_zero(pss_corr_ue[i]); } } @@ -801,7 +788,6 @@ static inline double angle64(int64_t x) *********************************************************************/ #define DOT_PRODUCT_SCALING_SHIFT (17) - int pss_search_time_nr(int **rxdata, ///rx data in time domain NR_DL_FRAME_PARMS *frame_parms, int fo_flag, @@ -812,7 +798,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain unsigned int n, ar, peak_position, pss_source; int64_t peak_value; int64_t result; - int64_t avg[NUMBER_PSS_SEQUENCE]; + int64_t avg[NUMBER_PSS_SEQUENCE]={0}; double ffo_est=0; // performing the correlation on a frame length plus one symbol for the first of the two frame @@ -823,9 +809,8 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain else length = frame_parms->samples_per_frame; - AssertFatal(length>0,"illegal length %d\n",length); - for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) AssertFatal(pss_corr_ue[i] != NULL,"pss_corr_ue[%d] not yet allocated! Exiting.\n", i); + AssertFatal(length>0,"illegal length %d\n",length); peak_value = 0; peak_position = 0; pss_source = 0; @@ -846,47 +831,41 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain /* Correlation computation is based on a a dot product which is realized thank to SIMS extensions */ for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) { - avg[pss_index]=0; - memset(pss_corr_ue[pss_index],0,length*sizeof(int64_t)); - } - for (n=0; n < length; n+=4) { // + for (n=0; n < length; n+=4) { // - for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) { + int64_t pss_corr_ue=0; + /* calculate dot product of primary_synchro_time_nr and rxdata[ar][n] + * (ar=0..nb_ant_rx) and store the sum in temp[n]; */ + for (ar=0; arnb_antennas_rx; ar++) { - if ( n < (length - frame_parms->ofdm_symbol_size)) { + /* perform correlation of rx data and pss sequence ie it is a dot product */ + result = dot_product64((short*)primary_synchro_time_nr[pss_index], + (short*)&(rxdata[ar][n+is*frame_parms->samples_per_frame]), + frame_parms->ofdm_symbol_size, + shift); + pss_corr_ue += abs64(result); + //((short*)pss_corr_ue[pss_index])[2*n] += ((short*) &result)[0]; /* real part */ + //((short*)pss_corr_ue[pss_index])[2*n+1] += ((short*) &result)[1]; /* imaginary part */ + //((short*)&synchro_out)[0] += ((int*) &result)[0]; /* real part */ + //((short*)&synchro_out)[1] += ((int*) &result)[1]; /* imaginary part */ - /* calculate dot product of primary_synchro_time_nr and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; */ - for (ar=0; arnb_antennas_rx; ar++) { - - /* perform correlation of rx data and pss sequence ie it is a dot product */ - result = dot_product64((short*)primary_synchro_time_nr[pss_index], - (short*)&(rxdata[ar][n+is*frame_parms->samples_per_frame]), - frame_parms->ofdm_symbol_size, - shift); - pss_corr_ue[pss_index][n] += abs64(result); - //((short*)pss_corr_ue[pss_index])[2*n] += ((short*) &result)[0]; /* real part */ - //((short*)pss_corr_ue[pss_index])[2*n+1] += ((short*) &result)[1]; /* imaginary part */ - //((short*)&synchro_out)[0] += ((int*) &result)[0]; /* real part */ - //((short*)&synchro_out)[1] += ((int*) &result)[1]; /* imaginary part */ - - } } - + /* calculate the absolute value of sync_corr[n] */ - avg[pss_index]+=pss_corr_ue[pss_index][n]; - if (pss_corr_ue[pss_index][n] > peak_value) { - peak_value = pss_corr_ue[pss_index][n]; + avg[pss_index]+=pss_corr_ue; + if (pss_corr_ue > peak_value) { + peak_value = pss_corr_ue; peak_position = n; pss_source = pss_index; - + #ifdef DEBUG_PSS_NR - printf("pss_index %d: n %6u peak_value %15llu\n", pss_index, n, (unsigned long long)pss_corr_ue[pss_index][n]); + printf("pss_index %d: n %6u peak_value %15llu\n", pss_index, n, (unsigned long long)pss_corr_ue[n]); #endif } } } - + if (fo_flag){ // fractional frequency offset computation according to Cross-correlation Synchronization Algorithm Using PSS @@ -922,7 +901,8 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain // computing absolute value of frequency offset *f_off = ffo_est*frame_parms->subcarrier_spacing; - for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) avg[pss_index]/=(length/4); + for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) + avg[pss_index]/=(length/4); *eNB_id = pss_source; @@ -937,9 +917,6 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain static int debug_cnt = 0; if (debug_cnt == 0) { - LOG_M("pss_corr_ue0.m","pss_corr_ue0",pss_corr_ue[0],length,1,6); - LOG_M("pss_corr_ue1.m","pss_corr_ue1",pss_corr_ue[1],length,1,6); - LOG_M("pss_corr_ue2.m","pss_corr_ue2",pss_corr_ue[2],length,1,6); if (is) LOG_M("rxdata1.m","rxd0",rxdata[frame_parms->samples_per_frame],length,1,1); else diff --git a/openair1/PHY/TOOLS/angle.c b/openair1/PHY/TOOLS/angle.c index a06640d1cf..89ffc3cb60 100644 --- a/openair1/PHY/TOOLS/angle.c +++ b/openair1/PHY/TOOLS/angle.c @@ -29,7 +29,7 @@ #include "costable.h" #include "defs.h" -unsigned int angle(struct complex16 perror) +unsigned int angle(c16_t perror) { int a; diff --git a/openair1/PHY/TOOLS/cadd_sv.c b/openair1/PHY/TOOLS/cadd_sv.c index caa8d1cc04..56dcb71847 100644 --- a/openair1/PHY/TOOLS/cadd_sv.c +++ b/openair1/PHY/TOOLS/cadd_sv.c @@ -129,7 +129,7 @@ main () short output[256] __attribute__((aligned(16))); int i; - struct complex16 alpha; + c16_t alpha; Zero_Buffer(output,256*2); diff --git a/openair1/PHY/TOOLS/cadd_vv.c b/openair1/PHY/TOOLS/cadd_vv.c index 77346a97f7..08bf514cb3 100644 --- a/openair1/PHY/TOOLS/cadd_vv.c +++ b/openair1/PHY/TOOLS/cadd_vv.c @@ -278,7 +278,7 @@ main () short output[256] __attribute__((aligned(16))); int i; - struct complex16 alpha; + c16_t alpha; Zero_Buffer(output,256*2); diff --git a/openair1/PHY/TOOLS/calibration_test.c b/openair1/PHY/TOOLS/calibration_test.c index 5dced27060..650d5e420c 100644 --- a/openair1/PHY/TOOLS/calibration_test.c +++ b/openair1/PHY/TOOLS/calibration_test.c @@ -305,15 +305,15 @@ int main(int argc, char **argv) { openair0_device_load(&rfdevice,&openair0_cfg); - void ** samplesRx = (void **)malloc16(antennas* sizeof(struct complex16 *) ); - void ** samplesTx = (void **)malloc16(antennas* sizeof(struct complex16 *) ); + void ** samplesRx = (void **)malloc16(antennas* sizeof(c16_t *) ); + void ** samplesTx = (void **)malloc16(antennas* sizeof(c16_t *) ); int fd=open(getenv("rftestInputFile"),O_RDONLY); AssertFatal(fd>=0,"%s",strerror(errno)); for (int i=0; irbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS] __attribute__((aligned(32))); bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS); if (input_fd == NULL) { - nr_dlsch_encoding(gNB, test_input, frame, slot, dlsch, frame_parms,output,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + nr_dlsch_encoding(gNB, frame, slot, &dlsch->harq_process, frame_parms,output,NULL,NULL,NULL,NULL,NULL,NULL,NULL); } for (SNR = snr0; SNR < snr1; SNR += snr_step) { diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index 151d51d726..b6dc3d8f11 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -551,7 +551,7 @@ int main(int argc, char **argv) if (n_trials==1) printf("txlev %d (%f dB), offset %d, sigma2 %f ( %f dB)\n",txlev,10*log10(txlev),startingSymbolIndex*frame_parms->ofdm_symbol_size,sigma2,sigma2_dB); - struct complex16 **rxdataF = (struct complex16 **)gNB->common_vars.rxdataF; + c16_t **rxdataF = (struct complex16 **)gNB->common_vars.rxdataF; for (int symb=0; symbframe_parms.symbols_per_slot;symb++) { if (symb= startingSymbolIndex+nrofSymbols) { int i0 = symb*gNB->frame_parms.ofdm_symbol_size; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c index c88c261667..093bb2d000 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c @@ -285,7 +285,7 @@ int main(int argc, char *argv[]) uint8_t nb_antennas_tx = 1; uint8_t nb_antennas_rx = 1; uint8_t frame_type = FDD; - uint8_t N_RB_DL=100; + int N_RB_DL=100; lte_prefix_type_t extended_prefix_flag = NORMAL; int Nid_cell[] = {(3*0+0)}; VOID_PARAMETER argc; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c index 05170e0bc9..96d7382f2b 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c @@ -200,7 +200,7 @@ int main(int argc, char *argv[]) uint8_t nb_antennas_tx = 1; uint8_t nb_antennas_rx = 1; uint8_t frame_type = FDD; - uint8_t N_RB_DL=100; + int N_RB_DL=100; lte_prefix_type_t extended_prefix_flag = NORMAL; int Nid_cell[] = {(3*0+0)}; VOID_PARAMETER argc; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c index 7600dfb08f..5c7f3157e7 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c @@ -379,7 +379,7 @@ int main(int argc, char *argv[]) uint8_t nb_antennas_tx = 1; uint8_t nb_antennas_rx = 1; uint8_t frame_type = FDD; - uint8_t N_RB_DL=100; + int N_RB_DL=100; lte_prefix_type_t extended_prefix_flag = NORMAL; int decoded_pbch = -1; int Nid1, Nid2; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c index 2088d558cb..de1249457f 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c @@ -184,7 +184,7 @@ int main(int argc, char *argv[]) uint8_t nb_antennas_rx = 1; uint16_t Nid_cell=123; uint8_t frame_type=FDD; - uint8_t N_RB_DL=100; + int N_RB_DL=100; lte_prefix_type_t extended_prefix_flag=NORMAL; const char *name_test = "PSS NR"; test_t test = { name_test, 0, 0, 0, 0}; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c index 4334bd12f9..2302c50ab1 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c @@ -206,7 +206,7 @@ void undefined_function(const char *function) { *********************************************************************/ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission_mode, - unsigned char extended_prefix_flag, uint8_t frame_type, uint16_t Nid_cell, uint8_t N_RB_DL) { + unsigned char extended_prefix_flag, uint8_t frame_type, uint16_t Nid_cell, int N_RB_DL) { (void) transmission_mode; NR_DL_FRAME_PARMS *frame_parms; int log_level = OAILOG_TRACE; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h index f0929e88c0..78efc2234b 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h @@ -90,7 +90,7 @@ int set_pss_in_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int p int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission_mode, unsigned char extended_prefix_flag, uint8_t frame_type, uint16_t Nid_cell, - uint8_t N_RB_DL); + int N_RB_DL); void display_test_configuration_pss(int position, int pss_sequence_number); diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_generator_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_generator_test.c index 68acea6d98..4948d0a876 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_generator_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_generator_test.c @@ -142,7 +142,7 @@ int main(int argc, char *argv[]) { uint8_t nb_antennas_tx = 1; uint8_t nb_antennas_rx = 1; uint8_t frame_type = FDD; - uint8_t N_RB_DL=106; + int N_RB_DL=106; lte_prefix_type_t extended_prefix_flag = NORMAL; int Nid_cell[] = {(3*1+3)}; VOID_PARAMETER argc; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c index f731edc20a..31fe15a6de 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c @@ -1239,7 +1239,7 @@ int main(int argc, char *argv[]) uint8_t nb_antennas_tx = 1; uint8_t nb_antennas_rx = 1; uint8_t frame_type = FDD; - uint8_t N_RB_DL=100; + int N_RB_DL=100; lte_prefix_type_t extended_prefix_flag = NORMAL; int Nid_cell[] = {(3*1+3)}; VOID_PARAMETER argc; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c index 34ea68bc61..235387acf7 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c @@ -442,7 +442,7 @@ int main(int argc, char *argv[]) uint8_t nb_antennas_tx = 1; uint8_t nb_antennas_rx = 1; uint8_t frame_type = FDD; - uint8_t N_RB_DL=100; + int N_RB_DL=100; lte_prefix_type_t extended_prefix_flag = NORMAL; int Nid_cell[] = {(3*0+0)}; VOID_PARAMETER argc; diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c index 34127b604f..6f6594861a 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) uint8_t nb_antennas_tx = 1; uint8_t nb_antennas_rx = 1; uint8_t frame_type = FDD; - uint8_t N_RB_DL=100; + int N_RB_DL=100; lte_prefix_type_t extended_prefix_flag = NORMAL; int phase; int Nid1, Nid2; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h index ba3128923f..f084cb2d63 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h @@ -109,8 +109,7 @@ typedef struct { uint8_t LCID: 6; // octet 1 [5:0] uint8_t F: 1; // octet 1 [6] uint8_t R: 1; // octet 1 [7] - uint8_t L1: 8; // octet 2 [7:0] - uint8_t L2: 8; // octet 3 [7:0] + uint16_t L: 16; // octet 2 [7:0] } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_LONG; typedef struct { @@ -118,6 +117,18 @@ typedef struct { uint8_t R: 2; // octet 1 [7:6] } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED; +static inline void getMacLen(uint8_t* pdu, uint16_t *mac_ce_len, uint16_t *mac_subheader_len) { + NR_MAC_SUBHEADER_SHORT *s=(NR_MAC_SUBHEADER_SHORT*) pdu; + NR_MAC_SUBHEADER_LONG *l=(NR_MAC_SUBHEADER_LONG*) pdu; + if (s->F) { + *mac_subheader_len=sizeof(*l); + *mac_ce_len=ntohs(l->L); + } else { + *mac_subheader_len=sizeof(*s); + *mac_ce_len=s->L; + } +} + // BSR MAC CEs // TS 38.321 ch. 6.1.3.1 // Short BSR for a specific logical channel group ID diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 0c339ee70a..05313f388a 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3326,10 +3326,6 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, int pdu_id){ - uint8_t rx_lcid; - uint16_t mac_ce_len; - uint16_t mac_subheader_len; - uint16_t mac_sdu_len; module_id_t module_idP = dl_info->module_id; frame_t frameP = dl_info->frame; int slot = dl_info->slot; @@ -3348,10 +3344,9 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, LOG_D(MAC, "In %s [%d.%d]: processing PDU %d (with length %d) of %d total number of PDUs...\n", __FUNCTION__, frameP, slot, pdu_id, pdu_len, dl_info->rx_ind->number_pdus); while (!done && pdu_len > 0){ - mac_ce_len = 0x0000; - mac_subheader_len = 0x0001; // default to fixed-length subheader = 1-oct - mac_sdu_len = 0x0000; - rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; + uint16_t mac_len = 0x0000; + uint16_t mac_subheader_len = 0x0001; // default to fixed-length subheader = 1-oct + uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len); switch(rx_lcid){ @@ -3359,128 +3354,89 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, case DL_SCH_LCID_CCCH: // MSG4 RRC Setup 38.331 // variable length - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pduP)->L1 & 0x7f) << 8) - | ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff); - mac_subheader_len = 3; - } else { - mac_sdu_len = ((NR_MAC_SUBHEADER_SHORT *) pduP)->L; - mac_subheader_len = 2; - } - - AssertFatal(pdu_len > mac_sdu_len, "The mac_sdu_len (%d) has an invalid size. PDU len = %d! \n", - mac_sdu_len, pdu_len); + getMacLen(pduP, &mac_len, &mac_subheader_len); + AssertFatal(pdu_len > mac_len, "The mac_len (%d) has an invalid size. PDU len = %d! \n", + mac_len, pdu_len); // Check if it is a valid CCCH message, we get all 00's messages very often int i = 0; - for(i=0; i<(mac_subheader_len+mac_sdu_len); i++) { + for(i=0; i<(mac_subheader_len+mac_len); i++) { if(pduP[i] != 0) { break; } } - if (i == (mac_subheader_len+mac_sdu_len)) { + if (i == (mac_subheader_len+mac_len)) { LOG_D(NR_MAC, "%s() Invalid CCCH message!, pdu_len: %d\n", __func__, pdu_len); done = 1; break; } - if ( mac_sdu_len > 0 ) { - LOG_D(NR_MAC,"DL_SCH_LCID_CCCH (e.g. RRCSetup) with payload len %d\n", mac_sdu_len); + if ( mac_len > 0 ) { + LOG_D(NR_MAC,"DL_SCH_LCID_CCCH (e.g. RRCSetup) with payload len %d\n", mac_len); for (int i = 0; i < mac_subheader_len; i++) { LOG_D(NR_MAC, "MAC header %d: 0x%x\n", i, pduP[i]); } - for (int i = 0; i < mac_sdu_len; i++) { + for (int i = 0; i < mac_len; i++) { LOG_D(NR_MAC, "%d: 0x%x\n", i, pduP[mac_subheader_len + i]); } - nr_mac_rrc_data_ind_ue(module_idP, CC_id, gNB_index, frameP, 0, mac->crnti, CCCH, pduP+mac_subheader_len, mac_sdu_len); + nr_mac_rrc_data_ind_ue(module_idP, CC_id, gNB_index, frameP, 0, mac->crnti, CCCH, pduP+mac_subheader_len, mac_len); } break; case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH: + case DL_SCH_LCID_APERIODIC_CSI_TRI_STATE_SUBSEL: + case DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT: + case DL_SCH_LCID_SP_SRS_ACTIVATION: // 38.321 Ch6.1.3.14 // varialbe length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } - break; - case DL_SCH_LCID_APERIODIC_CSI_TRI_STATE_SUBSEL: - // 38.321 Ch6.1.3.13 - // varialbe length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } - break; - case DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT: - // 38.321 Ch6.1.3.12 - // varialbe length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } - break; - case DL_SCH_LCID_SP_SRS_ACTIVATION: - // 38.321 Ch6.1.3.17 - // varialbe length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } + getMacLen(pduP, &mac_len, &mac_subheader_len); break; + case DL_SCH_LCID_RECOMMENDED_BITRATE: // 38.321 Ch6.1.3.20 - mac_ce_len = 2; + mac_len = 2; break; case DL_SCH_LCID_SP_ZP_CSI_RS_RES_SET_ACT: // 38.321 Ch6.1.3.19 - mac_ce_len = 2; + mac_len = 2; break; case DL_SCH_LCID_PUCCH_SPATIAL_RELATION_ACT: // 38.321 Ch6.1.3.18 - mac_ce_len = 3; + mac_len = 3; break; case DL_SCH_LCID_SP_CSI_REP_PUCCH_ACT: // 38.321 Ch6.1.3.16 - mac_ce_len = 2; + mac_len = 2; break; case DL_SCH_LCID_TCI_STATE_IND_UE_SPEC_PDCCH: // 38.321 Ch6.1.3.15 - mac_ce_len = 2; + mac_len = 2; break; case DL_SCH_LCID_DUPLICATION_ACT: // 38.321 Ch6.1.3.11 - mac_ce_len = 1; + mac_len = 1; break; case DL_SCH_LCID_SCell_ACT_4_OCT: // 38.321 Ch6.1.3.10 - mac_ce_len = 4; + mac_len = 4; break; case DL_SCH_LCID_SCell_ACT_1_OCT: // 38.321 Ch6.1.3.10 - mac_ce_len = 1; + mac_len = 1; break; case DL_SCH_LCID_L_DRX: // 38.321 Ch6.1.3.6 // fixed length but not yet specify. - mac_ce_len = 0; + mac_len = 0; break; case DL_SCH_LCID_DRX: // 38.321 Ch6.1.3.5 // fixed length but not yet specify. - mac_ce_len = 0; + mac_len = 0; break; case DL_SCH_LCID_TA_COMMAND: // 38.321 Ch6.1.3.4 - mac_ce_len = 1; + mac_len = 1; /*uint8_t ta_command = ((NR_MAC_CE_TA *)pduP)[1].TA_COMMAND; uint8_t tag_id = ((NR_MAC_CE_TA *)pduP)[1].TAGID;*/ @@ -3502,14 +3458,14 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, // Clause 5.1.5 and 6.1.3.3 of 3GPP TS 38.321 version 16.2.1 Release 16 // MAC Header: 1 byte (R/R/LCID) // MAC SDU: 6 bytes (UE Contention Resolution Identity) - mac_ce_len = 6; + mac_len = 6; if(ra->ra_state == WAIT_CONTENTION_RESOLUTION) { LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received contention resolution identity: 0x%02x%02x%02x%02x%02x%02x Terminating RA procedure\n", module_idP, frameP, pduP[1], pduP[2], pduP[3], pduP[4], pduP[5], pduP[6]); bool ra_success = true; - for(int i = 0; icont_res_id[i] != pduP[i+1]) { ra_success = false; break; @@ -3540,22 +3496,8 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, // check if LCID is valid at current time. if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) return; - NR_MAC_SUBHEADER_SHORT *shs = (NR_MAC_SUBHEADER_SHORT *)pduP; - if (shs->F) { - //mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG)) - return; - NR_MAC_SUBHEADER_LONG *shl = (NR_MAC_SUBHEADER_LONG *)pduP; - mac_sdu_len = ((uint16_t)(shl->L1 & 0x7f) << 8) | (uint16_t)(shl->L2 & 0xff); - } else { - if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) - return; - mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - } - - LOG_D(NR_MAC, "[UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, gNB_index, mac_sdu_len); + getMacLen(pduP, &mac_len, &mac_subheader_len); + LOG_D(NR_MAC, "[UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, gNB_index, mac_len); #if defined(ENABLE_MAC_PAYLOAD_DEBUG) LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP); @@ -3576,7 +3518,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, MBMS_FLAG_NO, rx_lcid, (char *) (pduP + mac_subheader_len), - mac_sdu_len, + mac_len, 1, NULL); } else { @@ -3587,8 +3529,8 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, break; } } - pduP += ( mac_subheader_len + mac_ce_len + mac_sdu_len ); - pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len ); + pduP += ( mac_subheader_len + mac_len ); + pdu_len -= ( mac_subheader_len + mac_len ); if (pdu_len < 0) LOG_E(MAC, "[UE %d][%d.%d] nr_ue_process_mac_pdu, residual mac pdu length %d < 0!\n", module_idP, frameP, slot, pdu_len); } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index bc9895ac2e..05c57d19ea 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -3118,8 +3118,7 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP, header->R = 0; header->F = 1; header->LCID = lcid; - header->L1 = ((unsigned short) sdu_length >> 8) & 0x7f; - header->L2 = (unsigned short) sdu_length & 0xff; + header->L = htons(sdu_length); #ifdef ENABLE_MAC_PAYLOAD_DEBUG LOG_I(NR_MAC, "In %s: dumping MAC sub-header with length %d: \n", __FUNCTION__, sh_size); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index f36dbc4a16..2263f4656b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1619,7 +1619,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra harq->feedback_slot = pucch->ul_slot; harq->feedback_frame = pucch->frame; - uint8_t *buf = (uint8_t *) harq->tb; + uint8_t *buf = (uint8_t *) harq->transportBlock; // Bytes to be transmitted if (harq->round == 0) { if (ra->msg3_dcch_dtch) { @@ -1866,11 +1866,11 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra } T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(ra->rnti), - T_INT(frameP), T_INT(slotP), T_INT(current_harq_pid), T_BUFFER(harq->tb, harq->tb_size)); + T_INT(frameP), T_INT(slotP), T_INT(current_harq_pid), T_BUFFER(harq->transportBlock, harq->tb_size)); // DL TX request nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs]; - memcpy(tx_req->TLVs[0].value.direct, harq->tb, sizeof(uint8_t) * harq->tb_size); + memcpy(tx_req->TLVs[0].value.direct, harq->transportBlock, sizeof(uint8_t) * harq->tb_size); tx_req->PDU_length = harq->tb_size; tx_req->PDU_index = pduindex; tx_req->num_TLV = 1; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 5032ee601f..ccbd6d43f8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1320,12 +1320,12 @@ void nr_schedule_ue_spec(module_id_t module_id, current_harq_pid); T(T_GNB_MAC_RETRANSMISSION_DL_PDU_WITH_DATA, T_INT(module_id), T_INT(CC_id), T_INT(rnti), - T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_INT(harq->round), T_BUFFER(harq->tb, TBS)); + T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_INT(harq->round), T_BUFFER(harq->transportBlock, TBS)); } else { /* initial transmission */ LOG_D(NR_MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot); - uint8_t *buf = (uint8_t *) harq->tb; + uint8_t *buf = (uint8_t *) harq->transportBlock; /* first, write all CEs that might be there */ int written = nr_write_ce_dlsch_pdu(module_id, @@ -1334,8 +1334,8 @@ void nr_schedule_ue_spec(module_id_t module_id, 255, // no drx NULL); // contention res id buf += written; - int size = TBS - written; - DevAssert(size >= 0); + uint8_t* bufEnd = buf + TBS - written; + DevAssert(TBS > written); /* next, get RLC data */ @@ -1345,18 +1345,15 @@ void nr_schedule_ue_spec(module_id_t module_id, start_meas(&gNB_mac->rlc_data_req); if (sched_ctrl->num_total_bytes > 0) { tbs_size_t len = 0; - while (size > 3) { + while (bufEnd-buf > sizeof(NR_MAC_SUBHEADER_LONG) + 1 ) { // 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 */ - const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer, size); - + const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer, + bufEnd-buf-+sizeof(NR_MAC_SUBHEADER_LONG)); len = mac_rlc_data_req(module_id, rnti, module_id, @@ -1365,12 +1362,12 @@ void nr_schedule_ue_spec(module_id_t module_id, MBMS_FLAG_NO, lcid, ndata, - (char *)buf, + (char *)buf+sizeof(NR_MAC_SUBHEADER_LONG), 0, 0); - + LOG_D(NR_MAC, - "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %d)\n", + "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %ld)\n", frame, slot, rnti, @@ -1378,59 +1375,45 @@ void nr_schedule_ue_spec(module_id_t module_id, lcid < 4 ? "DCCH" : "DTCH", lcid, ndata, - size); + bufEnd-buf-+sizeof(NR_MAC_SUBHEADER_LONG)); if (len == 0) break; header->R = 0; header->F = 1; header->LCID = lcid; - header->L1 = (len >> 8) & 0xff; - header->L2 = len & 0xff; - size -= len; - buf += len; + header->L = htons(len); + buf += len+sizeof(NR_MAC_SUBHEADER_LONG); dlsch_total_bytes += len; } - if (len == 0) { - /* RLC did not have data anymore, mark buffer as unused */ - buf -= 3; - size += 3; - } } else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra || get_softmodem_params()->sa) { /* we will need the large header, phy-test typically allocates all * resources and fills to the last byte below */ - NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf; - buf += 3; - size -= 3; - DevAssert(size > 0); - LOG_D(NR_MAC, "Configuring DL_TX in %d.%d: TBS %d with %d B of random data\n", frame, slot, TBS, size); - // fill dlsch_buffer with random data - for (int i = 0; i < size; i++) - buf[i] = lrand48() & 0xff; - header->R = 0; - header->F = 1; - header->LCID = DL_SCH_LCID_PADDING; - header->L1 = (size >> 8) & 0xff; - header->L2 = size & 0xff; - size -= size; - buf += size; - dlsch_total_bytes += size; + LOG_D(NR_MAC, "Configuring DL_TX in %d.%d: TBS %d of random data\n", frame, slot, TBS); + if (bufEnd-buf > sizeof(NR_MAC_SUBHEADER_LONG) ) { + NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf; + // fill dlsch_buffer with random data + header->R = 0; + header->F = 1; + header->LCID = DL_SCH_LCID_PADDING; + buf += sizeof(NR_MAC_SUBHEADER_LONG); + header->L = htons(bufEnd-buf); + dlsch_total_bytes += bufEnd-buf; + for (; buf < bufEnd; buf++) + *buf = lrand48() & 0xff; + } } stop_meas(&gNB_mac->rlc_data_req); // Add padding header and zero rest out if there is space left - if (size > 0) { + if (bufEnd-buf > 0) { NR_MAC_SUBHEADER_FIXED *padding = (NR_MAC_SUBHEADER_FIXED *) buf; padding->R = 0; padding->LCID = DL_SCH_LCID_PADDING; - size -= 1; buf += 1; - while (size > 0) { - *buf = 0; - buf += 1; - size -= 1; - } + memset(buf,0,bufEnd-buf); + buf=bufEnd; } UE_info->mac_stats[UE_id].dlsch_total_bytes += TBS; @@ -1455,7 +1438,7 @@ void nr_schedule_ue_spec(module_id_t module_id, } T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_id), T_INT(CC_id), T_INT(rnti), - T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_BUFFER(harq->tb, TBS)); + T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_BUFFER(harq->transportBlock, TBS)); } const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs; @@ -1464,7 +1447,7 @@ void nr_schedule_ue_spec(module_id_t module_id, tx_req->PDU_index = pduindex; tx_req->num_TLV = 1; tx_req->TLVs[0].length = TBS + 2; - memcpy(tx_req->TLVs[0].value.direct, harq->tb, TBS); + memcpy(tx_req->TLVs[0].value.direct, harq->transportBlock, TBS); gNB_mac->TX_req[CC_id].Number_of_PDUs++; gNB_mac->TX_req[CC_id].SFN = frame; gNB_mac->TX_req[CC_id].Slot = slot; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index aa49b14fe5..6c89d30800 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -205,11 +205,7 @@ int nr_process_mac_pdu(module_id_t module_idP, int pdu_len) { - uint8_t rx_lcid; uint8_t done = 0; - uint16_t mac_ce_len; - uint16_t mac_subheader_len; - uint16_t mac_sdu_len; NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; @@ -223,10 +219,9 @@ int nr_process_mac_pdu(module_id_t module_idP, #endif while (!done && pdu_len > 0){ - mac_ce_len = 0; - mac_subheader_len = sizeof(NR_MAC_SUBHEADER_FIXED); - mac_sdu_len = 0; - rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; + uint16_t mac_len=0; + uint16_t mac_subheader_len=sizeof(NR_MAC_SUBHEADER_FIXED); + uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; LOG_D(NR_MAC, "In %s: received UL-SCH sub-PDU with LCID 0x%x in %d.%d (remaining PDU length %d)\n", __func__, rx_lcid, frameP, slot, pdu_len); @@ -241,7 +236,7 @@ int nr_process_mac_pdu(module_id_t module_idP, #endif*/ case UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY: // 38.321 Ch6.1.3.20 - mac_ce_len = 2; + mac_len = 2; break; case UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION: // 38.321 Ch6.1.3.7 @@ -251,7 +246,7 @@ int nr_process_mac_pdu(module_id_t module_idP, case UL_SCH_LCID_S_TRUNCATED_BSR: //38.321 section 6.1.3.1 //fixed length - mac_ce_len =1; + mac_len =1; /* Extract short BSR value */ ce_ptr = &pduP[mac_subheader_len]; NR_BSR_SHORT *bsr_s = (NR_BSR_SHORT *) ce_ptr; @@ -269,25 +264,20 @@ int nr_process_mac_pdu(module_id_t module_idP, case UL_SCH_LCID_L_BSR: case UL_SCH_LCID_L_TRUNCATED_BSR: - //38.321 section 6.1.3.1 - //variable length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } - /* Extract long BSR value */ - ce_ptr = &pduP[mac_subheader_len]; - NR_BSR_LONG *bsr_l = (NR_BSR_LONG *) ce_ptr; - sched_ctrl->estimated_ul_buffer = 0; + //38.321 section 6.1.3.1 + //variable length + getMacLen(pduP, &mac_len, &mac_subheader_len); + /* Extract long BSR value */ + ce_ptr = &pduP[mac_subheader_len]; + NR_BSR_LONG *bsr_l = (NR_BSR_LONG *) ce_ptr; + sched_ctrl->estimated_ul_buffer = 0; + + n_Lcg = bsr_l->LcgID7 + bsr_l->LcgID6 + bsr_l->LcgID5 + bsr_l->LcgID4 + + bsr_l->LcgID3 + bsr_l->LcgID2 + bsr_l->LcgID1 + bsr_l->LcgID0; - n_Lcg = bsr_l->LcgID7 + bsr_l->LcgID6 + bsr_l->LcgID5 + bsr_l->LcgID4 + - bsr_l->LcgID3 + bsr_l->LcgID2 + bsr_l->LcgID1 + bsr_l->LcgID0; - - LOG_D(NR_MAC, "LONG BSR, LCG ID(7-0) %d/%d/%d/%d/%d/%d/%d/%d\n", - bsr_l->LcgID7, bsr_l->LcgID6, bsr_l->LcgID5, bsr_l->LcgID4, - bsr_l->LcgID3, bsr_l->LcgID2, bsr_l->LcgID1, bsr_l->LcgID0); + LOG_D(NR_MAC, "LONG BSR, LCG ID(7-0) %d/%d/%d/%d/%d/%d/%d/%d\n", + bsr_l->LcgID7, bsr_l->LcgID6, bsr_l->LcgID5, bsr_l->LcgID4, + bsr_l->LcgID3, bsr_l->LcgID2, bsr_l->LcgID1, bsr_l->LcgID0); for (int n = 0; n < n_Lcg; n++){ LOG_D(NR_MAC, "LONG BSR, %d/%d (n/n_Lcg), BS Index %d, BS value < %d", @@ -322,14 +312,14 @@ int nr_process_mac_pdu(module_id_t module_idP, //38.321 section 6.1.3.2 //fixed length - mac_ce_len = 2; + mac_len = 2; /* Extract CRNTI value */ break; case UL_SCH_LCID_SINGLE_ENTRY_PHR: //38.321 section 6.1.3.8 //fixed length - mac_ce_len = 2; + mac_len = 2; /* Extract SINGLE ENTRY PHR elements for PHR calculation */ ce_ptr = &pduP[mac_subheader_len]; NR_SINGLE_ENTRY_PHR_MAC_CE *phr = (NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr; @@ -348,26 +338,11 @@ int nr_process_mac_pdu(module_id_t module_idP, break; case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT: - //38.321 section 6.1.3.9 - // varialbe length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } - /* Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */ - break; - case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT: - //38.321 section 6.1.3.9 - // varialbe length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } + // varialbe length + getMacLen(pduP, &mac_len, &mac_subheader_len); + //Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */ + break; /* Extract MULTI ENTRY PHR elements from four octets bitmap for PHR calculation */ break; @@ -378,23 +353,14 @@ int nr_process_mac_pdu(module_id_t module_idP, case UL_SCH_LCID_SRB1: case UL_SCH_LCID_SRB2: - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - //mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pduP)->L1 & 0x7f) << 8) - | ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff); - } else { - mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - } - + getMacLen(pduP, &mac_len, &mac_subheader_len); rnti_t crnti = UE_info->rnti[UE_id]; int UE_idx = UE_id; for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[i]; if (ra->state >= WAIT_Msg3 && ra->rnti == UE_info->rnti[UE_id]) { - uint8_t *next_subpduP = pduP + mac_subheader_len + mac_sdu_len; - if ((pduP[mac_subheader_len+mac_sdu_len] & 0x3F) == UL_SCH_LCID_C_RNTI) { + uint8_t *next_subpduP = pduP + mac_subheader_len + mac_len; + if ((pduP[mac_subheader_len+mac_len] & 0x3F) == UL_SCH_LCID_C_RNTI) { crnti = ((next_subpduP[1]&0xFF)<<8)|(next_subpduP[2]&0xFF); UE_idx = find_nr_UE_id(module_idP, crnti); break; @@ -403,7 +369,7 @@ int nr_process_mac_pdu(module_id_t module_idP, } if (UE_info->CellGroup[UE_idx]) { - LOG_D(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DCCH %d (gNB %d, %d bytes), rnti: 0x%04x \n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len, crnti); + LOG_D(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DCCH %d (gNB %d, %d bytes), rnti: 0x%04x \n", module_idP, frameP, rx_lcid, module_idP, mac_len, crnti); mac_rlc_data_ind(module_idP, crnti, module_idP, @@ -412,7 +378,7 @@ int nr_process_mac_pdu(module_id_t module_idP, MBMS_FLAG_NO, rx_lcid, (char *) (pduP + mac_subheader_len), - mac_sdu_len, + mac_len, 1, NULL); } else { @@ -430,23 +396,23 @@ int nr_process_mac_pdu(module_id_t module_idP, if ( rx_lcid == UL_SCH_LCID_CCCH1 ) { // RRCResumeRequest1 message includes the full I-RNTI and has a size of 8 bytes - mac_sdu_len = 8; + mac_len = 8; // Check if it is a valid CCCH1 message, we get all 00's messages very often int i = 0; - for(i=0; i<(mac_subheader_len+mac_sdu_len); i++) { + for(i=0; i<(mac_subheader_len+mac_len); i++) { if(pduP[i] != 0) { break; } } - if (i == (mac_subheader_len+mac_sdu_len)) { + if (i == (mac_subheader_len+mac_len)) { LOG_D(NR_MAC, "%s() Invalid CCCH1 message!, pdu_len: %d\n", __func__, pdu_len); done = 1; break; } } else { // fixed length of 6 bytes - mac_sdu_len = 6; + mac_len = 6; } nr_mac_rrc_data_ind(module_idP, @@ -457,23 +423,12 @@ int nr_process_mac_pdu(module_id_t module_idP, UE_info->rnti[UE_id], CCCH, pduP + mac_subheader_len, - mac_sdu_len, + mac_len, 0); break; case UL_SCH_LCID_DTCH: - // check if LCID is valid at current time. - if (((NR_MAC_SUBHEADER_SHORT *)pduP)->F) { - // mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L1 & 0x7f) << 8) - | ((uint16_t)((NR_MAC_SUBHEADER_LONG *)pduP)->L2 & 0xff); - - } else { - mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - } - + getMacLen(pduP, &mac_len, &mac_subheader_len); LOG_D(NR_MAC, "In %s: [UE %d] %d.%d : ULSCH -> UL-%s %d (gNB %d, %d bytes)\n", __func__, module_idP, @@ -482,8 +437,8 @@ int nr_process_mac_pdu(module_id_t module_idP, rx_lcid<4?"DCCH":"DTCH", rx_lcid, module_idP, - mac_sdu_len); - UE_info->mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len; + mac_len); + UE_info->mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_len; mac_rlc_data_ind(module_idP, UE_info->rnti[UE_id], @@ -493,13 +448,13 @@ int nr_process_mac_pdu(module_id_t module_idP, MBMS_FLAG_NO, rx_lcid, (char *)(pduP + mac_subheader_len), - mac_sdu_len, + mac_len, 1, NULL); /* Updated estimated buffer when receiving data */ - if (sched_ctrl->estimated_ul_buffer >= mac_sdu_len) - sched_ctrl->estimated_ul_buffer -= mac_sdu_len; + if (sched_ctrl->estimated_ul_buffer >= mac_len) + sched_ctrl->estimated_ul_buffer -= mac_len; else sched_ctrl->estimated_ul_buffer = 0; break; @@ -514,16 +469,16 @@ int nr_process_mac_pdu(module_id_t module_idP, if (rx_lcid < 45 || rx_lcid == 52 || rx_lcid == 63) { LOG_I(NR_MAC, "In %s: dumping UL MAC SDU sub-header with length %d (LCID = 0x%02x):\n", __func__, mac_subheader_len, rx_lcid); log_dump(NR_MAC, pduP, mac_subheader_len, LOG_DUMP_CHAR, "\n"); - LOG_I(NR_MAC, "In %s: dumping UL MAC SDU with length %d (LCID = 0x%02x):\n", __func__, mac_sdu_len, rx_lcid); - log_dump(NR_MAC, pduP + mac_subheader_len, mac_sdu_len, LOG_DUMP_CHAR, "\n"); + LOG_I(NR_MAC, "In %s: dumping UL MAC SDU with length %d (LCID = 0x%02x):\n", __func__, mac_len, rx_lcid); + log_dump(NR_MAC, pduP + mac_subheader_len, mac_len, LOG_DUMP_CHAR, "\n"); } else { - LOG_I(NR_MAC, "In %s: dumping UL MAC CE with length %d (LCID = 0x%02x):\n", __func__, mac_ce_len, rx_lcid); - log_dump(NR_MAC, pduP + mac_subheader_len + mac_sdu_len, mac_ce_len, LOG_DUMP_CHAR, "\n"); + LOG_I(NR_MAC, "In %s: dumping UL MAC CE with length %d (LCID = 0x%02x):\n", __func__, mac_len, rx_lcid); + log_dump(NR_MAC, pduP + mac_subheader_len + mac_len, mac_len, LOG_DUMP_CHAR, "\n"); } #endif - pduP += ( mac_subheader_len + mac_ce_len + mac_sdu_len ); - pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len ); + pduP += ( mac_subheader_len + mac_len ); + pdu_len -= ( mac_subheader_len + mac_len ); if (pdu_len < 0) { LOG_E(NR_MAC, "In %s: residual UL MAC PDU in %d.%d with length < 0!, pdu_len %d \n", __func__, frameP, slot, pdu_len); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index eccffca031..eba9bc52b3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -444,7 +444,7 @@ typedef struct NR_UE_harq { /* Transport block to be sent using this HARQ process, its size is in * sched_pdsch */ - uint32_t tb[16384]; + uint32_t transportBlock[16384]; uint32_t tb_size; /// sched_pdsch keeps information on MCS etc used for the initial transmission diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 99897f9060..59cf465ac1 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1065,7 +1065,7 @@ void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nac int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ - NR_UE_L2_STATE_t ret; + NR_UE_L2_STATE_t ret=0; module_id_t module_id = ul_info->module_id; NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 4492380d7f..c73c3d9649 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -969,9 +969,9 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ( uint16_t ue_initial_id; uint32_t gNB_ue_ngap_id; rrc_gNB_ue_context_t *ue_context_p = NULL; - protocol_ctxt_t ctxt; - gtpv1u_gnb_create_tunnel_req_t create_tunnel_req; - gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp; + protocol_ctxt_t ctxt={0}; + gtpv1u_gnb_create_tunnel_req_t create_tunnel_req={0}; + gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp={0}; uint8_t pdu_sessions_done; uint8_t inde_list[NR_NB_RB_MAX - 3]= {0}; int ret = 0; diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index 283f3b7311..e151fec9b4 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -428,7 +428,7 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg, int Mod_id) { size += 10; // encode the message - initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t)); + initialNasMsg->data = malloc16_clear(size * sizeof(Byte_t)); registration_request_buf = initialNasMsg->data; initialNasMsg->length = mm_msg_encode(mm_msg, (uint8_t*)(initialNasMsg->data), size); diff --git a/targets/ARCH/rfsimulator/apply_channelmod.c b/targets/ARCH/rfsimulator/apply_channelmod.c index d7d3a68965..6e26120e29 100644 --- a/targets/ARCH/rfsimulator/apply_channelmod.c +++ b/targets/ARCH/rfsimulator/apply_channelmod.c @@ -52,7 +52,7 @@ either we regenerate the channel (call again random_channel(desc,0)), or we keep it over subframes legacy: we regenerate each sub frame in UL, and each frame only in DL */ -void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_sig, +void rxAddInput( c16_t *input_sig, c16_t *after_channel_sig, int rxAnt, channel_desc_t *channelDesc, int nbSamples, @@ -73,7 +73,7 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si const int nbTx=channelDesc->nb_tx; for (int i=0; i<((int)nbSamples-dd); i++) { - struct complex16 *out_ptr=after_channel_sig+dd+i; + c16_t *out_ptr=after_channel_sig+dd+i; struct complexd rx_tmp= {0}; for (int txAnt=0; txAnt < nbTx; txAnt++) { @@ -87,7 +87,7 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si // but it is not very usefull // it would be better to split out each antenna in a separate flow // that will allow to mix ru antennas freely - struct complex16 tx16=input_sig[((TS+i-l)*nbTx+txAnt)%CirSize]; + c16_t tx16=input_sig[((TS+i-l)*nbTx+txAnt)%CirSize]; rx_tmp.r += tx16.r * channelModel[l].r - tx16.i * channelModel[l].i; rx_tmp.i += tx16.i * channelModel[l].r + tx16.r * channelModel[l].i; } //l diff --git a/targets/ARCH/rfsimulator/rfsimulator.h b/targets/ARCH/rfsimulator/rfsimulator.h index 292873032e..33583f2d32 100644 --- a/targets/ARCH/rfsimulator/rfsimulator.h +++ b/targets/ARCH/rfsimulator/rfsimulator.h @@ -25,8 +25,8 @@ #define __RFSIMULATOR_H double gaussZiggurat(double mean, double variance); void tableNor(unsigned long seed); -void rxAddInput( struct complex16 *input_sig, - struct complex16 *after_channel_sig, +void rxAddInput( c16_t *input_sig, + c16_t *after_channel_sig, int rxAnt, channel_desc_t *channelDesc, int nbSamples, diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c index 013e542689..0a05f2cbef 100644 --- a/targets/ARCH/rfsimulator/simulator.c +++ b/targets/ARCH/rfsimulator/simulator.c @@ -100,7 +100,7 @@ static telnetshell_vardef_t rfsimu_vardef[] = { }; pthread_mutex_t Sockmutex; -typedef struct complex16 sample_t; // 2*16 bits complex number +typedef c16_t sample_t; // 2*16 bits complex number typedef struct buffer_s { int conn_sock; @@ -495,7 +495,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi setblocking(conn_sock, notBlocking); allocCirBuf(t, conn_sock); LOG_I(HW,"A client connected, sending the current time\n"); - struct complex16 v= {0}; + c16_t v= {0}; void *samplesVoid[t->tx_num_channels]; for ( int i=0; i < t->tx_num_channels; i++) @@ -665,7 +665,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest // We send timestamp for nb samples required // assuming this should have been done earlier if a Tx would exist pthread_mutex_unlock(&Sockmutex); - struct complex16 v= {0}; + c16_t v= {0}; void *dummyS[t->tx_num_channels]; for ( int i=0; i < t->tx_num_channels; i++) @@ -728,7 +728,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest for (int a=0; achannel_model != NULL ) // apply a channel model - rxAddInput( ptr->circularBuf, (struct complex16 *) samplesVoid[a], + rxAddInput( ptr->circularBuf, (c16_t *) samplesVoid[a], a, ptr->channel_model, nsamps, diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 13a09db5a3..1b59ba9b2b 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1941,7 +1941,7 @@ void write_dummy(PHY_VARS_UE *UE, openair0_timestamp timestamp) { // we have to write to tell explicitly to the eNB, else it will wait for us forever // we write the next subframe (always write in future of what we received) // - struct complex16 v= {0}; + c16_t v= {0}; void *samplesVoid[UE->frame_parms.nb_antennas_tx]; for ( int i=0; i < UE->frame_parms.nb_antennas_tx; i++) From 288c29da84fa2466ea4d503bbdbcce16e8528bf1 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 18 Mar 2022 19:46:42 +0000 Subject: [PATCH 04/39] Apply review suggestions --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 14 +++++++------- openair2/LAYER2/NR_MAC_COMMON/nr_mac.h | 12 ++++++------ openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index eda53e1c84..b8eaefedb1 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -287,8 +287,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, for (int aa=0;aanb_antennas_rx;aa++) { c16_t *r=(c16_t*)&rxdataF[aa][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[l]]; for (n=0;n<12;n++) { - xr[aa][l][n].r +=(int32_t)x_re[l][n]*r[n].r+(int32_t)x_im[l][n]*r[n].i; - xr[aa][l][n].i +=(int32_t)x_re[l][n]*r[n].i-(int32_t)x_im[l][n]*r[n].r; + xr[aa][l][n].r += (int32_t)x_re[l][n] * r[n].r + (int32_t)x_im[l][n] * r[n].i; + xr[aa][l][n].i += (int32_t)x_re[l][n] * r[n].i - (int32_t)x_im[l][n] * r[n].r; #ifdef DEBUG_NR_PUCCH_RX printf("x (%d,%d), r%d.%d (%d,%d), xr (%lld,%lld)\n", x_re[l][n],x_im[l][n],l2,re_offset[l],r[n].r,r[n].i,xr[aa][l][n].r,xr[aa][l][n].i); @@ -317,12 +317,12 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, for (int aa=0;aanb_antennas_rx;aa++) { corr_re[aa][l]=0; corr_im[aa][l]=0; - for (n=0;n<12;n++) { - corr_re[aa][l]+=xr[aa][l][n].r*idft12_re[seq_index][n]+xr[aa][l][n].i*idft12_im[seq_index][n]; - corr_im[aa][l]+=xr[aa][l][n].r*idft12_im[seq_index][n]-xr[aa][l][n].i*idft12_re[seq_index][n]; + for (n = 0; n < 12; n++) { + corr_re[aa][l] += xr[aa][l][n].r * idft12_re[seq_index][n] + xr[aa][l][n].i * idft12_im[seq_index][n]; + corr_im[aa][l] += xr[aa][l][n].r * idft12_im[seq_index][n] - xr[aa][l][n].i * idft12_re[seq_index][n]; } - corr_re[aa][l]>>=15; - corr_im[aa][l]>>=15; + corr_re[aa][l] >>= 15; + corr_im[aa][l] >>= 15; } } LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%ld,%ld)=>%f\n", diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h index f084cb2d63..248c30f26f 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h @@ -118,14 +118,14 @@ typedef struct { } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED; static inline void getMacLen(uint8_t* pdu, uint16_t *mac_ce_len, uint16_t *mac_subheader_len) { - NR_MAC_SUBHEADER_SHORT *s=(NR_MAC_SUBHEADER_SHORT*) pdu; - NR_MAC_SUBHEADER_LONG *l=(NR_MAC_SUBHEADER_LONG*) pdu; + NR_MAC_SUBHEADER_SHORT *s = (NR_MAC_SUBHEADER_SHORT*) pdu; + NR_MAC_SUBHEADER_LONG *l = (NR_MAC_SUBHEADER_LONG*) pdu; if (s->F) { - *mac_subheader_len=sizeof(*l); - *mac_ce_len=ntohs(l->L); + *mac_subheader_len = sizeof(*l); + *mac_ce_len = ntohs(l->L); } else { - *mac_subheader_len=sizeof(*s); - *mac_ce_len=s->L; + *mac_subheader_len = sizeof(*s); + *mac_ce_len = s->L; } } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 05313f388a..61a2902690 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2092,7 +2092,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac, pucch->is_common = current_harq->is_common; current_harq->active = false; current_harq->ack_received = false; - LOG_D(PHY,"%d.%d Sent %d ack on harq pid %d\n", frame, slot, current_harq->ack, dl_harq_pid); + LOG_D(PHY,"%4d.%2d Sent %d ack on harq pid %d\n", frame, slot, current_harq->ack, dl_harq_pid); } } } @@ -3497,7 +3497,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) return; getMacLen(pduP, &mac_len, &mac_subheader_len); - LOG_D(NR_MAC, "[UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, gNB_index, mac_len); + LOG_D(NR_MAC, "[UE %d] %4d.%2d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, slot, rx_lcid, gNB_index, mac_len); #if defined(ENABLE_MAC_PAYLOAD_DEBUG) LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP); From b153d2d1ee021116226707fbdef90b62b31126c0 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 24 Mar 2022 21:10:23 +0100 Subject: [PATCH 05/39] fix bug in nr_rate_matching --- openair1/PHY/CODING/nr_rate_matching.c | 97 ++++++++++++++------------ 1 file changed, 54 insertions(+), 43 deletions(-) diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c index 29cba0a557..84e6615ed9 100644 --- a/openair1/PHY/CODING/nr_rate_matching.c +++ b/openair1/PHY/CODING/nr_rate_matching.c @@ -309,60 +309,71 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f) void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f) { - int16_t *e1,*e2,*e3,*e4,*e5,*e6,*e7; switch(Qm) { case 2: - e1=e+(E/2); - for (int j = 0,j2=0; j< E/2; j+=2,j2+=4){ - e[j] = f[j2]; - e1[j] = f[j2+1]; - e[j+1] = f[j2+2]; - e1[j+1] = f[j2+3]; + { + int16_t *e1=e+(E/2); + int16_t *end=f+E-4; + while( f Date: Fri, 25 Mar 2022 16:32:07 +0100 Subject: [PATCH 06/39] fix bug introduced in this branch --- openair1/PHY/CODING/nr_rate_matching.c | 2 +- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 60 +++++++++++--------------- openair1/PHY/TOOLS/tools_defs.h | 3 ++ 3 files changed, 30 insertions(+), 35 deletions(-) diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c index 84e6615ed9..29a1e363e9 100644 --- a/openair1/PHY/CODING/nr_rate_matching.c +++ b/openair1/PHY/CODING/nr_rate_matching.c @@ -307,7 +307,7 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f) void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f) -{ +{ switch(Qm) { case 2: diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index b8eaefedb1..06b3c6e9e7 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -272,7 +272,6 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, x_im[1] = table_5_2_2_2_2_Im[u[1]]; c64_t xr[frame_parms->nb_antennas_rx][pucch_pdu->nr_of_symbols][12] __attribute__((aligned(32))); - memset(xr, 0, sizeof(xr)); int64_t xrtmag=0,xrtmag_next=0; uint8_t maxpos=0; uint8_t index=0; @@ -287,72 +286,65 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, for (int aa=0;aanb_antennas_rx;aa++) { c16_t *r=(c16_t*)&rxdataF[aa][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[l]]; for (n=0;n<12;n++) { - xr[aa][l][n].r += (int32_t)x_re[l][n] * r[n].r + (int32_t)x_im[l][n] * r[n].i; - xr[aa][l][n].i += (int32_t)x_re[l][n] * r[n].i - (int32_t)x_im[l][n] * r[n].r; + xr[aa][l][n].r = (int32_t)x_re[l][n] * r[n].r + (int32_t)x_im[l][n] * r[n].i; + xr[aa][l][n].i = (int32_t)x_re[l][n] * r[n].i - (int32_t)x_im[l][n] * r[n].r; #ifdef DEBUG_NR_PUCCH_RX printf("x (%d,%d), r%d.%d (%d,%d), xr (%lld,%lld)\n", x_re[l][n],x_im[l][n],l2,re_offset[l],r[n].r,r[n].i,xr[aa][l][n].r,xr[aa][l][n].i); #endif } - xr[aa][l][n].r>>=15; - xr[aa][l][n].i>>=15; } } - int64_t corr_re[frame_parms->nb_antennas_rx][2]; - int64_t corr_im[frame_parms->nb_antennas_rx][2]; //int32_t no_corr = 0; int seq_index = 0; int64_t temp; for(i=0;inr_of_symbols;l++) { - seq_index = (pucch_pdu->initial_cyclic_shift+ - mcs[i]+ - gNB->pucch0_lut.lut[cs_ind][slot][l+pucch_pdu->start_symbol_index])%12; + c64_t corr[frame_parms->nb_antennas_rx][2]; + for (int aa=0;aanb_antennas_rx;aa++) { + for (int l=0;lnr_of_symbols;l++) { + seq_index = (pucch_pdu->initial_cyclic_shift+ + mcs[i]+ + gNB->pucch0_lut.lut[cs_ind][slot][l+pucch_pdu->start_symbol_index])%12; #ifdef DEBUG_NR_PUCCH_RX - printf("PUCCH symbol %d seq %d, seq_index %d, mcs %d\n",l,i,seq_index,mcs[i]); + printf("PUCCH symbol %d seq %d, seq_index %d, mcs %d\n",l,i,seq_index,mcs[i]); #endif - for (int aa=0;aanb_antennas_rx;aa++) { - corr_re[aa][l]=0; - corr_im[aa][l]=0; + corr[aa][l]=(c64_t){0}; for (n = 0; n < 12; n++) { - corr_re[aa][l] += xr[aa][l][n].r * idft12_re[seq_index][n] + xr[aa][l][n].i * idft12_im[seq_index][n]; - corr_im[aa][l] += xr[aa][l][n].r * idft12_im[seq_index][n] - xr[aa][l][n].i * idft12_re[seq_index][n]; + corr[aa][l].r += xr[aa][l][n].r * idft12_re[seq_index][n] + xr[aa][l][n].i * idft12_im[seq_index][n]; + corr[aa][l].i += xr[aa][l][n].r * idft12_im[seq_index][n] - xr[aa][l][n].i * idft12_re[seq_index][n]; } - corr_re[aa][l] >>= 15; - corr_im[aa][l] >>= 15; + corr[aa][l].r >>= 31; + corr[aa][l].i >>= 31; } } LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%ld,%ld)=>%f\n", - mcs[i],seq_index,corr_re[0][0],corr_im[0][0], - 10*log10((double)corr_re[0][0]*corr_re[0][0] + (double)corr_im[0][0]*corr_im[0][0])); + mcs[i],seq_index,corr[0][0].r,corr[0][0].i, + 10*log10((double)squaredMod(corr[0][0]))); if (pucch_pdu->nr_of_symbols==2) LOG_D(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%ld,%ld)=>%f\n", - mcs[i],seq_index,corr_re[0][1],corr_im[0][1], - 10*log10((double)corr_re[0][1]*corr_re[0][1] + (double)corr_im[0][1]*corr_im[0][1])); + mcs[i],seq_index,corr[0][1].r,corr[0][1].i, + 10*log10((double)squaredMod(corr[0][1]))); if (pucch_pdu->freq_hop_flag == 0) { if (pucch_pdu->nr_of_symbols==1) {// non-coherent correlation temp=0; for (int aa=0;aanb_antennas_rx;aa++) - temp+=(int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0]; + temp+=squaredMod(corr[aa][0]); } else { - int64_t corr_re2=0; - int64_t corr_im2=0; temp=0; for (int aa=0;aanb_antennas_rx;aa++) { - corr_re2 = (int64_t)corr_re[aa][0]+corr_re[aa][1]; - corr_im2 = (int64_t)corr_im[aa][0]+corr_im[aa][1]; - // coherent combining of 2 symbols and then complex modulus for single-frequency case - temp+=corr_re2*corr_re2 + corr_im2*corr_im2; + c64_t corr2; + csum(corr2, corr[aa][0], corr[aa][1]); + // coherent combining of 2 symbols and then complex modulus for single-frequency case + temp+=corr2.r*corr2.r + corr2.i*corr2.i; } } } else if (pucch_pdu->freq_hop_flag == 1) { // full non-coherent combining of 2 symbols for frequency-hopping case temp=0; for (int aa=0;aanb_antennas_rx;aa++) - temp += (int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0] + (int64_t)corr_re[aa][1]*corr_re[aa][1] + (int64_t)corr_im[aa][1]*corr_im[aa][1]; + temp += squaredMod(corr[aa][0]) + squaredMod(corr[aa][1]); } else AssertFatal(1==0,"shouldn't happen\n"); @@ -364,9 +356,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_stats->current_pucch0_stat0 = 0; int64_t temp2=0,temp3=0;; for (int aa=0;aanb_antennas_rx;aa++) { - temp2 += ((int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0]); + temp2 += squaredMod(corr[aa][0]); if (pucch_pdu->nr_of_symbols==2) - temp3 += ((int64_t)corr_re[aa][1]*corr_re[aa][1] + (int64_t)corr_im[aa][1]*corr_im[aa][1]); + temp3 += squaredMod(corr[aa][1]); } uci_stats->current_pucch0_stat0= dB_fixed64(temp2); if ( pucch_pdu->nr_of_symbols==2) diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index 13ce9d85c7..c763ec6bac 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -63,6 +63,9 @@ typedef struct complex64 { int64_t r; int64_t i; } c64_t; + +#define squaredMod(a) ((a).r*(a).r+(a).i*(a).i) +#define csum(res, i1, i2) (res).r=(i1).r+(i2).r ; (res).i=(i1).i+(i2).i //cmult_sv.h /*!\fn void multadd_real_vector_complex_scalar(int16_t *x,int16_t *alpha,int16_t *y,uint32_t N) From 9be58373bc35b076b07f8bcc9d5aedb487956e5c Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 25 Mar 2022 18:20:05 +0100 Subject: [PATCH 07/39] fix regression on harq in UE --- openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 12 +++++++----- openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h | 1 + openair1/SIMULATION/NR_PHY/dlschsim.c | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 6163a95e5c..eac595b39e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -168,6 +168,8 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint dlsch->harq_processes[i]->d[r] = (int16_t *)malloc16(5*8448*sizeof(int16_t)); if (dlsch->harq_processes[i]->c[r]) memset(dlsch->harq_processes[i]->c[r],0,1056); + if (dlsch->harq_processes[i]->d[r]) + memset(dlsch->harq_processes[i]->d[r],0,5*8448); else exit_flag=2; @@ -306,6 +308,7 @@ void nr_processDLSegment(void* arg) { //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN); int16_t w[E]; + memset(w, 0, sizeof(w)); nr_deinterleaving_ldpc(E, Qm, w, // [hna] w is e @@ -324,12 +327,11 @@ void nr_processDLSegment(void* arg) { harq_process->rvidx, harq_process->round); */ //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_IN); - int16_t d[5*8448]; if (nr_rate_matching_ldpc_rx(Ilbrm, Tbslbrm, p_decoderParms->BG, p_decoderParms->Z, - d, + harq_process->d[r], w, harq_process->C, harq_process->rvidx, @@ -351,7 +353,7 @@ void nr_processDLSegment(void* arg) { LOG_D(PHY,"decoder input(segment %u) :",r); for (int i=0; id[r][i]); LOG_D(PHY,"\n"); } @@ -377,9 +379,9 @@ void nr_processDLSegment(void* arg) { //set Filler bits memset((&z[0]+K_bits_F),127,harq_process->F*sizeof(int16_t)); //Move coded bits before filler bits - memcpy((&z[0]+2*harq_process->Z),d,(K_bits_F-2*harq_process->Z)*sizeof(int16_t)); + memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bits_F-2*harq_process->Z)*sizeof(int16_t)); //skip filler bits - memcpy((&z[0]+Kr),d+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t)); + memcpy((&z[0]+Kr),harq_process->d[r]+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t)); //Saturate coded bits before decoding into 8 bits values for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++) { diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index f76119250f..ef42bb2abd 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -181,6 +181,7 @@ typedef struct { /// Pointers to transport block segments uint8_t **c; /// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) + /// Accumulates the soft bits for each round to increase decoding success (HARQ) int16_t **d; /// Index of current HARQ round for this DLSCH uint8_t round; diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index c8969d7a0f..eb48d26908 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -483,7 +483,7 @@ int main(int argc, char **argv) //unsigned char test_input[TBS / 8] __attribute__ ((aligned(16))); for (i = 0; i < TBS / 8; i++) test_input[i] = (unsigned char) rand(); - + harq->pdu=test_input; //estimated_output = harq_process->b; #ifdef DEBUG_NR_DLSCHSIM From a79ccb99926ab6e93e826a93441347436a6f5269 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 25 Mar 2022 21:45:37 +0100 Subject: [PATCH 08/39] fix nr_deinterleaving_ldpc() again, we are now too short in the buffer --- common/utils/assertions.h | 4 ++-- openair1/PHY/CODING/nr_rate_matching.c | 27 +++++++++++++++----------- openair1/SIMULATION/NR_PHY/dlschsim.c | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/common/utils/assertions.h b/common/utils/assertions.h index 573036b1d9..c8959d0adb 100644 --- a/common/utils/assertions.h +++ b/common/utils/assertions.h @@ -44,9 +44,9 @@ #define _Assert_(cOND, aCTION, fORMAT, aRGS...) \ do { \ if (!(cOND)) { \ - fprintf(stderr, "\nAssertion ("#cOND") failed!\n" \ + fprintf(stderr, "\nAssertion (%s) failed!\n" \ "In %s() %s:%d\n" fORMAT, \ - __FUNCTION__, __FILE__, __LINE__, ##aRGS); \ + #cOND, __FUNCTION__, __FILE__, __LINE__, ##aRGS); \ aCTION; \ } \ } while(0) diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c index 29a1e363e9..fbad79cad7 100644 --- a/openair1/PHY/CODING/nr_rate_matching.c +++ b/openair1/PHY/CODING/nr_rate_matching.c @@ -309,25 +309,28 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f) void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f) { + switch(Qm) { case 2: { - int16_t *e1=e+(E/2); - int16_t *end=f+E-4; - while( fpdu=test_input; + dlsch->harq_process.pdu=test_input; //estimated_output = harq_process->b; #ifdef DEBUG_NR_DLSCHSIM From c0568a997a003b15b64e47c3ae8c4868d0630425 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 22 Mar 2022 15:23:44 +0100 Subject: [PATCH 09/39] fix bugs, delete dead code --- executables/nr-ue.c | 27 +++--- openair1/PHY/defs_RU.h | 1 - openair1/PHY/defs_UE.h | 14 --- openair1/PHY/defs_gNB.h | 3 - openair1/SCHED_UE/phy_procedures_lte_ue.c | 106 ---------------------- openair2/RRC/LTE/rrc_UE.c | 3 +- targets/ARCH/rfsimulator/simulator.c | 72 ++++----------- targets/RT/USER/lte-ru.c | 19 +++- targets/RT/USER/lte-softmodem.h | 1 - targets/RT/USER/lte-uesoftmodem.c | 9 -- 10 files changed, 51 insertions(+), 204 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 3cc71b8b3a..aef0370e53 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -654,17 +654,15 @@ static void UE_synch(void *arg) { openair0_cfg[UE->rf_map.card].rx_freq[0], openair0_cfg[UE->rf_map.card].tx_freq[0]); - if (UE->mode != loop_through_memory) { - UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); - //UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]); - //UE->rfdevice.trx_stop_func(&UE->rfdevice); - // sleep(1); - /*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) { - LOG_E(HW,"Could not start the device\n"); - oai_exit=1; - }*/ - } - + UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); + //UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]); + //UE->rfdevice.trx_stop_func(&UE->rfdevice); + // sleep(1); + /*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) { + LOG_E(HW,"Could not start the device\n"); + oai_exit=1; + }*/ + if (UE->UE_scan_carrier == 1) { UE->UE_scan_carrier = 0; } else { @@ -683,8 +681,7 @@ static void UE_synch(void *arg) { LOG_I(PHY, "Initial sync failed: trying carrier off %d Hz\n", freq_offset); - if (UE->mode != loop_through_memory) - UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); + UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); } break; @@ -729,7 +726,7 @@ void processSlotTX(void *arg) { stop_meas(&UE->ue_ul_indication_stats); } - if ((UE->mode != loop_through_memory) && (rxtxD->ue_sched_mode != NOT_PUSCH)) { + if (rxtxD->ue_sched_mode != NOT_PUSCH) { phy_procedures_nrUE_TX(UE,proc,0); } } @@ -873,7 +870,7 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { *timestamp += UE->frame_parms.get_samples_per_slot(1,&UE->frame_parms); for ( int size=UE->rx_offset ; size > 0 ; size -= UE->frame_parms.samples_per_subframe ) { int unitTransfer=size>UE->frame_parms.samples_per_subframe ? UE->frame_parms.samples_per_subframe : size ; - // we write before read becasue gNB waits for UE to write and both executions halt + // we write before read because gNB waits for UE to write and both executions halt // this happens here as the read size is samples_per_subframe which is very much larger than samp_per_slot if (IS_SOFTMODEM_RFSIM) dummyWrite(UE,*timestamp, unitTransfer); AssertFatal(unitTransfer == diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 0b20aa409b..243e76f851 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -54,7 +54,6 @@ typedef enum { no_L2_connect=5, calib_prach_tx=6, rx_dump_frame=7, - loop_through_memory=8 } runmode_t; /*! \brief Extension Type */ diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h index 7f4d07ddae..a634a0d585 100644 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -168,19 +168,6 @@ typedef struct { struct sched_param sched_param_ue; /// pthread descriptor main UE thread pthread_t pthread_ue; - /// \brief Instance count for synch thread. - /// \internal This variable is protected by \ref mutex_synch. - int instance_cnt_synch; - /// pthread attributes for synch processing thread - pthread_attr_t attr_synch; - /// scheduling parameters for synch thread - struct sched_param sched_param_synch; - /// pthread descriptor synch thread - pthread_t pthread_synch; - /// condition variable for UE synch thread; - pthread_cond_t cond_synch; - /// mutex for UE synch thread - pthread_mutex_t mutex_synch; /// instance count for eNBs int instance_cnt_eNBs; /// set of scheduling variables RXn-TXnp4 threads @@ -833,7 +820,6 @@ typedef struct { pthread_mutex_t timer_mutex; pthread_cond_t timer_cond; int instance_cnt_timer; - /// RF and Interface devices per CC openair0_device rfdevice; diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 6dcce5df0a..66bf3e8b03 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -589,9 +589,6 @@ typedef struct gNB_L1_proc_t_s { int instance_cnt_te; /// \internal This variable is protected by \ref mutex_prach. int instance_cnt_prach; - - // instance count for over-the-air gNB synchronization - int instance_cnt_synch; /// \internal This variable is protected by \ref mutex_asynch_rxtx. int instance_cnt_asynch_rxtx; /// pthread structure for eNB single processing thread diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index b02f24e04e..52e7351e24 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -4870,109 +4870,3 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx); return (0); } - - -void phy_procedures_UE_lte(PHY_VARS_UE *ue, - UE_rxtx_proc_t *proc, - uint8_t eNB_id, - uint8_t abstraction_flag, - uint8_t do_pdcch_flag, - runmode_t mode) { - MessageDef *msg_p; - int result; - int frame_rx = proc->frame_rx; - int frame_tx = proc->frame_tx; - int subframe_rx = proc->subframe_rx; - int subframe_tx = proc->subframe_tx; - UE_L2_STATE_t ret; - int slot; - - if (ue->mac_enabled == 0) { - ue->UE_mode[eNB_id]=PUSCH; - } - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,1); - - if ( LOG_DEBUGFLAG(UE_TIMING)) { - start_meas(&ue->phy_proc[ue->current_thread_id[subframe_rx]]); - } - do { - // Checks if a message has been sent to PHY sub-task - itti_poll_msg (TASK_PHY_UE, &msg_p); - - if (msg_p != NULL) { - switch (ITTI_MSG_ID(msg_p)) { - case PHY_FIND_CELL_REQ: - LOG_I(PHY, "[UE ] Received %s\n", ITTI_MSG_NAME (msg_p)); - /* TODO process the message */ - break; - - default: - LOG_E(PHY, "[UE %ld] Received unexpected message %s\n", ITTI_MSG_DESTINATION_INSTANCE (msg_p), ITTI_MSG_NAME (msg_p)); - break; - } - - result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - } - } while(msg_p != NULL); - - for (slot=0; slot<2; slot++) { - if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_UL)|| - (ue->frame_parms.frame_type == FDD)) { - phy_procedures_UE_TX(ue,proc,eNB_id,abstraction_flag,mode); - } - - if ((subframe_select(&ue->frame_parms,subframe_rx)==SF_DL) || - (ue->frame_parms.frame_type == FDD)) { - phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode); - } - - if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_S) && - (slot==1)) { - phy_procedures_UE_S_TX(ue,eNB_id,abstraction_flag); - } - - if ((subframe_select(&ue->frame_parms,subframe_rx)==SF_S) && - (slot==0)) { - phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode); - } - - if (ue->mac_enabled==1) { - if (slot==0) { - //LOG_I(PHY,"[UE %d] Frame %d, subframe %d, star ue_scheduler\n", ue->Mod_id,frame_rx,subframe_tx); - ret = ue_scheduler(ue->Mod_id, - frame_rx, - subframe_rx, - frame_tx, - subframe_tx, - subframe_select(&ue->frame_parms,subframe_tx), - eNB_id, - 0/*FIXME CC_id*/); - - if (ret == CONNECTION_LOST) { - LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",ue->Mod_id, - frame_rx,subframe_tx); - ue->UE_mode[eNB_id] = PRACH; - // mac_xface->macphy_exit("Connection lost"); - } else if (ret == PHY_RESYNCH) { - LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, trying to resynch\n", - ue->Mod_id, - frame_rx,subframe_tx); - ue->UE_mode[eNB_id] = RESYNCH; - // mac_xface->macphy_exit("Connection lost"); - } else if (ret == PHY_HO_PRACH) { - LOG_I(PHY,"[UE %d] Frame %d, subframe %d, return to PRACH and perform a contention-free access\n", - ue->Mod_id,frame_rx,subframe_tx); - ue->UE_mode[eNB_id] = PRACH; - } - } - } - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,0); - - if (LOG_DEBUGFLAG(UE_TIMING)) { - stop_meas(&ue->phy_proc[ue->current_thread_id[subframe_rx]]); - } - } // slot -} diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index b46bba2492..9b37853ed2 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -3175,7 +3175,8 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const size_t num_plmn_data = sizeof(plmn_data) / sizeof(plmn_data[0]); for (size_t plmn_ind = 0;; ++plmn_ind) { if (plmn_ind == num_plmn_data) { - LOG_E( RRC, "Did not find name from internal table for %u %u\n", mcc, mnc); + LOG_W( RRC, "Did not find operator name from internal table for MCC %0*d, MNC %0*d\n", + mccdigits, mcc, mncdigits, mnc); break; } if ((plmn_data[plmn_ind].mcc == mcc) && (plmn_data[plmn_ind].mnc == mnc)) { diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c index 013e542689..dc5eab2f34 100644 --- a/targets/ARCH/rfsimulator/simulator.c +++ b/targets/ARCH/rfsimulator/simulator.c @@ -117,7 +117,7 @@ typedef struct buffer_s { typedef struct { int listen_sock, epollfd; - openair0_timestamp nextTimestamp; + openair0_timestamp nextRxTstamp; openair0_timestamp lastWroteTS; uint64_t typeStamp; char *ip; @@ -196,7 +196,7 @@ static void removeCirBuf(rfsimulator_state_t *bridge, int sock) { free(bridge->buf[sock].circularBuf); // Fixme: no free_channel_desc_scm(bridge->buf[sock].channel_model) implemented // a lot of mem leaks - free(bridge->buf[sock].channel_model); + //free(bridge->buf[sock].channel_model); memset(&bridge->buf[sock], 0, sizeof(buffer_t)); bridge->buf[sock].conn_sock=-1; } @@ -429,8 +429,6 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp if (!alreadyLocked) pthread_mutex_lock(&Sockmutex); - LOG_D(HW,"sending %d samples at time: %ld\n", nsamps, timestamp); - for (int i=0; ibuf[i]; @@ -549,14 +547,14 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi (t->typeStamp == ENB_MAGICDL && b->th.magic==UE_MAGICDL), "Socket Error in protocol"); b->headerMode=false; - if ( t->nextTimestamp == 0 ) { // First block in UE, resync with the eNB current TS - t->nextTimestamp=b->th.timestamp> nsamps_for_initial ? + if ( t->nextRxTstamp == 0 ) { // First block in UE, resync with the eNB current TS + t->nextRxTstamp=b->th.timestamp> nsamps_for_initial ? b->th.timestamp - nsamps_for_initial : 0; b->lastReceivedTS=b->th.timestamp> nsamps_for_initial ? b->th.timestamp : nsamps_for_initial; - LOG_W(HW,"UE got first timestamp: starting at %lu\n", t->nextTimestamp); + LOG_W(HW,"UE got first timestamp: starting at %lu\n", t->nextRxTstamp); b->trashingPacket=true; } else if ( b->lastReceivedTS < b->th.timestamp) { int nbAnt= b->th.nbAnt; @@ -623,7 +621,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest } rfsimulator_state_t *t = device->priv; - LOG_D(HW, "Enter rfsimulator_read, expect %d samples, will release at TS: %ld\n", nsamps, t->nextTimestamp+nsamps); + LOG_D(HW, "Enter rfsimulator_read, expect %d samples, will release at TS: %ld\n", nsamps, t->nextRxTstamp+nsamps); // deliver data from received data // check if a UE is connected int first_sock; @@ -634,54 +632,22 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest if ( first_sock == FD_SETSIZE ) { // no connected device (we are eNB, no UE is connected) - if ( t->nextTimestamp == 0) + if ( t->nextRxTstamp == 0) LOG_W(HW,"No connected device, generating void samples...\n"); if (!flushInput(t, 10, nsamps)) { for (int x=0; x < nbAnt; x++) memset(samplesVoid[x],0,sampleToByte(nsamps,1)); - t->nextTimestamp+=nsamps; + t->nextRxTstamp+=nsamps; - if ( ((t->nextTimestamp/nsamps)%100) == 0) - LOG_D(HW,"No UE, Generated void samples for Rx: %ld\n", t->nextTimestamp); + if ( ((t->nextRxTstamp/nsamps)%100) == 0) + LOG_D(HW,"No UE, Generated void samples for Rx: %ld\n", t->nextRxTstamp); - *ptimestamp = t->nextTimestamp-nsamps; + *ptimestamp = t->nextRxTstamp-nsamps; return nsamps; } } else { - pthread_mutex_lock(&Sockmutex); - - if ( t->nextTimestamp > 0 && t->lastWroteTS < t->nextTimestamp) { - pthread_mutex_unlock(&Sockmutex); - usleep(10000); - pthread_mutex_lock(&Sockmutex); - - if ( t->lastWroteTS < t->nextTimestamp ) { - // Assuming Tx is not done fully in another thread - // We can never write is the past from the received time - // So, the node perform receive but will never write these symbols - // let's tell this to the opposite node - // We send timestamp for nb samples required - // assuming this should have been done earlier if a Tx would exist - pthread_mutex_unlock(&Sockmutex); - struct complex16 v= {0}; - void *dummyS[t->tx_num_channels]; - - for ( int i=0; i < t->tx_num_channels; i++) - dummyS[i]=(void *)&v; - - LOG_I(HW, "No samples Tx occured, so we send 1 sample to notify it: Tx:%lu, Rx:%lu\n", - t->lastWroteTS, t->nextTimestamp); - rfsimulator_write_internal(t, t->nextTimestamp, - dummyS, 1, - t->tx_num_channels, 1, true); - } else { - pthread_mutex_unlock(&Sockmutex); - LOG_W(HW, "trx_write came from another thread\n"); - } - } else - pthread_mutex_unlock(&Sockmutex); bool have_to_wait; @@ -692,7 +658,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest buffer_t *b=&t->buf[sock]; if ( b->circularBuf ) - if ( t->nextTimestamp+nsamps > b->lastReceivedTS ) { + if ( t->nextRxTstamp+nsamps > b->lastReceivedTS ) { have_to_wait=true; break; } @@ -701,7 +667,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest if (have_to_wait) /*printf("Waiting on socket, current last ts: %ld, expected at least : %ld\n", ptr->lastReceivedTS, - t->nextTimestamp+nsamps); + t->nextRxTstamp+nsamps); */ flushInput(t, 3, nsamps); } while (have_to_wait); @@ -732,7 +698,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest a, ptr->channel_model, nsamps, - t->nextTimestamp, + t->nextRxTstamp, CirSize ); else { // no channel modeling @@ -747,8 +713,8 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest //LOG_I(HW, "nbAnt_tx %d\n",nbAnt_tx); for (int i=0; i < nsamps; i++) {//loop over nsamps for (int a_tx=0; a_txcircularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].r*H_awgn_mimo[a][a_tx]); - out[i].i += (short)(ptr->circularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].i*H_awgn_mimo[a][a_tx]); + out[i].r += (short)(ptr->circularBuf[((t->nextRxTstamp+i)*nbAnt_tx+a_tx)%CirSize].r*H_awgn_mimo[a][a_tx]); + out[i].i += (short)(ptr->circularBuf[((t->nextRxTstamp+i)*nbAnt_tx+a_tx)%CirSize].i*H_awgn_mimo[a][a_tx]); } // end for a_tx } // end for i (number of samps) } // end of no channel modeling @@ -756,11 +722,11 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest } } - *ptimestamp = t->nextTimestamp; // return the time of the first sample - t->nextTimestamp+=nsamps; + *ptimestamp = t->nextRxTstamp; // return the time of the first sample + t->nextRxTstamp+=nsamps; LOG_D(HW,"Rx to upper layer: %d from %ld to %ld, energy in first antenna %d\n", nsamps, - *ptimestamp, t->nextTimestamp, + *ptimestamp, t->nextRxTstamp, signal_energy(samplesVoid[0], nsamps)); return nsamps; } diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 66ce6ef247..f6cf51f101 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -733,7 +733,7 @@ void tx_rf(RU_t *ru, int sf_extension = 0; if ((SF_type == SF_DL) || - (SF_type == SF_S)) { + (SF_type == SF_S) ) { int siglen=fp->samples_per_tti,flags=1; if (SF_type == SF_S) { @@ -831,6 +831,23 @@ void tx_rf(RU_t *ru, late_control=STATE_BURST_TERMINATE; LOG_E(PHY,"TX : Timeout (sent %d/%d) state =%d\n",txs, siglen,late_control); } + } else if (IS_SOFTMODEM_RFSIM ) { + // in case of rfsim, we always enable tx because we need to feed rx of the opposite side + // we write 1 single I/Q sample to trigger Rx (rfsim will fill gaps with 0 I/Q) + void *dummy_tx[ru->frame_parms->nb_antennas_tx]; + for (int i=0; iframe_parms->nb_antennas_tx; i++) + dummy_tx[i]=malloc16_clear(4); + + AssertFatal( 1 == + ru->rfdevice.trx_write_func(&ru->rfdevice, + timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension, + dummy_tx, + 1, + ru->frame_parms->nb_antennas_tx, + 4),""); + + for (int i=0; iframe_parms->nb_antennas_tx; i++) + free(dummy_tx[i]); } } diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 0267ad8ce0..1c887dd3c8 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -49,7 +49,6 @@ {"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ {"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ {"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ - {"loop-memory", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \ {"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \ } #define CMDLINE_CALIBUERX_IDX 0 diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 8cdef647ca..089941c7df 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -276,7 +276,6 @@ uint16_t node_number; static void get_options(void) { int CC_id=0; int tddflag=0; - char *loopfile=NULL; int dumpframe=0; int timingadv=0; uint8_t nfapi_mode = NFAPI_MONOLITHIC; @@ -293,14 +292,6 @@ static void get_options(void) { config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL); nfapi_setmode(nfapi_mode); - - if (loopfile != NULL) { - printf("Input file for hardware emulation: %s",loopfile); - mode=loop_through_memory; - input_fd = fopen(loopfile,"r"); - AssertFatal(input_fd != NULL,"Please provide a valid input file\n"); - } - get_softmodem_params()->hw_timing_advance = timingadv; if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue; From f2e6537195b2bb553f291c914923da0f7a9f8ecf Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Sun, 10 Apr 2022 22:11:37 +0200 Subject: [PATCH 10/39] roolback regression --- openair1/PHY/defs_UE.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h index a634a0d585..4f9bc076ff 100644 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -168,6 +168,19 @@ typedef struct { struct sched_param sched_param_ue; /// pthread descriptor main UE thread pthread_t pthread_ue; + /// \brief Instance count for synch thread. + /// \internal This variable is protected by \ref mutex_synch. + int instance_cnt_synch; + /// pthread attributes for synch processing thread + pthread_attr_t attr_synch; + /// scheduling parameters for synch thread + struct sched_param sched_param_synch; + /// pthread descriptor synch thread + pthread_t pthread_synch; + /// condition variable for UE synch thread; + pthread_cond_t cond_synch; + /// mutex for UE synch thread + pthread_mutex_t mutex_synch; /// instance count for eNBs int instance_cnt_eNBs; /// set of scheduling variables RXn-TXnp4 threads From b860d76cd62ecdb1dba5d8743482cd92c3a2f09e Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 11 Apr 2022 09:39:16 +0200 Subject: [PATCH 11/39] fix lte-ue.c main loop with 5G common vars --- targets/RT/USER/lte-ue.c | 1003 ++++++++++++++++++-------------------- 1 file changed, 482 insertions(+), 521 deletions(-) diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 9010a40bf9..8565e36e87 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -87,7 +87,7 @@ extern void multicast_link_start(void (*rx_handlerP) (unsigned int, char *), extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP); -int tx_req_num_elems; +int tx_req_num_elems; extern uint16_t sf_ahead; //extern int tx_req_UE_MAC1(); @@ -176,6 +176,7 @@ PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, { PHY_VARS_UE *ue = (PHY_VARS_UE *)calloc(1,sizeof(PHY_VARS_UE)); AssertFatal(ue,""); + if (frame_parms!=(LTE_DL_FRAME_PARMS *)NULL) { // if we want to give initial frame parms, allocate the PHY_VARS_UE structure and put them in memcpy(&(ue->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS)); } @@ -204,8 +205,7 @@ void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_t *cpuset, - char *name) -{ + char *name) { #ifdef DEADLINE_SCHEDULER if (sched_runtime!=0) { @@ -266,8 +266,7 @@ void init_UE(int nb_inst, runmode_t mode, int rxgain, int txpowermax, - LTE_DL_FRAME_PARMS *fp0) -{ + LTE_DL_FRAME_PARMS *fp0) { PHY_VARS_UE *UE; int inst; int ret; @@ -283,9 +282,7 @@ void init_UE(int nb_inst, if (PHY_vars_UE_g[inst]==NULL) PHY_vars_UE_g[inst] = (PHY_VARS_UE **)calloc(1+MAX_NUM_CCs,sizeof(PHY_VARS_UE *)); LOG_I(PHY,"Allocating UE context %d\n",inst); - PHY_vars_UE_g[inst][0] = init_ue_vars(fp0,inst,0); - // turn off timing control loop in UE PHY_vars_UE_g[inst][0]->no_timing_correction = timing_correction; UE = PHY_vars_UE_g[inst][0]; @@ -362,7 +359,6 @@ void init_UE(int nb_inst, LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]); init_UE_threads(inst); - ret = openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]); if (ret !=0) { @@ -385,8 +381,7 @@ void init_UE(int nb_inst, void init_UE_stub_single_thread(int nb_inst, int eMBMS_active, int uecap_xer_in, - char *emul_iface) -{ + char *emul_iface) { int inst; LOG_I(PHY,"UE : Calling Layer 2 for initialization, nb_inst: %d \n", nb_inst); l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL, @@ -411,24 +406,23 @@ void init_UE_stub_single_thread(int nb_inst, } } -void init_UE_standalone_thread(int ue_idx) -{ +void init_UE_standalone_thread(int ue_idx) { int standalone_tx_port = 3211 + ue_idx * 2; int standalone_rx_port = 3212 + ue_idx * 2; ue_init_standalone_socket(standalone_tx_port, standalone_rx_port); - pthread_t thread; + if (pthread_create(&thread, NULL, ue_standalone_pnf_task, NULL) != 0) { LOG_E(MAC, "pthread_create failed for calling ue_standalone_pnf_task"); } + pthread_setname_np(thread, "oai:ue-stand"); } void init_UE_stub(int nb_inst, int eMBMS_active, int uecap_xer_in, - char *emul_iface) -{ + char *emul_iface) { int inst; LOG_I(PHY,"UE : Calling Layer 2 for initialization\n"); l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL, @@ -462,8 +456,7 @@ void init_UE_stub(int nb_inst, * \returns a pointer to an int. The storage is not on the heap and must not be freed. */ -static void *UE_thread_synch(void *arg) -{ +static void *UE_thread_synch(void *arg) { static int UE_thread_synch_retval; int i ; PHY_VARS_UE *UE = (PHY_VARS_UE *) arg; @@ -478,6 +471,7 @@ static void *UE_thread_synch(void *arg) printf("UE_thread_sync in with PHY_vars_UE %p\n",arg); cpu_set_t cpuset; CPU_ZERO(&cpuset); + if ( threads.sync != -1 ) CPU_SET(threads.sync, &cpuset); @@ -757,8 +751,7 @@ static void *UE_thread_synch(void *arg) * \param arg is a pointer to a \ref PHY_VARS_UE structure. * \returns a pointer to an int. The storage is not on the heap and must not be freed. */ -const char *get_connectionloss_errstr(int errcode) -{ +const char *get_connectionloss_errstr(int errcode) { switch (errcode) { case CONNECTION_LOST: return "RRC Connection lost, returning to PRACH"; @@ -773,8 +766,7 @@ const char *get_connectionloss_errstr(int errcode) return "UNKNOWN RETURN CODE"; } -static void *UE_thread_rxn_txnp4(void *arg) -{ +static void *UE_thread_rxn_txnp4(void *arg) { static __thread int UE_thread_rxtx_retval; struct rx_tx_thread_data *rtd = arg; UE_rxtx_proc_t *proc = rtd->proc; @@ -867,13 +859,11 @@ static void *UE_thread_rxn_txnp4(void *arg) if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) || (UE->frame_parms.frame_type == FDD) ) - if (UE->mode != loop_through_memory) - phy_procedures_UE_TX(UE,proc,0,0,UE->mode); + phy_procedures_UE_TX(UE,proc,0,0,UE->mode); if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_S) && (UE->frame_parms.frame_type == TDD)) - if (UE->mode != loop_through_memory) - phy_procedures_UE_S_TX(UE,0,0); + phy_procedures_UE_S_TX(UE,0,0); proc->instance_cnt_rxtx--; @@ -895,8 +885,7 @@ static void *UE_thread_rxn_txnp4(void *arg) unsigned int emulator_absSF; void ue_stub_rx_handler(unsigned int num_bytes, - char *rx_buffer) -{ + char *rx_buffer) { PHY_VARS_UE *UE; UE = PHY_vars_UE_g[0][0]; UE_tport_t *pdu = (UE_tport_t *)rx_buffer; @@ -951,14 +940,14 @@ void ue_stub_rx_handler(unsigned int num_bytes, } } -uint64_t clock_usec(void) -{ - struct timespec t; - if (clock_gettime(CLOCK_MONOTONIC, &t) == -1) - { - abort(); - } - return (uint64_t)t.tv_sec * 1000000 + (t.tv_nsec / 1000); +uint64_t clock_usec(void) { + struct timespec t; + + if (clock_gettime(CLOCK_MONOTONIC, &t) == -1) { + abort(); + } + + return (uint64_t)t.tv_sec * 1000000 + (t.tv_nsec / 1000); } /*! * \brief This is the UE thread for RX subframe n and TX subframe n+4. @@ -968,23 +957,21 @@ uint64_t clock_usec(void) * \returns a pointer to an int. The storage is not on the heap and must not be freed. */ -static void *UE_phy_stub_standalone_pnf_task(void *arg) -{ +static void *UE_phy_stub_standalone_pnf_task(void *arg) { #if 1 { struct sched_param sparam = { .sched_priority = 79, }; - if (pthread_setschedparam(pthread_self(), SCHED_RR, &sparam) != 0) - { + + if (pthread_setschedparam(pthread_self(), SCHED_RR, &sparam) != 0) { LOG_E(PHY,"pthread_setschedparam: %s\n", strerror(errno)); } } #else thread_top_init("UE_phy_stub_thread_rxn_txnp4", 1, 870000L, 1000000L, 1000000L); #endif - // for multipule UE's L2-emulator //module_id_t Mod_id = 0; //int init_ra_UE = -1; // This counter is used to initiate the RA of each UE in different SFrames @@ -1004,9 +991,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) PHY_VARS_UE *UE = NULL; int ret; proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0]; - UE = rtd->UE; - UL_INFO = (UL_IND_t *)calloc(1, sizeof(UL_IND_t)); UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NFAPI_RX_IND_MAX_PDU, sizeof(nfapi_rx_indication_pdu_t)); UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; @@ -1019,19 +1004,15 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = calloc(NFAPI_CQI_IND_MAX_PDU, sizeof(nfapi_cqi_indication_pdu_t)); UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = calloc(NFAPI_CQI_IND_MAX_PDU, sizeof(nfapi_cqi_indication_raw_pdu_t)); UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0; - proc->subframe_rx = proc->sub_frame_start; proc->subframe_tx = -1; proc->frame_rx = -1; proc->frame_tx = -1; // Initializations for nfapi-L2-emulator mode sync_var = 0; - //PANOS: CAREFUL HERE! wait_sync("UE_phy_stub_standalone_pnf_task"); - int last_sfn_sf = -1; - LOG_I(MAC, "Clearing Queues\n"); reset_queue(&dl_config_req_tx_req_queue); reset_queue(&ul_config_req_queue); @@ -1039,72 +1020,77 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) while (!oai_exit) { bool sent_any = false; + if (sem_wait(&sfn_semaphore) != 0) { LOG_E(MAC, "sem_wait() error\n"); abort(); } int sfn_sf = current_sfn_sf; - if (sfn_sf == last_sfn_sf) - { + + if (sfn_sf == last_sfn_sf) { LOG_W(MAC, "repeated sfn_sf = %d.%d\n", sfn_sf >> 4, sfn_sf & 15); continue; } - last_sfn_sf = sfn_sf; + last_sfn_sf = sfn_sf; nfapi_dl_config_req_tx_req_t *dl_config_req_tx_req = get_queue(&dl_config_req_tx_req_queue); nfapi_ul_config_request_t *ul_config_req = get_queue(&ul_config_req_queue); nfapi_hi_dci0_request_t *hi_dci0_req = get_queue(&hi_dci0_req_queue); - LOG_I(MAC, "received from proxy frame %d subframe %d\n", NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); if (ul_config_req != NULL) { uint8_t ul_num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; + if (ul_num_pdus > 0) { char *ul_str = nfapi_ul_config_req_to_string(ul_config_req); LOG_I(MAC, "ul_config_req: %s\n", ul_str); free(ul_str); } } + if (hi_dci0_req != NULL) { LOG_D(MAC, "hi_dci0_req pdus: %u Frame: %d Subframe: %d\n", - hi_dci0_req->hi_dci0_request_body.number_of_dci, - NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf)); + hi_dci0_req->hi_dci0_request_body.number_of_dci, + NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf)); } if (dl_config_req_tx_req != NULL) { - nfapi_tx_req_pdu_list_t *tx_req_pdu_list = dl_config_req_tx_req->tx_req_pdu_list; nfapi_dl_config_request_t *dl_config_req = dl_config_req_tx_req->dl_config_req; - uint16_t dl_num_pdus = dl_config_req->dl_config_request_body.number_pdu; LOG_I(MAC, "(OAI UE) Received dl_config_req from proxy at Frame: %d, Subframe: %d," " with number of PDUs: %u\n", NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_num_pdus); + if (dl_num_pdus > 0) { char *dl_str = nfapi_dl_config_req_to_string(dl_config_req); LOG_I(MAC, "dl_config_req: %s\n", dl_str); free(dl_str); } - LOG_D(MAC, "tx_req pdus: %d\n", tx_req_pdu_list->num_pdus); + LOG_D(MAC, "tx_req pdus: %d\n", tx_req_pdu_list->num_pdus); // Handling dl_config_req and tx_req: nfapi_dl_config_request_body_t *dl_config_req_body = &dl_config_req->dl_config_request_body; + for (int i = 0; i < dl_config_req_body->number_pdu; ++i) { nfapi_dl_config_request_pdu_t *pdu = &dl_config_req_body->dl_config_pdu_list[i]; + if (pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) { i += 1; AssertFatal(i < dl_config_req->dl_config_request_body.number_pdu, "Need PDU following DCI at index %d, but not found\n", i); nfapi_dl_config_request_pdu_t *dlsch = &dl_config_req_body->dl_config_pdu_list[i]; + if (dlsch->pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) { LOG_E(MAC, "expected DLSCH PDU at index %d\n", i); continue; } + dl_config_req_UE_MAC_dci(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf), pdu, @@ -1125,8 +1111,10 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) } } } + if (hi_dci0_req) { nfapi_hi_dci0_request_body_t *hi_dci0_body = &hi_dci0_req->hi_dci0_request_body; + for (int i = 0; i < hi_dci0_body->number_of_dci + hi_dci0_body->number_of_hi; i++) { nfapi_hi_dci0_request_pdu_t *pdu = &hi_dci0_body->hi_dci0_pdu_list[i]; hi_dci0_req_UE_MAC(NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), @@ -1139,13 +1127,13 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) for (ue_index = 0; ue_index < ue_num; ue_index++) { ue_Mod_id = ue_thread_id + NB_THREAD_INST * ue_index; // Always 0 in standalone pnf mode UE = PHY_vars_UE_g[ue_Mod_id][0]; - #if UE_TIMING_TRACE start_meas(&UE->generic_stat); #endif int rx_frame = NFAPI_SFNSF2SF(sfn_sf) < 4 ? (NFAPI_SFNSF2SFN(sfn_sf) + 1023) % 1024 : NFAPI_SFNSF2SFN(sfn_sf); // subtracting 4 from subframe_tx int rx_subframe = NFAPI_SFNSF2SF(sfn_sf) < 4 ? NFAPI_SFNSF2SF(sfn_sf) + 6 : NFAPI_SFNSF2SF(sfn_sf) - 4; LOG_D(MAC, "rx_frame %d rx_subframe %d\n", rx_frame, rx_subframe); + if (UE->mac_enabled == 1) { ret = ue_scheduler(ue_Mod_id, rx_frame, @@ -1168,178 +1156,171 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) // Prepare the future Tx data if ((subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)) == SF_UL) || - (UE->frame_parms.frame_type == FDD)) - { - if (UE->mode != loop_through_memory) - { - // We make the start of RA between consecutive UEs differ by 20 frames - //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && rx_frame >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { - if (UE_mac_inst[ue_Mod_id].UE_mode[0] == RA_RESPONSE && - is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf))) - { - UE_mac_inst[ue_Mod_id].UE_mode[0] = PRACH; - } - LOG_D(MAC, "UE_mode: %d\n", UE_mac_inst[ue_Mod_id].UE_mode[0]); - if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH) - { //&& ue_Mod_id == next_Mod_id) { - next_ra_frame++; - if (next_ra_frame > 500) - { - // check if we have PRACH opportunity - if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) - { - // The one working strangely... - //if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) { - PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf)); - if (prach_resources != NULL) - { - LOG_I(MAC, "preamble_received_tar_power: %d\n", - prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER); - UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf); - LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); - fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); - sent_any = true; - Msg1_transmitted(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0); - UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; - next_Mod_id = ue_Mod_id + 1; - //next_ra_frame = (rx_frame + 20)%1000; - next_ra_frame = 0; - } - //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); + (UE->frame_parms.frame_type == FDD)) { + // We make the start of RA between consecutive UEs differ by 20 frames + //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && rx_frame >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { + if (UE_mac_inst[ue_Mod_id].UE_mode[0] == RA_RESPONSE && + is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf))) { + UE_mac_inst[ue_Mod_id].UE_mode[0] = PRACH; + } + + LOG_D(MAC, "UE_mode: %d\n", UE_mac_inst[ue_Mod_id].UE_mode[0]); + + if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH) { + //&& ue_Mod_id == next_Mod_id) { + next_ra_frame++; + + if (next_ra_frame > 500) { + // check if we have PRACH opportunity + if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) { + // The one working strangely... + //if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) { + PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf)); + + if (prach_resources != NULL) { + LOG_I(MAC, "preamble_received_tar_power: %d\n", + prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER); + UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf); + LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); + fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); + sent_any = true; + Msg1_transmitted(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0); + UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; + next_Mod_id = ue_Mod_id + 1; + //next_ra_frame = (rx_frame + 20)%1000; + next_ra_frame = 0; } + + //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); } - } // mode is PRACH - - // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger - // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). - // Generate UL_indications which correspond to UL traffic. - if (ul_config_req != NULL) - { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ - ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id); } - } + } // mode is PRACH - phy_procedures_UE_SL_RX(UE, proc); - } - else - { - LOG_I(MAC, "Skipping subframe select statement proxy SFN.SF: %d.%d\n", - NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); - if (ul_config_req != NULL) - { - LOG_I(MAC, "Skipping subframe select statement ul_config_req SFN.SF: %d.%d\n", - NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf)); + // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger + // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). + // Generate UL_indications which correspond to UL traffic. + if (ul_config_req != NULL) { + //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ + ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id); } } - } //for (Mod_id=0; Mod_idcrc_ind.crc_indication_body.number_of_crcs > 0) { - //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf)); - //LOG_I(MAC, "ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs); - send_standalone_msg(UL_INFO, UL_INFO->crc_ind.header.message_id); - sent_any = true; - //LOG_I(MAC, "ul_config_req_UE_MAC 2.21 \n"); - UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0; - } + phy_procedures_UE_SL_RX(UE, proc); + } else { + LOG_I(MAC, "Skipping subframe select statement proxy SFN.SF: %d.%d\n", + NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); - if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus > 0) { - - //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf)); - //LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus); - send_standalone_msg(UL_INFO, UL_INFO->rx_ind.header.message_id); - sent_any = true; - - //LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n"); - UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; - } - - if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) { - send_standalone_msg(UL_INFO, UL_INFO->cqi_ind.header.message_id); - sent_any = true; - UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0; - } - - if (UL_INFO->harq_ind.harq_indication_body.number_of_harqs > 0) { - //LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs); - send_standalone_msg(UL_INFO, UL_INFO->harq_ind.header.message_id); - sent_any = true; - //LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n"); - UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0; - } - - if (UL_INFO->sr_ind.sr_indication_body.number_of_srs > 0) { - //LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs); - send_standalone_msg(UL_INFO, UL_INFO->sr_ind.header.message_id); - sent_any = true; - //LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n"); - UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; - } - - // De-allocate memory of nfapi requests copies before next subframe round - if (dl_config_req_tx_req != NULL) { - if (dl_config_req_tx_req->dl_config_req->vendor_extension != NULL) { - free(dl_config_req_tx_req->dl_config_req->vendor_extension); - dl_config_req_tx_req->dl_config_req->vendor_extension = NULL; + if (ul_config_req != NULL) { + LOG_I(MAC, "Skipping subframe select statement ul_config_req SFN.SF: %d.%d\n", + NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf)); } - - if (dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list != NULL) { - free(dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list); - dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL; - } - nfapi_free_tx_req_pdu_list(dl_config_req_tx_req->tx_req_pdu_list); - dl_config_req_tx_req->tx_req_pdu_list = NULL; - - free(dl_config_req_tx_req->dl_config_req); - dl_config_req_tx_req->dl_config_req = NULL; - - free(dl_config_req_tx_req); - dl_config_req_tx_req = NULL; } + } //for (Mod_id=0; Mod_idul_config_request_body.ul_config_pdu_list != NULL) { - free(ul_config_req->ul_config_request_body.ul_config_pdu_list); - ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; - } - - free(ul_config_req); - ul_config_req = NULL; - } - - if (hi_dci0_req != NULL) { - if (hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list != NULL) { - free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list); - hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL; - } - - free(hi_dci0_req); - hi_dci0_req = NULL; - } - if (!sent_any) - { - send_standalone_dummy(); - } + if (UL_INFO->crc_ind.crc_indication_body.number_of_crcs > 0) { + //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf)); + //LOG_I(MAC, "ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs); + send_standalone_msg(UL_INFO, UL_INFO->crc_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.21 \n"); + UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0; } - // Free UL_INFO messages - free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list); - UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL; - free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list); - UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL; - free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list); - UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL; - free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list); - UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL; - free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list); - UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL; - free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list); - UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL; - free(UL_INFO); - UL_INFO = NULL; + if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus > 0) { + //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf)); + //LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus); + send_standalone_msg(UL_INFO, UL_INFO->rx_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n"); + UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; + } - // thread finished - free(arg); - return NULL; + if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) { + send_standalone_msg(UL_INFO, UL_INFO->cqi_ind.header.message_id); + sent_any = true; + UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0; + } + + if (UL_INFO->harq_ind.harq_indication_body.number_of_harqs > 0) { + //LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs); + send_standalone_msg(UL_INFO, UL_INFO->harq_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n"); + UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0; + } + + if (UL_INFO->sr_ind.sr_indication_body.number_of_srs > 0) { + //LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs); + send_standalone_msg(UL_INFO, UL_INFO->sr_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n"); + UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; + } + + // De-allocate memory of nfapi requests copies before next subframe round + if (dl_config_req_tx_req != NULL) { + if (dl_config_req_tx_req->dl_config_req->vendor_extension != NULL) { + free(dl_config_req_tx_req->dl_config_req->vendor_extension); + dl_config_req_tx_req->dl_config_req->vendor_extension = NULL; + } + + if (dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list != NULL) { + free(dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list); + dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL; + } + + nfapi_free_tx_req_pdu_list(dl_config_req_tx_req->tx_req_pdu_list); + dl_config_req_tx_req->tx_req_pdu_list = NULL; + free(dl_config_req_tx_req->dl_config_req); + dl_config_req_tx_req->dl_config_req = NULL; + free(dl_config_req_tx_req); + dl_config_req_tx_req = NULL; + } + + if (ul_config_req != NULL) { + if (ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) { + free(ul_config_req->ul_config_request_body.ul_config_pdu_list); + ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; + } + + free(ul_config_req); + ul_config_req = NULL; + } + + if (hi_dci0_req != NULL) { + if (hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list != NULL) { + free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list); + hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL; + } + + free(hi_dci0_req); + hi_dci0_req = NULL; + } + + if (!sent_any) { + send_standalone_dummy(); + } +} + +// Free UL_INFO messages +free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list); +UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL; +free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list); +UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL; +free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list); +UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL; +free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list); +UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL; +free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list); +UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL; +free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list); +UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL; +free(UL_INFO); +UL_INFO = NULL; + +// thread finished +free(arg); +return NULL; } /*! @@ -1350,8 +1331,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) * \returns a pointer to an int. The storage is not on the heap and must not be freed. */ -static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) -{ +static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { #if 0 // TODO: doesn't currently compile, obviated by multi-ue proxy thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L); // for multipule UE's L2-emulator @@ -1377,7 +1357,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0]; phy_stub_ticking->num_single_thread[ue_thread_id] = -1; UE = rtd->UE; - UL_INFO = (UL_IND_t *)malloc(sizeof(UL_IND_t)); UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_rx_indication_pdu_t)); UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; @@ -1489,19 +1468,23 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) } if (dl_config_req && tx_req_pdu_list) { - nfapi_dl_config_request_body_t* dl_config_req_body = &dl_config_req->dl_config_request_body; + nfapi_dl_config_request_body_t *dl_config_req_body = &dl_config_req->dl_config_request_body; + for (int i = 0; i < dl_config_req_body->number_pdu; ++i) { - nfapi_dl_config_request_pdu_t* pdu = &dl_config_req_body->dl_config_pdu_list[i]; + nfapi_dl_config_request_pdu_t *pdu = &dl_config_req_body->dl_config_pdu_list[i]; + if (pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) { i += 1; AssertFatal(i < dl_config_req->dl_config_request_body.number_pdu, "Need PDU following DCI at index %d, but not found\n", i); nfapi_dl_config_request_pdu_t *dlsch = &dl_config_req_body->dl_config_pdu_list[i]; + if (dlsch->pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) { LOG_E(MAC, "expected DLSCH PDU at index %d\n", i); continue; } + dl_config_req_UE_MAC_dci(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf), pdu, @@ -1523,8 +1506,9 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) if (hi_dci0_req) { nfapi_hi_dci0_request_body_t *hi_dci0_body = &hi_dci0_req->hi_dci0_request_body; + for (int i = 0; i < hi_dci0_body->number_of_dci + hi_dci0_body->number_of_hi; i++) { - nfapi_hi_dci0_request_pdu_t* pdu = &hi_dci0_body->hi_dci0_pdu_list[i]; + nfapi_hi_dci0_request_pdu_t *pdu = &hi_dci0_body->hi_dci0_pdu_list[i]; hi_dci0_req_UE_MAC(NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf), pdu, @@ -1592,44 +1576,41 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) || (UE->frame_parms.frame_type == FDD) ) - if (UE->mode != loop_through_memory) { - // We make the start of RA between consecutive UEs differ by 20 frames - //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { - if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) { - next_ra_frame++; - if(next_ra_frame > 500) { - // check if we have PRACH opportunity - if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) { - // The one working strangely... - //if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) { - PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx); + // We make the start of RA between consecutive UEs differ by 20 frames + //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { + if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) { + next_ra_frame++; - if(prach_resources!=NULL ) { - UE_mac_inst[ue_Mod_id].ra_frame = proc->frame_rx; - LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id,proc->frame_tx, proc->subframe_tx); - fill_rach_indication_UE_MAC(ue_Mod_id, proc->frame_tx,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); - Msg1_transmitted(ue_Mod_id, 0, proc->frame_tx, 0); - UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; - next_Mod_id = ue_Mod_id + 1; - //next_ra_frame = (proc->frame_rx + 20)%1000; - next_ra_frame = 0; - } + if(next_ra_frame > 500) { + // check if we have PRACH opportunity + if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) { + // The one working strangely... + //if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) { + PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx); - //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); + if(prach_resources!=NULL ) { + UE_mac_inst[ue_Mod_id].ra_frame = proc->frame_rx; + LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id,proc->frame_tx, proc->subframe_tx); + fill_rach_indication_UE_MAC(ue_Mod_id, proc->frame_tx,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); + Msg1_transmitted(ue_Mod_id, 0, proc->frame_tx, 0); + UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; + next_Mod_id = ue_Mod_id + 1; + //next_ra_frame = (proc->frame_rx + 20)%1000; + next_ra_frame = 0; } + + //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); } - } // mode is PRACH - - // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger - // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). - // Generate UL_indications which correspond to UL traffic. - if(ul_config_req!=NULL) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ - ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, ue_Mod_id); } - } + } // mode is PRACH - phy_procedures_UE_SL_RX(UE,proc); + // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger + // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). + // Generate UL_indications which correspond to UL traffic. + if(ul_config_req!=NULL) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ + ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, ue_Mod_id); + } } //for (Mod_id=0; Mod_idnum_single_thread[ue_thread_id] = -1; @@ -1709,6 +1690,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) tx_req_pdu_list[i].segments[j].segment_data = NULL; } } + tx_req_num_elems = 0; free(tx_req_pdu_list); tx_req_pdu_list = NULL; @@ -1752,7 +1734,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) free(UL_INFO); UL_INFO = NULL; #endif // disabled UE_phy_stub_single_thread_rxn_txnp4 - // thread finished free(arg); return NULL; @@ -1767,9 +1748,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) * \returns a pointer to an int. The storage is not on the heap and must not be freed. */ -static void *UE_phy_stub_thread_rxn_txnp4(void *arg) -{ - #if 0 +static void *UE_phy_stub_thread_rxn_txnp4(void *arg) { +#if 0 thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L); module_id_t Mod_id = 0; static __thread int UE_thread_rxtx_retval; @@ -1880,45 +1860,42 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) || (UE->frame_parms.frame_type == FDD) ) - if (UE->mode != loop_through_memory) { - if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH) ) { - // check if we have PRACH opportunity - if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx)) { - PRACH_RESOURCES_t *prach_resources = ue_get_rach(Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx); + if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH) ) { + // check if we have PRACH opportunity + if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx)) { + PRACH_RESOURCES_t *prach_resources = ue_get_rach(Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx); - if(prach_resources!=NULL) { - fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); - Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0); - UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE; - } - - //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); - } - } // mode is PRACH - - // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger - // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). - // Generate UL_indications which correspond to UL traffic. - if(ul_config_req!= NULL && ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) { - //LOG_I(MAC, "UE_phy_stub_thread_rxn_txnp4 ul_config_req is not NULL \n"); - ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, Mod_id); - - if(ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) { - free(ul_config_req->ul_config_request_body.ul_config_pdu_list); - ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; + if(prach_resources!=NULL) { + fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); + Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0); + UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE; } - free(ul_config_req); - ul_config_req = NULL; - } else if(ul_config_req!=NULL) { - free(ul_config_req); - ul_config_req = NULL; + //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); } + } // mode is PRACH + + // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger + // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). + // Generate UL_indications which correspond to UL traffic. + if(ul_config_req!= NULL && ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) { + //LOG_I(MAC, "UE_phy_stub_thread_rxn_txnp4 ul_config_req is not NULL \n"); + ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, Mod_id); + + if(ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) { + free(ul_config_req->ul_config_request_body.ul_config_pdu_list); + ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; } - phy_procedures_UE_SL_RX(UE,proc); + free(ul_config_req); + ul_config_req = NULL; + } else if(ul_config_req!=NULL) { + free(ul_config_req); + ul_config_req = NULL; + } } - #endif // disabled + +#endif // disabled // thread finished free(arg); return NULL; //return &UE_thread_rxtx_retval; @@ -1940,20 +1917,19 @@ void write_dummy(PHY_VARS_UE *UE, openair0_timestamp timestamp) { // struct complex16 v= {0}; void *samplesVoid[UE->frame_parms.nb_antennas_tx]; - + for ( int i=0; i < UE->frame_parms.nb_antennas_tx; i++) samplesVoid[i]=(void *)&v; - + AssertFatal( 1 == UE->rfdevice.trx_write_func(&UE->rfdevice, - timestamp+2*UE->frame_parms.samples_per_tti, - samplesVoid, - 1, - UE->frame_parms.nb_antennas_tx, - 1),""); + timestamp+2*UE->frame_parms.samples_per_tti, + samplesVoid, + 1, + UE->frame_parms.nb_antennas_tx, + 1),""); } -void *UE_thread(void *arg) -{ +void *UE_thread(void *arg) { PHY_VARS_UE *UE = (PHY_VARS_UE *) arg; // int tx_enabled = 0; int dummy_rx[UE->frame_parms.nb_antennas_rx][UE->frame_parms.samples_per_tti] __attribute__((aligned(32))); @@ -1966,10 +1942,11 @@ void *UE_thread(void *arg) int ret; cpu_set_t cpuset; CPU_ZERO(&cpuset); + if ( threads.main != -1 ) CPU_SET(threads.main, &cpuset); - init_thread(100000, 500000, FIFO_PRIORITY, &cpuset, "UHD Threads"); + init_thread(100000, 500000, FIFO_PRIORITY, &cpuset, "UHD Threads"); /* while (sync_var<0) pthread_cond_wait(&sync_cond, &sync_mutex); @@ -1996,46 +1973,45 @@ void *UE_thread(void *arg) int instance_cnt_synch = UE->proc.instance_cnt_synch; int is_synchronized = UE->is_synchronized; AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), ""); - + if (is_synchronized == 0) { if (instance_cnt_synch < 0) { // we can invoke the synch - // we shift in time flow because the UE doesn't detect sync when frame alignment is not easy - for (int i=0; iframe_parms.nb_antennas_rx; i++) - rxp[i] = (void *)&dummy_rx[i][0]; - UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp, - rxp, - UE->frame_parms.samples_per_tti/2, - UE->frame_parms.nb_antennas_rx); - + // we shift in time flow because the UE doesn't detect sync when frame alignment is not easy + for (int i=0; iframe_parms.nb_antennas_rx; i++) + rxp[i] = (void *)&dummy_rx[i][0]; + + UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + rxp, + UE->frame_parms.samples_per_tti/2, + UE->frame_parms.nb_antennas_rx); + // grab 10 ms of signal and wakeup synch thread - - if (UE->mode != loop_through_memory) { - if (IS_SOFTMODEM_RFSIM ) { - for(int sf=0; sf<10; sf++) { - for (int i=0; iframe_parms.nb_antennas_rx; i++) - rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.samples_per_tti*sf]; - - AssertFatal(UE->frame_parms.samples_per_tti == UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp, - rxp, - UE->frame_parms.samples_per_tti, - UE->frame_parms.nb_antennas_rx), ""); - write_dummy(UE, timestamp); - } - } else { - for (int i=0; iframe_parms.nb_antennas_rx; i++) - rxp[i] = (void *)&UE->common_vars.rxdata[i][0]; - - AssertFatal( UE->frame_parms.samples_per_tti*10 == - UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp, - rxp, - UE->frame_parms.samples_per_tti*10, - UE->frame_parms.nb_antennas_rx), ""); - } - } + + if (IS_SOFTMODEM_RFSIM ) { + for(int sf=0; sf<10; sf++) { + for (int i=0; iframe_parms.nb_antennas_rx; i++) + rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.samples_per_tti*sf]; + + AssertFatal(UE->frame_parms.samples_per_tti == UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + rxp, + UE->frame_parms.samples_per_tti, + UE->frame_parms.nb_antennas_rx), ""); + write_dummy(UE, timestamp); + } + } else { + for (int i=0; iframe_parms.nb_antennas_rx; i++) + rxp[i] = (void *)&UE->common_vars.rxdata[i][0]; + + AssertFatal( UE->frame_parms.samples_per_tti*10 == + UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + rxp, + UE->frame_parms.samples_per_tti*10, + UE->frame_parms.nb_antennas_rx), ""); + } AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), ""); instance_cnt_synch = ++UE->proc.instance_cnt_synch; @@ -2049,69 +2025,62 @@ void *UE_thread(void *arg) AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), ""); } else { -#if OAISIM - (void)dummy_rx; /* avoid gcc warnings */ - usleep(500); -#else // grab 10 ms of signal into dummy buffer - if (UE->mode != loop_through_memory) { - for (int i=0; iframe_parms.nb_antennas_rx; i++) - rxp[i] = (void *)&dummy_rx[i][0]; + for (int i=0; iframe_parms.nb_antennas_rx; i++) + rxp[i] = (void *)&dummy_rx[i][0]; - for (int sf=0; sf<10; sf++) { - // printf("Reading dummy sf %d\n",sf); - UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp, - rxp, - UE->frame_parms.samples_per_tti, - UE->frame_parms.nb_antennas_rx); - if (IS_SOFTMODEM_RFSIM ) - write_dummy(UE, timestamp); - } - } -#endif + for (int sf=0; sf<10; sf++) { + // printf("Reading dummy sf %d\n",sf); + UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + rxp, + UE->frame_parms.samples_per_tti, + UE->frame_parms.nb_antennas_rx); + + if (IS_SOFTMODEM_RFSIM ) + write_dummy(UE, timestamp); + } } } // UE->is_synchronized==0 else { if (start_rx_stream==0) { start_rx_stream=1; - if (UE->mode != loop_through_memory) { - if (UE->no_timing_correction==0) { - LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode); - while ( UE->rx_offset ) { - size_t s=min(UE->rx_offset,UE->frame_parms.samples_per_tti); - AssertFatal(s == UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp, - (void **)UE->common_vars.rxdata, - s, - UE->frame_parms.nb_antennas_rx),""); - if (IS_SOFTMODEM_RFSIM ) - write_dummy(UE, timestamp); - UE->rx_offset-=s; - } + if (UE->no_timing_correction==0) { + LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode); + + while ( UE->rx_offset ) { + size_t s=min(UE->rx_offset,UE->frame_parms.samples_per_tti); + AssertFatal(s == UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + (void **)UE->common_vars.rxdata, + s, + UE->frame_parms.nb_antennas_rx),""); + + if (IS_SOFTMODEM_RFSIM ) + write_dummy(UE, timestamp); + + UE->rx_offset-=s; } + } - UE->rx_offset=0; - UE->time_sync_cell=0; + UE->rx_offset=0; + UE->time_sync_cell=0; - //UE->proc.proc_rxtx[0].frame_rx++; - //UE->proc.proc_rxtx[1].frame_rx++; - for (th_id=0; th_id < RX_NB_TH; th_id++) { - UE->proc.proc_rxtx[th_id].frame_rx++; - } + //UE->proc.proc_rxtx[0].frame_rx++; + //UE->proc.proc_rxtx[1].frame_rx++; + for (th_id=0; th_id < RX_NB_TH; th_id++) { + UE->proc.proc_rxtx[th_id].frame_rx++; + } - // read in first symbol - AssertFatal (UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0 == - UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp, - (void **)UE->common_vars.rxdata, - UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0, - UE->frame_parms.nb_antennas_rx),""); - slot_fep(UE,0, 0, 0, 0, 0); - } //UE->mode != loop_through_memory - else - rt_sleep_ns(1000*1000); + // read in first symbol + AssertFatal (UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0 == + UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + (void **)UE->common_vars.rxdata, + UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0, + UE->frame_parms.nb_antennas_rx),""); + slot_fep(UE,0, 0, 0, 0, 0); } else { sub_frame++; sub_frame%=10; @@ -2130,7 +2099,8 @@ void *UE_thread(void *arg) pthread_mutex_unlock(&proc->mutex_rxtx); } - usleep(300); + + usleep(300); } LOG_D(PHY,"Process Subframe %d thread Idx %d \n", sub_frame, UE->current_thread_id[sub_frame]); @@ -2139,130 +2109,129 @@ void *UE_thread(void *arg) if(thread_idx>=RX_NB_TH) thread_idx = 0; - if (UE->mode != loop_through_memory) { - for (i=0; iframe_parms.nb_antennas_rx; i++) - rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.ofdm_symbol_size+ - UE->frame_parms.nb_prefix_samples0+ - sub_frame*UE->frame_parms.samples_per_tti]; + for (i=0; iframe_parms.nb_antennas_rx; i++) + rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.ofdm_symbol_size+ + UE->frame_parms.nb_prefix_samples0+ + sub_frame*UE->frame_parms.samples_per_tti]; - for (i=0; iframe_parms.nb_antennas_tx; i++) - txp[i] = (void *)&UE->common_vars.txdata[i][((sub_frame+2)%10)*UE->frame_parms.samples_per_tti]; + for (i=0; iframe_parms.nb_antennas_tx; i++) + txp[i] = (void *)&UE->common_vars.txdata[i][((sub_frame+2)%10)*UE->frame_parms.samples_per_tti]; - int readBlockSize, writeBlockSize; + int readBlockSize, writeBlockSize; - if (sub_frame<9) { - readBlockSize=UE->frame_parms.samples_per_tti; - writeBlockSize=UE->frame_parms.samples_per_tti; - } else { - // set TO compensation to zero - UE->rx_offset_diff = 0; - - // compute TO compensation that should be applied for this frame - - if (UE->no_timing_correction == 0) { - if ( UE->rx_offset < 5*UE->frame_parms.samples_per_tti && - UE->rx_offset > 0 ) - UE->rx_offset_diff = -1 ; - - if ( UE->rx_offset > 5*UE->frame_parms.samples_per_tti && - UE->rx_offset < 10*UE->frame_parms.samples_per_tti ) - UE->rx_offset_diff = 1; - } - - LOG_D(PHY,"AbsSubframe %d.%d SET rx_off_diff to %d rx_offset %d \n",proc->frame_rx,sub_frame,UE->rx_offset_diff,UE->rx_offset); - readBlockSize=UE->frame_parms.samples_per_tti - - UE->frame_parms.ofdm_symbol_size - - UE->frame_parms.nb_prefix_samples0 - - UE->rx_offset_diff; - writeBlockSize=UE->frame_parms.samples_per_tti - - UE->rx_offset_diff; - } - - AssertFatal(readBlockSize == - UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp, - rxp, - readBlockSize, - UE->frame_parms.nb_antennas_rx),""); - AssertFatal( writeBlockSize == - UE->rfdevice.trx_write_func(&UE->rfdevice, - timestamp+ - (2*UE->frame_parms.samples_per_tti) - - UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0 - - openair0_cfg[0].tx_sample_advance, - txp, - writeBlockSize, - UE->frame_parms.nb_antennas_tx, - 1),""); - - if( sub_frame==9) { - // read in first symbol of next frame and adjust for timing drift - int first_symbols=writeBlockSize-readBlockSize; - - if ( first_symbols > 0 ) - AssertFatal(first_symbols == - UE->rfdevice.trx_read_func(&UE->rfdevice, - ×tamp1, - (void **)UE->common_vars.rxdata, - first_symbols, - UE->frame_parms.nb_antennas_rx),""); - - if ( first_symbols <0 ) - LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols); - } - - /* no timeout in IS_SOFTMODEM_RFSIM mode */ - if (IS_SOFTMODEM_RFSIM) { - ret = pthread_mutex_lock(&proc->mutex_rxtx); - } else { - struct timespec tv; - if (clock_gettime(CLOCK_REALTIME, &tv) != 0) { - perror("clock_gettime"); - exit(1); - } - tv.tv_nsec += 10*1000; - if (tv.tv_nsec >= 1000 * 1000 * 1000) { - tv.tv_sec++; - tv.tv_nsec -= 1000 * 1000 * 1000; - } - ret = pthread_mutex_timedlock(&proc->mutex_rxtx, &tv); - } - - // operate on thread sf mod 2 - if (ret != 0) { - if (ret == ETIMEDOUT) { - LOG_E(PHY,"Missed real time\n"); - continue; - } else { - LOG_E(PHY,"System error %s (%d)\n",strerror(errno),errno); - abort(); - } - } - - // usleep(3000); - if(sub_frame == 0) { - //UE->proc.proc_rxtx[0].frame_rx++; - //UE->proc.proc_rxtx[1].frame_rx++; - for (th_id=0; th_id < RX_NB_TH; th_id++) { - UE->proc.proc_rxtx[th_id].frame_rx++; - } - } - - proc->subframe_rx=sub_frame; - proc->subframe_tx=(sub_frame+4)%10; - proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0); - proc->timestamp_tx = timestamp+ - (4*UE->frame_parms.samples_per_tti)- - UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0; - proc->instance_cnt_rxtx++; - LOG_D( PHY, "[SCHED][UE %d] UE RX instance_cnt_rxtx %d subframe %d !!\n", UE->Mod_id, proc->instance_cnt_rxtx,proc->subframe_rx); - T(T_UE_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx)); - AssertFatal (pthread_cond_signal(&proc->cond_rxtx) ==0,""); - AssertFatal(pthread_mutex_unlock(&proc->mutex_rxtx) ==0,""); + if (sub_frame<9) { + readBlockSize=UE->frame_parms.samples_per_tti; + writeBlockSize=UE->frame_parms.samples_per_tti; } else { - printf("Processing subframe %d",proc->subframe_rx); - getchar(); + // set TO compensation to zero + UE->rx_offset_diff = 0; + + // compute TO compensation that should be applied for this frame + + if (UE->no_timing_correction == 0) { + if ( UE->rx_offset < 5*UE->frame_parms.samples_per_tti && + UE->rx_offset > 0 ) + UE->rx_offset_diff = -1 ; + + if ( UE->rx_offset > 5*UE->frame_parms.samples_per_tti && + UE->rx_offset < 10*UE->frame_parms.samples_per_tti ) + UE->rx_offset_diff = 1; + } + + LOG_D(PHY,"AbsSubframe %d.%d SET rx_off_diff to %d rx_offset %d \n",proc->frame_rx,sub_frame,UE->rx_offset_diff,UE->rx_offset); + readBlockSize=UE->frame_parms.samples_per_tti - + UE->frame_parms.ofdm_symbol_size - + UE->frame_parms.nb_prefix_samples0 - + UE->rx_offset_diff; + writeBlockSize=UE->frame_parms.samples_per_tti - + UE->rx_offset_diff; } + + AssertFatal(readBlockSize == + UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + rxp, + readBlockSize, + UE->frame_parms.nb_antennas_rx),""); + AssertFatal( writeBlockSize == + UE->rfdevice.trx_write_func(&UE->rfdevice, + timestamp+ + (2*UE->frame_parms.samples_per_tti) - + UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0 - + openair0_cfg[0].tx_sample_advance, + txp, + writeBlockSize, + UE->frame_parms.nb_antennas_tx, + 1),""); + + if( sub_frame==9) { + // read in first symbol of next frame and adjust for timing drift + int first_symbols=writeBlockSize-readBlockSize; + + if ( first_symbols > 0 ) + AssertFatal(first_symbols == + UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp1, + (void **)UE->common_vars.rxdata, + first_symbols, + UE->frame_parms.nb_antennas_rx),""); + + if ( first_symbols <0 ) + LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols); + } + + /* no timeout in IS_SOFTMODEM_RFSIM mode */ + if (IS_SOFTMODEM_RFSIM) { + ret = pthread_mutex_lock(&proc->mutex_rxtx); + } else { + struct timespec tv; + + if (clock_gettime(CLOCK_REALTIME, &tv) != 0) { + perror("clock_gettime"); + exit(1); + } + + tv.tv_nsec += 10*1000; + + if (tv.tv_nsec >= 1000 * 1000 * 1000) { + tv.tv_sec++; + tv.tv_nsec -= 1000 * 1000 * 1000; + } + + ret = pthread_mutex_timedlock(&proc->mutex_rxtx, &tv); + } + + // operate on thread sf mod 2 + if (ret != 0) { + if (ret == ETIMEDOUT) { + LOG_E(PHY,"Missed real time\n"); + continue; + } else { + LOG_E(PHY,"System error %s (%d)\n",strerror(errno),errno); + abort(); + } + } + + // usleep(3000); + if(sub_frame == 0) { + //UE->proc.proc_rxtx[0].frame_rx++; + //UE->proc.proc_rxtx[1].frame_rx++; + for (th_id=0; th_id < RX_NB_TH; th_id++) { + UE->proc.proc_rxtx[th_id].frame_rx++; + } + } + + proc->subframe_rx=sub_frame; + proc->subframe_tx=(sub_frame+4)%10; + proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0); + proc->timestamp_tx = timestamp+ + (4*UE->frame_parms.samples_per_tti)- + UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0; + proc->instance_cnt_rxtx++; + LOG_D( PHY, "[SCHED][UE %d] UE RX instance_cnt_rxtx %d subframe %d !!\n", UE->Mod_id, proc->instance_cnt_rxtx,proc->subframe_rx); + T(T_UE_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx)); + AssertFatal (pthread_cond_signal(&proc->cond_rxtx) ==0,""); + AssertFatal(pthread_mutex_unlock(&proc->mutex_rxtx) ==0,""); } // start_rx_stream==1 } // UE->is_synchronized==1 } // while !oai_exit @@ -2283,8 +2252,7 @@ void *UE_thread(void *arg) * - UE_thread_dlsch_proc_slot1 * and the locking between them. */ -void init_UE_threads(int inst) -{ +void init_UE_threads(int inst) { struct rx_tx_thread_data *rtd; PHY_VARS_UE *UE; AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n"); @@ -2339,8 +2307,7 @@ void init_UE_threads(int inst) * - UE_thread_dlsch_proc_slot1 * and the locking between them. */ -void init_UE_single_thread_stub(int nb_inst) -{ +void init_UE_single_thread_stub(int nb_inst) { struct rx_tx_thread_data *rtd; PHY_VARS_UE *UE; @@ -2368,8 +2335,8 @@ void init_UE_single_thread_stub(int nb_inst) // In phy_stub_UE mode due to less heavy processing operations we don't need two threads //int nb_threads=RX_NB_TH; int nb_threads=1; + void *(*task_func)(void *); - void* (*task_func)(void*); if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) { task_func = UE_phy_stub_standalone_pnf_task; } else { @@ -2413,8 +2380,7 @@ void init_UE_single_thread_stub(int nb_inst) * - UE_thread_dlsch_proc_slot1 * and the locking between them. */ -void init_UE_threads_stub(int inst) -{ +void init_UE_threads_stub(int inst) { struct rx_tx_thread_data *rtd; PHY_VARS_UE *UE; AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n"); @@ -2451,8 +2417,7 @@ void init_UE_threads_stub(int inst) } -void fill_ue_band_info(void) -{ +void fill_ue_band_info(void) { LTE_UE_EUTRA_Capability_t *UE_EUTRA_Capability = UE_rrc_inst[0].UECap->UE_EUTRA_Capability; int i,j; bands_to_scan.nbands = UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count; @@ -2477,8 +2442,7 @@ void fill_ue_band_info(void) } int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, - openair0_config_t *openair0_cfg) -{ + openair0_config_t *openair0_cfg) { int i, CC_id; LTE_DL_FRAME_PARMS *frame_parms; @@ -2520,8 +2484,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, // playing the role of nfapi-pnf. //02/02/2018 -static void *timer_thread( void *param ) -{ +static void *timer_thread( void *param ) { thread_top_init("timer_thread",1,870000L,1000000L,1000000L); timer_subframe =9; timer_frame =1023; @@ -2647,8 +2610,7 @@ static void *timer_thread( void *param ) } -int init_timer_thread(void) -{ +int init_timer_thread(void) { //PHY_VARS_UE *UE=PHY_vars_UE_g[0]; PHY_VARS_UE *UE=PHY_vars_UE_g[0][0]; phy_stub_ticking = (SF_ticking *)malloc(sizeof(SF_ticking)); @@ -2670,8 +2632,7 @@ int init_timer_thread(void) */ int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB, - find_type_t type) -{ + find_type_t type) { printf("you cannot read this\n"); abort(); } From 421603534c7db096fd7b4c21da302bfb28b712a2 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 11 Apr 2022 10:52:53 +0200 Subject: [PATCH 12/39] fix regression --- targets/RT/USER/lte-ue.c | 204 +++++++++++++++++++-------------------- 1 file changed, 100 insertions(+), 104 deletions(-) diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 8565e36e87..2b3a680713 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1203,124 +1203,120 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id); } + } else { + LOG_I(MAC, "Skipping subframe select statement proxy SFN.SF: %d.%d\n", + NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); + + if (ul_config_req != NULL) { + LOG_I(MAC, "Skipping subframe select statement ul_config_req SFN.SF: %d.%d\n", + NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf)); + } + } + } //for (Mod_id=0; Mod_idcrc_ind.crc_indication_body.number_of_crcs > 0) { + //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf)); + //LOG_I(MAC, "ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs); + send_standalone_msg(UL_INFO, UL_INFO->crc_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.21 \n"); + UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0; + } + + if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus > 0) { + //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf)); + //LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus); + send_standalone_msg(UL_INFO, UL_INFO->rx_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n"); + UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; + } + + if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) { + send_standalone_msg(UL_INFO, UL_INFO->cqi_ind.header.message_id); + sent_any = true; + UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0; + } + + if (UL_INFO->harq_ind.harq_indication_body.number_of_harqs > 0) { + //LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs); + send_standalone_msg(UL_INFO, UL_INFO->harq_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n"); + UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0; + } + + if (UL_INFO->sr_ind.sr_indication_body.number_of_srs > 0) { + //LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs); + send_standalone_msg(UL_INFO, UL_INFO->sr_ind.header.message_id); + sent_any = true; + //LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n"); + UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; + } + + // De-allocate memory of nfapi requests copies before next subframe round + if (dl_config_req_tx_req != NULL) { + if (dl_config_req_tx_req->dl_config_req->vendor_extension != NULL) { + free(dl_config_req_tx_req->dl_config_req->vendor_extension); + dl_config_req_tx_req->dl_config_req->vendor_extension = NULL; } - phy_procedures_UE_SL_RX(UE, proc); - } else { - LOG_I(MAC, "Skipping subframe select statement proxy SFN.SF: %d.%d\n", - NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); - - if (ul_config_req != NULL) { - LOG_I(MAC, "Skipping subframe select statement ul_config_req SFN.SF: %d.%d\n", - NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf)); + if (dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list != NULL) { + free(dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list); + dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL; } - } - } //for (Mod_id=0; Mod_idcrc_ind.crc_indication_body.number_of_crcs > 0) { - //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf)); - //LOG_I(MAC, "ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs); - send_standalone_msg(UL_INFO, UL_INFO->crc_ind.header.message_id); - sent_any = true; - //LOG_I(MAC, "ul_config_req_UE_MAC 2.21 \n"); - UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0; - } - - if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus > 0) { - //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf)); - //LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus); - send_standalone_msg(UL_INFO, UL_INFO->rx_ind.header.message_id); - sent_any = true; - //LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n"); - UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; - } - - if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) { - send_standalone_msg(UL_INFO, UL_INFO->cqi_ind.header.message_id); - sent_any = true; - UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0; - } - - if (UL_INFO->harq_ind.harq_indication_body.number_of_harqs > 0) { - //LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs); - send_standalone_msg(UL_INFO, UL_INFO->harq_ind.header.message_id); - sent_any = true; - //LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n"); - UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0; - } - - if (UL_INFO->sr_ind.sr_indication_body.number_of_srs > 0) { - //LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs); - send_standalone_msg(UL_INFO, UL_INFO->sr_ind.header.message_id); - sent_any = true; - //LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n"); - UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; - } - - // De-allocate memory of nfapi requests copies before next subframe round - if (dl_config_req_tx_req != NULL) { - if (dl_config_req_tx_req->dl_config_req->vendor_extension != NULL) { - free(dl_config_req_tx_req->dl_config_req->vendor_extension); - dl_config_req_tx_req->dl_config_req->vendor_extension = NULL; + nfapi_free_tx_req_pdu_list(dl_config_req_tx_req->tx_req_pdu_list); + dl_config_req_tx_req->tx_req_pdu_list = NULL; + free(dl_config_req_tx_req->dl_config_req); + dl_config_req_tx_req->dl_config_req = NULL; + free(dl_config_req_tx_req); + dl_config_req_tx_req = NULL; } - if (dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list != NULL) { - free(dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list); - dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL; + if (ul_config_req != NULL) { + if (ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) { + free(ul_config_req->ul_config_request_body.ul_config_pdu_list); + ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; + } + + free(ul_config_req); + ul_config_req = NULL; } - nfapi_free_tx_req_pdu_list(dl_config_req_tx_req->tx_req_pdu_list); - dl_config_req_tx_req->tx_req_pdu_list = NULL; - free(dl_config_req_tx_req->dl_config_req); - dl_config_req_tx_req->dl_config_req = NULL; - free(dl_config_req_tx_req); - dl_config_req_tx_req = NULL; - } + if (hi_dci0_req != NULL) { + if (hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list != NULL) { + free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list); + hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL; + } - if (ul_config_req != NULL) { - if (ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) { - free(ul_config_req->ul_config_request_body.ul_config_pdu_list); - ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; + free(hi_dci0_req); + hi_dci0_req = NULL; } - free(ul_config_req); - ul_config_req = NULL; - } - - if (hi_dci0_req != NULL) { - if (hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list != NULL) { - free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list); - hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL; + if (!sent_any) { + send_standalone_dummy(); } - - free(hi_dci0_req); - hi_dci0_req = NULL; } - if (!sent_any) { - send_standalone_dummy(); - } -} - -// Free UL_INFO messages -free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list); -UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL; -free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list); -UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL; -free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list); -UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL; -free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list); -UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL; -free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list); -UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL; -free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list); -UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL; -free(UL_INFO); -UL_INFO = NULL; - -// thread finished -free(arg); -return NULL; + // Free UL_INFO messages + free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list); + UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL; + free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list); + UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL; + free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list); + UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL; + free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list); + UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL; + free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list); + UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL; + free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list); + UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL; + free(UL_INFO); + UL_INFO = NULL; + // thread finished + free(arg); + return NULL; } /*! From b738f8a6a98976c04c01b8f7a230193523a341fd Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 11 Apr 2022 17:27:11 +0200 Subject: [PATCH 13/39] tackle code review remarks --- executables/nr-softmodem-common.h | 1 - executables/nr-ue.c | 14 ++------------ executables/softmodem-common.h | 1 - targets/RT/USER/lte-ru.c | 5 ++--- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h index 47fd816db5..6e36dcf6c7 100644 --- a/executables/nr-softmodem-common.h +++ b/executables/nr-softmodem-common.h @@ -51,7 +51,6 @@ #define CONFIG_HLP_UEFO "set UE to enable estimation and compensation of frequency offset\n" #define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n" #define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n" -#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n" #define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n" #define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n" #define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n" diff --git a/executables/nr-ue.c b/executables/nr-ue.c index aef0370e53..02e92cbe0b 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -655,14 +655,6 @@ static void UE_synch(void *arg) { openair0_cfg[UE->rf_map.card].tx_freq[0]); UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); - //UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]); - //UE->rfdevice.trx_stop_func(&UE->rfdevice); - // sleep(1); - /*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) { - LOG_E(HW,"Could not start the device\n"); - oai_exit=1; - }*/ - if (UE->UE_scan_carrier == 1) { UE->UE_scan_carrier = 0; } else { @@ -815,9 +807,9 @@ void processSlotRX(void *arg) { void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) { void *dummy_tx[UE->frame_parms.nb_antennas_tx]; - + int16_t dummy_tx_data[UE->frame_parms.nb_antennas_tx][2*writeBlockSize]; // 2 because the function we call use pairs of int16_t implicitly as complex numbers for (int i=0; iframe_parms.nb_antennas_tx; i++) - dummy_tx[i]=malloc16_clear(writeBlockSize*4); + dummy_tx[i]=dummy_tx_data[i]; AssertFatal( writeBlockSize == UE->rfdevice.trx_write_func(&UE->rfdevice, @@ -827,8 +819,6 @@ void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockS UE->frame_parms.nb_antennas_tx, 4),""); - for (int i=0; iframe_parms.nb_antennas_tx; i++) - free(dummy_tx[i]); } void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, bool toTrash) { diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 48ce73149f..eb0c1a54f7 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -53,7 +53,6 @@ extern "C" #define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n" -#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n" #define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n" #define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n" #define CONFIG_HLP_SA "run gNB in standalone mode\n" diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index f6cf51f101..c1ffd7a292 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -835,8 +835,9 @@ void tx_rf(RU_t *ru, // in case of rfsim, we always enable tx because we need to feed rx of the opposite side // we write 1 single I/Q sample to trigger Rx (rfsim will fill gaps with 0 I/Q) void *dummy_tx[ru->frame_parms->nb_antennas_tx]; + int16_t dummy_tx_data[ru->frame_parms->nb_antennas_tx][2]; // 2 because the function we call use pairs of int16_t implicitly as complex numbers for (int i=0; iframe_parms->nb_antennas_tx; i++) - dummy_tx[i]=malloc16_clear(4); + dummy_tx[i]= dummy_tx_data[i]; AssertFatal( 1 == ru->rfdevice.trx_write_func(&ru->rfdevice, @@ -846,8 +847,6 @@ void tx_rf(RU_t *ru, ru->frame_parms->nb_antennas_tx, 4),""); - for (int i=0; iframe_parms->nb_antennas_tx; i++) - free(dummy_tx[i]); } } From 4ad71064b8a51176ec4c9536c2173ffda71df708 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 11 Apr 2022 19:29:45 +0200 Subject: [PATCH 14/39] review comments --- openair1/PHY/CODING/nr_rate_matching.c | 8 +-- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 2 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac.h | 7 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 13 ++-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 66 ++++--------------- targets/ARCH/rfsimulator/apply_channelmod.c | 3 +- targets/ARCH/rfsimulator/rfsimulator.h | 2 +- 8 files changed, 31 insertions(+), 72 deletions(-) diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c index fbad79cad7..8c105c37e6 100644 --- a/openair1/PHY/CODING/nr_rate_matching.c +++ b/openair1/PHY/CODING/nr_rate_matching.c @@ -313,14 +313,12 @@ void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f) switch(Qm) { case 2: { - AssertFatal(E%4==0,""); + AssertFatal(E%2==0,""); int16_t *e1=e+(E/2); - int16_t *end=f+E-3; + int16_t *end=f+E-1; while( fF && pdu_len < sizeof(NR_MAC_SUBHEADER_LONG)) + return false; if (s->F) { *mac_subheader_len = sizeof(*l); *mac_ce_len = ntohs(l->L); @@ -128,6 +132,7 @@ static inline void getMacLen(uint8_t* pdu, uint16_t *mac_ce_len, uint16_t *mac_s *mac_subheader_len = sizeof(*s); *mac_ce_len = s->L; } + return true; } // BSR MAC CEs diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 47a6682f63..ab63303629 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3364,13 +3364,14 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len); + bool ret; switch(rx_lcid){ // MAC CE case DL_SCH_LCID_CCCH: // MSG4 RRC Setup 38.331 // variable length - getMacLen(pduP, &mac_len, &mac_subheader_len); - AssertFatal(pdu_len > mac_len, "The mac_len (%d) has an invalid size. PDU len = %d! \n", + ret=get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len); + AssertFatal(ret, "The mac_len (%d) has an invalid size. PDU len = %d! \n", mac_len, pdu_len); // Check if it is a valid CCCH message, we get all 00's messages very often @@ -3404,7 +3405,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, // 38.321 Ch6.1.3.14 // varialbe length - getMacLen(pduP, &mac_len, &mac_subheader_len); + get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len); break; case DL_SCH_LCID_RECOMMENDED_BITRATE: @@ -3508,10 +3509,8 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, // check if LCID is valid at current time. default: { - // check if LCID is valid at current time. - if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) - return; - getMacLen(pduP, &mac_len, &mac_subheader_len); + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return; LOG_D(NR_MAC, "[UE %d] %4d.%2d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, slot, rx_lcid, gNB_index, mac_len); #if defined(ENABLE_MAC_PAYLOAD_DEBUG) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 422e40af7e..7e3f6c857a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1426,7 +1426,7 @@ void nr_schedule_ue_spec(module_id_t module_id, /* limit requested number of bytes to what preprocessor specified, or * such that TBS is full */ const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer, - bufEnd-buf-+sizeof(NR_MAC_SUBHEADER_LONG)); + bufEnd-buf-sizeof(NR_MAC_SUBHEADER_LONG)); tbs_size_t len = mac_rlc_data_req(module_id, rnti, module_id, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 67ab8aacc5..1955d91af6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -213,6 +213,7 @@ int nr_process_mac_pdu(module_id_t module_idP, int pdu_len) { + uint8_t done = 0; NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info; @@ -279,16 +280,8 @@ int nr_process_mac_pdu(module_id_t module_idP, to be a partial PDU at the end of this buffer, so here we gracefully ignore that by returning 0. See: https://gitlab.eurecom.fr/oai/openairinterface5g/-/issues/534 */ - if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) - return 0; - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG)) - return 0; - mac_ce_len= ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L); - mac_subheader_len = 3; - } + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return 0; /* Extract long BSR value */ ce_ptr = &pduP[mac_subheader_len]; NR_BSR_LONG *bsr_l = (NR_BSR_LONG *) ce_ptr; @@ -362,32 +355,16 @@ int nr_process_mac_pdu(module_id_t module_idP, case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT: //38.321 section 6.1.3.9 // varialbe length - if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) - return 0; - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG)) - return 0; - mac_ce_len = ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L); - mac_subheader_len = 3; - } + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return 0; /* Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */ break; case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT: //38.321 section 6.1.3.9 // varialbe length - if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) - return 0; - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG)) - return 0; - mac_ce_len = ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L); - mac_subheader_len = 3; - } + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return 0; /* Extract MULTI ENTRY PHR elements from four octets bitmap for PHR calculation */ break; @@ -398,18 +375,8 @@ int nr_process_mac_pdu(module_id_t module_idP, case UL_SCH_LCID_SRB1: case UL_SCH_LCID_SRB2: - if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) - return 0; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - //mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG)) - return 0; - mac_subheader_len = 3; - mac_sdu_len = ntohs(NR_MAC_SUBHEADER_LONG *) pduP)->L); - } else { - mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - } + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return 0; rnti_t crnti = UE_info->rnti[UE_id]; int UE_idx = UE_id; @@ -486,19 +453,8 @@ int nr_process_mac_pdu(module_id_t module_idP, case UL_SCH_LCID_DTCH: // check if LCID is valid at current time. - if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) - return 0; - if (((NR_MAC_SUBHEADER_SHORT *)pduP)->F) { - // mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG)) - return 0; - mac_subheader_len = 3; - mac_sdu_len = ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L); - - } else { - mac_sdu_len = (NR_MAC_SUBHEADER_SHORT *)pduP)->L; - mac_subheader_len = 2; - } + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return 0; LOG_D(NR_MAC, "In %s: [UE %d] %d.%d : ULSCH -> UL-%s %d (gNB %d, %d bytes)\n", __func__, diff --git a/targets/ARCH/rfsimulator/apply_channelmod.c b/targets/ARCH/rfsimulator/apply_channelmod.c index 6e26120e29..4ff5321e4d 100644 --- a/targets/ARCH/rfsimulator/apply_channelmod.c +++ b/targets/ARCH/rfsimulator/apply_channelmod.c @@ -52,7 +52,8 @@ either we regenerate the channel (call again random_channel(desc,0)), or we keep it over subframes legacy: we regenerate each sub frame in UL, and each frame only in DL */ -void rxAddInput( c16_t *input_sig, c16_t *after_channel_sig, +void rxAddInput( const c16_t *input_sig, + c16_t *after_channel_sig, int rxAnt, channel_desc_t *channelDesc, int nbSamples, diff --git a/targets/ARCH/rfsimulator/rfsimulator.h b/targets/ARCH/rfsimulator/rfsimulator.h index 33583f2d32..e69d41fa6c 100644 --- a/targets/ARCH/rfsimulator/rfsimulator.h +++ b/targets/ARCH/rfsimulator/rfsimulator.h @@ -25,7 +25,7 @@ #define __RFSIMULATOR_H double gaussZiggurat(double mean, double variance); void tableNor(unsigned long seed); -void rxAddInput( c16_t *input_sig, +void rxAddInput( const c16_t *input_sig, c16_t *after_channel_sig, int rxAnt, channel_desc_t *channelDesc, From 2373b0215011357aa853bb9d53804a536977d226 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 12 Apr 2022 20:52:40 +0200 Subject: [PATCH 15/39] review remarks --- executables/nr-ue.c | 1 + targets/RT/USER/lte-ru.c | 1 + 2 files changed, 2 insertions(+) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 02e92cbe0b..aff56f583a 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -808,6 +808,7 @@ void processSlotRX(void *arg) { void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) { void *dummy_tx[UE->frame_parms.nb_antennas_tx]; int16_t dummy_tx_data[UE->frame_parms.nb_antennas_tx][2*writeBlockSize]; // 2 because the function we call use pairs of int16_t implicitly as complex numbers + memset(dummy_tx_data, 0, sizeof(dummy_tx_data)); for (int i=0; iframe_parms.nb_antennas_tx; i++) dummy_tx[i]=dummy_tx_data[i]; diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index c1ffd7a292..cee15ef48b 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -836,6 +836,7 @@ void tx_rf(RU_t *ru, // we write 1 single I/Q sample to trigger Rx (rfsim will fill gaps with 0 I/Q) void *dummy_tx[ru->frame_parms->nb_antennas_tx]; int16_t dummy_tx_data[ru->frame_parms->nb_antennas_tx][2]; // 2 because the function we call use pairs of int16_t implicitly as complex numbers + memset(dummy_tx_data,0,sizeof(dummy_tx_data)); for (int i=0; iframe_parms->nb_antennas_tx; i++) dummy_tx[i]= dummy_tx_data[i]; From 815a15e544ccb25bf46d6a3181deb718f3a91077 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 14 Apr 2022 17:43:02 +0200 Subject: [PATCH 16/39] fixes for SR in pucch0 --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 20 ++++++++++++++------ openair1/PHY/defs_gNB.h | 2 -- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 50c3b62f50..d1f7ff7c6c 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -298,7 +298,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, xr[aa][l][n2+1]+=(int16_t)(((int32_t)x_re[l][n]*r[n2+1]-(int32_t)x_im[l][n]*r[n2])>>15); #ifdef DEBUG_NR_PUCCH_RX printf("x (%d,%d), r%d.%d (%d,%d), xr (%d,%d)\n", - x_re[l][n],x_im[l][n],l2,re_offset[l],r[n2],r[n2+1],xr[aa][l][n2],xr[aa][l][n2+1]); + x_re[l][n],x_im[l][n],l2,re_offset[l],r[n2],r[n2+1],xr[aa][l][n2],xr[aa][l][n2+1]); #endif } } @@ -390,7 +390,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, index=maxpos; uci_stats->pucch0_n00 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[0]]; uci_stats->pucch0_n01 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]]; - LOG_D(PHY,"n00[%d] = %d, n01[%d] = %d\n",prb_offset[0],uci_stats->pucch0_n00,prb_offset[1],uci_stats->pucch0_n01); + LOG_I(PHY,"n00[%d] = %d, n01[%d] = %d\n",prb_offset[0],uci_stats->pucch0_n00,prb_offset[1],uci_stats->pucch0_n01); // estimate CQI for MAC (from antenna port 0 only) int max_n0 = uci_stats->pucch0_n00>uci_stats->pucch0_n01 ? uci_stats->pucch0_n00:uci_stats->pucch0_n01; int SNRtimes10,sigenergy=0; @@ -422,11 +422,12 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, if (pucch_pdu->bit_len_harq==0) { uci_pdu->harq = NULL; uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); - uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0; + uci_pdu->sr->sr_confidence_level = (SNRtimes10 > uci_stats->pucch0_thres) ? 1 : 0; uci_stats->pucch0_sr_trials++; - if (xrtmag_dBtimes10>(10*gNB->measurements.n0_power_tot_dB)) { + if (xrtmag_dBtimes10>10*max_n0) { uci_pdu->sr->sr_indication = 1; uci_stats->pucch0_positive_SR++; + LOG_D(PHY,"PUCCH0 got positive SR. Cumulative number of positive SR %d\n", uci_stats->pucch0_positive_SR); } else { uci_pdu->sr->sr_indication = 0; } @@ -445,7 +446,10 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr->sr_indication = (index>1) ? 1 : 0; uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0; - uci_stats->pucch0_positive_SR++; + if(uci_pdu->sr->sr_indication == 1 && uci_pdu->sr->sr_confidence_level == 0) { + uci_stats->pucch0_positive_SR++; + LOG_D(PHY,"PUCCH0 got positive SR. Cumulative number of positive SR %d\n", uci_stats->pucch0_positive_SR); + } } uci_stats->pucch01_trials++; } @@ -463,6 +467,10 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr->sr_indication = (index>3) ? 1 : 0; uci_pdu->sr->sr_confidence_level = (no_conf) ? 1 : 0; + if(uci_pdu->sr->sr_indication == 1 && uci_pdu->sr->sr_confidence_level == 0) { + uci_stats->pucch0_positive_SR++; + LOG_D(PHY,"PUCCH0 got positive SR. Cumulative number of positive SR %d\n", uci_stats->pucch0_positive_SR); + } } } } @@ -1671,7 +1679,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, LOG_D(PHY,"metric %d dB\n",corr_dB); } - // estimate CQI for MAC (from antenna port 0 only) + // estimate CQI for MAC (from antenna port 0 only) int SNRtimes10 = dB_fixed_times10(signal_energy_nodc(&rxdataF[0][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[0]], 12*pucch_pdu->prb_size)) - (10*gNB->measurements.n0_power_tot_dB); diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 7b655c023a..f382de73aa 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -661,8 +661,6 @@ typedef struct { unsigned int n0_power_tot; //! estimated avg noise power (dB) unsigned int n0_power_tot_dB; - //! estimated avg noise power (dB) - int n0_power_tot_dBm; //! estimated avg noise power per RB per RX ant (lin) unsigned int n0_subband_power[MAX_NUM_RU_PER_gNB][275]; //! estimated avg noise power per RB per RX ant (dB) From ca51ba7d3f860df32b256df2a4b5c2b55d14b929 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 14 Apr 2022 19:30:22 +0200 Subject: [PATCH 17/39] ignoring PUCCH2 TPC for now --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 3 ++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index d1f7ff7c6c..bcf743b560 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -390,7 +390,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, index=maxpos; uci_stats->pucch0_n00 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[0]]; uci_stats->pucch0_n01 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]]; - LOG_I(PHY,"n00[%d] = %d, n01[%d] = %d\n",prb_offset[0],uci_stats->pucch0_n00,prb_offset[1],uci_stats->pucch0_n01); + LOG_D(PHY,"n00[%d] = %d, n01[%d] = %d\n",prb_offset[0],uci_stats->pucch0_n00,prb_offset[1],uci_stats->pucch0_n01); // estimate CQI for MAC (from antenna port 0 only) int max_n0 = uci_stats->pucch0_n00>uci_stats->pucch0_n01 ? uci_stats->pucch0_n00:uci_stats->pucch0_n01; int SNRtimes10,sigenergy=0; @@ -1680,6 +1680,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, } // estimate CQI for MAC (from antenna port 0 only) + // TODO this computation is wrong -> to be ignored at MAC for now int SNRtimes10 = dB_fixed_times10(signal_energy_nodc(&rxdataF[0][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[0]], 12*pucch_pdu->prb_size)) - (10*gNB->measurements.n0_power_tot_dB); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index e21d1e50f7..3eda061959 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1493,10 +1493,11 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; // tpc (power control) - sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, - uci_234->ul_cqi, - 30); - sched_ctrl->pucch_snrx10 = uci_234->ul_cqi * 5 - 640; + // TODO PUCCH2 SNR computation is not correct -> ignore the following + //sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, + // uci_234->ul_cqi, + // 30); + //sched_ctrl->pucch_snrx10 = uci_234->ul_cqi * 5 - 640; if ((uci_234->pduBitmap >> 1) & 0x01) { // iterate over received harq bits From 8b0be9cf87708f9f5976ff239daa8d719d17dae4 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 20 Jan 2022 15:45:43 +0100 Subject: [PATCH 18/39] nr rlc: speedup ack/nack reception The code completely changed, expect problems. --- openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c | 850 +++++++++++---------- openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h | 3 - openair2/LAYER2/nr_rlc/nr_rlc_sdu.c | 11 +- openair2/LAYER2/nr_rlc/nr_rlc_sdu.h | 7 +- openair2/LAYER2/nr_rlc/tests/test14.txt.gz | Bin 792 -> 799 bytes openair2/LAYER2/nr_rlc/tests/test15.txt.gz | Bin 546 -> 554 bytes 6 files changed, 441 insertions(+), 430 deletions(-) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index af8cb5715a..e86e7c7d05 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -103,36 +103,6 @@ static int segment_already_received(nr_rlc_entity_am_t *entity, return size <= 0; } -static void consider_retransmission(nr_rlc_entity_am_t *entity, - nr_rlc_sdu_segment_t *cur, int update_retx) -{ - if (update_retx) - cur->sdu->retx_count++; - - /* let's report max RETX reached for all retx_count >= max_retx_threshold - * (specs say to report if retx_count == max_retx_threshold). - * Upper layers should react (radio link failure), so no big deal actually. - */ - if (update_retx && cur->sdu->retx_count >= entity->max_retx_threshold) { - entity->common.max_retx_reached(entity->common.max_retx_reached_data, - (nr_rlc_entity_t *)entity); - } - - /* let's put in retransmit list even if we are over max_retx_threshold. - * upper layers should deal with this condition, internally it's better - * for the RLC code to keep going with this segment (we only remove - * a segment that was ACKed) - */ - LOG_D(RLC, "RLC segment to be added at the ReTx list \n"); - nr_rlc_sdu_segment_list_append(&entity->retransmit_list, - &entity->retransmit_end, - cur); - - /* update buffer status */ - entity->common.bstatus.retx_size += compute_pdu_header_size(entity, cur) - + cur->size; -} - /* checks that all the bytes of the SDU sn have been received (but SDU * has not been already processed) */ @@ -315,81 +285,6 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu) } } -static void process_received_ack(nr_rlc_entity_am_t *entity, int ack_sn) -{ - nr_rlc_sdu_segment_t head; - nr_rlc_sdu_segment_t *cur; - nr_rlc_sdu_segment_t *prev; - unsigned char sn_set[32768]; /* used to dec retx_count only once per sdu */ - - memset(sn_set, 0, 32768); - -#define IS_SN_SET(b) (sn_set[(b)/8] & (1 << ((b) % 8))) -#define SET_SN(b) do { sn_set[(b)/8] |= (1 << ((b) % 8)); } while (0) - - /* put SDUs from wait and retransmit lists with SN < 'ack_sn' to ack_list */ - - /* process wait list */ - head.next = entity->wait_list; - prev = &head; - cur = entity->wait_list; - while (cur != NULL) { - if (sn_compare_tx(entity, cur->sdu->sn, ack_sn) < 0) { - /* remove from wait list */ - prev->next = cur->next; - /* put the PDU in the ack list */ - entity->ack_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity, - entity->ack_list, cur); - entity->wait_end = prev; - cur = prev->next; - } else { - entity->wait_end = cur; - prev = cur; - cur = cur->next; - } - } - entity->wait_list = head.next; - if (entity->wait_list == NULL) - entity->wait_end = NULL; - - /* process retransmit list */ - head.next = entity->retransmit_list; - prev = &head; - cur = entity->retransmit_list; - while (cur != NULL) { - if (sn_compare_tx(entity, cur->sdu->sn, ack_sn) < 0) { - /* dec. retx_count in case we put this segment back in retransmit list - * in 'process_received_nack' - * do it only once per SDU - */ - if (!IS_SN_SET(cur->sdu->sn)) { - cur->sdu->retx_count--; - SET_SN(cur->sdu->sn); - } - /* remove from retransmit list */ - prev->next = cur->next; - /* update buffer status */ - entity->common.bstatus.retx_size -= compute_pdu_header_size(entity, cur) - + cur->size; - /* put the PDU in the ack list */ - entity->ack_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity, - entity->ack_list, cur); - entity->retransmit_end = prev; - cur = prev->next; - } else { - entity->retransmit_end = cur; - prev = cur; - cur = cur->next; - } - } - entity->retransmit_list = head.next; - if (entity->retransmit_list == NULL) - entity->retransmit_end = NULL; - -#undef IS_BIT_SET -#undef SET_BIT -} - static int so_overlap(int s1, int e1, int s2, int e2) { if (s1 < s2) { @@ -402,136 +297,375 @@ static int so_overlap(int s1, int e1, int s2, int e2) return 0; } -static void process_nack_sn(nr_rlc_entity_am_t *entity, int nack_sn, - int so_start, int so_end, unsigned char *sn_set) -{ - /* put all SDU segments with SN == 'sn' and with an overlapping so start/end - * to the retransmit list - * source lists are ack list and wait list. - * Not sure if we should consider wait list, isn't the other end supposed - * to only NACK SNs lower than the ACK SN sent in the status PDU, in which - * case all potential SDU segments should all be in ack list when calling - * the current function? in doubt let's accept anything and thus process - * also wait list. - */ - nr_rlc_sdu_segment_t head; - nr_rlc_sdu_segment_t *cur; - nr_rlc_sdu_segment_t *prev; - -#define IS_SN_SET(b) (sn_set[(b)/8] & (1 << ((b) % 8))) -#define SET_SN(b) do { sn_set[(b)/8] |= (1 << ((b) % 8)); } while (0) - - /* check that tx_next_ack <= sn < tx_next */ - if (!(sn_compare_tx(entity, entity->tx_next_ack, nack_sn) <= 0 && - sn_compare_tx(entity, nack_sn, entity->tx_next) < 0)) - return; - - /* process wait list */ - head.next = entity->wait_list; - prev = &head; - cur = entity->wait_list; - while (cur != NULL) { - if (cur->sdu->sn == nack_sn && - so_overlap(so_start, so_end, cur->so, cur->so + cur->size - 1)) { - /* remove from wait list */ - prev->next = cur->next; - cur->next = NULL; - /* consider the SDU segment for retransmission */ - consider_retransmission(entity, cur, !IS_SN_SET(cur->sdu->sn)); - SET_SN(cur->sdu->sn); - entity->wait_end = prev; - cur = prev->next; - } else { - entity->wait_end = cur; - prev = cur; - cur = cur->next; - } - } - entity->wait_list = head.next; - if (entity->wait_list == NULL) - entity->wait_end = NULL; - - /* process ack list */ - head.next = entity->ack_list; - prev = &head; - cur = entity->ack_list; - while (cur != NULL) { - if (cur->sdu->sn == nack_sn && - so_overlap(so_start, so_end, cur->so, cur->so + cur->size - 1)) { - /* remove from ack list */ - prev->next = cur->next; - cur->next = NULL; - /* consider the SDU segment for retransmission */ - consider_retransmission(entity, cur, !IS_SN_SET(cur->sdu->sn)); - SET_SN(cur->sdu->sn); - cur = prev->next; - } else { - prev = cur; - cur = cur->next; - } - } - entity->ack_list = head.next; - -#undef IS_BIT_SET -#undef SET_BIT -} - -static void process_received_nack(nr_rlc_entity_am_t *entity, int nack_sn, - int so_start, int so_end, int range, - unsigned char *sn_set) +static void process_control_pdu(nr_rlc_entity_am_t *entity, + char *buffer, int size) { +#define R(d) do { if (nr_rlc_pdu_decoder_in_error(&d)) goto err; } while (0) + nr_rlc_pdu_decoder_t decoder; int i; + int cpt; + int ack_sn; + int nack_sn; + int e1; + int e2; + int e3; + int so_start; + int so_end; + int range; + int prev_nack_sn = -1; + int prev_so_start; + int prev_so_end; + int tx_next_ack; + nr_rlc_sdu_segment_t *cur_wait_list; + nr_rlc_sdu_segment_t *prev_wait_list; + nr_rlc_sdu_segment_t *end_wait_list = NULL; + nr_rlc_sdu_segment_t head_wait_list; + nr_rlc_sdu_segment_t *cur_retransmit_list; + nr_rlc_sdu_segment_t *new_retransmit_list; + nr_rlc_sdu_segment_t head_retransmit_list; - for (i = 0; i < range; i++) - process_nack_sn(entity, (nack_sn + i) % entity->sn_modulus, - i == 0 ? so_start : 0, - i == range - 1 ? so_end : -1, - sn_set); -} + head_wait_list.next = entity->wait_list; + cur_wait_list = entity->wait_list; + prev_wait_list = &head_wait_list; -static int sdu_segment_in_ack_list_full(nr_rlc_sdu_segment_t *sdu) -{ - int target_count = sdu->sdu->ref_count; - int actual_count = 0; - int sn = sdu->sdu->sn; + head_retransmit_list.next = NULL; + cur_retransmit_list = entity->retransmit_list; + new_retransmit_list = &head_retransmit_list; - while (sdu != NULL && sdu->sdu->sn == sn) { - actual_count++; - sdu = sdu->next; + nr_rlc_pdu_decoder_init(&decoder, buffer, size); + nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); /* dc */ + + cpt = nr_rlc_pdu_decoder_get_bits(&decoder, 3); R(decoder); + if (cpt != 0) { + LOG_E(RLC, "%s:%d:%s: warning: discard PDU, CPT not 0 (%d)\n", + __FILE__, __LINE__, __FUNCTION__, cpt); + goto err; + } + ack_sn = nr_rlc_pdu_decoder_get_bits(&decoder, entity->sn_field_length); R(decoder); + e1 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); + /* r bits */ + if (entity->sn_field_length == 18) { + nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); + } else { + nr_rlc_pdu_decoder_get_bits(&decoder, 7); R(decoder); } - return actual_count == target_count; -} - -static void finalize_ack_nack_processing(nr_rlc_entity_am_t *entity) -{ - nr_rlc_sdu_segment_t *cur = entity->ack_list; - int sn; - - /* - send indication of successful delivery for all consecutive acked SDUs - * starting from tx_next_ack. Also free them. - * - update tx_next_ack to the next SN not acked yet + /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is + * received for the SN 'poll_sn' - check ACK case (NACK done below) */ - /* todo: send indication of successful delivery as soon as possible as - * the specs say (38.322 5.2.3.1.1). As the code is, if we receive - * ack for SN+2 we won't indicate successful delivery before - * SN+1 has been indicated. + if (sn_compare_tx(entity, entity->poll_sn, ack_sn) < 0) + entity->t_poll_retransmit_start = 0; + + while (e1) { + nack_sn = nr_rlc_pdu_decoder_get_bits(&decoder, entity->sn_field_length); R(decoder); + e1 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); + e2 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); + e3 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); + /* r bits */ + if (entity->sn_field_length == 18) { + nr_rlc_pdu_decoder_get_bits(&decoder, 3); R(decoder); + } else { + nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); + } + if (e2) { + so_start = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder); + so_end = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder); + } else { + so_start = 0; + so_end = 0xffff; + } + if (e3) { + range = nr_rlc_pdu_decoder_get_bits(&decoder, 8); R(decoder); + } else { + range = 1; + } + /* special value 0xffff indicates 'all bytes to the end' */ + if (so_end == 0xffff) + so_end = -1; + + /* process nacks */ + for (i = 0; i < range; i++) { + int cur_nack_sn = (nack_sn + i) % entity->sn_modulus; + int cur_so_start = i == 0 ? so_start : 0; + int cur_so_end = i == range - 1 ? so_end : -1; + + /* check that current nack is > previous nack and <= ack + * if not then skip it and all following nacks, and + * do not touch t_poll_retransmit + */ + if (prev_nack_sn != -1) { + int cmp = sn_compare_tx(entity, cur_nack_sn, prev_nack_sn); + if (cmp < 0 + || (cmp == 0 + && (prev_so_end == -1 + || cur_so_start <= prev_so_end))) { + LOG_E(RLC, "%s:%d:%s: bad NACK (nack sn %d so start/end %d/%d, previous nack sn %d so start/end %d/%d), skip it and all following NACKs\n", + __FILE__, __LINE__, __FUNCTION__, + cur_nack_sn, cur_so_start, cur_so_end, + prev_nack_sn, prev_so_start, prev_so_end); + goto nacks_done; + } + } + if (sn_compare_tx(entity, cur_nack_sn, ack_sn) > 0) { + LOG_E(RLC, "%s:%d:%s: bad NACK (nack %d ack %d), skip it and all following NACKs\n", + __FILE__, __LINE__, __FUNCTION__, + cur_nack_sn, ack_sn); + goto nacks_done; + } + +process_next_pdu: + /* process smallest SN either from wait_list or retransmit list */ + if (cur_wait_list == NULL && cur_retransmit_list == NULL) + goto lists_over; + if (cur_wait_list == NULL) + goto process_retransmit_list_head; + if (cur_retransmit_list == NULL) + goto process_wait_list_head; + if (cur_wait_list->sdu->sn < cur_retransmit_list->sdu->sn + || (cur_wait_list->sdu->sn == cur_retransmit_list->sdu->sn && + cur_wait_list->so < cur_retransmit_list->so)) + goto process_wait_list_head; + goto process_retransmit_list_head; + +process_wait_list_head: + /* if nack overlaps with current segment, put it in retransmit list */ + if (cur_wait_list->sdu->sn == cur_nack_sn + && so_overlap(cur_so_start, cur_so_end, + cur_wait_list->so, + cur_wait_list->so + cur_wait_list->size - 1)) { + prev_wait_list->next = cur_wait_list->next; + if (cur_wait_list == entity->wait_end) + end_wait_list = prev_wait_list; + cur_wait_list->next = NULL; + new_retransmit_list->next = cur_wait_list; + new_retransmit_list = cur_wait_list; + /* increase retx count. Don't care about segmentation, so maybe we + * increase too much. + */ + cur_wait_list->sdu->retx_count++; + /* report max RETX reached for all retx_count >= max_retx_threshold + * (specs say to report if retx_count == max_retx_threshold). + * Upper layers should react (radio link failure), so no big deal. + * We deal with segmentation by requiring + * retx_count >= max_retx_threshold * number of segments. + * We may report max RETX reached too late/early. To be refined if + * this is a problem. + */ + if (cur_wait_list->sdu->retx_count + >= entity->max_retx_threshold * cur_wait_list->sdu->ref_count) + entity->common.max_retx_reached(entity->common.max_retx_reached_data, + (nr_rlc_entity_t *)entity); + /* update buffer status */ + entity->common.bstatus.retx_size += compute_pdu_header_size(entity, cur_wait_list) + + cur_wait_list->size; + /* and go process the next pdu, still for the current nack */ + cur_wait_list = prev_wait_list->next; + goto process_next_pdu; + } + + /* if current segment SN > current NACK, we can't classify it yet */ + if (sn_compare_tx(entity, cur_wait_list->sdu->sn, cur_nack_sn) > 0 + || (cur_wait_list->sdu->sn == cur_nack_sn + && cur_wait_list->so > cur_so_start)) + goto done_nack; + + /* if current segment is acked, free it, indicate successful delivery + * if fully acked + */ + if (sn_compare_tx(entity, cur_wait_list->sdu->sn, ack_sn) < 0) { + nr_rlc_sdu_segment_t *cur = cur_wait_list; + int upper_layer_id = cur->sdu->upper_layer_id; + int sdu_size = cur->sdu->size; + cur_wait_list = cur_wait_list->next; + prev_wait_list->next = cur_wait_list; + if (cur_wait_list == entity->wait_end) + end_wait_list = prev_wait_list; + if (nr_rlc_free_sdu_segment(cur)) { + entity->tx_size -= sdu_size; + entity->common.sdu_successful_delivery( + entity->common.sdu_successful_delivery_data, + (nr_rlc_entity_t *)entity, upper_layer_id); + } + goto process_next_pdu; + } + + /* if current segment SN > ack_sn, we're done with this list */ + if (sn_compare_tx(entity, cur_wait_list->sdu->sn, ack_sn) > 0) { + cur_wait_list = NULL; + goto process_next_pdu; + } + + /* current segment SN == ack_sn, skip this segment and move to the next. + * Not sure if correct, can we get a nack_sn == ack_sn? 38.322 5.3.4 says + * "set the ACK_SN to the SN of the next not received RLC SDU which is + * not indicated as missing in the resulting STATUS PDU." Is it okay to + * receive some NACK for a given SN and an ACK == this SN? I can see a + * case where it's possible (only parts of an SN were received and the + * TB is too small to report the several NACKs for this SN, then we + * can't set ACK = SN+1 but in this case, shouldn't we skip sending + * NACKs for this SN and only send ACK = SN? our current implementation + * does send both NACKs and ACK, see function generate_status()). + */ + prev_wait_list = cur_wait_list; + cur_wait_list = cur_wait_list->next; + goto process_next_pdu; + +process_retransmit_list_head: + /* if nack overlaps with current segment, leave it in retransmit list */ + if (cur_retransmit_list->sdu->sn == cur_nack_sn + && so_overlap(cur_so_start, cur_so_end, + cur_retransmit_list->so, + cur_retransmit_list->so + cur_retransmit_list->size - 1)) { + new_retransmit_list->next = cur_retransmit_list; + cur_retransmit_list = cur_retransmit_list->next; + new_retransmit_list = new_retransmit_list->next; + new_retransmit_list->next = NULL; + /* go process the next pdu, still for the current nack */ + goto process_next_pdu; + } + + /* if current segment SN > current NACK, we can't classify it yet */ + if (sn_compare_tx(entity, cur_retransmit_list->sdu->sn, cur_nack_sn) > 0 + || (cur_retransmit_list->sdu->sn == cur_nack_sn + && cur_retransmit_list->so > cur_so_start)) + goto done_nack; + + /* if current segment is acked, free it, indicate successful delivery + * if fully acked + */ + if (sn_compare_tx(entity, cur_retransmit_list->sdu->sn, ack_sn) < 0) { + nr_rlc_sdu_segment_t *cur = cur_retransmit_list; + int upper_layer_id = cur->sdu->upper_layer_id; + int sdu_size = cur->sdu->size; + cur_retransmit_list = cur_retransmit_list->next; + /* update buffer status */ + entity->common.bstatus.retx_size -= compute_pdu_header_size(entity, cur) + + cur->size; + if (nr_rlc_free_sdu_segment(cur)) { + entity->tx_size -= sdu_size; + entity->common.sdu_successful_delivery( + entity->common.sdu_successful_delivery_data, + (nr_rlc_entity_t *)entity, upper_layer_id); + } + goto process_next_pdu; + } + + /* current segment SN >= ack_sn + * if the wait list is empty, then put the remaining retransmit list at + * the end of the new retransmit list (just a speedup) + * if not, put only this segment + */ + if (cur_wait_list == NULL) { + new_retransmit_list->next = cur_retransmit_list; + cur_retransmit_list = NULL; + goto lists_over; + } + new_retransmit_list->next = cur_retransmit_list; + cur_retransmit_list = cur_retransmit_list->next; + new_retransmit_list = new_retransmit_list->next; + new_retransmit_list->next = NULL; + goto process_next_pdu; + +done_nack: + prev_nack_sn = cur_nack_sn; + prev_so_start = cur_so_start; + prev_so_end = cur_so_end; + } /* for (i = 0; i < range; i++) */ + +lists_over: + /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is + * received for the SN 'poll_sn' - check NACK case (ACK done above) + */ + if (sn_compare_tx(entity, nack_sn, entity->poll_sn) <= 0 && + sn_compare_tx(entity, entity->poll_sn, (nack_sn + range) % entity->sn_modulus) < 0) + entity->t_poll_retransmit_start = 0; + } /* while (e1) */ + +nacks_done: + /* nacks done, finish with ack */ + /* we may report successful delivery out of order, if it's a problem + * then we can have a single loop and deal with the smallest sn of + * the current head of wait list and the current head of retransmit list. + * (It's simpler to process those two lists the one after the other.) */ - while (cur != NULL && cur->sdu->sn == entity->tx_next_ack && - sdu_segment_in_ack_list_full(cur)) { - entity->tx_size -= cur->sdu->size; - sn = cur->sdu->sn; - entity->common.sdu_successful_delivery( - entity->common.sdu_successful_delivery_data, - (nr_rlc_entity_t *)entity, cur->sdu->upper_layer_id); - while (cur != NULL && cur->sdu->sn == sn) { - nr_rlc_sdu_segment_t *s = cur; - cur = cur->next; - nr_rlc_free_sdu_segment(s); + /* deal with wait list */ + while (cur_wait_list != NULL + && sn_compare_tx(entity, cur_wait_list->sdu->sn, ack_sn) < 0) { + /* current segment is acked, free it, indicate successful delivery + * if fully acked + */ + nr_rlc_sdu_segment_t *cur = cur_wait_list; + int upper_layer_id = cur->sdu->upper_layer_id; + int sdu_size = cur->sdu->size; + prev_wait_list->next = cur_wait_list->next; + if (cur_wait_list == entity->wait_end) + end_wait_list = prev_wait_list; + cur_wait_list = cur_wait_list->next; + if (nr_rlc_free_sdu_segment(cur)) { + entity->tx_size -= sdu_size; + entity->common.sdu_successful_delivery( + entity->common.sdu_successful_delivery_data, + (nr_rlc_entity_t *)entity, upper_layer_id); } - entity->ack_list = cur; - entity->tx_next_ack = (entity->tx_next_ack + 1) % entity->sn_modulus; } + /* deal with retransmit list */ + while (cur_retransmit_list != NULL + && sn_compare_tx(entity, cur_retransmit_list->sdu->sn, ack_sn) < 0) { + /* current segment is acked, free it, indicate successful delivery + * if fully acked + */ + nr_rlc_sdu_segment_t *cur = cur_retransmit_list; + int upper_layer_id = cur->sdu->upper_layer_id; + int sdu_size = cur->sdu->size; + cur_retransmit_list = cur_retransmit_list->next; + /* update buffer status */ + entity->common.bstatus.retx_size -= compute_pdu_header_size(entity, cur) + + cur->size; + if (nr_rlc_free_sdu_segment(cur)) { + entity->tx_size -= sdu_size; + entity->common.sdu_successful_delivery( + entity->common.sdu_successful_delivery_data, + (nr_rlc_entity_t *)entity, upper_layer_id); + } + } + + new_retransmit_list->next = cur_retransmit_list; + + entity->wait_list = head_wait_list.next; + entity->retransmit_list = head_retransmit_list.next; + + if (end_wait_list != NULL) { + if (end_wait_list == &head_wait_list) + entity->wait_end = NULL; + else + entity->wait_end = end_wait_list; + } + + /* update tx_next_ack */ + /* 38.322 5.2.3.1.1 says "set TX_Next_Ack equal to the SN of the RLC SDU + * with the smallest SN, whose SN falls within the range + * TX_Next_Ack <= SN <= TX_Next and for which a positive acknowledgment + * has not been received yet. + */ + /* let's start from highest possible value and go down as needed */ + tx_next_ack = entity->tx_next; + if (entity->wait_list != NULL + && sn_compare_tx(entity, entity->wait_list->sdu->sn, tx_next_ack) < 0) + tx_next_ack = entity->wait_list->sdu->sn; + if (entity->retransmit_list != NULL + && sn_compare_tx(entity, entity->retransmit_list->sdu->sn, tx_next_ack) < 0) + tx_next_ack = entity->retransmit_list->sdu->sn; + if (sn_compare_tx(entity, ack_sn, tx_next_ack) < 0) + tx_next_ack = ack_sn; + entity->tx_next_ack = tx_next_ack; + + return; + +err: + LOG_E(RLC, "%s:%d:%s: error decoding PDU, NR RLC entity in inconsistent state\n", + __FILE__, __LINE__, __FUNCTION__); + +#undef R } void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, @@ -540,7 +674,6 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, #define R(d) do { if (nr_rlc_pdu_decoder_in_error(&d)) goto err; } while (0) nr_rlc_entity_am_t *entity = (nr_rlc_entity_am_t *)_entity; nr_rlc_pdu_decoder_t decoder; - nr_rlc_pdu_decoder_t control_decoder; nr_rlc_pdu_t *pdu; int dc; int p = 0; @@ -551,23 +684,11 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, int is_first; int is_last; - int cpt; - int e1; - int e2; - int e3; - int ack_sn; - int nack_sn; - int so_start; - int so_end; - int range; - int control_e1; - int control_e2; - int control_e3; - unsigned char sn_set[32768]; /* used to dec retx_count only once per sdu */ - nr_rlc_pdu_decoder_init(&decoder, buffer, size); dc = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - if (dc == 0) goto control; + + if (dc == 0) + return process_control_pdu(entity, buffer, size); /* data PDU */ p = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); @@ -596,20 +717,20 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, /* dicard PDU if no data */ if (data_size <= 0) { - LOG_W(RLC, "%s:%d:%s: warning: discard PDU, no data\n", + LOG_D(RLC, "%s:%d:%s: warning: discard PDU, no data\n", __FILE__, __LINE__, __FUNCTION__); goto discard; } /* dicard PDU if rx buffer is full */ if (entity->rx_size + data_size > entity->rx_maxsize) { - LOG_W(RLC, "%s:%d:%s: warning: discard PDU, RX buffer full\n", + LOG_D(RLC, "%s:%d:%s: warning: discard PDU, RX buffer full\n", __FILE__, __LINE__, __FUNCTION__); goto discard; } if (!sn_in_recv_window(entity, sn)) { - LOG_W(RLC, "%s:%d:%s: warning: discard PDU, sn out of window (sn %d rx_next %d)\n", + LOG_D(RLC, "%s:%d:%s: warning: discard PDU, sn out of window (sn %d rx_next %d)\n", __FILE__, __LINE__, __FUNCTION__, sn, entity->rx_next); goto discard; @@ -617,7 +738,7 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, /* discard segment if all the bytes of the segment are already there */ if (segment_already_received(entity, sn, so, data_size)) { - LOG_W(RLC, "%s:%d:%s: warning: discard PDU, already received\n", + LOG_D(RLC, "%s:%d:%s: warning: discard PDU, already received\n", __FILE__, __LINE__, __FUNCTION__); goto discard; } @@ -650,118 +771,6 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, return; -control: - cpt = nr_rlc_pdu_decoder_get_bits(&decoder, 3); R(decoder); - if (cpt != 0) { - LOG_W(RLC, "%s:%d:%s: warning: discard PDU, CPT not 0 (%d)\n", - __FILE__, __LINE__, __FUNCTION__, cpt); - goto discard; - } - ack_sn = nr_rlc_pdu_decoder_get_bits(&decoder, entity->sn_field_length); R(decoder); - e1 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - /* r bits */ - if (entity->sn_field_length == 18) { - nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - } else { - nr_rlc_pdu_decoder_get_bits(&decoder, 7); R(decoder); - } - - /* let's try to parse the control PDU once to check consistency */ - control_decoder = decoder; - control_e1 = e1; - while (control_e1) { - nack_sn = nr_rlc_pdu_decoder_get_bits(&control_decoder, entity->sn_field_length); R(control_decoder); - control_e1 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); - control_e2 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); - control_e3 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); - /* r bits */ - if (entity->sn_field_length == 18) { - nr_rlc_pdu_decoder_get_bits(&control_decoder, 3); R(control_decoder); - } else { - nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); - } - /* check range and so_start/so_end consistency */ - if (control_e2) { - so_start = nr_rlc_pdu_decoder_get_bits(&control_decoder, 16); R(control_decoder); - so_end = nr_rlc_pdu_decoder_get_bits(&control_decoder, 16); R(control_decoder); - } else { - so_start = 0; - so_end = 0xffff; - } - if (control_e3) { - range = nr_rlc_pdu_decoder_get_bits(&control_decoder, 8); R(control_decoder); - } else { - range = 1; - } - if (range < 1) { - LOG_E(RLC, "%s:%d:%s: error, bad 'range' in RLC NACK (sn %d)\n", - __FILE__, __LINE__, __FUNCTION__, nack_sn); - goto err; - } - /* so_start can be > so_end if more than one range; they don't refer - * to the same PDU then - */ - if (range == 1 && so_end < so_start) { - LOG_E(RLC, "%s:%d:%s: error, bad so start/end (sn %d)\n", - __FILE__, __LINE__, __FUNCTION__, nack_sn); - goto err; - } - } - - /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is - * received for the SN 'poll_sn' - check ACK case (NACK done below) - */ - if (sn_compare_tx(entity, entity->poll_sn, ack_sn) < 0) - entity->t_poll_retransmit_start = 0; - - /* at this point, accept the PDU even if the actual values - * may be incorrect (eg. if so_start > so_end) - */ - process_received_ack(entity, ack_sn); - - if (e1) - memset(sn_set, 0, 32768); - - while (e1) { - nack_sn = nr_rlc_pdu_decoder_get_bits(&decoder, entity->sn_field_length); R(decoder); - e1 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - e2 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - e3 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - /* r bits */ - if (entity->sn_field_length == 18) { - nr_rlc_pdu_decoder_get_bits(&decoder, 3); R(decoder); - } else { - nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - } - if (e2) { - so_start = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder); - so_end = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder); - } else { - so_start = 0; - so_end = 0xffff; - } - if (e3) { - range = nr_rlc_pdu_decoder_get_bits(&decoder, 8); R(decoder); - } else { - range = 1; - } - /* special value 0xffff indicates 'all bytes to the end' */ - if (so_end == 0xffff) - so_end = -1; - process_received_nack(entity, nack_sn, so_start, so_end, range, sn_set); - - /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is - * received for the SN 'poll_sn' - check NACK case (ACK done above) - */ - if (sn_compare_tx(entity, nack_sn, entity->poll_sn) <= 0 && - sn_compare_tx(entity, entity->poll_sn, (nack_sn + range) % entity->sn_modulus) < 0) - entity->t_poll_retransmit_start = 0; - } - - finalize_ack_nack_processing(entity); - - return; - err: LOG_W(RLC, "%s:%d:%s: error decoding PDU, discarding\n", __FILE__, __LINE__, __FUNCTION__); goto discard; @@ -1225,7 +1234,7 @@ static int generate_missing(nr_rlc_entity_am_t *entity, static int generate_status(nr_rlc_entity_am_t *entity, char *buffer, int size) { int ack_sn = entity->rx_next; - missing_data_t m; + missing_data_t m; nr_rlc_pdu_t *cur; int nack_count = 0; nr_rlc_pdu_encoder_t encoder; @@ -1427,8 +1436,6 @@ static int generate_retx_pdu(nr_rlc_entity_am_t *entity, char *buffer, return 0; entity->retransmit_list = entity->retransmit_list->next; - if (entity->retransmit_list == NULL) - entity->retransmit_end = NULL; sdu->next = NULL; @@ -1444,15 +1451,24 @@ static int generate_retx_pdu(nr_rlc_entity_am_t *entity, char *buffer, /* put the second SDU back at the head of the retransmit list */ next_sdu->next = entity->retransmit_list; entity->retransmit_list = next_sdu; - if (entity->retransmit_end == NULL) - entity->retransmit_end = entity->retransmit_list; /* update buffer status */ entity->common.bstatus.retx_size += compute_pdu_header_size(entity, next_sdu) + next_sdu->size; } /* put SDU/SDU segment in the wait list */ - nr_rlc_sdu_segment_list_append(&entity->wait_list, &entity->wait_end, sdu); + /* speedup: check end of wait list, maybe the new sdu comes after */ + if (entity->wait_end == NULL + || sn_compare_tx(entity, sdu->sdu->sn, entity->wait_end->sdu->sn) > 0 + || (sn_compare_tx(entity, sdu->sdu->sn, entity->wait_end->sdu->sn) == 0 + && sdu->so > entity->wait_end->so)) + nr_rlc_sdu_segment_list_append(&entity->wait_list, &entity->wait_end, sdu); + else { + entity->wait_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity, + entity->wait_list, sdu); + if (entity->wait_list->next == NULL) + entity->wait_end = entity->wait_list; + } p = check_poll_after_pdu_assembly(entity); @@ -1519,7 +1535,18 @@ static int generate_tx_pdu(nr_rlc_entity_am_t *entity, char *buffer, int size) entity->tx_next = (entity->tx_next + 1) % entity->sn_modulus; /* put SDU/SDU segment in the wait list */ - nr_rlc_sdu_segment_list_append(&entity->wait_list, &entity->wait_end, sdu); + /* speedup: check end of wait list, probably the new sdu comes after */ + if (entity->wait_end == NULL + || sn_compare_tx(entity, sdu->sdu->sn, entity->wait_end->sdu->sn) > 0 + || (sn_compare_tx(entity, sdu->sdu->sn, entity->wait_end->sdu->sn) == 0 + && sdu->so > entity->wait_end->so)) + nr_rlc_sdu_segment_list_append(&entity->wait_list, &entity->wait_end, sdu); + else { + entity->wait_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity, + entity->wait_list, sdu); + if (entity->wait_list->next == NULL) + entity->wait_end = entity->wait_list; + } /* polling actions for a new PDU */ entity->pdu_without_poll++; @@ -1629,11 +1656,7 @@ void nr_rlc_entity_am_recv_sdu(nr_rlc_entity_t *_entity, static void check_t_poll_retransmit(nr_rlc_entity_am_t *entity) { - nr_rlc_sdu_segment_t head; nr_rlc_sdu_segment_t *cur; - nr_rlc_sdu_segment_t *prev; - int sn; - int old_retx_count; /* 38.322 5.3.3.4 */ /* did t_poll_retransmit expire? */ @@ -1659,74 +1682,58 @@ static void check_t_poll_retransmit(nr_rlc_entity_am_t *entity) */ entity->force_poll = 1; - LOG_W(RLC, "%s:%d:%s: warning: t_poll_retransmit expired\n", + LOG_D(RLC, "%s:%d:%s: warning: t_poll_retransmit expired\n", __FILE__, __LINE__, __FUNCTION__); /* do we meet conditions of 38.322 5.3.3.4? */ if (!check_poll_after_pdu_assembly(entity)) return; - /* search wait list for SDU with highest SN */ - /* this code may be incorrect: in LTE we had to look for PDU - * with SN = VT(S) - 1, but for NR the specs say "highest SN among the - * ones submitted to lower layers" not 'tx_next - 1'. So we should look - * for the highest SN in the wait list. But that's no big deal. If the - * program runs this code, then the connection is in a bad state and we - * can retransmit whatever we want. At some point we will receive a status - * report and retransmit what we really have to. Actually we could just - * retransmit the head of wait list (the specs have this 'or'). - * (Actually, maybe this interpretation is not correct and what the code - * does is correct. The specs are confusing.) + /* retransmit the head of wait list, this is the case + * "consider any RLC SDU which has not been positively acknowledged for + * retransmission" of 36.322 5.3.3.4. + * We don't search for the highest SN, it's simpler to just take the head + * of wait list. This can be changed if needed. */ - sn = (entity->tx_next - 1 + entity->sn_modulus) % entity->sn_modulus; - - head.next = entity->wait_list; cur = entity->wait_list; - prev = &head; - - while (cur != NULL) { - if (cur->sdu->sn == sn) - break; - prev = cur; - cur = cur->next; - } - - /* SDU with highest SN not found? take the head of wait list */ - if (cur == NULL) { - cur = entity->wait_list; - prev = &head; - sn = cur->sdu->sn; - } /* todo: do we need to for check cur == NULL? * It seems that no, the wait list should not be empty here, but not sure. */ - old_retx_count = cur->sdu->retx_count; + entity->wait_list = cur->next; + if (entity->wait_list == NULL) + entity->wait_end = NULL; - /* 38.322 says "SDU", not "SDU segment", so let's retransmit all - * SDU segments with this SN + /* 38.322 says "SDU", not "SDU segment", but let's retransmit only + * the 'cur' SDU segment. To be changed if needed. (Maybe we have + * to retransmit all SDU segments with the same SN that are in the + * wait list.) */ - /* todo: maybe we could simply retransmit the current SDU segment, - * so that we don't have to run through the full wait list. + + /* increase retx count. Don't care about segmentation, so maybe we + * increase too much. */ - while (cur != NULL) { - if (cur->sdu->sn == sn) { - prev->next = cur->next; - cur->next = NULL; - /* put in retransmit list */ - consider_retransmission(entity, cur, - old_retx_count == cur->sdu->retx_count); - } else { - prev = cur; - } - cur = prev->next; - } - entity->wait_list = head.next; - /* reset wait_end (todo: optimize?) */ - entity->wait_end = entity->wait_list; - while (entity->wait_end != NULL && entity->wait_end->next != NULL) - entity->wait_end = entity->wait_end->next; + cur->sdu->retx_count++; + /* report max RETX reached for all retx_count >= max_retx_threshold + * (specs say to report if retx_count == max_retx_threshold). + * Upper layers should react (radio link failure), so no big deal. + * We deal with segmentation by requiring + * retx_count >= max_retx_threshold * number of segments. + * We may report max RETX reached too late/early. To be refined if + * this is a problem. + */ + if (cur->sdu->retx_count + >= entity->max_retx_threshold * cur->sdu->ref_count) + entity->common.max_retx_reached(entity->common.max_retx_reached_data, + (nr_rlc_entity_t *)entity); + /* update buffer status */ + entity->common.bstatus.retx_size += compute_pdu_header_size(entity, cur) + + cur->size; + + /* put in retransmit list */ + entity->retransmit_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity, + entity->retransmit_list, cur); } static void check_t_reassembly(nr_rlc_entity_am_t *entity) @@ -1815,6 +1822,7 @@ void nr_rlc_entity_am_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id) entity->common.bstatus.tx_size -= compute_pdu_header_size(entity, cur) + cur->size; + entity->tx_size -= cur->sdu->size; nr_rlc_free_sdu_segment(cur); } @@ -1857,7 +1865,6 @@ static void clear_entity(nr_rlc_entity_am_t *entity) nr_rlc_free_sdu_segment_list(entity->tx_list); nr_rlc_free_sdu_segment_list(entity->wait_list); nr_rlc_free_sdu_segment_list(entity->retransmit_list); - nr_rlc_free_sdu_segment_list(entity->ack_list); entity->tx_list = NULL; entity->tx_end = NULL; @@ -1867,9 +1874,6 @@ static void clear_entity(nr_rlc_entity_am_t *entity) entity->wait_end = NULL; entity->retransmit_list = NULL; - entity->retransmit_end = NULL; - - entity->ack_list = NULL; entity->common.bstatus.tx_size = 0; entity->common.bstatus.retx_size = 0; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h index 453fe87026..57ae1a3485 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h @@ -84,9 +84,6 @@ typedef struct { nr_rlc_sdu_segment_t *wait_end; nr_rlc_sdu_segment_t *retransmit_list; - nr_rlc_sdu_segment_t *retransmit_end; - - nr_rlc_sdu_segment_t *ack_list; } nr_rlc_entity_am_t; void nr_rlc_entity_am_recv_sdu(nr_rlc_entity_t *entity, diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c index ef0d52558a..ef64389ac5 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c @@ -58,14 +58,19 @@ oom: exit(1); } -void nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu) +int nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu) { - sdu->sdu->ref_count--; - if (sdu->sdu->ref_count == 0) { + int ret = 0; + + sdu->sdu->free_count++; + if (sdu->sdu->free_count == sdu->sdu->ref_count) { free(sdu->sdu->data); free(sdu->sdu); + ret = 1; } free(sdu); + + return ret; } void nr_rlc_sdu_segment_list_append(nr_rlc_sdu_segment_t **list, diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h index f4585fb7d6..20cc90f185 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h @@ -30,6 +30,10 @@ typedef struct nr_rlc_sdu_t { int retx_count; int ref_count; /* incremented each time the SDU is segmented */ + int free_count; /* incremented each time a segment is freed + * when it equals ref_count we can free the SDU + * completely + */ } nr_rlc_sdu_t; typedef struct nr_rlc_sdu_segment_t { @@ -44,7 +48,8 @@ typedef struct nr_rlc_sdu_segment_t { nr_rlc_sdu_segment_t *nr_rlc_new_sdu( char *buffer, int size, int upper_layer_id); -void nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu); +/* return 1 if the SDU has been freed too, 0 if not (more segments to free) */ +int nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu); void nr_rlc_sdu_segment_list_append(nr_rlc_sdu_segment_t **list, nr_rlc_sdu_segment_t **end, nr_rlc_sdu_segment_t *sdu); diff --git a/openair2/LAYER2/nr_rlc/tests/test14.txt.gz b/openair2/LAYER2/nr_rlc/tests/test14.txt.gz index 53616dae3d10b71375cea41ca9061d4304f64dcf..45e54651eb317c3b7695cfcab7428fe43172227b 100644 GIT binary patch delta 727 zcmV;|0x12M2A>9hABzYGOnK#D0t0kqb96B@E_8Tw0Ns{LYhyM4NCCm^MOEKZ=bSpax9>mP-mu=3)#kg~ z{rThj8|)3M(LUX+`va@j9?Uh<1qmfF$t3~1yeB%vosFO z#2T!{I;>z7>#+eFu?d^81zWKV+pz;XaRz5`4ktLpd0fCnT*75s!Bt$tb=<&B#31&! zL;SywKgOzT#@(NN`vhKg;G5awH34cl-io5)8o-96^ro zpHsnJ_7p$=^5cGtJ|6BrjTIk$`uLMT0at$vP`7iA)!mX%o9%j^RLk>jKZUUQ`|)I! zIsZ8yU2wvJ@)Tmb-w|Qw9P6%ww$qNiXy`iu^vJPt=-3>{k(|hxT*#H&$eldMlVT{A z;wVBZySmsfn7Yg<7eN+Npy&cMfQl=4gLH zQ<|p*T0Ed$-|AR>on!U9W92$%JMGxZhwk61xPQ6g`}*+g3(d1H+*#%={g3gIP9hHf zB3?d{PR8rfxRclNS6Q>(wl>!5xqW!}{G|Tq?@rXaSJulb>i-AdiJFg6Qx8+KC0eEx zTBS8wrw!Vq8@i=Cy3m#G>46^UiJpJygt< zMrRDhWE!SrI;Jp{>6w8UnTeT?2RNsLUiKJ|DVDz#W0#M8XO(ASA-o{R%-L87Cu3pP zxT8y7xVC4Yo=z|?M>kyg;_oR>{y$RwjmE1a;Pl2_0rqh2kKgKnX5n#7%(Dw?@)b>e JEYZ;s0009vZy5jp delta 720 zcmV;>0x$ia2ABqaABzYG$u*{70t0kqb96B@E_8Tw0Ns{5ZyZMugmeFjFSHY5X1eFa zP>|rviKxghhZ@~X5=8Fzp5?Gt#}fp2Dy-&}qd?nniDsDd~|5Jfx^kccECBL%5QLpm~$i5k?R z4i!{Uj|MbCq6y7tK`YwOjt+D#=i@EjEsWt6@9_a2@d=;t1z+(E-|-8WNiYOUa0EHR ze@+E^*zjQWeLUQM9xL9z{qU1O0at%CP`7iA)!mX%o9%j^RLlEr--WRG>v3h4 zKL1%C9dN>e@)Tmb=ZLU#j&;{T+iAyMH1wSSdgNF+bZidfNKWKTF62sXuXU`x%&~gjv2q=>op$WyL-(&$+<(8~`}*+gh344{cb0k0{>OMpClQB# z5idVUC*w8!FaFCkAElHYrc_I`Oe?fXYqU-qv`IH~OLugkE8WurJ<=0B(+j=Q8@(^H zK%Wf5unfl#hB7=OFd`!{GNUjmqcMLvV=yMuFfG$Dg{e%>49v((%zWIyIUV$}+jvZk z{H@ryeC#``JTr#jJ95LE9m8;P49{GBIsv>Kop9xYyr(ev|489CHeMwGrzhwNu!nOW zPOAr+E%mz|4S$w3>uqaey`I~Lhc8bQjQ;b9di%n9_riL4VZA?BT%gc&;HC?*=-Ux2N2b{wRPH`S*xPXhegv+>s>u^18z)gh>HzE!ZL=le| z5|D@_BqIgskRBP3iZo=W>c_jtnx ze8eYw#ut2t@9_h^;v0U%9444z9y2Up5ldLc3f5sgHeeNN*f{kk2tf&+V1z)3gha@M zLg)xRVIWk(1ZE^Uq7aqn4-(LQ0?~+p7>S9PiG|n^d*VQ>#6}!RjwB={d6JO=DUuQ? zlM1OL^`wDRNsTm;9a+dq_GBXmawI2mCKqx??#TnWk{fxXIEqk|;weT6zY_S=KDT9e z-7db=^%lKt&`*`_=XyFL?cvjV@kyTXb$9U1=6k&V{Bid3#4g;!XUEygmi=FtHymfL zPi)~meDMJLw!?SJ{&CJfKiM>|?dtNTEjfLAz6;&{nH)eRcJ1CuOUz_X^}+rFTP29vb2E|M*M~ sWUv0;muI7`KBVol{*!mmkK|+cZ5A^}_s6#07RbSZA0L&&0<;ML09iH+!vFvP literal 546 zcmV+-0^R)|iwFqSHKt(#19W9`bTKt9ba-?C&6P`QlR*@Q_x_4!sT-MdnOl}(ap$J( zN~C<3`J_-plBS}+-Xu+=(U?%dS{Q~|%o(2d%=^w85xL?J5Ch)#^eM9joOti+Dk z69?i*T)|AFKoXLY?5F_U7m%D3Nr{w6g;Yr$sV5Djk<>^NIgo{{WFtE{k`pmKl}&G&f!*=hCi#4g<9^V8~OtNt&{8&9j(C${h& zUpk_`?fCB1KhF7=XPd*vc5{8#=A6I1+=ceJXLd_|pe?q0@z>+w_Vs-pYNI?TXxqgq zp!fY;&#R#8z8mFVg>l0vf4Y(9|BtyIiPHFgACgUP^-sNh)?e%n{e<0z-|k|qG4Qop kuviX5TP&vK&CR!63)=YlP=P$QK#vyu0JKzLn6wE10El1~J^%m! From 33663e68b093ffdb28ff5e31f9dd3f360eb9dbf7 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 19 Apr 2022 18:37:14 +0200 Subject: [PATCH 19/39] rename frame_type --- common/utils/nr/nr_common.c | 4 ++-- common/utils/nr/nr_common.h | 2 +- openair1/PHY/LTE_TRANSPORT/prach.c | 2 +- openair1/PHY/LTE_TRANSPORT/prach_common.c | 2 +- openair1/PHY/LTE_TRANSPORT/prach_extern.h | 2 +- openair1/PHY/LTE_TRANSPORT/transport_common_proto.h | 4 ++-- openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c | 10 +++++----- openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c | 2 +- openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h | 4 ++-- openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h | 4 ++-- openair1/PHY/defs_common.h | 4 ++-- openair1/PHY/defs_nr_common.h | 2 +- openair1/SCHED/phy_procedures_lte_common.c | 2 +- openair1/SCHED/sched_common.h | 2 +- openair1/SCHED/sched_eNB.h | 2 +- openair1/SCHED_UE/phy_procedures_lte_ue.c | 2 +- openair1/SCHED_UE/sched_UE.h | 2 +- openair1/SIMULATION/LTE_PHY/pdcchsim.c | 2 +- openair2/COMMON/m2ap_messages_types.h | 4 ++-- openair2/COMMON/m3ap_messages_types.h | 2 +- openair2/COMMON/phy_messages_types.h | 2 +- openair2/COMMON/rrc_messages_types.h | 4 ++-- openair2/COMMON/x2ap_messages_types.h | 2 +- openair2/ENB_APP/RRC_config_tools.h | 2 +- openair2/ENB_APP/flexran_agent_ran_api.c | 2 +- openair2/ENB_APP/flexran_agent_ran_api.h | 2 +- openair2/GNB_APP/gnb_config.c | 2 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 2 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 2 +- openair2/LAYER2/NR_MAC_UE/config_ue.c | 2 +- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 2 +- openair2/LAYER2/NR_MAC_gNB/config.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 6 +++--- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 +- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 +- openair2/M2AP/m2ap_MCE_defs.h | 2 +- openair2/M2AP/m2ap_eNB_defs.h | 2 +- openair2/RRC/LTE/rrc_eNB_S1AP.c | 2 +- openair2/RRC/NR/nr_rrc_config.c | 4 ++-- openair2/UTIL/OCG/OCG.h | 2 +- openair2/X2AP/x2ap_eNB_defs.h | 2 +- openair3/M3AP/m3ap_MCE_defs.h | 2 +- openair3/M3AP/m3ap_MME_defs.h | 2 +- targets/RT/USER/lte-ue.c | 2 +- 45 files changed, 59 insertions(+), 59 deletions(-) diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index 49743b3bdc..0aeeaf3afd 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -336,9 +336,9 @@ int get_dmrs_port(int nl, uint16_t dmrs_ports) { return p; } -lte_frame_type_t get_frame_type(uint16_t current_band, uint8_t scs_index) +frame_type_t get_frame_type(uint16_t current_band, uint8_t scs_index) { - lte_frame_type_t current_type; + frame_type_t current_type; int32_t delta_duplex = get_delta_duplex(current_band, scs_index); if (delta_duplex == 0) diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index 0150cf59f8..a09532a565 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -63,7 +63,7 @@ void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset); uint16_t config_bandwidth(int mu, int nb_rb, int nr_band); int get_nr_table_idx(int nr_bandP, uint8_t scs_index); int32_t get_delta_duplex(int nr_bandP, uint8_t scs_index); -lte_frame_type_t get_frame_type(uint16_t nr_bandP, uint8_t scs_index); +frame_type_t get_frame_type(uint16_t nr_bandP, uint8_t scs_index); uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex); int NRRIV2BW(int locationAndBandwidth,int N_RB); int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB); diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index eb46a8d663..91c419ebe3 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -56,7 +56,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, uint8_t ce_level ) { int i; - lte_frame_type_t frame_type; + frame_type_t frame_type; uint16_t rootSequenceIndex; uint8_t prach_ConfigIndex; uint8_t Ncs_config; diff --git a/openair1/PHY/LTE_TRANSPORT/prach_common.c b/openair1/PHY/LTE_TRANSPORT/prach_common.c index e366e8edbc..f3409a90e3 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach_common.c +++ b/openair1/PHY/LTE_TRANSPORT/prach_common.c @@ -399,7 +399,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex, uint8_t prach_ConfigIndex, uint8_t zeroCorrelationZoneConfig, uint8_t highSpeedFlag, - lte_frame_type_t frame_type, + frame_type_t frame_type, uint32_t X_u[64][839]) { // Compute DFT of x_u => X_u[k] = x_u(inv(u)*k)^* X_u[k] = exp(j\pi u*inv(u)*k*(inv(u)*k+1)/N_ZC) unsigned int k,inv_u,i,NCS=0,num_preambles; diff --git a/openair1/PHY/LTE_TRANSPORT/prach_extern.h b/openair1/PHY/LTE_TRANSPORT/prach_extern.h index 3404646923..3403861011 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach_extern.h +++ b/openair1/PHY/LTE_TRANSPORT/prach_extern.h @@ -81,7 +81,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex, uint8_t prach_ConfigIndex, uint8_t zeroCorrelationZoneConfig, uint8_t highSpeedFlag, - lte_frame_type_t frame_type, + frame_type_t frame_type, uint32_t X_u[64][839]); #endif diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h index af8e63c3ed..74a38e58db 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h @@ -224,7 +224,7 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id); @returns 0-1 accordingly */ /* -uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type); +uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,frame_type_t frame_type); */ /*! @@ -247,7 +247,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex, uint8_t prach_ConfigIndex, uint8_t zeroCorrelationZoneConfig, uint8_t highSpeedFlag, - lte_frame_type_t frame_type, + frame_type_t frame_type, uint32_t X_u[64][839]); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c index efde277203..088e2c0a5e 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c @@ -64,7 +64,7 @@ extern uint16_t beta_cqi[16]; extern uint16_t beta_ri[16]; extern uint16_t beta_ack[16]; -void extract_dci1A_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) +void extract_dci1A_info(uint8_t N_RB_DL, frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) { uint8_t harq_pid=0; uint32_t rballoc=0; @@ -182,7 +182,7 @@ void extract_dci1A_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_ pdci_info_extarcted->dai = dai; } -void extract_dci1C_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) +void extract_dci1C_info(uint8_t N_RB_DL, frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) { uint32_t rballoc=0; @@ -222,7 +222,7 @@ void extract_dci1C_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_ pdci_info_extarcted->Ngap = Ngap; } -void extract_dci1_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) +void extract_dci1_info(uint8_t N_RB_DL, frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) { uint32_t rballoc=0; @@ -329,7 +329,7 @@ void extract_dci1_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_p } -void extract_dci2_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, uint8_t nb_antenna_ports_eNB, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) +void extract_dci2_info(uint8_t N_RB_DL, frame_type_t frame_type, uint8_t nb_antenna_ports_eNB, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) { uint32_t rballoc=0; @@ -615,7 +615,7 @@ void extract_dci2_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, uint8_t nb_ } -void extract_dci2A_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, uint8_t nb_antenna_ports_eNB, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) +void extract_dci2A_info(uint8_t N_RB_DL, frame_type_t frame_type, uint8_t nb_antenna_ports_eNB, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted) { uint32_t rballoc=0; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c index 82120dc3c3..4faa8367c3 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c @@ -46,7 +46,7 @@ //#define PRACH_DEBUG 1 int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint16_t Nf ) { - lte_frame_type_t frame_type = ue->frame_parms.frame_type; + frame_type_t frame_type = ue->frame_parms.frame_type; //uint8_t tdd_config = ue->frame_parms.tdd_config; uint16_t rootSequenceIndex = ue->frame_parms.prach_config_common.rootSequenceIndex; uint8_t prach_ConfigIndex = ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h index c5d096ceb7..05a5904971 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h +++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h @@ -1669,7 +1669,7 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id); @param frame_type 0-FDD, 1-TDD @returns 0-1 accordingly */ -uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type); +uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,frame_type_t frame_type); /*! \brief Helper for MAC, returns frequency index of PRACH resource in TDD for a particular configuration index @@ -1691,7 +1691,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex, uint8_t prach_ConfigIndex, uint8_t zeroCorrelationZoneConfig, uint8_t highSpeedFlag, - lte_frame_type_t frame_type, + frame_type_t frame_type, uint32_t X_u[64][839]); 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 dc0f38f096..65c0ec9381 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -1567,7 +1567,7 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id); @param frame_type 0-FDD, 1-TDD @returns 0-1 accordingly */ -uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type); +uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,frame_type_t frame_type); /*! \brief Helper for MAC, returns frequency index of PRACH resource in TDD for a particular configuration index @@ -1589,7 +1589,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex, uint8_t prach_ConfigIndex, uint8_t zeroCorrelationZoneConfig, uint8_t highSpeedFlag, - lte_frame_type_t frame_type, + frame_type_t frame_type, uint32_t X_u[64][839]); diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h index 86df85db5c..d13fe260de 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -99,7 +99,7 @@ #define NB_RX_ANTENNAS_MAX 64 -typedef enum {TDD=1,FDD=0} lte_frame_type_t; +typedef enum {TDD=1,FDD=0} frame_type_t; typedef enum {EXTENDED=1,NORMAL=0} lte_prefix_type_t; @@ -597,7 +597,7 @@ typedef struct LTE_DL_FRAME_PARMS { /// shift of pilot position in one RB uint8_t nushift; /// Frame type (0 FDD, 1 TDD) - lte_frame_type_t frame_type; + frame_type_t frame_type; /// TDD subframe assignment (0-7) (default = 3) (254=RX only, 255=TX only) uint8_t tdd_config; /// TDD S-subframe configuration (0-9) diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index 7c78d20ae5..756e6b7210 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -280,7 +280,7 @@ struct NR_DL_FRAME_PARMS { uint32_t att_rx; /// total Number of Resource Block Groups: this is ceil(N_PRB/P) /// Frame type (0 FDD, 1 TDD) - lte_frame_type_t frame_type; + frame_type_t frame_type; uint8_t tdd_config; /// Cell ID uint16_t Nid_cell; diff --git a/openair1/SCHED/phy_procedures_lte_common.c b/openair1/SCHED/phy_procedures_lte_common.c index 7033c52701..9de453da94 100644 --- a/openair1/SCHED/phy_procedures_lte_common.c +++ b/openair1/SCHED/phy_procedures_lte_common.c @@ -994,7 +994,7 @@ int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subf return(isSubframeSRS); } -void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset) +void compute_srs_pos(frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset) { if(TDD == frameType) { diff --git a/openair1/SCHED/sched_common.h b/openair1/SCHED/sched_common.h index c9fc338686..9f3e6695b6 100644 --- a/openair1/SCHED/sched_common.h +++ b/openair1/SCHED/sched_common.h @@ -339,7 +339,7 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe, unsig int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx); -void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); +void compute_srs_pos(frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); /* from here: prototype added to remove compilation warnings, doc to be written by the author of the function */ diff --git a/openair1/SCHED/sched_eNB.h b/openair1/SCHED/sched_eNB.h index de987b0ac7..efdb1bd199 100644 --- a/openair1/SCHED/sched_eNB.h +++ b/openair1/SCHED/sched_eNB.h @@ -215,7 +215,7 @@ int16_t get_target_pucch_rx_power(module_id_t module_idP, uint8_t CC_id); int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx); -void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); +void compute_srs_pos(frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); void release_rnti_of_phy(module_id_t mod_id); /*@}*/ diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index b02f24e04e..67513b9c59 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -574,7 +574,7 @@ void get_cqipmiri_params(PHY_VARS_UE *ue, } } -PUCCH_FMT_t get_pucch_format(lte_frame_type_t frame_type, +PUCCH_FMT_t get_pucch_format(frame_type_t frame_type, lte_prefix_type_t cyclic_prefix_type, uint8_t SR_payload, uint8_t nb_cw, diff --git a/openair1/SCHED_UE/sched_UE.h b/openair1/SCHED_UE/sched_UE.h index 32702b1148..0dbb779630 100644 --- a/openair1/SCHED_UE/sched_UE.h +++ b/openair1/SCHED_UE/sched_UE.h @@ -278,7 +278,7 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe, unsig int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx); -void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); +void compute_srs_pos(frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); /*@}*/ diff --git a/openair1/SIMULATION/LTE_PHY/pdcchsim.c b/openair1/SIMULATION/LTE_PHY/pdcchsim.c index bd2c2d66b9..50910290c3 100644 --- a/openair1/SIMULATION/LTE_PHY/pdcchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pdcchsim.c @@ -415,7 +415,7 @@ int main(int argc, char **argv) { uint8_t harq_pid; uint8_t phich_ACK; uint8_t num_phich_interf = 0; - lte_frame_type_t frame_type=TDD; + frame_type_t frame_type=TDD; // int re_offset; // uint32_t *txptr; int aarx; diff --git a/openair2/COMMON/m2ap_messages_types.h b/openair2/COMMON/m2ap_messages_types.h index c70c50fc64..460dbfc4bb 100644 --- a/openair2/COMMON/m2ap_messages_types.h +++ b/openair2/COMMON/m2ap_messages_types.h @@ -354,7 +354,7 @@ typedef struct m2ap_register_mce_req_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; int num_cc; @@ -427,7 +427,7 @@ typedef struct m2ap_register_enb_req_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; int num_cc; diff --git a/openair2/COMMON/m3ap_messages_types.h b/openair2/COMMON/m3ap_messages_types.h index 21e24dd449..36ac8fcc9a 100644 --- a/openair2/COMMON/m3ap_messages_types.h +++ b/openair2/COMMON/m3ap_messages_types.h @@ -123,7 +123,7 @@ typedef struct m3ap_register_mce_req_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; int num_cc; diff --git a/openair2/COMMON/phy_messages_types.h b/openair2/COMMON/phy_messages_types.h index 1f040a0a77..40e4678228 100644 --- a/openair2/COMMON/phy_messages_types.h +++ b/openair2/COMMON/phy_messages_types.h @@ -70,7 +70,7 @@ typedef struct CellInfo_s { //-------------------------------------------------------------------------------------------// // eNB: ENB_APP -> PHY messages typedef struct PhyConfigurationReq_s { - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; lte_prefix_type_t prefix_type[MAX_NUM_CCs]; uint32_t downlink_frequency[MAX_NUM_CCs]; int32_t uplink_frequency_offset[MAX_NUM_CCs]; diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index ac70dee092..5b214cf95a 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -188,7 +188,7 @@ typedef struct RrcConfigurationReq_s { uint32_t rrc_inactivity_timer_thres; // for testing, maybe change later paging_drx_t default_drx; int16_t nb_cc; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint8_t tdd_config[MAX_NUM_CCs]; uint8_t tdd_config_s[MAX_NUM_CCs]; lte_prefix_type_t prefix_type[MAX_NUM_CCs]; @@ -339,7 +339,7 @@ typedef struct NbIoTRrcConfigurationReq_s { uint16_t mcc; uint16_t mnc; uint8_t mnc_digit_length; - lte_frame_type_t frame_type; + frame_type_t frame_type; uint8_t tdd_config; uint8_t tdd_config_s; lte_prefix_type_t prefix_type; diff --git a/openair2/COMMON/x2ap_messages_types.h b/openair2/COMMON/x2ap_messages_types.h index 9339ab12f3..cd092b6ca8 100644 --- a/openair2/COMMON/x2ap_messages_types.h +++ b/openair2/COMMON/x2ap_messages_types.h @@ -138,7 +138,7 @@ typedef struct x2ap_register_enb_req_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; uint32_t subframeAssignment[MAX_NUM_CCs]; diff --git a/openair2/ENB_APP/RRC_config_tools.h b/openair2/ENB_APP/RRC_config_tools.h index 488441ff59..89cefeaa1f 100644 --- a/openair2/ENB_APP/RRC_config_tools.h +++ b/openair2/ENB_APP/RRC_config_tools.h @@ -38,7 +38,7 @@ typedef struct eutra_band_s { uint32_t ul_max; uint32_t dl_min; uint32_t dl_max; - lte_frame_type_t frame_type; + frame_type_t frame_type; } eutra_band_t; diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index 68d1f3311f..9926ec9e20 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -1352,7 +1352,7 @@ void flexran_agent_set_operating_bandwidth(mid_t mod_id, uint8_t cc_id, uint8_t } } -void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, lte_frame_type_t frame_type) { +void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, frame_type_t frame_type) { if (phy_is_present(mod_id, cc_id)) { RC.eNB[mod_id][cc_id]->frame_parms.frame_type = frame_type; } else { diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index 79115b0a16..c15865ccfd 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -433,7 +433,7 @@ void flexran_agent_set_operating_eutra_band(mid_t mod_id, uint8_t cc_id, uint8_t void flexran_agent_set_operating_bandwidth(mid_t mod_id, uint8_t cc_id, uint8_t N_RB); /*set frame type*/ -void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, lte_frame_type_t frame_type); +void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, frame_type_t frame_type); /*RRC status flexRAN*/ uint8_t flexran_get_rrc_status(mid_t mod_id, rnti_t rnti); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 434a2896de..2c486ec832 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -346,7 +346,7 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap) { // prepare DL Allocation lists nr_rrc_config_dl_tda(scc); - lte_frame_type_t frame_type = get_frame_type((int)*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + frame_type_t frame_type = get_frame_type((int)*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); if (frame_type == FDD) { ASN_STRUCT_FREE(asn_DEF_NR_TDD_UL_DL_ConfigCommon, scc->tdd_UL_DL_ConfigurationCommon); scc->tdd_UL_DL_ConfigurationCommon = NULL; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index b25efbb5d8..581930b83d 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -3092,7 +3092,7 @@ int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slo else return(slot_in_period <= slots1+tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0); } -int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slot, lte_frame_type_t frame_type) { +int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slot, frame_type_t frame_type) { int period,period1,period2=0; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 0f2cb42b88..e8a3af2498 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -45,7 +45,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slot_t slotP); -int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slotP, lte_frame_type_t frame_type); +int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slotP, frame_type_t frame_type); uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDLBWP, const NR_BWP_UplinkCommon_t *initialULBWP, diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 3b10167e03..bd693e4d88 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -323,7 +323,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; mac->frequency_range = band<100?FR1:FR2; - lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); // cell config diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index fc2c2d2c8b..99cbdf3292 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -369,7 +369,7 @@ typedef struct { NR_ControlResourceSet_t *coreset[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP]; NR_SearchSpace_t *SSpace[MAX_NUM_BWP][FAPI_NR_MAX_SS]; - lte_frame_type_t frame_type; + frame_type_t frame_type; /*BWP*/ // dedicated active DL BWP diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 6ba8629718..a2cbd4807f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -233,7 +233,7 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, rrc_pdsch_AntennaPorts uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; frequency_range_t frequency_range = band<100?FR1:FR2; - lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); RC.nrmac[Mod_idP]->common_channels[0].frame_type = frame_type; // Cell configuration diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index ca197b224d..3d17e966a9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -399,7 +399,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, uint16_t *msg2_frame, uint16_t *msg2_slot, NR_ServingCellConfigCommon_t *scc, - lte_frame_type_t frame_type, + frame_type_t frame_type, uint16_t monitoring_slot_period, uint16_t monitoring_offset,uint8_t beam_index, uint8_t num_active_ssb, @@ -525,7 +525,7 @@ void nr_initiate_ra_proc(module_id_t module_idP, 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; - lte_frame_type_t frame_type = cc->frame_type; + frame_type_t frame_type = cc->frame_type; uint8_t total_RApreambles = MAX_NUM_NR_PRACH_PREAMBLES; uint8_t num_ssb_per_RO = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present; @@ -933,7 +933,7 @@ void nr_get_Msg3alloc(module_id_t module_id, uint16_t msg3_nb_rb = 8; // sdu has 6 or 8 bytes - lte_frame_type_t frame_type = RC.nrmac[module_id]->common_channels->frame_type; + frame_type_t frame_type = RC.nrmac[module_id]->common_channels->frame_type; int mu = ubwp ? ubwp->bwp_Common->genericParameters.subcarrierSpacing : diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 5aace1d0dc..7806d6011d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -62,7 +62,7 @@ void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t * /* there is a mixed slot only when in TDD */ NR_ServingCellConfigCommon_t *scc = nrmac->common_channels->ServingCellConfigCommon; - lte_frame_type_t frame_type = nrmac->common_channels->frame_type; + frame_type_t frame_type = nrmac->common_channels->frame_type; const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 9273c38de3..7342864763 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -55,7 +55,7 @@ void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ub /* there is a mixed slot only when in TDD */ NR_ServingCellConfigCommon_t *scc = nrmac->common_channels->ServingCellConfigCommon; - lte_frame_type_t frame_type = nrmac->common_channels->frame_type; + frame_type_t frame_type = nrmac->common_channels->frame_type; const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; NR_ServingCellConfigCommonSIB_t *scc_sib1 = get_softmodem_params()->sa ? diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 0f538131dd..0ed70444b1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -202,7 +202,7 @@ typedef struct { int p_gNB; int Ncp; int nr_band; - lte_frame_type_t frame_type; + frame_type_t frame_type; uint64_t dl_CarrierFreq; NR_BCCH_BCH_Message_t *mib; NR_BCCH_DL_SCH_Message_t *sib1; diff --git a/openair2/M2AP/m2ap_MCE_defs.h b/openair2/M2AP/m2ap_MCE_defs.h index 5267232d69..73183e89c2 100644 --- a/openair2/M2AP/m2ap_MCE_defs.h +++ b/openair2/M2AP/m2ap_MCE_defs.h @@ -170,7 +170,7 @@ typedef struct m2ap_MCE_instance_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; int num_cc; diff --git a/openair2/M2AP/m2ap_eNB_defs.h b/openair2/M2AP/m2ap_eNB_defs.h index b8f7e4b3c6..0b30c33d80 100644 --- a/openair2/M2AP/m2ap_eNB_defs.h +++ b/openair2/M2AP/m2ap_eNB_defs.h @@ -181,7 +181,7 @@ typedef struct m2ap_eNB_instance_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; int num_cc; diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 9b9e267828..f24c9ab1b6 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -1757,7 +1757,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance && RC.rrc[instance]->configuration.mnc[j] == S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc && RC.rrc[instance]->configuration.tac == S1AP_PAGING_IND(msg_p).tac[tai_size]) { for (uint8_t CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - lte_frame_type_t frame_type = RC.eNB[instance][CC_id]->frame_parms.frame_type; + frame_type_t frame_type = RC.eNB[instance][CC_id]->frame_parms.frame_type; /* get nB from configuration */ /* get default DRX cycle from configuration */ Tc = (uint8_t)RC.rrc[instance]->configuration.radioresourceconfig[CC_id].pcch_defaultPagingCycle; diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index bb2a180146..54fb5a168b 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -216,7 +216,7 @@ void prepare_sim_uecap(NR_UE_NR_Capability_t *cap, void nr_rrc_config_dl_tda(NR_ServingCellConfigCommon_t *scc){ - lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); int curr_bwp = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; // coreset duration setting to be improved in the framework of RRC harmonization, potentially using a common function int len_coreset = 1; @@ -253,7 +253,7 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay){ uint8_t DELTA[4]= {2,3,4,6}; // Delta parameter for Msg3 int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; - lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); struct NR_PUSCH_TimeDomainResourceAllocation *pusch_timedomainresourceallocation = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation)); pusch_timedomainresourceallocation->k2 = CALLOC(1,sizeof(long)); diff --git a/openair2/UTIL/OCG/OCG.h b/openair2/UTIL/OCG/OCG.h index 58cc7184e7..452581bb17 100644 --- a/openair2/UTIL/OCG/OCG.h +++ b/openair2/UTIL/OCG/OCG.h @@ -700,7 +700,7 @@ typedef struct { unsigned int n_frames_flag; // if set, then let the emulation goes to infinity node_function_t node_function[MAX_NUM_CCs]; node_timing_t node_timing[MAX_NUM_CCs]; - unsigned char frame_type[MAX_NUM_CCs]; //! LTE frame type (TDD=1, FDD=0). \note this should be converted to \ref lte_frame_type_t (header file reorganization needed) + unsigned char frame_type[MAX_NUM_CCs]; //! LTE frame type (TDD=1, FDD=0). \note this should be converted to \ref frame_type_t (header file reorganization needed) char *frame_type_name[MAX_NUM_CCs]; unsigned char tdd_config[MAX_NUM_CCs]; unsigned char tdd_config_S[MAX_NUM_CCs]; diff --git a/openair2/X2AP/x2ap_eNB_defs.h b/openair2/X2AP/x2ap_eNB_defs.h index 063302d03a..bd6092e0cb 100644 --- a/openair2/X2AP/x2ap_eNB_defs.h +++ b/openair2/X2AP/x2ap_eNB_defs.h @@ -172,7 +172,7 @@ typedef struct x2ap_eNB_instance_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; uint32_t subframeAssignment[MAX_NUM_CCs]; diff --git a/openair3/M3AP/m3ap_MCE_defs.h b/openair3/M3AP/m3ap_MCE_defs.h index 18ad70a408..4dcb2b4db0 100644 --- a/openair3/M3AP/m3ap_MCE_defs.h +++ b/openair3/M3AP/m3ap_MCE_defs.h @@ -170,7 +170,7 @@ typedef struct m3ap_MCE_instance_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; int num_cc; diff --git a/openair3/M3AP/m3ap_MME_defs.h b/openair3/M3AP/m3ap_MME_defs.h index 3b5725655d..6608587cc3 100644 --- a/openair3/M3AP/m3ap_MME_defs.h +++ b/openair3/M3AP/m3ap_MME_defs.h @@ -170,7 +170,7 @@ typedef struct m3ap_MME_instance_s { int32_t uplink_frequency_offset[MAX_NUM_CCs]; uint32_t Nid_cell[MAX_NUM_CCs]; int16_t N_RB_DL[MAX_NUM_CCs]; - lte_frame_type_t frame_type[MAX_NUM_CCs]; + frame_type_t frame_type[MAX_NUM_CCs]; uint32_t fdd_earfcn_DL[MAX_NUM_CCs]; uint32_t fdd_earfcn_UL[MAX_NUM_CCs]; int num_cc; diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 9010a40bf9..eaeb22d096 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -111,7 +111,7 @@ typedef struct eutra_band_s { uint32_t ul_max; uint32_t dl_min; uint32_t dl_max; - lte_frame_type_t frame_type; + frame_type_t frame_type; } eutra_band_t; typedef struct band_info_s { From 32b2f76c578ae6f2443d6cb9f3aac6f63a9a6625 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 20 Apr 2022 14:30:13 +0200 Subject: [PATCH 20/39] fix(ci): first port to the new Eurecom infrastructure: * Proxy no longer required for git cloning * Most of the IP addresses have been changed - Remaining --> 192.168.18.89 for amariue Signed-off-by: Raphael Defosseux --- ci-scripts/build_fr1_template.yaml | 2 +- ci-scripts/ci_ueinfra.yaml | 6 +-- ci-scripts/cls_containerize.py | 46 +++++++++---------- .../enb.band38.lte_2x2.100PRB.usrpn310.conf | 2 +- ...nb.band38.lte_2x2_tm2.100PRB.usrpn310.conf | 2 +- .../enb.band38.nsa_2x2.100PRB.usrpn310.conf | 2 +- ...sci_gnb.band78.sa.fr1.106PRB.usrpn310.conf | 2 +- ...oxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf | 2 +- .../gNB_SA_n78_106PRB.2x2_usrpn310.conf | 6 +-- .../gNB_SA_n78_133PRB.2x2_usrpn310.conf | 6 +-- .../gnb.band78.nsa_2x2.106PRB.usrpn310.conf | 2 +- ...and78.sa.fr1.106PRB.2x2.usrpn310.asue.conf | 2 +- ...gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf | 2 +- .../gnb.band78.sa.fr1.106PRB.usrpn310.conf | 2 +- ...gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf | 2 +- ci-scripts/main.py | 14 +++--- ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml | 4 +- .../fr1_nsa_2x2_quectel_attach_detach.xml | 4 +- .../xml_files/fr1_sa_amarisoft_ue_1x.xml | 2 +- ci-scripts/xml_files/fr1_sa_oaiue_b200.xml | 2 +- ci-scripts/xml_files/fr1_sa_oaiue_n310.xml | 4 +- ci-scripts/xml_files/fr1_sa_oaiue_x300.xml | 2 +- ci-scripts/xml_files/fr1_sa_quectel.xml | 2 +- .../xml_files/fr1_sa_quectel_162prb.xml | 2 +- .../xml_files/fr1_sa_quectel_stages.xml | 2 +- .../fr1_sa_quectel_stages_162prb.xml | 2 +- ci-scripts/xml_files/lte_2x2_tm1_quectel.xml | 2 +- ci-scripts/xml_files/lte_2x2_tm2_quectel.xml | 2 +- .../4g_rfsimulator_fdd_05MHz/README.md | 2 +- .../docker-compose.yml | 2 +- .../docker-compose.yml | 2 +- .../docker-compose.yml | 2 +- .../docker-compose.yml | 2 +- .../5g_f1_rfsimulator/docker-compose.yaml | 2 +- .../5g_fdd_rfsimulator/docker-compose.yaml | 2 +- ci-scripts/yaml_files/5g_l2sim_tdd/README.md | 8 ++-- .../5g_l2sim_tdd/docker-compose.yaml | 6 +-- .../5g_rfsimulator/docker-compose.yaml | 2 +- .../fr1_epc_20897/docker-compose.yml | 2 +- .../magma_nsa_20897/docker-compose.yml | 2 +- .../nsa_b200_enb/docker-compose.yml | 4 +- .../nsa_b200_gnb/docker-compose.yml | 4 +- 42 files changed, 86 insertions(+), 86 deletions(-) diff --git a/ci-scripts/build_fr1_template.yaml b/ci-scripts/build_fr1_template.yaml index 02e49bc4b5..5c7b2fc6f4 100755 --- a/ci-scripts/build_fr1_template.yaml +++ b/ci-scripts/build_fr1_template.yaml @@ -14,7 +14,7 @@ steps: ADB: #on Caracal - ADBIPAddress : 192.168.18.196 + ADBIPAddress : 172.21.16.132 ADBUserName : oaici ADBPassword : KkexF6CErOi1fNuebCPsuIVK diff --git a/ci-scripts/ci_ueinfra.yaml b/ci-scripts/ci_ueinfra.yaml index 89bda5fa92..b58e14ff6a 100644 --- a/ci-scripts/ci_ueinfra.yaml +++ b/ci-scripts/ci_ueinfra.yaml @@ -12,7 +12,7 @@ idefix: LogStore : /media/usb-drive/ci_qlogs PLMN : 22201 UENetwork : wwan0 - HostIPAddress : 192.168.18.188 + HostIPAddress : 172.21.16.135 HostUsername : oaicicd HostPassword : oaicicd HostSourceCodePath : none @@ -32,7 +32,7 @@ nrmodule2_quectel: LogStore : /media/ci_qlogs PLMN : 20897 UENetwork : wwan0 - HostIPAddress : 192.168.18.189 + HostIPAddress : 172.21.16.139 HostUsername : nrmodule2 HostPassword : linux HostSourceCodePath : none @@ -97,7 +97,7 @@ dummy: DetachScript : '' PLMN : 22201 UENetwork : wwan0 - HostIPAddress : 192.168.18.188 + HostIPAddress : 172.21.16.135 HostUsername : oaicicd HostPassword : oaicicd HostSourceCodePath : none diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 8092febe39..89a3ac586d 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -243,7 +243,7 @@ class Containerize(): # Build the base image only on Push Events (not on Merge Requests) # On when the base image docker file is being modified. if forceBaseImageBuild: - mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + baseImage + ' --tag ' + baseImage + ':' + baseTag + ' --file docker/Dockerfile.base' + self.dockerfileprefix + ' --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-base.log 2>&1', '\$', 1600) + mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + baseImage + ' --tag ' + baseImage + ':' + baseTag + ' --file docker/Dockerfile.base' + self.dockerfileprefix + ' . > cmake_targets/log/ran-base.log 2>&1', '\$', 1600) # First verify if the base image was properly created. status = True mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + baseImage + ':' + baseTag, '\$', 5) @@ -1146,19 +1146,19 @@ class Containerize(): mySSH.open(ipAddr, userName, password) # Check if route to asterix gnb exists mySSH.command('ip route | grep --colour=never "192.168.68.64/26"', '\$', 10) - result = re.search('192.168.18.194', mySSH.getBefore()) + result = re.search('172.21.16.127', mySSH.getBefore()) if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.64/26 via 192.168.18.194 dev eno1', '\$', 10) + mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.64/26 via 172.21.16.127 dev eno1', '\$', 10) # Check if route to obelix enb exists mySSH.command('ip route | grep --colour=never "192.168.68.128/26"', '\$', 10) - result = re.search('192.168.18.193', mySSH.getBefore()) + result = re.search('172.21.16.128', mySSH.getBefore()) if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.128/26 via 192.168.18.193 dev eno1', '\$', 10) + mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.128/26 via 172.21.16.128 dev eno1', '\$', 10) # Check if route to nepes gnb exists mySSH.command('ip route | grep --colour=never "192.168.68.192/26"', '\$', 10) - result = re.search('192.168.18.209', mySSH.getBefore()) + result = re.search('172.21.16.137', mySSH.getBefore()) if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.192/26 via 192.168.18.209 dev eno1', '\$', 10) + mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.192/26 via 172.21.16.137 dev eno1', '\$', 10) # Check if forwarding is enabled mySSH.command('sysctl net.ipv4.conf.all.forwarding', '\$', 10) result = re.search('net.ipv4.conf.all.forwarding = 1', mySSH.getBefore()) @@ -1174,19 +1174,19 @@ class Containerize(): mySSH.open(ipAddr, userName, password) # Check if route to porcepix epc exists mySSH.command('ip route | grep --colour=never "192.168.61.192/26"', '\$', 10) - result = re.search('192.168.18.210', mySSH.getBefore()) + result = re.search('172.21.16.136', mySSH.getBefore()) if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.61.192/26 via 192.168.18.210 dev em1', '\$', 10) + mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.61.192/26 via 172.21.16.136 dev em1', '\$', 10) # Check if route to porcepix cn5g exists mySSH.command('ip route | grep --colour=never "192.168.70.128/26"', '\$', 10) - result = re.search('192.168.18.210', mySSH.getBefore()) + result = re.search('172.21.16.136', mySSH.getBefore()) if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.70.128/26 via 192.168.18.210 dev em1', '\$', 10) + mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.70.128/26 via 172.21.16.136 dev em1', '\$', 10) # Check if X2 route to obelix enb exists mySSH.command('ip route | grep --colour=never "192.168.68.128/26"', '\$', 10) - result = re.search('192.168.18.193', mySSH.getBefore()) + result = re.search('172.21.16.128', mySSH.getBefore()) if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.128/26 via 192.168.18.193 dev em1', '\$', 10) + mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.128/26 via 172.21.16.128 dev em1', '\$', 10) # Check if forwarding is enabled mySSH.command('sysctl net.ipv4.conf.all.forwarding', '\$', 10) result = re.search('net.ipv4.conf.all.forwarding = 1', mySSH.getBefore()) @@ -1202,19 +1202,19 @@ class Containerize(): mySSH.open(ipAddr, userName, password) # Check if route to porcepix epc exists mySSH.command('ip route | grep --colour=never "192.168.61.192/26"', '\$', 10) - result = re.search('192.168.18.210', mySSH.getBefore()) + result = re.search('172.21.16.136', mySSH.getBefore()) if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.61.192/26 via 192.168.18.210 dev eno1', '\$', 10) + mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.61.192/26 via 172.21.16.136 dev eno1', '\$', 10) # Check if X2 route to asterix gnb exists mySSH.command('ip route | grep --colour=never "192.168.68.64/26"', '\$', 10) - result = re.search('192.168.18.194', mySSH.getBefore()) + result = re.search('172.21.16.127', mySSH.getBefore()) if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.64/26 via 192.168.18.194 dev eno1', '\$', 10) + mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.64/26 via 172.21.16.127 dev eno1', '\$', 10) # Check if X2 route to nepes gnb exists mySSH.command('ip route | grep --colour=never "192.168.68.192/26"', '\$', 10) - result = re.search('192.168.18.209', mySSH.getBefore()) + result = re.search('172.21.16.137', mySSH.getBefore()) if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.192/26 via 192.168.18.209 dev eno1', '\$', 10) + mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.192/26 via 172.21.16.137 dev eno1', '\$', 10) # Check if forwarding is enabled mySSH.command('sysctl net.ipv4.conf.all.forwarding', '\$', 10) result = re.search('net.ipv4.conf.all.forwarding = 1', mySSH.getBefore()) @@ -1230,14 +1230,14 @@ class Containerize(): mySSH.open(ipAddr, userName, password) # Check if route to porcepix epc exists mySSH.command('ip route | grep --colour=never "192.168.61.192/26"', '\$', 10) - result = re.search('192.168.18.210', mySSH.getBefore()) + result = re.search('172.21.16.136', mySSH.getBefore()) if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.61.192/26 via 192.168.18.210 dev enp0s31f6', '\$', 10) + mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.61.192/26 via 172.21.16.136 dev enp0s31f6', '\$', 10) # Check if X2 route to obelix enb exists mySSH.command('ip route | grep --colour=never "192.168.68.128/26"', '\$', 10) - result = re.search('192.168.18.193', mySSH.getBefore()) + result = re.search('172.21.16.128', mySSH.getBefore()) if result is None: - mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.128/26 via 192.168.18.193 dev enp0s31f6', '\$', 10) + mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.128/26 via 172.21.16.128 dev enp0s31f6', '\$', 10) # Check if forwarding is enabled mySSH.command('sysctl net.ipv4.conf.all.forwarding', '\$', 10) result = re.search('net.ipv4.conf.all.forwarding = 1', mySSH.getBefore()) diff --git a/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf index fe2e031acb..a7100a97e3 100644 --- a/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf @@ -237,7 +237,7 @@ RUs = ( 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"; + sdr_addrs = "mgmt_addr=172.21.19.13,addr=192.168.20.2,second_addr=192.168.10.2"; } ); diff --git a/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf index a0742c57a6..1f358c1571 100644 --- a/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf @@ -237,7 +237,7 @@ RUs = ( 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"; + sdr_addrs = "mgmt_addr=172.21.19.13,addr=192.168.20.2,second_addr=192.168.10.2"; } ); 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 dfc9beda71..f7088aee52 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 @@ -237,7 +237,7 @@ RUs = ( 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"; + sdr_addrs = "mgmt_addr=172.21.19.13,addr=192.168.20.2,second_addr=192.168.10.2"; } ); diff --git a/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf index 40f6f911b1..51ffb1d5cd 100644 --- a/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -239,7 +239,7 @@ RUs = ( #beamforming 1x4 matrix: bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; #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" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf index edcd4f06ff..f80ce3751a 100644 --- a/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -240,7 +240,7 @@ RUs = ( #beamforming 1x4 matrix: bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; #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" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf b/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf index 33ab30887f..d6edc09286 100644 --- a/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf +++ b/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf @@ -209,9 +209,9 @@ gNBs = { GNB_INTERFACE_NAME_FOR_NG_AMF = "em1"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.18.194/24"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.16.127/24"; GNB_INTERFACE_NAME_FOR_NGU = "em1"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.18.194/24"; + GNB_IPV4_ADDRESS_FOR_NGU = "172.21.16.127/24"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; @@ -258,7 +258,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf b/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf index 4a5eaec89b..7f4b11c35d 100644 --- a/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf +++ b/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf @@ -206,9 +206,9 @@ gNBs = { GNB_INTERFACE_NAME_FOR_NG_AMF = "em1"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.18.194/24"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.16.127/24"; GNB_INTERFACE_NAME_FOR_NGU = "em1"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.18.194/24"; + GNB_IPV4_ADDRESS_FOR_NGU = "172.21.16.127/24"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; @@ -254,7 +254,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); 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 21863dcfc7..e3bd49e7fc 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 @@ -230,7 +230,7 @@ RUs = ( bf_weights = [0x00007fff, 0x00007fff]; #clock_src = "external"; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf index 60fb16318f..5e6b3fb217 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf @@ -264,7 +264,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf index 1d7c4b57f0..8489008300 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf @@ -261,7 +261,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf index e2b331939b..9e1f499f03 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -263,7 +263,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf index 324b3d2ce1..ce63578dd3 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf @@ -262,7 +262,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=172.21.19.14,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/main.py b/ci-scripts/main.py index c838c3740d..65f9fbb0da 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -779,19 +779,19 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re HTML.CreateHtmlTabHeader() # On CI bench w/ containers, we need to validate if IP routes are set - if EPC.IPAddress == '192.168.18.210': + if EPC.IPAddress == '172.21.16.136': CONTAINERS.CheckAndAddRoute('porcepix', EPC.IPAddress, EPC.UserName, EPC.Password) - if CONTAINERS.eNBIPAddress == '192.168.18.194': + if CONTAINERS.eNBIPAddress == '172.21.16.127': CONTAINERS.CheckAndAddRoute('asterix', CONTAINERS.eNBIPAddress, CONTAINERS.eNBUserName, CONTAINERS.eNBPassword) - if CONTAINERS.eNB1IPAddress == '192.168.18.194': + if CONTAINERS.eNB1IPAddress == '172.21.16.127': CONTAINERS.CheckAndAddRoute('asterix', CONTAINERS.eNB1IPAddress, CONTAINERS.eNB1UserName, CONTAINERS.eNB1Password) - if CONTAINERS.eNBIPAddress == '192.168.18.193': + if CONTAINERS.eNBIPAddress == '172.21.16.128': CONTAINERS.CheckAndAddRoute('obelix', CONTAINERS.eNBIPAddress, CONTAINERS.eNBUserName, CONTAINERS.eNBPassword) - if CONTAINERS.eNB1IPAddress == '192.168.18.193': + if CONTAINERS.eNB1IPAddress == '172.21.16.128': CONTAINERS.CheckAndAddRoute('obelix', CONTAINERS.eNB1IPAddress, CONTAINERS.eNB1UserName, CONTAINERS.eNB1Password) - if CONTAINERS.eNBIPAddress == '192.168.18.209': + if CONTAINERS.eNBIPAddress == '172.21.16.137': CONTAINERS.CheckAndAddRoute('nepes', CONTAINERS.eNBIPAddress, CONTAINERS.eNBUserName, CONTAINERS.eNBPassword) - if CONTAINERS.eNB1IPAddress == '192.168.18.209': + if CONTAINERS.eNB1IPAddress == '172.21.16.137': CONTAINERS.CheckAndAddRoute('nepes', CONTAINERS.eNB1IPAddress, CONTAINERS.eNB1UserName, CONTAINERS.eNB1Password) CiTestObj.FailReportCnt = 0 diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml index 56694920ba..a4dcb58e8b 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml @@ -68,7 +68,7 @@ lte yes yes - 192.168.18.241 + 172.21.19.13 @@ -81,7 +81,7 @@ nr yes datalog_rt_stats.2x2.yaml - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel_attach_detach.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel_attach_detach.xml index 840521481e..335fe873a1 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel_attach_detach.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel_attach_detach.xml @@ -87,7 +87,7 @@ lte yes yes - 192.168.18.241 + 172.21.19.13 @@ -100,7 +100,7 @@ nr yes datalog_rt_stats.2x2.yaml - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_amarisoft_ue_1x.xml b/ci-scripts/xml_files/fr1_sa_amarisoft_ue_1x.xml index 194ed4e453..ea031a0174 100644 --- a/ci-scripts/xml_files/fr1_sa_amarisoft_ue_1x.xml +++ b/ci-scripts/xml_files/fr1_sa_amarisoft_ue_1x.xml @@ -52,7 +52,7 @@ yes yes datalog_rt_stats.2x2.yaml - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_oaiue_b200.xml b/ci-scripts/xml_files/fr1_sa_oaiue_b200.xml index 55268b909d..5995f75a64 100644 --- a/ci-scripts/xml_files/fr1_sa_oaiue_b200.xml +++ b/ci-scripts/xml_files/fr1_sa_oaiue_b200.xml @@ -60,7 +60,7 @@ nr yes yes - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml b/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml index 53b696c6eb..468005f54f 100644 --- a/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml +++ b/ci-scripts/xml_files/fr1_sa_oaiue_n310.xml @@ -42,7 +42,7 @@ Initialize_OAI_UE Initialize OAI UE (N310) nr - --sa -O ../../../ci-scripts/conf_files/ue.sa.conf --usrp-args "mgmt_addr=192.168.18.241,addr=192.168.10.2" --numerology 1 -r 106 --band 78 -C 3319680000 --nokrnmod 1 --ue-txgain 0 --ue-rxgain 70 --ue-fo-compensation --log_config.global_log_options level,nocolor,time + --sa -O ../../../ci-scripts/conf_files/ue.sa.conf --usrp-args "mgmt_addr=172.21.19.13,addr=192.168.10.2" --numerology 1 -r 106 --band 78 -C 3319680000 --nokrnmod 1 --ue-txgain 0 --ue-rxgain 70 --ue-fo-compensation --log_config.global_log_options level,nocolor,time @@ -60,7 +60,7 @@ nr yes yes - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_oaiue_x300.xml b/ci-scripts/xml_files/fr1_sa_oaiue_x300.xml index 8c2f7052e4..ef001a7518 100644 --- a/ci-scripts/xml_files/fr1_sa_oaiue_x300.xml +++ b/ci-scripts/xml_files/fr1_sa_oaiue_x300.xml @@ -60,7 +60,7 @@ nr yes yes - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_quectel.xml b/ci-scripts/xml_files/fr1_sa_quectel.xml index 576456ebc9..4d4edab56b 100644 --- a/ci-scripts/xml_files/fr1_sa_quectel.xml +++ b/ci-scripts/xml_files/fr1_sa_quectel.xml @@ -70,7 +70,7 @@ yes yes datalog_rt_stats.2x2.yaml - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml b/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml index c5f2ddad5f..23eaccfcfd 100644 --- a/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml +++ b/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml @@ -68,7 +68,7 @@ yes yes datalog_rt_stats.2x2.yaml - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_quectel_stages.xml b/ci-scripts/xml_files/fr1_sa_quectel_stages.xml index 2707fd4ebf..603f3f919b 100644 --- a/ci-scripts/xml_files/fr1_sa_quectel_stages.xml +++ b/ci-scripts/xml_files/fr1_sa_quectel_stages.xml @@ -74,7 +74,7 @@ yes yes datalog_rt_stats.2x2.yaml - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/fr1_sa_quectel_stages_162prb.xml b/ci-scripts/xml_files/fr1_sa_quectel_stages_162prb.xml index 661bcb32fe..9371e46ec9 100644 --- a/ci-scripts/xml_files/fr1_sa_quectel_stages_162prb.xml +++ b/ci-scripts/xml_files/fr1_sa_quectel_stages_162prb.xml @@ -74,7 +74,7 @@ yes yes datalog_rt_stats.2x2.yaml - 192.168.18.252 + 172.21.19.14 diff --git a/ci-scripts/xml_files/lte_2x2_tm1_quectel.xml b/ci-scripts/xml_files/lte_2x2_tm1_quectel.xml index 11c4abce1b..6aa53200c8 100644 --- a/ci-scripts/xml_files/lte_2x2_tm1_quectel.xml +++ b/ci-scripts/xml_files/lte_2x2_tm1_quectel.xml @@ -65,7 +65,7 @@ lte yes yes - 192.168.18.241 + 172.21.19.13 diff --git a/ci-scripts/xml_files/lte_2x2_tm2_quectel.xml b/ci-scripts/xml_files/lte_2x2_tm2_quectel.xml index 714cf51a9b..84aa87aa23 100644 --- a/ci-scripts/xml_files/lte_2x2_tm2_quectel.xml +++ b/ci-scripts/xml_files/lte_2x2_tm2_quectel.xml @@ -65,7 +65,7 @@ lte yes yes - 192.168.18.241 + 172.21.19.13 diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md index 400559d269..be0d63838b 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md @@ -505,7 +505,7 @@ In my traffic test, I was able to ping outside of my local network. in SPGW-C config: ```yaml - DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129 + DEFAULT_DNS_IPV4_ADDRESS: 172.21.3.100 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 PUSH_PROTOCOL_OPTION: 'true' ``` diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml index b15e794c10..a260857a34 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml @@ -115,7 +115,7 @@ services: 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_IPV4_ADDRESS: 172.21.3.100 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 PUSH_PROTOCOL_OPTION: 'true' APN_NI_1: oai.ipv4 diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml index e1e992c94c..3f63953b0e 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml @@ -115,7 +115,7 @@ services: 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_IPV4_ADDRESS: 172.21.3.100 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 PUSH_PROTOCOL_OPTION: 'true' APN_NI_1: oai.ipv4 diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml index ad665813f2..1165400273 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml @@ -115,7 +115,7 @@ services: 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_IPV4_ADDRESS: 172.21.3.100 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 PUSH_PROTOCOL_OPTION: 'true' APN_NI_1: oai.ipv4 diff --git a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml index ffa92bac49..86f6c80b59 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml @@ -115,7 +115,7 @@ services: 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_IPV4_ADDRESS: 172.21.3.100 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 PUSH_PROTOCOL_OPTION: 'true' APN_NI_1: oai.ipv4 diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml index 74a23905f0..d52b228ec6 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -120,7 +120,7 @@ services: - SMF_INTERFACE_PORT_FOR_SBI=80 - SMF_INTERFACE_HTTP2_PORT_FOR_SBI=9090 - SMF_API_VERSION=v1 - - DEFAULT_DNS_IPV4_ADDRESS=192.168.18.129 + - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - AMF_IPV4_ADDRESS=0.0.0.0 - AMF_PORT=80 diff --git a/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml index 3e46adb9e7..7758c39592 100644 --- a/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml @@ -120,7 +120,7 @@ services: - SMF_INTERFACE_PORT_FOR_SBI=80 - SMF_INTERFACE_HTTP2_PORT_FOR_SBI=9090 - SMF_API_VERSION=v1 - - DEFAULT_DNS_IPV4_ADDRESS=192.168.18.129 + - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - AMF_IPV4_ADDRESS=0.0.0.0 - AMF_PORT=80 diff --git a/ci-scripts/yaml_files/5g_l2sim_tdd/README.md b/ci-scripts/yaml_files/5g_l2sim_tdd/README.md index 531f2406ef..f1e1287995 100644 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/README.md +++ b/ci-scripts/yaml_files/5g_l2sim_tdd/README.md @@ -326,16 +326,16 @@ Removing network l2sim-oai-traffic-net In the `SMF` section, provide your own DNS IP address: ```yaml - DEFAULT_DNS_IPV4_ADDRESS=192.168.18.129 + DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 ``` -In the `gNB` section, provide your docker-host primary IP address and interface name: in our case `192.168.18.193` and `eno1`. +In the `gNB` section, provide your docker-host primary IP address and interface name: in our case `172.21.16.128` and `eno1`. ```yaml GNB_NGA_IF_NAME: eno1 - GNB_NGA_IP_ADDRESS: 192.168.18.193 + GNB_NGA_IP_ADDRESS: 172.21.16.128 GNB_NGU_IF_NAME: eno1 - GNB_NGU_IP_ADDRESS: 192.168.18.193 + GNB_NGU_IP_ADDRESS: 172.21.16.128 ``` Same thing in the `nr-ue` section: diff --git a/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml b/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml index c899f8cc7e..a28b640e1a 100644 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml @@ -120,7 +120,7 @@ services: - SMF_INTERFACE_PORT_FOR_SBI=80 - SMF_INTERFACE_HTTP2_PORT_FOR_SBI=9090 - SMF_API_VERSION=v1 - - DEFAULT_DNS_IPV4_ADDRESS=192.168.18.129 + - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - AMF_IPV4_ADDRESS=0.0.0.0 - AMF_PORT=80 @@ -241,9 +241,9 @@ services: NSSAI_SD1: 112233 AMF_IP_ADDRESS: 192.168.71.132 GNB_NGA_IF_NAME: eno1 - GNB_NGA_IP_ADDRESS: 192.168.18.193 + GNB_NGA_IP_ADDRESS: 172.21.16.128 GNB_NGU_IF_NAME: eno1 - GNB_NGU_IP_ADDRESS: 192.168.18.193 + GNB_NGU_IP_ADDRESS: 172.21.16.128 LOCAL_S_IF_NAME: 'lo:' REMOTE_S_ADDRESS: 127.0.0.1 LOCAL_S_ADDRESS: 127.0.0.2 diff --git a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml index f27ec3050d..696d8c6698 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml @@ -120,7 +120,7 @@ services: - SMF_INTERFACE_PORT_FOR_SBI=80 - SMF_INTERFACE_HTTP2_PORT_FOR_SBI=9090 - SMF_API_VERSION=v1 - - DEFAULT_DNS_IPV4_ADDRESS=192.168.18.129 + - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - AMF_IPV4_ADDRESS=0.0.0.0 - AMF_PORT=80 diff --git a/ci-scripts/yaml_files/fr1_epc_20897/docker-compose.yml b/ci-scripts/yaml_files/fr1_epc_20897/docker-compose.yml index a3675dc78e..91d15b5251 100644 --- a/ci-scripts/yaml_files/fr1_epc_20897/docker-compose.yml +++ b/ci-scripts/yaml_files/fr1_epc_20897/docker-compose.yml @@ -132,7 +132,7 @@ services: 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_IPV4_ADDRESS: 172.21.3.100 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 PUSH_PROTOCOL_OPTION: 'true' APN_NI_1: oai.ipv4 diff --git a/ci-scripts/yaml_files/magma_nsa_20897/docker-compose.yml b/ci-scripts/yaml_files/magma_nsa_20897/docker-compose.yml index df14e900e7..f320e7e3df 100644 --- a/ci-scripts/yaml_files/magma_nsa_20897/docker-compose.yml +++ b/ci-scripts/yaml_files/magma_nsa_20897/docker-compose.yml @@ -116,7 +116,7 @@ services: 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_IPV4_ADDRESS: 172.21.3.100 DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4 PUSH_PROTOCOL_OPTION: 'true' APN_NI_1: oai.ipv4 diff --git a/ci-scripts/yaml_files/nsa_b200_enb/docker-compose.yml b/ci-scripts/yaml_files/nsa_b200_enb/docker-compose.yml index 92ccdf8a0a..2df5eac61b 100644 --- a/ci-scripts/yaml_files/nsa_b200_enb/docker-compose.yml +++ b/ci-scripts/yaml_files/nsa_b200_enb/docker-compose.yml @@ -20,7 +20,7 @@ services: NB_PRB: 25 ENABLE_MEASUREMENT_REPORTS: 'yes' ENABLE_X2: 'yes' - MME_S1C_IP_ADDRESS: 192.168.18.210 + MME_S1C_IP_ADDRESS: 172.21.16.136 ENB_S1C_IF_NAME: eth0 ENB_S1C_IP_ADDRESS: 192.168.68.130 ENB_S1U_IF_NAME: eth0 @@ -29,7 +29,7 @@ services: RRC_INACTIVITY_THRESHOLD: 0 FLEXRAN_ENABLED: 'no' FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 192.168.18.210 + FLEXRAN_IPV4_ADDRESS: 172.21.16.136 THREAD_PARALLEL_CONFIG: PARALLEL_SINGLE_THREAD USE_ADDITIONAL_OPTIONS: --log_config.global_log_options level,nocolor,time,line_num,function volumes: diff --git a/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml b/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml index c6096956a8..61266aa2b1 100644 --- a/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml @@ -15,7 +15,7 @@ services: TAC: 1 ENABLE_X2: 'yes' ENB_X2_IP_ADDRESS: 192.168.68.130 - MME_S1C_IP_ADDRESS: 192.168.18.210 + MME_S1C_IP_ADDRESS: 172.21.16.136 GNB_S1C_IF_NAME: eth0 GNB_S1C_IP_ADDRESS: 192.168.68.194 GNB_S1U_IF_NAME: eth0 @@ -24,7 +24,7 @@ services: RRC_INACTIVITY_THRESHOLD: 0 FLEXRAN_ENABLED: 'no' FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 192.168.18.210 + FLEXRAN_IPV4_ADDRESS: 172.21.16.136 THREAD_PARALLEL_CONFIG: PARALLEL_RU_L1_TRX_SPLIT USE_ADDITIONAL_OPTIONS: -E -q --RUs.[0].sdr_addrs serial=30C51D4 --log_config.global_log_options level,nocolor,time,line_num,function volumes: From d592b1ff5bcb8743129006bb43a5a2501b5a14ec Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 20 Apr 2022 17:56:25 +0200 Subject: [PATCH 21/39] fix(ci): dummy commit to re-trigger Signed-off-by: Raphael Defosseux --- ci-scripts/ci_ueinfra.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci-scripts/ci_ueinfra.yaml b/ci-scripts/ci_ueinfra.yaml index b58e14ff6a..b888f6bb59 100644 --- a/ci-scripts/ci_ueinfra.yaml +++ b/ci-scripts/ci_ueinfra.yaml @@ -40,6 +40,7 @@ nrmodule2_quectel: - sudo -S ip link set dev wwan1 mtu 1500 MTU : 1500 +# CAUTION: 192.168.18.89 address has to be changed when the server is moved #single UE single ping amarisoft_ue_1: ID: amarisoft_ue_1 From b8ac9d5db9a171424000ae9015abb500f89ae853 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 21 Apr 2022 12:30:08 +0200 Subject: [PATCH 22/39] fix(ci): fix helm charts for phy-sim testing on cluster new infra Signed-off-by: Raphael Defosseux --- charts/physims/charts/dlsim/values.yaml | 4 +-- charts/physims/charts/ldpctest/values.yaml | 4 +-- charts/physims/charts/nr-dlschsim/values.yaml | 4 +-- charts/physims/charts/nr-dlsim/values.yaml | 4 +-- charts/physims/charts/nr-pbchsim/values.yaml | 4 +-- charts/physims/charts/nr-prachsim/values.yaml | 4 +-- charts/physims/charts/nr-pucchsim/values.yaml | 4 +-- charts/physims/charts/nr-ulschsim/values.yaml | 4 +-- charts/physims/charts/nr-ulsim/values.yaml | 4 +-- charts/physims/charts/polartest/values.yaml | 4 +-- .../physims/charts/smallblocktest/values.yaml | 4 +-- charts/physims/charts/ulsim/values.yaml | 4 +-- charts/physims/templates/rbac.yaml | 30 ++++++++++++++----- charts/physims/values.yaml | 4 +-- ci-scripts/cls_physim1.py | 30 +++++++++++++------ 15 files changed, 69 insertions(+), 43 deletions(-) diff --git a/charts/physims/charts/dlsim/values.yaml b/charts/physims/charts/dlsim/values.yaml index d78fbb7409..7f45b42f72 100644 --- a/charts/physims/charts/dlsim/values.yaml +++ b/charts/physims/charts/dlsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/ldpctest/values.yaml b/charts/physims/charts/ldpctest/values.yaml index e2e6467923..b3cc476cf8 100644 --- a/charts/physims/charts/ldpctest/values.yaml +++ b/charts/physims/charts/ldpctest/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/nr-dlschsim/values.yaml b/charts/physims/charts/nr-dlschsim/values.yaml index 8944e7e724..b7ef28f47a 100644 --- a/charts/physims/charts/nr-dlschsim/values.yaml +++ b/charts/physims/charts/nr-dlschsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/nr-dlsim/values.yaml b/charts/physims/charts/nr-dlsim/values.yaml index 573e8630de..2a35912fee 100644 --- a/charts/physims/charts/nr-dlsim/values.yaml +++ b/charts/physims/charts/nr-dlsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/nr-pbchsim/values.yaml b/charts/physims/charts/nr-pbchsim/values.yaml index 28c4678334..9a25d2810d 100644 --- a/charts/physims/charts/nr-pbchsim/values.yaml +++ b/charts/physims/charts/nr-pbchsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/nr-prachsim/values.yaml b/charts/physims/charts/nr-prachsim/values.yaml index 9e3c68b54d..dba6cc16c0 100644 --- a/charts/physims/charts/nr-prachsim/values.yaml +++ b/charts/physims/charts/nr-prachsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/nr-pucchsim/values.yaml b/charts/physims/charts/nr-pucchsim/values.yaml index 449670f713..77fe0963ac 100644 --- a/charts/physims/charts/nr-pucchsim/values.yaml +++ b/charts/physims/charts/nr-pucchsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/nr-ulschsim/values.yaml b/charts/physims/charts/nr-ulschsim/values.yaml index a3afc090e8..efb011a7f6 100644 --- a/charts/physims/charts/nr-ulschsim/values.yaml +++ b/charts/physims/charts/nr-ulschsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/nr-ulsim/values.yaml b/charts/physims/charts/nr-ulsim/values.yaml index 2bf96498e8..71c455b69c 100644 --- a/charts/physims/charts/nr-ulsim/values.yaml +++ b/charts/physims/charts/nr-ulsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/polartest/values.yaml b/charts/physims/charts/polartest/values.yaml index e0a532fdd8..e0751e8ec4 100644 --- a/charts/physims/charts/polartest/values.yaml +++ b/charts/physims/charts/polartest/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/smallblocktest/values.yaml b/charts/physims/charts/smallblocktest/values.yaml index f2f113d9b6..f933a978fd 100644 --- a/charts/physims/charts/smallblocktest/values.yaml +++ b/charts/physims/charts/smallblocktest/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/charts/ulsim/values.yaml b/charts/physims/charts/ulsim/values.yaml index 35dc14d596..d25b6fc2a5 100644 --- a/charts/physims/charts/ulsim/values.yaml +++ b/charts/physims/charts/ulsim/values.yaml @@ -4,11 +4,11 @@ replicaCount: 1 -namespace: "oaicicd-ran-tmp" +namespace: "OAICICD_PROJECT" image: registry: local - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: temp # pullPolicy: IfNotPresent or Never or Always pullPolicy: Always diff --git a/charts/physims/templates/rbac.yaml b/charts/physims/templates/rbac.yaml index 35f956a203..b341744796 100644 --- a/charts/physims/templates/rbac.yaml +++ b/charts/physims/templates/rbac.yaml @@ -1,12 +1,26 @@ -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role metadata: - name: {{ .Chart.Name }}-{{ .Values.global.namespace }}-rbac -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: cluster-admin + name: {{ .Chart.Name }}-{{ .Release.Namespace }}-role +rules: +- apiGroups: + - security.openshift.io + resourceNames: + - privileged + resources: + - securitycontextconstraints + verbs: + - use +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ .Chart.Name }}-{{ .Release.Namespace }}-binding subjects: - kind: ServiceAccount name: {{ .Values.global.serviceAccountName }} - namespace: {{ .Values.global.namespace }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: Role + name: {{ .Chart.Name }}-{{ .Release.Namespace }}-role + apiGroup: rbac.authorization.k8s.io diff --git a/charts/physims/values.yaml b/charts/physims/values.yaml index b348e822bb..d5253c7812 100644 --- a/charts/physims/values.yaml +++ b/charts/physims/values.yaml @@ -4,9 +4,9 @@ global: serviceAccountName: oai-physim-sa - namespace: "oaicicd-ran-tmp" + namespace: "OAICICD_PROJECT" image: - repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + repository: image-registry.openshift-image-registry.svc:5000/OAICICD_PROJECT/oai-physim version: TAG ## Declaring values specific to coressponding physim to overwrite diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 83fb74b7cb..54329790cd 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -153,6 +153,7 @@ class PhySim: mySSH.command(f'oc project {ocProjectName}', '\$', 30) if mySSH.getBefore().count(f'Already on project "{ocProjectName}"') == 0 and mySSH.getBefore().count(f'Now using project "{self.OCProjectName}"') == 0: logging.error(f'\u001B[1m Unable to access OC project {ocProjectName}\u001B[0m') + mySSH.command('oc logout', '\$', 30) mySSH.close() HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PROJECT_FAIL) RAN.prematureExit = True @@ -161,9 +162,10 @@ class PhySim: logging.debug(f'\u001B[1m Now using project {ocProjectName}\u001B[0m') # Tag the image and push to the OC cluster - mySSH.command('oc whoami -t | sudo podman login -u ' + ocUserName + ' --password-stdin https://default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/ --tls-verify=false', '\$', 30) + mySSH.command('oc whoami -t | sudo podman login -u ' + ocUserName + ' --password-stdin https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/ --tls-verify=false', '\$', 30) if mySSH.getBefore().count('Login Succeeded!') == 0: logging.error('\u001B[1m Podman Login to OC Cluster Registry Failed\u001B[0m') + mySSH.command('oc logout', '\$', 30) mySSH.close() HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL) RAN.prematureExit = True @@ -171,9 +173,11 @@ class PhySim: else: logging.debug('\u001B[1m Podman Login to OC Cluster Registry Successfully\u001B[0m') time.sleep(2) - mySSH.command('oc create -f openshift/oai-physim-image-stream.yml', '\$', 30) + mySSH.command('oc create -f openshift/oai-physim-image-stream.yml || true', '\$', 30) if mySSH.getBefore().count('(AlreadyExists):') == 0 and mySSH.getBefore().count('created') == 0: logging.error(f'\u001B[1m Image Stream "oai-physim" Creation Failed on OC Cluster {ocProjectName}\u001B[0m') + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) + mySSH.command('oc logout', '\$', 30) mySSH.close() HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_IS_FAIL) RAN.prematureExit = True @@ -181,11 +185,13 @@ class PhySim: else: logging.debug(f'\u001B[1m Image Stream "oai-physim" created on OC project {ocProjectName}\u001B[0m') time.sleep(2) - mySSH.command(f'sudo podman tag oai-physim:{imageTag} default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) + mySSH.command(f'sudo podman tag oai-physim:{imageTag} default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) time.sleep(2) - mySSH.command(f'sudo podman push default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag} --tls-verify=false', '\$', 180) + mySSH.command(f'sudo podman push default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag} --tls-verify=false', '\$', 180) if mySSH.getBefore().count('Storing signatures') == 0: logging.error('\u001B[1m Image "oai-physim" push to OC Cluster Registry Failed\u001B[0m') + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) + mySSH.command('oc logout', '\$', 30) mySSH.close() HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_IS_FAIL) RAN.prematureExit = True @@ -195,8 +201,9 @@ class PhySim: # Using helm charts deployment time.sleep(5) + mySSH.command(f'grep -rl OAICICD_PROJECT ./charts/ | xargs sed -i -e "s#OAICICD_PROJECT#{ocProjectName}#"', '\$', 30) mySSH.command(f'sed -i -e "s#TAG#{imageTag}#g" ./charts/physims/values.yaml', '\$', 6) - mySSH.command('helm install physim ./charts/physims/ | tee -a cmake_targets/log/physim_helm_summary.txt 2>&1', '\$', 30) + mySSH.command('helm install physim ./charts/physims/ 2>&1 | tee -a cmake_targets/log/physim_helm_summary.txt', '\$', 30) if mySSH.getBefore().count('STATUS: deployed') == 0: logging.error('\u001B[1m Deploying PhySim Failed using helm chart on OC Cluster\u001B[0m') mySSH.command('helm uninstall physim >> cmake_targets/log/physim_helm_summary.txt 2>&1', '\$', 30) @@ -206,8 +213,10 @@ class PhySim: mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) if re.search('No resources found', mySSH.getBefore()): isFinished1 = True - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) + mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) mySSH.command('oc delete is oai-physim', '\$', 30) + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) + mySSH.command('oc logout', '\$', 30) mySSH.close() self.AnalyzeLogFile_phySim(HTML) RAN.prematureExit = True @@ -227,7 +236,7 @@ class PhySim: if isRunning == False: logging.error('\u001B[1m Some PODS Running FAILED \u001B[0m') mySSH.command('oc get pods -l app.kubernetes.io/instance=physim 2>&1 | tee -a cmake_targets/log/physim_pods_summary.txt', '\$', 6) - mySSH.command('helm uninstall physim >> cmake_targets/log/physim_helm_summary.txt 2>&1', '\$', 6) + mySSH.command('helm uninstall physim 2>&1 >> cmake_targets/log/physim_helm_summary.txt', '\$', 6) self.AnalyzeLogFile_phySim(HTML) isFinished1 = False while(isFinished1 == False): @@ -235,8 +244,10 @@ class PhySim: mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) if re.search('No resources found', mySSH.getBefore()): isFinished1 = True - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) + mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) mySSH.command('oc delete is oai-physim', '\$', 6) + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) + mySSH.command('oc logout', '\$', 30) HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PHYSIM_DEPLOY_FAIL) HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult) RAN.prematureExit = True @@ -293,9 +304,10 @@ class PhySim: isFinished1 = True if isFinished1 == True: logging.debug('\u001B[1m UnDeployed PhySim Successfully on OC Cluster\u001B[0m') - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) + mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) mySSH.command('oc delete is oai-physim', '\$', 6) logging.debug('\u001B[1m Deleted the Image and ImageStream\u001B[0m') + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) mySSH.command('oc logout', '\$', 6) mySSH.close() self.AnalyzeLogFile_phySim(HTML) From 9327e9915210ee6480b66bcf88567b4bea501948 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 21 Apr 2022 16:29:22 +0200 Subject: [PATCH 23/39] additional fixes for SR --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index bcf743b560..5026354afd 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -422,9 +422,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, if (pucch_pdu->bit_len_harq==0) { uci_pdu->harq = NULL; uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); - uci_pdu->sr->sr_confidence_level = (SNRtimes10 > uci_stats->pucch0_thres) ? 1 : 0; + uci_pdu->sr->sr_confidence_level = (SNRtimes10 < uci_stats->pucch0_thres); uci_stats->pucch0_sr_trials++; - if (xrtmag_dBtimes10>10*max_n0) { + if (xrtmag_dBtimes10>(10*max_n0+100)) { uci_pdu->sr->sr_indication = 1; uci_stats->pucch0_positive_SR++; LOG_D(PHY,"PUCCH0 got positive SR. Cumulative number of positive SR %d\n", uci_stats->pucch0_positive_SR); From 4b4e419aba60c857ca4f9ecaee4eba87ef283c85 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 14 Apr 2022 16:42:38 +0200 Subject: [PATCH 24/39] nr rlc: fix NR RLC AM status generation Several problems were found and fixed. --- openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c | 107 +++++++++++++--------- 1 file changed, 63 insertions(+), 44 deletions(-) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index af8cb5715a..bfc8abbf73 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -908,8 +908,6 @@ typedef struct { int so_start; int sn_end; int so_end; - /* data for maximum ack */ - int ack_sn; /* -1 if not to be used */ /* pdu to use for next call to 'next_missing' */ nr_rlc_pdu_t *next; } missing_data_t; @@ -924,13 +922,12 @@ static missing_data_t next_missing(nr_rlc_entity_am_t *entity, int max_so = 0; int last_reached = 0; - ret.ack_sn = -1; - /* special case: missing part before the head of RX list */ if (check_head) { if (cur->sn != entity->rx_next || !cur->is_first) { /* don't report if out of reporting window */ - if (sn_compare_rx(entity, entity->rx_highest_status, cur->sn) <= 0) { + if (sn_compare_rx(entity, entity->rx_highest_status, + entity->rx_next) <= 0) { ret.sn_start = -1; return ret; } @@ -954,10 +951,6 @@ next_pdu: max_so = cur_max_so; last_reached = last_reached | cur->is_last; - /* if cur already processed, it can be the acked SDU */ - if (cur->data == NULL) - ret.ack_sn = (cur->sn + 1) % entity->sn_modulus; - /* no next? */ if (cur->next == NULL) { /* inform the caller that work is over */ @@ -1033,32 +1026,36 @@ next_pdu: } /* discontinuity between different SDUs */ - ret.sn_start = sn; + if (last_reached) { + ret.sn_start = (sn + 1) % entity->sn_modulus; + ret.so_start = 0; + } else { + ret.sn_start = sn; + ret.so_start = max_so + 1; + } /* don't report if out of reporting window */ if (sn_compare_rx(entity, entity->rx_highest_status, ret.sn_start) <= 0) { ret.sn_start = -1; return ret; } - ret.so_start = max_so + 1; set_end_different_sdu: - /* don't go more than rx_highest_status - 1 */ - if (sn_compare_rx(entity, entity->rx_highest_status, cur->sn) <= 0) { - ret.sn_end = (entity->rx_highest_status - 1 + entity->sn_modulus) % - entity->sn_modulus; - ret.so_end = 0xffff; - return ret; - } - /* if cur is the head of a SDU, then use cur-1 */ if (cur->is_first) { ret.sn_end = (cur->sn - 1 + entity->sn_modulus) % entity->sn_modulus; ret.so_end = 0xffff; - return ret; + } else { + ret.sn_end = cur->sn; + ret.so_end = cur->so - 1; + } + /* don't go more than rx_highest_status - 1 */ + if (sn_compare_rx(entity, entity->rx_highest_status, ret.sn_end) <= 0) { + ret.sn_end = (entity->rx_highest_status - 1 + entity->sn_modulus) % + entity->sn_modulus; + ret.so_end = 0xffff; + ret.next = NULL; } - ret.sn_end = cur->sn; - ret.so_end = cur->so - 1; return ret; } @@ -1098,21 +1095,20 @@ static void get_e1_position(nr_rlc_entity_am_t *entity, } } -/* returns the number of nacks serialized. - * In most cases it is 1, it can be more if the - * missing data consists of a range that is more - * than 255 SNs in which case it has to be cut in - * smaller ranges. +/* returns the last nack SN generated, -1 if nothing generated. * If there is no more room in the status buffer, * will set m->next = NULL (and may serialize - * less nacks than required by 'm'). + * less nacks than required by 'm'), also + * sets *generation_truncated to 1. */ static int generate_missing(nr_rlc_entity_am_t *entity, nr_rlc_pdu_encoder_t *encoder, - missing_data_t *m, int *e1_byte, int *e1_bit) + missing_data_t *m, int *e1_byte, int *e1_bit, + int *generation_truncated, + unsigned char **so_end_address) { int r_bits = entity->sn_field_length == 18 ? 3 : 1; - int range_count = 0; + int last_nack_generated = -1; int sn_start; int so_start; int sn_end; @@ -1164,6 +1160,7 @@ static int generate_missing(nr_rlc_entity_am_t *entity, m_nack.so_end = so_end; if (encoder->byte + nack_size(entity, &m_nack) > encoder->size) { m->next = NULL; + *generation_truncated = 1; break; } @@ -1197,6 +1194,7 @@ static int generate_missing(nr_rlc_entity_am_t *entity, /* nack_sn */ nr_rlc_pdu_encoder_put_bits(encoder, sn_start, entity->sn_field_length); + last_nack_generated = sn_start; /* e1 = 0 (set later if needed) */ nr_rlc_pdu_encoder_put_bits(encoder, 0, 1); /* e2 */ @@ -1208,34 +1206,44 @@ static int generate_missing(nr_rlc_entity_am_t *entity, /* so_start/so_end */ if (e2) { nr_rlc_pdu_encoder_put_bits(encoder, so_start, 16); + *so_end_address = (unsigned char *)encoder->buffer + encoder->byte; nr_rlc_pdu_encoder_put_bits(encoder, so_end, 16); - } + } else + *so_end_address = NULL; /* nack range */ - if (e3) + if (e3) { nr_rlc_pdu_encoder_put_bits(encoder, cur_sn_count, 8); + last_nack_generated += cur_sn_count - 1; + } sn_count -= cur_sn_count; sn_start = (sn_start + cur_sn_count) % entity->sn_modulus; - range_count++; } - return range_count; + return last_nack_generated; } static int generate_status(nr_rlc_entity_am_t *entity, char *buffer, int size) { - int ack_sn = entity->rx_next; - missing_data_t m; + int last_nack; + int ack_sn; + missing_data_t m; nr_rlc_pdu_t *cur; - int nack_count = 0; + int check_head = 1; nr_rlc_pdu_encoder_t encoder; int e1_byte; int e1_bit; + int generation_truncated; + int ln; + unsigned char *so_end_address = NULL; /* if not enough room, do nothing */ if (size < 3) return 0; + /* initial last_nack is rx_next - 1 */ + last_nack = (entity->rx_next - 1 + entity->sn_modulus) % entity->sn_modulus; + nr_rlc_pdu_encoder_init(&encoder, buffer, size); /* first 3 bytes, ack_sn and e1 will be set later */ @@ -1250,22 +1258,33 @@ static int generate_status(nr_rlc_entity_am_t *entity, char *buffer, int size) e1_bit = entity->sn_field_length == 18 ? 1 : 7; while (cur != NULL) { - m = next_missing(entity, cur, nack_count == 0); - - /* update ack_sn if the returned value is valid */ - if (m.ack_sn != -1) - ack_sn = m.ack_sn; + m = next_missing(entity, cur, check_head); + check_head = 0; /* stop here if no more nack to report */ if (m.sn_start == -1) break; - nack_count += generate_missing(entity, &encoder, &m, &e1_byte, &e1_bit); + generation_truncated = 0; + ln = generate_missing(entity, &encoder, &m, &e1_byte, &e1_bit, + &generation_truncated, &so_end_address); + /* remember the last nack put, if any */ + if (ln != -1) + last_nack = ln; + /* if generation was truncated and so_end was put, we force its value to + * 0xffff (end of SDU) because we don't know what missing nack information + * was supposed to be put, so we nack until the end of the PDU to be sure + */ + if (generation_truncated && so_end_address != NULL) { + so_end_address[0] = 0xff; + so_end_address[1] = 0xff; + } cur = m.next; } - /* put ack_sn */ + /* put ack_sn, which is last_nack + 1 */ + ack_sn = (last_nack + 1) % entity->sn_modulus; if (entity->sn_field_length == 12) { buffer[0] = ack_sn >> 8; buffer[1] = ack_sn & 255; From 4c4cbc963b99080682ea10c00c31cd7540e8ebd2 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 22 Apr 2022 12:28:04 +0200 Subject: [PATCH 25/39] fix(ci): little fixes after migration to new infra: - Better mechanism for qlog cleaning - Faster attachment check - html.py is confusing for some python3 installation -- renaming it Signed-off-by: Raphael Defosseux --- ci-scripts/cls_log_mgt.py | 23 ++++++++++++++--------- ci-scripts/cls_module_ue.py | 7 ++++--- ci-scripts/{html.py => cls_oai_html.py} | 0 ci-scripts/cls_oaicitest.py | 4 ++-- ci-scripts/cls_physim.py | 2 +- ci-scripts/cls_physim1.py | 2 +- ci-scripts/main.py | 4 ++-- 7 files changed, 24 insertions(+), 18 deletions(-) rename ci-scripts/{html.py => cls_oai_html.py} (100%) diff --git a/ci-scripts/cls_log_mgt.py b/ci-scripts/cls_log_mgt.py index 905a105512..e29e9168b7 100644 --- a/ci-scripts/cls_log_mgt.py +++ b/ci-scripts/cls_log_mgt.py @@ -64,10 +64,10 @@ class Log_Mgt: if m is not None: return int(m.group(1)) - def __RemoveOldest(self): + def __RemoveOldest(self, days): mySSH = sshconnection.SSHConnection() mySSH.open(self.IPAddress, self.Username, self.Password) - COMMAND='echo ' + self.Password + ' | sudo -S find ' + self.path + ' -type f -mtime +14 -delete' + COMMAND='echo ' + self.Password + ' | sudo -S find ' + self.path + ' -type f -mtime +' + str(days) + ' -delete' mySSH.command(COMMAND,'\$',20) mySSH.close() @@ -79,13 +79,18 @@ class Log_Mgt: def LogRotation(self): - used_space = self.__CheckUsedSpace() #avail space in target folder - if used_space > 80 : - logging.debug('\u001B[1;37;41m Used Disk > 80%, on ' + self.Username+'@'+self.IPAddress + '\u001B[0m') - logging.debug('\u001B[1;37;41m Removing Artifacts older than 14 days \u001B[0m') - self.__RemoveOldest() - else: - logging.debug('Used Disk < 80%, on ' + self.Username+'@'+self.IPAddress +', no cleaning required') + doLoop = True + nbDays = 14 + while doLoop and nbDays > 2: + used_space = self.__CheckUsedSpace() #avail space in target folder + if used_space > 80 : + logging.debug('\u001B[1;37;41m Used Disk (' + str(used_space) + '%) > 80%, on ' + self.Username+'@'+self.IPAddress + '\u001B[0m') + logging.debug('\u001B[1;37;41m Removing Artifacts older than ' + nbDays + ' days \u001B[0m') + self.__RemoveOldest(nbDays) + nbDays -= 1 + else: + logging.debug('Used Disk (' + str(used_space) + '%) < 80%, on ' + self.Username+'@'+self.IPAddress +', no cleaning required') + doLoop = False diff --git a/ci-scripts/cls_module_ue.py b/ci-scripts/cls_module_ue.py index fb10700798..dcf75a34fc 100644 --- a/ci-scripts/cls_module_ue.py +++ b/ci-scripts/cls_module_ue.py @@ -107,14 +107,15 @@ class Module_UE: def GetModuleIPAddress(self): HOST=self.HostUsername+'@'+self.HostIPAddress response= [] - tentative = 3 + tentative = 8 while (len(response)==0) and (tentative>0): COMMAND="ip a show dev " + self.UENetwork + " | grep --colour=never inet | grep " + self.UENetwork - logging.debug(COMMAND) + if tentative == 8: + logging.debug(COMMAND) ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) response = ssh.stdout.readlines() tentative-=1 - time.sleep(10) + time.sleep(2) if (tentative==0) and (len(response)==0): logging.debug('\u001B[1;37;41m Module IP Address Not Found! Time expired \u001B[0m') return -1 diff --git a/ci-scripts/html.py b/ci-scripts/cls_oai_html.py similarity index 100% rename from ci-scripts/html.py rename to ci-scripts/cls_oai_html.py diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 33910f1f9b..9d5ae84038 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -439,7 +439,7 @@ class OaiCiTest(): while cnt < 4: Module_UE.Command("wup") logging.debug("Waiting for IP address to be assigned") - time.sleep(20) + time.sleep(5) logging.debug("Retrieve IP address") status=Module_UE.GetModuleIPAddress() if status==0: @@ -1111,7 +1111,7 @@ class OaiCiTest(): while cnt < 4: Module_UE.Command("wup") logging.debug("Waiting for IP address to be assigned") - time.sleep(20) + time.sleep(5) logging.debug("Retrieve IP address") status=Module_UE.GetModuleIPAddress() if status==0: diff --git a/ci-scripts/cls_physim.py b/ci-scripts/cls_physim.py index 33792f6ca4..ecd8f63af1 100644 --- a/ci-scripts/cls_physim.py +++ b/ci-scripts/cls_physim.py @@ -32,7 +32,7 @@ import logging #to create a SSH object locally in the methods import sshconnection #to update the HTML object -import html +import cls_oai_html from multiprocessing import SimpleQueue #for log folder maintenance import os diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 54329790cd..3907fc2a34 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -33,7 +33,7 @@ #----------------------------------------------------------- import logging import sshconnection as SSH -import html +import cls_oai_html import os import re import time diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 65f9fbb0da..03947bdfc9 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -49,7 +49,7 @@ import cls_physim1 #class PhySim for physical simulators deploy and run import sshconnection import epc import ran -import html +import cls_oai_html #----------------------------------------------------------- @@ -518,7 +518,7 @@ CiTestObj = cls_oaicitest.OaiCiTest() SSH = sshconnection.SSHConnection() EPC = epc.EPCManagement() RAN = ran.RANManagement() -HTML = html.HTMLManagement() +HTML = cls_oai_html.HTMLManagement() CONTAINERS = cls_containerize.Containerize() SCA = cls_static_code_analysis.StaticCodeAnalysis() PHYSIM = cls_physim1.PhySim() From 532bb0da965417617e4e7ed2612b1208814bae3c Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 22 Apr 2022 17:54:41 +0200 Subject: [PATCH 26/39] Remove useless comments --- openair2/LAYER2/NR_MAC_COMMON/nr_mac.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h index 63f21ec382..9123afd324 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h @@ -107,10 +107,10 @@ typedef struct { } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_SHORT; typedef struct { - uint8_t LCID: 6; // octet 1 [5:0] - uint8_t F: 1; // octet 1 [6] - uint8_t R: 1; // octet 1 [7] - uint16_t L: 16; // octet 2 [7:0] + uint8_t LCID: 6; + uint8_t F: 1; + uint8_t R: 1; + uint16_t L: 16; } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_LONG; typedef struct { From 3c6a628b747cd6e78ae2b30072f19b9fbabbe202 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Mon, 25 Apr 2022 23:34:48 +0200 Subject: [PATCH 27/39] fix 2 bugs: one new introduced by merge develop, one introduced by extra change asked in code review --- openair1/PHY/CODING/nr_segmentation.c | 2 +- openair1/SCHED_NR_UE/harq_nr.c | 4 +++- openair1/SIMULATION/NR_PHY/dlschsim.c | 7 +------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/openair1/PHY/CODING/nr_segmentation.c b/openair1/PHY/CODING/nr_segmentation.c index 281e61cda5..f43813a6ca 100644 --- a/openair1/PHY/CODING/nr_segmentation.c +++ b/openair1/PHY/CODING/nr_segmentation.c @@ -87,7 +87,7 @@ if ((Kprime%Kb) > 0) else Z = (Kprime/Kb); - LOG_D(PHY,"nr segmetation B %u Bprime %u Kprime %u z %u \n", B, Bprime, Kprime, Z); + LOG_D(PHY,"nr segmentation B %u Bprime %u Kprime %u z %u \n", B, Bprime, Kprime, Z); if (Z <= 2) { *K = 2; diff --git a/openair1/SCHED_NR_UE/harq_nr.c b/openair1/SCHED_NR_UE/harq_nr.c index c0f7c08771..a9ff01d78a 100644 --- a/openair1/SCHED_NR_UE/harq_nr.c +++ b/openair1/SCHED_NR_UE/harq_nr.c @@ -357,8 +357,10 @@ void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ndi, int if (ndi!=dl_harq->DCINdi) { dl_harq->first_rx = true; dl_harq->DLround = 0; - } else + } else { + dl_harq->first_rx = false; dl_harq->DLround++; + } dl_harq->status = ACTIVE; diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index 64e377b896..6f747b36a6 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -478,13 +478,10 @@ int main(int argc, char **argv) harq_process->n_dmrs_cdm_groups = 1; printf("harq process ue mcs = %d Qm = %d, symb %d\n", harq_process->mcs, harq_process->Qm, nb_symb_sch); - unsigned char *test_input; - test_input = (unsigned char *) malloc16(sizeof(unsigned char) * TBS / 8); + unsigned char *test_input=dlsch->harq_process.pdu; //unsigned char test_input[TBS / 8] __attribute__ ((aligned(16))); for (i = 0; i < TBS / 8; i++) test_input[i] = (unsigned char) rand(); - dlsch->harq_process.pdu=test_input; - //estimated_output = harq_process->b; #ifdef DEBUG_NR_DLSCHSIM for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%hhu \n",test_input[i]); @@ -618,8 +615,6 @@ int main(int argc, char **argv) } }*/ - //free(test_input); it must not be free as it is in DLSCH_struct -> free_gNB_dlsch () -> free(harq->pdu) with no checks or control - free_channel_desc_scm(gNB2UE); reset_DLSCH_struct(gNB, &msgDataTx); From b805e6db47bbb42dd97a735984e75860ddd8274e Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 26 Apr 2022 17:40:42 +0200 Subject: [PATCH 28/39] Use --continuous-tx for B210-based gNB (TDD) --- ci-scripts/xml_files/fr1_nsa_quectel.xml | 2 +- ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/xml_files/fr1_nsa_quectel.xml b/ci-scripts/xml_files/fr1_nsa_quectel.xml index 55f6f4376e..44aab6e892 100644 --- a/ci-scripts/xml_files/fr1_nsa_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_quectel.xml @@ -74,7 +74,7 @@ Initialize_eNB Initialize gNB - -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E -q --RUs.[0].sdr_addrs "serial=30C51D4" --log_config.global_log_options level,nocolor,time,line_num,function + -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E -q --RUs.[0].sdr_addrs "serial=30C51D4" --continuous-tx --log_config.global_log_options level,nocolor,time,line_num,function 1 1 nr diff --git a/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml b/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml index 61266aa2b1..208e1564cd 100644 --- a/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml @@ -26,7 +26,7 @@ services: FLEXRAN_INTERFACE_NAME: eth0 FLEXRAN_IPV4_ADDRESS: 172.21.16.136 THREAD_PARALLEL_CONFIG: PARALLEL_RU_L1_TRX_SPLIT - USE_ADDITIONAL_OPTIONS: -E -q --RUs.[0].sdr_addrs serial=30C51D4 --log_config.global_log_options level,nocolor,time,line_num,function + USE_ADDITIONAL_OPTIONS: -E -q --RUs.[0].sdr_addrs serial=30C51D4 --continuous-tx --log_config.global_log_options level,nocolor,time,line_num,function volumes: - /dev:/dev networks: From 57d1b22ca4296ba3e92a990ad41432e895f83ceb Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 26 Apr 2022 17:48:23 +0200 Subject: [PATCH 29/39] Improve B210 gNB configuration --- .../conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 af58145322..f2bf69d2f7 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 @@ -203,7 +203,7 @@ MACRLCs = ( tr_n_preference = "local_RRC"; pusch_TargetSNRx10 = 200; pucch_TargetSNRx10 = 200; - ulsch_max_frame_inactivity = 1; + ulsch_max_frame_inactivity = 0; } ); @@ -221,11 +221,11 @@ RUs = ( local_rf = "yes" nb_tx = 1 nb_rx = 1 - att_tx = 3 - att_rx = 0; + att_tx = 16 + att_rx = 16; bands = [7]; max_pdschReferenceSignalPower = -27; - max_rxgain = 111; + max_rxgain = 114; eNB_instances = [0]; # sdr_addrs = "serial=30C51D4"; # clock_src = "external"; From 4389fdea4ef82dba502271235ab65d5b446d5432 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 26 Apr 2022 18:16:19 +0200 Subject: [PATCH 30/39] Harmonize NSA DMRS AdditionalPosition with SA --- openair2/RRC/NR/rrc_gNB_reconfig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 36113fb7ee..4e9245cf46 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -223,7 +223,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); - *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; + *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1; secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList)); @@ -572,7 +572,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; } bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); - *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; + *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1; bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList)); From 89e7923652c0f28ce1dd2538c3cb562ffc6dc962 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 26 Apr 2022 17:56:50 +0200 Subject: [PATCH 31/39] Increase NSA B210 throughput requirements --- .../xml_files/container_nsa_b200_quectel.xml | 8 ++++---- ci-scripts/xml_files/fr1_nsa_quectel.xml | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ci-scripts/xml_files/container_nsa_b200_quectel.xml b/ci-scripts/xml_files/container_nsa_b200_quectel.xml index 610f0b019a..80ed3f5cfc 100644 --- a/ci-scripts/xml_files/container_nsa_b200_quectel.xml +++ b/ci-scripts/xml_files/container_nsa_b200_quectel.xml @@ -138,12 +138,12 @@ Iperf - iperf (DL/40Mbps/UDP)(60 sec)(single-ue profile) - -u -b 40M -t 60 -i 1 -fm + iperf (DL/125Mbps/UDP)(60 sec)(single-ue profile) + -u -b 125M -t 60 -i 1 -fm DL idefix - 20 - 85 + 1 + 95 single-ue diff --git a/ci-scripts/xml_files/fr1_nsa_quectel.xml b/ci-scripts/xml_files/fr1_nsa_quectel.xml index 44aab6e892..f8ecaae0fd 100644 --- a/ci-scripts/xml_files/fr1_nsa_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_quectel.xml @@ -117,29 +117,29 @@ -u -b 30M -t 30 DL idefix - 5 + 1 95 single-ue Iperf - iperf (DL/40Mbps/UDP)(30 sec)(single-ue profile) - -u -b 40M -t 30 + iperf (DL/90Mbps/UDP)(30 sec)(single-ue profile) + -u -b 90M -t 30 DL idefix - 5 + 1 95 single-ue Iperf - iperf (DL/60Mbps/UDP)(60 sec)(single-ue profile) - -u -b 60M -t 60 + iperf (DL/125Mbps/UDP)(60 sec)(single-ue profile) + -u -b 125M -t 60 DL idefix - 5 + 1 95 single-ue From a4f3d431f5a52e876c26f61ea7159c039250b145 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 27 Apr 2022 16:31:35 +0200 Subject: [PATCH 32/39] Further improve B210/NSA gNB configuration file --- ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 f2bf69d2f7..f3515d3882 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 @@ -221,8 +221,8 @@ RUs = ( local_rf = "yes" nb_tx = 1 nb_rx = 1 - att_tx = 16 - att_rx = 16; + att_tx = 12 + att_rx = 12; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 114; From c265cbda8a272dd245dd7635cce12a70f62409e0 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 27 Apr 2022 16:36:16 +0200 Subject: [PATCH 33/39] NSA-B200(-Container) test: increase UL traffic requirements --- ci-scripts/xml_files/container_nsa_b200_quectel.xml | 4 ++-- ci-scripts/xml_files/fr1_nsa_quectel.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ci-scripts/xml_files/container_nsa_b200_quectel.xml b/ci-scripts/xml_files/container_nsa_b200_quectel.xml index 80ed3f5cfc..47a939f63c 100644 --- a/ci-scripts/xml_files/container_nsa_b200_quectel.xml +++ b/ci-scripts/xml_files/container_nsa_b200_quectel.xml @@ -149,8 +149,8 @@ Iperf - iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile) - -u -b 3M -t 60 -i 1 -fm + iperf (UL/8Mbps/UDP)(60 sec)(single-ue profile) + -u -b 8M -t 60 -i 1 -fm UL idefix 1 diff --git a/ci-scripts/xml_files/fr1_nsa_quectel.xml b/ci-scripts/xml_files/fr1_nsa_quectel.xml index f8ecaae0fd..0f8c90abdf 100644 --- a/ci-scripts/xml_files/fr1_nsa_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_quectel.xml @@ -146,8 +146,8 @@ Iperf - iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile) - -u -b 3M -t 60 + iperf (UL/8Mbps/UDP)(60 sec)(single-ue profile) + -u -b 8M -t 60 UL idefix 1 From 629b04dc80800af8ec7351a88e88547a126488ba Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 27 Apr 2022 15:25:43 +0200 Subject: [PATCH 34/39] fix(ci): typo when printing Signed-off-by: Raphael Defosseux --- ci-scripts/cls_log_mgt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/cls_log_mgt.py b/ci-scripts/cls_log_mgt.py index e29e9168b7..f1dbf6b8ec 100644 --- a/ci-scripts/cls_log_mgt.py +++ b/ci-scripts/cls_log_mgt.py @@ -81,11 +81,11 @@ class Log_Mgt: def LogRotation(self): doLoop = True nbDays = 14 - while doLoop and nbDays > 2: + while doLoop and nbDays > 1: used_space = self.__CheckUsedSpace() #avail space in target folder if used_space > 80 : logging.debug('\u001B[1;37;41m Used Disk (' + str(used_space) + '%) > 80%, on ' + self.Username+'@'+self.IPAddress + '\u001B[0m') - logging.debug('\u001B[1;37;41m Removing Artifacts older than ' + nbDays + ' days \u001B[0m') + logging.debug('\u001B[1;37;41m Removing Artifacts older than ' + str(nbDays) + ' days \u001B[0m') self.__RemoveOldest(nbDays) nbDays -= 1 else: From e98afec56753f15427c29866626dbeb3c6e7a914 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 27 Apr 2022 17:40:53 +0200 Subject: [PATCH 35/39] NSA-2x2 test: improve gNB configuration --- .../gnb.band78.nsa_2x2.106PRB.usrpn310.conf | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 e3bd49e7fc..fa7c190538 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 @@ -199,12 +199,12 @@ gNBs = ); MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - ulsch_max_frame_inactivity = 1; - } +{ + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + ulsch_max_frame_inactivity = 0; +} ); L1s = ( @@ -213,6 +213,7 @@ L1s = ( tr_n_preference = "local_mac"; thread_pool_size = 8; prach_dtx_threshold = 120; + pucch0_dtx_threshold = 80; } ); From 730fa472ae361b5e3e7ab973c5c763b0cd74c046 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 27 Apr 2022 17:46:17 +0200 Subject: [PATCH 36/39] NSA-2x2 test: increase DL traffic requirements --- ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml index a4dcb58e8b..332af80d22 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml @@ -115,11 +115,11 @@ Iperf - iperf (DL/60Mbps/UDP)(60 sec)(single-ue profile) - -u -b 60M -t 60 + iperf (DL/125Mbps/UDP)(60 sec)(single-ue profile) + -u -b 125M -t 60 DL nrmodule2_quectel - 5 + 15 single-ue From b089469935673c3101db6eb26edc74290a2491d3 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 27 Apr 2022 18:15:46 +0200 Subject: [PATCH 37/39] Reduce nr_dlsim 256QAM MCS 27 test case to MCS 26, see #543 --- cmake_targets/autotests/test_case_list.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index ce1b9dcdf4..b55228bdc9 100755 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1093,7 +1093,7 @@ (Test8: 217 PRB 100 PDSCH-PRBs 110 PDSCH-Offset), (Test9: 106 PRBs 50 PDSCH-PRBs MCS Index 27), (Test10: 106 PRBs 50 PDSCH-PRBs MCS Index 16), - (Test11: 106 MCS-TABLE 256 QAM MCS Index 27), + (Test11: 106 MCS-TABLE 256 QAM MCS Index 26), (Test12: HARQ test 25% TP 4 rounds), (Test13: HARQ test 33% TP 3 rounds), (Test14: HARQ test 50% TP 2 rounds), @@ -1121,7 +1121,7 @@ -n100 -R217 -a110 -s5 -b100 -n100 -e27 -s30 -n100 -e16 -s10 - -n100 -q1 -e27 -s30 + -n100 -q1 -e26 -s30 -n100 -s1 -t25 -n100 -s1 -t33 -n100 -s1 -t50 From ced2a66f6e57e3afd77a7d547f0fc32e96fb2eaf Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 27 Apr 2022 18:36:01 +0200 Subject: [PATCH 38/39] fix(ci): changing the Docker Hub account to push to Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-push-registry | 13 +++++--- ci-scripts/provideUniqueImageTag.py | 6 ++-- .../4g_rfsimulator_fdd_05MHz/README.md | 28 ++++++++-------- ci-scripts/yaml_files/5g_l2sim_tdd/README.md | 32 +++++++++---------- .../yaml_files/5g_rfsimulator/README.md | 28 ++++++++-------- 5 files changed, 52 insertions(+), 55 deletions(-) diff --git a/ci-scripts/Jenkinsfile-push-registry b/ci-scripts/Jenkinsfile-push-registry index f5847ff0aa..bc1a80ba61 100644 --- a/ci-scripts/Jenkinsfile-push-registry +++ b/ci-scripts/Jenkinsfile-push-registry @@ -26,6 +26,9 @@ def nodeExecutor = params.nodeExecutor // Name of the phone resource def ciServerResource = params.serverResource +// Docker Hub account to push to +def DH_Account = "oaisoftwarealliance" + pipeline { agent { label nodeExecutor @@ -66,11 +69,11 @@ pipeline { def listOfImages = ["oai-enb", "oai-gnb", "oai-lte-ue", "oai-nr-ue"] sh "docker login -u ${DH_Username} -p ${DH_Password} > /dev/null 2>&1" listOfImages.eachWithIndex { item, iindex -> - sh "docker image tag ${item}:develop ${DH_Username}/${item}:develop" - sh "docker image tag ${item}:develop ${DH_Username}/${item}:${WEEK_TAG}" - sh "docker push --quiet ${DH_Username}/${item}:${WEEK_TAG}" - sh "docker push --quiet ${DH_Username}/${item}:develop" - sh "docker rmi ${DH_Username}/${item}:${WEEK_TAG} ${DH_Username}/${item}:develop" + sh "docker image tag ${item}:develop ${DH_Account}/${item}:develop" + sh "docker image tag ${item}:develop ${DH_Account}/${item}:${WEEK_TAG}" + sh "docker push --quiet ${DH_Account}/${item}:${WEEK_TAG}" + sh "docker push --quiet ${DH_Account}/${item}:develop" + sh "docker rmi ${DH_Account}/${item}:${WEEK_TAG} ${DH_Account}/${item}:develop" } sh "docker logout > /dev/null 2>&1" } diff --git a/ci-scripts/provideUniqueImageTag.py b/ci-scripts/provideUniqueImageTag.py index ee8306402f..88d51ca6f8 100644 --- a/ci-scripts/provideUniqueImageTag.py +++ b/ci-scripts/provideUniqueImageTag.py @@ -5,15 +5,15 @@ import subprocess import sys AUTH_SERVICE = 'registry.docker.io' -AUTH_SCOPE = 'repository:rdefosseoai/oai-enb:pull' +AUTH_SCOPE = 'repository:oaisoftwarealliance/oai-enb:pull' def main() -> None: args = _parse_args() - cmd = 'curl -fsSL "https://auth.docker.io/token?service=' + AUTH_SERVICE + '&scope=' + AUTH_SCOPE + '" | jq --raw-output ".token"' + cmd = 'curl -fsSL "https://auth.docker.io/token?service=' + AUTH_SERVICE + '&scope=' + AUTH_SCOPE + '" 2>/dev/null | jq --raw-output ".token"' token = subprocess.check_output(cmd, shell=True, universal_newlines=True) token = str(token).strip() - cmd = 'curl -fsSL -H "Authorization: Bearer ' + token + '" "https://index.docker.io/v2/rdefosseoai/oai-enb/tags/list" | jq .' + cmd = 'curl -fsSL -H "Authorization: Bearer ' + token + '" "https://index.docker.io/v2/oaisoftwarealliance/oai-enb/tags/list" 2>/dev/null | jq .' listOfTags = subprocess.check_output(cmd, shell=True, universal_newlines=True) foundTag = False diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md index be0d63838b..1a947d0389 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md @@ -31,9 +31,7 @@ This page is only valid for an `Ubuntu18` host. # 1. Retrieving the images on Docker-Hub # -Currently the images are hosted under the user account `rdefosseoai`. - -This may change in the future. +Currently the images are hosted under the team account `oaisoftwarealliance`. They were previously hosted under the user account `rdefosseoai`. Once again you may need to log on [docker-hub](https://hub.docker.com/) if your organization has reached pulling limit as `anonymous`. @@ -49,13 +47,13 @@ Now pull images. ```bash $ docker pull cassandra:2.1 $ docker pull redis:6.0.5 -$ docker pull rdefosseoai/oai-hss:latest -$ docker pull rdefosseoai/magma-mme:latest -$ docker pull rdefosseoai/oai-spgwc:latest -$ docker pull rdefosseoai/oai-spgwu-tiny:latest +$ docker pull oaisoftwarealliance/oai-hss:latest +$ docker pull oaisoftwarealliance/magma-mme:latest +$ docker pull oaisoftwarealliance/oai-spgwc:latest +$ docker pull oaisoftwarealliance/oai-spgwu-tiny:latest -$ docker pull rdefosseoai/oai-enb:develop -$ docker pull rdefosseoai/oai-lte-ue:develop +$ docker pull oaisoftwarealliance/oai-enb:develop +$ docker pull oaisoftwarealliance/oai-lte-ue:develop ``` If the `redis` tag is not available, pick the newest available `6.0.x` tag at [Docker Hub Redis Tags](https://hub.docker.com/_/redis?tab=tags). @@ -63,13 +61,13 @@ If the `redis` tag is not available, pick the newest available `6.0.x` tag at [D And **re-tag** them for tutorials' docker-compose file to work. ```bash -$ docker image tag rdefosseoai/oai-spgwc:latest oai-spgwc:latest -$ docker image tag rdefosseoai/oai-hss:latest oai-hss:latest -$ docker image tag rdefosseoai/oai-spgwu-tiny:latest oai-spgwu-tiny:latest -$ docker image tag rdefosseoai/magma-mme:latest magma-mme:latest +$ docker image tag oaisoftwarealliance/oai-spgwc:latest oai-spgwc:latest +$ docker image tag oaisoftwarealliance/oai-hss:latest oai-hss:latest +$ docker image tag oaisoftwarealliance/oai-spgwu-tiny:latest oai-spgwu-tiny:latest +$ docker image tag oaisoftwarealliance/magma-mme:latest magma-mme:latest -$ docker image tag rdefosseoai/oai-enb:develop oai-enb:develop -$ docker image tag rdefosseoai/oai-lte-ue:develop oai-lte-ue:develop +$ docker image tag oaisoftwarealliance/oai-enb:develop oai-enb:develop +$ docker image tag oaisoftwarealliance/oai-lte-ue:develop oai-lte-ue:develop ``` ```bash diff --git a/ci-scripts/yaml_files/5g_l2sim_tdd/README.md b/ci-scripts/yaml_files/5g_l2sim_tdd/README.md index f1e1287995..c3f631cf76 100644 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/README.md +++ b/ci-scripts/yaml_files/5g_l2sim_tdd/README.md @@ -18,9 +18,7 @@ This tutorial is only valid once this file is merged into the `develop` branch. # 1. Retrieving the images on Docker-Hub # -Currently the images are hosted under the user account `rdefosseoai`. - -This may change in the future. +Currently the images are hosted under the team account `oaisoftwarealliance`. They were previously hosted under the user account `rdefosseoai`. Once again you may need to log on [docker-hub](https://hub.docker.com/) if your organization has reached pulling limit as `anonymous`. @@ -35,27 +33,27 @@ Now pull images. ```bash $ docker pull mysql:5.7 -$ docker pull rdefosseoai/oai-amf:latest -$ docker pull rdefosseoai/oai-nrf:latest -$ docker pull rdefosseoai/oai-smf:latest -$ docker pull rdefosseoai/oai-spgwu-tiny:latest +$ docker pull oaisoftwarealliance/oai-amf:latest +$ docker pull oaisoftwarealliance/oai-nrf:latest +$ docker pull oaisoftwarealliance/oai-smf:latest +$ docker pull oaisoftwarealliance/oai-spgwu-tiny:latest -$ docker pull rdefosseoai/oai-gnb:develop -$ docker pull rdefosseoai/oai-nr-ue:develop -$ docker pull rdefosseoai/proxy:latest +$ docker pull oaisoftwarealliance/oai-gnb:develop +$ docker pull oaisoftwarealliance/oai-nr-ue:develop +$ docker pull oaisoftwarealliance/proxy:latest ``` And **re-tag** them for tutorials' docker-compose file to work. ```bash -$ docker image tag rdefosseoai/oai-amf:latest oai-amf:latest -$ docker image tag rdefosseoai/oai-nrf:latest oai-nrf:latest -$ docker image tag rdefosseoai/oai-smf:latest oai-smf:latest -$ docker image tag rdefosseoai/oai-spgwu-tiny:latest oai-spgwu-tiny:latest +$ docker image tag oaisoftwarealliance/oai-amf:latest oai-amf:latest +$ docker image tag oaisoftwarealliance/oai-nrf:latest oai-nrf:latest +$ docker image tag oaisoftwarealliance/oai-smf:latest oai-smf:latest +$ docker image tag oaisoftwarealliance/oai-spgwu-tiny:latest oai-spgwu-tiny:latest -$ docker image tag rdefosseoai/oai-gnb:develop oai-gnb:develop -$ docker image tag rdefosseoai/oai-nr-ue:develop oai-nr-ue:develop -$ docker image tag rdefosseoai/proxy:latest oai-lte-multi-ue-proxy:latest +$ docker image tag oaisoftwarealliance/oai-gnb:develop oai-gnb:develop +$ docker image tag oaisoftwarealliance/oai-nr-ue:develop oai-nr-ue:develop +$ docker image tag oaisoftwarealliance/proxy:latest oai-lte-multi-ue-proxy:latest ``` ```bash diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index 64c9084500..aa18571776 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -35,9 +35,7 @@ This page is only valid for an `Ubuntu18` host. # 1. Retrieving the images on Docker-Hub # -Currently the images are hosted under the user account `rdefosseoai`. - -This may change in the future. +Currently the images are hosted under the team account `oaisoftwarealliance`. They were previously hosted under the user account `rdefosseoai`. Once again you may need to log on [docker-hub](https://hub.docker.com/) if your organization has reached pulling limit as `anonymous`. @@ -52,25 +50,25 @@ Now pull images. ```bash $ docker pull mysql:5.7 -$ docker pull rdefosseoai/oai-amf:latest -$ docker pull rdefosseoai/oai-nrf:latest -$ docker pull rdefosseoai/oai-smf:latest -$ docker pull rdefosseoai/oai-spgwu-tiny:latest +$ docker pull oaisoftwarealliance/oai-amf:latest +$ docker pull oaisoftwarealliance/oai-nrf:latest +$ docker pull oaisoftwarealliance/oai-smf:latest +$ docker pull oaisoftwarealliance/oai-spgwu-tiny:latest -$ docker pull rdefosseoai/oai-gnb:develop -$ docker pull rdefosseoai/oai-nr-ue:develop +$ docker pull oaisoftwarealliance/oai-gnb:develop +$ docker pull oaisoftwarealliance/oai-nr-ue:develop ``` And **re-tag** them for tutorials' docker-compose file to work. ```bash -$ docker image tag rdefosseoai/oai-amf:latest oai-amf:latest -$ docker image tag rdefosseoai/oai-nrf:latest oai-nrf:latest -$ docker image tag rdefosseoai/oai-smf:latest oai-smf:latest -$ docker image tag rdefosseoai/oai-spgwu-tiny:latest oai-spgwu-tiny:latest +$ docker image tag oaisoftwarealliance/oai-amf:latest oai-amf:latest +$ docker image tag oaisoftwarealliance/oai-nrf:latest oai-nrf:latest +$ docker image tag oaisoftwarealliance/oai-smf:latest oai-smf:latest +$ docker image tag oaisoftwarealliance/oai-spgwu-tiny:latest oai-spgwu-tiny:latest -$ docker image tag rdefosseoai/oai-gnb:develop oai-gnb:develop -$ docker image tag rdefosseoai/oai-nr-ue:develop oai-nr-ue:develop +$ docker image tag oaisoftwarealliance/oai-gnb:develop oai-gnb:develop +$ docker image tag oaisoftwarealliance/oai-nr-ue:develop oai-nr-ue:develop ``` ```bash From 8d43b9c4770b64b47f9f1fc89bf923e630c4741c Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 28 Apr 2022 09:47:05 +0200 Subject: [PATCH 39/39] NSA 2x2: Set bitrate threshold to mark test green (setup problem) --- ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml index 332af80d22..2ef2b7d7ce 100644 --- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml @@ -120,6 +120,7 @@ DL nrmodule2_quectel 15 + 85 single-ue