diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 5e690b3f7c..3fcc37f6bd 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -762,7 +762,8 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id, phy_vars_ue->dlsch_received_last[eNB_id]=0; phy_vars_ue->dlsch_fer[eNB_id]=0; - + phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1; + phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1; if (physicalConfigDedicated) { LOG_D(PHY,"[UE %d] Received physicalConfigDedicated from eNB %d\n",Mod_id, eNB_id); @@ -894,6 +895,31 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id, } + if (physicalConfigDedicated->cqi_ReportConfig) { + if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic) { + // configure PUSCH CQI reporting + phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic; + if ((phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm12) && + (phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm30) && + (phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm31)) + LOG_E(PHY,"Unsupported Aperiodic CQI Feedback Mode : %d\n",phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic); + } + if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) { + if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_setup) { + // configure PUCCH CQI reporting + phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex; + phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex; + if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex) + phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex; + } + else if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_release) { + // handle release + phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1; + phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1; + } + } + } + #ifdef CBA if (physicalConfigDedicated->pusch_CBAConfigDedicated_vlola) { @@ -910,6 +936,9 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id, return; } + // fill cqi parameters for periodic CQI reporting + get_cqipmiri_params(phy_vars_ue,eNB_id); + } void phy_config_cba_rnti (module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uint8_t index, rnti_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c b/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c index 6ebd8948cf..d713cc0163 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c @@ -102,7 +102,7 @@ int lte_est_freq_offset(int **dl_ch_estimates, { int ch_offset, omega, dl_ch_shift; - struct complex16 *omega_cpx; + struct complex16 omega_cpx; double phase_offset; int freq_offset_est; unsigned char aa; @@ -142,9 +142,8 @@ int lte_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*) ω - - // printf("omega (%d,%d)\n",omega_cpx->r,omega_cpx->i); + omega_cpx.r = ((struct complex16*) &omega)->r; + omega_cpx.i = ((struct complex16*) &omega)->i; dl_ch = (int16_t *)&dl_ch_estimates[aa][(((frame_parms->N_RB_DL/2) + 1)*12) + ch_offset]; @@ -155,10 +154,12 @@ 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 += ((struct complex16*) &omega)->r; + omega_cpx.i += ((struct complex16*) &omega)->i; + // phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r); - phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r); + phase_offset += atan2((double)omega_cpx.i,(double)omega_cpx.r); // LOG_I(PHY,"omega (%d,%d) -> %f\n",omega_cpx->r,omega_cpx->i,phase_offset); } diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index aa2daf8ebb..3624d67af1 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -1260,6 +1260,11 @@ int generate_eNB_dlsch_params_from_dci(int frame, dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][NPRB-1]; } + else + { + LOG_E(PHY,"DL Received HarqReTx round=%d mcs=%d rballoc=%d rv=%d \n", + dlsch0_harq->round,mcs,rballoc,rv); + } dlsch[0]->current_harq_pid = harq_pid; @@ -4143,6 +4148,20 @@ int generate_ue_dlsch_params_from_dci(int frame, dlsch0_harq->DCINdi = ndi; + // this a retransmission + if(dlsch0_harq->round) + { + // compare old TBS to new TBS + if(dlsch0_harq->TBS != TBStable[get_I_TBS(mcs)][NPRB-1]) + { + // this is an eNB issue + // retransmisison but old and new TBS are different !!! + // work around, consider it as a new transmission + LOG_E(PHY,"Format1A Retransmission but TBS are different: consider it as new transmission !!! \n"); + dlsch0_harq->round = 0; + } + } + dlsch0_harq->mcs = mcs; if ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti)) { dlsch0_harq->TBS = TBStable[mcs][NPRB-1]; @@ -4452,6 +4471,20 @@ int generate_ue_dlsch_params_from_dci(int frame, dlsch0_harq->mcs = mcs; + // this a retransmission + if(dlsch0_harq->round) + { + // compare old TBS to new TBS + if(dlsch0_harq->TBS != TBStable[get_I_TBS(mcs)][NPRB-1]) + { + // this is an eNB issue + // retransmisison but old and new TBS are different !!! + // work around, consider it as a new transmission + LOG_E(PHY,"Format1 Retransmission but TBS are different: consider it as new transmission !!! \n"); + dlsch0_harq->round = 0; + } + } + dlsch0_harq->TBS = TBStable[get_I_TBS(mcs)][NPRB-1]; if (mcs <= 28) dlsch0_harq->Qm = get_Qm(mcs); diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c index f4ab4c0924..c7cd5ab52f 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c @@ -249,7 +249,12 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, tc = phy_threegpplte_turbo_decoder16; } else - tc = phy_threegpplte_turbo_decoder8; + { + AssertFatal (harq_process->TBS >= 256 , "Mismatch flag nbRB=%d TBS=%d mcs=%d Qm=%d RIV=%d round=%d \n", + harq_process->nb_rb, harq_process->TBS,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round); + tc = phy_threegpplte_turbo_decoder8; + } + // nb_rb = dlsch->nb_rb; @@ -448,6 +453,11 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, #if 1 if (err_flag == 0) { + if (llr8_flag) { + AssertFatal (Kr >= 256, "turbo algo issue Kr=%d cb_cnt=%d C=%d nbRB=%d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d\n", + Kr,r,harq_process->C,harq_process->nb_rb,A,harq_process->TBS,harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round); + } + start_meas(dlsch_turbo_decoding_stats); ret = tc (&harq_process->d[r][96], diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c index 661fe96be8..91374078c0 100644 --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c @@ -462,6 +462,13 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) } } + /* Consider this is a false detection if the offset is > 1000 Hz */ + if( (abs(ue->common_vars.freq_offset) > 1000) && (ret == 0) ) + { + ret=-1; + LOG_E(HW,"Ignore MIB with high freq offset [%d Hz] estimation \n",ue->common_vars.freq_offset); + } + if (ret==0) { // PBCH found so indicate sync to higher layers and configure frame parameters //#ifdef DEBUG_INITIAL_SYNCH diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 86bc3723af..90971e4a84 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -1445,6 +1445,9 @@ int32_t generate_ue_ulsch_params_from_rar(PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id); double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id); + +uint8_t sinr2cqi(double sinr,uint8_t trans_mode); + int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB, eNB_rxtx_proc_t *proc, void *dci_pdu, @@ -1712,6 +1715,20 @@ void generate_pucch1x(int32_t **txdataF, int16_t amp, uint8_t subframe); +void generate_pucch2x(int32_t **txdataF, + LTE_DL_FRAME_PARMS *fp, + uint8_t ncs_cell[20][7], + PUCCH_FMT_t fmt, + PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, + uint16_t n2_pucch, + uint16_t *payload, + int A, + int B2, + int16_t amp, + uint8_t subframe, + uint16_t rnti); + + void generate_pucch_emul(PHY_VARS_UE *phy_vars_ue, UE_rxtx_proc_t *proc, PUCCH_FMT_t format, diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index c0c54b9782..34e64dfd5f 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -442,7 +442,7 @@ inline void pucch2x_scrambling(LTE_DL_FRAME_PARMS *fp,int subframe,uint16_t rnti int i; uint8_t c; - x2 = (rnti<<14) + ((1+subframe)<<16)*(1+(fp->Nid_cell<<1)); //this is c_init in 36.211 Sec 6.3.1 + x2 = (rnti) + ((uint32_t)(1+subframe)<<16)*(1+(fp->Nid_cell<<1)); //this is c_init in 36.211 Sec 6.3.1 s = lte_gold_generic(&x1, &x2, 1); for (i=0;i<19;i++) { c = (uint8_t)((s>>i)&1); @@ -456,22 +456,24 @@ inline void pucch2x_modulation(uint8_t *btilde,int16_t *d,int16_t amp) { int i; for (i=0;i<20;i++) - d[i] = btilde[i] == 1 ? amp : -amp; + d[i] = btilde[i] == 1 ? -amp : amp; } + + uint32_t pucch_code[13] = {0xFFFFF,0x5A933,0x10E5A,0x6339C,0x73CE0, 0xFFC00,0xD8E64,0x4F6B0,0x218EC,0x1B746, 0x0FFFF,0x33FFF,0x3FFFC}; + void generate_pucch2x(int32_t **txdataF, LTE_DL_FRAME_PARMS *fp, uint8_t ncs_cell[20][7], PUCCH_FMT_t fmt, PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, uint16_t n2_pucch, - uint8_t shortened_format, - uint32_t *payload, + uint16_t *payload, int A, int B2, int16_t amp, @@ -486,13 +488,14 @@ void generate_pucch2x(int32_t **txdataF, uint8_t NRB2 = fp->pucch_config_common.nRB_CQI; uint8_t Ncs1 = fp->pucch_config_common.nCS_AN; - uint32_t u0 = (fp->Nid_cell + fp->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30; - uint32_t u1 = (fp->Nid_cell + fp->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30; - uint32_t v0=fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1]; - uint32_t v1=fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; + uint32_t u0 = fp->pucch_config_common.grouphop[subframe<<1]; + uint32_t u1 = fp->pucch_config_common.grouphop[1+(subframe<<1)]; + uint32_t v0 = fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1]; + uint32_t v1 = fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; + uint32_t z[12*14],*zptr; uint32_t u,v,n; - uint8_t ns,N_UL_symb,nsymb; + uint8_t ns,N_UL_symb,nsymb_slot0,nsymb_pertti; uint32_t nprime,l,n_cs; int alpha_ind,data_ind; int16_t ref_re,ref_im; @@ -509,7 +512,6 @@ void generate_pucch2x(int32_t **txdataF, return; } - // pucch2x_encoding for (i=0;i 0) @@ -545,66 +547,72 @@ void generate_pucch2x(int32_t **txdataF, } } - zptr = z; #ifdef DEBUG_PUCCH_TX printf("[PHY] PUCCH2x: n2_pucch %d\n",n2_pucch); #endif N_UL_symb = (fp->Ncp==0) ? 7 : 6; - + data_ind = 0; + zptr = z; for (ns=(subframe<<1),u=u0,v=v0; ns<(2+(subframe<<1)); ns++,u=u1,v=v1) { if ((ns&1) == 0) - nprime = (n2_pucch < 12*NRB2) ? - n2_pucch % 12 : - (n2_pucch+Ncs1 + 1)%12; - else - nprime = (n2_pucch < 12*NRB2) ? - ((12*(nprime+1)) % 13)-1 : - (10-n2_pucch)%12; - + nprime = (n2_pucch < 12*NRB2) ? + n2_pucch % 12 : + (n2_pucch+Ncs1 + 1)%12; + else { + nprime = (n2_pucch < 12*NRB2) ? + ((12*(nprime+1)) % 13)-1 : + (10-n2_pucch)%12; + } //loop over symbols in slot for (l=0; l>15); + ref_im = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)] + (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][n<<1])>>15); - // this is r_uv^alpha(n) - ref_re = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][n<<1] - (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)])>>15); - ref_im = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)] + (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][n<<1])>>15); - - if ((l<2)||(l>=(N_UL_symb-2))) { //these are PUCCH data symbols - ((int16_t *)&zptr[n])[0] = ((int32_t)d[data_ind]*ref_re - (int32_t)d[data_ind+1]*ref_im)>>15; - ((int16_t *)&zptr[n])[1] = ((int32_t)d[data_ind]*ref_im + (int32_t)d[data_ind+1]*ref_re)>>15; - } - else { - ((int16_t *)&zptr[n])[0] = ref_re; - ((int16_t *)&zptr[n])[1] = ref_im; - } - + if ((l!=1)&&(l!=5)) { //these are PUCCH data symbols + ((int16_t *)&zptr[n])[0] = ((int32_t)d[data_ind]*ref_re - (int32_t)d[data_ind+1]*ref_im)>>15; + ((int16_t *)&zptr[n])[1] = ((int32_t)d[data_ind]*ref_im + (int32_t)d[data_ind+1]*ref_re)>>15; + //LOG_I(PHY,"slot %d ofdm# %d ==> d[%d,%d] \n",ns,l,data_ind,n); + } + else { + ((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_re>>15); + ((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_im>>15); + //LOG_I(PHY,"slot %d ofdm# %d ==> dmrs[%d] \n",ns,l,n); + } + alpha_ind = (alpha_ind + n_cs)%12; } // n - if ((l<2)||(l>=(N_UL_symb-2))) //these are PUCCH data symbols so increment data index - data_ind+=2; + zptr+=12; + + if ((l!=1)&&(l!=5)) //these are PUCCH data symbols so increment data index + data_ind+=2; } // l } //ns m = n2_pucch/12; #ifdef DEBUG_PUCCH_TX - printf("[PHY] PUCCH: m %d\n",m); + LOG_D(PHY,"[PHY] PUCCH: n2_pucch %d m %d\n",n2_pucch,m); #endif - nsymb = N_UL_symb<<1; + + nsymb_slot0 = ((fp->Ncp==0) ? 7 : 6); + nsymb_pertti = nsymb_slot0 << 1; + + //nsymb = nsymb_slot0<<1; //for (j=0,l=0;l<(nsymb-1);l++) { - for (j=0,l=0; l<(nsymb); l++) { - if ((l<(nsymb>>1)) && ((m&1) == 0)) + for (j=0,l=0; l<(nsymb_pertti); l++) { + + if ((lfirst_carrier_offset; - else if ((l<(nsymb>>1)) && ((m&1) == 1)) + else if ((lfirst_carrier_offset + (fp->N_RB_DL - (m>>1) - 1)*12; else if ((m&1) == 0) re_offset = fp->first_carrier_offset + (fp->N_RB_DL - (m>>1) - 1)*12; @@ -614,23 +622,33 @@ void generate_pucch2x(int32_t **txdataF, if (re_offset > fp->ofdm_symbol_size) re_offset -= (fp->ofdm_symbol_size); - symbol_offset = (unsigned int)fp->ofdm_symbol_size*(l+(subframe*nsymb)); + + + symbol_offset = (unsigned int)fp->ofdm_symbol_size*(l+(subframe*nsymb_pertti)); txptr = &txdataF[0][symbol_offset]; + //LOG_I(PHY,"ofdmSymb %d/%d, firstCarrierOffset %d, symbolOffset[sfn %d] %d, reOffset %d, &txptr: %x \n", l, nsymb, fp->first_carrier_offset, subframe, symbol_offset, re_offset, &txptr[0]); + for (i=0; i<12; i++,j++) { - txptr[re_offset++] = z[j]; + txptr[re_offset] = z[j]; + + re_offset++; if (re_offset==fp->ofdm_symbol_size) - re_offset = 0; + re_offset -= (fp->ofdm_symbol_size); #ifdef DEBUG_PUCCH_TX - printf("[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]); + LOG_D(PHY,"[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]); #endif } } } +//#define Amax 13 +//void init_pucch2x_rx() {}; + + uint32_t rx_pucch(PHY_VARS_eNB *eNB, PUCCH_FMT_t fmt, uint8_t UE_id, diff --git a/openair1/PHY/LTE_TRANSPORT/uci_tools.c b/openair1/PHY/LTE_TRANSPORT/uci_tools.c index a8f9f6ba57..37c5dc1432 100644 --- a/openair1/PHY/LTE_TRANSPORT/uci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/uci_tools.c @@ -836,3 +836,5 @@ void print_CQI(void *o,UCI_format_t uci_format,unsigned char eNB_id,int N_RB_DL) } + + diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index 64db760acc..9005518e7b 100644 --- a/openair1/PHY/impl_defs_lte.h +++ b/openair1/PHY/impl_defs_lte.h @@ -429,16 +429,20 @@ typedef struct { /// CQI-ReportPeriodic typedef struct { - /// Parameter: \f$n^{(2)}_\text{PUCCH}\f$, see TS 36.213 (7.2). \vr{[0..1185]} - uint16_t cqi_PUCCH_ResourceIndex; + /// Parameter: \f$n^{(2)}_\text{PUCCH}\f$, see TS 36.213 (7.2). \vr{[0..1185]}, -1 indicates inactivity + int16_t cqi_PUCCH_ResourceIndex; /// Parameter: CQI/PMI Periodicity and Offset Configuration Index \f$I_\text{CQI/PMI}\f$, see TS 36.213 (tables 7.2.2-1A and 7.2.2-1C). \vr{[0..1023]} - uint16_t cqi_PMI_ConfigIndex; + int16_t cqi_PMI_ConfigIndex; /// Parameter: K, see 36.213 (4.2.2). \vr{[1..4]} uint8_t K; - /// Parameter: RI Config Index \f$I_\text{RI}\f$, see TS 36.213 (7.2.2-1B). \vr{[0..1023]} - uint16_t ri_ConfigIndex; + /// Parameter: RI Config Index \f$I_\text{RI}\f$, see TS 36.213 (7.2.2-1B). \vr{[0..1023]}, -1 indicates inactivity + int16_t ri_ConfigIndex; /// Parameter: Simultaneous-AN-and-CQI, see TS 36.213 (10.1). \vr{[0..1]} 1 indicates that simultaneous transmission of ACK/NACK and CQI is allowed. uint8_t simultaneousAckNackAndCQI; + /// parameter computed from Tables 7.2.2-1A and 7.2.2-1C + uint16_t Npd; + /// parameter computed from Tables 7.2.2-1A and 7.2.2-1C + uint16_t N_OFFSET_CQI; } CQI_REPORTPERIODIC; /// Enumeration for parameter reporting mode \ref CQI_REPORT_CONFIG::cqi_ReportModeAperiodic. diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/defs.h index 6f0900c5b1..a9031ac443 100644 --- a/openair1/SCHED/defs.h +++ b/openair1/SCHED/defs.h @@ -446,6 +446,8 @@ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_ */ void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t *pnb_rb_srs, uint8_t abstraction_flag); +void get_cqipmiri_params(PHY_VARS_UE *ue,uint8_t eNB_id); + int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id, uint8_t eNB_index); #ifdef LOCALIZATION @@ -461,6 +463,8 @@ double aggregate_eNB_UE_localization_stats(PHY_VARS_eNB *phy_vars_eNB, int8_t UE #endif LTE_eNB_UE_stats* get_UE_stats(uint8_t Mod_id, uint8_t CC_id,uint16_t rnti); + + LTE_DL_FRAME_PARMS *get_lte_frame_parms(module_id_t Mod_id, uint8_t CC_id); MU_MIMO_mode* get_mu_mimo_mode (module_id_t Mod_id, uint8_t CC_id, rnti_t rnti); diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index e5fac38a52..55e7686462 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -377,6 +377,43 @@ uint8_t is_SR_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) return(0); } +uint8_t is_cqi_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) +{ + int subframe = proc->subframe_tx; + int frame = proc->frame_tx; + CQI_REPORTPERIODIC *cqirep = &ue->cqi_report_config[eNB_id].CQI_ReportPeriodic; + + //LOG_I(PHY,"[UE %d][CRNTI %x] AbsSubFrame %d.%d Checking for CQI TXOp (cqi_ConfigIndex %d) isCQIOp %d\n", + // ue->Mod_id,ue->pdcch_vars[eNB_id]->crnti,frame,subframe, + // cqirep->cqi_PMI_ConfigIndex, + // (((10*frame + subframe) % cqirep->Npd) == cqirep->N_OFFSET_CQI)); + + if (((10*frame + subframe) % cqirep->Npd) == cqirep->N_OFFSET_CQI) + return(1); + else + return(0); +} +uint8_t is_ri_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) +{ + + + int subframe = proc->subframe_tx; + int frame = proc->frame_tx; + CQI_REPORTPERIODIC *cqirep = &ue->cqi_report_config[eNB_id].CQI_ReportPeriodic; + int log2Mri = cqirep->ri_ConfigIndex/161; + int N_OFFSET_RI = cqirep->ri_ConfigIndex % 161; + + //LOG_I(PHY,"[UE %d][CRNTI %x] AbsSubFrame %d.%d Checking for RI TXOp (ri_ConfigIndex %d) isRIOp %d\n", + // ue->Mod_id,ue->pdcch_vars[eNB_id]->crnti,frame,subframe, + // cqirep->ri_ConfigIndex, + // (((10*frame + subframe + cqirep->N_OFFSET_CQI - N_OFFSET_RI) % (cqirep->Npd<N_OFFSET_CQI - N_OFFSET_RI) % (cqirep->Npd<subframe_tx; uint8_t isSubframeSRS = 0; // SRS Cell Occasion + uint8_t is_pucch2_subframe = 0; + uint8_t is_sr_an_subframe = 0; + SOUNDINGRS_UL_CONFIG_DEDICATED *pSoundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; // check for SRS opportunity @@ -533,30 +573,149 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id LOG_D(PHY," SrsDedicatedSetup: %d \n",pSoundingrs_ul_config_dedicated->srsConfigDedicatedSetup); if(pSoundingrs_ul_config_dedicated->srsConfigDedicatedSetup) { - compute_srs_pos(frame_parms->frame_type, pSoundingrs_ul_config_dedicated->srs_ConfigIndex, &srsPeriodicity, &srsOffset); + compute_srs_pos(frame_parms->frame_type, pSoundingrs_ul_config_dedicated->srs_ConfigIndex, &srsPeriodicity, &srsOffset); - LOG_D(PHY," srsPeriodicity: %d srsOffset: %d isSubframeSRS %d \n",srsPeriodicity,srsOffset,isSubframeSRS); + LOG_D(PHY," srsPeriodicity: %d srsOffset: %d isSubframeSRS %d \n",srsPeriodicity,srsOffset,isSubframeSRS); - // transmit SRS if the four following constraints are respected: - // - UE is configured to transmit SRS - // - SRS are configured in current subframe - // - UE is configured to send SRS in this subframe - // - CQI is not scheduled in PUCCH transmission - TO BE ADDED - // - simultaneous transmission of SRS and ACKNACK is authorised - TO BE CHECKED - if( isSubframeSRS && - (((10*frame_tx+subframe_tx) % srsPeriodicity) == srsOffset) - //(! is_pucch_per_cqi_report)) - ) - { - pSoundingrs_ul_config_dedicated->srsUeSubframe = 1; - ue->ulsch[eNB_id]->srs_active = 1; - ue->ulsch[eNB_id]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)- ue->ulsch[eNB_id]->srs_active; - } + // transmit SRS if the four following constraints are respected: + // - UE is configured to transmit SRS + // - SRS are configured in current subframe + // - UE is configured to send SRS in this subframe + + // 36.213 8.2 + // 1- A UE shall not transmit SRS whenever SRS and PUCCH format 2/2a/2b transmissions happen to coincide in the same subframe + // 2- A UE shall not transmit SRS whenever SRS transmit + // on and PUCCH transmission carrying ACK/NACK and/or + // positive SR happen to coincide in the same subframe if the parameter + // Simultaneous-AN-and-SRS is FALSE + + // check PUCCH format 2/2a/2b transmissions + is_pucch2_subframe = is_cqi_TXOp(ue,proc,eNB_id) && (ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0); + is_pucch2_subframe = (is_ri_TXOp(ue,proc,eNB_id) && (ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0)) || is_pucch2_subframe; + + // check ACK/SR transmission + if(frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission == FALSE) + { + if(is_SR_TXOp(ue,proc,eNB_id)) + { + uint32_t SR_payload = 0; + if (ue->mac_enabled==1) + { + int Mod_id = ue->Mod_id; + int CC_id = ue->CC_id; + SR_payload = mac_xface->ue_get_SR(Mod_id, + CC_id, + frame_tx, + eNB_id, + ue->pdcch_vars[eNB_id]->crnti, + subframe_tx); // subframe used for meas gap + + if (SR_payload > 0) + is_sr_an_subframe = 1; + } + } + + uint8_t pucch_ack_payload[2]; + if (get_ack(&ue->frame_parms, + ue->dlsch[eNB_id][0]->harq_ack, + subframe_tx,pucch_ack_payload) > 0) + { + is_sr_an_subframe = 1; + } + } + + // check SRS UE opportunity + if( isSubframeSRS && + (((10*frame_tx+subframe_tx) % srsPeriodicity) == srsOffset) + ) + { + if ((is_pucch2_subframe == 0) && (is_sr_an_subframe == 0)) + { + pSoundingrs_ul_config_dedicated->srsUeSubframe = 1; + ue->ulsch[eNB_id]->srs_active = 1; + ue->ulsch[eNB_id]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)- ue->ulsch[eNB_id]->srs_active; + } + else + { + LOG_I(PHY,"DROP UE-SRS-TX for this subframe %d.%d: collision with PUCCH2 or SR/AN: PUCCH2-occasion: %d, SR-AN-occasion[simSRS-SR-AN %d]: %d \n", frame_tx, subframe_tx, is_pucch2_subframe, frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, is_sr_an_subframe); + } + } } LOG_D(PHY," srsCellSubframe: %d, srsUeSubframe: %d, Nsymb-pusch: %d \n", pSoundingrs_ul_config_dedicated->srsCellSubframe, pSoundingrs_ul_config_dedicated->srsUeSubframe, ue->ulsch[eNB_id]->Nsymb_pusch); } } +void get_cqipmiri_params(PHY_VARS_UE *ue,uint8_t eNB_id) +{ + + CQI_REPORTPERIODIC *cqirep = &ue->cqi_report_config[eNB_id].CQI_ReportPeriodic; + int cqi_PMI_ConfigIndex = cqirep->cqi_PMI_ConfigIndex; + + if (ue->frame_parms.frame_type == FDD) { + if (cqi_PMI_ConfigIndex <= 1) { // 2 ms CQI_PMI period + cqirep->Npd = 2; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex; + } else if (cqi_PMI_ConfigIndex <= 6) { // 5 ms CQI_PMI period + cqirep->Npd = 5; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-2; + } else if (cqi_PMI_ConfigIndex <=16) { // 10ms CQI_PMI period + cqirep->Npd = 10; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-7; + } else if (cqi_PMI_ConfigIndex <= 36) { // 20 ms CQI_PMI period + cqirep->Npd = 20; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-17; + } else if (cqi_PMI_ConfigIndex <= 76) { // 40 ms CQI_PMI period + cqirep->Npd = 40; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-37; + } else if (cqi_PMI_ConfigIndex <= 156) { // 80 ms CQI_PMI period + cqirep->Npd = 80; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-77; + } else if (cqi_PMI_ConfigIndex <= 316) { // 160 ms CQI_PMI period + cqirep->Npd = 160; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-157; + } + else if (cqi_PMI_ConfigIndex > 317) { + + if (cqi_PMI_ConfigIndex <= 349) { // 32 ms CQI_PMI period + cqirep->Npd = 32; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-318; + } + else if (cqi_PMI_ConfigIndex <= 413) { // 64 ms CQI_PMI period + cqirep->Npd = 64; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-350; + } + else if (cqi_PMI_ConfigIndex <= 541) { // 128 ms CQI_PMI period + cqirep->Npd = 128; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-414; + } + } + } + else { // TDD + if (cqi_PMI_ConfigIndex == 0) { // all UL subframes + cqirep->Npd = 1; + cqirep->N_OFFSET_CQI = 0; + } else if (cqi_PMI_ConfigIndex <= 6) { // 5 ms CQI_PMI period + cqirep->Npd = 5; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-1; + } else if (cqi_PMI_ConfigIndex <=16) { // 10ms CQI_PMI period + cqirep->Npd = 10; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-6; + } else if (cqi_PMI_ConfigIndex <= 36) { // 20 ms CQI_PMI period + cqirep->Npd = 20; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-16; + } else if (cqi_PMI_ConfigIndex <= 76) { // 40 ms CQI_PMI period + cqirep->Npd = 40; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-36; + } else if (cqi_PMI_ConfigIndex <= 156) { // 80 ms CQI_PMI period + cqirep->Npd = 80; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-76; + } else if (cqi_PMI_ConfigIndex <= 316) { // 160 ms CQI_PMI period + cqirep->Npd = 160; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-156; + } + } +} + uint16_t get_n1_pucch(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t eNB_id, @@ -1309,14 +1468,42 @@ void ue_srs_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8 } } +int16_t get_pucch2_cqi(PHY_VARS_UE *ue,int eNB_id,int *len) { + + if ((ue->transmission_mode[eNB_id]<4)|| + (ue->transmission_mode[eNB_id]==7)) { // Mode 1-0 feedback + // 4-bit CQI message + *len=4; + return(sinr2cqi((double)ue->measurements.wideband_cqi_avg[eNB_id], + ue->transmission_mode[eNB_id])); + } + else { // Mode 1-1 feedback, later + *len=0; + // 2-antenna ports RI=1, 6 bits (2 PMI, 4 CQI) + + // 2-antenna ports RI=2, 8 bits (1 PMI, 7 CQI/DIFF CQI) + return(0); + } +} + + +int16_t get_pucch2_ri(PHY_VARS_UE *ue,int eNB_id) { + + return(1); +} + void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag) { uint8_t pucch_ack_payload[2]; - uint8_t n1_pucch; + uint8_t n1_pucch,n2_pucch; ANFBmode_t bundling_flag; PUCCH_FMT_t format; + uint8_t SR_payload; + uint16_t CQI_payload; + uint16_t RI_payload; + LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; int frame_tx=proc->frame_tx; int subframe_tx=proc->subframe_tx; @@ -1326,6 +1513,12 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin int8_t Po_PUCCH; SOUNDINGRS_UL_CONFIG_DEDICATED *pSoundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; + + // 36.213 8.2 + /*if ackNackSRS_SimultaneousTransmission == TRUE and in the cell specific SRS subframes UE shall transmit + ACK/NACK and SR using the shortened PUCCH format. This shortened PUCCH format shall be used in a cell + specific SRS subframe even if the UE does not transmit SRS in that subframe + */ uint8_t isShortenPucch = (pSoundingrs_ul_config_dedicated->srsCellSubframe && frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission); bundling_flag = ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode; @@ -1447,7 +1640,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin #endif } } else if (SR_payload==1) { // no ACK/NAK but SR is triggered by MAC - + if (ue->mac_enabled == 1) { Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,pucch_format1); } @@ -1497,6 +1690,111 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin } } // SR_Payload==1 + + // PUCCH 2x + + if (ue->generate_ul_signal[eNB_id] == 0) { // we have not generated ACK/NAK/SR in this subframe + + n2_pucch = ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex; + // only use format2 for now, i.e. now ACK/NAK - CQI multiplexing + format = pucch_format2; + + // Periodic CQI report + if ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0)&& + (is_cqi_TXOp(ue,proc,eNB_id)==1)){ + + if (ue->mac_enabled == 1) { + Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format); + } + else { + Po_PUCCH = ue->tx_power_max_dBm; + } + ue->tx_power_dBm[subframe_tx] = Po_PUCCH; + ue->tx_total_RE[subframe_tx] = 12; + +#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) + tx_amp = get_tx_amp(Po_PUCCH, + ue->tx_power_max_dBm, + ue->frame_parms.N_RB_UL, + 1); +#else + tx_amp = AMP; +#endif + LOG_D(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (CQI), n2_pucch %d, Po_PUCCH %d, isShortenPucch %d, amp %d\n", + Mod_id, + ue->dlsch[eNB_id][0]->rnti, + frame_tx, subframe_tx, + n2_pucch, + Po_PUCCH, + isShortenPucch, + tx_amp); + + int len; + // get the payload : < 12 bits, returned in len + CQI_payload = get_pucch2_cqi(ue,eNB_id,&len); + generate_pucch2x(ue->common_vars.txdataF, + &ue->frame_parms, + ue->ncs_cell, + format, + &ue->pucch_config_dedicated[eNB_id], + n2_pucch, + &CQI_payload, + len, // A + 0, // B2 not needed + tx_amp, + subframe_tx, + ue->pdcch_vars[eNB_id]->crnti); + + ue->generate_ul_signal[eNB_id] = 1; + } + // Periodic RI report + else if ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) && + (is_ri_TXOp(ue,proc,eNB_id)==1)){ + + if (ue->mac_enabled == 1) { + Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format); + } + else { + Po_PUCCH = ue->tx_power_max_dBm; + } + ue->tx_power_dBm[subframe_tx] = Po_PUCCH; + ue->tx_total_RE[subframe_tx] = 12; + +#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) + tx_amp = get_tx_amp(Po_PUCCH, + ue->tx_power_max_dBm, + ue->frame_parms.N_RB_UL, + 1); +#else + tx_amp = AMP; +#endif + LOG_D(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (RI), n2_pucch %d, Po_PUCCH %d, isShortenPucch %d, amp %d\n", + Mod_id, + ue->dlsch[eNB_id][0]->rnti, + frame_tx, subframe_tx, + n2_pucch, + Po_PUCCH, + isShortenPucch, + tx_amp); + + RI_payload = get_pucch2_ri(ue,eNB_id); + + generate_pucch2x(ue->common_vars.txdataF, + &ue->frame_parms, + ue->ncs_cell, + format, + &ue->pucch_config_dedicated[eNB_id], + n2_pucch, + &RI_payload, + 1, // A + 0, // B2 not needed + tx_amp, + subframe_tx, + ue->pdcch_vars[eNB_id]->crnti); + + ue->generate_ul_signal[eNB_id] = 1; + } + } } void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type) { @@ -2281,7 +2579,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint if (generate_ue_dlsch_params_from_dci(frame_rx, subframe_rx, (void *)&dci_alloc_rx[i].dci_pdu, - SI_RNTI, + P_RNTI, dci_alloc_rx[i].format, &ue->dlsch_SI[eNB_id], &ue->frame_parms, @@ -2774,7 +3072,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, subframe_rx, harq_pid, pdsch==PDSCH?1:0, - dlsch0->harq_processes[harq_pid]->nb_rb>10?1:0); + dlsch0->harq_processes[harq_pid]->TBS>256?1:0); stop_meas(&ue->dlsch_decoding_stats); } diff --git a/openair1/SCHED/pucch_pc.c b/openair1/SCHED/pucch_pc.c index 5afd57e6a0..2795fe65a9 100644 --- a/openair1/SCHED/pucch_pc.c +++ b/openair1/SCHED/pucch_pc.c @@ -88,7 +88,7 @@ int8_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,ui } if (pucch_fmt!=pucch_format1) { - LOG_I(PHY,"[UE %d][PDSCH %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB, g_pucch %d dB\n", + LOG_D(PHY,"[UE %d][PDSCH %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB, g_pucch %d dB\n", ue->Mod_id, ue->dlsch[eNB_id][0]->rnti,proc->frame_tx,subframe, Po_PUCCH, @@ -96,7 +96,7 @@ int8_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,ui get_PL(ue->Mod_id,ue->CC_id,eNB_id), ue->dlsch[eNB_id][0]->g_pucch); } else { - LOG_I(PHY,"[UE %d][SR %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB g_pucch %d dB\n", + LOG_D(PHY,"[UE %d][SR %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB g_pucch %d dB\n", ue->Mod_id, ue->dlsch[eNB_id][0]->rnti,proc->frame_tx,subframe, Po_PUCCH, diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index d46b761bd0..3fbcadafbb 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -69,7 +69,6 @@ void ue_mac_reset(module_id_t module_idP,uint8_t eNB_index) // cancel all pending SRs UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; - UE_mac_inst[module_idP].BSR_reporting_active=0; // stop ongoing RACH procedure @@ -226,34 +225,13 @@ rrc_mac_config_req( if (mac_MainConfig->ext1 && mac_MainConfig->ext1->sr_ProhibitTimer_r9) { UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = (uint16_t) *mac_MainConfig->ext1->sr_ProhibitTimer_r9; } else { - UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = 0; + UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = (uint16_t) 0; } - if (mac_MainConfig->ext2 && mac_MainConfig->ext2->mac_MainConfig_v1020) { - if (mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10) { - UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t) *mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10; - } else { - UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t)0; - } - if (mac_MainConfig->ext2->mac_MainConfig_v1020->extendedPHR_r10) { - UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t) *mac_MainConfig->ext2->mac_MainConfig_v1020->extendedPHR_r10; - } else { - UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0; - } - } else { - UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t)0; - UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0; - } #endif UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer); UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer); - UE_mac_inst[Mod_idP].BSR_reporting_active = 0; - LOG_D(MAC,"[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n", - Mod_idP, - UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF, - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF); - UE_mac_inst[Mod_idP].scheduling_info.drx_config = mac_MainConfig->drx_Config; UE_mac_inst[Mod_idP].scheduling_info.phr_config = mac_MainConfig->phr_Config; @@ -274,7 +252,6 @@ rrc_mac_config_req( UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer); UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer); UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[Mod_idP].scheduling_info.PathlossChange); - UE_mac_inst[Mod_idP].PHR_reporting_active = 0; LOG_D(MAC,"[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n", Mod_idP, (mac_MainConfig->phr_Config)?mac_MainConfig->phr_Config->present:-1, diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index d38ca05362..2235c3e1c4 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -945,12 +945,8 @@ typedef enum { typedef struct { /// buffer status for each lcgid uint8_t BSR[MAX_NUM_LCGID]; // should be more for mesh topology - /// keep the number of bytes in rlc buffer for each lcgid + /// keep the number of bytes in rlc buffer for each lcid uint16_t BSR_bytes[MAX_NUM_LCGID]; -#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 - /// after multiplexing buffer remain for each lcid - uint16_t LCID_buffer_remain[MAX_NUM_LCID]; -#endif /// buffer status for each lcid uint8_t LCID_status[MAX_NUM_LCID]; /// SR pending as defined in 36.321 @@ -991,12 +987,6 @@ typedef struct { int16_t prohibitPHR_SF; ///DL Pathloss Change in db uint16_t PathlossChange_db; - - /// default value is false - uint16_t extendedBSR_Sizes_r10; - /// default value is false - uint16_t extendedPHR_r10; - //Bj bucket usage per lcid int16_t Bj[MAX_NUM_LCID]; // Bucket size per lcid @@ -1084,8 +1074,6 @@ typedef struct { uint8_t PHR_reporting_active; /// power backoff due to power management (as allowed by P-MPRc) for this cell uint8_t power_backoff_db[NUMBER_OF_eNB_MAX]; - /// BSR report falg management - uint8_t BSR_reporting_active; /// MBSFN_Subframe Configuration struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? /// number of subframe allocation pattern available for MBSFN sync area diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 7946fdf663..2107ad0f9a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -1006,7 +1006,7 @@ void dump_CCE_table(int *CCE_table,const int nCCE,const unsigned short rnti,cons for (i=0;i 0) { + } else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DCCH] > 0) { // This is for triggering a transmission on DCCH using PRACH (during handover, or sending SR for example) dcch_header_len = 2 + 2; /// SHORT Subheader + C-RNTI control element rlc_status = mac_rlc_status_ind(module_idP,UE_mac_inst[module_idP].crnti, eNB_indexP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO, diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index c24702b3b5..d5958f6e5e 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -102,17 +102,13 @@ void ue_init_mac(module_id_t module_idP) UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer_Running=0; UE_mac_inst[module_idP].scheduling_info.maxHARQ_Tx=MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; UE_mac_inst[module_idP].scheduling_info.ttiBundling=0; - UE_mac_inst[module_idP].scheduling_info.extendedBSR_Sizes_r10=0; - UE_mac_inst[module_idP].scheduling_info.extendedPHR_r10=0; UE_mac_inst[module_idP].scheduling_info.drx_config=NULL; UE_mac_inst[module_idP].scheduling_info.phr_config=NULL; UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); - UE_mac_inst[module_idP].BSR_reporting_active = 0; UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer); UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer); UE_mac_inst[module_idP].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[module_idP].scheduling_info.PathlossChange); - UE_mac_inst[module_idP].PHR_reporting_active = 0; for (i=0; i < MAX_NUM_LCID; i++) { LOG_D(MAC,"[UE%d] Applying default logical channel config for LCGID %d\n",module_idP,i); @@ -125,7 +121,7 @@ void ue_init_mac(module_id_t module_idP) UE_mac_inst[module_idP].scheduling_info.LCGID[i]=1; } - UE_mac_inst[module_idP].scheduling_info.LCID_status[i]=LCID_EMPTY; + UE_mac_inst[module_idP].scheduling_info.LCID_status[i]=0; } #ifdef CBA @@ -310,28 +306,18 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i // initiate RA UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; - // release all pucch resource - UE_mac_inst[module_idP].physicalConfigDedicated = NULL; - UE_mac_inst[module_idP].ul_active=0; - UE_mac_inst[module_idP].BSR_reporting_active=0; - - LOG_T(MAC,"[UE %d] Release all SRs \n", module_idP); return(0); } } //------------------------------------------------------------------------------ void -ue_send_sdu( - module_id_t module_idP, - uint8_t CC_id, - frame_t frameP, - uint8_t* sdu, - uint16_t sdu_len, - uint8_t eNB_index -) -//------------------------------------------------------------------------------ -{ +ue_send_sdu(module_id_t module_idP, + uint8_t CC_id, + frame_t frameP, + uint8_t* sdu, + uint16_t sdu_len, + uint8_t eNB_index) { unsigned char rx_ces[MAX_NUM_CE],num_ce,num_sdu,i,*payload_ptr; unsigned char rx_lcids[NB_RB_MAX]; @@ -1258,12 +1244,11 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf BSR_LONG *bsr_l=&bsr_long; POWER_HEADROOM_CMD phr; POWER_HEADROOM_CMD *phr_p=&phr; - unsigned short short_padding=0, post_padding=0, padding_len=0; + unsigned short short_padding=0, post_padding=0; int lcgid; int j; // used for padding // Compute header length - int all_pdu_len; - + if (CC_id>0) { LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n"); mac_xface->macphy_exit("MAC FATAL CC_id>0"); @@ -1297,10 +1282,19 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len=(buflen > 128 ) ? 3 : 2 ; //sizeof(SCH_SUBHEADER_LONG)-1 : sizeof(SCH_SUBHEADER_SHORT); bsr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); phr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); + phr_ce_len = (UE_mac_inst[module_idP].PHR_reporting_active == 1) ? 1 /* sizeof(POWER_HEADROOM_CMD)*/: 0; - bsr_ce_len = get_bsr_len (module_idP, eNB_index, frameP, buflen); - // retxBSR-Timer expires or periodicBSR-Timer expires and Regular BSR trigger - if ((bsr_ce_len > 0 ) && (UE_mac_inst[module_idP].BSR_reporting_active > 0)) { + if (phr_ce_len > 0) { + phr_len = phr_ce_len + phr_header_len; + LOG_D(MAC,"[UE %d] header size info: PHR len %d (ce%d,hdr%d) buff_len %d\n", + module_idP, phr_len, phr_ce_len, phr_header_len, buflen); + } else { + phr_len=0; + } + + bsr_ce_len = get_bsr_len (module_idP, buflen-phr_len); + + if (bsr_ce_len > 0 ) { bsr_len = bsr_ce_len + bsr_header_len; LOG_D(MAC,"[UE %d] header size info: dcch %d, dcch1 %d, dtch %d, bsr (ce%d,hdr%d) buff_len %d\n", module_idP, dcch_header_len,dcch1_header_len,dtch_header_len, bsr_ce_len, bsr_header_len, buflen); @@ -1311,15 +1305,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf //bsr_len = bsr_ce_len + bsr_header_len; } - phr_ce_len = (UE_mac_inst[module_idP].PHR_reporting_active == 1) ? 1 /* sizeof(POWER_HEADROOM_CMD)*/: 0; - if (phr_ce_len > 0) { - phr_len = phr_ce_len + phr_header_len; - LOG_D(MAC,"[UE %d] header size info: PHR len %d (ce%d,hdr%d) buff_len %d\n", - module_idP, phr_len, phr_ce_len, phr_header_len, buflen); - } else { - phr_len=0; - } - // check for UL bandwidth requests and add SR control element // check for UL bandwidth requests and add SR control element @@ -1353,12 +1338,8 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf sdu_lcids[0] = DCCH; LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH\n",module_idP,sdu_lengths[0]); num_sdus = 1; - //update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]); + update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]); //header_len +=2; - UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] = LCID_EMPTY; -#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 - UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] = rlc_status.bytes_in_buffer-sdu_lengths[0]; -#endif } else { dcch_header_len=0; num_sdus = 0; @@ -1394,13 +1375,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf sdu_length_total += sdu_lengths[num_sdus]; sdu_lcids[num_sdus] = DCCH1; LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH1\n",module_idP,sdu_lengths[num_sdus]); + num_sdus++; //update_bsr(module_idP, frameP, DCCH1); //dcch_header_len +=2; // include dcch1 - UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] = LCID_EMPTY; -#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 - UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1] = rlc_status.bytes_in_buffer-sdu_lengths[num_sdus]; -#endif - num_sdus++; } else { dcch1_header_len =0; } @@ -1411,9 +1388,8 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len+=3; dtch_header_len_last=3; - all_pdu_len = bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len+sdu_length_total; if ((UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) && - (all_pdu_len <= buflen)) { + ((bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len+sdu_length_total) <= buflen)) { // optimize the dtch header lenght //if ((UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH] > 128) && @@ -1431,11 +1407,11 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ENB_FLAG_NO, MBMS_FLAG_NO, // eNB_index lcid, - buflen-all_pdu_len); + buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total); LOG_D(MAC,"[UE %d] Frame %d : UL-DTCH -> ULSCH%d, %d bytes to send (Transport Block size %d, mac header len %d, BSR byte[%d] %d)\n", module_idP,frameP, lcid, rlc_status.bytes_in_buffer,buflen,dtch_header_len, - lcid, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]); + lcid, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcid]); if (rlc_status.bytes_in_buffer > 0) { sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, @@ -1455,20 +1431,16 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len --; dtch_header_len_last --; } -#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 - UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] = rlc_status.bytes_in_buffer-sdu_lengths[num_sdus]; -#endif num_sdus++; - //UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]); + UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]); } else { dtch_header_len -= 3; } - UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_EMPTY; } else { // no rlc pdu : generate the dummy header dtch_header_len -= 3; } } - + lcgid= get_bsr_lcgid(module_idP); if (lcgid < 0 ) { @@ -1480,29 +1452,15 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf bsr_l->Buffer_size1 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]; bsr_l->Buffer_size2 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]; bsr_l->Buffer_size3 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]; - LOG_D(MAC, "[UE %d] Frame %d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP, UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]); - - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID0] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID1] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID2] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID3] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3] = 0; } else if (bsr_ce_len == sizeof(BSR_SHORT)) { bsr_l = NULL; bsr_s->LCGID = lcgid; bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]; - - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = 0; - LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); } else { @@ -1536,14 +1494,12 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len_last-=1; dtch_header_len= (dtch_header_len >0)? dtch_header_len - dtch_header_len_last : dtch_header_len; } - // 1-bit padding or 2-bit padding special padding subheader - padding_len = buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total; - if (padding_len <= 2) { - short_padding = padding_len; - // only add padding header + + if ((buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total) <= 2) { + short_padding = buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total; post_padding = 0; } else { - if (padding_len == buflen) {// nona mac pdu + if ((buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total) == buflen) { *access_mode=CANCELED_ACCESS; } @@ -1588,9 +1544,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf module_idP,payload_offset, sdu_length_total); UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; - UE_mac_inst[module_idP].BSR_reporting_active=0; - UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); - UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT); stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu); @@ -1752,25 +1705,10 @@ ue_scheduler( // call SR procedure to generate pending SR and BSR for next PUCCH/PUSCH TxOp. This should implement the procedures // outlined in Sections 5.4.4 an 5.4.5 of 36.321 - // Call BSR procedure as described in Section 5.4.5 in 36.321 - if (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF == get_sf_periodicBSRTimer(MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity)) { - UE_mac_inst[module_idP].BSR_reporting_active = 1; - } else if (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF <= 0 ){ - // trigger BSR and reset the timer later when the BSR report is sent - UE_mac_inst[module_idP].BSR_reporting_active = 1; - } else if (UE_mac_inst[module_idP].BSR_reporting_active == 0 ) { - UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF--; - } - - if (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF <= 0){ - // trigger BSR and reset the timer later when the BSR report is sent - UE_mac_inst[module_idP].BSR_reporting_active = 1; - } else if (UE_mac_inst[module_idP].BSR_reporting_active == 0 ) { - UE_mac_inst[module_idP].scheduling_info.retxBSR_SF--; - } + // Put this in another function // Get RLC status info and update Bj for all lcids that are active - for (lcid=DCCH; lcid < MAX_NUM_LCID; lcid++ ) { + for (lcid=DCCH; lcid <= DTCH; lcid++ ) { if ((lcid == 0) ||(UE_mac_inst[module_idP].logicalChannelConfig[lcid])) { // meausre the Bj if ((directionP == SF_UL)&& (UE_mac_inst[module_idP].scheduling_info.Bj[lcid] >= 0)) { @@ -1791,8 +1729,6 @@ ue_scheduler( if (update_bsr(module_idP,frameP, eNB_indexP, lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid])) { UE_mac_inst[module_idP].scheduling_info.SR_pending= 1; - // Regular BSR trigger - UE_mac_inst[module_idP].BSR_reporting_active = 1; LOG_D(MAC,"[UE %d][SR] Frame %d subframe %d SR for PUSCH is pending for LCGID %d with BSR level %d (%d bytes in RLC)\n", module_idP, frameP,subframeP,UE_mac_inst[module_idP].scheduling_info.LCGID[lcid], UE_mac_inst[module_idP].scheduling_info.BSR[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]], @@ -2034,26 +1970,31 @@ int get_bsr_lcgid (module_id_t module_idP) } } -uint8_t get_bsr_len (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint16_t buflen) +uint8_t get_bsr_len (module_id_t module_idP, uint16_t buflen) { - int lcid; - uint8_t bsr_len=0, num_lcid=0; - int pdu = 0; - mac_rlc_status_resp_t rlc_status; - for (lcid=DCCH; lcid 0 ) { - pdu += rlc_status.bytes_in_buffer + sizeof(SCH_SUBHEADER_SHORT) + bsr_len; - if (rlc_status.bytes_in_buffer > 128 ) { - pdu += 1; //sizeof(SCH_SUBHEADER_LONG) - } + int lcgid=0; + uint8_t bsr_len=0, num_lcgid=0; + int pdu = 0; + + + for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 0 ) { + pdu += (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] + bsr_len + 2); //2 = sizeof(SCH_SUBHEADER_SHORT) } - if ( (pdu > buflen) && (rlc_status.bytes_in_buffer > 0 ) ) { - num_lcid +=1; - bsr_len = (num_lcid >= 2 ) ? sizeof(BSR_LONG) : sizeof(BSR_SHORT) ; + + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 128 ) { // long header size: adjust the header size + pdu += 1; } - LOG_D(MAC,"LC buffer Bytes %d for lcid %d bsr len %d num lcid %d\n", rlc_status.bytes_in_buffer, lcid, bsr_len, num_lcid); + + // current phy buff can not transport all sdu for this lcgid -> transmit a bsr for this lcgid + + if ( (pdu > buflen) && (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 0 ) ) { + num_lcgid +=1; + bsr_len = (num_lcgid >= 2 ) ? sizeof(BSR_LONG) : sizeof(BSR_SHORT) ; + } + + LOG_D(MAC,"BSR Bytes %d for lcgid %d bsr len %d num lcgid %d\n", UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid], lcgid, bsr_len, num_lcgid); } if ( bsr_len > 0 ) @@ -2063,6 +2004,7 @@ uint8_t get_bsr_len (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,ui return bsr_len; } + boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_index, uint8_t lcid, uint8_t lcg_id) { @@ -2086,17 +2028,11 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in lcid, 0); - if ((rlc_status.bytes_in_buffer > 0 ) -#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 - && (rlc_status.bytes_in_buffer > UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]) -#endif - ){ - //BSR trigger SR + if (rlc_status.bytes_in_buffer > 0 ) { sr_pending = TRUE; UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_NOT_EMPTY; - // sum lcid buffer which has same lcgid + UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] += locate (BSR_TABLE,BSR_TABLE_SIZE, rlc_status.bytes_in_buffer); UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id] += rlc_status.bytes_in_buffer; - UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] = locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); // UE_mac_inst[module_idP].scheduling_info.BSR_short_lcid = lcid; // only applicable to short bsr LOG_D(MAC,"[UE %d] BSR level %d (LCGID %d, rlc buffer %d byte)\n", module_idP, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id],lcg_id, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); @@ -2109,7 +2045,7 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in return sr_pending; } -uint8_t locate_BsrIndexByBufferSize (const uint32_t *table, int size, int value) +uint8_t locate (const uint32_t *table, int size, int value) { uint8_t ju, jm, jl; @@ -2140,7 +2076,7 @@ uint8_t locate_BsrIndexByBufferSize (const uint32_t *table, int size, int value) if (value == table[jl]) { return jl; - } else { + } else { return jl+1; //equally ju } diff --git a/openair2/LAYER2/MAC/vars.h b/openair2/LAYER2/MAC/vars.h index 236439c6e5..83d159f910 100644 --- a/openair2/LAYER2/MAC/vars.h +++ b/openair2/LAYER2/MAC/vars.h @@ -45,15 +45,6 @@ const uint32_t BSR_TABLE[BSR_TABLE_SIZE]= {0,10,12,14,17,19,22,26,31,36,42,49,57 1326,1552,1817,2127,2490,2915,3413,3995,4677,5467,6411,7505,8787,10287,12043,14099, 16507,19325,22624,26487,31009,36304,42502,49759,58255,68201,79846,93479,109439, 128125,150000, 300000 }; -// extended bsr table--currently not used -const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE] = {0,10,13,16,19,23,29,35,43,53,65,80,98,120,147, - 181,223,274,337,414,509,625,769,945,1162,1429, - 1757,2161,2657,3267,4017,4940,6074,7469,9185, - 11294,13888,17077,20999,25822,31752,39045,48012, - 59039,72598,89272,109774,134986,165989,204111, - 250990,308634,379519,466683,573866,705666,867737, - 1067031,1312097,1613447,1984009,2439678,3000000, - 6000000}; //uint32_t EBSR_Level[63]={0,10,13,16,19,23,29,35,43,53,65,80,98,120,147,181}; diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index fb8f2a426f..7d2fc3a3d8 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -2663,6 +2663,21 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) // UE_EUTRA_Capability->measParameters.bandListEUTRA.list.count = 0; // no measurements on other bands // UE_EUTRA_Capability->featureGroupIndicators // null + + // featureGroup is mandatory for CMW tests + // featureGroup is filled only for usim-test mode + BIT_STRING_t *bit_string; + uint32_t featrG; + bit_string = CALLOC(1, sizeof(*bit_string)); + featrG = 0x04000800; + if(usim_test == 1) + { + bit_string->buf = &featrG; + bit_string->size = 4; + bit_string->bits_unused = 0; + UE_EUTRA_Capability->featureGroupIndicators = bit_string; + } + // UE_EUTRA_Capability->interRAT_Parameters // null } else { diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index a41a664c18..1b22ae5d0b 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -817,6 +817,7 @@ rrc_ue_process_measConfig( } } + LOG_I(RRC,"call rrc_mac_config_req \n"); rrc_mac_config_req(ctxt_pP->module_id,0,ENB_FLAG_NO,0,eNB_index, (RadioResourceConfigCommonSIB_t *)NULL, (struct PhysicalConfigDedicated *)NULL, @@ -963,6 +964,199 @@ rrc_ue_process_measConfig( } } + +void +rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radioResourceConfigDedicated, + const protocol_ctxt_t* const ctxt_pP, + uint8_t eNB_index) +{ + PhysicalConfigDedicated_t* physicalConfigDedicated2 = NULL; + + physicalConfigDedicated2 = CALLOC(1,sizeof(*physicalConfigDedicated2)); + physicalConfigDedicated2->pdsch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated)); + physicalConfigDedicated2->pusch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated)); + physicalConfigDedicated2->pucch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated)); + physicalConfigDedicated2->cqi_ReportConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); + physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); + + physicalConfigDedicated2->uplinkPowerControlDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated)); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); + + // Update pdsch_ConfigDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->pdsch_ConfigDedicated != NULL) + { + LOG_I(RRC,"Update pdsch_ConfigDedicated config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated = CALLOC(1,sizeof(PDSCH_ConfigDedicated_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->pdsch_ConfigDedicated, + sizeof(physicalConfigDedicated2->pdsch_ConfigDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for pdsch_ConfigDedicated\n"); + } + + // Update pusch_ConfigDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->pusch_ConfigDedicated != NULL) + { + LOG_I(RRC,"Update pusch_ConfigDedicated config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated = CALLOC(1,sizeof(PUSCH_ConfigDedicated_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->pusch_ConfigDedicated, + sizeof(physicalConfigDedicated2->pusch_ConfigDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for pusch_ConfigDedicated\n"); + } + + // Update pucch_ConfigDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->pucch_ConfigDedicated != NULL) + { + LOG_I(RRC,"Update pucch_ConfigDedicated config \n"); + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated = CALLOC(1,sizeof(PUCCH_ConfigDedicated_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->pucch_ConfigDedicated, + sizeof(physicalConfigDedicated2->pucch_ConfigDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for pucch_ConfigDedicated\n"); + } + + // Update cqi_ReportConfig + if(radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig != NULL) + { + LOG_I(RRC,"Update cqi_ReportConfig config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig = CALLOC(1,sizeof(CQI_ReportConfig_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig, + sizeof(physicalConfigDedicated2->cqi_ReportConfig)); + } + else + { + LOG_I(RRC,"Keep old config for cqi_ReportConfig\n"); + } + + // Update schedulingRequestConfig + if(radioResourceConfigDedicated->physicalConfigDedicated->schedulingRequestConfig != NULL) + { + LOG_I(RRC,"Update schedulingRequestConfig config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig = CALLOC(1,sizeof(SchedulingRequestConfig_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->schedulingRequestConfig, + sizeof(physicalConfigDedicated2->schedulingRequestConfig)); + } + else + { + LOG_I(RRC,"Keep old config for schedulingRequestConfig\n"); + } + + // Update soundingRS_UL_ConfigDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->soundingRS_UL_ConfigDedicated != NULL) + { + LOG_I(RRC,"Update soundingRS_UL_ConfigDedicated config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(SoundingRS_UL_ConfigDedicated_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->soundingRS_UL_ConfigDedicated, + sizeof(physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for soundingRS_UL_ConfigDedicated\n"); + } + + // Update antennaInfo + if(radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo != NULL) + { + LOG_I(RRC,"Update antennaInfo config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo = CALLOC(1,sizeof(struct PhysicalConfigDedicated__antennaInfo)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo, + sizeof(physicalConfigDedicated2->antennaInfo)); + } + else + { + LOG_I(RRC,"Keep old config for antennaInfo\n"); + } + + + // Update uplinkPowerControlDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->uplinkPowerControlDedicated != NULL) + { + LOG_I(RRC,"Update uplinkPowerControlDedicated config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated = CALLOC(1,sizeof(UplinkPowerControlDedicated_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->uplinkPowerControlDedicated, + sizeof(physicalConfigDedicated2->uplinkPowerControlDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for uplinkPowerControlDedicated\n"); + } + + // Update tpc_PDCCH_ConfigPUCCH + if(radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUCCH != NULL) + { + LOG_I(RRC,"Update tpc_PDCCH_ConfigPUCCH config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(TPC_PDCCH_Config_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUCCH, + sizeof(physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); + } + else + { + LOG_I(RRC,"Keep old config for tpc_PDCCH_ConfigPUCCH\n"); + } + + // Update tpc_PDCCH_ConfigPUSCH + if(radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUSCH != NULL) + { + LOG_I(RRC,"Update tpc_PDCCH_ConfigPUSCH config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(TPC_PDCCH_Config_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUSCH, + sizeof(physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); + + } + else + { + LOG_I(RRC,"Keep old config for tpc_PDCCH_ConfigPUSCH\n"); + } + +} //----------------------------------------------------------------------------- void rrc_ue_process_radioResourceConfigDedicated( @@ -983,11 +1177,17 @@ rrc_ue_process_radioResourceConfigDedicated( // Save physicalConfigDedicated if present if (radioResourceConfigDedicated->physicalConfigDedicated) { + LOG_I(RRC,"Save physicalConfigDedicated if present \n"); + if (UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]) { +#if 1 + rrc_ue_update_radioResourceConfigDedicated(radioResourceConfigDedicated, ctxt_pP, eNB_index); +#else memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index],(char*)radioResourceConfigDedicated->physicalConfigDedicated, sizeof(struct PhysicalConfigDedicated)); - +#endif } else { + LOG_I(RRC,"Init physicalConfigDedicated UE_rrc_inst to radioResourceConfigDedicated->physicalConfigDedicated\n"); UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index] = radioResourceConfigDedicated->physicalConfigDedicated; } } @@ -1105,7 +1305,7 @@ rrc_ue_process_radioResourceConfigDedicated( SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; } - LOG_D(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 eNB %d) --->][MAC_UE][MOD %02d][]\n", + LOG_I(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 eNB %d) --->][MAC_UE][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); rrc_mac_config_req(ctxt_pP->module_id,0,ENB_FLAG_NO,0,eNB_index, (RadioResourceConfigCommonSIB_t *)NULL, @@ -1160,7 +1360,7 @@ rrc_ue_process_radioResourceConfigDedicated( SRB2_logicalChannelConfig = &SRB2_logicalChannelConfig_defaultValue; } - LOG_D(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 eNB %d) --->][MAC_UE][MOD %02d][]\n", + LOG_I(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 eNB %d) --->][MAC_UE][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, eNB_index, @@ -1267,7 +1467,7 @@ rrc_ue_process_radioResourceConfigDedicated( UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id] = radioResourceConfigDedicated->drb_ToAddModList->list.array[i]; rrc_ue_establish_drb(ctxt_pP->module_id,ctxt_pP->frame,eNB_index,radioResourceConfigDedicated->drb_ToAddModList->list.array[i]); // MAC/PHY Configuration - LOG_D(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (DRB %d eNB %d) --->][MAC_UE][MOD %02d][]\n", + LOG_I(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (DRB %d eNB %d) --->][MAC_UE][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, radioResourceConfigDedicated->drb_ToAddModList->list.array[i]->drb_Identity, eNB_index, @@ -1825,7 +2025,7 @@ rrc_ue_process_mobilityControlInfo( UE_rrc_inst[ue_mod_idP].DRB_config[eNB_index][0] = NULL; */ //Synchronisation to DL of target cell - LOG_D(RRC, + LOG_I(RRC, "HO: Reset PDCP and RLC for configured RBs.. \n[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 eNB %d) --->][MAC_UE][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); @@ -2685,7 +2885,7 @@ static int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod = siPeriod_int[sib1->schedulingInfoList.list.array[0]->si_Periodicity]; UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize = siWindowLength_int[sib1->si_WindowLength]; - LOG_D( RRC, "[FRAME unknown][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB1 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", + LOG_I( RRC, "[FRAME unknown][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB1 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", ctxt_pP->module_id, eNB_index, ctxt_pP->module_id ); rrc_mac_config_req(ctxt_pP->module_id, 0, ENB_FLAG_NO, 0, eNB_index, @@ -3499,7 +3699,7 @@ static int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_in LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB13 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); dump_sib13( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index] ); // adding here function to store necessary parameters for using in decode_MCCH_Message + maybe transfer to PHY layer - LOG_D( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB13 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", + LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB13 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); rrc_mac_config_req(ctxt_pP->module_id,0,ENB_FLAG_NO,0,eNB_index, (RadioResourceConfigCommonSIB_t *)NULL, @@ -3956,7 +4156,7 @@ static void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_i { protocol_ctxt_t ctxt; - LOG_D(RRC,"[UE %d] Frame %d : Number of MCH(s) in the MBSFN Sync Area %d is %d\n", + LOG_I(RRC,"[UE %d] Frame %d : Number of MCH(s) in the MBSFN Sync Area %d is %d\n", ue_mod_idP, frameP, mbsfn_sync_area, UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9.list.count); // store to MAC/PHY necessary parameters for receiving MTCHs rrc_mac_config_req(ue_mod_idP,0,ENB_FLAG_NO,0,eNB_index, @@ -4301,12 +4501,26 @@ void *rrc_ue_task( void *args_p ) /* Transfer data to PDCP */ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, UE_rrc_inst[ue_mod_id].Info[0].rnti, 0, 0,0); - rrc_data_req (&ctxt, - DCCH, - rrc_mui++, - SDU_CONFIRM_NO, - length, buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + + // check if SRB2 is created, if yes request data_req on DCCH1 (SRB2) + if(UE_rrc_inst[ue_mod_id].SRB2_config[0] == NULL) + { + rrc_data_req (&ctxt, + DCCH, + rrc_mui++, + SDU_CONFIRM_NO, + length, buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + } + else + { + rrc_data_req (&ctxt, + DCCH1, + rrc_mui++, + SDU_CONFIRM_NO, + length, buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + } break; } diff --git a/openair3/NAS/UE/EMM/SAP/emm_recv.c b/openair3/NAS/UE/EMM/SAP/emm_recv.c index 32e8e1ec30..a79a14d9c1 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_recv.c +++ b/openair3/NAS/UE/EMM/SAP/emm_recv.c @@ -137,8 +137,15 @@ int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause) /* * Message checking */ - if (msg->tailist.typeoflist != - TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS) { + // supported cases: + // typeoflist = 1 Or + // typeoflist = 0 and numberofelements = 1 (ie numberofelements equal to zero see 3gpp 24.301 9.9.3.33.1) + LOG_D(NAS,"attach accept type of list: %d, number of element: %d\n",msg->tailist.typeoflist, msg->tailist.numberofelements); + if (!( (msg->tailist.typeoflist == TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS) || + ((msg->tailist.typeoflist == 0) && ( msg->tailist.numberofelements == 0)) + ) + ) + { /* Only list of TACs belonging to one PLMN with consecutive * TAC values is supported */ *emm_cause = EMM_CAUSE_IE_NOT_IMPLEMENTED;