From 58734eb019d6b8016f1ea6f951d81e84054729cd Mon Sep 17 00:00:00 2001 From: Javier Morgade Date: Tue, 1 Oct 2019 15:23:49 +0200 Subject: [PATCH] MBMS Scheduler code cleanup MCH channel level calculation reformulated according to DLSCH ACKNOWLEDGEMENT: 1. This commit was developed at Vicomtech (https://www.vicomtech.org) under UE project CDN-X-ALL: "CDN edge-cloud computing for efficient cache and reliable streaming aCROSS Aggregated unicast-multicast LinkS" 2. Project funded by Fed4FIRE+ OC5 (https://www.fed4fire.eu) Signed-off-by: Javier Morgade --- openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c | 6 +-- openair1/SCHED/prach_procedures.c | 2 +- openair2/LAYER2/MAC/eNB_scheduler_mch.c | 60 ++++++------------------- 3 files changed, 18 insertions(+), 50 deletions(-) diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c index 973891d034..dd49697d49 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c @@ -265,16 +265,16 @@ void mch_channel_level(int **dl_ch_estimates_ext, for (i=0; i<(nre>>2); i++) { #if defined(__x86_64__) || defined(__i386__) - avg128 = _mm_add_epi32(avg128,_mm_madd_epi16(dl_ch128[0],dl_ch128[0])); + avg128 = _mm_add_epi32(avg128,_mm_srai_epi32(_mm_madd_epi16(dl_ch128[0],dl_ch128[0]),log2_approx(nre>>2)-1)); #elif defined(__arm__) #endif } - avg[aarx] = (((int*)&avg128)[0] + + avg[aarx] = (((((int*)&avg128)[0] + ((int*)&avg128)[1] + ((int*)&avg128)[2] + - ((int*)&avg128)[3])/nre; + ((int*)&avg128)[3])/(nre>>factor2(nre)))*(1<<(log2_approx(nre>>2)-1-factor2(nre)))); // printf("Channel level : %d\n",avg[(aatx<<1)+aarx]); } diff --git a/openair1/SCHED/prach_procedures.c b/openair1/SCHED/prach_procedures.c index 15d2c4fafc..eb62f1ed00 100644 --- a/openair1/SCHED/prach_procedures.c +++ b/openair1/SCHED/prach_procedures.c @@ -166,7 +166,7 @@ void prach_procedures(PHY_VARS_eNB *eNB { if ((eNB->prach_energy_counter == 100) && (max_preamble_energy[0] > eNB->measurements.prach_I0+eNB->prach_DTX_threshold)) { - LOG_I(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n", + LOG_D(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n", eNB->Mod_id, eNB->CC_id, frame, diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c index b1e9717a9e..d2b4779cf2 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c @@ -81,14 +81,12 @@ get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id, } } -uint32_t bytes_in_buffer=0; -uint8_t msi_active=0; -uint8_t msi_pmch_stop=0; -uint8_t msi_pmch_stop2=0; - +static uint32_t bytes_in_buffer=0; +static uint8_t msi_pmch_stop=0; +//static uint8_t msi_active=0; +//static uint8_t msi_pmch_stop2=0; uint16_t mbms_rab_id = 2047; - -uint8_t msi_sfs=0; +static uint8_t msi_sfs=0; //MSI_ELEMENT * ptr =NULL; @@ -534,60 +532,30 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, //l=0; for (k = 0; k < num_mtch; k++) { // loop for all session in this MCH (MCH[0]) at this moment + ((MSI_ELEMENT *) msi_ptr)->lcid = cc->mbms_SessionList[0]->list.array[k]->logicalChannelIdentity_r9; //mtch_lcid; - ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0; // last subframeP of this mtch (only one mtch now) - ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xB; - //((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0x2; //100 - ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0x7; // last subframeP of this mtch (only one mtch now) - //((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xB; - ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xFF; //100 - -// ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0x0; // last subframeP of this mtch (only one mtch now) -// ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0x2; //100 - - //while((++l)*TBS<=bytes_in_buffer && l<=cc->pmch_Config[0]->sf_AllocEnd_r9){ - // if(l>=6 && l<=cc->pmch_Config[0]->sf_AllocEnd_r9){ - // ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0; //we limite till 256 TOFIX - // ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = l; - // } - //} - //ptr = (MSI_ELEMENT *) msi_ptr; - if( msi_sfs != 0 ) msi_pmch_stop = msi_sfs-1; else msi_pmch_stop = msi_sfs; - //msi_pmch_stop = bytes_in_buffer/TBS; - //if(bytes_in_buffer%TBS) - //msi_pmch_stop++; - // - //msi_pmch_stop = 20; + if( msi_pmch_stop > cc->pmch_Config[0]->sf_AllocEnd_r9) + LOG_W(MAC,"e-MBMS Buffer Overflow\n"); + if(msi_pmch_stop>=num_sf_alloc /*&& msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9*/) { - ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0; // last subframeP of this mtch (only one mtch now) + ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0; // last subframeP of this mtch (only one mtch now) & stop_sf limited to 256 //((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = msi_pmch_stop; ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = (msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[0]->sf_AllocEnd_r9); msi_pmch_stop = (msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[0]->sf_AllocEnd_r9); }else{ ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0x7; // last subframeP of this mtch (only one mtch now) - ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xFF; //100 + ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xFF; msi_pmch_stop=0; } -// do{ -// if(l>=0 && l<=cc->pmch_Config[0]->sf_AllocEnd_r9){ -// ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0; //we limite till 256 TOFIX -// ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = l; -// } -// }while((l++)*TBS<=bytes_in_buffer); -// - // if(((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB !=0x7 && ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB != 0xFF ) - // msi_active=1; - // else - // msi_active=1; - //((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = l; - // l++; - // } + + + msi_ptr += sizeof(MSI_ELEMENT); }