diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 1bafeff8d1951b9e5bad0cd46b05381639f9fa4f..397cf376197f7259d44fc254b2b088356cb28c05 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -61,8 +61,8 @@ #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 -int choose(int n,int k) { - +int choose(int n,int k) +{ int res = 1; int res2 = 1; int i; @@ -77,8 +77,8 @@ int choose(int n,int k) { } // Patented algorithm from Yang et al, US Patent 2009, "Channel Quality Indexing and Reverse Indexing" -void reverse_index(int N,int M,int r,int *v) { - +void reverse_index(int N,int M,int r,int *v) +{ int BaseValue=0; int IncreaseValue,ThresholdValue; int sumV; @@ -90,7 +90,6 @@ void reverse_index(int N,int M,int r,int *v) { sumV=0; i=M; while (i>0 && r>0) { - IncreaseValue = choose(N-M+1-sumV-v[i-1]+i-2,i-1); ThresholdValue = BaseValue+IncreaseValue; if (r>=ThresholdValue) { @@ -103,38 +102,39 @@ void reverse_index(int N,int M,int r,int *v) { i--; BaseValue=0; } - } - } -int to_prb(int dl_Bandwidth) { + +int to_prb(int dl_Bandwidth) +{ int prbmap[6] = {6,15,25,50,75,100}; AssertFatal(dl_Bandwidth < 6,"dl_Bandwidth is 0..5\n"); return(prbmap[dl_Bandwidth]); } -int to_rbg(int dl_Bandwidth) { +int to_rbg(int dl_Bandwidth) +{ int rbgmap[6] = {6,8,13,17,19,25}; AssertFatal(dl_Bandwidth < 6,"dl_Bandwidth is 0..5\n"); return(rbgmap[dl_Bandwidth]); } - -int get_phich_resource_times6(COMMON_channels_t *cc) { +int get_phich_resource_times6(COMMON_channels_t *cc) +{ int phichmap[4] = {1,3,6,12}; AssertFatal(cc!=NULL,"cc is null\n"); AssertFatal(cc->mib!=NULL,"cc->mib is null\n"); - AssertFatal((cc->mib->message.phich_Config.phich_Resource>=0) && - (cc->mib->message.phich_Config.phich_Resource<4), - "phich_Resource %d not in 0..3\n",(int)cc->mib->message.phich_Config.phich_Resource); + AssertFatal((cc->mib->message.phich_Config.phich_Resource>=0) && + (cc->mib->message.phich_Config.phich_Resource<4), + "phich_Resource %d not in 0..3\n",(int)cc->mib->message.phich_Config.phich_Resource); return(phichmap[cc->mib->message.phich_Config.phich_Resource]); } -uint16_t mac_computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs) { - +uint16_t mac_computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs) +{ uint16_t RIV; if (Lcrbs<=(1+(N_RB_DL>>1))) @@ -145,8 +145,8 @@ uint16_t mac_computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs) { return(RIV); } -uint8_t getQm(uint8_t mcs) { - +uint8_t getQm(uint8_t mcs) +{ if (mcs<10) return(2); else if (mcs<17) return(4); else return (6); @@ -154,12 +154,11 @@ uint8_t getQm(uint8_t mcs) { void get_Msg3alloc(COMMON_channels_t *cc, - sub_frame_t current_subframe, - frame_t current_frame, - frame_t *frame, - sub_frame_t *subframe) + sub_frame_t current_subframe, + frame_t current_frame, + frame_t *frame, + sub_frame_t *subframe) { - // Fill in other TDD Configuration!!!! if (cc->tdd_Config==NULL) { // FDD @@ -221,56 +220,56 @@ void get_Msg3alloc(COMMON_channels_t *cc, break; } } else if (cc->tdd_Config->subframeAssignment == 4) { - switch (current_subframe) { - - case 0: - case 4: - case 5: - case 6: - *subframe = 2; - *frame = (current_frame+1) & 1023; - break; + switch (current_subframe) { - case 7: - *subframe = 3; - *frame = (current_frame+1) & 1023; - break; + case 0: + case 4: + case 5: + case 6: + *subframe = 2; + *frame = (current_frame+1) & 1023; + break; - case 8: - case 9: - *subframe = 2; - *frame = (current_frame+2) & 1023; - break; - } - } else if (cc->tdd_Config->subframeAssignment == 5) { - switch (current_subframe) { - - case 0: - case 4: - case 5: - case 6: - *subframe = 2; - *frame = (current_frame+1) & 1023; - break; - - case 7: - case 8: - case 9: - *subframe = 2; - *frame = (current_frame+2) & 1023; - break; - } - } + case 7: + *subframe = 3; + *frame = (current_frame+1) & 1023; + break; + + case 8: + case 9: + *subframe = 2; + *frame = (current_frame+2) & 1023; + break; + } + } else if (cc->tdd_Config->subframeAssignment == 5) { + switch (current_subframe) { + + case 0: + case 4: + case 5: + case 6: + *subframe = 2; + *frame = (current_frame+1) & 1023; + break; + + case 7: + case 8: + case 9: + *subframe = 2; + *frame = (current_frame+2) & 1023; + break; + } + } } } void get_Msg3allocret(COMMON_channels_t *cc, - sub_frame_t current_subframe, - frame_t current_frame, - frame_t *frame, - sub_frame_t *subframe) + sub_frame_t current_subframe, + frame_t current_frame, + frame_t *frame, + sub_frame_t *subframe) { if (cc->tdd_Config == NULL) { //FDD /* always retransmit in n+8 */ @@ -314,9 +313,7 @@ uint8_t subframe2harqpid(COMMON_channels_t *cc,frame_t frame,sub_frame_t subfram if (cc->tdd_Config == NULL) { // FDD ret = (((frame<<1)+subframe)&7); } else { - switch (cc->tdd_Config->subframeAssignment) { - case 1: if ((subframe==2) || (subframe==3) || @@ -334,7 +331,7 @@ uint8_t subframe2harqpid(COMMON_channels_t *cc,frame_t frame,sub_frame_t subfram break; default: - AssertFatal(1==0,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment); + AssertFatal(1==0,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment); break; } @@ -342,26 +339,26 @@ uint8_t subframe2harqpid(COMMON_channels_t *cc,frame_t frame,sub_frame_t subfram case 2: AssertFatal((subframe==2) || (subframe==7), - "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment); - + "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment); + ret = (subframe/7); break; case 3: - AssertFatal((subframe>1) && (subframe<5), - "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment); + AssertFatal((subframe>1) && (subframe<5), + "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment); ret = (subframe-2); break; case 4: AssertFatal((subframe>1) && (subframe<4), - "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment); + "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment); ret = (subframe-2); break; case 5: AssertFatal(subframe==2, - "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment); + "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,(int)cc->tdd_Config->subframeAssignment); ret = (subframe-2); break; @@ -373,10 +370,9 @@ uint8_t subframe2harqpid(COMMON_channels_t *cc,frame_t frame,sub_frame_t subfram } uint8_t get_Msg3harqpid(COMMON_channels_t *cc, - frame_t frame, - sub_frame_t current_subframe) + frame_t frame, + sub_frame_t current_subframe) { - uint8_t ul_subframe=0; uint32_t ul_frame=0; @@ -387,7 +383,6 @@ uint8_t get_Msg3harqpid(COMMON_channels_t *cc, switch (cc->tdd_Config->subframeAssignment) { case 1: switch (current_subframe) { - case 9: case 0: ul_subframe = 7; @@ -404,7 +399,6 @@ uint8_t get_Msg3harqpid(COMMON_channels_t *cc, case 3: switch (current_subframe) { - case 0: case 5: case 6: @@ -428,7 +422,6 @@ uint8_t get_Msg3harqpid(COMMON_channels_t *cc, case 4: switch (current_subframe) { - case 0: case 5: case 6: @@ -456,7 +449,6 @@ uint8_t get_Msg3harqpid(COMMON_channels_t *cc, } return(subframe2harqpid(cc,ul_frame,ul_subframe)); - } uint32_t pdcchalloc2ulframe(COMMON_channels_t *ccP,uint32_t frame, uint8_t n) @@ -468,11 +460,11 @@ uint32_t pdcchalloc2ulframe(COMMON_channels_t *ccP,uint32_t frame, uint8_t n) ((n==1)||(n==6))) // tdd_config 0,1 SF 1,5 ul_frame = (frame + (n==1 ? 0 : 1)); else if ((ccP->tdd_Config) && - (ccP->tdd_Config->subframeAssignment == 6) && - ((n==0)||(n==1)||(n==5)||(n==6))) + (ccP->tdd_Config->subframeAssignment == 6) && + ((n==0)||(n==1)||(n==5)||(n==6))) ul_frame = (frame + (n>=5 ? 1 : 0)); else if ((ccP->tdd_Config) && - (ccP->tdd_Config->subframeAssignment == 6) && + (ccP->tdd_Config->subframeAssignment == 6) && (n==9)) // tdd_config 6 SF 9 ul_frame = (frame+1); else @@ -480,11 +472,10 @@ uint32_t pdcchalloc2ulframe(COMMON_channels_t *ccP,uint32_t frame, uint8_t n) LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, n, ul_frame); return ul_frame; - } -uint8_t pdcchalloc2ulsubframe(COMMON_channels_t *ccP,uint8_t n) { - +uint8_t pdcchalloc2ulsubframe(COMMON_channels_t *ccP,uint8_t n) +{ uint8_t ul_subframe; if ((ccP->tdd_Config) && @@ -492,11 +483,11 @@ uint8_t pdcchalloc2ulsubframe(COMMON_channels_t *ccP,uint8_t n) { ((n==1)||(n==6))) // tdd_config 0,1 SF 1,5 ul_subframe = ((n+6)%10); else if ((ccP->tdd_Config) && - (ccP->tdd_Config->subframeAssignment == 6) && + (ccP->tdd_Config->subframeAssignment == 6) && ((n==0)||(n==1)||(n==5)||(n==6))) ul_subframe = ((n+7)%10); else if ((ccP->tdd_Config) && - (ccP->tdd_Config->subframeAssignment == 6) && + (ccP->tdd_Config->subframeAssignment == 6) && (n==9)) // tdd_config 6 SF 9 ul_subframe = ((n+5)%10); else @@ -508,13 +499,11 @@ uint8_t pdcchalloc2ulsubframe(COMMON_channels_t *ccP,uint8_t n) { int is_UL_sf(COMMON_channels_t *ccP,sub_frame_t subframeP) { - // if FDD return dummy value if (ccP->tdd_Config == NULL) return(0); switch (ccP->tdd_Config->subframeAssignment) { - case 1: switch (subframeP) { case 0: @@ -552,7 +541,7 @@ int is_UL_sf(COMMON_channels_t *ccP,sub_frame_t subframeP) return(1); else AssertFatal(1==0,"Unknown subframe number\n"); break; - + case 5: if ((subframeP<=1) || (subframeP>=3)) return(0); @@ -563,16 +552,15 @@ int is_UL_sf(COMMON_channels_t *ccP,sub_frame_t subframeP) default: AssertFatal(1==0,"subframe %d Unsupported TDD configuration %d\n", - subframeP,(int)ccP->tdd_Config->subframeAssignment); + subframeP,(int)ccP->tdd_Config->subframeAssignment); break; - } } -uint16_t get_pucch1_absSF(COMMON_channels_t *cc,uint16_t dlsch_absSF) { - +uint16_t get_pucch1_absSF(COMMON_channels_t *cc,uint16_t dlsch_absSF) +{ uint16_t sf,f,nextf; - + if (cc->tdd_Config==NULL) { //FDD n+4 return((dlsch_absSF + 4)%10240); } @@ -598,9 +586,9 @@ uint16_t get_pucch1_absSF(COMMON_channels_t *cc,uint16_t dlsch_absSF) { else AssertFatal(1==0,"Impossible dlsch subframe %d for TDD configuration 3\n",sf); break; case 3: - if ((sf==5) || (sf==6) || (sf==7) || (sf==8) || (sf==9)) return((10*nextf) + (sf>>1)); // ACK/NAK in 2,3,4 resp. next frame - else if (sf==1) return((10*nextf) + 2); // ACK/NAK in 2 next frame - else if (sf==0) return((10*f) + 4); // ACK/NAK in 4 same frame + if ((sf==5) || (sf==6) || (sf==7) || (sf==8) || (sf==9)) return((10*nextf) + (sf>>1)); // ACK/NAK in 2,3,4 resp. next frame + else if (sf==1) return((10*nextf) + 2); // ACK/NAK in 2 next frame + else if (sf==0) return((10*f) + 4); // ACK/NAK in 4 same frame else AssertFatal(1==0,"Impossible dlsch subframe %d for TDD configuration 3\n",sf); break; case 4: @@ -610,8 +598,8 @@ uint16_t get_pucch1_absSF(COMMON_channels_t *cc,uint16_t dlsch_absSF) { break; case 5: if ((sf==0) || (sf==1) || (sf==3) || (sf==4) || (sf==5) || (sf==6) || (sf==7) || (sf==8)) return(((10*nextf) + 2)%10240); // ACK/NAK in SF 3 next frame - else if (sf==9) return(((10*(1+nextf)) + 2)%10240); // ACK/NAK in SF 2 next frame - else AssertFatal(1==0,"Impossible dlsch subframe %d for TDD configuration 5\n",sf); + else if (sf==9) return(((10*(1+nextf)) + 2)%10240); // ACK/NAK in SF 2 next frame + else AssertFatal(1==0,"Impossible dlsch subframe %d for TDD configuration 5\n",sf); break; case 6: AssertFatal(1==0,"SFA 6 To be filled in now, :-)\n"); @@ -624,11 +612,11 @@ uint16_t get_pucch1_absSF(COMMON_channels_t *cc,uint16_t dlsch_absSF) { AssertFatal(1==0,"Shouldn't get here\n"); } -void get_srs_pos(COMMON_channels_t *cc,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset) { - +void get_srs_pos(COMMON_channels_t *cc,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset) +{ if(cc->tdd_Config) { // TDD AssertFatal(isrs>=10,"2 ms SRS periodicity not supported"); - + if ((isrs>9)&&(isrs<15)) { *psrsPeriodicity=5; *psrsOffset=isrs-10; @@ -657,12 +645,10 @@ void get_srs_pos(COMMON_channels_t *cc,uint16_t isrs,uint16_t *psrsPeriodicity,u *psrsPeriodicity=320; *psrsOffset=isrs-325; } - + AssertFatal(isrs<=644,"Isrs out of range %d>644\n",isrs); - } // TDD else { // FDD - if (isrs<2) { *psrsPeriodicity=2; *psrsOffset=isrs; @@ -696,12 +682,11 @@ void get_srs_pos(COMMON_channels_t *cc,uint16_t isrs,uint16_t *psrsPeriodicity,u *psrsOffset=isrs-317; } AssertFatal(isrs<=636,"Isrs out of range %d>636\n",isrs); - } } -void get_csi_params(COMMON_channels_t *cc,struct CQI_ReportPeriodic *cqi_ReportPeriodic,uint16_t *Npd,uint16_t *N_OFFSET_CQI,int *H) { - +void get_csi_params(COMMON_channels_t *cc,struct CQI_ReportPeriodic *cqi_ReportPeriodic,uint16_t *Npd,uint16_t *N_OFFSET_CQI,int *H) +{ uint16_t cqi_PMI_ConfigIndex = cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex; uint8_t Jtab[6] = {0,2,2,3,4,4}; @@ -731,19 +716,19 @@ void get_csi_params(COMMON_channels_t *cc,struct CQI_ReportPeriodic *cqi_ReportP *N_OFFSET_CQI = cqi_PMI_ConfigIndex-157; } else if (cqi_PMI_ConfigIndex > 317) { - + if (cqi_PMI_ConfigIndex <= 349) { // 32 ms CQI_PMI period - *Npd = 32; + *Npd = 32; *N_OFFSET_CQI = cqi_PMI_ConfigIndex-318; } else if (cqi_PMI_ConfigIndex <= 413) { // 64 ms CQI_PMI period - *Npd = 64; - *N_OFFSET_CQI = cqi_PMI_ConfigIndex-350; + *Npd = 64; + *N_OFFSET_CQI = cqi_PMI_ConfigIndex-350; } else if (cqi_PMI_ConfigIndex <= 541) { // 128 ms CQI_PMI period - *Npd = 128; - *N_OFFSET_CQI = cqi_PMI_ConfigIndex-414; - } + *Npd = 128; + *N_OFFSET_CQI = cqi_PMI_ConfigIndex-414; + } } } else { // TDD @@ -778,9 +763,8 @@ void get_csi_params(COMMON_channels_t *cc,struct CQI_ReportPeriodic *cqi_ReportP *H=1; } - -uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t *cc,uint8_t tmode,uint8_t ri, CQI_ReportModeAperiodic_t *cqi_ReportModeAperiodic) { - +uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t *cc,uint8_t tmode,uint8_t ri, CQI_ReportModeAperiodic_t *cqi_ReportModeAperiodic) +{ int Ntab[6] = {0,4,7,9,10,13}; int N = Ntab[cc->mib->message.dl_Bandwidth]; int Ltab_uesel[6] = {0,6,9,13,15,18}; @@ -789,14 +773,13 @@ uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t *cc,uint8_t tmode,uint8_t ri AssertFatal(cqi_ReportModeAperiodic != NULL,"cqi_ReportPeriodic is null!\n"); switch (*cqi_ReportModeAperiodic) { - case CQI_ReportModeAperiodic_rm12: AssertFatal(tmode==4 || tmode==6 || tmode==8 || tmode==9 || tmode==10,"Illegal TM (%d) for CQI_ReportModeAperiodic_rm12\n",tmode); AssertFatal(cc->p_eNB<=4,"only up to 4 antenna ports supported here\n"); if (ri==1 && cc->p_eNB==2) return(4+(N<<1)); else if (ri==2 && cc->p_eNB==2) return(8+N); else if (ri==1 && cc->p_eNB==4) return(4+(N<<2)); - else if (ri>1 && cc->p_eNB==4) return(8+(N<<2)); + else if (ri>1 && cc->p_eNB==4) return(8+(N<<2)); break; case CQI_ReportModeAperiodic_rm20: // Table 5.2.2.6.3-1 (36.212) @@ -844,7 +827,7 @@ uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t *cc,uint8_t tmode,uint8_t ri if (ri==1 && cc->p_eNB==2) return(4+0+2); else if (ri==2 && cc->p_eNB==2) return(4+4+1); else if (ri==1 && cc->p_eNB==4) return(4+0+4); - else if (ri>1 && cc->p_eNB==4) return(4+4+4); + else if (ri>1 && cc->p_eNB==4) return(4+4+4); break; } @@ -852,8 +835,8 @@ uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t *cc,uint8_t tmode,uint8_t ri return(0); } -uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl *sched_ctl,int CC_idP,COMMON_channels_t *cc,uint8_t tmode, struct CQI_ReportPeriodic *cqi_ReportPeriodic) { - +uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl *sched_ctl,int CC_idP,COMMON_channels_t *cc,uint8_t tmode, struct CQI_ReportPeriodic *cqi_ReportPeriodic) +{ int no_pmi=0; // Ltab[6] = {0,log2(15/4/2),log2(25/4/2),log2(50/6/3),log2(75/8/4),log2(100/8/4)}; @@ -862,9 +845,9 @@ uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl *sched_ctl,int CC_idP,COMMON_chan AssertFatal(cqi_ReportPeriodic != NULL,"cqi_ReportPeriodic is null!\n"); AssertFatal(cqi_ReportPeriodic->present != CQI_ReportPeriodic_PR_NOTHING, - "cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_NOTHING!\n"); + "cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_NOTHING!\n"); AssertFatal(cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present != CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING, - "cqi_ReportPeriodic->cqi_FormatIndicatorPeriodic.choice.setup.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING!\n"); + "cqi_ReportPeriodic->cqi_FormatIndicatorPeriodic.choice.setup.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING!\n"); switch(tmode) { case 1: @@ -878,8 +861,6 @@ uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl *sched_ctl,int CC_idP,COMMON_chan no_pmi=0; } - - if ((cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI) || (sched_ctl->feedback_cnt[CC_idP] == 0)) { // send wideband report every opportunity if wideband reporting mode is selected, else every H opportunities @@ -893,26 +874,26 @@ uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl *sched_ctl,int CC_idP,COMMON_chan } else if (cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI) { if ((no_pmi == 1)||ri==1) return(4+Ltab[cc->mib->message.dl_Bandwidth]); - else - return(7+Ltab[cc->mib->message.dl_Bandwidth]); + else + return(7+Ltab[cc->mib->message.dl_Bandwidth]); } AssertFatal(1==0,"Shouldn't get here : cqi_ReportPeriodic->present %d\n",cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present); } void fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t *dl_config_pdu, - uint8_t aggregation_level, - uint16_t rnti, - uint8_t rnti_type, - uint8_t harq_process, - uint8_t tpc, - uint16_t resource_block_coding, - uint8_t mcs, - uint8_t ndi, - uint8_t rv, - uint8_t vrb_flag) { - + uint8_t aggregation_level, + uint16_t rnti, + uint8_t rnti_type, + uint8_t harq_process, + uint8_t tpc, + uint16_t resource_block_coding, + uint8_t mcs, + uint8_t ndi, + uint8_t rv, + uint8_t vrb_flag) +{ memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t)); - dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; + dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; dl_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_dl_config_dci_dl_pdu)); dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1A; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = aggregation_level; @@ -926,11 +907,10 @@ void fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t *dl_config_pdu, dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = ndi; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = rv; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag = vrb_flag; - } -void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t frameP, sub_frame_t subframeP,uint8_t cce_idx) { - +void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t frameP, sub_frame_t subframeP,uint8_t cce_idx) +{ eNB_MAC_INST *eNB = RC.mac[module_idP]; COMMON_channels_t *cc = eNB->common_channels; UE_list_t *UE_list = &eNB->UE_list; @@ -941,33 +921,33 @@ void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t int use_simultaneous_pucch_pusch=0; nfapi_ul_config_ulsch_harq_information *ulsch_harq_information = NULL; nfapi_ul_config_harq_information *harq_information = NULL; - + #if defined(Rel10) || defined(Rel14) - + if ((UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2) && (UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2->pucch_ConfigDedicated_v1020) && - (UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2->pucch_ConfigDedicated_v1020->simultaneousPUCCH_PUSCH_r10) && + (UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2->pucch_ConfigDedicated_v1020->simultaneousPUCCH_PUSCH_r10) && (*UE_list->UE_template[CC_idP][UE_idP].physicalConfigDedicated->ext2->pucch_ConfigDedicated_v1020->simultaneousPUCCH_PUSCH_r10 == PUCCH_ConfigDedicated_v1020__simultaneousPUCCH_PUSCH_r10_true)) use_simultaneous_pucch_pusch=1; #endif - + // pucch1 and pusch feedback is similar, namely in n+k subframes from now // This is used in the following "if/else" condition to check if there isn't or is already an UL grant in n+k int16_t ul_absSF = get_pucch1_absSF(&cc[CC_idP],subframeP+(10*frameP)); - + if ((ul_config_pdu = has_ul_grant(module_idP,CC_idP, - ul_absSF, - rnti)) == NULL) { + ul_absSF, + rnti)) == NULL) { // no UL grant so // Program ACK/NAK alone Format 1a/b or 3 - + ul_req = &RC.mac[module_idP]->UL_req_tmp[CC_idP][ul_absSF%10].ul_config_request_body; - ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus]; + ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus]; // Do PUCCH fill_nfapi_uci_acknak(module_idP, - CC_idP, - rnti, - (frameP*10)+subframeP, - cce_idx); + CC_idP, + rnti, + (frameP*10)+subframeP, + cce_idx); } else { // there is already an existing UL grant so update it if needed // on top of some other UL resource (PUSCH,combined SR/CQI/HARQ on PUCCH, etc) @@ -976,23 +956,23 @@ void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE: case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE: if (use_simultaneous_pucch_pusch==1) { - AssertFatal(ul_config_pdu->pdu_type!=NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE, - "Cannot be NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE, simultaneous_pucch_pusch is active\n"); - // Convert it to an NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE - harq_information = &ul_config_pdu->ulsch_uci_harq_pdu.harq_information; - ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE; - LOG_D(MAC,"Frame %d, Subframe %d: Switched UCI HARQ to ULSCH UCI HARQ\n",frameP,subframeP); + AssertFatal(ul_config_pdu->pdu_type!=NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE, + "Cannot be NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE, simultaneous_pucch_pusch is active\n"); + // Convert it to an NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE + harq_information = &ul_config_pdu->ulsch_uci_harq_pdu.harq_information; + ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE; + LOG_D(MAC,"Frame %d, Subframe %d: Switched UCI HARQ to ULSCH UCI HARQ\n",frameP,subframeP); } else { - AssertFatal(ul_config_pdu->pdu_type!=NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE, - "Cannot be NFAPI_UL_CONFIG_ULSCH_UCI_PDU_TYPE, simultaneous_pucch_pusch is inactive\n"); - // Convert it to an NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE - ulsch_harq_information = &ul_config_pdu->ulsch_harq_pdu.harq_information; - ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE; - ul_config_pdu->ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial=0; // last symbol not punctured - ul_config_pdu->ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks= - ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks; // we don't change the number of resource blocks across retransmissions yet - LOG_D(MAC,"Frame %d, Subframe %d: Switched UCI HARQ to ULSCH HARQ\n",frameP,subframeP); + AssertFatal(ul_config_pdu->pdu_type!=NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE, + "Cannot be NFAPI_UL_CONFIG_ULSCH_UCI_PDU_TYPE, simultaneous_pucch_pusch is inactive\n"); + // Convert it to an NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE + ulsch_harq_information = &ul_config_pdu->ulsch_harq_pdu.harq_information; + ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE; + ul_config_pdu->ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial=0; // last symbol not punctured + ul_config_pdu->ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks= + ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks; // we don't change the number of resource blocks across retransmissions yet + LOG_D(MAC,"Frame %d, Subframe %d: Switched UCI HARQ to ULSCH HARQ\n",frameP,subframeP); } break; case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE: @@ -1000,28 +980,28 @@ void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE: case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE: if (use_simultaneous_pucch_pusch==1) { - AssertFatal(ul_config_pdu->pdu_type==NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE || - ul_config_pdu->pdu_type==NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE, - "Cannot be NFAPI_UL_CONFIG_ULSCH_CQI_RI_xxx_PDU_TYPE, simultaneous_pucch_pusch is active\n"); - // convert it to an NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE - harq_information = &ul_config_pdu->ulsch_csi_uci_harq_pdu.harq_information; - ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE; - + AssertFatal(ul_config_pdu->pdu_type==NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE || + ul_config_pdu->pdu_type==NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE, + "Cannot be NFAPI_UL_CONFIG_ULSCH_CQI_RI_xxx_PDU_TYPE, simultaneous_pucch_pusch is active\n"); + // convert it to an NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE + harq_information = &ul_config_pdu->ulsch_csi_uci_harq_pdu.harq_information; + ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE; + } - else { - AssertFatal(ul_config_pdu->pdu_type==NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE || - ul_config_pdu->pdu_type==NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE, - "Cannot be NFAPI_UL_CONFIG_ULSCH_UCI_xxx_PDU_TYPE, simultaneous_pucch_pusch is inactive\n"); - // Convert it to an NFAPI_UL_CONFIG_ULSCH_CQI_RI_HARQ_PDU_TYPE - ulsch_harq_information = &ul_config_pdu->ulsch_cqi_harq_ri_pdu.harq_information; - ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE; - ul_config_pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial=0; // last symbol not punctured - ul_config_pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks= - ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks; // we don't change the number of resource blocks across retransmissions yet + else { + AssertFatal(ul_config_pdu->pdu_type==NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE || + ul_config_pdu->pdu_type==NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE, + "Cannot be NFAPI_UL_CONFIG_ULSCH_UCI_xxx_PDU_TYPE, simultaneous_pucch_pusch is inactive\n"); + // Convert it to an NFAPI_UL_CONFIG_ULSCH_CQI_RI_HARQ_PDU_TYPE + ulsch_harq_information = &ul_config_pdu->ulsch_cqi_harq_ri_pdu.harq_information; + ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE; + ul_config_pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial=0; // last symbol not punctured + ul_config_pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks= + ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks; // we don't change the number of resource blocks across retransmissions yet } - + break; - + case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE: case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE: // convert/keep it to NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE @@ -1034,7 +1014,7 @@ void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE; harq_information = &ul_config_pdu->uci_cqi_harq_pdu.harq_information; break; - + case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE: case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE: // convert/keep it to NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE @@ -1043,37 +1023,36 @@ void program_dlsch_acknak(module_id_t module_idP, int CC_idP,int UE_idP, frame_t break; } } - + if (ulsch_harq_information) fill_nfapi_ulsch_harq_information(module_idP,CC_idP, - rnti, - ulsch_harq_information); - - + rnti, + ulsch_harq_information); + if (harq_information) fill_nfapi_harq_information(module_idP,CC_idP, - rnti, - (frameP*10)+subframeP, - harq_information, - cce_idx); + rnti, + (frameP*10)+subframeP, + harq_information, + cce_idx); } -uint8_t get_V_UL_DAI(module_id_t module_idP,int CC_idP,uint16_t rntiP) { - +uint8_t get_V_UL_DAI(module_id_t module_idP,int CC_idP,uint16_t rntiP) +{ nfapi_hi_dci0_request_body_t *HI_DCI0_req = &RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body; nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[0]; for (int i=0;i<HI_DCI0_req->number_of_dci;i++) { if ((hi_dci0_pdu[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE)&& - (hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti == rntiP)) - return(hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.dl_assignment_index); + (hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti == rntiP)) + return(hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.dl_assignment_index); } return(4); // this is rule from Section 7.3 in 36.213 } -void fill_nfapi_ulsch_harq_information(module_id_t module_idP, - int CC_idP, - uint16_t rntiP, - nfapi_ul_config_ulsch_harq_information *harq_information) { - +void fill_nfapi_ulsch_harq_information(module_id_t module_idP, + int CC_idP, + uint16_t rntiP, + nfapi_ul_config_ulsch_harq_information *harq_information) +{ eNB_MAC_INST *eNB = RC.mac[module_idP]; COMMON_channels_t *cc = &eNB->common_channels[CC_idP]; UE_list_t *UE_list = &eNB->UE_list; @@ -1111,45 +1090,42 @@ void fill_nfapi_ulsch_harq_information(module_id_t module_idP, case 5: case 6: case 7: - if (cc->tdd_Config==NULL) // FDD harq_information->harq_information_rel10.harq_size = 1; else { if (harq_information->harq_information_rel10.ack_nack_mode == 1) - harq_information->harq_information_rel10.harq_size = get_V_UL_DAI(module_idP,CC_idP,rntiP); + harq_information->harq_information_rel10.harq_size = get_V_UL_DAI(module_idP,CC_idP,rntiP); else - harq_information->harq_information_rel10.harq_size = 1; + harq_information->harq_information_rel10.harq_size = 1; } break; - default: // for any other TM we need 2 bits harq - + default: // for any other TM we need 2 bits harq if (cc->tdd_Config==NULL) { - harq_information->harq_information_rel10.harq_size = 2; + harq_information->harq_information_rel10.harq_size = 2; } else { if (harq_information->harq_information_rel10.ack_nack_mode == 1) - harq_information->harq_information_rel10.harq_size = get_V_UL_DAI(module_idP,CC_idP,rntiP); + harq_information->harq_information_rel10.harq_size = get_V_UL_DAI(module_idP,CC_idP,rntiP); else - harq_information->harq_information_rel10.harq_size = 2; + harq_information->harq_information_rel10.harq_size = 2; } break; } // get Tmode } - + void fill_nfapi_harq_information(module_id_t module_idP, - int CC_idP, - uint16_t rntiP, - uint16_t absSFP, - nfapi_ul_config_harq_information *harq_information, - uint8_t cce_idxP) { - + int CC_idP, + uint16_t rntiP, + uint16_t absSFP, + nfapi_ul_config_harq_information *harq_information, + uint8_t cce_idxP) +{ eNB_MAC_INST *eNB = RC.mac[module_idP]; COMMON_channels_t *cc = &eNB->common_channels[CC_idP]; UE_list_t *UE_list = &eNB->UE_list; int UE_id = find_UE_id(module_idP,rntiP); - AssertFatal(UE_id>=0,"UE_id cannot be found, impossible\n"); AssertFatal(UE_list!=NULL,"UE_list is null\n"); AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated!=NULL,"physicalConfigDedicated for rnti %x is null\n",rntiP); @@ -1164,15 +1140,15 @@ void fill_nfapi_harq_information(module_id_t module_idP, case 7: if (cc->tdd_Config!=NULL) { AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated!=NULL, - "pucch_ConfigDedicated is null for TDD!\n"); + "pucch_ConfigDedicated is null for TDD!\n"); if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode!=NULL)&& - (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode==PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing)) { - harq_information->harq_information_rel10_tdd.harq_size = 2; // 2-bit ACK/NAK - harq_information->harq_information_rel10_tdd.ack_nack_mode = 1; // multiplexing + (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode==PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing)) { + harq_information->harq_information_rel10_tdd.harq_size = 2; // 2-bit ACK/NAK + harq_information->harq_information_rel10_tdd.ack_nack_mode = 1; // multiplexing } else { - harq_information->harq_information_rel10_tdd.harq_size = 1; // 1-bit ACK/NAK - harq_information->harq_information_rel10_tdd.ack_nack_mode = 0; // bundling + harq_information->harq_information_rel10_tdd.harq_size = 1; // 1-bit ACK/NAK + harq_information->harq_information_rel10_tdd.ack_nack_mode = 0; // bundling } harq_information->harq_information_rel10_tdd.n_pucch_1_0 = cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP; harq_information->harq_information_rel10_tdd.number_of_pucch_resources = 1; @@ -1182,18 +1158,18 @@ void fill_nfapi_harq_information(module_id_t module_idP, harq_information->harq_information_rel9_fdd.n_pucch_1_0 = cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP; } break; - default: // for any other TM we need 2 bits harq + default: // for any other TM we need 2 bits harq if (cc->tdd_Config!=NULL) { AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated!=NULL, - "pucch_ConfigDedicated is null for TDD!\n"); + "pucch_ConfigDedicated is null for TDD!\n"); if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode!=NULL)&& - (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode==PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing)) { - harq_information->harq_information_rel10_tdd.ack_nack_mode = 1; // multiplexing + (*UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode==PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing)) { + harq_information->harq_information_rel10_tdd.ack_nack_mode = 1; // multiplexing } else { - harq_information->harq_information_rel10_tdd.ack_nack_mode = 0; // bundling + harq_information->harq_information_rel10_tdd.ack_nack_mode = 0; // bundling } - harq_information->harq_information_rel10_tdd.harq_size = 2; + harq_information->harq_information_rel10_tdd.harq_size = 2; harq_information->harq_information_rel10_tdd.n_pucch_1_0 = cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP; harq_information->harq_information_rel10_tdd.number_of_pucch_resources = 1; } @@ -1201,85 +1177,82 @@ void fill_nfapi_harq_information(module_id_t module_idP, harq_information->harq_information_rel9_fdd.number_of_pucch_resources = 1; harq_information->harq_information_rel9_fdd.ack_nack_mode = 0; // 1a/b harq_information->harq_information_rel9_fdd.harq_size = 2; - harq_information->harq_information_rel9_fdd.n_pucch_1_0 = cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP; + harq_information->harq_information_rel9_fdd.n_pucch_1_0 = cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP; } break; } // get Tmode } - uint16_t fill_nfapi_uci_acknak(module_id_t module_idP, - int CC_idP, - uint16_t rntiP, - uint16_t absSFP, - uint8_t cce_idxP) { - + int CC_idP, + uint16_t rntiP, + uint16_t absSFP, + uint8_t cce_idxP) +{ eNB_MAC_INST *eNB = RC.mac[module_idP]; COMMON_channels_t *cc = &eNB->common_channels[CC_idP]; - + int ackNAK_absSF = get_pucch1_absSF(cc,absSFP); nfapi_ul_config_request_body_t *ul_req = &eNB->UL_req_tmp[CC_idP][ackNAK_absSF%10].ul_config_request_body; - nfapi_ul_config_request_pdu_t *ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus]; - + nfapi_ul_config_request_pdu_t *ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus]; memset((void*)ul_config_pdu,0,sizeof(nfapi_ul_config_request_pdu_t)); - ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE; + ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE; ul_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_ul_config_uci_harq_pdu)); ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.handle = 0; // don't know how to use this ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti = rntiP; fill_nfapi_harq_information(module_idP,CC_idP, - rntiP, - absSFP, - &ul_config_pdu->uci_harq_pdu.harq_information, - cce_idxP); + rntiP, + absSFP, + &ul_config_pdu->uci_harq_pdu.harq_information, + cce_idxP); LOG_D(MAC,"Filled in UCI HARQ request for rnti %x SF %d.%d acknakSF %d.%d, cce_idxP %d-> n1_pucch %d\n",rntiP, - absSFP/10,absSFP%10,ackNAK_absSF/10,ackNAK_absSF%10,cce_idxP,ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.n_pucch_1_0); + absSFP/10,absSFP%10,ackNAK_absSF/10,ackNAK_absSF%10,cce_idxP,ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.n_pucch_1_0); ul_req->number_of_pdus++; return(((ackNAK_absSF/10)<<4) + (ackNAK_absSF%10)); } -void fill_nfapi_dlsch_config(eNB_MAC_INST *eNB, - nfapi_dl_config_request_body_t *dl_req, - uint16_t length, - uint16_t pdu_index, - uint16_t rnti, - uint8_t resource_allocation_type, - uint8_t virtual_resource_block_assignment_flag, - uint16_t resource_block_coding, - uint8_t modulation, - uint8_t redundancy_version, - uint8_t transport_blocks, - uint8_t transport_block_to_codeword_swap_flag, - uint8_t transmission_scheme, - uint8_t number_of_layers, - uint8_t number_of_subbands, - // uint8_t codebook_index, - uint8_t ue_category_capacity, - uint8_t pa, - uint8_t delta_power_offset_index, - uint8_t ngap, - uint8_t nprb, - uint8_t transmission_mode, - uint8_t num_bf_prb_per_subband, - uint8_t num_bf_vector - ) { - - nfapi_dl_config_request_pdu_t *dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; - - dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; +void fill_nfapi_dlsch_config(eNB_MAC_INST *eNB, + nfapi_dl_config_request_body_t *dl_req, + uint16_t length, + uint16_t pdu_index, + uint16_t rnti, + uint8_t resource_allocation_type, + uint8_t virtual_resource_block_assignment_flag, + uint16_t resource_block_coding, + uint8_t modulation, + uint8_t redundancy_version, + uint8_t transport_blocks, + uint8_t transport_block_to_codeword_swap_flag, + uint8_t transmission_scheme, + uint8_t number_of_layers, + uint8_t number_of_subbands, + // uint8_t codebook_index, + uint8_t ue_category_capacity, + uint8_t pa, + uint8_t delta_power_offset_index, + uint8_t ngap, + uint8_t nprb, + uint8_t transmission_mode, + uint8_t num_bf_prb_per_subband, + uint8_t num_bf_vector + ) +{ + nfapi_dl_config_request_pdu_t *dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t)); - dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE; + + dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE; dl_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu)); dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length = length; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = pdu_index; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = rnti; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = resource_allocation_type; - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = virtual_resource_block_assignment_flag; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = virtual_resource_block_assignment_flag; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = resource_block_coding; - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = modulation; + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = modulation; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = redundancy_version; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = transport_blocks; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = transport_block_to_codeword_swap_flag; @@ -1298,9 +1271,9 @@ void fill_nfapi_dlsch_config(eNB_MAC_INST *eNB, dl_req->number_pdu++; } -uint16_t fill_nfapi_tx_req(nfapi_tx_request_body_t *tx_req_body,uint16_t absSF,uint16_t pdu_length, uint16_t *pdu_index, uint8_t *pdu) { - - nfapi_tx_request_pdu_t *TX_req = &tx_req_body->tx_pdu_list[tx_req_body->number_of_pdus]; +uint16_t fill_nfapi_tx_req(nfapi_tx_request_body_t *tx_req_body,uint16_t absSF,uint16_t pdu_length, uint16_t *pdu_index, uint8_t *pdu) +{ + nfapi_tx_request_pdu_t *TX_req = &tx_req_body->tx_pdu_list[tx_req_body->number_of_pdus]; LOG_D(MAC,"Filling TX_req %d for pdu length %d\n",tx_req_body->number_of_pdus,pdu_length); TX_req->pdu_length = pdu_length; TX_req->pdu_index = *pdu_index++; @@ -1313,28 +1286,27 @@ uint16_t fill_nfapi_tx_req(nfapi_tx_request_body_t *tx_req_body,uint16_t absSF,u } void fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t *ul_config_pdu, - uint8_t cqi_req, - COMMON_channels_t *cc, - struct PhysicalConfigDedicated *physicalConfigDedicated, - uint8_t tmode, - uint32_t handle, - uint16_t rnti, - uint8_t resource_block_start, - uint8_t number_of_resource_blocks, - uint8_t mcs, - uint8_t cyclic_shift_2_for_drms, - uint8_t frequency_hopping_enabled_flag, - uint8_t frequency_hopping_bits, - uint8_t new_data_indication, - uint8_t redundancy_version, - uint8_t harq_process_number, - uint8_t ul_tx_mode, - uint8_t current_tx_nb, - uint8_t n_srs, - uint16_t size - ) { - - + uint8_t cqi_req, + COMMON_channels_t *cc, + struct PhysicalConfigDedicated *physicalConfigDedicated, + uint8_t tmode, + uint32_t handle, + uint16_t rnti, + uint8_t resource_block_start, + uint8_t number_of_resource_blocks, + uint8_t mcs, + uint8_t cyclic_shift_2_for_drms, + uint8_t frequency_hopping_enabled_flag, + uint8_t frequency_hopping_bits, + uint8_t new_data_indication, + uint8_t redundancy_version, + uint8_t harq_process_number, + uint8_t ul_tx_mode, + uint8_t current_tx_nb, + uint8_t n_srs, + uint16_t size + ) +{ memset((void*)ul_config_pdu,0,sizeof(nfapi_ul_config_request_pdu_t)); if (cqi_req==0) ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE; @@ -1368,27 +1340,27 @@ void fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t *ul_con ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.report_type = 1; ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.number_of_cc = 1; LOG_D(MAC,"report_type %d\n",ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.report_type); - + if (cc->p_eNB<=2 && (tmode==3||tmode==4||tmode==8||tmode==9||tmode==10)) ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 1; - else if (cc->p_eNB<=2) + else if (cc->p_eNB<=2) ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 0; else if (cc->p_eNB==4) ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 2; - + AssertFatal(physicalConfigDedicated->cqi_ReportConfig!=NULL,"physicalConfigDedicated->cqi_ReportConfig is null!\n"); AssertFatal(physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic!=NULL,"physicalConfigDedicated->cqi_ReportModeAperiodic is null!\n"); AssertFatal(physicalConfigDedicated->pusch_ConfigDedicated!=NULL,"physicalConfigDedicated->puschConfigDedicated is null!\n"); - + for (int ri=0; - ri<(1<<ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size); - ri++) - ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size[ri] = - get_dl_cqi_pmi_size_pusch(cc, - tmode, - 1+ri, - physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic); - + ri<(1<<ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size); + ri++) + ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size[ri] = + get_dl_cqi_pmi_size_pusch(cc, + tmode, + 1+ri, + physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic); + ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.delta_offset_cqi = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index; ((nfapi_ul_config_ulsch_cqi_ri_pdu*)ul_config_pdu)->cqi_ri_information.cqi_ri_information_rel9.delta_offset_ri = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index; } @@ -1396,27 +1368,29 @@ void fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t *ul_con #ifdef Rel14 void fill_nfapi_ulsch_config_request_emtc(nfapi_ul_config_request_pdu_t *ul_config_pdu, - uint8_t ue_type, - uint16_t total_number_of_repetitions, - uint16_t repetition_number, - uint16_t initial_transmission_sf_io) { + uint8_t ue_type, + uint16_t total_number_of_repetitions, + uint16_t repetition_number, + uint16_t initial_transmission_sf_io) +{ // Re13 fields - + ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.ue_type = ue_type; ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions = total_number_of_repetitions; ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number = repetition_number; ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io = initial_transmission_sf_io; - } -int get_numnarrowbands(long dl_Bandwidth) { +int get_numnarrowbands(long dl_Bandwidth) +{ int nb_tab[6] = {1,2,4,8,12,16}; AssertFatal(dl_Bandwidth<7 || dl_Bandwidth>=0,"dl_Bandwidth not in [0..6]\n"); return(nb_tab[dl_Bandwidth]); } -int get_numnarrowbandbits(long dl_Bandwidth) { +int get_numnarrowbandbits(long dl_Bandwidth) +{ int nbbits_tab[6] = {0,1,2,3,4,4}; AssertFatal(dl_Bandwidth<7 || dl_Bandwidth>=0,"dl_Bandwidth not in [0..6]\n"); @@ -1427,11 +1401,10 @@ int get_numnarrowbandbits(long dl_Bandwidth) { int startSF_fdd_RA_times2[8] = {2,3,4,5,8,10,16,20}; int startSF_tdd_RA[7] = {1,2,4,5,8,10,20}; -int mpdcch_sf_condition(eNB_MAC_INST *eNB,int CC_id, frame_t frameP,sub_frame_t subframeP,int rmax,MPDCCH_TYPES_t mpdcch_type,int UE_id) { - +int mpdcch_sf_condition(eNB_MAC_INST *eNB,int CC_id, frame_t frameP,sub_frame_t subframeP,int rmax,MPDCCH_TYPES_t mpdcch_type,int UE_id) +{ struct PRACH_ConfigSIB_v1310 *ext4_prach = eNB->common_channels[CC_id].radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310; - int T; EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11; @@ -1447,7 +1420,7 @@ int mpdcch_sf_condition(eNB_MAC_INST *eNB,int CC_id, frame_t frameP,sub_frame_t break; case TYPE2: // RAR AssertFatal(ext4_prach->mpdcch_startSF_CSS_RA_r13!=NULL, - "mpdcch_startSF_CSS_RA_r13 is null\n"); + "mpdcch_startSF_CSS_RA_r13 is null\n"); AssertFatal(rmax>0,"rmax is 0!\b"); if (eNB->common_channels[CC_id].tdd_Config==NULL) //FDD T = rmax*startSF_fdd_RA_times2[ext4_prach->mpdcch_startSF_CSS_RA_r13->choice.fdd_r13]>>1; @@ -1459,16 +1432,15 @@ int mpdcch_sf_condition(eNB_MAC_INST *eNB,int CC_id, frame_t frameP,sub_frame_t break; case TYPEUESPEC: epdcch_setconfig_r11= eNB->UE_list.UE_template[CC_id][UE_id].physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0] ; - - + AssertFatal(epdcch_setconfig_r11 != NULL," epdcch_setconfig_r11 is null for UE specific \n"); AssertFatal(epdcch_setconfig_r11->ext2 != NULL," ext2 doesn't exist in epdcch config ' \n"); - + if (eNB->common_channels[CC_id].tdd_Config==NULL) //FDD T = rmax*startSF_fdd_RA_times2[epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_StartSF_UESS_r13.choice.fdd_r13]>>1; else //TDD T = rmax*startSF_tdd_RA[epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_StartSF_UESS_r13.choice.tdd_r13]; - + break; default: return(0); @@ -1477,11 +1449,10 @@ int mpdcch_sf_condition(eNB_MAC_INST *eNB,int CC_id, frame_t frameP,sub_frame_t AssertFatal(T>0,"T is 0!\n"); if (((10*frameP) + subframeP)%T == 0) return(1); else return(0); - } -int narrowband_to_first_rb(COMMON_channels_t *cc, int nb_index) { - +int narrowband_to_first_rb(COMMON_channels_t *cc, int nb_index) +{ switch (cc->mib->message.dl_Bandwidth) { case 0: // 6 PRBs, N_NB=1, i_0=0 return(0); @@ -1540,9 +1511,7 @@ void init_ue_sched_info(void) unsigned char get_ue_weight(module_id_t module_idP, int CC_idP, int ue_idP) //------------------------------------------------------------------------------ { - return(eNB_dlsch_info[module_idP][CC_idP][ue_idP].weight); - } //------------------------------------------------------------------------------ @@ -1568,20 +1537,18 @@ int find_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP) { int RA_id; AssertFatal(RC.mac[mod_idP],"RC.mac[%d] is null\n",mod_idP); - - RA_TEMPLATE *RA_template = (RA_TEMPLATE *)&RC.mac[mod_idP]->common_channels[CC_idP].RA_template[0]; - + RA_TEMPLATE *RA_template = (RA_TEMPLATE *)&RC.mac[mod_idP]->common_channels[CC_idP].RA_template[0]; for (RA_id = 0; RA_id < NB_RA_PROC_MAX; RA_id++) { LOG_D(MAC,"Checking RA_id %d for %x : RA_active %d, wait_ack_Msg4 %d\n", - RA_id,rntiP, - RA_template[RA_id].RA_active, - RA_template[RA_id].wait_ack_Msg4); - - if (RA_template[RA_id].RA_active==TRUE && + RA_id,rntiP, + RA_template[RA_id].RA_active, + RA_template[RA_id].wait_ack_Msg4); + + if (RA_template[RA_id].RA_active==TRUE && RA_template[RA_id].wait_ack_Msg4 == 0 && - RA_template[RA_id].rnti == rntiP) return(RA_id); + RA_template[RA_id].rnti == rntiP) return(RA_id); } return(-1); } @@ -1604,7 +1571,6 @@ int UE_PCCID(module_id_t mod_idP,int ue_idP) rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP) //------------------------------------------------------------------------------ { - rnti_t rnti = RC.mac[mod_idP]->UE_list.UE_template[UE_PCCID(mod_idP,ue_idP)][ue_idP].rnti; if (rnti>0) { @@ -1651,9 +1617,8 @@ uint8_t find_active_UEs(module_id_t module_idP,int CC_id){ unsigned char get_aggregation (uint8_t bw_index, uint8_t cqi, uint8_t dci_fmt) { unsigned char aggregation=3; - + switch (dci_fmt){ - case format0: aggregation = cqi2fmt0_agg[bw_index][cqi]; break; @@ -1661,14 +1626,14 @@ unsigned char get_aggregation (uint8_t bw_index, uint8_t cqi, uint8_t dci_fmt) case format1A: case format1B: case format1D: - aggregation = cqi2fmt1x_agg[bw_index][cqi]; + aggregation = cqi2fmt1x_agg[bw_index][cqi]; break; case format2: case format2A: case format2B: case format2C: case format2D: - aggregation = cqi2fmt2x_agg[bw_index][cqi]; + aggregation = cqi2fmt2x_agg[bw_index][cqi]; break; case format1C: case format1E_2A_M10PRB: @@ -1679,9 +1644,9 @@ unsigned char get_aggregation (uint8_t bw_index, uint8_t cqi, uint8_t dci_fmt) LOG_W(MAC,"unsupported DCI format %d\n",dci_fmt); } - LOG_D(MAC,"Aggregation level %d (cqi %d, bw_index %d, format %d)\n", - 1<<aggregation, cqi,bw_index,dci_fmt); - + LOG_D(MAC,"Aggregation level %d (cqi %d, bw_index %d, format %d)\n", + 1<<aggregation, cqi,bw_index,dci_fmt); + return 1<<aggregation; } @@ -1737,8 +1702,8 @@ int add_new_ue(module_id_t mod_idP, int cc_idP, rnti_t rntiP,int harq_pidP for (j=0; j<8; j++) { UE_list->UE_template[cc_idP][UE_id].oldNDI[j] = (j==0)?1:0; // 1 because first transmission is with format1A (Msg4) for harq_pid 0 UE_list->UE_template[cc_idP][UE_id].oldNDI_UL[j] = (j==harq_pidP)?0:1; // 1st transmission is with Msg3; - UE_list->UE_sched_ctrl[UE_id].round[cc_idP][j] = 8; - UE_list->UE_sched_ctrl[UE_id].round_UL[cc_idP][j] = 0; + UE_list->UE_sched_ctrl[UE_id].round[cc_idP][j] = 8; + UE_list->UE_sched_ctrl[UE_id].round_UL[cc_idP][j] = 0; } eNB_ulsch_info[mod_idP][cc_idP][UE_id].status = S_UL_WAITING; @@ -1755,7 +1720,7 @@ int add_new_ue(module_id_t mod_idP, int cc_idP, rnti_t rntiP,int harq_pidP } //------------------------------------------------------------------------------ -int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP) +int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP) //------------------------------------------------------------------------------ { int i; @@ -1790,7 +1755,6 @@ int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP) eNB_dlsch_info[mod_idP][pCC_id][UE_id].rnti = NOT_A_RNTI; eNB_dlsch_info[mod_idP][pCC_id][UE_id].status = S_DL_NONE; - // check if this has an RA process active RA_TEMPLATE *RA_template; for (i=0;i<NB_RA_PROC_MAX;i++) { @@ -1810,8 +1774,6 @@ int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP) return 0; } - - int prev(UE_list_t *listP, int nodeP, int ul_flag) { int j; @@ -1842,13 +1804,11 @@ int prev(UE_list_t *listP, int nodeP, int ul_flag) nodeP, (ul_flag == 0)? "DL" : "UL"); dump_ue_list(listP, ul_flag); - return(-1); } void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag) { - int prev_i,prev_j,next_i,next_j; LOG_T(MAC,"Swapping UE %d,%d\n",nodeiP,nodejP); @@ -1858,7 +1818,7 @@ void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag) prev_j = prev(listP,nodejP,ul_flag); AssertFatal((prev_i>=0) && (prev_j>=0), - "swap_UEs: problem"); + "swap_UEs: problem"); if (ul_flag == 0) { next_i = listP->next[nodeiP]; @@ -1899,7 +1859,6 @@ void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag) listP->next[nodejP] = next_i; listP->next[nodeiP] = next_j; - if (nodeiP==listP->head) { LOG_T(MAC,"changing head to %d\n",nodejP); listP->head=nodejP; @@ -1941,7 +1900,6 @@ void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag) listP->next_ul[nodejP] = next_i; listP->next_ul[nodeiP] = next_j; - if (nodeiP==listP->head_ul) { LOG_T(MAC,"[UL]changing head to %d\n",nodejP); listP->head_ul=nodejP; @@ -1961,13 +1919,6 @@ void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag) dump_ue_list(listP,ul_flag); } - - - - - - - /* #if defined(Rel10) || defined(Rel14) unsigned char generate_mch_header( unsigned char *mac_header, @@ -2084,11 +2035,9 @@ void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag) // This has to be updated to include BSR information uint8_t UE_is_to_be_scheduled(module_id_t module_idP,int CC_id,uint8_t UE_id) { - UE_TEMPLATE *UE_template = &RC.mac[module_idP]->UE_list.UE_template[CC_id][UE_id]; UE_sched_ctrl *UE_sched_ctl = &RC.mac[module_idP]->UE_list.UE_sched_ctrl[UE_id]; - // do not schedule UE if UL is not working if (UE_sched_ctl->ul_failure_timer>0) return(0); @@ -2107,20 +2056,18 @@ uint8_t UE_is_to_be_scheduled(module_id_t module_idP,int CC_id,uint8_t UE_id) ((UE_sched_ctl->ul_inactivity_timer>10)&& (UE_sched_ctl->ul_scheduled==0)&& (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP,UE_id)) < RRC_CONNECTED))) // every Frame when not RRC_CONNECTED - { - - LOG_D(MAC,"[eNB %d][PUSCH] UE %d/%x should be scheduled (BSR0 %d,SR %d)\n",module_idP,UE_id,UE_RNTI(module_idP,UE_id), - UE_template->bsr_info[LCGID0], - UE_template->ul_SR); + { + LOG_D(MAC,"[eNB %d][PUSCH] UE %d/%x should be scheduled (BSR0 %d,SR %d)\n",module_idP,UE_id,UE_RNTI(module_idP,UE_id), + UE_template->bsr_info[LCGID0], + UE_template->ul_SR); return(1); } else { return(0); } } - -uint8_t get_tmode(module_id_t module_idP,int CC_idP,int UE_idP) { - +uint8_t get_tmode(module_id_t module_idP,int CC_idP,int UE_idP) +{ eNB_MAC_INST *eNB = RC.mac[module_idP]; COMMON_channels_t *cc = &eNB->common_channels[CC_idP]; @@ -2132,11 +2079,11 @@ uint8_t get_tmode(module_id_t module_idP,int CC_idP,int UE_idP) { } else { AssertFatal(physicalConfigDedicated->antennaInfo!=NULL, - "antennaInfo is null for CCId %d, UEid %d\n",CC_idP,UE_idP); - - AssertFatal(physicalConfigDedicated->antennaInfo->present != PhysicalConfigDedicated__antennaInfo_PR_NOTHING, - "antennaInfo (mod_id %d, CC_id %d) is set to NOTHING\n",module_idP,CC_idP); - + "antennaInfo is null for CCId %d, UEid %d\n",CC_idP,UE_idP); + + AssertFatal(physicalConfigDedicated->antennaInfo->present != PhysicalConfigDedicated__antennaInfo_PR_NOTHING, + "antennaInfo (mod_id %d, CC_id %d) is set to NOTHING\n",module_idP,CC_idP); + if (physicalConfigDedicated->antennaInfo->present == PhysicalConfigDedicated__antennaInfo_PR_explicitValue) { return(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode); } @@ -2148,8 +2095,8 @@ uint8_t get_tmode(module_id_t module_idP,int CC_idP,int UE_idP) { } } -int8_t get_ULharq(module_id_t module_idP,int CC_idP,uint16_t frameP,uint8_t subframeP) { - +int8_t get_ULharq(module_id_t module_idP,int CC_idP,uint16_t frameP,uint8_t subframeP) +{ uint8_t ret = -1; eNB_MAC_INST *eNB = RC.mac[module_idP]; COMMON_channels_t *cc = &eNB->common_channels[CC_idP]; @@ -2157,9 +2104,7 @@ int8_t get_ULharq(module_id_t module_idP,int CC_idP,uint16_t frameP,uint8_t subf if (cc->tdd_Config==NULL) { // FDD ret = (((frameP<<1)+subframeP)&7); } else { - switch (cc->tdd_Config->subframeAssignment) { - case 1: if ((subframeP==2) || (subframeP==3) || @@ -2185,25 +2130,25 @@ int8_t get_ULharq(module_id_t module_idP,int CC_idP,uint16_t frameP,uint8_t subf case 2: AssertFatal((subframeP==2) || (subframeP==7), - "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframeP,(int)cc->tdd_Config->subframeAssignment); + "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframeP,(int)cc->tdd_Config->subframeAssignment); ret = (subframeP/7); break; case 3: AssertFatal((subframeP>1) && (subframeP<5), - "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframeP,(int)cc->tdd_Config->subframeAssignment); + "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframeP,(int)cc->tdd_Config->subframeAssignment); ret = (subframeP-2); break; case 4: AssertFatal((subframeP>1) && (subframeP<4), - "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframeP,(int)cc->tdd_Config->subframeAssignment); + "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframeP,(int)cc->tdd_Config->subframeAssignment); ret = (subframeP-2); break; case 5: AssertFatal(subframeP==2, - "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframeP,(int)cc->tdd_Config->subframeAssignment); + "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframeP,(int)cc->tdd_Config->subframeAssignment); ret = (subframeP-2); break; @@ -2214,14 +2159,13 @@ int8_t get_ULharq(module_id_t module_idP,int CC_idP,uint16_t frameP,uint8_t subf } AssertFatal(ret!=-1, - "invalid harq_pid(%d) at SFN/SF = %d/%d\n", (int8_t)ret, frameP, subframeP); + "invalid harq_pid(%d) at SFN/SF = %d/%d\n", (int8_t)ret, frameP, subframeP); return ret; } uint16_t getRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs) { - uint16_t RIV; if (Lcrbs<=(1+(N_RB_DL>>1))) @@ -2234,7 +2178,6 @@ uint16_t getRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs) uint32_t allocate_prbs(int UE_id,unsigned char nb_rb, int N_RB_DL, uint32_t *rballoc) { - int i; uint32_t rballoc_dci=0; unsigned char nb_rb_alloc=0; @@ -2263,9 +2206,8 @@ uint32_t allocate_prbs(int UE_id,unsigned char nb_rb, int N_RB_DL, uint32_t *rba int get_bw_index(module_id_t module_id, uint8_t CC_id) { - int bw_index=0; - + int N_RB_DL = to_prb(RC.mac[module_id]->common_channels[CC_id].mib->message.dl_Bandwidth); switch (N_RB_DL) { @@ -2296,7 +2238,6 @@ int get_bw_index(module_id_t module_id, uint8_t CC_id) int get_min_rb_unit(module_id_t module_id, uint8_t CC_id) { - int min_rb_unit=0; int N_RB_DL = to_prb(RC.mac[module_id]->common_channels[CC_id].mib->message.dl_Bandwidth); @@ -2329,7 +2270,6 @@ int get_min_rb_unit(module_id_t module_id, uint8_t CC_id) uint32_t allocate_prbs_sub(int nb_rb, int N_RB_DL, int N_RBG, uint8_t *rballoc) { - int check=0;//check1=0,check2=0; uint32_t rballoc_dci=0; //uint8_t number_of_subbands=13; @@ -2382,16 +2322,17 @@ uint32_t allocate_prbs_sub(int nb_rb, int N_RB_DL, int N_RBG, uint8_t *rballoc) return (rballoc_dci); } -int get_subbandsize(uint8_t dl_Bandwidth) { +int get_subbandsize(uint8_t dl_Bandwidth) +{ uint8_t ss[6] = {6,4,4,6,8,8}; AssertFatal(dl_Bandwidth<6,"dl_Bandwidth %d is out of bounds\n",dl_Bandwidth); return(ss[dl_Bandwidth]); } + int get_nb_subband(int N_RB_DL) { - int nb_sb=0; switch (N_RB_DL) { @@ -2424,23 +2365,21 @@ int get_nb_subband(int N_RB_DL) } return nb_sb; - } void init_CCE_table(int module_idP,int CC_idP) { memset(RC.mac[module_idP]->CCE_table[CC_idP],0,800*sizeof(int)); -} +} int get_nCCE_offset(int *CCE_table, - const unsigned char L, - const int nCCE, - const int common_dci, - const unsigned short rnti, - const unsigned char subframe) + const unsigned char L, + const int nCCE, + const int common_dci, + const unsigned short rnti, + const unsigned char subframe) { - int search_space_free,m,nb_candidates = 0,l,i; unsigned int Yk; /* @@ -2461,16 +2400,16 @@ int get_nCCE_offset(int *CCE_table, search_space_free = 1; for (l=0; l<L; l++) { - // printf("CCE_table[%d] %d\n",(m*L)+l,CCE_table[(m*L)+l]); + // printf("CCE_table[%d] %d\n",(m*L)+l,CCE_table[(m*L)+l]); if (CCE_table[(m*L) + l] == 1) { search_space_free = 0; break; } } - + if (search_space_free == 1) { - // printf("returning %d\n",m*L); + // printf("returning %d\n",m*L); for (l=0; l<L; l++) CCE_table[(m*L)+l]=1; @@ -2490,7 +2429,6 @@ int get_nCCE_offset(int *CCE_table, Yk = Yk % (nCCE/L); - switch (L) { case 1: case 2: @@ -2507,7 +2445,6 @@ int get_nCCE_offset(int *CCE_table, break; } - LOG_D(MAC,"rnti %x, Yk = %d, nCCE %d (nCCE/L %d),nb_cand %d\n",rnti,Yk,nCCE,nCCE/L,nb_candidates); for (m = 0 ; m < nb_candidates ; m++) { @@ -2533,11 +2470,11 @@ int get_nCCE_offset(int *CCE_table, } } -void dump_CCE_table(int *CCE_table,const int nCCE,const unsigned short rnti,const int subframe,int L) { - +void dump_CCE_table(int *CCE_table,const int nCCE,const unsigned short rnti,const int subframe,int L) +{ int nb_candidates = 0,i; unsigned int Yk; - + printf("CCE 0: "); for (i=0;i<nCCE;i++) { printf("%1d.",CCE_table[i]); @@ -2546,46 +2483,40 @@ void dump_CCE_table(int *CCE_table,const int nCCE,const unsigned short rnti,cons } Yk = (unsigned int)rnti; - + for (i=0; i<=subframe; i++) Yk = (Yk*39827)%65537; - + Yk = Yk % (nCCE/L); - - + switch (L) { case 1: case 2: nb_candidates = 6; break; - + case 4: case 8: nb_candidates = 2; break; - + default: DevParam(L, nCCE, rnti); break; } - - - printf("rnti %x, Yk*L = %d, nCCE %d (nCCE/L %d),nb_cand*L %d\n",rnti,Yk*L,nCCE,nCCE/L,nb_candidates*L); + printf("rnti %x, Yk*L = %d, nCCE %d (nCCE/L %d),nb_cand*L %d\n",rnti,Yk*L,nCCE,nCCE/L,nb_candidates*L); } - - uint16_t getnquad(COMMON_channels_t *cc, uint8_t num_pdcch_symbols,uint8_t mi) { - uint16_t Nreg=0; AssertFatal(cc!=NULL,"cc is null\n"); AssertFatal(cc->mib!=NULL,"cc->mib is null\n"); int N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth); - int phich_resource = get_phich_resource_times6(cc); + int phich_resource = get_phich_resource_times6(cc); uint8_t Ngroup_PHICH = (phich_resource*N_RB_DL)/48; @@ -2630,8 +2561,8 @@ uint16_t getnCCE(COMMON_channels_t *cc, uint8_t num_pdcch_symbols, uint8_t mi) return(getnquad(cc,num_pdcch_symbols,mi)/9); } -uint8_t getmi(COMMON_channels_t *cc,int subframe) { - +uint8_t getmi(COMMON_channels_t *cc,int subframe) +{ AssertFatal(cc!=NULL,"cc is null\n"); // for FDD @@ -2640,7 +2571,6 @@ uint8_t getmi(COMMON_channels_t *cc,int subframe) { // for TDD switch (cc->tdd_Config->subframeAssignment) { - case 0: if ((subframe==0) || (subframe==5)) return(2); @@ -2696,16 +2626,15 @@ uint16_t get_nCCE_max(COMMON_channels_t *cc, int num_pdcch_symbols,int subframe) { AssertFatal(cc!=NULL,"cc is null\n"); return(getnCCE(cc,num_pdcch_symbols, - getmi(cc,subframe))); + getmi(cc,subframe))); } - + // Allocate the CCEs int allocate_CCEs(int module_idP, - int CC_idP, - int subframeP, - int test_onlyP) { - - + int CC_idP, + int subframeP, + int test_onlyP) +{ int *CCE_table = RC.mac[module_idP]->CCE_table[CC_idP]; nfapi_dl_config_request_body_t *DL_req = &RC.mac[module_idP]->DL_req[CC_idP].dl_config_request_body; nfapi_hi_dci0_request_body_t *HI_DCI0_req = &RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body; @@ -2716,7 +2645,6 @@ int allocate_CCEs(int module_idP, int i,j,idci; int nCCE=0; - LOG_D(MAC,"Allocate CCEs subframe %d, test %d : (DL PDU %d, DL DCI %d, UL %d)\n",subframeP,test_onlyP,DL_req->number_pdu,DL_req->number_dci,HI_DCI0_req->number_of_dci); DL_req->number_pdcch_ofdm_symbols=1; @@ -2724,65 +2652,64 @@ try_again: init_CCE_table(module_idP,CC_idP); nCCE=0; - for (i=0,idci=0;i<DL_req->number_pdu;i++) { // allocate DL common DCIs first if ((dl_config_pdu[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)&& - (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type==2) - ) { + (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type==2) + ) { LOG_D(MAC,"Trying to allocate COMMON DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n", - idci,DL_req->number_dci+HI_DCI0_req->number_of_dci, - DL_req->number_dci,HI_DCI0_req->number_of_dci, - dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti, - dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, - nCCE,nCCE_max, DL_req->number_pdcch_ofdm_symbols); - + idci,DL_req->number_dci+HI_DCI0_req->number_of_dci, + DL_req->number_dci,HI_DCI0_req->number_of_dci, + dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti, + dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, + nCCE,nCCE_max, DL_req->number_pdcch_ofdm_symbols); + if (nCCE + (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level) > nCCE_max) { - if (DL_req->number_pdcch_ofdm_symbols == 3) - goto failed; - LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",DL_req->number_pdcch_ofdm_symbols); - DL_req->number_pdcch_ofdm_symbols++; - nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP); - goto try_again; + if (DL_req->number_pdcch_ofdm_symbols == 3) + goto failed; + LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",DL_req->number_pdcch_ofdm_symbols); + DL_req->number_pdcch_ofdm_symbols++; + nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP); + goto try_again; } - + // number of CCEs left can potentially hold this allocation fCCE = get_nCCE_offset(CCE_table, - dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, - nCCE_max, - 1, - dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti, - subframeP); + dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, + nCCE_max, + 1, + dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti, + subframeP); if (fCCE == -1) { - if (DL_req->number_pdcch_ofdm_symbols == 3) { - LOG_D(MAC,"subframe %d: Dropping Allocation for RNTI %x\n", - subframeP,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti); - for (j=0;j<=i;j++){ - if (dl_config_pdu[j].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) - LOG_D(MAC,"DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n", - j,DL_req->number_dci+HI_DCI0_req->number_of_dci, - DL_req->number_dci,HI_DCI0_req->number_of_dci, - dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.rnti, - dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.dci_format, - dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, - nCCE,nCCE_max,DL_req->number_pdcch_ofdm_symbols); - } - //dump_CCE_table(CCE_table,nCCE_max,subframeP,dci_alloc->rnti,1<<dci_alloc->L); - goto failed; - } - LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols (rnti condition), increasing by 1\n",DL_req->number_pdcch_ofdm_symbols); - - DL_req->number_pdcch_ofdm_symbols++; - nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP); - goto try_again; + if (DL_req->number_pdcch_ofdm_symbols == 3) { + LOG_D(MAC,"subframe %d: Dropping Allocation for RNTI %x\n", + subframeP,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti); + for (j=0;j<=i;j++){ + if (dl_config_pdu[j].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) + LOG_D(MAC,"DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n", + j,DL_req->number_dci+HI_DCI0_req->number_of_dci, + DL_req->number_dci,HI_DCI0_req->number_of_dci, + dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.rnti, + dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.dci_format, + dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, + nCCE,nCCE_max,DL_req->number_pdcch_ofdm_symbols); + } + //dump_CCE_table(CCE_table,nCCE_max,subframeP,dci_alloc->rnti,1<<dci_alloc->L); + goto failed; + } + LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols (rnti condition), increasing by 1\n",DL_req->number_pdcch_ofdm_symbols); + + DL_req->number_pdcch_ofdm_symbols++; + nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP); + goto try_again; } // fCCE==-1 - + // the allocation is feasible, rnti rule passes nCCE += dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level; LOG_D(MAC,"Allocating at nCCE %d\n",fCCE); if (test_onlyP == 0) { - dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx=fCCE; - LOG_D(MAC,"Allocate COMMON DCI CCEs subframe %d, test %d => L %d fCCE %d\n",subframeP,test_onlyP,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,fCCE); + dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx=fCCE; + LOG_D(MAC,"Allocate COMMON DCI CCEs subframe %d, test %d => L %d fCCE %d\n",subframeP,test_onlyP,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,fCCE); } idci++; } @@ -2791,62 +2718,62 @@ try_again: // no try to allocate UL DCIs for (i=0;i<HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi;i++) { - // allocate UL DCIs + // allocate UL DCIs if (hi_dci0_pdu[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) { LOG_D(MAC,"Trying to allocate format 0 DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n", - idci,DL_req->number_dci+HI_DCI0_req->number_of_dci, - DL_req->number_dci,HI_DCI0_req->number_of_dci, - hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti,hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level, - nCCE,nCCE_max, DL_req->number_pdcch_ofdm_symbols); - + idci,DL_req->number_dci+HI_DCI0_req->number_of_dci, + DL_req->number_dci,HI_DCI0_req->number_of_dci, + hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti,hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level, + nCCE,nCCE_max, DL_req->number_pdcch_ofdm_symbols); + if (nCCE + (hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level) > nCCE_max) { - if (DL_req->number_pdcch_ofdm_symbols == 3) - goto failed; - LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",DL_req->number_pdcch_ofdm_symbols); + if (DL_req->number_pdcch_ofdm_symbols == 3) + goto failed; + LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",DL_req->number_pdcch_ofdm_symbols); - DL_req->number_pdcch_ofdm_symbols++; - nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP); - goto try_again; + DL_req->number_pdcch_ofdm_symbols++; + nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP); + goto try_again; } - + // number of CCEs left can potentially hold this allocation fCCE = get_nCCE_offset(CCE_table, - hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level, - nCCE_max, - 0, - hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti, - subframeP); + hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level, + nCCE_max, + 0, + hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti, + subframeP); if (fCCE == -1) { - if (DL_req->number_pdcch_ofdm_symbols == 3) { - LOG_D(MAC,"subframe %d: Dropping Allocation for RNTI %x\n", - subframeP,hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti); - for (j=0;j<=i;j++){ - if (hi_dci0_pdu[j].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) - LOG_D(MAC,"DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n", - j,DL_req->number_dci+HI_DCI0_req->number_of_dci, - DL_req->number_dci,HI_DCI0_req->number_of_dci, - hi_dci0_pdu[j].dci_pdu.dci_pdu_rel8.rnti, - hi_dci0_pdu[j].dci_pdu.dci_pdu_rel8.dci_format, - hi_dci0_pdu[j].dci_pdu.dci_pdu_rel8.aggregation_level, - nCCE,nCCE_max,DL_req->number_pdcch_ofdm_symbols); - } - //dump_CCE_table(CCE_table,nCCE_max,subframeP,dci_alloc->rnti,1<<dci_alloc->L); - goto failed; - } - LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols (rnti condition), increasing by 1\n",DL_req->number_pdcch_ofdm_symbols); - - DL_req->number_pdcch_ofdm_symbols++; - nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP); - goto try_again; + if (DL_req->number_pdcch_ofdm_symbols == 3) { + LOG_D(MAC,"subframe %d: Dropping Allocation for RNTI %x\n", + subframeP,hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti); + for (j=0;j<=i;j++){ + if (hi_dci0_pdu[j].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) + LOG_D(MAC,"DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n", + j,DL_req->number_dci+HI_DCI0_req->number_of_dci, + DL_req->number_dci,HI_DCI0_req->number_of_dci, + hi_dci0_pdu[j].dci_pdu.dci_pdu_rel8.rnti, + hi_dci0_pdu[j].dci_pdu.dci_pdu_rel8.dci_format, + hi_dci0_pdu[j].dci_pdu.dci_pdu_rel8.aggregation_level, + nCCE,nCCE_max,DL_req->number_pdcch_ofdm_symbols); + } + //dump_CCE_table(CCE_table,nCCE_max,subframeP,dci_alloc->rnti,1<<dci_alloc->L); + goto failed; + } + LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols (rnti condition), increasing by 1\n",DL_req->number_pdcch_ofdm_symbols); + + DL_req->number_pdcch_ofdm_symbols++; + nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP); + goto try_again; } // fCCE==-1 - + // the allocation is feasible, rnti rule passes nCCE += hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level; LOG_D(MAC,"Allocating at nCCE %d\n",fCCE); if (test_onlyP == 0) { - hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.cce_index=fCCE; - LOG_D(MAC,"Allocate CCEs subframe %d, test %d\n",subframeP,test_onlyP); + hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.cce_index=fCCE; + LOG_D(MAC,"Allocate CCEs subframe %d, test %d\n",subframeP,test_onlyP); } idci++; } @@ -2855,60 +2782,60 @@ try_again: for (i=0;i<DL_req->number_pdu;i++) { // allocate DL common DCIs first if ((dl_config_pdu[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)&& - (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type==1)) { + (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type==1)) { LOG_D(MAC,"Trying to allocate DL UE-SPECIFIC DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n", - idci,DL_req->number_dci+HI_DCI0_req->number_of_dci, - DL_req->number_dci,HI_DCI0_req->number_of_dci, - dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, - nCCE,nCCE_max, DL_req->number_pdcch_ofdm_symbols); - + idci,DL_req->number_dci+HI_DCI0_req->number_of_dci, + DL_req->number_dci,HI_DCI0_req->number_of_dci, + dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, + nCCE,nCCE_max, DL_req->number_pdcch_ofdm_symbols); + if (nCCE + (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level) > nCCE_max) { - if (DL_req->number_pdcch_ofdm_symbols == 3) - goto failed; - LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",DL_req->number_pdcch_ofdm_symbols); + if (DL_req->number_pdcch_ofdm_symbols == 3) + goto failed; + LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",DL_req->number_pdcch_ofdm_symbols); - DL_req->number_pdcch_ofdm_symbols++; - nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP); - goto try_again; + DL_req->number_pdcch_ofdm_symbols++; + nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP); + goto try_again; } - + // number of CCEs left can potentially hold this allocation fCCE = get_nCCE_offset(CCE_table, - dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, - nCCE_max, - 0, - dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti, - subframeP); + dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, + nCCE_max, + 0, + dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti, + subframeP); if (fCCE == -1) { - if (DL_req->number_pdcch_ofdm_symbols == 3) { - LOG_I(MAC,"subframe %d: Dropping Allocation for RNTI %x\n", - subframeP,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti); - for (j=0;j<=i;j++){ - if (dl_config_pdu[j].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) - LOG_I(MAC,"DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n", - j,DL_req->number_dci+HI_DCI0_req->number_of_dci, - DL_req->number_dci,HI_DCI0_req->number_of_dci, - dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.rnti, - dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.dci_format, - dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, - nCCE,nCCE_max,DL_req->number_pdcch_ofdm_symbols); - } - //dump_CCE_table(CCE_table,nCCE_max,subframeP,dci_alloc->rnti,1<<dci_alloc->L); - goto failed; - } - LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols (rnti condition), increasing by 1\n",DL_req->number_pdcch_ofdm_symbols); - - DL_req->number_pdcch_ofdm_symbols++; - nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP); - goto try_again; + if (DL_req->number_pdcch_ofdm_symbols == 3) { + LOG_I(MAC,"subframe %d: Dropping Allocation for RNTI %x\n", + subframeP,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti); + for (j=0;j<=i;j++){ + if (dl_config_pdu[j].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) + LOG_I(MAC,"DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n", + j,DL_req->number_dci+HI_DCI0_req->number_of_dci, + DL_req->number_dci,HI_DCI0_req->number_of_dci, + dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.rnti, + dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.dci_format, + dl_config_pdu[j].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, + nCCE,nCCE_max,DL_req->number_pdcch_ofdm_symbols); + } + //dump_CCE_table(CCE_table,nCCE_max,subframeP,dci_alloc->rnti,1<<dci_alloc->L); + goto failed; + } + LOG_D(MAC,"Can't fit DCI allocations with %d PDCCH symbols (rnti condition), increasing by 1\n",DL_req->number_pdcch_ofdm_symbols); + + DL_req->number_pdcch_ofdm_symbols++; + nCCE_max = get_nCCE_max(&RC.mac[module_idP]->common_channels[CC_idP],DL_req->number_pdcch_ofdm_symbols,subframeP); + goto try_again; } // fCCE==-1 - + // the allocation is feasible, rnti rule passes nCCE += dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level; LOG_D(MAC,"Allocating at nCCE %d\n",fCCE); if (test_onlyP == 0) { - dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx=fCCE; - LOG_D(MAC,"Allocate CCEs subframe %d, test %d\n",subframeP,test_onlyP); + dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx=fCCE; + LOG_D(MAC,"Allocate CCEs subframe %d, test %d\n",subframeP,test_onlyP); } idci++; } @@ -2916,19 +2843,17 @@ try_again: return 0; - - failed: +failed: return -1; } /* -uint8_t get_ul_req_index(module_id_t module_idP, int CC_idP, sub_frame_t subframeP) { - - if (RC.mac[module_idP]->common_channels[CC_idP].tdd_Config == NULL) +uint8_t get_ul_req_index(module_id_t module_idP, int CC_idP, sub_frame_t subframeP) +{ + if (RC.mac[module_idP]->common_channels[CC_idP].tdd_Config == NULL) return(0); - + switch (RC.mac[module_idP]->common_channels[CC_idP].tdd_Config->subframeAssignment) { - case 0: case 1: case 2: @@ -2958,12 +2883,12 @@ uint8_t get_ul_req_index(module_id_t module_idP, int CC_idP, sub_frame_t subfram return(0); } */ - -nfapi_ul_config_request_pdu_t* has_ul_grant(module_id_t module_idP,int CC_idP,uint16_t absSFP,uint16_t rnti) { - nfapi_ul_config_request_body_t *ul_req; - nfapi_ul_config_request_pdu_t *ul_config_pdu; - +nfapi_ul_config_request_pdu_t* has_ul_grant(module_id_t module_idP,int CC_idP,uint16_t absSFP,uint16_t rnti) +{ + nfapi_ul_config_request_body_t *ul_req; + nfapi_ul_config_request_pdu_t *ul_config_pdu; + ul_req = &RC.mac[module_idP]->UL_req_tmp[CC_idP][absSFP%10].ul_config_request_body; ul_config_pdu = &ul_req->ul_config_pdu_list[0]; LOG_D(MAC,"Checking for rnti %x UL grant in subframeP %d (num pdu %d)\n",rnti,absSFP%10,ul_req->number_of_pdus); @@ -2971,53 +2896,51 @@ nfapi_ul_config_request_pdu_t* has_ul_grant(module_id_t module_idP,int CC_idP,ui for (int i=0; i<ul_req->number_of_pdus;i++){ LOG_D(MAC,"PDU %d : type %d,rnti %x\n",i,ul_config_pdu[i].pdu_type,rnti); if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE)&& - (ul_config_pdu[i].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]); + (ul_config_pdu[i].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]); if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE)&& - (ul_config_pdu[i].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]); + (ul_config_pdu[i].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]); if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE)&& - (ul_config_pdu[i].ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]); + (ul_config_pdu[i].ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]); if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE)&& - (ul_config_pdu[i].ulsch_cqi_harq_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]); + (ul_config_pdu[i].ulsch_cqi_harq_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]); if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE)&& - (ul_config_pdu[i].uci_cqi_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]); + (ul_config_pdu[i].uci_cqi_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]); if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE)&& - (ul_config_pdu[i].uci_sr_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]); + (ul_config_pdu[i].uci_sr_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]); if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE)&& - (ul_config_pdu[i].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]); + (ul_config_pdu[i].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]); if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE)&& - (ul_config_pdu[i].uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]); + (ul_config_pdu[i].uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]); if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE)&& - (ul_config_pdu[i].uci_cqi_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]); + (ul_config_pdu[i].uci_cqi_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]); if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE)&& - (ul_config_pdu[i].uci_cqi_sr_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]); + (ul_config_pdu[i].uci_cqi_sr_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]); if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE) && - (ul_config_pdu[i].uci_cqi_sr_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]); + (ul_config_pdu[i].uci_cqi_sr_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)) return(&ul_config_pdu[i]); if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE)&& - (ul_config_pdu[i].ulsch_uci_csi_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]); + (ul_config_pdu[i].ulsch_uci_csi_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]); if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE)&& - (ul_config_pdu[i].ulsch_uci_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]); + (ul_config_pdu[i].ulsch_uci_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]); if ((ul_config_pdu[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE)&& - (ul_config_pdu[i].ulsch_csi_uci_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]); - - - + (ul_config_pdu[i].ulsch_csi_uci_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)) return(&ul_config_pdu[i]); } + return(NULL); // no ul grant at all for this UE } - + boolean_t CCE_allocation_infeasible(int module_idP, - int CC_idP, - int format_flag, - int subframe, - int aggregation, - int rnti) + int CC_idP, + int format_flag, + int subframe, + int aggregation, + int rnti) { nfapi_dl_config_request_body_t *DL_req = &RC.mac[module_idP]->DL_req[CC_idP].dl_config_request_body; nfapi_dl_config_request_pdu_t *dl_config_pdu = &DL_req->dl_config_pdu_list[DL_req->number_pdu]; nfapi_hi_dci0_request_body_t *HI_DCI0_req = &RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body; - nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi]; + nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi]; int ret; boolean_t res = FALSE; @@ -3032,10 +2955,10 @@ boolean_t CCE_allocation_infeasible(int module_idP, dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = aggregation; DL_req->number_pdu++; LOG_D(MAC,"Subframe %d: Checking CCE feasibility format %d : (%x,%d) (%x,%d,%d)\n", - subframe,format_flag,rnti,aggregation, - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti, - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type); + subframe,format_flag,rnti,aggregation, + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti, + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type); ret = allocate_CCEs(module_idP,CC_idP,subframe,0); if (ret==-1) res = TRUE; @@ -3061,8 +2984,8 @@ boolean_t CCE_allocation_infeasible(int module_idP, return res; } -void extract_harq(module_id_t mod_idP,int CC_idP,int UE_id,frame_t frameP,sub_frame_t subframeP,void *harq_indication,int format) { - +void extract_harq(module_id_t mod_idP,int CC_idP,int UE_id,frame_t frameP,sub_frame_t subframeP,void *harq_indication,int format) +{ UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list; UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; rnti_t rnti = UE_RNTI(mod_idP,UE_id); @@ -3081,16 +3004,16 @@ void extract_harq(module_id_t mod_idP,int CC_idP,int UE_id,frame_t frameP,sub_fr AssertFatal(UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->pucch_ConfigDedicated!=NULL,"pucch_ConfigDedicated is null!\n"); if ((UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7) && (UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13) && - (((UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13->spatialBundlingPUCCH_r13) && - (format==0)) || - ((UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13->spatialBundlingPUSCH_r13) && - (format==1)))) + (((UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13->spatialBundlingPUCCH_r13) && + (format==0)) || + ((UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated->ext7->pucch_ConfigDedicated_r13->spatialBundlingPUSCH_r13) && + (format==1)))) spatial_bundling = 1; #endif for (i=0;i<numCC;i++) tmode[i] = get_tmode(mod_idP,i,UE_id); - - if (cc->tdd_Config) { + + if (cc->tdd_Config) { harq_indication_tdd = (nfapi_harq_indication_tdd_rel13_t *)harq_indication; // pdu = &harq_indication_tdd->harq_tb_n[0]; @@ -3098,20 +3021,19 @@ void extract_harq(module_id_t mod_idP,int CC_idP,int UE_id,frame_t frameP,sub_fr switch (harq_indication_tdd->mode) { case 0: // Format 1a/b - AssertFatal(numCC==1,"numCC %d > 1, should not be using Format1a/b\n",numCC); - break; + AssertFatal(numCC==1,"numCC %d > 1, should not be using Format1a/b\n",numCC); + break; case 1: // Channel Selection - break; + break; case 2: // Format 3 - break; + break; case 3: // Format 4 - break; + break; case 4: // Format 5 - break; + break; } } else { - harq_indication_fdd = (nfapi_harq_indication_fdd_rel13_t *)harq_indication; num_ack_nak = harq_indication_fdd->number_of_ack_nack; pdu = &harq_indication_fdd->harq_tb_n[0]; @@ -3120,193 +3042,194 @@ void extract_harq(module_id_t mod_idP,int CC_idP,int UE_id,frame_t frameP,sub_fr switch (harq_indication_fdd->mode) { case 0: // Format 1a/b (10.1.2.1) - AssertFatal(numCC==1,"numCC %d > 1, should not be using Format1a/b\n",numCC); - if (tmode[0]==1 || tmode[0]==2 || tmode[0]==5 || tmode[0]==6 || tmode[0]==7) { // NOTE: have to handle the case of TM9-10 with 1 antenna port - // single ACK/NAK bit - AssertFatal(num_ack_nak==1,"num_ack_nak %d > 1 for 1 CC and single-layer transmission\n",num_ack_nak); - AssertFatal(sched_ctl->round[CC_idP][harq_pid]<8,"Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n",harq_pid,UE_id,rnti); - AssertFatal(pdu[0] == 1 || pdu[0] == 2 || pdu[0] == 4, + AssertFatal(numCC==1,"numCC %d > 1, should not be using Format1a/b\n",numCC); + if (tmode[0]==1 || tmode[0]==2 || tmode[0]==5 || tmode[0]==6 || tmode[0]==7) { // NOTE: have to handle the case of TM9-10 with 1 antenna port + // single ACK/NAK bit + AssertFatal(num_ack_nak==1,"num_ack_nak %d > 1 for 1 CC and single-layer transmission\n",num_ack_nak); + AssertFatal(sched_ctl->round[CC_idP][harq_pid]<8,"Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n",harq_pid,UE_id,rnti); + AssertFatal(pdu[0] == 1 || pdu[0] == 2 || pdu[0] == 4, "Received ACK/NAK %d which is not 1 or 2 for harq_pid %d from UE %d/%x\n",pdu[0],harq_pid,UE_id,rnti); - LOG_D(MAC,"Received %d for harq_pid %d\n",pdu[0],harq_pid); - - if (pdu[0] == 1) { // ACK - sched_ctl->round[CC_idP][harq_pid]=8; // release HARQ process - sched_ctl->tbcnt[CC_idP][harq_pid]=0; - } - else if (pdu[0] == 2 || pdu[0] == 4) // NAK (treat DTX as NAK) - sched_ctl->round[CC_idP][harq_pid]++; // increment round - } - else { - // one or two ACK/NAK bits - AssertFatal(num_ack_nak>2,"num_ack_nak %d > 2 for 1 CC and TM3/4/8/9/10\n",num_ack_nak); - if ((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[CC_idP][harq_pid]==1) && (pdu[0] == 1) && (pdu[1] == 1)) { - sched_ctl->round[CC_idP][harq_pid]=8; - sched_ctl->tbcnt[CC_idP][harq_pid]=0; - } - if ((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[CC_idP][harq_pid]==1) && (pdu[0] == 2) && (pdu[1] == 2)) - sched_ctl->round[CC_idP][harq_pid]++; - else if (((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[0][harq_pid]==2) && (pdu[0] == 1) && (pdu[1] == 2)) || - ((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[CC_idP][harq_pid]==2) && (pdu[0] == 2) && (pdu[1] == 1))) { - sched_ctl->round[CC_idP][harq_pid]++; - sched_ctl->tbcnt[CC_idP][harq_pid]=1; - } - else if ((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[CC_idP][harq_pid]==2) && (pdu[0] == 2) && (pdu[1] == 2)) - sched_ctl->round[CC_idP][harq_pid]++; - else AssertFatal(1==0,"Illegal ACK/NAK/round combination (%d,%d,%d,%d,%d) for harq_pid %d, UE %d/%x\n", - num_ack_nak,sched_ctl->round[CC_idP][harq_pid],sched_ctl->round[CC_idP][harq_pid],pdu[0],pdu[1], harq_pid,UE_id, - rnti); - } - break; + LOG_D(MAC,"Received %d for harq_pid %d\n",pdu[0],harq_pid); + + if (pdu[0] == 1) { // ACK + sched_ctl->round[CC_idP][harq_pid]=8; // release HARQ process + sched_ctl->tbcnt[CC_idP][harq_pid]=0; + } + else if (pdu[0] == 2 || pdu[0] == 4) // NAK (treat DTX as NAK) + sched_ctl->round[CC_idP][harq_pid]++; // increment round + } + else { + // one or two ACK/NAK bits + AssertFatal(num_ack_nak>2,"num_ack_nak %d > 2 for 1 CC and TM3/4/8/9/10\n",num_ack_nak); + if ((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[CC_idP][harq_pid]==1) && (pdu[0] == 1) && (pdu[1] == 1)) { + sched_ctl->round[CC_idP][harq_pid]=8; + sched_ctl->tbcnt[CC_idP][harq_pid]=0; + } + if ((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[CC_idP][harq_pid]==1) && (pdu[0] == 2) && (pdu[1] == 2)) + sched_ctl->round[CC_idP][harq_pid]++; + else if (((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[0][harq_pid]==2) && (pdu[0] == 1) && (pdu[1] == 2)) || + ((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[CC_idP][harq_pid]==2) && (pdu[0] == 2) && (pdu[1] == 1))) { + sched_ctl->round[CC_idP][harq_pid]++; + sched_ctl->tbcnt[CC_idP][harq_pid]=1; + } + else if ((num_ack_nak==2) && (sched_ctl->round[CC_idP][harq_pid]<8) && (sched_ctl->tbcnt[CC_idP][harq_pid]==2) && (pdu[0] == 2) && (pdu[1] == 2)) + sched_ctl->round[CC_idP][harq_pid]++; + else AssertFatal(1==0,"Illegal ACK/NAK/round combination (%d,%d,%d,%d,%d) for harq_pid %d, UE %d/%x\n", + num_ack_nak,sched_ctl->round[CC_idP][harq_pid],sched_ctl->round[CC_idP][harq_pid],pdu[0],pdu[1], harq_pid,UE_id, + rnti); + } + break; case 1: // FDD Channel Selection (10.1.2.2.1), must be received for 2 serving cells - AssertFatal(numCC==2,"Should not receive harq indication with channel selection with %d active CCs\n", - numCC); - - if ((num_ack_nak == 2) && (sched_ctl->round[pCCid][harq_pid]<8) && (sched_ctl->round[1-pCCid][harq_pid]<8) && (sched_ctl->tbcnt[pCCid][harq_pid]==1) && (sched_ctl->tbcnt[1-pCCid][harq_pid]==1)) { - AssertFatal(pdu[0]<=3,"pdu[0] %d is not ACK/NAK/DTX\n",pdu[0]); - AssertFatal(pdu[1]<=3,"pdu[1] %d is not ACK/NAK/DTX\n",pdu[1]); - if (pdu[0] == 1) sched_ctl->round[pCCid][harq_pid]=8; - else sched_ctl->round[pCCid][harq_pid]++; - if (pdu[1] == 1) sched_ctl->round[1-pCCid][harq_pid]=8; - else sched_ctl->round[1-pCCid][harq_pid]++; - } // A=2 - else if ((num_ack_nak == 3) && (sched_ctl->round[pCCid][harq_pid]<8) && (sched_ctl->tbcnt[pCCid][harq_pid]==2) && (sched_ctl->round[1-pCCid][harq_pid]<8) && (sched_ctl->tbcnt[1-pCCid][harq_pid]==1)) { - AssertFatal(pdu[0]<=3,"pdu[0] %d is not ACK/NAK/DTX\n",pdu[0]); - AssertFatal(pdu[1]<=3,"pdu[1] %d is not ACK/NAK/DTX\n",pdu[1]); - AssertFatal(pdu[2]<=3,"pdu[2] %d is not ACK/NAK/DTX\n",pdu[2]); - AssertFatal(sched_ctl->tbcnt[pCCid][harq_pid] == 2,"sched_ctl->tbcnt[%d][%d] != 2 for UE %d/%x\n",pCCid,harq_pid,UE_id,rnti); - AssertFatal(sched_ctl->tbcnt[1-pCCid][harq_pid] == 1,"sched_ctl->tbcnt[%d][%d] != 1 for UE %d/%x\n",1-pCCid,harq_pid,UE_id,rnti); - if ((pdu[0] == 1) && (pdu[1] == 1)) { // both ACK - sched_ctl->round[pCCid][harq_pid]=8; - sched_ctl->tbcnt[pCCid][harq_pid]=0; - } - else if (((pdu[0] == 2) && (pdu[1] == 1))|| - ((pdu[0] == 1) && (pdu[1] == 2))){ - sched_ctl->round[pCCid][harq_pid]++; - sched_ctl->tbcnt[pCCid][harq_pid]=1; - } - else - sched_ctl->round[pCCid][harq_pid]++; - - if (pdu[2] == 1) sched_ctl->round[1-pCCid][harq_pid]=8; - else sched_ctl->round[1-pCCid][harq_pid]++; - } // A=3 primary cell has 2 TBs - else if ((num_ack_nak == 3) && (sched_ctl->round[1-pCCid][harq_pid]<8) && (sched_ctl->round[pCCid][harq_pid]<8) && (sched_ctl->tbcnt[1-pCCid][harq_pid]==2) && (sched_ctl->tbcnt[pCCid][harq_pid]==1)) { - AssertFatal(pdu[0]<=3,"pdu[0] %d is not ACK/NAK/DTX\n",pdu[0]); - AssertFatal(pdu[1]<=3,"pdu[1] %d is not ACK/NAK/DTX\n",pdu[1]); - AssertFatal(pdu[2]<=3,"pdu[2] %d is not ACK/NAK/DTX\n",pdu[2]); - AssertFatal(sched_ctl->tbcnt[1-pCCid][harq_pid] == 2,"sched_ctl->tbcnt[%d][%d] != 2 for UE %d/%x\n",1-pCCid,harq_pid,UE_id,rnti); - AssertFatal(sched_ctl->tbcnt[pCCid][harq_pid] == 1,"sched_ctl->tbcnt[%d][%d] != 1 for UE %d/%x\n",pCCid,harq_pid,UE_id,rnti); - if ((pdu[0] == 1) && (pdu[1] == 1)) { // both ACK - sched_ctl->round[1-pCCid][harq_pid]=8; - sched_ctl->tbcnt[1-pCCid][harq_pid]=0; - } - else if (((pdu[0] >= 2) && (pdu[1] == 1))|| - ((pdu[0] == 1) && (pdu[1] >= 2))){ // one ACK - sched_ctl->round[1-pCCid][harq_pid]++; - sched_ctl->tbcnt[1-pCCid][harq_pid]=1; - } - else // both NAK/DTX - sched_ctl->round[1-pCCid][harq_pid]++; - - if (pdu[2] == 1) sched_ctl->round[pCCid][harq_pid]=8; - else sched_ctl->round[pCCid][harq_pid]++; - } // A=3 secondary cell has 2 TBs + AssertFatal(numCC==2,"Should not receive harq indication with channel selection with %d active CCs\n", + numCC); + + if ((num_ack_nak == 2) && (sched_ctl->round[pCCid][harq_pid]<8) && (sched_ctl->round[1-pCCid][harq_pid]<8) && (sched_ctl->tbcnt[pCCid][harq_pid]==1) && (sched_ctl->tbcnt[1-pCCid][harq_pid]==1)) { + AssertFatal(pdu[0]<=3,"pdu[0] %d is not ACK/NAK/DTX\n",pdu[0]); + AssertFatal(pdu[1]<=3,"pdu[1] %d is not ACK/NAK/DTX\n",pdu[1]); + if (pdu[0] == 1) sched_ctl->round[pCCid][harq_pid]=8; + else sched_ctl->round[pCCid][harq_pid]++; + if (pdu[1] == 1) sched_ctl->round[1-pCCid][harq_pid]=8; + else sched_ctl->round[1-pCCid][harq_pid]++; + } // A=2 + else if ((num_ack_nak == 3) && (sched_ctl->round[pCCid][harq_pid]<8) && (sched_ctl->tbcnt[pCCid][harq_pid]==2) && (sched_ctl->round[1-pCCid][harq_pid]<8) && (sched_ctl->tbcnt[1-pCCid][harq_pid]==1)) { + AssertFatal(pdu[0]<=3,"pdu[0] %d is not ACK/NAK/DTX\n",pdu[0]); + AssertFatal(pdu[1]<=3,"pdu[1] %d is not ACK/NAK/DTX\n",pdu[1]); + AssertFatal(pdu[2]<=3,"pdu[2] %d is not ACK/NAK/DTX\n",pdu[2]); + AssertFatal(sched_ctl->tbcnt[pCCid][harq_pid] == 2,"sched_ctl->tbcnt[%d][%d] != 2 for UE %d/%x\n",pCCid,harq_pid,UE_id,rnti); + AssertFatal(sched_ctl->tbcnt[1-pCCid][harq_pid] == 1,"sched_ctl->tbcnt[%d][%d] != 1 for UE %d/%x\n",1-pCCid,harq_pid,UE_id,rnti); + if ((pdu[0] == 1) && (pdu[1] == 1)) { // both ACK + sched_ctl->round[pCCid][harq_pid]=8; + sched_ctl->tbcnt[pCCid][harq_pid]=0; + } + else if (((pdu[0] == 2) && (pdu[1] == 1))|| + ((pdu[0] == 1) && (pdu[1] == 2))){ + sched_ctl->round[pCCid][harq_pid]++; + sched_ctl->tbcnt[pCCid][harq_pid]=1; + } + else + sched_ctl->round[pCCid][harq_pid]++; + + if (pdu[2] == 1) sched_ctl->round[1-pCCid][harq_pid]=8; + else sched_ctl->round[1-pCCid][harq_pid]++; + } // A=3 primary cell has 2 TBs + else if ((num_ack_nak == 3) && (sched_ctl->round[1-pCCid][harq_pid]<8) && (sched_ctl->round[pCCid][harq_pid]<8) && (sched_ctl->tbcnt[1-pCCid][harq_pid]==2) && (sched_ctl->tbcnt[pCCid][harq_pid]==1)) { + AssertFatal(pdu[0]<=3,"pdu[0] %d is not ACK/NAK/DTX\n",pdu[0]); + AssertFatal(pdu[1]<=3,"pdu[1] %d is not ACK/NAK/DTX\n",pdu[1]); + AssertFatal(pdu[2]<=3,"pdu[2] %d is not ACK/NAK/DTX\n",pdu[2]); + AssertFatal(sched_ctl->tbcnt[1-pCCid][harq_pid] == 2,"sched_ctl->tbcnt[%d][%d] != 2 for UE %d/%x\n",1-pCCid,harq_pid,UE_id,rnti); + AssertFatal(sched_ctl->tbcnt[pCCid][harq_pid] == 1,"sched_ctl->tbcnt[%d][%d] != 1 for UE %d/%x\n",pCCid,harq_pid,UE_id,rnti); + if ((pdu[0] == 1) && (pdu[1] == 1)) { // both ACK + sched_ctl->round[1-pCCid][harq_pid]=8; + sched_ctl->tbcnt[1-pCCid][harq_pid]=0; + } + else if (((pdu[0] >= 2) && (pdu[1] == 1))|| + ((pdu[0] == 1) && (pdu[1] >= 2))){ // one ACK + sched_ctl->round[1-pCCid][harq_pid]++; + sched_ctl->tbcnt[1-pCCid][harq_pid]=1; + } + else // both NAK/DTX + sched_ctl->round[1-pCCid][harq_pid]++; + + if (pdu[2] == 1) sched_ctl->round[pCCid][harq_pid]=8; + else sched_ctl->round[pCCid][harq_pid]++; + } // A=3 secondary cell has 2 TBs #if MAX_NUM_CCs>1 - else if ((num_ack_nak == 4) && (sched_ctl->round[0][harq_pid]<8) && (sched_ctl->round[1][harq_pid]<8) && (sched_ctl->tbcnt[1-pCCid][harq_pid]==2) && (sched_ctl->tbcnt[pCCid][harq_pid]==2)) { - AssertFatal(pdu[0]<=3,"pdu[0] %d is not ACK/NAK/DTX\n",pdu[0]); - AssertFatal(pdu[1]<=3,"pdu[1] %d is not ACK/NAK/DTX\n",pdu[1]); - AssertFatal(pdu[2]<=3,"pdu[2] %d is not ACK/NAK/DTX\n",pdu[2]); - AssertFatal(pdu[3]<=3,"pdu[3] %d is not ACK/NAK/DTX\n",pdu[3]); - AssertFatal(sched_ctl->tbcnt[0][harq_pid] == 2,"sched_ctl->tbcnt[0][%d] != 2 for UE %d/%x\n",harq_pid,UE_id,rnti); - AssertFatal(sched_ctl->tbcnt[1][harq_pid] == 2,"sched_ctl->tbcnt[1][%d] != 2 for UE %d/%x\n",harq_pid,UE_id,rnti); - if ((pdu[0] == 1) && (pdu[1] == 1)) { // both ACK - sched_ctl->round[0][harq_pid]=8; - sched_ctl->tbcnt[0][harq_pid]=0; - } - else if (((pdu[0] >= 2) && (pdu[1] == 1))|| - ((pdu[0] == 1) && (pdu[1] >= 2))){ // one ACK - sched_ctl->round[0][harq_pid]++; - sched_ctl->tbcnt[0][harq_pid]=1; - } - else // both NAK/DTX - sched_ctl->round[0][harq_pid]++; - - if ((pdu[2] == 1) && (pdu[3] == 1)) { // both ACK - sched_ctl->round[1][harq_pid]=8; - sched_ctl->tbcnt[1][harq_pid]=0; - } - else if (((pdu[2] >= 2) && (pdu[3] == 1))|| - ((pdu[2] == 1) && (pdu[3] >= 2))){ // one ACK - sched_ctl->round[1][harq_pid]++; - sched_ctl->tbcnt[1][harq_pid]=1; - } - else // both NAK/DTX - sched_ctl->round[1][harq_pid]++; - } // A=4 both serving cells have 2 TBs + else if ((num_ack_nak == 4) && (sched_ctl->round[0][harq_pid]<8) && (sched_ctl->round[1][harq_pid]<8) && (sched_ctl->tbcnt[1-pCCid][harq_pid]==2) && (sched_ctl->tbcnt[pCCid][harq_pid]==2)) { + AssertFatal(pdu[0]<=3,"pdu[0] %d is not ACK/NAK/DTX\n",pdu[0]); + AssertFatal(pdu[1]<=3,"pdu[1] %d is not ACK/NAK/DTX\n",pdu[1]); + AssertFatal(pdu[2]<=3,"pdu[2] %d is not ACK/NAK/DTX\n",pdu[2]); + AssertFatal(pdu[3]<=3,"pdu[3] %d is not ACK/NAK/DTX\n",pdu[3]); + AssertFatal(sched_ctl->tbcnt[0][harq_pid] == 2,"sched_ctl->tbcnt[0][%d] != 2 for UE %d/%x\n",harq_pid,UE_id,rnti); + AssertFatal(sched_ctl->tbcnt[1][harq_pid] == 2,"sched_ctl->tbcnt[1][%d] != 2 for UE %d/%x\n",harq_pid,UE_id,rnti); + if ((pdu[0] == 1) && (pdu[1] == 1)) { // both ACK + sched_ctl->round[0][harq_pid]=8; + sched_ctl->tbcnt[0][harq_pid]=0; + } + else if (((pdu[0] >= 2) && (pdu[1] == 1))|| + ((pdu[0] == 1) && (pdu[1] >= 2))){ // one ACK + sched_ctl->round[0][harq_pid]++; + sched_ctl->tbcnt[0][harq_pid]=1; + } + else // both NAK/DTX + sched_ctl->round[0][harq_pid]++; + + if ((pdu[2] == 1) && (pdu[3] == 1)) { // both ACK + sched_ctl->round[1][harq_pid]=8; + sched_ctl->tbcnt[1][harq_pid]=0; + } + else if (((pdu[2] >= 2) && (pdu[3] == 1))|| + ((pdu[2] == 1) && (pdu[3] >= 2))){ // one ACK + sched_ctl->round[1][harq_pid]++; + sched_ctl->tbcnt[1][harq_pid]=1; + } + else // both NAK/DTX + sched_ctl->round[1][harq_pid]++; + } // A=4 both serving cells have 2 TBs #endif - break; + break; case 2: // Format 3 - AssertFatal(numCC>2,"Should not receive harq indication with FDD format 3 with %d < 3 active CCs\n", - numCC); - for (i=0,j=0;i<numCC;i++) { - if ((sched_ctl->round[i][harq_pid]<8)) { - if (tmode[i]==1 || tmode[i]==2 || tmode[0]==5 || tmode[0]==6 || tmode[0]==7) { - if (pdu[j] == 1) { - sched_ctl->round[i][harq_pid]=8; - sched_ctl->tbcnt[i][harq_pid]=0; - } - else if (pdu[j] == 2) sched_ctl->round[i][harq_pid]++; - else AssertFatal(1==0,"Illegal harq_ack value for CC %d harq_pid %d (%d) UE %d/%x\n", - i,harq_pid,pdu[j],UE_id,rnti); - j++; - } - else if (spatial_bundling == 0) { - if ((sched_ctl->tbcnt[i][harq_pid]==2) && (pdu[j] == 1) && (pdu[j+1]==1)) { - sched_ctl->round[i][harq_pid]=8; - sched_ctl->tbcnt[i][harq_pid]=0; - } - else if ((sched_ctl->tbcnt[i][harq_pid]==2) && (pdu[j] == 1) && (pdu[j+1]==2)) { - sched_ctl->round[i][harq_pid]++; - sched_ctl->tbcnt[i][harq_pid]=1; - } - else if ((sched_ctl->tbcnt[i][harq_pid]==2) && (pdu[j] == 2) && (pdu[j+1]==1)) { - sched_ctl->round[i][harq_pid]++; - sched_ctl->tbcnt[i][harq_pid]=1; - } - else if ((sched_ctl->tbcnt[i][harq_pid]==2) && (pdu[j] == 2) && (pdu[j+1]==2)) { - sched_ctl->round[i][harq_pid]++; - } - else AssertFatal(1==0,"Illegal combination for CC %d harq_pid %d (%d,%d,%d) UE %d/%x\n", - i,harq_pid,sched_ctl->tbcnt[i][harq_pid],pdu[j],pdu[j+1],UE_id,rnti); - j+=2; - } - else if (spatial_bundling == 1) { - if (pdu[j] == 1) { - sched_ctl->round[i][harq_pid]=8; - sched_ctl->tbcnt[i][harq_pid]=0; - } - else if (pdu[j] == 2) { - sched_ctl->round[i][harq_pid]++; - } - else AssertFatal(1==0,"Illegal hack_nak value %d for CC %d harq_pid %d UE %d/%x\n", - pdu[j],i,harq_pid,UE_id,rnti); - j++; - } - else AssertFatal(1==0,"Illegal value for spatial_bundling %d\n",spatial_bundling); - } - } - break; + AssertFatal(numCC>2,"Should not receive harq indication with FDD format 3 with %d < 3 active CCs\n", + numCC); + for (i=0,j=0;i<numCC;i++) { + if ((sched_ctl->round[i][harq_pid]<8)) { + if (tmode[i]==1 || tmode[i]==2 || tmode[0]==5 || tmode[0]==6 || tmode[0]==7) { + if (pdu[j] == 1) { + sched_ctl->round[i][harq_pid]=8; + sched_ctl->tbcnt[i][harq_pid]=0; + } + else if (pdu[j] == 2) sched_ctl->round[i][harq_pid]++; + else AssertFatal(1==0,"Illegal harq_ack value for CC %d harq_pid %d (%d) UE %d/%x\n", + i,harq_pid,pdu[j],UE_id,rnti); + j++; + } + else if (spatial_bundling == 0) { + if ((sched_ctl->tbcnt[i][harq_pid]==2) && (pdu[j] == 1) && (pdu[j+1]==1)) { + sched_ctl->round[i][harq_pid]=8; + sched_ctl->tbcnt[i][harq_pid]=0; + } + else if ((sched_ctl->tbcnt[i][harq_pid]==2) && (pdu[j] == 1) && (pdu[j+1]==2)) { + sched_ctl->round[i][harq_pid]++; + sched_ctl->tbcnt[i][harq_pid]=1; + } + else if ((sched_ctl->tbcnt[i][harq_pid]==2) && (pdu[j] == 2) && (pdu[j+1]==1)) { + sched_ctl->round[i][harq_pid]++; + sched_ctl->tbcnt[i][harq_pid]=1; + } + else if ((sched_ctl->tbcnt[i][harq_pid]==2) && (pdu[j] == 2) && (pdu[j+1]==2)) { + sched_ctl->round[i][harq_pid]++; + } + else AssertFatal(1==0,"Illegal combination for CC %d harq_pid %d (%d,%d,%d) UE %d/%x\n", + i,harq_pid,sched_ctl->tbcnt[i][harq_pid],pdu[j],pdu[j+1],UE_id,rnti); + j+=2; + } + else if (spatial_bundling == 1) { + if (pdu[j] == 1) { + sched_ctl->round[i][harq_pid]=8; + sched_ctl->tbcnt[i][harq_pid]=0; + } + else if (pdu[j] == 2) { + sched_ctl->round[i][harq_pid]++; + } + else AssertFatal(1==0,"Illegal hack_nak value %d for CC %d harq_pid %d UE %d/%x\n", + pdu[j],i,harq_pid,UE_id,rnti); + j++; + } + else AssertFatal(1==0,"Illegal value for spatial_bundling %d\n",spatial_bundling); + } + } + break; case 3: // Format 4 - AssertFatal(1==0,"Should not receive harq indication with Format 4\n"); - break; + AssertFatal(1==0,"Should not receive harq indication with Format 4\n"); + break; case 4: // Format 5 - AssertFatal(1==0,"Should not receive harq indication with Format 5\n"); - break; + AssertFatal(1==0,"Should not receive harq indication with Format 5\n"); + break; } } } -void extract_pucch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,sub_frame_t subframeP,uint8_t *pdu, uint8_t length) { +void extract_pucch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,sub_frame_t subframeP,uint8_t *pdu, uint8_t length) +{ UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list; UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; COMMON_channels_t *cc=&RC.mac[mod_idP]->common_channels[CC_idP]; @@ -3319,18 +3242,18 @@ void extract_pucch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP, AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n",UE_id); AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig != NULL,"cqi_ReportConfig is null for UE %d\n",UE_id); AssertFatal((cqi_ReportPeriodic = UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic)!=NULL, - "cqi_ReportPeriodic is null for UE %d\n",UE_id); - + "cqi_ReportPeriodic is null for UE %d\n",UE_id); + // determine feedback mode AssertFatal(cqi_ReportPeriodic->present != CQI_ReportPeriodic_PR_NOTHING, - "cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_NOTHING!\n"); + "cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_NOTHING!\n"); AssertFatal(cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present != CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING, - "cqi_ReportPeriodic->cqi_FormatIndicatorPeriodic.choice.setup.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING!\n"); + "cqi_ReportPeriodic->cqi_FormatIndicatorPeriodic.choice.setup.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING!\n"); uint16_t Npd,N_OFFSET_CQI; int H,K,bandwidth_part,L,Lmask; int ri = sched_ctl->periodic_ri_received[CC_idP]; - + get_csi_params(cc,cqi_ReportPeriodic,&Npd,&N_OFFSET_CQI,&H); K =(H-1)/Jtab[cc->mib->message.dl_Bandwidth]; L = Ltab[cc->mib->message.dl_Bandwidth]; @@ -3356,8 +3279,8 @@ void extract_pucch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP, // note: need to check TM8-10 without PMI/RI or with 1 antenna port (see Section 5.2.3.3.1 from 36.213) no_pmi=0; } - - if ((cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI) || + + if ((cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present == CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_widebandCQI) || (feedback_cnt==0)){ // Note: This implements only Tables: 5.3.3.1-1,5.3.3.1-1A and 5.3.3.1-2 from 36.213 (1,2,4 antenna ports Wideband CQI/PMI) @@ -3397,17 +3320,17 @@ void extract_pucch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP, sched_ctl->periodic_subband_cqi[CC_idP][(bandwidth_part*L)+((pdu[0]>>4)&Lmask)] = pdu[0]&0xF; } else if (ri>1) { - //7+Ltab[cc->mib->message.dl_Bandwidth] bits; + //7+Ltab[cc->mib->message.dl_Bandwidth] bits; sched_ctl->periodic_subband_spatial_diffcqi[CC_idP][(bandwidth_part*L)+((pdu[0]>>7)&Lmask)] = (pdu[0]>>4)&7; sched_ctl->periodic_subband_cqi[CC_idP][(bandwidth_part*L)+((pdu[0]>>7)&Lmask)] = pdu[0]&0xF; } } } -void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,sub_frame_t subframeP,uint8_t *pdu, uint8_t length) { - +void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP,sub_frame_t subframeP,uint8_t *pdu, uint8_t length) +{ UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list; - COMMON_channels_t *cc = &RC.mac[mod_idP]->common_channels[CC_idP]; + COMMON_channels_t *cc = &RC.mac[mod_idP]->common_channels[CC_idP]; UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; int Ntab[6] = {0,4,7,9,10,13}; int Ntab_uesel[6] = {0,8,13,17,19,25}; @@ -3422,7 +3345,7 @@ void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP, AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n",UE_id); AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig != NULL,"cqi_ReportConfig is null for UE %d\n",UE_id); AssertFatal((cqi_ReportModeAperiodic = UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic)!=NULL, - "cqi_ReportModeAperiodic is null for UE %d\n",UE_id); + "cqi_ReportModeAperiodic is null for UE %d\n",UE_id); int N = Ntab[cc->mib->message.dl_Bandwidth]; int tmode = get_tmode(mod_idP,CC_idP,UE_id); @@ -3432,41 +3355,40 @@ void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP, int m; switch(*cqi_ReportModeAperiodic) { - case CQI_ReportModeAperiodic_rm12: AssertFatal(0==1, "to be fixed, don't use p but pdu directly\n"); // wideband multiple PMI (TM4/6), Table 5.2.2.6.1-1 (for TM4/6) AssertFatal(tmode==4 || tmode==6 || tmode==8|| tmode==9 || tmode==10,"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm12\n",tmode); if (tmode <= 6) { //Table 5.2.2.6.1-1 36.213 - if ((ri==1) && (cc->p_eNB==2)) { - sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4; - for (i=0;i<N;i++) { - sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x03); - p>>=2; - } + if ((ri==1) && (cc->p_eNB==2)) { + sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4; + for (i=0;i<N;i++) { + sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x03); + p>>=2; + } } - if ((ri==2) && (cc->p_eNB==2)) { - sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4; - sched_ctl->aperiodic_wideband_cqi1[CC_idP] = (uint8_t)(p&0x0F); p>>=4; - for (i=0;i<N;i++) { - sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01); - p>>=1; - } + if ((ri==2) && (cc->p_eNB==2)) { + sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4; + sched_ctl->aperiodic_wideband_cqi1[CC_idP] = (uint8_t)(p&0x0F); p>>=4; + for (i=0;i<N;i++) { + sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01); + p>>=1; + } } - if ((ri==1) && (cc->p_eNB==4)) { - sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4; - for (i=0;i<N;i++) { - sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x03); - p>>=4; - } + if ((ri==1) && (cc->p_eNB==4)) { + sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4; + for (i=0;i<N;i++) { + sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x03); + p>>=4; + } } - if ((ri==2) && (cc->p_eNB==4)) { - sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4; - sched_ctl->aperiodic_wideband_cqi1[CC_idP] = (uint8_t)(p&0x0F); p>>=4; - for (i=0;i<N;i++) { - sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01); - p>>=4; - } + if ((ri==2) && (cc->p_eNB==4)) { + sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4; + sched_ctl->aperiodic_wideband_cqi1[CC_idP] = (uint8_t)(p&0x0F); p>>=4; + for (i=0;i<N;i++) { + sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01); + p>>=4; + } } } // if (tmode <= 6) { //Table 5.2.2.6.1-1 36.213 else { @@ -3476,7 +3398,7 @@ void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP, break; case CQI_ReportModeAperiodic_rm20: AssertFatal(0==1, "to be fixed, don't use p but pdu directly\n"); - // UE-selected subband CQI no PMI (TM1/2/3/7) , Table 5.2.2.6.3-1 from 36.213 + // UE-selected subband CQI no PMI (TM1/2/3/7) , Table 5.2.2.6.3-1 from 36.213 AssertFatal(tmode==1 || tmode==2 || tmode==3 || tmode==7,"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm20\n",tmode); sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4; @@ -3493,7 +3415,7 @@ void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP, sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4; diffcqi0 = (uint8_t)(p&0x03); p>>=2; - + if (ri>1) { sched_ctl->aperiodic_wideband_cqi1[CC_idP] = (uint8_t)(p&0x0F); p>>=4; diffcqi1 = (uint8_t)(p&0x03); p>>=2; @@ -3512,7 +3434,7 @@ void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP, pmi_uesel = p&0x0F; p>>=4; sched_ctl->aperiodic_wideband_pmi[CC_idP] = p&0x0F; } - for (m=0;m<Mtab_uesel[bw];m++) { + for (m=0;m<Mtab_uesel[bw];m++) { sched_ctl->aperiodic_subband_diffcqi0[CC_idP][v[m]] = diffcqi0; if (ri>1) sched_ctl->aperiodic_subband_diffcqi1[CC_idP][v[m]] = diffcqi1; sched_ctl->aperiodic_subband_pmi[CC_idP][v[m]] = pmi_uesel; @@ -3539,49 +3461,49 @@ void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP, //subband CQI single PMI (TM4/5/6) AssertFatal(tmode==4 || tmode==5 || tmode==6 || tmode==8|| tmode==9|| tmode==10,"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm31\n",tmode); - if ((ri==1) && (cc->p_eNB==2)) { + if ((ri==1) && (cc->p_eNB==2)) { sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4; for (i=0;i<N;i++) { - sched_ctl->aperiodic_subband_diffcqi0[CC_idP][i] = (uint8_t)(p&0x03); - p>>=2; + sched_ctl->aperiodic_subband_diffcqi0[CC_idP][i] = (uint8_t)(p&0x03); + p>>=2; } sched_ctl->aperiodic_wideband_pmi[CC_idP] = p&0x03; } - if ((ri==2) && (cc->p_eNB==2)) { + if ((ri==2) && (cc->p_eNB==2)) { sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4; for (i=0;i<N;i++) { - sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01); - p>>=1; + sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01); + p>>=1; } sched_ctl->aperiodic_wideband_cqi1[CC_idP] = (uint8_t)(p&0x0F); p>>=4; for (i=0;i<N;i++) { - sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01); - p>>=1; + sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01); + p>>=1; } sched_ctl->aperiodic_wideband_pmi[CC_idP] = p&0x01; } - if ((ri==1) && (cc->p_eNB==4)) { + if ((ri==1) && (cc->p_eNB==4)) { sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4; for (i=0;i<N;i++) { - sched_ctl->aperiodic_subband_diffcqi0[CC_idP][i] = (uint8_t)(p&0x03); - p>>=2; + sched_ctl->aperiodic_subband_diffcqi0[CC_idP][i] = (uint8_t)(p&0x03); + p>>=2; } sched_ctl->aperiodic_wideband_pmi[CC_idP] = p&0x0F; } if ((ri>1) && (cc->p_eNB==4)) { // Note : 64 bits for 20 MHz sched_ctl->aperiodic_wideband_cqi0[CC_idP] = (uint8_t)(p&0x0F); p>>=4; for (i=0;i<N;i++) { - sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01); - p>>=1; + sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01); + p>>=1; } sched_ctl->aperiodic_wideband_cqi1[CC_idP] = (uint8_t)(p&0x0F); p>>=4; for (i=0;i<N;i++) { - sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01); - p>>=2; + sched_ctl->aperiodic_subband_pmi[CC_idP][i] = (uint8_t)(p&0x01); + p>>=2; } sched_ctl->aperiodic_wideband_pmi[CC_idP] = p&0x0F; } - + break; case CQI_ReportModeAperiodic_rm32_v1250: AssertFatal(tmode==4 || tmode==5 || tmode==6 || tmode==8|| tmode==9|| tmode==10,"Illegal transmission mode %d for CQI_ReportModeAperiodic_rm32\n",tmode); @@ -3596,14 +3518,12 @@ void extract_pusch_csi(module_id_t mod_idP,int CC_idP,int UE_id, frame_t frameP, AssertFatal(1==0,"CQI_ReportModeAperiodic_rm11 to be done\n"); break; } - - } -void cqi_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP, rnti_t rntiP, - nfapi_cqi_indication_rel9_t *rel9,uint8_t *pdu, - nfapi_ul_cqi_information_t *ul_cqi_information) { - +void cqi_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP, rnti_t rntiP, + nfapi_cqi_indication_rel9_t *rel9,uint8_t *pdu, + nfapi_ul_cqi_information_t *ul_cqi_information) +{ int UE_id = find_UE_id(mod_idP, rntiP); UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list; UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; @@ -3616,34 +3536,34 @@ void cqi_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, sub_frame_t extract_pucch_csi(mod_idP,CC_idP,UE_id,frameP,subframeP,pdu,rel9->length); memcpy((void*)sched_ctl->periodic_ri_received, - (void*)rel9->ri, - rel9->number_of_cc_reported); + (void*)rel9->ri, + rel9->number_of_cc_reported); // SNR for PUCCH2 sched_ctl->pucch2_snr[CC_idP] = ul_cqi_information->ul_cqi; } else { //PUSCH memcpy((void*)sched_ctl->aperiodic_ri_received, - (void*)rel9->ri, - rel9->number_of_cc_reported); + (void*)rel9->ri, + rel9->number_of_cc_reported); extract_pusch_csi(mod_idP,CC_idP,UE_id,frameP,subframeP,pdu,rel9->length); - + } // timing advance sched_ctl->timing_advance = rel9->timing_advance; - sched_ctl->timing_advance_r9 = rel9->timing_advance_r9; + sched_ctl->timing_advance_r9 = rel9->timing_advance_r9; } } void SR_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, sub_frame_t subframeP, rnti_t rntiP, uint8_t ul_cqi) { T(T_ENB_MAC_SCHEDULING_REQUEST, T_INT(mod_idP), T_INT(cc_idP), T_INT(frameP), T_INT(subframeP), T_INT(rntiP)); - + int UE_id = find_UE_id(mod_idP, rntiP); UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list; - + if (UE_id != -1) { if (mac_eNB_get_rrc_status(mod_idP,UE_RNTI(mod_idP,UE_id)) < RRC_CONNECTED) 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); @@ -3666,14 +3586,13 @@ void SR_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, sub_frame_t void UL_failure_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, rnti_t rntiP, sub_frame_t subframeP) { - int UE_id = find_UE_id(mod_idP, rntiP); UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list; if (UE_id != -1) { LOG_D(MAC,"[eNB %d][UE %d/%x] Frame %d subframeP %d Signaling UL Failure for UE %d on CC_id %d (timer %d)\n", - mod_idP,UE_id,rntiP,frameP,subframeP, UE_id,cc_idP, - UE_list->UE_sched_ctrl[UE_id].ul_failure_timer); + mod_idP,UE_id,rntiP,frameP,subframeP, UE_id,cc_idP, + UE_list->UE_sched_ctrl[UE_id].ul_failure_timer); if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer == 0) UE_list->UE_sched_ctrl[UE_id].ul_failure_timer=1; } else { @@ -3683,9 +3602,8 @@ void UL_failure_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, rnti } } -void harq_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP, nfapi_harq_indication_pdu_t *harq_pdu) { - - +void harq_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP, nfapi_harq_indication_pdu_t *harq_pdu) +{ rnti_t rnti = harq_pdu->rx_ue_information.rnti; uint8_t ul_cqi = harq_pdu->ul_cqi_information.ul_cqi; uint8_t channel = harq_pdu->ul_cqi_information.channel;