From 18d996ebd60ad007d69ad3d23c6a224887d403b1 Mon Sep 17 00:00:00 2001 From: sharma Date: Sun, 3 Dec 2017 00:08:04 +0100 Subject: [PATCH] addition of UL scheduler for eMTC --- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 149 ++++++++ openair1/PHY/LTE_TRANSPORT/edci.c | 7 +- openair1/PHY/LTE_TRANSPORT/mdci.h | 16 +- openair1/PHY/LTE_TRANSPORT/proto.h | 6 +- openair1/PHY/LTE_TRANSPORT/pucch.c | 46 ++- openair1/SCHED/fapi_l1.c | 41 +- openair1/SCHED/phy_procedures_lte_eNb.c | 40 +- openair2/LAYER2/MAC/defs.h | 2 + openair2/LAYER2/MAC/eNB_scheduler.c | 4 +- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 43 ++- openair2/LAYER2/MAC/eNB_scheduler_bch.c | 3 +- .../LAYER2/MAC/eNB_scheduler_primitives.c | 2 +- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 358 +++++++++++++++++- openair2/LAYER2/MAC/pre_processor.c | 2 + openair2/RRC/LITE/MESSAGES/asn1_msg.c | 5 +- openair2/RRC/LITE/rrc_common.c | 8 +- openair2/RRC/LITE/rrc_eNB.c | 1 + 17 files changed, 647 insertions(+), 86 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index 5a27a4dd06..6059ac8aa7 100755 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -2583,6 +2583,155 @@ fill_dci0 (PHY_VARS_eNB * eNB, eNB_rxtx_proc_t * proc, DCI_ALLOC_t * dci_alloc, } } +#ifdef Rel14 +void +fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, eNB_rxtx_proc_t * proc, mDCI_ALLOC_t * dci_alloc, nfapi_hi_dci0_mpdcch_dci_pdu * pdu) +{ + LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; + nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t *rel13 = &pdu->mpdcch_dci_pdu_rel13; + + uint32_t cqi_req = rel13->csi_request; + uint32_t dai = rel13->dl_assignment_index; + uint32_t TPC = rel13->tpc; + uint32_t mcs = rel13->mcs; + uint32_t hopping = rel13->frequency_hopping_flag; + uint32_t rballoc = computeRIV (6, + rel13->resource_block_start, + rel13->number_of_resource_blocks); + + uint32_t ndi = rel13->new_data_indication; + +#ifdef T_TRACER + T (T_ENB_PHY_ULSCH_UE_DCI, T_INT (eNB->Mod_id), T_INT (proc->frame_tx), T_INT (proc->subframe_tx), + T_INT (rel13->rnti), T_INT (((proc->frame_tx * 10 + proc->subframe_tx + 4) % 8) /* TODO: correct harq pid */ ), + T_INT (mcs), T_INT (-1 /* TODO: remove round? */ ), + T_INT (rel13->resource_block_start), + T_INT (rel13->number_of_resource_blocks), + T_INT (get_TBS_UL (mcs, rel13->number_of_resource_blocks) * 8), T_INT (rel13->aggregation_level), T_INT (rel13->cce_index)); +#endif + + void *dci_pdu = (void *) dci_alloc->dci_pdu; + + AssertFatal(rel13->ce_mode == 1 && rel13->dci_format == 4, "dci format 5 (CE_modeB) not supported yet\n"); + + LOG_D (PHY, "Filling DCI6-0A with cqi %d, mcs %d, hopping %d, rballoc %x (%d,%d) ndi %d TPC %d\n", cqi_req, + mcs, hopping, rballoc, rel13->resource_block_start, rel13->number_of_resource_blocks, ndi, TPC); + + dci_alloc->format = format6_0A; + dci_alloc->firstCCE = rel13->ecce_index; + dci_alloc->L = rel13->aggreagation_level; + dci_alloc->rnti = rel13->rnti; + dci_alloc->harq_pid = rel13->harq_process; + dci_alloc->narrowband = rel13->mpdcch_narrowband; + dci_alloc->number_of_prb_pairs = rel13->number_of_prb_pairs; + dci_alloc->resource_block_assignment = rel13->resource_block_assignment; + dci_alloc->transmission_type = rel13->mpdcch_transmission_type; + dci_alloc->start_symbol = rel13->start_symbol; + dci_alloc->ce_mode = rel13->ce_mode; + dci_alloc->dmrs_scrambling_init = rel13->drms_scrambling_init; + dci_alloc->i0 = rel13->initial_transmission_sf_io; + + + switch (frame_parms->N_RB_DL) { + case 6: + if (frame_parms->frame_type == TDD) { + AssertFatal(1==0,"TDD not supported for eMTC yet\n"); + } else { + AssertFatal(1==0,"6 PRBS not supported for eMTC\n"); + } + + break; + + case 25: + if (frame_parms->frame_type == TDD) { + AssertFatal(1==0,"TDD not supported for eMTC yet\n"); + } else { + dci_alloc->dci_length = sizeof_DCI6_0A_5MHz_t; + ((DCI6_0A_10MHz_t *) dci_pdu)->type = 0; + ((DCI6_0A_10MHz_t *) dci_pdu)->hopping = hopping; + ((DCI6_0A_10MHz_t *) dci_pdu)->rballoc = rballoc; + ((DCI6_0A_10MHz_t *) dci_pdu)->mcs = mcs; + ((DCI6_0A_10MHz_t *) dci_pdu)->rep = rel13->pusch_repetition_levels; + ((DCI6_0A_10MHz_t *) dci_pdu)->harq_pid = rel13->harq_process; + ((DCI6_0A_10MHz_t *) dci_pdu)->ndi = ndi; + ((DCI6_0A_10MHz_t *) dci_pdu)->rv_idx = rel13->redudency_version; + ((DCI6_0A_10MHz_t *) dci_pdu)->TPC = TPC; + ((DCI6_0A_10MHz_t *) dci_pdu)->csi_req = cqi_req; + ((DCI6_0A_10MHz_t *) dci_pdu)->srs_req = rel13->srs_request; + ((DCI6_0A_10MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number; + + } + + break; + + case 50: + if (frame_parms->frame_type == TDD) { + AssertFatal(1==0,"TDD not supported for eMTC yet\n"); + } else { + dci_alloc->dci_length = sizeof_DCI6_0A_10MHz_t; + ((DCI6_0A_10MHz_t *) dci_pdu)->type = 0; + ((DCI6_0A_10MHz_t *) dci_pdu)->hopping = hopping; + ((DCI6_0A_10MHz_t *) dci_pdu)->rballoc = rballoc; + ((DCI6_0A_10MHz_t *) dci_pdu)->mcs = mcs; + ((DCI6_0A_10MHz_t *) dci_pdu)->rep = rel13->pusch_repetition_levels; + ((DCI6_0A_10MHz_t *) dci_pdu)->harq_pid = rel13->harq_process; + ((DCI6_0A_10MHz_t *) dci_pdu)->ndi = ndi; + ((DCI6_0A_10MHz_t *) dci_pdu)->rv_idx = rel13->redudency_version; + ((DCI6_0A_10MHz_t *) dci_pdu)->TPC = TPC; + ((DCI6_0A_10MHz_t *) dci_pdu)->csi_req = cqi_req; + ((DCI6_0A_10MHz_t *) dci_pdu)->srs_req = rel13->srs_request; + ((DCI6_0A_10MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number; + LOG_I(PHY,"Frame %d, Subframe %d : Programming Format 6-0A DCI, type %d, hopping %d, narrowband %d, rballoc %x, mcs %d, rep %d, harq_pid %d, ndi %d, rv %d, TPC %d, csi_req %d, srs_req %d, dci_rep r%d => %x\n", + proc->frame_tx,proc->subframe_tx, + ((DCI6_0A_10MHz_t *) dci_pdu)->type, + ((DCI6_0A_10MHz_t *) dci_pdu)->hopping, + ((DCI6_0A_10MHz_t *) dci_pdu)->narrowband, + ((DCI6_0A_10MHz_t *) dci_pdu)->rballoc, + ((DCI6_0A_10MHz_t *) dci_pdu)->mcs, + ((DCI6_0A_10MHz_t *) dci_pdu)->rep, + ((DCI6_0A_10MHz_t *) dci_pdu)->harq_pid, + ((DCI6_0A_10MHz_t *) dci_pdu)->ndi, + ((DCI6_0A_10MHz_t *) dci_pdu)->rv_idx, + ((DCI6_0A_10MHz_t *) dci_pdu)->TPC, + ((DCI6_0A_10MHz_t *) dci_pdu)->csi_req, + ((DCI6_0A_10MHz_t *) dci_pdu)->srs_req, + ((DCI6_0A_10MHz_t *) dci_pdu)->dci_rep, + ((uint32_t*)dci_pdu)[0]); + + } + + break; + + case 100: + if (frame_parms->frame_type == TDD) { + AssertFatal(1==0,"TDD not supported for eMTC yet\n"); + } else { + dci_alloc->dci_length = sizeof_DCI6_0A_20MHz_t; + ((DCI6_0A_20MHz_t *) dci_pdu)->type = 0; + ((DCI6_0A_20MHz_t *) dci_pdu)->hopping = hopping; + ((DCI6_0A_20MHz_t *) dci_pdu)->rballoc = rballoc; + ((DCI6_0A_20MHz_t *) dci_pdu)->mcs = rel13->mcs; + ((DCI6_0A_20MHz_t *) dci_pdu)->rep = rel13->pusch_repetition_levels; + ((DCI6_0A_20MHz_t *) dci_pdu)->harq_pid = rel13->harq_process; + ((DCI6_0A_20MHz_t *) dci_pdu)->ndi = ndi; + ((DCI6_0A_20MHz_t *) dci_pdu)->rv_idx = rel13->redudency_version; + ((DCI6_0A_20MHz_t *) dci_pdu)->TPC = TPC; + ((DCI6_0A_20MHz_t *) dci_pdu)->csi_req = cqi_req; + ((DCI6_0A_20MHz_t *) dci_pdu)->srs_req = rel13->srs_request; + ((DCI6_0A_20MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number; + } + + //printf("eNB: rb_alloc (20 MHz dci) %d\n",rballoc); + break; + + default: + LOG_E (PHY, "Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); + DevParam (frame_parms->N_RB_DL, 0, 0); + break; + } +} +#endif + void fill_ulsch (PHY_VARS_eNB * eNB, nfapi_ul_config_ulsch_pdu * ulsch_pdu, int frame, int subframe) { diff --git a/openair1/PHY/LTE_TRANSPORT/edci.c b/openair1/PHY/LTE_TRANSPORT/edci.c index 932408ad0a..fbc3adc7aa 100755 --- a/openair1/PHY/LTE_TRANSPORT/edci.c +++ b/openair1/PHY/LTE_TRANSPORT/edci.c @@ -339,7 +339,7 @@ void generate_mdci_top(PHY_VARS_eNB * eNB, int frame, int subframe, int16_t amp, AssertFatal(absSF < 10240, "Absolute subframe %d = %d*10 + %d > 10239\n", absSF, frame, subframe); mpdcch_scrambling(fp, mdci, absSF, mpdcch->e, coded_bits); - + // Modulation for PDCCH if (fp->nb_antenna_ports_eNB == 1) gain_lin_QPSK = (int16_t) ((amp * ONE_OVER_SQRT2_Q15) >> 15); @@ -388,15 +388,14 @@ void generate_mdci_top(PHY_VARS_eNB * eNB, int frame, int subframe, int16_t amp, ((int16_t *) & yIQ)[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK; e_ptr++; txF[mpdcchtab[i]] = yIQ; - /* - LOG_D(PHY,"Frame %d, subframe %d: mpdcch pos %d (%d,%d) => (%d,%d)\n", + /* + LOG_I(PHY,"Frame %d, subframe %d: mpdcch pos %d (%d,%d) => (%d,%d)\n", frame,subframe,i,mpdcchtab[i]+re_offset,mpdcchtab[i]/fp->ofdm_symbol_size, ((int16_t *) & yIQ)[0],((int16_t *) & yIQ)[1]);*/ } if (mdci->transmission_type == 1) w=0; // distributed else w = wp[a_index&1]; - // pilot scrambling initiatlization (note: this is for a single repetition) // x1 is set in lte_gold_generic diff --git a/openair1/PHY/LTE_TRANSPORT/mdci.h b/openair1/PHY/LTE_TRANSPORT/mdci.h index b2b0d3edce..5068aa072c 100755 --- a/openair1/PHY/LTE_TRANSPORT/mdci.h +++ b/openair1/PHY/LTE_TRANSPORT/mdci.h @@ -89,7 +89,9 @@ struct DCI6_1A_5MHz { /// Modulation and Coding Scheme and Redundancy Version uint32_t mcs:4; /// Resource block assignment (assignment flag = 0 for 5 MHz, ceil(log2(floor(N_RB_DL/6)))+5) - uint32_t rballoc:7; + uint32_t rballoc:5; + /// narroband index log2(floor(N_RB_DL/6))) bits + uint32_t narrowband:2; /// Frequency hopping flag uint32_t hopping:1; /// 0/1A differentiator @@ -122,7 +124,9 @@ struct DCI6_0A_10MHz { /// Modulation and Coding Scheme and Redundancy Version uint32_t mcs:4; /// RB Assignment (ceil(log2(floor(N_RB_UL/6))) + 5 bits) - uint32_t rballoc:8; + uint32_t rballoc:5; + /// narroband index log2(floor(N_RB_DL/6))) bits + uint32_t narrowband:3; /// Hopping flag uint32_t hopping:1; /// type = 0 => DCI Format 0, type = 1 => DCI Format 1A @@ -190,7 +194,9 @@ struct DCI6_0A_20MHz { /// Modulation and Coding Scheme and Redundancy Version uint32_t mcs:4; /// RB Assignment (ceil(log2(floor(N_RB_UL/6))) + 5 bits) - uint32_t rballoc:9; + uint32_t rballoc:5; + /// narroband index log2(floor(N_RB_DL/6))) bits + uint32_t narrowband:4; /// Hopping flag uint32_t hopping:1; /// type = 0 => DCI Format 0, type = 1 => DCI Format 1A @@ -223,7 +229,9 @@ struct DCI6_1A_20MHz { /// Modulation and Coding Scheme and Redundancy Version uint32_t mcs:4; /// Resource block assignment (assignment flag = 0 for 20 MHz, ceil(log2(floor(N_RB_DL/6)))+5) - uint32_t rballoc:9; + uint32_t rballoc:5; + /// narroband index log2(floor(N_RB_DL/6))) bits + uint32_t narrowband:4; /// Frequency hopping flag uint32_t hopping:1; /// 0/1A differentiator diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 8fa2f0ca22..c39879a771 100755 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -2103,7 +2103,11 @@ uint32_t rx_pucch(PHY_VARS_eNB *phy_vars_eNB, uint8_t *payload, int frame, uint8_t subframe, - uint8_t pucch1_thres); + uint8_t pucch1_thres +#ifdef Rel14 + ,uint8_t br_flag + ); +#endif int32_t rx_pucch_emul(PHY_VARS_eNB *phy_vars_eNB, eNB_rxtx_proc_t *proc, diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index bda998d0fb..d03ac16105 100755 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -1793,7 +1793,11 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, uint8_t *payload, int frame, uint8_t subframe, - uint8_t pucch1_thres) + uint8_t pucch1_thres +#ifdef Rel14 + ,uint8_t br_flag +#endif + ) { @@ -2057,14 +2061,25 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, //for (j=0,l=0;l<(nsymb-1);l++) { for (j=0,l=0; l>1)) && ((m&1) == 0)) - re_offset = (m*6) + frame_parms->first_carrier_offset; - else if ((l<(nsymb>>1)) && ((m&1) == 1)) - re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; - else if ((m&1) == 0) - re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; +#ifdef Rel14 + if (br_flag > 0 ) { + if ((m&1) == 0) + re_offset = (m*6) + frame_parms->first_carrier_offset; + else + re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; + } else - re_offset = ((m-1)*6) + frame_parms->first_carrier_offset; +#endif + { + if ((l<(nsymb>>1)) && ((m&1) == 0)) + re_offset = (m*6) + frame_parms->first_carrier_offset; + else if ((l<(nsymb>>1)) && ((m&1) == 1)) + re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; + else if ((m&1) == 0) + re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; + else + re_offset = ((m-1)*6) + frame_parms->first_carrier_offset; + } if (re_offset > frame_parms->ofdm_symbol_size) re_offset -= (frame_parms->ofdm_symbol_size); @@ -2159,9 +2174,9 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, printf("[eNB] PUCCH: stat %d, stat_max %d, phase_max %d\n", stat,stat_max,phase_max); #endif -#ifdef DEBUG_PUCCH_RX - LOG_D(PHY,"[eNB] PUCCH fmt1: stat_max : %d, sigma2_dB %d (%d, %d), phase_max : %d\n",dB_fixed(stat_max),sigma2_dB,eNB->measurements.n0_subband_power_tot_dBm[6],pucch1_thres,phase_max); -#endif + //#ifdef DEBUG_PUCCH_RX + LOG_I(PHY,"[eNB] PUCCH fmt1: stat_max : %d, sigma2_dB %d (%d, %d), phase_max : %d\n",dB_fixed(stat_max),sigma2_dB,eNB->measurements.n0_subband_power_tot_dBm[6],pucch1_thres,phase_max); + //#endif eNB->pucch1_stats[UE_id][(subframe<<10)+eNB->pucch1_stats_cnt[UE_id][subframe]] = stat_max; @@ -2368,7 +2383,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, #endif } - + #ifdef DEBUG_PUCCH_RX printf("[eNB] PUCCH subframe %d chest1[%d][%d] => (%d,%d)\n",subframe,aa,re, @@ -2416,9 +2431,10 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, } // aa - LOG_D(PHY,"PUCCH 1a/b: subframe %d : stat %d,%d (pos %d)\n",subframe,stat_re,stat_im, + LOG_I(PHY,"PUCCH 1a/b: SFN.SF %d.%d : stat %d,%d (pos %d)\n", + frame,subframe,stat_re,stat_im, (subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])); - LOG_D(PHY,"PUCCH 1a/b: subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres); + LOG_D(PHY,"PUCCH 1a/b: SFN.SF %d.%d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",frame,subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres); eNB->pucch1ab_stats[UE_id][(subframe<<11) + 2*(eNB->pucch1ab_stats_cnt[UE_id][subframe])] = (stat_re); eNB->pucch1ab_stats[UE_id][(subframe<<11) + 1+2*(eNB->pucch1ab_stats_cnt[UE_id][subframe])] = (stat_im); @@ -2432,7 +2448,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, if (fmt==pucch_format1b) *(1+payload) = (stat_im<0) ? 1 : 2; } else { // insufficient energy on PUCCH so NAK - LOG_I(PHY,"PUCCH 1a/b: subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres); + LOG_D(PHY,"PUCCH 1a/b: subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres); *payload = 4; // DTX ((int16_t*)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[0] = (int16_t)(stat_re); ((int16_t*)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[1] = (int16_t)(stat_im); diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index b8dc008aa2..fddea1a539 100755 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -74,6 +74,15 @@ void handle_nfapi_hi_dci0_dci_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, fill_dci0(eNB,proc,&pdcch_vars->dci_alloc[pdcch_vars->num_dci], &hi_dci0_config_pdu->dci_pdu); } +void handle_nfapi_hi_dci0_mpdcch_dci_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, + nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu) +{ + int idx = proc->subframe_tx&1; + LTE_eNB_PDCCH *pdcch_vars = &eNB->mpdcch_vars[idx]; + // copy dci configuration in to eNB structure + fill_mpdcch_dci0(eNB,proc,&pdcch_vars->dci_alloc[pdcch_vars->num_dci], &hi_dci0_config_pdu->dci_pdu); +} + void handle_nfapi_hi_dci0_hi_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu) { @@ -244,13 +253,13 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, AssertFatal(sdu!=NULL,"NFAPI: frame %d, subframe %d: programming dlsch for round 0, rnti %x, UE_id %d, harq_pid %d : sdu is null for pdu_index %d\n", proc->frame_tx,proc->subframe_tx,rel8->rnti,UE_id,harq_pid, dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index); - if (rel8->rnti != 0xFFFF) LOG_I(PHY,"NFAPI: frame %d, subframe %d: programming dlsch for round 0, rnti %x, UE_id %d, harq_pid %d\n", + if (rel8->rnti != 0xFFFF) LOG_D(PHY,"NFAPI: frame %d, subframe %d: programming dlsch for round 0, rnti %x, UE_id %d, harq_pid %d\n", proc->frame_tx,proc->subframe_tx,rel8->rnti,UE_id,harq_pid); if (codeword_index == 0) dlsch0_harq->pdu = sdu; else dlsch1_harq->pdu = sdu; } else { - if (rel8->rnti != 0xFFFF) LOG_I(PHY,"NFAPI: frame %d, subframe %d: programming dlsch for round %d, rnti %x, UE_id %d, harq_pid %d\n", + if (rel8->rnti != 0xFFFF) LOG_D(PHY,"NFAPI: frame %d, subframe %d: programming dlsch for round %d, rnti %x, UE_id %d, harq_pid %d\n", proc->frame_tx,proc->subframe_tx,dlsch0_harq->round, rel8->rnti,UE_id,harq_pid); } @@ -436,7 +445,11 @@ void handle_uci_sr_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_request_pdu_t uci->n_pucch_1_0_sr[0] = ul_config_pdu->uci_sr_pdu.sr_information.sr_information_rel8.pucch_index; uci->srs_active = srs_active; uci->active = 1; - +#ifdef Rel14 + uci->ue_type = ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel13.ue_type; + uci->empty_symbols = ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel13.empty_symbols; + uci->total_repetitions = ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel13.total_number_of_repetitions; +#endif LOG_D(PHY,"Programming UCI SR rnti %x, pucch1_0 %d for (%d,%d)\n", uci->rnti,uci->n_pucch_1_0_sr[0],frame,subframe); } @@ -454,7 +467,11 @@ void handle_uci_sr_harq_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_request_ uci->n_pucch_1_0_sr[0] = ul_config_pdu->uci_sr_harq_pdu.sr_information.sr_information_rel8.pucch_index; uci->srs_active = srs_active; uci->active = 1; - +#ifdef Rel14 + uci->ue_type = ul_config_pdu->uci_sr_harq_pdu.ue_information.ue_information_rel13.ue_type; + uci->empty_symbols = ul_config_pdu->uci_sr_harq_pdu.ue_information.ue_information_rel13.empty_symbols; + uci->total_repetitions = ul_config_pdu->uci_sr_harq_pdu.ue_information.ue_information_rel13.total_number_of_repetitions; +#endif handle_uci_harq_information(eNB,uci,&ul_config_pdu->uci_sr_harq_pdu.harq_information); } @@ -469,7 +486,11 @@ void handle_uci_harq_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_request_pdu uci->type = HARQ; uci->srs_active = srs_active; uci->num_antenna_ports = ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel11.num_ant_ports; - +#ifdef Rel14 + uci->ue_type = ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.ue_type; + uci->empty_symbols = ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.empty_symbols; + uci->total_repetitions = ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.total_number_of_repetitions; +#endif handle_uci_harq_information(eNB,uci,&ul_config_pdu->uci_harq_pdu.harq_information); uci->active=1; @@ -511,7 +532,7 @@ void handle_nfapi_ul_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, if (ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE) { AssertFatal((UE_id = find_ulsch(ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE))>=0, "No existing UE ULSCH for rnti %x\n",rel8->rnti); - LOG_D(PHY,"Applying UL config for UE %d, rnti %x for frame %d, subframe %d\n", + LOG_I(PHY,"Applying UL config for UE %d, rnti %x for frame %d, subframe %d\n", UE_id,rel8->rnti,frame,subframe); fill_ulsch(eNB,&ul_config_pdu->ulsch_pdu,frame,subframe); @@ -547,6 +568,9 @@ void handle_nfapi_ul_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, AssertFatal((UE_id = find_uci(ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti, proc->frame_tx,proc->subframe_tx,eNB,SEARCH_EXIST_OR_FREE))>=0, "No available UE UCI for rnti %x\n",ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti); + LOG_I(PHY,"Applying UL UCI_HARQ config for UE %d, rnti %x for frame %d, subframe %d\n", + UE_id,ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti,frame,subframe); + handle_uci_harq_pdu(eNB,UE_id,ul_config_pdu,frame,subframe,srs_present); } else if (ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE) { @@ -720,6 +744,11 @@ void schedule_response(Sched_Rsp_t *Sched_INFO) eNB->pdcch_vars[subframe&1].num_dci++; break; + case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE: + handle_nfapi_hi_dci0_mpdcch_dci_pdu(eNB,proc,hi_dci0_req_pdu); + eNB->mpdcch_vars[subframe&1].num_dci++; + break; + case NFAPI_HI_DCI0_HI_PDU_TYPE: handle_nfapi_hi_dci0_hi_pdu(eNB,proc,hi_dci0_req_pdu); diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 9339ebc49a..99f23200c8 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -688,8 +688,12 @@ uci_procedures (PHY_VARS_eNB * eNB, eNB_rxtx_proc_t * proc) metric_SR = rx_pucch (eNB, uci->pucch_fmt, i, uci->n_pucch_1_0_sr[0], 0, // n2_pucch uci->srs_active, // shortened format - &SR_payload, frame, subframe, PUCCH1_THRES); - LOG_D (PHY, "[eNB %d][SR %x] Frame %d subframe %d Checking SR is %d (SR n1pucch is %d)\n", eNB->Mod_id, uci->rnti, frame, subframe, SR_payload, uci->n_pucch_1_0_sr[0]); + &SR_payload, frame, subframe, PUCCH1_THRES +#ifdef Rel14 + ,uci->ue_type +#endif + ); + LOG_I (PHY, "[eNB %d][SR %x] Frame %d subframe %d Checking SR is %d (SR n1pucch is %d)\n", eNB->Mod_id, uci->rnti, frame, subframe, SR_payload, uci->n_pucch_1_0_sr[0]); if (uci->type == SR) { if (SR_payload == 1) { fill_sr_indication (eNB, uci->rnti, frame, subframe, metric_SR); @@ -705,8 +709,12 @@ uci_procedures (PHY_VARS_eNB * eNB, eNB_rxtx_proc_t * proc) metric[0] = rx_pucch (eNB, uci->pucch_fmt, i, uci->n_pucch_1[0][0], 0, //n2_pucch uci->srs_active, // shortened format - pucch_b0b1[0], frame, subframe, PUCCH1a_THRES); - + pucch_b0b1[0], frame, subframe, PUCCH1a_THRES +#ifdef Rel14 + ,uci->ue_type +#endif + ); + /* cancel SR detection if reception on n1_pucch0 is better than on SR PUCCH resource index, otherwise send it up to MAC */ if (uci->type == HARQ_SR && metric[0] > metric_SR) @@ -717,10 +725,14 @@ uci_procedures (PHY_VARS_eNB * eNB, eNB_rxtx_proc_t * proc) if (uci->type == HARQ_SR && metric[0] <= metric_SR) { /* when transmitting ACK/NACK on SR PUCCH resource index, SR payload is always 1 */ SR_payload = 1; - - metric[0] = rx_pucch (eNB, uci->pucch_fmt, i, uci->n_pucch_1_0_sr[0], 0, //n2_pucch - uci->srs_active, // shortened format - pucch_b0b1[0], frame, subframe, PUCCH1a_THRES); + + metric[0] = rx_pucch(eNB, uci->pucch_fmt, i, uci->n_pucch_1_0_sr[0], 0, //n2_pucch + uci->srs_active, // shortened format + pucch_b0b1[0], frame, subframe, PUCCH1a_THRES +#ifdef Rel14 + ,uci->ue_type +#endif + ); } @@ -741,7 +753,11 @@ uci_procedures (PHY_VARS_eNB * eNB, eNB_rxtx_proc_t * proc) metric[0] = rx_pucch (eNB, pucch_format1b, i, uci->n_pucch_1_0_sr[0], 0, //n2_pucch uci->srs_active, // shortened format - pucch_b0b1[0], frame, subframe, PUCCH1a_THRES); + pucch_b0b1[0], frame, subframe, PUCCH1a_THRES +#ifdef Rel14 + ,uci->ue_type +#endif + ); } else { //using assigned pucch resources #ifdef DEBUG_PHY_PROC LOG_D (PHY, "[eNB %d][PDSCH %x] Frame %d subframe %d Checking ACK/NAK M=%d (%d,%d,%d,%d) format %d\n", eNB->Mod_id, @@ -751,7 +767,11 @@ uci_procedures (PHY_VARS_eNB * eNB, eNB_rxtx_proc_t * proc) for (res = 0; res < uci->num_pucch_resources; res++) metric[res] = rx_pucch (eNB, uci->pucch_fmt, i, uci->n_pucch_1[res][0], 0, // n2_pucch uci->srs_active, // shortened format - pucch_b0b1[res], frame, subframe, PUCCH1a_THRES); + pucch_b0b1[res], frame, subframe, PUCCH1a_THRES +#ifdef Rel14 + ,uci->ue_type +#endif + ); diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 267392d684..9eeb545325 100755 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -916,6 +916,8 @@ typedef struct { int msg4_mcs; /// size off piggybacked RRC SDU uint8_t msg4_rrc_sdu_length; + uint32_t msg4_delay; + #ifdef Rel14 uint8_t rach_resource_type; uint8_t msg2_mpdcch_repetition_cnt; diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 6bcbc13106..8286e2dfd8 100755 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -246,7 +246,7 @@ void schedule_SR(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n",UE_id); // drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet - if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP,UE_id)) < RRC_CONNECTED) continue; + // if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP,UE_id)) < RRC_CONNECTED) continue; if ((SRconfig = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->schedulingRequestConfig)!=NULL) { if (SRconfig->present == SchedulingRequestConfig_PR_setup) { @@ -294,7 +294,7 @@ void schedule_SR(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) // drop the allocation because ULSCH with handle it with BSR if (skip_ue==1) continue; - LOG_D(MAC,"Frame %d, Subframe %d : Scheduling SR for UE %d/%x\n",frameP,subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].rnti); + LOG_I(MAC,"Frame %d, Subframe %d : Scheduling SR for UE %d/%x\n",frameP,subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].rnti); // check Rel10 or Rel8 SR #if defined(Rel10) || defined(Rel14) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 468fd27bc0..ab339758b6 100755 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -165,7 +165,7 @@ add_msg3 (module_id_t module_idP, int CC_id, RA_TEMPLATE * RA_template, frame_t for (j = 0; j < RA_template->msg3_nb_rb; j++) cc->vrb_map_UL[RA_template->msg3_first_rb + j] = 1; - LOG_D (MAC, "[eNB %d][PUSCH-RA %x] CC_id %d Frame %d subframeP %d Scheduled (PHICH) RA (mcs %d, first rb %d, nb_rb %d,round %d)\n", + LOG_I (MAC, "[eNB %d][PUSCH-RA %x] CC_id %d Frame %d subframeP %d Scheduled (PHICH) RA (mcs %d, first rb %d, nb_rb %d,round %d)\n", module_idP, RA_template->rnti, CC_id, frameP, subframeP, 10, 1, 1, RA_template->msg3_round - 1); } // if (RA_template->msg3_round != 0) { // program HI too } // non-BL/CE UE case @@ -560,6 +560,7 @@ generate_Msg4 (module_id_t module_idP, int CC_idP, frame_t frameP, sub_frame_t s dl_req = &eNB->DL_req[CC_idP].dl_config_request_body; dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; + N_RB_DL = to_prb (cc[CC_idP].mib->message.dl_Bandwidth); UE_id = find_UE_id (module_idP, RA_template->rnti); @@ -573,7 +574,10 @@ generate_Msg4 (module_id_t module_idP, int CC_idP, frame_t frameP, sub_frame_t s RA_template->harq_pid = ((frameP * 10) + subframeP) & 7; - + if (RA_template->msg4_delay < 8) { + RA_template->msg4_delay++; + return; + } #ifdef Rel14 if (RA_template->rach_resource_type > 0) { @@ -606,7 +610,7 @@ generate_Msg4 (module_id_t module_idP, int CC_idP, frame_t frameP, sub_frame_t s AssertFatal (RA_template->msg4_rrc_sdu_length > 0, "[MAC][eNB Scheduler] CCCH not allocated\n"); - LOG_I (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: UE_id %d, rrc_sdu_length %d\n", module_idP, CC_idP, frameP, subframeP, UE_id, RA_template->msg4_rrc_sdu_length); + LOG_I (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: UE_id %d, rrc_sdu_length %d, dl_req->num_pdu %d\n", module_idP, CC_idP, frameP, subframeP, UE_id, RA_template->msg4_rrc_sdu_length,dl_req->number_pdu); // MPDCCH configuration for Msg4 RA_template->msg4_mpdcch_done=0; @@ -614,33 +618,33 @@ generate_Msg4 (module_id_t module_idP, int CC_idP, frame_t frameP, sub_frame_t s dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE; dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu)); dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_format = (RA_template->rach_resource_type > 1) ? 11 : 10; - dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = RA_template->msg34_narrowband; + dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = RA_template->msg2_narrowband; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = 6; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic - dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1; - AssertFatal (cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 != NULL, "cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n"); + dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1; // imposed (9.1.5 in 213) for Type 2 Common search space + AssertFatal (cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 != NULL, "cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n"); dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = 0; // Note: this should be dynamic dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4 - dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = 0; // t-C-RNTI + dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = 0; // t-CRNTI dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti = RA_template->rnti; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = (RA_template->rach_resource_type < 3) ? 1 : 2; - dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = cc[CC_idP].physCellId; /// Check this is still N_id_cell for type2 common + dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = cc[CC_idP].physCellId; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = 6000; // 0dB - dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV (6, 0, 6); // check if not getRIV(N_RB_DL,first_rb,6); - dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 4; // adjust according to size of Msg4 - dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = 0; // fix to 0 for now + dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV (6, 0, 6); + dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB=3 + dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = 0; // fix to 4 for now dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = 0; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = 0; - dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process = RA_template->harq_pid; + dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process = 0; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length = 0; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi = 0; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag = 0; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi = 0; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = 0; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = rep; - dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 3; + dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 3; // N1A_PRB=3 (36.212) => 56 bits dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = 0; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = 0; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = 0; @@ -655,6 +659,7 @@ generate_Msg4 (module_id_t module_idP, int CC_idP, frame_t frameP, sub_frame_t s dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.direct_indication = 0; dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding = 0; // this is not needed by OAI L1, but should be filled in dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports = 1; + RA_template->msg4_mpdcch_repetition_cnt++; dl_req->number_pdu++; RA_template->msg4_TBsize = get_TBS_DL(dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs, @@ -662,7 +667,9 @@ generate_Msg4 (module_id_t module_idP, int CC_idP, frame_t frameP, sub_frame_t s } //repetition_count==0 && SF condition met if ((RA_template->msg4_mpdcch_repetition_cnt > 0)&& - (RA_template->msg4_mpdcch_done==0)) { // we're in a stream of repetitions + (RA_template->msg4_mpdcch_done==0)) { // we're in a stream of repetitions + LOG_I(MAC,"SFN.SF %d.%d : msg4 mpdcch repetition number %d/%d\n", + frameP,subframeP,RA_template->msg4_mpdcch_repetition_cnt,reps); if (RA_template->msg4_mpdcch_repetition_cnt == reps) { // this is the last mpdcch repetition RA_template->msg4_mpdcch_done = 1; if (cc[CC_idP].tdd_Config == NULL) { // FDD case @@ -768,9 +775,9 @@ generate_Msg4 (module_id_t module_idP, int CC_idP, frame_t frameP, sub_frame_t s eNB->TX_req[CC_idP].tx_request_body.number_of_pdus++; // Program ACK/NAK for Msg4 PDSCH - int absSF = (RA_template->Msg3_frame * 10) + RA_template->Msg3_subframe; + int absSF = (frameP * 10) + subframeP; // see Section 10.2 from 36.213 - int ackNAK_absSF = absSF + reps + 4; + int ackNAK_absSF = absSF + reps + 3; AssertFatal (reps == 1, "Have to handle programming of ACK when PDSCH repetitions is > 1\n"); ul_req = &eNB->UL_req_tmp[CC_idP][ackNAK_absSF % 10].ul_config_request_body; ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus]; @@ -1015,7 +1022,7 @@ check_Msg4_retransmission (module_id_t module_idP, int CC_idP, frame_t frameP, s dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; N_RB_DL = to_prb (cc[CC_idP].mib->message.dl_Bandwidth); - LOG_D (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Checking if Msg4 for harq_pid %d was acknowledged (round %d)\n", module_idP, CC_idP, frameP, subframeP, RA_template->harq_pid, round); + LOG_I (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Checking if Msg4 for harq_pid %d was acknowledged (round %d)\n", module_idP, CC_idP, frameP, subframeP, RA_template->harq_pid, round); if (round != 8) { @@ -1096,7 +1103,7 @@ check_Msg4_retransmission (module_id_t module_idP, int CC_idP, frame_t frameP, s } // Msg4 frame/subframe } // regular LTE case } else { - LOG_D (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d : Msg4 acknowledged\n", module_idP, CC_idP, frameP, subframeP); + LOG_I (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d : Msg4 acknowledged\n", module_idP, CC_idP, frameP, subframeP); RA_template->wait_ack_Msg4 = 0; RA_template->RA_active = FALSE; UE_id = find_UE_id (module_idP, RA_template->rnti); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c index 7f32165008..0c7b457c6f 100755 --- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c @@ -400,7 +400,8 @@ schedule_SI_BR( vrb_map[first_rb+4] = 1; vrb_map[first_rb+5] = 1; - if ((frameP&1023) < 200) LOG_D(MAC,"[eNB %d] Frame %d Subframe %d: SI_BR->DLSCH CC_id %d, Narrowband %d rvidx %d (sf_mod_period %d : si_WindowLength_BR_r13 %d : si_RepetitionPattern_r13 %d) bcch_sdu_length %d\n", + //if ((frameP&1023) < 200) + LOG_D(MAC,"[eNB %d] Frame %d Subframe %d: SI_BR->DLSCH CC_id %d, Narrowband %d rvidx %d (sf_mod_period %d : si_WindowLength_BR_r13 %d : si_RepetitionPattern_r13 %d) bcch_sdu_length %d\n", module_idP,frameP,subframeP,CC_id,(int)si_Narrowband_r13-1,rvidx, sf_mod_period,(int)si_WindowLength_BR_r13,(int)si_RepetitionPattern_r13, bcch_sdu_length); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 1966d5254e..e44fb518d6 100755 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -3602,7 +3602,7 @@ void SR_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, sub_frame_t if (UE_id != -1) { if (mac_eNB_get_rrc_status(mod_idP,UE_RNTI(mod_idP,UE_id)) < RRC_CONNECTED) - LOG_D(MAC,"[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d on CC_id %d\n",mod_idP,rntiP,frameP,subframeP, UE_id,cc_idP); + LOG_I(MAC,"[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d on CC_id %d\n",mod_idP,rntiP,frameP,subframeP, UE_id,cc_idP); #if 0 UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 957cdf82ac..e589057520 100755 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -793,13 +793,24 @@ void schedule_ulsch(module_id_t module_idP, break; } } + +#ifdef Rel14 + int emtc_active[5]; + memset(emtc_active,0,5*sizeof(int)); + schedule_ulsch_rnti_emtc(module_idP, frameP, subframeP, sched_subframe, emtc_active); +#endif + for (CC_id=0; CC_idschedule_ulsch); } @@ -881,6 +892,8 @@ void schedule_ulsch_rnti(module_id_t module_idP, // loop over all active UEs for (UE_id=UE_list->head_ul; UE_id>=0; UE_id=UE_list->next_ul[UE_id]) { + if (UE_list->UE_template[UE_PCCID(module_idP,UE_id)][UE_id].rach_resource_type > 0) continue; + // don't schedule if Msg4 is not received yet if (UE_list->UE_template[UE_PCCID(module_idP,UE_id)][UE_id].configured==FALSE) { LOG_D(MAC,"[eNB %d] frame %d subfarme %d, UE %d: not configured, skipping UE scheduling \n", @@ -1132,15 +1145,7 @@ abort(); get_TBS_UL(UE_template->mcs_UL[harq_pid], rb_table[rb_table_index]) ); -#ifdef Rel14 - if (UE_template->rach_resource_type>0) { // This is a BL/CE UE allocation - fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus], - UE_template->rach_resource_type>2 ? 2 : 1, - 1, //total_number_of_repetitions - 1, //repetition_number - (frameP*10)+subframeP); - } -#endif + ul_req_tmp->number_of_pdus++; eNB->ul_handle++; @@ -1198,15 +1203,6 @@ abort(); 0, // n_srs UE_template->TBS_UL[harq_pid] ); -#ifdef Rel14 - if (UE_template->rach_resource_type>0) { // This is a BL/CE UE allocation - fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus], - UE_template->rach_resource_type>2 ? 2 : 1, - 1, //total_number_of_repetitions - 1, //repetition_number - (frameP*10)+subframeP); - } -#endif ul_req_tmp->number_of_pdus++; eNB->ul_handle++; @@ -1244,3 +1240,323 @@ abort(); } // loop over UE_id } // loop of CC_id } + +#ifdef Rel14 +void schedule_ulsch_rnti_emtc(module_id_t module_idP, + frame_t frameP, + sub_frame_t subframeP, + unsigned char sched_subframeP, + uint16_t *emtc_active) +{ + int UE_id; + rnti_t rnti = -1; + uint8_t round = 0; + uint8_t harq_pid = 0; + uint8_t status = 0; + uint32_t cqi_req,cshift,ndi,tpc; + int32_t normalized_rx_power; + int32_t target_rx_power=-90; + static int32_t tpc_accumulated=0; + int n; + int CC_id = 0; + int N_RB_UL; + eNB_MAC_INST *eNB = RC.mac[module_idP]; + COMMON_channels_t *cc = eNB->common_channels; + UE_list_t *UE_list=&eNB->UE_list; + UE_TEMPLATE *UE_template; + UE_sched_ctrl *UE_sched_ctrl; + int sched_frame=frameP; + int rvidx_tab[4] = {0,2,3,1}; + + if (sched_subframePHI_DCI0_req[CC_id].hi_dci0_request_body; + nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu; + + nfapi_ul_config_request_body_t *ul_req_tmp = &eNB->UL_req_tmp[CC_id][sched_subframeP].ul_config_request_body; + + // loop over all active UEs + for (UE_id=UE_list->head_ul; UE_id>=0; UE_id=UE_list->next_ul[UE_id]) { + + if (UE_list->UE_template[UE_PCCID(module_idP,UE_id)][UE_id].rach_resource_type == 0) continue; + + // don't schedule if Msg4 is not received yet + if (UE_list->UE_template[UE_PCCID(module_idP,UE_id)][UE_id].configured==FALSE) { + LOG_D(MAC,"[eNB %d] frame %d subfarme %d, UE %d: not configured, skipping UE scheduling \n", + module_idP,frameP,subframeP,UE_id); + continue; + } + + rnti = UE_RNTI(module_idP,UE_id); + + if (rnti==NOT_A_RNTI) { + LOG_W(MAC,"[eNB %d] frame %d subfarme %d, UE %d: no RNTI \n", module_idP,frameP,subframeP,UE_id); + continue; + } + + // loop over all active UL CC_ids for this UE + for (n=0; nnumactiveULCCs[UE_id]; n++) { + // This is the actual CC_id in the list + CC_id = UE_list->ordered_ULCCids[n][UE_id]; + N_RB_UL = to_prb(cc[CC_id].ul_Bandwidth); + + + UE_template = &UE_list->UE_template[CC_id][UE_id]; + UE_sched_ctrl = &UE_list->UE_sched_ctrl[UE_id]; + harq_pid = 0; + round = UE_sched_ctrl->round_UL[CC_id][harq_pid]; + AssertFatal(round<8,"round %d > 7 for UE %d/%x\n",round,UE_id,rnti); + LOG_D(MAC,"[eNB %d] frame %d subframe %d,Checking PUSCH %d for BL/CE UE %d/%x CC %d : aggregation level %d, N_RB_UL %d\n", + module_idP,frameP,subframeP,harq_pid,UE_id,rnti,CC_id, 24,N_RB_UL); + + RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP] = UE_template->ul_total_buffer; + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO,RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP]); + if (UE_is_to_be_scheduled(module_idP,CC_id,UE_id) > 0 || round > 0)// || ((frameP%10)==0)) + // if there is information on bsr of DCCH, DTCH or if there is UL_SR, or if there is a packet to retransmit, or we want to schedule a periodic feedback every 10 frames + { + LOG_I(MAC,"[eNB %d][PUSCH %d] Frame %d subframe %d Scheduling UE %d/%x in round %d(SR %d,UL_inactivity timer %d,UL_failure timer %d,cqi_req_timer %d)\n", + module_idP,harq_pid,frameP,subframeP,UE_id,rnti,round,UE_template->ul_SR, + UE_sched_ctrl->ul_inactivity_timer, + + UE_sched_ctrl->ul_failure_timer, + + UE_sched_ctrl->cqi_req_timer); + // reset the scheduling request + emtc_active[CC_id]=1; + UE_template->ul_SR = 0; + status = mac_eNB_get_rrc_status(module_idP,rnti); + if (status < RRC_CONNECTED) + cqi_req = 0; + else if (UE_sched_ctrl->cqi_req_timer>30) { + cqi_req = 1; + UE_sched_ctrl->cqi_req_timer=0; + } + else + cqi_req = 0; + + //power control + //compute the expected ULSCH RX power (for the stats) + + // this is the normalized RX power and this should be constant (regardless of mcs + normalized_rx_power = UE_sched_ctrl->pusch_snr[CC_id]; + target_rx_power = 178; + + // this assumes accumulated tpc + // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out + int32_t framex10psubframe = UE_template->pusch_tpc_tx_frame*10+UE_template->pusch_tpc_tx_subframe; + if (((framex10psubframe+10)<=(frameP*10+subframeP)) || //normal case + ((framex10psubframe>(frameP*10+subframeP)) && (((10240-framex10psubframe+frameP*10+subframeP)>=10)))) //frame wrap-around + { + UE_template->pusch_tpc_tx_frame=frameP; + UE_template->pusch_tpc_tx_subframe=subframeP; + if (normalized_rx_power>(target_rx_power+4)) { + tpc = 0; //-1 + tpc_accumulated--; + } else if (normalized_rx_power<(target_rx_power-4)) { + tpc = 2; //+1 + tpc_accumulated++; + } else { + tpc = 1; //0 + } + } else { + tpc = 1; //0 + } + //tpc = 1; + if (tpc!=1) { + LOG_D(MAC,"[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n", + module_idP,frameP,subframeP,harq_pid,tpc, + tpc_accumulated,normalized_rx_power,target_rx_power); + } + + // new transmission + if (round==0) { + + ndi = 1-UE_template->oldNDI_UL[harq_pid]; + UE_template->oldNDI_UL[harq_pid]=ndi; + UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power=normalized_rx_power; + UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power=target_rx_power; + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1=4; + UE_template->mcs_UL[harq_pid] = 4; + + + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=UE_template->mcs_UL[harq_pid]; + // buffer_occupancy = UE_template->ul_total_buffer; + + + + UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid],6); + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx+=6; + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS=UE_template->TBS_UL[harq_pid]; + // buffer_occupancy -= TBS; + + T(T_ENB_MAC_UE_UL_SCHEDULE, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), + T_INT(subframeP), T_INT(harq_pid), T_INT(UE_template->mcs_UL[harq_pid]), T_INT(0), T_INT(6), + T_INT(UE_template->TBS_UL[harq_pid]), T_INT(ndi)); + + if (mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED) + LOG_D(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE %d (mcs %d, first rb %d, nb_rb %d, TBS %d, harq_pid %d)\n", + module_idP,harq_pid,rnti,CC_id,frameP,subframeP,UE_id,UE_template->mcs_UL[harq_pid], + 0,6, + UE_template->TBS_UL[harq_pid],harq_pid); + + // bad indices : 20 (40 PRB), 21 (45 PRB), 22 (48 PRB) + //store for possible retransmission + UE_template->nb_rb_ul[harq_pid] = 6; + UE_template->first_rb_ul[harq_pid] = 0; + + UE_sched_ctrl->ul_scheduled |= (1<head) + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SCHEDULED,UE_sched_ctrl->ul_scheduled); + + // adjust total UL buffer status by TBS, wait for UL sdus to do final update + LOG_D(MAC,"[eNB %d] CC_id %d UE %d/%x : adjusting ul_total_buffer, old %d, TBS %d\n", module_idP,CC_id,UE_id,rnti,UE_template->ul_total_buffer,UE_template->TBS_UL[harq_pid]); + if (UE_template->ul_total_buffer > UE_template->TBS_UL[harq_pid]) + UE_template->ul_total_buffer -= UE_template->TBS_UL[harq_pid]; + else + UE_template->ul_total_buffer = 0; + LOG_D(MAC,"ul_total_buffer, new %d\n", UE_template->ul_total_buffer); + // Cyclic shift for DM RS + cshift = 0;// values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1) + // save it for a potential retransmission + UE_template->cshift[harq_pid] = cshift; + + LOG_I(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL 6-0A MPDCCH for BL/CE UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", + harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP); + AssertFatal (UE_template->physicalConfigDedicated != NULL, + "UE_template->physicalConfigDedicated is null\n"); + AssertFatal (UE_template->physicalConfigDedicated->ext4 != NULL, + "UE_template->physicalConfigDedicated->ext4 is null\n"); + AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 != NULL, + "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 is null\n"); + AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present == EPDCCH_Config_r11__config_r11_PR_setup, + "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present != setup\n"); + AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 != NULL, + "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = NULL\n"); + EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11 = UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0]; + AssertFatal(epdcch_setconfig_r11 != NULL, "epdcch_setconfig_r11 is null\n"); + AssertFatal(epdcch_setconfig_r11->ext2!=NULL, "epdcch_setconfig_r11->ext2 is null\n"); + AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13!=NULL, + "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null"); + AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13!=NULL, + "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null"); + AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->present==EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13_PR_setup, + "epdcch_setconfig_r11->ext2->mpdcch_config_r13->present is not setup\n"); + AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310!=NULL, + "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 is null"); + AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present==EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310_PR_setup, + "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present is not setup\n"); + + hi_dci0_pdu = &hi_dci0_req->hi_dci0_pdu_list[eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_dci+eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_hi]; + memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t)); + + hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE; + hi_dci0_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu)); + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_format = (UE_template->rach_resource_type > 1) ? 5 : 4; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type > 1) ? 2 : 1; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_narrowband = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13; + + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_prb_pairs = 6; // checked above that it has to be this + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_transmission_type = epdcch_setconfig_r11->transmissionType_r11; // distibuted + + AssertFatal(UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11!=NULL, + "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 is null\n"); + + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.start_symbol = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ecce_index = 0; // Note: this should be dynamic + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.aggreagation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4 + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti_type = 4; // other + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti = rnti; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type < 3) ? 1 : 2; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.drms_scrambling_init = epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.transmission_power = 6000; // 0dB + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_start = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_resource_blocks = 6; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB=3 + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.pusch_repetition_levels = 0; + AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13==0, + "epdcch_setconfig_r11->ext2->mpdcch_config_r13->mpdcch_pdsch_HoppingConfig_r13 is not 0\n"); + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.frequency_hopping_flag = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.redudency_version = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.new_data_indication = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.harq_process = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tpc = tpc; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.csi_request = cqi_req; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ul_inex = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dai_presence_flag = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dl_assignment_index = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.srs_request = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_subframe_repetition_number = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tcp_bitmap = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.total_dci_length_include_padding = 29; // hard-coded for 10 MHz + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_tx_antenna_ports = 1; + + eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_dci++; + + + LOG_I(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for BL/CE UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", + harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP); + + + fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus], + cqi_req, + cc, + UE_template->physicalConfigDedicated, + get_tmode(module_idP,CC_id,UE_id), + eNB->ul_handle, + rnti, + UE_template->first_rb_ul[harq_pid], // resource_block_start + UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks + UE_template->mcs_UL[harq_pid], + cshift, // cyclic_shift_2_for_drms + 0, // frequency_hopping_enabled_flag + 0, // frequency_hopping_bits + UE_template->oldNDI_UL[harq_pid], // new_data_indication + rvidx_tab[round&3], // redundancy_version + harq_pid, // harq_process_number + 0, // ul_tx_mode + 0, // current_tx_nb + 0, // n_srs + UE_template->TBS_UL[harq_pid] + ); + fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus], + UE_template->rach_resource_type>2 ? 2 : 1, + 1, //total_number_of_repetitions + 1, //repetition_number + (frameP*10)+subframeP); + + + ul_req_tmp->number_of_pdus++; + eNB->ul_handle++; + + add_ue_ulsch_info(module_idP, + CC_id, + UE_id, + subframeP, + S_UL_SCHEDULED); + + LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n", module_idP,CC_id,frameP,subframeP,UE_id); + + } + else { // round > 0 => retransmission + T(T_ENB_MAC_UE_UL_SCHEDULE_RETRANSMISSION, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), + T_INT(subframeP), T_INT(harq_pid), T_INT(UE_template->mcs_UL[harq_pid]), T_INT(0), T_INT(6), + T_INT(round)); + + + fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus], + UE_template->rach_resource_type>2 ? 2 : 1, + 1, //total_number_of_repetitions + 1, //repetition_number + (frameP*10)+subframeP); + + ul_req_tmp->number_of_pdus++; + eNB->ul_handle++; + + } + } // UE_is_to_be_scheduled + } // ULCCs + } // loop over UE_id +} +#endif diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index 612f64fe61..1fb09d63d0 100755 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -1131,6 +1131,8 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP, for (i=UE_list->head_ul; i>=0; i=UE_list->next_ul[i]) { + if (UE_list->UE_template[CC_id][UE_id].rach_resource_type > 0) continue; + rnti = UE_RNTI(module_idP,i); if (rnti==NOT_A_RNTI) diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index 18dd7f15ce..05d87f7b43 100755 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -2560,7 +2560,9 @@ do_RRCConnectionSetup_BR( epdcch_setconfig_r11->re_MappingQCL_ConfigId_r11 = NULL; epdcch_setconfig_r11->ext2 = calloc(1, sizeof(struct EPDCCH_SetConfig_r11__ext2)); - epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 = NULL; + epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 = calloc(1,sizeof(struct EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310)); + epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present = EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310_PR_setup; + epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->choice.setup = EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310__setup_n6; epdcch_setconfig_r11->ext2->mpdcch_config_r13 = calloc(1, sizeof(struct EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13)); epdcch_setconfig_r11->ext2->mpdcch_config_r13->present = EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13_PR_setup; epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.csi_NumRepetitionCE_r13 = EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__csi_NumRepetitionCE_r13_sf1; @@ -2571,6 +2573,7 @@ do_RRCConnectionSetup_BR( epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 = 2; ASN_SEQUENCE_ADD(physicalConfigDedicated2->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11, epdcch_setconfig_r11); + // FIXME allocate physicalConfigDedicated2->ext7 physicalConfigDedicated2->ext7 = CALLOC(1, sizeof(struct PhysicalConfigDedicated__ext7)); diff --git a/openair2/RRC/LITE/rrc_common.c b/openair2/RRC/LITE/rrc_common.c index 0e836f5677..9ae9606127 100755 --- a/openair2/RRC/LITE/rrc_common.c +++ b/openair2/RRC/LITE/rrc_common.c @@ -329,8 +329,11 @@ rrc_rx_tx( check_handovers(ctxt_pP); // counetr, and get the value and aggregate + // check for UL failure RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { + LOG_I(RRC,"SFN.SN %d.%d => release timer %d/%d\n",ctxt_pP->frame,ctxt_pP->subframe, + ue_context_p->ue_context.ue_release_timer,ue_context_p->ue_context.ue_release_timer_thres); if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) { if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/20000\n", @@ -348,7 +351,7 @@ rrc_rx_tx( ue_context_p->ue_context.ul_failure_timer++; if (ue_context_p->ue_context.ul_failure_timer >= 20000) { // remove UE after 20 seconds after MAC has indicated UL failure - LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); + LOG_I(RRC,"Removing UE %x instance (failure)\n",ue_context_p->ue_context.rnti); ue_to_be_removed = ue_context_p; break; } @@ -357,8 +360,9 @@ rrc_rx_tx( ue_context_p->ue_context.ue_release_timer++; if (ue_context_p->ue_context.ue_release_timer >= ue_context_p->ue_context.ue_release_timer_thres) { - LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); + LOG_I(RRC,"Removing UE %x instance (release timer %d)\n",ue_context_p->ue_context.rnti,ue_context_p->ue_context.ue_release_timer); ue_to_be_removed = ue_context_p; + exit(-1); break; } } diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 559f58ab4b..22aff3299d 100755 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -873,6 +873,7 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* #endif #endif + LOG_I(RRC,"Removing ue %x (rrc_eNB_free_UE)\n",rnti); rrc_mac_remove_ue(enb_mod_idP,rnti); rrc_rlc_remove_ue(&ctxt); pdcp_remove_UE(&ctxt);