Commit bb6ff96d authored by Navid Nikaein's avatar Navid Nikaein

* add time measurement for lte softmodem

* bug fixe when missed slots happens
* bug fix in mac ULSCH preprocessor


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7490 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 370dc660
......@@ -44,6 +44,35 @@ int opp_enabled = 0;
return (double)ts.diff/1000000000;
}*/
double get_cpu_freq_GHz(void) {
time_stats_t ts = {0};
reset_meas(&ts);
start_meas(&ts);
sleep(1);
stop_meas(&ts);
cpu_freq_GHz = (double)ts.diff/1000000000;
return cpu_freq_GHz;
}
void print_meas_now(time_stats_t *ts, const char* name, int subframe, FILE* file_name){
if (opp_enabled) {
//static double cpu_freq_GHz = 3.2;
//if (cpu_freq_GHz == 0.0)
//cpu_freq_GHz = get_cpu_freq_GHz(); // super slow
if (ts->trials>0) {
//fprintf(file_name,"Name %25s: Processing %15.3f ms for SF %d, diff_now %15.3f \n", name,(ts->diff_now/(cpu_freq_GHz*1000000.0)),subframe,ts->diff_now);
fprintf(file_name,"%15.3f ms, diff_now %15.3f \n",(ts->diff_now/(cpu_freq_GHz*1000000.0)),ts->diff_now);
}
}
}
void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time)
{
......
......@@ -34,9 +34,12 @@
// global var to enable openair performance profiler
extern int opp_enabled;
double cpu_freq_GHz;
typedef struct {
long long in;
long long diff_now;
long long diff;
long long p_time; /*!< \brief absolute process duration */
long long diff_square; /*!< \brief process duration square */
......@@ -47,8 +50,11 @@ typedef struct {
static inline void start_meas(time_stats_t *ts) __attribute__((always_inline));
static inline void stop_meas(time_stats_t *ts) __attribute__((always_inline));
void print_meas_now(time_stats_t *ts, const char* name, int subframe, FILE* file_name);
void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time);
double get_time_meas_us(time_stats_t *ts);
double get_cpu_freq_GHz(void);
#if defined(__i386__)
static inline unsigned long long rdtsc_oai(void) __attribute__((always_inline));
......@@ -109,6 +115,8 @@ static inline void stop_meas(time_stats_t *ts)
if (tid==0)
#endif
{
ts->diff_now = (out-ts->in);
ts->diff += (out-ts->in);
/// process duration is the difference between two clock points
ts->p_time = (out-ts->in);
......@@ -121,16 +129,25 @@ static inline void stop_meas(time_stats_t *ts)
}
}
static inline void reset_meas(time_stats_t *ts)
{
static inline void reset_meas(time_stats_t *ts) {
static cpu_freq_set=0;
if (opp_enabled) {
ts->trials=0;
ts->diff_now=0;
ts->diff=0;
ts->p_time=0;
ts->diff_square=0;
ts->max=0;
if (cpu_freq_set == 0 ){
cpu_freq_set = 1;
get_cpu_freq_GHz();
printf("CPU Freq is %f \n", cpu_freq_GHz);
}
}
}
static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts)
{
......@@ -148,14 +165,4 @@ static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts)
}
*/
static inline double get_cpu_freq_GHz(void)
{
time_stats_t ts = {0};
reset_meas(&ts);
start_meas(&ts);
sleep(1);
stop_meas(&ts);
return (double)ts.diff/1000000000;
}
......@@ -1394,7 +1394,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
// If we've dropped the UE, go back to PRACH mode for this UE
//#if !defined(EXMIMO_IOT)
if (phy_vars_eNB->eNB_UE_stats[i].ulsch_consecutive_errors == ULSCH_max_consecutive_errors) {
LOG_I(PHY,"[eNB %d, CC %d] frame %d, subframe %d, UE %d: ULSCH consecutive error count reached %u, removing UE\n",
LOG_W(PHY,"[eNB %d, CC %d] frame %d, subframe %d, UE %d: ULSCH consecutive error count reached %u, removing UE\n",
phy_vars_eNB->Mod_id,phy_vars_eNB->CC_id,frame,subframe, i, phy_vars_eNB->eNB_UE_stats[i].ulsch_consecutive_errors);
phy_vars_eNB->eNB_UE_stats[i].mode = PRACH;
remove_ue(phy_vars_eNB->eNB_UE_stats[i].crnti,phy_vars_eNB,abstraction_flag);
......@@ -3549,7 +3549,7 @@ void phy_procedures_eNB_RX(const unsigned char sched_subframe,PHY_VARS_eNB *phy_
*/
// dump_ulsch(phy_vars_eNB,sched_subframe,i);
//#ifndef EXMIMO_IOT
LOG_W(PHY,"[eNB] Frame %d, Subframe %d: Msg3 in error\n", frame,subframe);
LOG_W(PHY,"[eNB] Frame %d, Subframe %d: Msg3 in error, i = %d \n", frame,subframe,i);
//#else
//mac_exit_wrapper("Msg3 error");
//#endif
......
......@@ -81,7 +81,8 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,
//(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 );
#warning "This condition happens sometimes. Need more investigation" // navid
//DevAssert( MPR_x100/6 < 100 );
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)
......
......@@ -766,16 +766,15 @@ void schedule_ulsch_rnti(module_id_t module_idP,
ndi = 1-UE_template->oldNDI_UL[harq_pid];
UE_template->oldNDI_UL[harq_pid]=ndi;
//mcs = 10;
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=UE_template->pre_assigned_mcs_ul;
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=UE_template->pre_assigned_mcs_ul;
mcs = cmin (UE_template->pre_assigned_mcs_ul, openair_daq_vars.target_ue_ul_mcs); // adjust, based on user-defined MCS
if (UE_template->pre_allocated_rb_table_index_ul >=0) {
rb_table_index=UE_template->pre_allocated_rb_table_index_ul;
} else {
mcs=10;
mcs=cmin (10, openair_daq_vars.target_ue_ul_mcs);
rb_table_index=5; // for PHR
}
}
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=mcs;
buffer_occupancy = UE_template->ul_total_buffer;
......
......@@ -1057,11 +1057,11 @@ void assign_max_mcs_min_rb(module_id_t module_idP,int frameP, sub_frame_t subfra
// if this UE has UL traffic
if (UE_template->ul_total_buffer > 0 ) {
tbs = mac_xface->get_TBS_UL(mcs,1);
tbs = mac_xface->get_TBS_UL(mcs,3); // 1 or 2 PRB with cqi enabled does not work well!
// fixme: set use_srs flag
tx_power= mac_xface->estimate_ue_tx_power(tbs,rb_table[rb_table_index],0,frame_parms->Ncp,0);
while (((UE_template->phr_info - tx_power) < 0 ) &&
while ((((UE_template->phr_info - tx_power) < 0 ) || (tbs > UE_template->ul_total_buffer))&&
(mcs > 3)) {
// LOG_I(MAC,"UE_template->phr_info %d tx_power %d mcs %d\n", UE_template->phr_info,tx_power, mcs);
mcs--;
......@@ -1086,7 +1086,7 @@ void assign_max_mcs_min_rb(module_id_t module_idP,int frameP, sub_frame_t subfra
}
// 1 or 2 PRB with cqi enabled does not work well!
if (rb_table[rb_table_index]<3) {
if (rb_table[rb_table_index]<3) {
rb_table_index=2; //3PRB
}
......
......@@ -83,6 +83,7 @@ const char* eurecomVariablesNames[] = {
"slot_number_RX_UE",
"subframe_number_TX_UE",
"subframe_number_RX_UE",
"missed_slot_enb",
"daq_mbox",
"rx_offset_mbox",
"ue_rx_offset",
......
......@@ -55,6 +55,7 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX_UE,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX_UE,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX_UE,
VCD_SIGNAL_DUMPER_VARIABLES_MISSED_SLOTS_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX,
VCD_SIGNAL_DUMPER_VARIABLES_UE_OFFSET_MBOX,
VCD_SIGNAL_DUMPER_VARIABLES_UE_RX_OFFSET,
......
......@@ -30,10 +30,10 @@ eNBs =
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 7;
downlink_frequency = 2660000000L;
downlink_frequency = 2680000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 25;
N_RB_DL = 50;
Nid_cell_mbsfn = 0;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
......@@ -66,9 +66,9 @@ eNBs =
srs_ackNackST =;
srs_MaxUpPts =;*/
pusch_p0_Nominal = -85;
pusch_p0_Nominal = -80; /*-85;*/
pusch_alpha = "AL1";
pucch_p0_Nominal = -108;
pucch_p0_Nominal = -108; /* -108 */
msg3_delta_Preamble = 6;
pucch_deltaF_Format1 = "deltaF2";
pucch_deltaF_Format1b = "deltaF3";
......@@ -104,7 +104,7 @@ eNBs =
);
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.13.11";
mme_ip_address = ( { ipv4 = "10.0.1.1";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
......@@ -113,11 +113,11 @@ eNBs =
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.13.10/24";
ENB_INTERFACE_NAME_FOR_S1_MME = "eth3";
ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.1.229/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.13.10/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth3";
ENB_IPV4_ADDRESS_FOR_S1U = "10.0.1.229/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
......@@ -125,7 +125,7 @@ eNBs =
{
global_log_level ="debug";
global_log_verbosity ="medium";
hw_log_level ="warn";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="warn";
phy_log_verbosity ="medium";
......@@ -137,6 +137,12 @@ eNBs =
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="medium";
gtpu_log_level ="error";
gtpu_log_verbosity ="medium";
udp_log_level ="error";
udp_log_verbosity ="medium";
osa_log_level ="warn";
osa_log_verbosity ="low";
};
}
......
Active_eNBs = ( "eNB_Eurecom_LTEBox");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
eNBs =
(
{
# real_time choice in {hard, rt-preempt, no}
real_time = "no";
////////// Identification parameters:
eNB_ID = 0xe00;
cell_type = "CELL_MACRO_ENB";
eNB_name = "eNB_Eurecom_LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = "1";
mobile_country_code = "001";
mobile_network_code = "01";
////////// Physical parameters:
component_carriers = (
{
frame_type = "FDD";
tdd_config = 3;
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 7;
downlink_frequency = 2680000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 25;
Nid_cell_mbsfn = 0;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 25;
rx_gain = 20;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
prach_zero_correlation = 1;
prach_freq_offset = 2;
pucch_delta_shift = 1;
pucch_nRB_CQI = 1;
pucch_nCS_AN = 0;
pucch_n1_AN = 32;
pdsch_referenceSignalPower = -26;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame";
pusch_hoppingOffset = 0;
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_nDMRS1 = 0;
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
srs_enable = "DISABLE";
/* srs_BandwidthConfig =;
srs_SubframeConfig =;
srs_ackNackST =;
srs_MaxUpPts =;*/
pusch_p0_Nominal = -80; /*-85;*/
pusch_alpha = "AL1";
pucch_p0_Nominal = -108; /* -108 */
msg3_delta_Preamble = 6;
pucch_deltaF_Format1 = "deltaF2";
pucch_deltaF_Format1b = "deltaF3";
pucch_deltaF_Format2 = "deltaF0";
pucch_deltaF_Format2a = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
rach_numberOfRA_Preambles = 64;
rach_preamblesGroupAConfig = "DISABLE";
/*
rach_sizeOfRA_PreamblesGroupA = ;
rach_messageSizeGroupA = ;
rach_messagePowerOffsetGroupB = ;
*/
rach_powerRampingStep = 2;
rach_preambleInitialReceivedTargetPower = -100;
rach_preambleTransMax = 10;
rach_raResponseWindowSize = 10;
rach_macContentionResolutionTimer = 48;
rach_maxHARQ_Msg3Tx = 4;
pcch_default_PagingCycle = 128;
pcch_nB = "oneT";
bcch_modificationPeriodCoeff = 2;
ue_TimersAndConstants_t300 = 1000;
ue_TimersAndConstants_t301 = 1000;
ue_TimersAndConstants_t310 = 1000;
ue_TimersAndConstants_t311 = 10000;
ue_TimersAndConstants_n310 = 20;
ue_TimersAndConstants_n311 = 1;
}
);
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.4.80";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth3";
ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.1.10/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth3";
ENB_IPV4_ADDRESS_FOR_S1U = "10.0.1.10/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
log_config :
{
global_log_level ="debug";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="warn";
phy_log_verbosity ="medium";
mac_log_level ="warn";
mac_log_verbosity ="medium";
rlc_log_level ="warn";
rlc_log_verbosity ="medium";
pdcp_log_level ="warn";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="medium";
gtpu_log_level ="info";
gtpu_log_verbosity ="medium";
udp_log_level ="info";
udp_log_verbosity ="medium";
osa_log_level ="warn";
osa_log_verbosity ="low";
};
}
);
[*]
[*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI
[*] Fri Feb 27 11:14:11 2015
[*] GTKWave Analyzer v3.3.62 (w)1999-2014 BSI
[*] Thu May 28 09:51:04 2015
[*]
[dumpfile] "/tmp/openair_dump_eNB.vcd"
[dumpfile_mtime] "Fri Feb 27 11:06:12 2015"
[dumpfile_size] 22907981
[savefile] "/home/superserver/openair4G/trunk/targets/RT/USER/eNB_exmimo2.gtkw"
[timestart] 26966900000
[size] 1158 892
[pos] -1 -1
*-23.248880 26982603536 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[dumpfile] "/home/geyser/Documents/Results-Mobiarch-v2/no-dedicated-core/FIFO/2 cores/50RB/MCS26-16/run4-ok/openair_dump_eNB.vcd"
[dumpfile_mtime] "Fri May 22 17:35:07 2015"
[dumpfile_size] 352707646
[savefile] "/home/geyser/openair4G/targets/RT/USER/eNB_exmimo2.gtkw"
[timestart] 48949410000
[size] 1920 1014
[pos] -40 -40
*-21.787668 54509118463 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[sst_width] 257
[signals_width] 230
[sst_expanded] 1
......@@ -17,6 +17,14 @@
@24
variables.hw_frame[63:0]
variables.hw_subframe[63:0]
@28
functions.rt_sleep
@22
variables.daq_mbox[63:0]
variables.diff2[63:0]
@25
variables.missed_slot_enb[63:0]
@24
variables.txcnt[63:0]
variables.rxcnt[63:0]
variables.frame_number_TX_eNB[63:0]
......
......@@ -53,6 +53,7 @@
#include <execinfo.h>
#include <getopt.h>
#include <syscall.h>
#include <pthread.h> // for gettid
#include "rt_wrapper.h"
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
......@@ -960,7 +961,12 @@ static void* eNB_thread_tx( void* param )
static int eNB_thread_tx_status[NUM_ENB_THREADS];
eNB_proc_t *proc = (eNB_proc_t*)param;
FILE *tx_time_file;
char tx_time_name[101];
if (opp_enabled == 1) {
snprintf(tx_time_name, 100,"/tmp/%s_tx_time_thread_sf_%d", "eNB", proc->subframe);
tx_time_file = fopen(tx_time_name,"w");
}
// set default return value
eNB_thread_tx_status[proc->subframe] = 0;
......@@ -1002,9 +1008,9 @@ static void* eNB_thread_tx( void* param )
return &eNB_thread_tx_status[proc->subframe];
}
LOG_I( HW, "[SCHED] eNB TX deadline thread %d(id %ld) started on CPU %d\n", proc->subframe, gettid(), sched_getcpu() );
LOG_I( HW, "[SCHED] eNB TX deadline thread %d(tid %ld) started on CPU %d\n", proc->subframe, gettid(), sched_getcpu() );
#else
LOG_I( HW, "[SCHED][eNB] TX thread %d started on CPU %d\n", proc->subframe, sched_getcpu() );
LOG_I( HW, "[SCHED][eNB] TX thread %d started on CPU %d TID %d\n", proc->subframe, sched_getcpu(),gettid() );
#endif
#endif
......@@ -1076,6 +1082,9 @@ static void* eNB_thread_tx( void* param )
if (proc->frame_tx==1024)
proc->frame_tx=0;
stop_meas( &softmodem_stats_tx_sf[proc->subframe] );
print_meas_now(&softmodem_stats_tx_sf[proc->subframe],"eNB_TX_SF",proc->subframe, tx_time_file);
}
stop_meas( &softmodem_stats_tx_sf[proc->subframe] );
......@@ -1110,6 +1119,12 @@ static void* eNB_thread_rx( void* param )
eNB_proc_t *proc = (eNB_proc_t*)param;
FILE *rx_time_file;
char rx_time_name[101];
if (opp_enabled == 1){
snprintf(rx_time_name, 100,"/tmp/%s_rx_time_thread_sf_%d", "eNB", proc->subframe);
rx_time_file = fopen(rx_time_name,"w");
}
// set default return value
eNB_thread_rx_status[proc->subframe] = 0;
......@@ -1143,7 +1158,7 @@ static void* eNB_thread_rx( void* param )
/* This creates a 2ms reservation every 10ms period*/
attr.sched_policy = SCHED_DEADLINE;
attr.sched_runtime = 0.9 * 1000000; // each rx thread must finish its job in the worst case in 2ms
attr.sched_deadline = 1 * 1000000; // each rx thread will finish within 2ms
attr.sched_deadline = 2 * 1000000; // each rx thread will finish within 2ms
attr.sched_period = 1 * 10000000; // each rx thread has a period of 10ms from the starting point
if (sched_setattr(0, &attr, flags) < 0 ) {
......@@ -1153,7 +1168,7 @@ static void* eNB_thread_rx( void* param )
LOG_I( HW, "[SCHED] eNB RX deadline thread %d(id %ld) started on CPU %d\n", proc->subframe, gettid(), sched_getcpu() );
#else
LOG_I( HW, "[SCHED][eNB] RX thread %d started on CPU %d\n", proc->subframe, sched_getcpu() );
LOG_I( HW, "[SCHED][eNB] RX thread %d started on CPU %d TID %d\n", proc->subframe, sched_getcpu(),gettid() );
#endif
#endif // RTAI
......@@ -1219,6 +1234,9 @@ static void* eNB_thread_rx( void* param )
if (proc->frame_rx==1024)
proc->frame_rx=0;
stop_meas( &softmodem_stats_rx_sf[proc->subframe] );
print_meas_now(&softmodem_stats_rx_sf[proc->subframe],"eNB_RX_SF",proc->subframe, rx_time_file);
}
stop_meas( &softmodem_stats_rx_sf[proc->subframe] );
......@@ -1269,6 +1287,7 @@ void init_eNB_proc(void)
sched_param_eNB_proc_rx[CC_id][i].sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&attr_eNB_proc_rx[CC_id][i], &sched_param_eNB_proc_rx[CC_id][i]);
pthread_attr_setschedpolicy (&attr_eNB_proc_rx[CC_id][i], SCHED_FIFO);
printf("Setting OS scheduler to SCHED_FIFO for eNB [cc%d][thread%d] \n",CC_id, i);
#endif
PHY_vars_eNB_g[0][CC_id]->proc[i].instance_cnt_tx = -1;
......@@ -1429,7 +1448,7 @@ static void* eNB_thread( void* arg )
unsigned int rx_pos = 0;
unsigned int tx_pos = spp*tx_delay;
#endif
int CC_id=0;
struct timespec trx_time0, trx_time1, trx_time2;
#ifdef RTAI
......@@ -1475,7 +1494,7 @@ static void* eNB_thread( void* arg )
#ifdef RTAI
printf( "[SCHED][eNB] Started eNB main thread (id %p)\n", task );
#else
printf( "[SCHED][eNB] Started eNB main thread on CPU %d\n", sched_getcpu());
printf( "[SCHED][eNB] Started eNB main thread on CPU %d TID %d\n", sched_getcpu(), gettid());
#endif
#ifdef HARD_RT
......@@ -1533,18 +1552,40 @@ static void* eNB_thread( void* arg )
}
if (((slot%2==0) && (diff < (-14))) || ((slot%2==1) && (diff < (-7)))) {
// at the eNB, even slots have double as much time since most of the processing is done here and almost nothing in odd slots
LOG_D(HW,"eNB Frame %d, time %llu: missed slot, proceeding with next one (slot %d, hw_slot %d, mbox_current %d, mbox_target %d, diff %d)\n",frame, rt_get_time_ns(), slot, hw_slot, mbox_current,
mbox_target, diff);
slot++;
// at the eNB, even slots have double as much time since most of the processing is done here and almost nothing in odd slots
LOG_W(HW,"eNB Frame %d, time %llu: missed slot %d, proceeding with next one (slot %d, hw_slot %d, mbox_current %d, mbox_target %d, diff %d)\n",
frame, rt_get_time_ns(), num_missed_slots, slot, hw_slot, mbox_current,mbox_target, diff);
if (exit_missed_slots==1) {
stop_meas(&softmodem_stats_mt);
exit_fun("[HW][eNB] missed slot");
} else {
num_missed_slots++;
LOG_W(HW,"[eNB] just missed slot (total missed slots %ld)\n", num_missed_slots);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_MISSED_SLOTS_ENB,num_missed_slots );
}
if ((slot&1) == 1) {
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++){
if (PHY_vars_eNB_g[0][CC_id]->proc[((slot>>1)+1)%10].frame_rx==1023)
PHY_vars_eNB_g[0][CC_id]->proc[((slot>>1)+1)%10].frame_rx=0;
else
PHY_vars_eNB_g[0][CC_id]->proc[((slot>>1)+1)%10].frame_rx += 1;
if (PHY_vars_eNB_g[0][CC_id]->proc[((slot>>1)+1)%10].frame_tx==1023)
PHY_vars_eNB_g[0][CC_id]->proc[((slot>>1)+1)%10].frame_tx=0;
else
PHY_vars_eNB_g[0][CC_id]->proc[((slot>>1)+1)%10].frame_tx += 1;
}
}
slot++;
if (slot == 20) {
frame++;
slot = 0;
}
}
if (diff>8)
......@@ -1569,7 +1610,9 @@ static void* eNB_thread( void* arg )
LOG_D(HW,"eNB Frame %d, time %llu: rt_sleep_ns returned %d\n",frame, time_in);
hw_slot = (((((volatile unsigned int *)DAQ_MBOX)[0]+1)%150)<<1)/15;
//LOG_D(HW,"eNB Frame %d : hw_slot %d, time %llu\n",frame,hw_slot,rt_get_time_ns());
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_HW_SUBFRAME, hw_slot>>1);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_HW_FRAME, frame);
//LOG_D(HW,"eNB Frame %d : hw_slot %d, time %llu\n",frame,hw_slot,rt_get_time_ns());
delay_cnt++;
if (delay_cnt == 10) {
......@@ -1655,7 +1698,7 @@ static void* eNB_thread( void* arg )
(rx_pos >= (((2*hw_subframe)+1)*PHY_vars_eNB_g[0][0]->lte_frame_parms.samples_per_tti>>1))) {
tx_launched = 1;
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
if (pthread_mutex_lock(&PHY_vars_eNB_g[0][CC_id]->proc[hw_subframe].mutex_tx) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB TX thread %d (IC %d)\n", hw_subframe, PHY_vars_eNB_g[0][CC_id]->proc[hw_subframe].instance_cnt_tx );
exit_fun( "error locking mutex_tx" );
......@@ -2984,6 +3027,7 @@ int main( int argc, char **argv )
sched_param_dlsch.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&attr_dlsch_threads, &sched_param_dlsch);
pthread_attr_setschedpolicy (&attr_dlsch_threads, SCHED_FIFO);
printf("Setting eNB_thread FIFO scheduling policy with priority %d \n", sched_param_dlsch.sched_priority);
#endif
#endif
......@@ -3015,7 +3059,6 @@ int main( int argc, char **argv )
#endif
printf("UE threads created\n");
} else {
if (multi_thread>0) {
init_eNB_proc();
sleep(1);
......
......@@ -101,6 +101,8 @@ int sched_getattr(pid_t pid,struct sched_attr *attr,unsigned int size, unsigned
#endif
#define gettid() syscall(__NR_gettid) // for gettid
#else
#include <rtai_hal.h>
#include <rtai_lxrt.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment