From f1f3b8a0a874f675082425966e7800f3b979a96f Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Mon, 22 Jan 2018 15:32:41 +0100 Subject: [PATCH 1/5] bugfix: fix issue 285 - connect/disconnect multiple time As reported by Emad Alizade: According to "Issue255 256 257 paging reesta release" that has been merged in develop version, we have a question: In rrc_eNB_free_UE() function only all ulsch related memory of user has been cleaned, but I think not only ulsch memory but also dlsch memory must be cleaned. I tested the latest develop version and with repetition UE attach-detach procedures we find that the dlsch memory has not been cleaned and after repeat this sequence (45 times) assertion with cause UE_id!=-1 (no free or exiting dlsch_context, dci_tools.c: fill_dci_and_dlsch() ) occurred and no UE will be attached to system. The fixes in this commit are from Emad Alizade. (cherry picked from commit 4b5b55649351b4fe3f46b35d4a533a7b778ccce0) # Conflicts: # openair1/PHY/LTE_TRANSPORT/dlsch_coding.c # openair2/LAYER2/MAC/eNB_scheduler.c # openair2/RRC/LITE/rrc_eNB.c --- openair1/PHY/LTE_TRANSPORT/dlsch_coding.c | 1 + openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c | 1 + openair2/LAYER2/MAC/eNB_scheduler.c | 11 ++++++++--- openair2/RRC/LITE/rrc_eNB.c | 19 ++++++++----------- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index 7482524d41..bd5c1b05c2 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -252,6 +252,7 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch) #else dlsch->active = 0; #endif + dlsch->harq_mask = 0; for (i=0; i<10; i++) dlsch->harq_ids[i] = Mdlharq; diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index a5f4666210..7a60e0fc90 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -170,6 +170,7 @@ void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch) //ulsch = (LTE_eNB_ULSCH_t *)malloc16(sizeof(LTE_eNB_ULSCH_t)); if (ulsch) { ulsch->rnti = 0; + ulsch->harq_mask = 0; for (i=0; i<8; i++) { if (ulsch->harq_processes[i]) { diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 2b8dfbea80..521030eb54 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -731,12 +731,17 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, pdcp_remove_UE(&ctxt); } for (int ii=0; iiulsch[ii]; + LTE_eNB_ULSCH_t *ulsch = RC.eNB[module_idP][CC_id]->ulsch[ii]; if((ulsch != NULL) && (ulsch->rnti == rnti)){ LOG_I(MAC, "clean_eNb_ulsch UE %x \n", rnti); clean_eNb_ulsch(ulsch); - break; + } + } + for (int ii=0; iidlsch[ii][0]; + if((dlsch != NULL) && (dlsch->rnti == rnti)){ + LOG_I(MAC, "clean_eNb_dlsch UE %x \n", rnti); + clean_eNb_dlsch(dlsch); } } diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 7a7e1e3b08..90b85f6c14 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -806,6 +806,7 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* #ifndef UE_EXPANSION int i, j , CC_id, pdu_number; LTE_eNB_ULSCH_t *ulsch = NULL; + LTE_eNB_DLSCH_t *dlsch = NULL; nfapi_ul_config_request_body_t *ul_req_tmp = NULL; PHY_VARS_eNB *eNB_PHY = NULL; eNB_MAC_INST *eNB_MAC = RC.mac[enb_mod_idP]; @@ -849,19 +850,15 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* ulsch = eNB_PHY->ulsch[i]; if((ulsch != NULL) && (ulsch->rnti == rnti)){ LOG_I(RRC, "clean_eNb_ulsch UE %x \n", rnti); - //clean_eNb_ulsch(ulsch); - ulsch->rnti = 0; - } - if(eNB_PHY->uci_vars[i].rnti == rnti){ - LOG_I(MAC, "clean eNb uci_vars[%d] UE %x \n",i, rnti); - memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI)); + clean_eNb_ulsch(ulsch); } } - ulsch = eNB_PHY->ulsch[i]; - if((ulsch != NULL) && (ulsch->rnti == rnti)){ - LOG_I(RRC, "clean_eNb_ulsch UE %x \n", rnti); - //clean_eNb_ulsch(ulsch); - ulsch->rnti = 0; + for (i=0; idlsch[i][0]; + if((dlsch != NULL) && (dlsch->rnti == rnti)){ + LOG_I(RRC, "clean_eNb_dlsch UE %x \n", rnti); + clean_eNb_dlsch(dlsch); + } } for(j = 0; j < 10; j++){ From dbe32083024d68d3bf3e7b1ace94e49b3ec4b6a0 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Fri, 16 Mar 2018 15:32:14 +0900 Subject: [PATCH 2/5] Fix: eNB can not accept attach more than 257 times. --- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 16 ++++++++++++---- openair1/SCHED/fapi_l1.c | 19 ++++++++++++++----- openair1/SCHED/phy_procedures_lte_eNb.c | 12 ++++++++++-- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 10 +++++++--- openair2/RRC/LITE/rrc_eNB.c | 11 +++++++---- 5 files changed, 50 insertions(+), 18 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index d943b91d3a..0af9d9332a 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -1054,8 +1054,12 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci if ((rel8->rnti_type == 2 ) && (rel8->rnti != SI_RNTI) && (rel8->rnti != P_RNTI)) dci_alloc->ra_flag = 1; UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE); - AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n"); - AssertFatal(UE_id= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX); + if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ){ + LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel8->rnti,UE_id); + return; + } + //AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n"); + //AssertFatal(UE_id= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX); dlsch0 = eNB->dlsch[UE_id][0]; dlsch1 = eNB->dlsch[UE_id][1]; @@ -2298,8 +2302,12 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d if (rel13->rnti_type == 2 ) dci_alloc->ra_flag = 1; UE_id = find_dlsch(rel13->rnti,eNB,SEARCH_EXIST_OR_FREE); - AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n"); - AssertFatal(UE_id= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX); + if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ){ + LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel13->rnti,UE_id); + return; + } + //AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n"); + //AssertFatal(UE_id= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX); dlsch0 = eNB->dlsch[UE_id][0]; dlsch0_harq = dlsch0->harq_processes[rel13->harq_process]; diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index dbce91776d..32dba016d2 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -137,8 +137,12 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, int harq_pid; UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE); - AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n"); - AssertFatal(UE_id= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX); + if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ){ + LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel8->rnti,UE_id); + return; + } + //AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n"); + //AssertFatal(UE_id= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX); dlsch0 = eNB->dlsch[UE_id][0]; dlsch1 = eNB->dlsch[UE_id][1]; @@ -176,9 +180,14 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, dlsch0_harq->pdsch_start = eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols; if (dlsch0_harq->round==0) { //get pointer to SDU if this a new SDU - AssertFatal(sdu!=NULL,"NFAPI: frame %d, subframe %d: programming dlsch for round 0, rnti %x, UE_id %d, harq_pid %d : sdu is null for pdu_index %d\n", - proc->frame_tx,proc->subframe_tx,rel8->rnti,UE_id,harq_pid, - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index); + if(sdu == NULL) { + LOG_E(PHY,"NFAPI: frame %d, subframe %d: programming dlsch for round 0, rnti %x, UE_id %d, harq_pid %d : sdu is null for pdu_index %d\n", + proc->frame_tx, proc->subframe_tx, rel8->rnti, UE_id, harq_pid, dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index); + return; + } + //AssertFatal(sdu!=NULL,"NFAPI: frame %d, subframe %d: programming dlsch for round 0, rnti %x, UE_id %d, harq_pid %d : sdu is null for pdu_index %d\n", + // proc->frame_tx,proc->subframe_tx,rel8->rnti,UE_id,harq_pid, + // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index); if (rel8->rnti != 0xFFFF) LOG_D(PHY,"NFAPI: frame %d, subframe %d: programming dlsch for round 0, rnti %x, UE_id %d, harq_pid %d\n", proc->frame_tx,proc->subframe_tx,rel8->rnti,UE_id,harq_pid); if (codeword_index == 0) dlsch0_harq->pdu = sdu; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 8500cd8b9b..d1f6e9a161 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1690,7 +1690,11 @@ void fill_ulsch_cqi_indication(PHY_VARS_eNB *eNB,uint16_t frame,uint8_t subframe void fill_ulsch_harq_indication(PHY_VARS_eNB *eNB,LTE_UL_eNB_HARQ_t *ulsch_harq,uint16_t rnti, int frame,int subframe,int bundling) { int UE_id = find_dlsch(rnti,eNB,SEARCH_EXIST); - AssertFatal(UE_id>=0,"UE_id doesn't exist\n"); + if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ){ + LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rnti,UE_id); + return; + } + //AssertFatal(UE_id>=0,"UE_id doesn't exist\n"); pthread_mutex_lock(&eNB->UL_INFO_mutex); nfapi_harq_indication_pdu_t *pdu = &eNB->UL_INFO.harq_ind.harq_pdu_list[eNB->UL_INFO.harq_ind.number_of_harqs]; @@ -1759,7 +1763,11 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB, uint16_t tdd_multiplexing_mask) { int UE_id=find_dlsch(uci->rnti,eNB,SEARCH_EXIST); - AssertFatal(UE_id>=0,"UE_id doesn't exist\n"); + if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ){ + LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",uci->rnti,UE_id); + return; + } + //AssertFatal(UE_id>=0,"UE_id doesn't exist\n"); pthread_mutex_lock(&eNB->UL_INFO_mutex); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 6a4c93ac3a..5fe91571ab 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -782,9 +782,13 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, // Get RRCConnectionSetup for Piggyback rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block &cc[CC_idP].CCCH_pdu.payload[0], ENB_FLAG_YES, module_idP, 0); // not used in this case - - AssertFatal(rrc_sdu_length > 0, - "[MAC][eNB Scheduler] CCCH not allocated\n"); + + if(rrc_sdu_length <= 0) { + LOG_D(MAC,"[MAC][eNB Scheduler] CCCH not allocated\n %d",rrc_sdu_length); + return; + } + //AssertFatal(rrc_sdu_length > 0, + //"[MAC][eNB Scheduler] CCCH not allocated\n"); LOG_D(MAC, diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 90b85f6c14..3660fa2606 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -927,6 +927,7 @@ void release_UE_in_freeList(module_id_t mod_id) int i, j , CC_id, pdu_number; protocol_ctxt_t ctxt; LTE_eNB_ULSCH_t *ulsch = NULL; + LTE_eNB_DLSCH_t *dlsch = NULL; nfapi_ul_config_request_body_t *ul_req_tmp = NULL; PHY_VARS_eNB *eNB_PHY = NULL; struct rrc_eNB_ue_context_s *ue_context_pP = NULL; @@ -966,10 +967,12 @@ void release_UE_in_freeList(module_id_t mod_id) memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI)); } } - ulsch = eNB_PHY->ulsch[i]; - if((ulsch != NULL) && (ulsch->rnti == rnti)){ - LOG_I(RRC, "clean_eNb_ulsch ulsch[%d] UE %x\n", i, rnti); - clean_eNb_ulsch(ulsch); + for (i=0; idlsch[i][0]; + if((dlsch != NULL) && (dlsch->rnti == rnti)){ + LOG_I(RRC, "clean_eNb_dlsch dlsch[%d] UE %x \n", i, rnti); + clean_eNb_dlsch(dlsch); + } } for(j = 0; j < 10; j++){ From eaa3f533a5b2f469185d580a01f3e58093217242 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Tue, 20 Mar 2018 13:00:21 +0900 Subject: [PATCH 3/5] Fix: segmentation fault happens when clean_eNb_dlsch() function is executed while pdsch procedure running. --- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index 90450b7c1c..5e82fdcd0f 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -2063,6 +2063,10 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, if ((dlsch0 != NULL) && (dlsch1 != NULL)){ harq_pid = dlsch0->harq_ids[subframe_offset]; + if(harq_pid >= dlsch0->Mdlharq) { + LOG_E(PHY,"illegal harq_pid %d\n", harq_pid); + return(-1); + } dlsch0_harq = dlsch0->harq_processes[harq_pid]; mimo_mode = dlsch0_harq->mimo_mode; mod_order0 = dlsch0_harq->Qm; @@ -2080,6 +2084,10 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, }else if ((dlsch0 != NULL) && (dlsch1 == NULL)){ harq_pid = dlsch0->harq_ids[subframe_offset]; + if(harq_pid >= dlsch0->Mdlharq) { + LOG_E(PHY,"illegal harq_pid %d\n", harq_pid); + return(-1); + } dlsch0_harq = dlsch0->harq_processes[harq_pid]; mimo_mode = dlsch0_harq->mimo_mode; mod_order0 = dlsch0_harq->Qm; @@ -2097,6 +2105,10 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, }else if ((dlsch0 == NULL) && (dlsch1 != NULL)){ harq_pid = dlsch1->harq_ids[subframe_offset]; + if(harq_pid >= dlsch1->Mdlharq) { + LOG_E(PHY,"illegal harq_pid %d\n", harq_pid); + return(-1); + } dlsch1_harq = dlsch1->harq_processes[harq_pid]; mimo_mode = dlsch1_harq->mimo_mode; mod_order0 = dlsch1_harq->Qm; From 5646b07870a0518e0de93383481e811b1030a79c Mon Sep 17 00:00:00 2001 From: Masayuki HARADA Date: Fri, 23 Mar 2018 14:20:58 +0900 Subject: [PATCH 4/5] =?UTF-8?q?Fix=20ul=20scd=20problems.=20=E3=83=BBDelet?= =?UTF-8?q?e=20double=20BSR=20calculation.=20=E3=83=BBchange=20TBS=20for?= =?UTF-8?q?=20mcs=20setting=20bit=20to=20byte.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 39cd022424ebe98c95be32cbb4127aa9d0e0ff3b) --- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 6 ++++-- openair2/LAYER2/MAC/pre_processor.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 6b5bf9a3d0..4e5eda84f0 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -1788,12 +1788,12 @@ void schedule_ulsch_rnti(module_id_t module_idP, VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SCHEDULED,UE_sched_ctrl->ul_scheduled); // adjust total UL buffer status by TBS, wait for UL sdus to do final update - LOG_D(MAC,"[eNB %d] CC_id %d UE %d/%x : adjusting ul_total_buffer, old %d, TBS %d\n", module_idP,CC_id,UE_id,rnti,UE_template->ul_total_buffer,UE_template->TBS_UL[harq_pid]); + /*LOG_D(MAC,"[eNB %d] CC_id %d UE %d/%x : adjusting ul_total_buffer, old %d, TBS %d\n", module_idP,CC_id,UE_id,rnti,UE_template->ul_total_buffer,UE_template->TBS_UL[harq_pid]); if (UE_template->ul_total_buffer > UE_template->TBS_UL[harq_pid]) UE_template->ul_total_buffer -= UE_template->TBS_UL[harq_pid]; else UE_template->ul_total_buffer = 0; - LOG_D(MAC,"ul_total_buffer, new %d\n", UE_template->ul_total_buffer); + LOG_D(MAC,"ul_total_buffer, new %d\n", UE_template->ul_total_buffer);*/ // Cyclic shift for DM RS cshift = 0;// values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1) // save it for a potential retransmission @@ -1868,6 +1868,7 @@ void schedule_ulsch_rnti(module_id_t module_idP, // increment first rb for next UE allocation first_rb[CC_id]+=rb_table[rb_table_index]; if(ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_FIRST) { + LOG_D(MAC,"[eNB %d] CC_id %d UE %d/%x : adjusting ul_total_buffer, old %d, TBS %d\n", module_idP,CC_id,UE_id,rnti,UE_template->ul_total_buffer,UE_template->TBS_UL[harq_pid]); if(ulsch_ue_select[CC_id].list[ulsch_ue_num].ul_total_buffer > 0){ if (UE_template->ul_total_buffer > UE_template->TBS_UL[harq_pid]) UE_template->ul_total_buffer -= UE_template->TBS_UL[harq_pid]; @@ -1876,6 +1877,7 @@ void schedule_ulsch_rnti(module_id_t module_idP, } else { UE_template->ul_SR = 0; } + LOG_D(MAC,"ul_total_buffer, new %d\n", UE_template->ul_total_buffer); } if((ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_INACTIVE) && (ULSCH_first_end == 0)) { ULSCH_first_end = 1; diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index b341c9ca3c..f3ec71bfcd 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -2788,28 +2788,28 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP, if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_FIRST ) { if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ul_total_buffer > 0 ) { rb_table_index = 2; - tbs = get_TBS_UL(mcs,rb_table[rb_table_index])<<3; - tx_power= estimate_ue_tx_power(tbs,rb_table[rb_table_index],0,frame_parms->Ncp,0); + tbs = get_TBS_UL(mcs,rb_table[rb_table_index]); + tx_power= estimate_ue_tx_power(tbs*8,rb_table[rb_table_index],0,frame_parms->Ncp,0); while ( (((UE_template->phr_info - tx_power) < 0 ) || (tbs > UE_template->ul_total_buffer)) && (mcs > 3) ) { mcs--; - tbs = get_TBS_UL(mcs,rb_table[rb_table_index])<<3; - tx_power= estimate_ue_tx_power(tbs,rb_table[rb_table_index],0,frame_parms->Ncp,0); + tbs = get_TBS_UL(mcs,rb_table[rb_table_index]); + tx_power= estimate_ue_tx_power(tbs*8,rb_table[rb_table_index],0,frame_parms->Ncp,0); } if(frame_parms->N_RB_UL == 25){ while ( (tbs < UE_template->ul_total_buffer) && (rb_table[rb_table_index]<(frame_parms->N_RB_UL-1-first_rb[CC_id])) && ((UE_template->phr_info - tx_power) > 0) && (rb_table_index < 32 )) { rb_table_index++; - tbs = get_TBS_UL(mcs,rb_table[rb_table_index])<<3; - tx_power= estimate_ue_tx_power(tbs,rb_table[rb_table_index],0,frame_parms->Ncp,0); + tbs = get_TBS_UL(mcs,rb_table[rb_table_index]); + tx_power= estimate_ue_tx_power(tbs*8,rb_table[rb_table_index],0,frame_parms->Ncp,0); } }else{ while ( (tbs < UE_template->ul_total_buffer) && (rb_table[rb_table_index]<(frame_parms->N_RB_UL-2-first_rb[CC_id])) && ((UE_template->phr_info - tx_power) > 0) && (rb_table_index < 32 )) { rb_table_index++; - tbs = get_TBS_UL(mcs,rb_table[rb_table_index])<<3; - tx_power= estimate_ue_tx_power(tbs,rb_table[rb_table_index],0,frame_parms->Ncp,0); + tbs = get_TBS_UL(mcs,rb_table[rb_table_index]); + tx_power= estimate_ue_tx_power(tbs*8,rb_table[rb_table_index],0,frame_parms->Ncp,0); } } if ( rb_table[rb_table_index]<3 ) { From 8f86f38d58ced447e507725fa9aef5c19a91782e Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Fri, 23 Mar 2018 18:24:51 +0900 Subject: [PATCH 5/5] Fix: memory leak occurs when memblock is exhausted. (cherry picked from commit 0e550a32e46d797d03fd72e54e474762d4db7614) # Conflicts: # openair2/LAYER2/RLC/rlc.c --- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c | 1 + openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c | 1 + openair2/LAYER2/RLC/rlc.c | 4 ++++ openair2/LAYER2/RLC/rlc_mac.c | 1 + 4 files changed, 7 insertions(+) diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c index c8b8bce7aa..6f1516d3b9 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c @@ -509,6 +509,7 @@ rlc_am_rx ( default: LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" TX UNKNOWN PROTOCOL STATE 0x%02X\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP, rlc), rlc->protocol_state); + list_free (&data_indP.data); } } diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c index 2e1629f8c8..77d0563bba 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c @@ -421,6 +421,7 @@ rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, void *argP, struct mac_data_ind LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TX UNKNOWN PROTOCOL STATE %02X hex\n", PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p), l_rlc_p->protocol_state); + list_free (&data_indP.data); } } diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index d70d85f2d5..a1cda00235 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -441,6 +441,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, return RLC_OP_STATUS_OK; } else { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); + free_mem_block(sdu_pP, __func__); return RLC_OP_STATUS_INTERNAL_ERROR; } @@ -465,6 +466,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, return RLC_OP_STATUS_OK; } else { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); + free_mem_block(sdu_pP, __func__); return RLC_OP_STATUS_INTERNAL_ERROR; } @@ -487,6 +489,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, } else { //handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : out of memory\n", __FILE__, __LINE__); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); + free_mem_block(sdu_pP, __func__); return RLC_OP_STATUS_INTERNAL_ERROR; } @@ -521,6 +524,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, return RLC_OP_STATUS_OK; } else { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); + free_mem_block(sdu_pP, __func__); return RLC_OP_STATUS_BAD_PARAMETER; } } else { diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index d49393d959..04619eb067 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -299,6 +299,7 @@ void mac_rlc_data_ind ( switch (rlc_mode) { case RLC_MODE_NONE: //handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP); + list_free (&data_ind.data); break; case RLC_MODE_AM: