Commit 7ed637a9 authored by Raymond Knopp's avatar Raymond Knopp

added n1L1_stats.log. improvements to noise level (PUCCH/PUSCH) and signal...

added n1L1_stats.log. improvements to noise level (PUCCH/PUSCH) and signal level (PUCCH) computations. added DTX detection parameters for PUCCH/PUSCH/PRACH in L1 section of configuration file. hotfix from C. Roux for SRB PDCP integrity. extra logging to debug missing PUSCH/DCI at UE.
parent c0ae1432
...@@ -339,6 +339,22 @@ static void *process_stats_thread(void *param) { ...@@ -339,6 +339,22 @@ static void *process_stats_thread(void *param) {
return(NULL); return(NULL);
} }
void *nrL1_stats_thread(void *param) {
PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param;
wait_sync("L1_stats_thread");
FILE *fd;
while (!oai_exit) {
sleep(1);
fd=fopen("nrL1_stats.log","w");
AssertFatal(fd!=NULL,"Cannot open ngL1_stats.log\n");
dump_nr_I0_stats(fd,gNB);
dump_pusch_stats(fd,gNB);
// dump_uci_stats(fd,eNB,eNB->proc.L1_proc_tx.frame_tx);
fclose(fd);
}
return(NULL);
}
void init_gNB_Tpool(int inst) { void init_gNB_Tpool(int inst) {
PHY_VARS_gNB *gNB; PHY_VARS_gNB *gNB;
gNB = RC.gNB[inst]; gNB = RC.gNB[inst];
...@@ -373,7 +389,10 @@ void init_gNB_Tpool(int inst) { ...@@ -373,7 +389,10 @@ void init_gNB_Tpool(int inst) {
initNotifiedFIFO(gNB->resp_RU_tx); initNotifiedFIFO(gNB->resp_RU_tx);
// Stats measurement thread // Stats measurement thread
if(opp_enabled == 1) threadCreate(&proc->L1_stats_thread, process_stats_thread,(void *)gNB, "time_meas", -1, OAI_PRIORITY_RT_LOW); if(opp_enabled == 1) threadCreate(&proc->process_stats_thread, process_stats_thread,(void *)gNB, "time_meas", -1, OAI_PRIORITY_RT_LOW);
threadCreate(&proc->L1_stats_thread,nrL1_stats_thread,(void*)gNB,"L1_stats",-1,OAI_PRIORITY_RT_LOW);
} }
...@@ -462,6 +481,8 @@ printf("after %p\n", gNB->common_vars.rxdataF[aa]); ...@@ -462,6 +481,8 @@ printf("after %p\n", gNB->common_vars.rxdataF[aa]);
} }
void init_gNB(int single_thread_flag,int wait_for_sync) { void init_gNB(int single_thread_flag,int wait_for_sync) {
int inst; int inst;
......
...@@ -70,7 +70,34 @@ int nr_est_timing_advance_pusch(PHY_VARS_gNB* gNB, int UE_id) ...@@ -70,7 +70,34 @@ int nr_est_timing_advance_pusch(PHY_VARS_gNB* gNB, int UE_id)
} }
void gNB_I0_measurements(PHY_VARS_gNB *gNB) { void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB) {
int min_I0=1000,max_I0=0;
int amin=0,amax=0;
for (int i=0; i<gNB->frame_parms.N_RB_UL; i++) {
if (i==(gNB->frame_parms.N_RB_UL>>1) - 1) i+=2;
if (gNB->measurements.n0_subband_power_tot_dB[i]<min_I0) {min_I0 = gNB->measurements.n0_subband_power_tot_dB[i]; amin=i;}
if (gNB->measurements.n0_subband_power_tot_dB[i]>max_I0) {max_I0 = gNB->measurements.n0_subband_power_tot_dB[i]; amax=i;}
}
for (int i=0; i<gNB->frame_parms.N_RB_UL; i++) {
fprintf(fd,"%2d.",gNB->measurements.n0_subband_power_tot_dB[i]-gNB->measurements.n0_subband_power_avg_dB);
if (i%25 == 24) fprintf(fd,"\n");
}
fprintf(fd,"\nmax_I0 %d (rb %d), min_I0 %d (rb %d), avg I0 %d\n", max_I0, amax, min_I0, amin, gNB->measurements.n0_subband_power_avg_dB);
fprintf(fd,"prach_I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10);
}
void gNB_I0_measurements(PHY_VARS_gNB *gNB,int first_symb,int num_symb) {
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
NR_gNB_COMMON *common_vars = &gNB->common_vars; NR_gNB_COMMON *common_vars = &gNB->common_vars;
...@@ -79,42 +106,51 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB) { ...@@ -79,42 +106,51 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB) {
double rx_gain = openair0_cfg[0].rx_gain[0]; double rx_gain = openair0_cfg[0].rx_gain[0];
double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0]; double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0];
uint32_t *rb_mask = gNB->rb_mask_ul; uint32_t *rb_mask = gNB->rb_mask_ul;
int symbol = gNB->ulmask_symb; int rb, offset, offset0, nb_rb, len;
int rb, offset, nb_rb;
uint32_t n0_subband_power_temp = 0; uint32_t n0_subband_power_temp = 0;
int32_t *ul_ch; int32_t *ul_ch;
int32_t n0_power_tot;
int64_t n0_power_tot2;
if (symbol>-1) {
measurements->n0_power_tot = 0;
for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
nb_rb = 0; nb_rb = 0;
n0_power_tot2=0;
for (rb=0; rb<frame_parms->N_RB_UL; rb++) { for (rb=0; rb<frame_parms->N_RB_UL; rb++) {
n0_power_tot=0;
offset0 = (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size;
if ((rb_mask[rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe if ((rb_mask[rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe
nb_rb++; nb_rb++;
offset = (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size; for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
offset += (symbol*frame_parms->ofdm_symbol_size); measurements->n0_subband_power[aarx][rb]=0;
ul_ch = &common_vars->rxdataF[aarx][offset]; for (int s=first_symb;s<(first_symb+num_symb);s++) {
//TODO what about DC?
n0_subband_power_temp += signal_energy_nodc(ul_ch,12);
}
}
if (nb_rb != 0) { offset = offset0 + (s*frame_parms->ofdm_symbol_size);
measurements->n0_power[aarx] = n0_subband_power_temp/nb_rb; ul_ch = &common_vars->rxdataF[aarx][offset];
measurements->n0_power_dB[aarx] = dB_fixed(measurements->n0_power[aarx]); len = 12;
measurements->n0_power_tot += measurements->n0_power[aarx]; if (((frame_parms->N_RB_UL&1) == 1) &&
(rb==(frame_parms->N_RB_UL>>1))) {
len=6;
} }
AssertFatal(ul_ch, "RX signal buffer (freq) problem\n");
measurements->n0_subband_power[aarx][rb] += signal_energy_nodc(ul_ch,len);
} // symbol
measurements->n0_subband_power[aarx][rb]/=num_symb;
measurements->n0_subband_power_dB[aarx][rb] = dB_fixed(measurements->n0_subband_power[aarx][rb]);
n0_power_tot += measurements->n0_subband_power[aarx][rb];
} //antenna
n0_power_tot/=frame_parms->nb_antennas_rx;
n0_power_tot2 += n0_power_tot;
measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_power_tot);
measurements->n0_subband_power_tot_dBm[rb] = measurements->n0_subband_power_tot_dB[rb] - gNB->rx_total_gain_dB - dB_fixed(frame_parms->N_RB_UL);
} }
} //rb
measurements->n0_power_tot_dB = dB_fixed(measurements->n0_power_tot); if (nb_rb>0) measurements->n0_subband_power_avg_dB = dB_fixed(n0_power_tot2/nb_rb);
measurements->n0_power_tot_dBm = measurements->n0_power_tot_dB + 30 - 10 * log10(pow(2, 30)) - (rx_gain - rx_gain_offset) - dB_fixed(fp->ofdm_symbol_size);
LOG_D(PHY, "In %s: tot n0 power %d dBm for %d RBs (tot N0 power = %d)\n", __FUNCTION__, measurements->n0_power_tot_dBm, nb_rb, measurements->n0_power_tot);
}
} }
// Scope: This function computes the UL SNR from the UL channel estimates // Scope: This function computes the UL SNR from the UL channel estimates
// //
// Todo: // Todo:
......
...@@ -47,7 +47,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -47,7 +47,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
unsigned short bwp_start_subcarrier, unsigned short bwp_start_subcarrier,
nfapi_nr_pusch_pdu_t *pusch_pdu); nfapi_nr_pusch_pdu_t *pusch_pdu);
void gNB_I0_measurements(PHY_VARS_gNB *gNB); void gNB_I0_measurements(PHY_VARS_gNB *gNB,int first_symb,int num_symb);
void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq_pid, unsigned char symbol); void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq_pid, unsigned char symbol);
......
...@@ -357,6 +357,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ...@@ -357,6 +357,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
nfapi_nr_pucch_pdu_t* pucch_pdu); nfapi_nr_pucch_pdu_t* pucch_pdu);
void nr_decode_pucch0(PHY_VARS_gNB *gNB, void nr_decode_pucch0(PHY_VARS_gNB *gNB,
int frame,
int slot, int slot,
nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu, nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu,
nfapi_nr_pucch_pdu_t* pucch_pdu); nfapi_nr_pucch_pdu_t* pucch_pdu);
......
...@@ -137,11 +137,20 @@ void nr_ulsch_unscrambling_optim(int16_t* llr, ...@@ -137,11 +137,20 @@ void nr_ulsch_unscrambling_optim(int16_t* llr,
#endif #endif
} }
void dump_pusch_stats(PHY_VARS_gNB *gNB) { #define STATSTRLEN 16384
void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB) {
char output[16384];
int stroff=0;
for (int i=0;i<NUMBER_OF_NR_ULSCH_MAX;i++) {
for (int aa=0;aa<gNB->frame_parms.nb_antennas_rx;aa++)
stroff+=sprintf(output+stroff,"ULSCH RNTI %x: ulsch_power[%d] %d, ulsch_noise_power[%d] %d\n",
gNB->ulsch_stats[i].rnti, aa,gNB->ulsch_stats[i].power[aa],aa,gNB->ulsch_stats[i].noise_power[aa]);
AssertFatal(stroff<(STATSTRLEN-1000),"Increase STATSTRLEN\n");
for (int i=0;i<NUMBER_OF_NR_ULSCH_MAX;i++)
if (gNB->ulsch_stats[i].rnti>0) if (gNB->ulsch_stats[i].rnti>0)
LOG_I(PHY,"ULSCH RNTI %x: round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, current_Qm %d, current_RI %d, total_bytes RX/SCHED %d/%d\n", stroff+=sprintf(output+stroff,"ULSCH RNTI %x: round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, current_Qm %d, current_RI %d, total_bytes RX/SCHED %d/%d\n",
gNB->ulsch_stats[i].rnti, gNB->ulsch_stats[i].rnti,
gNB->ulsch_stats[i].round_trials[0], gNB->ulsch_stats[i].round_trials[0],
(double)gNB->ulsch_stats[i].round_trials[1]/gNB->ulsch_stats[i].round_trials[0], (double)gNB->ulsch_stats[i].round_trials[1]/gNB->ulsch_stats[i].round_trials[0],
...@@ -154,7 +163,7 @@ void dump_pusch_stats(PHY_VARS_gNB *gNB) { ...@@ -154,7 +163,7 @@ void dump_pusch_stats(PHY_VARS_gNB *gNB) {
gNB->ulsch_stats[i].current_RI, gNB->ulsch_stats[i].current_RI,
gNB->ulsch_stats[i].total_bytes_rx, gNB->ulsch_stats[i].total_bytes_rx,
gNB->ulsch_stats[i].total_bytes_tx); gNB->ulsch_stats[i].total_bytes_tx);
}
} }
void clear_pusch_stats(PHY_VARS_gNB *gNB) { void clear_pusch_stats(PHY_VARS_gNB *gNB) {
......
...@@ -89,6 +89,6 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, ...@@ -89,6 +89,6 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB,
uint8_t harq_pid); uint8_t harq_pid);
int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type); int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
void dump_pusch_stats(PHY_VARS_gNB *gNB); void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB);
void clear_pusch_stats(PHY_VARS_gNB *gNB); void clear_pusch_stats(PHY_VARS_gNB *gNB);
...@@ -1222,11 +1222,13 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -1222,11 +1222,13 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] = signal_energy_nodc(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][symbol*frame_parms->ofdm_symbol_size], gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] = signal_energy_nodc(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][symbol*frame_parms->ofdm_symbol_size],
rel15_ul->rb_size*12); rel15_ul->rb_size*12);
LOG_D(PHY,"ulsch_power[%d] symbol %d %f (%p)\n",aarx,symbol,dB_fixed_times10( gNB->pusch_vars[ulsch_id]->ulsch_power[aarx])/10.0, LOG_D(PHY,"ulsch_power[%d] symbol %d %f (%p)\n",aarx,symbol,dB_fixed_x10( gNB->pusch_vars[ulsch_id]->ulsch_power[aarx])/10.0,
&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][symbol*frame_parms->ofdm_symbol_size]); &gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][symbol*frame_parms->ofdm_symbol_size]);
if (gNB->pusch_vars[ulsch_id]->ulsch_power[aarx]==1) return (1); if (gNB->pusch_vars[ulsch_id]->ulsch_power[aarx]==1) return (1);
gNB->pusch_vars[ulsch_id]->ulsch_noise_power[aarx]=0;
for (int rb=0;rb<rel15_ul->rb_size;rb++)
gNB->pusch_vars[ulsch_id]->ulsch_noise_power[aarx]+=gNB->measurements.n0_subband_power[aarx][rel15_ul->bwp_start+rel15_ul->rb_start+rb]/rel15_ul->rb_size;
} }
} }
stop_meas(&gNB->ulsch_channel_estimation_stats); stop_meas(&gNB->ulsch_channel_estimation_stats);
//---------------------------------------------------------- //----------------------------------------------------------
......
...@@ -161,6 +161,7 @@ int16_t idft12_im[12][12] = { ...@@ -161,6 +161,7 @@ int16_t idft12_im[12][12] = {
void nr_decode_pucch0(PHY_VARS_gNB *gNB, void nr_decode_pucch0(PHY_VARS_gNB *gNB,
int frame,
int slot, int slot,
nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu, nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu,
nfapi_nr_pucch_pdu_t* pucch_pdu) { nfapi_nr_pucch_pdu_t* pucch_pdu) {
...@@ -178,6 +179,19 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -178,6 +179,19 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
"Either bit_len_harq (%d) or sr_flag (%d) must be > 0\n", "Either bit_len_harq (%d) or sr_flag (%d) must be > 0\n",
pucch_pdu->bit_len_harq,pucch_pdu->sr_flag); pucch_pdu->bit_len_harq,pucch_pdu->sr_flag);
NR_gNB_UCI_STATS_t *uci_stats=NULL;
NR_gNB_UCI_STATS_t *first_uci_stats=NULL;
for (int i=0;i<NUMBER_OF_NR_UCI_STATS_MAX;i++)
if (gNB->uci_stats[i].rnti == pucch_pdu->rnti) {
uci_stats = &gNB->uci_stats[i];
break;
} else if (first_uci_stats == NULL && gNB->uci_stats[i].rnti == 0) first_uci_stats = &gNB->uci_stats[i];
if (uci_stats == NULL) { uci_stats=first_uci_stats; uci_stats->rnti = pucch_pdu->rnti;}
AssertFatal(uci_stats!=NULL,"No stat index found\n");
uci_stats->frame = frame;
if(pucch_pdu->bit_len_harq==0){ if(pucch_pdu->bit_len_harq==0){
mcs=table1_mcs; mcs=table1_mcs;
nr_sequences=1; nr_sequences=1;
...@@ -253,6 +267,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -253,6 +267,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
memset((void*)xr[0],0,24*sizeof(int16_t)); memset((void*)xr[0],0,24*sizeof(int16_t));
memset((void*)xr[1],0,24*sizeof(int16_t)); memset((void*)xr[1],0,24*sizeof(int16_t));
int n2; int n2;
for (l=0; l<pucch_pdu->nr_of_symbols; l++) { for (l=0; l<pucch_pdu->nr_of_symbols; l++) {
l2 = l+pucch_pdu->start_symbol_index; l2 = l+pucch_pdu->start_symbol_index;
re_offset[l] = (12*prb_offset[l]) + frame_parms->first_carrier_offset; re_offset[l] = (12*prb_offset[l]) + frame_parms->first_carrier_offset;
...@@ -312,6 +327,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -312,6 +327,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
if (temp>xrtmag) { if (temp>xrtmag) {
xrtmag=temp; xrtmag=temp;
maxpos=i; maxpos=i;
uci_stats->current_pucch0_stat0 = dB_fixed64((int64_t)corr_re[0]*corr_re[0] + (int64_t)corr_im[0]*corr_im[0]);
if (l==2) uci_stats->current_pucch0_stat1 = dB_fixed64((int64_t)corr_re[1]*corr_re[1] + (int64_t)corr_im[1]*corr_im[1]);
} }
} }
if(nr_sequences>1) if(nr_sequences>1)
...@@ -328,18 +345,19 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -328,18 +345,19 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
// 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][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset[0]],12)) - (10*gNB->measurements.n0_power_tot_dB); int max_n0 = uci_stats->pucch0_n00>uci_stats->pucch0_n01 ? uci_stats->pucch0_n00:uci_stats->pucch0_n01;
int SNRtimes10 = dB_fixed_times10(signal_energy_nodc(&rxdataF[0][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset[0]],12)) - (10*max_n0);
int cqi; int cqi;
if (SNRtimes10 < -640) cqi=0; if (SNRtimes10 < -640) cqi=0;
else if (SNRtimes10 > 635) cqi=255; else if (SNRtimes10 > 635) cqi=255;
else cqi=(640+SNRtimes10)/5; else cqi=(640+SNRtimes10)/5;
uci_stats->pucch0_thres = gNB->pucch0_thres + (10*max_n0);
bool no_conf=false; bool no_conf=false;
if (nr_sequences>1) { if (nr_sequences>1) {
if ((xrtmag_dB<(11+dB_fixed(no_corr))) || (dB_fixed(av_corr)<(13+gNB->measurements.n0_power_tot_dB))) //TODO these are temporary threshold based on measurments with the phone if (10*xrtmag_dB < uci_stats->pucch0_thres)
no_conf=true; no_conf=true;
} }
gNB->bad_pucch += no_conf;
// first bit of bitmap for sr presence and second bit for acknack presence // first bit of bitmap for sr presence and second bit for acknack presence
uci_pdu->pduBitmap = pucch_pdu->sr_flag | ((pucch_pdu->bit_len_harq>0)<<1); uci_pdu->pduBitmap = pucch_pdu->sr_flag | ((pucch_pdu->bit_len_harq>0)<<1);
uci_pdu->pucch_format = 0; // format 0 uci_pdu->pucch_format = 0; // format 0
...@@ -347,12 +365,17 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -347,12 +365,17 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_pdu->ul_cqi = cqi; uci_pdu->ul_cqi = cqi;
uci_pdu->timing_advance = 0xffff; // currently not valid uci_pdu->timing_advance = 0xffff; // currently not valid
uci_pdu->rssi = 1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(signal_energy_nodc(&rxdataF[0][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset[0]],12))); uci_pdu->rssi = 1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(signal_energy_nodc(&rxdataF[0][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset[0]],12)));
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]];
if (pucch_pdu->bit_len_harq==0) { if (pucch_pdu->bit_len_harq==0) {
uci_pdu->harq = NULL; uci_pdu->harq = NULL;
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
uci_pdu->sr->sr_confidence_level = (xrtmag_dB<(13+gNB->measurements.n0_power_tot_dB)) ? 1 : 0; uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0;
uci_stats->pucch0_sr_trials++;
if (xrtmag_dB>(gNB->measurements.n0_power_tot_dB)) { if (xrtmag_dB>(gNB->measurements.n0_power_tot_dB)) {
uci_pdu->sr->sr_indication = 1; uci_pdu->sr->sr_indication = 1;
uci_stats->pucch0_positive_SR++;
} else { } else {
uci_pdu->sr->sr_indication = 0; uci_pdu->sr->sr_indication = 0;
} }
...@@ -360,16 +383,19 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -360,16 +383,19 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
else if (pucch_pdu->bit_len_harq==1) { else if (pucch_pdu->bit_len_harq==1) {
uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq));
uci_pdu->harq->num_harq = 1; uci_pdu->harq->num_harq = 1;
uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0; uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0;
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
uci_pdu->harq->harq_list[0].harq_value = index&0x01; uci_pdu->harq->harq_list[0].harq_value = index&0x01;
LOG_I(PHY, "Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d n0 %d\n", LOG_I(PHY, "Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d n0 %d pucch0_thres %d\n",
slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dB,gNB->measurements.n0_power_tot_dB); slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dB,max_n0,uci_stats->pucch0_thres);
if (pucch_pdu->sr_flag == 1) { if (pucch_pdu->sr_flag == 1) {
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
uci_pdu->sr->sr_indication = (index>1) ? 1 : 0; uci_pdu->sr->sr_indication = (index>1) ? 1 : 0;
uci_pdu->sr->sr_confidence_level = (no_conf) ? 1 : 0; uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0;
uci_stats->pucch0_positive_SR++;
} }
uci_stats->pucch01_trials++;
} }
else { else {
uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq));
...@@ -1613,3 +1639,33 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ...@@ -1613,3 +1639,33 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
} }
} }
void dump_uci_stats(FILE *fd,PHY_VARS_gNB *gNB,int frame) {
int strpos=0;
char output[16384];
for (int i=0;i<NUMBER_OF_NR_UCI_STATS_MAX;i++){
if (gNB->uci_stats[i].rnti>0) {
NR_gNB_UCI_STATS_t *uci_stats = &gNB->uci_stats[i];
if (uci_stats->pucch0_sr_trials > 0)
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch0_sr_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_sr_thres %d dB, current pucch1_stat0 %d dB, current pucch1_stat1 %d dB, positive SR count %d\n",
i,uci_stats->rnti,uci_stats->pucch0_sr_trials,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_sr_thres,dB_fixed(uci_stats->current_pucch0_sr_stat0),dB_fixed(uci_stats->current_pucch0_sr_stat1),uci_stats->pucch0_positive_SR);
if (uci_stats->pucch01_trials > 0)
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current pucch0_stat0 %d dB, current pucch1_stat1 %d dB, pucch01_DTX %d\n",
i,uci_stats->rnti,uci_stats->pucch01_trials,uci_stats->pucch0_n01,uci_stats->pucch0_n01,uci_stats->pucch0_thres,dB_fixed(uci_stats->current_pucch0_stat0),dB_fixed(uci_stats->current_pucch0_stat1),uci_stats->pucch01_DTX);
if (uci_stats->pucch02_trials > 0)
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current pucch0_stat0 %d dB, current pucch0_stat1 %d dB, pucch01_DTX %d\n",
i,uci_stats->rnti,uci_stats->pucch02_trials,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,dB_fixed(uci_stats->current_pucch0_stat0),dB_fixed(uci_stats->current_pucch0_stat1),uci_stats->pucch02_DTX);
if (uci_stats->pucch2_trials > 0)
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch2_trials %d, pucch2_DTX %d\n",
i,uci_stats->rnti,
uci_stats->pucch2_trials,
uci_stats->pucch2_DTX);
}
}
if (fd) fprintf(fd,"%s",output);
else printf("%s",output);
}
...@@ -133,8 +133,31 @@ typedef struct { ...@@ -133,8 +133,31 @@ typedef struct {
int total_bytes_rx; int total_bytes_rx;
int current_Qm; int current_Qm;
int current_RI; int current_RI;
int power[NB_ANTENNAS_RX];
int noise_power[NB_ANTENNAS_RX];
} NR_gNB_SCH_STATS_t; } NR_gNB_SCH_STATS_t;
typedef struct {
int frame;
uint16_t rnti;
int pucch0_sr_trials;
int pucch0_sr_thres;
int current_pucch0_sr_stat0;
int current_pucch0_sr_stat1;
int pucch0_positive_SR;
int pucch01_trials;
int pucch0_n00;
int pucch0_n01;
int pucch0_thres;
int current_pucch0_stat0;
int current_pucch0_stat1;
int pucch01_DTX;
int pucch02_trials;
int pucch02_DTX;
int pucch2_trials;
int pucch2_DTX;
} NR_gNB_UCI_STATS_t;
typedef struct { typedef struct {
/// Pointers to variables related to DLSCH harq process /// Pointers to variables related to DLSCH harq process
NR_DL_gNB_HARQ_t harq_process; NR_DL_gNB_HARQ_t harq_process;
...@@ -465,7 +488,9 @@ typedef struct { ...@@ -465,7 +488,9 @@ typedef struct {
/// - second index: ? [0..168*N_RB_UL[ /// - second index: ? [0..168*N_RB_UL[
int32_t **ul_ch_magb1[8][8]; int32_t **ul_ch_magb1[8][8];
/// measured RX power based on DRS /// measured RX power based on DRS
int ulsch_power[2]; int ulsch_power[8];
/// measured RX noise power
int ulsch_noise_power[8];
/// \brief llr values. /// \brief llr values.
/// - first index: ? [0..1179743] (hard coded) /// - first index: ? [0..1179743] (hard coded)
int16_t *llr; int16_t *llr;
...@@ -562,8 +587,10 @@ typedef struct gNB_L1_proc_t_s { ...@@ -562,8 +587,10 @@ typedef struct gNB_L1_proc_t_s {
pthread_t pthread_single; pthread_t pthread_single;
/// pthread structure for asychronous RX/TX processing thread /// pthread structure for asychronous RX/TX processing thread
pthread_t pthread_asynch_rxtx; pthread_t pthread_asynch_rxtx;
/// pthread structure for printing time meas /// pthread structure for dumping L1 stats
pthread_t L1_stats_thread; pthread_t L1_stats_thread;
/// pthread structure for printing time meas
pthread_t process_stats_thread;
/// flag to indicate first RX acquisition /// flag to indicate first RX acquisition
int first_rx; int first_rx;
/// flag to indicate first TX transmission /// flag to indicate first TX transmission
...@@ -629,6 +656,8 @@ typedef struct { ...@@ -629,6 +656,8 @@ typedef struct {
unsigned short n0_subband_power[MAX_NUM_RU_PER_gNB][275]; unsigned short n0_subband_power[MAX_NUM_RU_PER_gNB][275];
//! estimated avg noise power per RB per RX ant (dB) //! estimated avg noise power per RB per RX ant (dB)
unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_gNB][275]; unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_gNB][275];
//! estimated avg subband noise power (dB)
unsigned short n0_subband_power_avg_dB;
//! estimated avg noise power per RB (dB) //! estimated avg noise power per RB (dB)
short n0_subband_power_tot_dB[275]; short n0_subband_power_tot_dB[275];
//! estimated avg noise power per RB (dBm) //! estimated avg noise power per RB (dBm)
...@@ -734,7 +763,7 @@ typedef struct PHY_VARS_gNB_s { ...@@ -734,7 +763,7 @@ typedef struct PHY_VARS_gNB_s {
NR_gNB_SCH_STATS_t dlsch_stats[NUMBER_OF_NR_SCH_STATS_MAX]; NR_gNB_SCH_STATS_t dlsch_stats[NUMBER_OF_NR_SCH_STATS_MAX];
/// statistics for ULSCH measurement collection /// statistics for ULSCH measurement collection
NR_gNB_SCH_STATS_t ulsch_stats[NUMBER_OF_NR_SCH_STATS_MAX]; NR_gNB_SCH_STATS_t ulsch_stats[NUMBER_OF_NR_SCH_STATS_MAX];
NR_gNB_UCI_STATS_t uci_stats[NUMBER_OF_NR_UCI_STATS_MAX];
t_nrPolar_params *uci_polarParams; t_nrPolar_params *uci_polarParams;
uint8_t pbch_configured; uint8_t pbch_configured;
...@@ -801,6 +830,7 @@ typedef struct PHY_VARS_gNB_s { ...@@ -801,6 +830,7 @@ typedef struct PHY_VARS_gNB_s {
int prach_energy_counter; int prach_energy_counter;
int pucch0_thres; int pucch0_thres;
int prach_thres;
uint64_t bad_pucch; uint64_t bad_pucch;
/* /*
time_stats_t phy_proc; time_stats_t phy_proc;
......
...@@ -122,7 +122,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { ...@@ -122,7 +122,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) {
gNB->prach_energy_counter); gNB->prach_energy_counter);
if ((gNB->prach_energy_counter == 100) && if ((gNB->prach_energy_counter == 100) &&
(max_preamble_energy[0] > gNB->measurements.prach_I0+100)) { (max_preamble_energy[0] > gNB->measurements.prach_I0+gNB->prach_thres)) {
LOG_I(PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d start symbol %u freq index %u\n", LOG_I(PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d start symbol %u freq index %u\n",
gNB->Mod_id, gNB->Mod_id,
......
...@@ -378,12 +378,12 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, ...@@ -378,12 +378,12 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
if (timing_advance_update < 0) timing_advance_update = 0; if (timing_advance_update < 0) timing_advance_update = 0;
if (timing_advance_update > 63) timing_advance_update = 63; if (timing_advance_update > 63) timing_advance_update = 63;
LOG_D(PHY, "Estimated timing advance PUSCH is = %d, timing_advance_update is %d \n", sync_pos,timing_advance_update); LOG_I(PHY, "Estimated timing advance PUSCH is = %d, timing_advance_update is %d \n", sync_pos,timing_advance_update);
// estimate UL_CQI for MAC (from antenna port 0 only) // estimate UL_CQI for MAC (from antenna port 0 only)
int SNRtimes10 = dB_fixed_times10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0]) - (10*gNB->measurements.n0_power_dB[0]); int SNRtimes10 = dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0]) - dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[0]);
LOG_D(PHY, "Estimated SNR for PUSCH is = %f dB (ulsch_power %f)\n", SNRtimes10/10,dB_fixed_times10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0])/10.0); LOG_I(PHY, "Estimated SNR for PUSCH is = %f dB (ulsch_power %f, noise %f)\n", SNRtimes10/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0])/10.0,dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[0])/10.0);
if (SNRtimes10 < -640) cqi=0; if (SNRtimes10 < -640) cqi=0;
else if (SNRtimes10 > 635) cqi=255; else if (SNRtimes10 > 635) cqi=255;
...@@ -533,7 +533,17 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -533,7 +533,17 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
if (gNB->frame_parms.frame_type == TDD) if (gNB->frame_parms.frame_type == TDD)
fill_ul_rb_mask(gNB, frame_rx, slot_rx); fill_ul_rb_mask(gNB, frame_rx, slot_rx);
gNB_I0_measurements(gNB); int first_symb=0,num_symb=0;
if (gNB->frame_parms.frame_type == TDD)
for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
if (gNB->gNB_config.tdd_table.max_tdd_periodicity_list[slot_rx].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1) {
if (num_symb==0) first_symb=symbol_count;
num_symb++;
}
}
else num_symb=14;
gNB_I0_measurements(gNB,first_symb,num_symb);
int offset = 10*gNB->frame_parms.ofdm_symbol_size + gNB->frame_parms.first_carrier_offset; int offset = 10*gNB->frame_parms.ofdm_symbol_size + gNB->frame_parms.first_carrier_offset;
int power_rxF = signal_energy_nodc(&gNB->common_vars.rxdataF[0][offset+(47*12)],12*18); int power_rxF = signal_energy_nodc(&gNB->common_vars.rxdataF[0][offset+(47*12)],12*18);
...@@ -561,6 +571,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -561,6 +571,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu_format0 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_0_1; nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu_format0 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_0_1;
nr_decode_pucch0(gNB, nr_decode_pucch0(gNB,
frame_rx,
slot_rx, slot_rx,
uci_pdu_format0, uci_pdu_format0,
pucch_pdu); pucch_pdu);
...@@ -663,11 +674,6 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -663,11 +674,6 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
} }
} }
// figure out a better way to choose slot_rx, 19 is ok for a particular TDD configuration with 30kHz SCS // figure out a better way to choose slot_rx, 19 is ok for a particular TDD configuration with 30kHz SCS
if ((frame_rx&127) == 0 && slot_rx==19) {
dump_pusch_stats(gNB);
LOG_I(PHY, "Number of bad PUCCH received: %lu\n", gNB->bad_pucch);
}
if (pucch_decode_done || pusch_decode_done) { if (pucch_decode_done || pusch_decode_done) {
T(T_GNB_PHY_PUCCH_PUSCH_IQ, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF[0][0], gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size * 4)); T(T_GNB_PHY_PUCCH_PUSCH_IQ, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF[0][0], gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size * 4));
} }
......
...@@ -90,6 +90,7 @@ ...@@ -90,6 +90,7 @@
#define NUMBER_OF_NR_DLSCH_MAX 2//16 #define NUMBER_OF_NR_DLSCH_MAX 2//16
#define NUMBER_OF_NR_ULSCH_MAX 2//16 #define NUMBER_OF_NR_ULSCH_MAX 2//16
#define NUMBER_OF_NR_SCH_STATS_MAX 16 #define NUMBER_OF_NR_SCH_STATS_MAX 16
#define NUMBER_OF_NR_UCI_STATS_MAX 16
#define NUMBER_OF_NR_PUCCH_MAX 16 #define NUMBER_OF_NR_PUCCH_MAX 16
#define NUMBER_OF_NR_SR_MAX 16 #define NUMBER_OF_NR_SR_MAX 16
#define NUMBER_OF_NR_PDCCH_MAX 16 #define NUMBER_OF_NR_PDCCH_MAX 16
......
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
#define CONFIG_STRING_L1_REMOTE_N_PORTD "remote_n_portd" #define CONFIG_STRING_L1_REMOTE_N_PORTD "remote_n_portd"
#define CONFIG_STRING_L1_TRANSPORT_N_PREFERENCE "tr_n_preference" #define CONFIG_STRING_L1_TRANSPORT_N_PREFERENCE "tr_n_preference"
#define CONFIG_STRING_L1_PUSCH_PROC_THREADS "pusch_proc_threads" #define CONFIG_STRING_L1_PUSCH_PROC_THREADS "pusch_proc_threads"
#define CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD "pucch0_dtx_threshold"
#define CONFIG_STRING_L1_PRACH_DTX_THRESHOLD "prach_dtx_threshold"
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------*/
/* L1 configuration parameters */ /* L1 configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
...@@ -62,7 +63,9 @@ ...@@ -62,7 +63,9 @@
{CONFIG_STRING_L1_REMOTE_N_PORTC, NULL, 0, uptr:NULL, defintval:50030, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_REMOTE_N_PORTC, NULL, 0, uptr:NULL, defintval:50030, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_LOCAL_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_LOCAL_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_REMOTE_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_REMOTE_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0} \ {CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_PUCCH0_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:100, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_PRACH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:200, TYPE_UINT, 0} \
} }
#define L1_CC_IDX 0 #define L1_CC_IDX 0
#define L1_TRANSPORT_N_PREFERENCE_IDX 1 #define L1_TRANSPORT_N_PREFERENCE_IDX 1
...@@ -74,6 +77,8 @@ ...@@ -74,6 +77,8 @@
#define L1_LOCAL_N_PORTD_IDX 7 #define L1_LOCAL_N_PORTD_IDX 7
#define L1_REMOTE_N_PORTD_IDX 8 #define L1_REMOTE_N_PORTD_IDX 8
#define L1_PUSCH_PROC_THREADS 9 #define L1_PUSCH_PROC_THREADS 9
#define L1_PUCCH0_DTX_THRESHOLD 10
#define L1_PRACH_DTX_THRESHOLD 11
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------*/
#endif #endif
...@@ -570,7 +570,8 @@ void RCconfig_NR_L1(void) { ...@@ -570,7 +570,8 @@ void RCconfig_NR_L1(void) {
} }
RC.gNB[j]->pusch_proc_threads = *(L1_ParamList.paramarray[j][L1_PUSCH_PROC_THREADS].uptr); RC.gNB[j]->pusch_proc_threads = *(L1_ParamList.paramarray[j][L1_PUSCH_PROC_THREADS].uptr);
RC.gNB[j]->pucch0_thres = *(L1_ParamList.paramarray[j][L1_PUCCH0_DTX_THRESHOLD].uptr);
RC.gNB[j]->prach_thres = *(L1_ParamList.paramarray[j][L1_PRACH_DTX_THRESHOLD].uptr);
if(strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) { if(strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
//sf_ahead = 2; // Need 4 subframe gap between RX and TX //sf_ahead = 2; // Need 4 subframe gap between RX and TX
}else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) { }else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
......
...@@ -1247,9 +1247,9 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, ...@@ -1247,9 +1247,9 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc,
case NR_UL_DCI_FORMAT_0_0: case NR_UL_DCI_FORMAT_0_0:
switch (rnti_type) { switch (rnti_type) {
case NR_RNTI_C: case NR_RNTI_C:
// indicating a DL DCI format 1bit // indicating a UL DCI format 1bit
pos=1; pos=1;
*dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 1) << (dci_size - pos); //*dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 1) << (dci_size - pos);
// Freq domain assignment max 16 bit // Freq domain assignment max 16 bit
fsize = (int)ceil(log2((N_RB * (N_RB + 1)) >> 1)); fsize = (int)ceil(log2((N_RB * (N_RB + 1)) >> 1));
pos+=fsize; pos+=fsize;
......
...@@ -969,6 +969,7 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, ...@@ -969,6 +969,7 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id,
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
// tpc (power control) // tpc (power control)
if (uci_01->harq->harq_confidence_level == 0)
sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10,
uci_01->ul_cqi, uci_01->ul_cqi,
30); 30);
......
...@@ -452,7 +452,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -452,7 +452,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
T_BUFFER(sduP, sdu_lenP)); T_BUFFER(sduP, sdu_lenP));
UE_info->mac_stats[UE_id].ulsch_total_bytes_rx += sdu_lenP; UE_info->mac_stats[UE_id].ulsch_total_bytes_rx += sdu_lenP;
LOG_D(NR_MAC, "[gNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu from PHY (rnti %x, UE_id %d) ul_cqi %d sduP %p\n", LOG_I(NR_MAC, "[gNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu from PHY (rnti %x, UE_id %d) ul_cqi %d TA %d sduP %p\n",
gnb_mod_idP, gnb_mod_idP,
harq_pid, harq_pid,
CC_idP, CC_idP,
...@@ -461,6 +461,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -461,6 +461,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
current_rnti, current_rnti,
UE_id, UE_id,
ul_cqi, ul_cqi,
timing_advance,
sduP); sduP);
// if not missed detection (10dB threshold for now) // if not missed detection (10dB threshold for now)
...@@ -1081,7 +1082,7 @@ void nr_schedule_ulsch(module_id_t module_id, ...@@ -1081,7 +1082,7 @@ void nr_schedule_ulsch(module_id_t module_id,
} }
UE_info->mac_stats[UE_id].ulsch_current_bytes = sched_pusch->tb_size; UE_info->mac_stats[UE_id].ulsch_current_bytes = sched_pusch->tb_size;
LOG_D(NR_MAC, LOG_I(NR_MAC,
"%4d.%2d RNTI %04x UL sched %4d.%2d start %d RBS %d MCS %d TBS %d HARQ PID %d round %d NDI %d\n", "%4d.%2d RNTI %04x UL sched %4d.%2d start %d RBS %d MCS %d TBS %d HARQ PID %d round %d NDI %d\n",
frame, frame,
slot, slot,
...@@ -1239,7 +1240,7 @@ void nr_schedule_ulsch(module_id_t module_id, ...@@ -1239,7 +1240,7 @@ void nr_schedule_ulsch(module_id_t module_id,
pdcch_pdu_bwp_coreset[bwpid][coresetid] = pdcch_pdu; pdcch_pdu_bwp_coreset[bwpid][coresetid] = pdcch_pdu;
} }
LOG_D(NR_MAC,"Configuring ULDCI/PDCCH in %d.%d\n", frame,slot); LOG_I(NR_MAC,"Configuring ULDCI/PDCCH in %d.%d\n", frame,slot);
/* Fill PDCCH DL DCI PDU */ /* Fill PDCCH DL DCI PDU */
nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci]; nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci];
......
...@@ -65,8 +65,9 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, ...@@ -65,8 +65,9 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity,
buffer[2]; buffer[2];
header_size = 3; header_size = 3;
} }
/* SRBs always have MAC-I, even if integrity is not active */
if (entity->has_integrity) { if (entity->has_integrity
|| entity->type == NR_PDCP_SRB) {
integrity_size = 4; integrity_size = 4;
} else { } else {
integrity_size = 0; integrity_size = 0;
...@@ -181,7 +182,9 @@ static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity, ...@@ -181,7 +182,9 @@ static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity,
header_size = 3; header_size = 3;
} }
if (entity->has_integrity) { /* SRBs always have MAC-I, even if integrity is not active */
if (entity->has_integrity
|| entity->type == NR_PDCP_SRB) {
integrity_size = 4; integrity_size = 4;
} else { } else {
integrity_size = 0; integrity_size = 0;
...@@ -194,6 +197,9 @@ static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity, ...@@ -194,6 +197,9 @@ static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity,
(unsigned char *)buf + header_size + size, (unsigned char *)buf + header_size + size,
(unsigned char *)buf, header_size + size, (unsigned char *)buf, header_size + size,
entity->rb_id, count, entity->is_gnb ? 1 : 0); entity->rb_id, count, entity->is_gnb ? 1 : 0);
else if (integrity_size == 4)
/* set MAC-I to 0 for SRBs with integrity not active */
memset(buf + header_size + size, 0, 4);
if (entity->has_ciphering) if (entity->has_ciphering)
entity->cipher(entity->security_context, entity->cipher(entity->security_context,
......
...@@ -1151,7 +1151,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti, ...@@ -1151,7 +1151,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti,
physicalCellGroupConfig = calloc(1,sizeof(*physicalCellGroupConfig)); physicalCellGroupConfig = calloc(1,sizeof(*physicalCellGroupConfig));
physicalCellGroupConfig->p_NR_FR1 = calloc(1,sizeof(*physicalCellGroupConfig->p_NR_FR1)); physicalCellGroupConfig->p_NR_FR1 = calloc(1,sizeof(*physicalCellGroupConfig->p_NR_FR1));
*physicalCellGroupConfig->p_NR_FR1 = 0; *physicalCellGroupConfig->p_NR_FR1 = 20;
physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook = NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic; physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook = NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic;
cellGroupConfig->physicalCellGroupConfig = physicalCellGroupConfig; cellGroupConfig->physicalCellGroupConfig = physicalCellGroupConfig;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment