Commit 9ba19119 authored by nikaeinn's avatar nikaeinn

* adding additional tests for 10MHz and 20MHz channel BW

* applying patches 8 and 9 contributed from S. Held


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6536 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent f757f2eb
...@@ -222,7 +222,7 @@ int timer_remove(long timer_id) ...@@ -222,7 +222,7 @@ int timer_remove(long timer_id)
/* We didn't find the timer in list */ /* We didn't find the timer in list */
if (timer_p == NULL) { if (timer_p == NULL) {
pthread_mutex_unlock(&timer_desc.timer_list_mutex); pthread_mutex_unlock(&timer_desc.timer_list_mutex);
TMR_ERROR("Didn't find timer 0x%lx in list\n", (long)timer_p->timer); TMR_ERROR("Didn't find timer 0x%lx in list\n", timer_id);
return -1; return -1;
} }
......
...@@ -619,8 +619,11 @@ void phy_config_dedicated_eNB(uint8_t Mod_id, ...@@ -619,8 +619,11 @@ void phy_config_dedicated_eNB(uint8_t Mod_id,
struct PhysicalConfigDedicated *physicalConfigDedicated) { struct PhysicalConfigDedicated *physicalConfigDedicated) {
PHY_VARS_eNB *phy_vars_eNB = PHY_vars_eNB_g[Mod_id][CC_id]; PHY_VARS_eNB *phy_vars_eNB = PHY_vars_eNB_g[Mod_id][CC_id];
uint8_t UE_id = find_ue(rnti,phy_vars_eNB); int8_t UE_id = find_ue(rnti,phy_vars_eNB);
if (UE_id == -1) {
LOG_E( PHY, "[eNB %"PRIu8"] Frame %d: find_ue() returns -1\n", Mod_id, phy_vars_eNB->proc[8].frame_tx );
return;
}
if (physicalConfigDedicated) { if (physicalConfigDedicated) {
......
...@@ -155,6 +155,10 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB, ...@@ -155,6 +155,10 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB,
k+=phy_vars_eNB->lte_frame_parms.first_carrier_offset; k+=phy_vars_eNB->lte_frame_parms.first_carrier_offset;
DevAssert( Ns < 20 );
DevAssert( l < 2 );
DevAssert( mprime>>4 < 14 );
for (m=0;m<phy_vars_eNB->lte_frame_parms.N_RB_DL<<1;m++) { for (m=0;m<phy_vars_eNB->lte_frame_parms.N_RB_DL<<1;m++) {
mprime_dword = mprime>>4; mprime_dword = mprime>>4;
......
...@@ -618,6 +618,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -618,6 +618,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
} }
} }
else { // TM3 else { // TM3
DevAssert(dlsch1_harq);
if (get_Qm(dlsch1_harq->mcs) == 2) { if (get_Qm(dlsch1_harq->mcs) == 2) {
/* dlsch_qpsk_llr(frame_parms, /* dlsch_qpsk_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
......
...@@ -632,9 +632,11 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) { ...@@ -632,9 +632,11 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
phy_vars_eNB->eNB_UE_stats[UE_id].mode); phy_vars_eNB->eNB_UE_stats[UE_id].mode);
#ifdef OPENAIR2 #ifdef OPENAIR2
UE_id_mac = find_UE_id(phy_vars_eNB->Mod_id,phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->rnti); UE_id_mac = find_UE_id(phy_vars_eNB->Mod_id,phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->rnti);
RRC_status = mac_get_rrc_status(phy_vars_eNB->Mod_id,1,UE_id_mac); if (UE_id_mac != -1) {
RRC_status = mac_get_rrc_status(phy_vars_eNB->Mod_id,1,UE_id_mac);
len += sprintf(&buffer[len],"[eNB PROC] UE_id_mac = %d, RRC status = %d\n",UE_id_mac,RRC_status); len += sprintf(&buffer[len],"[eNB PROC] UE_id_mac = %d, RRC status = %d\n",UE_id_mac,RRC_status);
} else
len += sprintf(&buffer[len],"[eNB PROC] UE_id_mac = -1\n");
#endif #endif
#ifdef OPENAIR2 #ifdef OPENAIR2
......
...@@ -131,7 +131,8 @@ int32_t generate_srs_tx(PHY_VARS_UE *phy_vars_ue, ...@@ -131,7 +131,8 @@ int32_t generate_srs_tx(PHY_VARS_UE *phy_vars_ue,
mod_sym_t *txdataF = phy_vars_ue->lte_ue_common_vars.txdataF[0]; mod_sym_t *txdataF = phy_vars_ue->lte_ue_common_vars.txdataF[0];
uint16_t msrsb=0,Nb=0,nb,b,msrs0=0,k,Msc_RS,Msc_RS_idx,carrier_pos,symbol_offset; uint16_t msrsb=0,Nb=0,nb,b,msrs0=0,k,Msc_RS,Msc_RS_idx,carrier_pos,symbol_offset;
uint16_t *Msc_idx_ptr; uint16_t *Msc_idx_ptr;
uint32_t k0,T_SFC; int32_t k0;
uint32_t T_SFC;
uint32_t subframe_offset; uint32_t subframe_offset;
uint8_t Bsrs = soundingrs_ul_config_dedicated->srs_Bandwidth; uint8_t Bsrs = soundingrs_ul_config_dedicated->srs_Bandwidth;
uint8_t Csrs = frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig; uint8_t Csrs = frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig;
......
...@@ -132,6 +132,7 @@ void do_diff_cqi(uint8_t N_RB_DL, ...@@ -132,6 +132,7 @@ void do_diff_cqi(uint8_t N_RB_DL,
break; break;
case 15: case 15:
nb_sb = 4; nb_sb = 4;
break;
case 25: case 25:
nb_sb = 7; nb_sb = 7;
break; break;
......
...@@ -336,6 +336,8 @@ void ulsch_modulation(mod_sym_t **txdataF, ...@@ -336,6 +336,8 @@ void ulsch_modulation(mod_sym_t **txdataF,
uint8_t qam16_table_offset_im = 0; uint8_t qam16_table_offset_im = 0;
short gain_lin_QPSK; short gain_lin_QPSK;
DevAssert(frame_parms);
int re_offset,re_offset0,i,Msymb,j,k,nsymb,Msc_PUSCH,l; int re_offset,re_offset0,i,Msymb,j,k,nsymb,Msc_PUSCH,l;
// uint8_t harq_pid = (rag_flag == 1) ? 0 : subframe2harq_pid_tdd(frame_parms->tdd_config,subframe); // uint8_t harq_pid = (rag_flag == 1) ? 0 : subframe2harq_pid_tdd(frame_parms->tdd_config,subframe);
uint8_t harq_pid = subframe2harq_pid(frame_parms,frame,subframe); uint8_t harq_pid = subframe2harq_pid(frame_parms,frame,subframe);
...@@ -349,14 +351,14 @@ void ulsch_modulation(mod_sym_t **txdataF, ...@@ -349,14 +351,14 @@ void ulsch_modulation(mod_sym_t **txdataF,
uint32_t x1, x2, s=0; uint32_t x1, x2, s=0;
uint8_t c; uint8_t c;
// x1 is set in lte_gold_generic
x2 = (ulsch->rnti<<14) + (subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.3.1
if (!ulsch) { if (!ulsch) {
msg("ulsch_modulation.c: Null ulsch\n"); msg("ulsch_modulation.c: Null ulsch\n");
return; return;
} }
// x1 is set in lte_gold_generic
x2 = (ulsch->rnti<<14) + (subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.3.1
if (harq_pid > 7) { if (harq_pid > 7) {
msg("ulsch_modulation.c: Illegal harq_pid %d\n",harq_pid); msg("ulsch_modulation.c: Illegal harq_pid %d\n",harq_pid);
return; return;
...@@ -645,6 +647,8 @@ void ulsch_modulation(mod_sym_t **txdataF, ...@@ -645,6 +647,8 @@ void ulsch_modulation(mod_sym_t **txdataF,
dft_lte(ulsch->z,ulsch->d,Msc_PUSCH,ulsch->Nsymb_pusch); dft_lte(ulsch->z,ulsch->d,Msc_PUSCH,ulsch->Nsymb_pusch);
#endif #endif
DevAssert(txdataF);
#ifdef OFDMA_ULSCH #ifdef OFDMA_ULSCH
re_offset0 = frame_parms->first_carrier_offset + (ulsch->harq_processes[harq_pid]->first_rb*12); re_offset0 = frame_parms->first_carrier_offset + (ulsch->harq_processes[harq_pid]->first_rb*12);
if (re_offset0>frame_parms->ofdm_symbol_size) { if (re_offset0>frame_parms->ofdm_symbol_size) {
......
...@@ -1877,6 +1877,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e ...@@ -1877,6 +1877,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
if (UE_id<0) { if (UE_id<0) {
LOG_E(PHY,"[eNB %"PRIu8"] Frame %d: Unknown UE_id for rnti %"PRIx16"\n",phy_vars_eNB->Mod_id,phy_vars_eNB->proc[sched_subframe].frame_tx,DCI_pdu->dci_alloc[i].rnti); LOG_E(PHY,"[eNB %"PRIu8"] Frame %d: Unknown UE_id for rnti %"PRIx16"\n",phy_vars_eNB->Mod_id,phy_vars_eNB->proc[sched_subframe].frame_tx,DCI_pdu->dci_alloc[i].rnti);
mac_exit_wrapper("Invalid UE id (< 0) detected"); mac_exit_wrapper("Invalid UE id (< 0) detected");
return; // not reached
} }
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
//if (phy_vars_eNB->proc[sched_subframe].frame_tx%100 == 0) //if (phy_vars_eNB->proc[sched_subframe].frame_tx%100 == 0)
......
...@@ -1707,6 +1707,8 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst ...@@ -1707,6 +1707,8 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst
uint16_t frame_tx; uint16_t frame_tx;
static uint8_t first_run = 1; static uint8_t first_run = 1;
uint8_t pbch_trials = 0; uint8_t pbch_trials = 0;
DevAssert(phy_vars_ue);
int slot_rx = phy_vars_ue->slot_rx; int slot_rx = phy_vars_ue->slot_rx;
int frame_rx = phy_vars_ue->frame_rx; int frame_rx = phy_vars_ue->frame_rx;
...@@ -1832,7 +1834,7 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst ...@@ -1832,7 +1834,7 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst
phy_vars_ue->lte_frame_parms.N_RB_DL, phy_vars_ue->lte_frame_parms.N_RB_DL,
phy_vars_ue->lte_frame_parms.phich_config_common.phich_duration, phy_vars_ue->lte_frame_parms.phich_config_common.phich_duration,
phy_vars_ue->lte_frame_parms.phich_config_common.phich_resource); phy_vars_ue->lte_frame_parms.phich_config_common.phich_resource);
if ((frame_rx%100==0)&&(phy_vars_ue!=NULL)) { if (frame_rx%100 == 0) {
LOG_I(PHY,"[UE %d] frame %d, slot %d, PBCH: mode1_flag %d, tx_ant %d, frame_tx %d, phase %d. N_RB_DL %d, phich_duration %d, phich_resource %d/6\n", LOG_I(PHY,"[UE %d] frame %d, slot %d, PBCH: mode1_flag %d, tx_ant %d, frame_tx %d, phase %d. N_RB_DL %d, phich_duration %d, phich_resource %d/6\n",
phy_vars_ue->Mod_id, phy_vars_ue->Mod_id,
frame_rx, frame_rx,
......
...@@ -52,6 +52,9 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id, ...@@ -52,6 +52,9 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,
uint32_t Nre,sumKr,MPR_x100,Kr,r; uint32_t Nre,sumKr,MPR_x100,Kr,r;
uint16_t beta_offset_pusch; uint16_t beta_offset_pusch;
DevAssert( UE_id < NUMBER_OF_UE_MAX+1 );
DevAssert( harq_pid < 8 );
Nre = phy_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->Nsymb_initial * Nre = phy_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->Nsymb_initial *
phy_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->nb_rb*12; phy_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->nb_rb*12;
...@@ -74,6 +77,9 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id, ...@@ -74,6 +77,9 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,
beta_offset_pusch = 8; beta_offset_pusch = 8;
//(phy_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->control_only == 1) ? phy_vars_eNB->ulsch_eNB[UE_id]->beta_offset_cqi_times8:8; //(phy_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->control_only == 1) ? phy_vars_eNB->ulsch_eNB[UE_id]->beta_offset_cqi_times8:8;
DevAssert( UE_id < NUMBER_OF_UE_MAX );
DevAssert( MPR_x100/6 < 100 );
if (phy_vars_eNB->ul_power_control_dedicated[UE_id].deltaMCS_Enabled == 1) { if (phy_vars_eNB->ul_power_control_dedicated[UE_id].deltaMCS_Enabled == 1) {
// This is the formula from Section 5.1.1.1 in 36.213 10*log10(deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch) // This is the formula from Section 5.1.1.1 in 36.213 10*log10(deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch)
if (bw_factor == 1) { if (bw_factor == 1) {
...@@ -89,7 +95,12 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id, ...@@ -89,7 +95,12 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,
} }
int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid) { int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid) {
return get_hundred_times_delta_IF_eNB(PHY_vars_eNB_g[module_idP][CC_id],find_ue(rnti,PHY_vars_eNB_g[module_idP][CC_id]),harq_pid, 0); int8_t UE_id = find_ue( rnti, PHY_vars_eNB_g[module_idP][CC_id] );
if (UE_id == -1) {
// not found
return 0;
}
return get_hundred_times_delta_IF_eNB( PHY_vars_eNB_g[module_idP][CC_id], UE_id, harq_pid, 0 );
} }
int16_t get_hundred_times_delta_IF(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t harq_pid) { int16_t get_hundred_times_delta_IF(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t harq_pid) {
......
...@@ -654,6 +654,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) { ...@@ -654,6 +654,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
AssertError (0, parse_errors ++, AssertError (0, parse_errors ++,
"Failed to parse eNB configuration file %s, %u th enb\n", "Failed to parse eNB configuration file %s, %u th enb\n",
lib_config_file_name_pP, i); lib_config_file_name_pP, i);
continue; // FIXME this prevents segfaults below, not sure what happens after function exit
} }
// search if in active list // search if in active list
for (j=0; j < num_enb_properties; j++) { for (j=0; j < num_enb_properties; j++) {
...@@ -768,6 +769,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) { ...@@ -768,6 +769,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
AssertError (0, parse_errors ++, AssertError (0, parse_errors ++,
"Failed to parse eNB configuration file %s, Component Carrier %d!\n", "Failed to parse eNB configuration file %s, Component Carrier %d!\n",
lib_config_file_name_pP, enb_properties.properties[enb_properties_index]->nb_cc++); lib_config_file_name_pP, enb_properties.properties[enb_properties_index]->nb_cc++);
continue; // FIXME this prevents segfaults below, not sure what happens after function exit
} }
enb_properties.properties[enb_properties_index]->nb_cc++; enb_properties.properties[enb_properties_index]->nb_cc++;
...@@ -1633,6 +1635,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) { ...@@ -1633,6 +1635,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
AssertError (0, parse_errors ++, AssertError (0, parse_errors ++,
"Failed to parse eNB configuration file %s, %u th enb %u th mme address !\n", "Failed to parse eNB configuration file %s, %u th enb %u th mme address !\n",
lib_config_file_name_pP, i, j); lib_config_file_name_pP, i, j);
continue; // FIXME will prevent segfaults below, not sure what happens at function exit...
} }
enb_properties.properties[enb_properties_index]->nb_mme += 1; enb_properties.properties[enb_properties_index]->nb_mme += 1;
......
...@@ -37,7 +37,9 @@ ...@@ -37,7 +37,9 @@
#ifndef ENB_CONFIG_H_ #ifndef ENB_CONFIG_H_
#define ENB_CONFIG_H_ #define ENB_CONFIG_H_
#include <netinet/in.h> #include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "commonDef.h" #include "commonDef.h"
#include "platform_types.h" #include "platform_types.h"
......
...@@ -134,8 +134,8 @@ int rrc_mac_config_req(module_id_t Mod_id, eNB_flag_t eNB_flagP,uint8_t UE_id,ui ...@@ -134,8 +134,8 @@ int rrc_mac_config_req(module_id_t Mod_id, eNB_flag_t eNB_flagP,uint8_t UE_id,ui
} }
} }
if ((tdd_Config!=NULL)||(SIwindowsize!=NULL)||(SIperiod!=NULL)){ if (tdd_Config && SIwindowsize && SIperiod) {
if (eNB_flagP==1) if (eNB_flagP == ENB_FLAG_YES)
mac_xface->phy_config_sib1_eNB(Mod_id,0,tdd_Config,*SIwindowsize,*SIperiod); mac_xface->phy_config_sib1_eNB(Mod_id,0,tdd_Config,*SIwindowsize,*SIperiod);
else else
mac_xface->phy_config_sib1_ue(Mod_id,0,eNB_index,tdd_Config,*SIwindowsize,*SIperiod); mac_xface->phy_config_sib1_ue(Mod_id,0,eNB_index,tdd_Config,*SIwindowsize,*SIperiod);
...@@ -226,7 +226,8 @@ int rrc_mac_config_req(module_id_t Mod_id, eNB_flag_t eNB_flagP,uint8_t UE_id,ui ...@@ -226,7 +226,8 @@ int rrc_mac_config_req(module_id_t Mod_id, eNB_flag_t eNB_flagP,uint8_t UE_id,ui
UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_Timer); UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_Timer);
UE_mac_inst[Mod_id].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[Mod_id].scheduling_info.PathlossChange); UE_mac_inst[Mod_id].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[Mod_id].scheduling_info.PathlossChange);
LOG_D(MAC,"[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n", LOG_D(MAC,"[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n",
Mod_id,mac_MainConfig->phr_Config->present, Mod_id,
(mac_MainConfig->phr_Config)?mac_MainConfig->phr_Config->present:-1,
UE_mac_inst[Mod_id].scheduling_info.periodicPHR_SF, UE_mac_inst[Mod_id].scheduling_info.periodicPHR_SF,
UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_SF, UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_SF,
UE_mac_inst[Mod_id].scheduling_info.PathlossChange_db); UE_mac_inst[Mod_id].scheduling_info.PathlossChange_db);
......
...@@ -283,6 +283,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -283,6 +283,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
switch (mac_xface->lte_frame_parms->tdd_config) { switch (mac_xface->lte_frame_parms->tdd_config) {
case 2: case 2:
schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,7,nCCE); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,7,nCCE);
// no break here!
case 5: case 5:
schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status);
...@@ -307,8 +308,11 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, ...@@ -307,8 +308,11 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
case 1: case 1:
// schedule_RA(module_idP,frameP,subframeP,nprb,nCCE); // schedule_RA(module_idP,frameP,subframeP,nprb,nCCE);
schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,8,nCCE); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,8,nCCE);
// no break here!
case 2: case 2:
// no break here!
case 4: case 4:
// no break here!
case 5: case 5:
schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status);
fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status);
......
...@@ -389,6 +389,7 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,un ...@@ -389,6 +389,7 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,un
} }
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d subframeP %d Msg4 : TBS %d, sdu_len %d, msg4_header %d, msg4_padding %d, msg4_post_padding %d\n", LOG_I(MAC,"[eNB %d][RAPROC] Frame %d subframeP %d Msg4 : TBS %d, sdu_len %d, msg4_header %d, msg4_padding %d, msg4_post_padding %d\n",
module_idP,frameP,subframeP,TBsize,rrc_sdu_length,msg4_header,msg4_padding,msg4_post_padding); module_idP,frameP,subframeP,TBsize,rrc_sdu_length,msg4_header,msg4_padding,msg4_post_padding);
DevAssert( UE_id != UE_INDEX_INVALID ); // FIXME not sure how to gracefully return
offset = generate_dlsch_header((unsigned char*)eNB->UE_list.DLSCH_pdu[CC_id][0][(unsigned char)UE_id].payload[0], offset = generate_dlsch_header((unsigned char*)eNB->UE_list.DLSCH_pdu[CC_id][0][(unsigned char)UE_id].payload[0],
1, //num_sdus 1, //num_sdus
&rrc_sdu_length, // &rrc_sdu_length, //
......
...@@ -71,7 +71,7 @@ void schedule_SI(module_id_t module_idP,frame_t frameP, unsigned int *nprbP,unsi ...@@ -71,7 +71,7 @@ void schedule_SI(module_id_t module_idP,frame_t frameP, unsigned int *nprbP,unsi
unsigned char bcch_sdu_length; int8_t bcch_sdu_length;
int mcs = -1; int mcs = -1;
void *BCCH_alloc_pdu; void *BCCH_alloc_pdu;
int CC_id; int CC_id;
......
...@@ -2146,14 +2146,16 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP ...@@ -2146,14 +2146,16 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP
unsigned char *get_dlsch_sdu(module_id_t module_idP, int CC_id, frame_t frameP, rnti_t rntiP, uint8_t TBindex) { unsigned char *get_dlsch_sdu(module_id_t module_idP, int CC_id, frame_t frameP, rnti_t rntiP, uint8_t TBindex) {
int UE_id;
eNB_MAC_INST *eNB=&eNB_mac_inst[module_idP]; eNB_MAC_INST *eNB=&eNB_mac_inst[module_idP];
if (rntiP==SI_RNTI) { if (rntiP==SI_RNTI) {
LOG_D(MAC,"[eNB %d] Frame %d Get DLSCH sdu for BCCH \n",module_idP,frameP); LOG_D(MAC,"[eNB %d] Frame %d Get DLSCH sdu for BCCH \n",module_idP,frameP);
return((unsigned char *)&eNB->common_channels[CC_id].BCCH_pdu.payload[0]); return((unsigned char *)&eNB->common_channels[CC_id].BCCH_pdu.payload[0]);
} else if ((UE_id = find_UE_id(module_idP,rntiP)) != UE_INDEX_INVALID ){ }
int UE_id = find_UE_id(module_idP,rntiP);
if (UE_id != -1) {
LOG_D(MAC,"[eNB %d] Frame %d: CC_id %d Get DLSCH sdu for rnti %x => UE_id %d\n",module_idP,frameP,CC_id,rntiP,UE_id); LOG_D(MAC,"[eNB %d] Frame %d: CC_id %d Get DLSCH sdu for rnti %x => UE_id %d\n",module_idP,frameP,CC_id,rntiP,UE_id);
return((unsigned char *)&eNB->UE_list.DLSCH_pdu[CC_id][TBindex][UE_id].payload[0]); return((unsigned char *)&eNB->UE_list.DLSCH_pdu[CC_id][TBindex][UE_id].payload[0]);
} else { } else {
...@@ -2191,6 +2193,7 @@ void set_ue_dai(sub_frame_t subframeP, ...@@ -2191,6 +2193,7 @@ void set_ue_dai(sub_frame_t subframeP,
case 0: case 0:
if ((subframeP==0)||(subframeP==1)||(subframeP==3)||(subframeP==5)||(subframeP==6)||(subframeP==8)) if ((subframeP==0)||(subframeP==1)||(subframeP==3)||(subframeP==5)||(subframeP==6)||(subframeP==8))
UE_list->UE_template[CC_id][UE_id].DAI = 0; UE_list->UE_template[CC_id][UE_id].DAI = 0;
break;
case 1: case 1:
if ((subframeP==0)||(subframeP==4)||(subframeP==5)||(subframeP==9)) if ((subframeP==0)||(subframeP==4)||(subframeP==5)||(subframeP==9))
UE_list->UE_template[CC_id][UE_id].DAI = 0; UE_list->UE_template[CC_id][UE_id].DAI = 0;
...@@ -2214,6 +2217,7 @@ void set_ue_dai(sub_frame_t subframeP, ...@@ -2214,6 +2217,7 @@ void set_ue_dai(sub_frame_t subframeP,
case 6: case 6:
if ((subframeP==0)||(subframeP==1)||(subframeP==5)||(subframeP==6)||(subframeP==9)) if ((subframeP==0)||(subframeP==1)||(subframeP==5)||(subframeP==6)||(subframeP==9))
UE_list->UE_template[CC_id][UE_id].DAI = 0; UE_list->UE_template[CC_id][UE_id].DAI = 0;
break;
default: default:
UE_list->UE_template[CC_id][UE_id].DAI = 0; UE_list->UE_template[CC_id][UE_id].DAI = 0;
LOG_N(MAC,"unknow TDD config %d\n",tdd_config); LOG_N(MAC,"unknow TDD config %d\n",tdd_config);
......
...@@ -362,8 +362,10 @@ void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag) { ...@@ -362,8 +362,10 @@ void swap_UEs(UE_list_t *listP,int nodeiP, int nodejP, int ul_flag) {
prev_i = prev(listP,nodeiP,ul_flag); prev_i = prev(listP,nodeiP,ul_flag);
prev_j = prev(listP,nodejP,ul_flag); prev_j = prev(listP,nodejP,ul_flag);
if ((prev_i<0) || (prev_j<0)) if ((prev_i<0) || (prev_j<0)) {
mac_xface->macphy_exit(""); mac_xface->macphy_exit("");
return; // not reached
}
if (ul_flag == 0){ if (ul_flag == 0){
next_i = listP->next[nodeiP]; next_i = listP->next[nodeiP];
...@@ -471,7 +473,7 @@ void SR_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, rnti_t rntiP ...@@ -471,7 +473,7 @@ void SR_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, rnti_t rntiP
int UE_id = find_UE_id(mod_idP, rntiP); int UE_id = find_UE_id(mod_idP, rntiP);
UE_list_t *UE_list = &eNB_mac_inst[mod_idP].UE_list; UE_list_t *UE_list = &eNB_mac_inst[mod_idP].UE_list;
if (UE_id != UE_INDEX_INVALID ) { if (UE_id != -1) {
LOG_D(MAC,"[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d on CC_id %d\n",mod_idP,rntiP,frameP,subframeP, UE_id,cc_idP); LOG_D(MAC,"[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d on CC_id %d\n",mod_idP,rntiP,frameP,subframeP, UE_id,cc_idP);
UE_list->UE_template[cc_idP][UE_id].ul_SR = 1; UE_list->UE_template[cc_idP][UE_id].ul_SR = 1;
UE_list->UE_template[cc_idP][UE_id].ul_active = TRUE; UE_list->UE_template[cc_idP][UE_id].ul_active = TRUE;
......
...@@ -94,7 +94,7 @@ void rx_sdu(module_id_t enb_mod_idP,int CC_idP,frame_t frameP,rnti_t rntiP,uint8 ...@@ -94,7 +94,7 @@ void rx_sdu(module_id_t enb_mod_idP,int CC_idP,frame_t frameP,rnti_t rntiP,uint8
switch (rx_ces[i]) { // implement and process BSR + CRNTI + switch (rx_ces[i]) { // implement and process BSR + CRNTI +
case POWER_HEADROOM: case POWER_HEADROOM:
if (UE_id != UE_INDEX_INVALID ){ if (UE_id != -1){
UE_list->UE_template[CC_idP][UE_id].phr_info = (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET; UE_list->UE_template[CC_idP][UE_id].phr_info = (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET;
LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received PHR PH = %d (db)\n", rx_ces[i], UE_list->UE_template[CC_idP][UE_id].phr_info); LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received PHR PH = %d (db)\n", rx_ces[i], UE_list->UE_template[CC_idP][UE_id].phr_info);
UE_list->UE_template[CC_idP][UE_id].phr_info_configured=1; UE_list->UE_template[CC_idP][UE_id].phr_info_configured=1;
...@@ -107,7 +107,7 @@ void rx_sdu(module_id_t enb_mod_idP,int CC_idP,frame_t frameP,rnti_t rntiP,uint8 ...@@ -107,7 +107,7 @@ void rx_sdu(module_id_t enb_mod_idP,int CC_idP,frame_t frameP,rnti_t rntiP,uint8
break; break;
case TRUNCATED_BSR: case TRUNCATED_BSR:
case SHORT_BSR: { case SHORT_BSR: {
if (UE_id != UE_INDEX_INVALID ){ if (UE_id != -1){
uint8_t lcgid; uint8_t lcgid;
lcgid = (payload_ptr[0] >> 6); lcgid = (payload_ptr[0] >> 6);
LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n", LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n",
...@@ -119,7 +119,7 @@ void rx_sdu(module_id_t enb_mod_idP,int CC_idP,frame_t frameP,rnti_t rntiP,uint8 ...@@ -119,7 +119,7 @@ void rx_sdu(module_id_t enb_mod_idP,int CC_idP,frame_t frameP,rnti_t rntiP,uint8
payload_ptr += 1;//sizeof(SHORT_BSR); // fixme payload_ptr += 1;//sizeof(SHORT_BSR); // fixme
} break; } break;
case LONG_BSR: case LONG_BSR:
if (UE_id != UE_INDEX_INVALID ){ if (UE_id != -1){
UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID0] = ((payload_ptr[0] & 0xFC) >> 2); UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID0] = ((payload_ptr[0] & 0xFC) >> 2);
UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID1] = UE_list->UE_template[CC_idP][UE_id].bsr_info[LCGID1] =
((payload_ptr[0] & 0x03) << 4) | ((payload_ptr[1] & 0xF0) >> 4); ((payload_ptr[0] & 0x03) << 4) | ((payload_ptr[1] & 0xF0) >> 4);
......
...@@ -47,7 +47,7 @@ int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP,uint8_t CC_id) { ...@@ -47,7 +47,7 @@ int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP,uint8_t CC_id) {
if (CC_id>0) { if (CC_id>0) {
LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n"); LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n");
mac_xface->macphy_exit("MAC FATAL CC_id>0"); mac_xface->macphy_exit("MAC FATAL CC_id>0");
return; return 0; // not reached
} }
if (UE_mac_inst[module_idP].radioResourceConfigCommon) if (UE_mac_inst[module_idP].radioResourceConfigCommon)
...@@ -66,7 +66,7 @@ int8_t get_deltaP_rampup(module_id_t module_idP,uint8_t CC_id) { ...@@ -66,7 +66,7 @@ int8_t get_deltaP_rampup(module_id_t module_idP,uint8_t CC_id) {
if (CC_id>0) { if (CC_id>0) {
LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n"); LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n");
mac_xface->macphy_exit("MAC FATAL CC_id>0"); mac_xface->macphy_exit("MAC FATAL CC_id>0");
return; return 0; // not reached
} }
LOG_D(MAC,"[PUSCH]%d dB\n",UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER<<1); LOG_D(MAC,"[PUSCH]%d dB\n",UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER<<1);
......
...@@ -91,16 +91,16 @@ int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length) ...@@ -91,16 +91,16 @@ int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length)
len+=sprintf(&buffer[len],"UE TTI: %d\n",UE_mac_inst[ue_id].frame); len+=sprintf(&buffer[len],"UE TTI: %d\n",UE_mac_inst[ue_id].frame);
for (enb_id= 0; enb_id <NUM_eNB_INST;enb_id++) { for (enb_id= 0; enb_id <NB_SIG_CNX_UE;enb_id++) {
switch (mac_get_rrc_status(eNB_id,0,ue_id) > RRC_CONNECTED) { switch (mac_get_rrc_status(ue_id,0,enb_id) > RRC_CONNECTED) {
case RRC_RECONFIGURED : case RRC_RECONFIGURED :
case RRC_CONNECTED: case RRC_CONNECTED:
case RRC_SI_RECEIVED: case RRC_SI_RECEIVED:
case RRC_IDLE: case RRC_IDLE:
break; break;
if (mac_get_rrc_status(eNB_id,0,ue_id) > RRC_CONNECTED) { if (mac_get_rrc_status(ue_id,0,enb_id) > RRC_CONNECTED) {
// if (UE_mac_inst[ue_id].Dcch_lchan[CH_index].Active==1) { // if (UE_mac_inst[ue_id].Dcch_lchan[CH_index].Active==1) {
len+=sprintf(&buffer[len],"eNB %d: Wideband SINR %d dB---\n", len+=sprintf(&buffer[len],"eNB %d: Wideband SINR %d dB---\n",
CH_index,UE_mac_inst[Mod_id].Def_meas[CH_index].Wideband_sinr); CH_index,UE_mac_inst[Mod_id].Def_meas[CH_index].Wideband_sinr);
......
...@@ -249,8 +249,10 @@ int maxcqi(module_id_t Mod_id,int32_t UE_id) { ...@@ -249,8 +249,10 @@ int maxcqi(module_id_t Mod_id,int32_t UE_id) {
for (n=0;n<UE_list->numactiveCCs[UE_id];n++) { for (n=0;n<UE_list->numactiveCCs[UE_id];n++) {
CC_id = UE_list->ordered_CCids[n][UE_id]; CC_id = UE_list->ordered_CCids[n][UE_id];
eNB_UE_stats = mac_xface->get_eNB_UE_stats(Mod_id,CC_id,UE_RNTI(Mod_id,UE_id)); eNB_UE_stats = mac_xface->get_eNB_UE_stats(Mod_id,CC_id,UE_RNTI(Mod_id,UE_id));
if (eNB_UE_stats==NULL) if (eNB_UE_stats==NULL) {
mac_xface->macphy_exit("maxcqi: could not get eNB_UE_stats\n"); mac_xface->macphy_exit("maxcqi: could not get eNB_UE_stats\n");
return 0; // not reached
}
if (eNB_UE_stats->DL_cqi[0] > CQI) if (eNB_UE_stats->DL_cqi[0] > CQI)
CQI = eNB_UE_stats->DL_cqi[0]; CQI = eNB_UE_stats->DL_cqi[0];
} }
......
...@@ -127,6 +127,7 @@ void get_prach_resources(module_id_t module_idP, ...@@ -127,6 +127,7 @@ void get_prach_resources(module_id_t module_idP,
else { else {
LOG_E(MAC,"[UE %d] FATAL radioResourceConfigCommon is NULL !!!\n",module_idP); LOG_E(MAC,"[UE %d] FATAL radioResourceConfigCommon is NULL !!!\n",module_idP);
mac_xface->macphy_exit("MAC FATAL radioResourceConfigCommon is NULL"); mac_xface->macphy_exit("MAC FATAL radioResourceConfigCommon is NULL");
return; // not reached
} }
if (rach_ConfigDedicated) { // This is for network controlled Mobility, later if (rach_ConfigDedicated) { // This is for network controlled Mobility, later
......
...@@ -219,7 +219,7 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i ...@@ -219,7 +219,7 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i
if (CC_id>0) { if (CC_id>0) {
LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n"); LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n");
mac_xface->macphy_exit("MAC FATAL CC_id>0"); mac_xface->macphy_exit("MAC FATAL CC_id>0");
return; return 0;
} }
// determin the measurement gap // determin the measurement gap
...@@ -1733,7 +1733,7 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, uint8_t lcid, uint ...@@ -1733,7 +1733,7 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, uint8_t lcid, uint
boolean_t sr_pending = FALSE; boolean_t sr_pending = FALSE;
if ((lcg_id < 0) || (lcg_id > MAX_NUM_LCGID) ) if ((lcg_id < 0) || (lcg_id >= MAX_NUM_LCGID) )
return sr_pending; return sr_pending;
// fixme: need a better way to reset // fixme: need a better way to reset
if ((lcid == DCCH) || (lcid == DTCH)){ if ((lcid == DCCH) || (lcid == DTCH)){
...@@ -1766,10 +1766,13 @@ uint8_t locate (const uint32_t *table, int size, int value){ ...@@ -1766,10 +1766,13 @@ uint8_t locate (const uint32_t *table, int size, int value){
uint8_t ju, jm, jl; uint8_t ju, jm, jl;
int ascend; int ascend;
DevAssert( size > 0 );
DevAssert( size <= 256 );
if (value == 0) return 0; //elseif (value > 150000) return 63; if (value == 0) return 0; //elseif (value > 150000) return 63;
jl = 0; // lower bound jl = 0; // lower bound
ju = size ;// upper bound ju = size - 1; // upper bound
ascend = (table[ju] >= table[jl]) ? 1 : 0; // determine the order of the the table: 1 if ascending order of table, 0 otherwise ascend = (table[ju] >= table[jl]) ? 1 : 0; // determine the order of the the table: 1 if ascending order of table, 0 otherwise
while (ju-jl > 1) { //If we are not yet done, while (ju-jl > 1) { //If we are not yet done,
......
...@@ -655,6 +655,7 @@ boolean_t pdcp_data_ind( ...@@ -655,6 +655,7 @@ boolean_t pdcp_data_ind(
module_id_t src_id, dst_id;