Commit 6e4d361e authored by knopp's avatar knopp

commit before merge

parent 41f04233
...@@ -1736,6 +1736,9 @@ add_executable(oaisim ...@@ -1736,6 +1736,9 @@ add_executable(oaisim
${s1ap_h} ${s1ap_h}
${x2ap_h} ${x2ap_h}
${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-enb.c
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c ${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c
${OPENAIR_TARGETS}/SIMU/USER/init_lte.c ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
${OPENAIR_TARGETS}/SIMU/USER/oaisim_config.c ${OPENAIR_TARGETS}/SIMU/USER/oaisim_config.c
...@@ -1779,6 +1782,9 @@ add_executable(oaisim_nos1 ...@@ -1779,6 +1782,9 @@ add_executable(oaisim_nos1
${s1ap_h} ${s1ap_h}
${x2ap_h} ${x2ap_h}
${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-enb.c
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c ${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c
${OPENAIR_TARGETS}/SIMU/USER/init_lte.c ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
${OPENAIR_TARGETS}/SIMU/USER/oaisim_config.c ${OPENAIR_TARGETS}/SIMU/USER/oaisim_config.c
......
...@@ -171,6 +171,7 @@ typedef enum { ...@@ -171,6 +171,7 @@ typedef enum {
} eNB_timing_t; } eNB_timing_t;
typedef struct UE_SCAN_INFO_s { typedef struct UE_SCAN_INFO_s {
/// 10 best amplitudes (linear) for each pss signals /// 10 best amplitudes (linear) for each pss signals
int32_t amp[3][10]; int32_t amp[3][10];
...@@ -310,10 +311,16 @@ typedef struct { ...@@ -310,10 +311,16 @@ typedef struct {
uint8_t CC_id; uint8_t CC_id;
/// Last RX timestamp /// Last RX timestamp
openair0_timestamp timestamp_rx; openair0_timestamp timestamp_rx;
/// pthread attributes for main UE thread
pthread_attr_t attr_ue;
/// scheduling parameters for main UE thread
struct sched_param sched_param_ue;
/// pthread descriptor main UE thread
pthread_t pthread_ue;
/// \brief Instance count for synch thread. /// \brief Instance count for synch thread.
/// \internal This variable is protected by \ref mutex_synch. /// \internal This variable is protected by \ref mutex_synch.
int instance_cnt_synch; int instance_cnt_synch;
/// pthread attributes for prach processing thread /// pthread attributes for synch processing thread
pthread_attr_t attr_synch; pthread_attr_t attr_synch;
/// scheduling parameters for synch thread /// scheduling parameters for synch thread
struct sched_param sched_param_synch; struct sched_param sched_param_synch;
...@@ -770,6 +777,9 @@ typedef struct { ...@@ -770,6 +777,9 @@ typedef struct {
time_stats_t dlsch_tc_intl2_stats; time_stats_t dlsch_tc_intl2_stats;
time_stats_t tx_prach; time_stats_t tx_prach;
/// RF and Interface devices per CC
openair0_device rfdevice;
#if ENABLE_RAL #if ENABLE_RAL
hash_table_t *ral_thresholds_timed; hash_table_t *ral_thresholds_timed;
SLIST_HEAD(ral_thresholds_gen_poll_s, ral_threshold_phy_t) ral_thresholds_gen_polled[RAL_LINK_PARAM_GEN_MAX]; SLIST_HEAD(ral_thresholds_gen_poll_s, ral_threshold_phy_t) ral_thresholds_gen_polled[RAL_LINK_PARAM_GEN_MAX];
......
...@@ -111,6 +111,9 @@ extern double p_qam64[8]; ...@@ -111,6 +111,9 @@ extern double p_qam64[8];
extern double beta1_dlsch[6][MCS_COUNT]; extern double beta1_dlsch[6][MCS_COUNT];
extern double beta2_dlsch[6][MCS_COUNT]; extern double beta2_dlsch[6][MCS_COUNT];
extern char eNB_functions[5][20];
extern char eNB_timing[2][20];
#endif /*__PHY_EXTERN_H__ */ #endif /*__PHY_EXTERN_H__ */
...@@ -139,6 +139,9 @@ double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.1682 ...@@ -139,6 +139,9 @@ double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.1682
*/ */
char eNB_functions[5][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RRU_IF5","NGFI_RRU_IF4","NGFI_RCC_IF4"};
char eNB_timing[2][20]={"synch_to_ext_device","synch_to_other"};
#endif /*__PHY_VARS_H__ */ #endif /*__PHY_VARS_H__ */
...@@ -3236,99 +3236,3 @@ int phy_procedures_RN_eNB_TX(unsigned char last_slot, unsigned char next_slot, r ...@@ -3236,99 +3236,3 @@ int phy_procedures_RN_eNB_TX(unsigned char last_slot, unsigned char next_slot, r
return do_proc; return do_proc;
} }
#endif #endif
/*
void phy_procedures_eNB_lte(unsigned char subframe,PHY_VARS_eNB **eNB,uint8_t abstraction_flag,
relaying_type_t r_type, PHY_VARS_RN *rn)
{
#if defined(ENABLE_ITTI)
MessageDef *msg_p;
const char *msg_name;
instance_t instance;
unsigned int Mod_id;
int result;
#endif
int CC_id=0;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX_ENB, eNB[0]->proc[subframe].frame_tx);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_LTE,1);
start_meas(&eNB[0]->phy_proc);
#if defined(ENABLE_ITTI)
do {
// Checks if a message has been sent to PHY sub-task
itti_poll_msg (TASK_PHY_ENB, &msg_p);
if (msg_p != NULL) {
msg_name = ITTI_MSG_NAME (msg_p);
instance = ITTI_MSG_INSTANCE (msg_p);
Mod_id = instance;
switch (ITTI_MSG_ID(msg_p)) {
// Messages from eNB app
case PHY_CONFIGURATION_REQ:
LOG_I(PHY, "[eNB %d] Received %s\n", instance, msg_name);
// TODO
break;
default:
LOG_E(PHY, "[ENB %d] Received unexpected message %s\n", Mod_id, msg_name);
break;
}
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
} while(msg_p != NULL);
#endif
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
if ((((eNB[CC_id]->frame_parms.frame_type == TDD)&&
(subframe_select(&eNB[CC_id]->frame_parms,eNB[CC_id]->proc[0].subframe_tx)==SF_DL))||
(eNB[CC_id]->frame_parms.frame_type == FDD))) {
#ifdef Rel10
if (phy_procedures_RN_eNB_TX(eNB[CC_id]->proc[0].subframe_rx, eNB[CC_id]->proc[0].subframe_tx, r_type) != 0 )
#endif
phy_procedures_eNB_TX(subframe,eNB[CC_id],abstraction_flag,r_type,rn);
}
if ((((eNB[CC_id]->frame_parms.frame_type == TDD )&&
(subframe_select(&eNB[CC_id]->frame_parms,eNB[CC_id]->proc[0].subframe_rx)==SF_UL)) ||
(eNB[CC_id]->frame_parms.frame_type == FDD))) {
phy_procedures_eNB_RX(subframe,eNB[CC_id],abstraction_flag,r_type);
}
if (subframe_select(&eNB[CC_id]->frame_parms,eNB[CC_id]->proc[0].subframe_tx)==SF_S) {
#ifdef Rel10
if (phy_procedures_RN_eNB_TX(subframe, subframe, r_type) != 0 )
#endif
phy_procedures_eNB_TX(subframe,eNB[CC_id],abstraction_flag,r_type,rn);
}
if ((subframe_select(&eNB[CC_id]->frame_parms,eNB[CC_id]->proc[0].subframe_rx)==SF_S)) {
phy_procedures_eNB_S_RX(subframe,eNB[CC_id],abstraction_flag,r_type);
}
eNB[CC_id]->proc[0].frame_tx++;
eNB[CC_id]->proc[0].frame_rx++;
if (eNB[CC_id]->proc[0].frame_tx>=MAX_FRAME_NUMBER) // defined in impl_defs_top.h
eNB[CC_id]->proc[0].frame_tx-=MAX_FRAME_NUMBER;
if (eNB[CC_id]->proc[0].frame_rx>=MAX_FRAME_NUMBER)
eNB[CC_id]->proc[0].frame_rx-=MAX_FRAME_NUMBER;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_LTE,0);
stop_meas(&eNB[0]->phy_proc);
}
*/
...@@ -707,6 +707,8 @@ typedef struct { ...@@ -707,6 +707,8 @@ typedef struct {
// phy related params // phy related params
unsigned int n_frames; unsigned int n_frames;
unsigned int n_frames_flag; // if set, then let the emulation goes to infinity unsigned int n_frames_flag; // if set, then let the emulation goes to infinity
node_function_t node_function[MAX_NUM_CCs];
node_timing_t node_timing[MAX_NUM_CCS];
unsigned char frame_type[MAX_NUM_CCs]; //! LTE frame type (TDD=1, FDD=0). \note this should be converted to \ref lte_frame_type_t (header file reorganization needed) unsigned char frame_type[MAX_NUM_CCs]; //! LTE frame type (TDD=1, FDD=0). \note this should be converted to \ref lte_frame_type_t (header file reorganization needed)
char * frame_type_name[MAX_NUM_CCs]; char * frame_type_name[MAX_NUM_CCs];
unsigned char tdd_config[MAX_NUM_CCs]; unsigned char tdd_config[MAX_NUM_CCs];
......
...@@ -23,6 +23,8 @@ eNBs = ...@@ -23,6 +23,8 @@ eNBs =
component_carriers = ( component_carriers = (
{ {
node_function = "eNodeB_3GPP";
node_timing = "SYNCH_TO_OTHER";
frame_type = "FDD"; frame_type = "FDD";
tdd_config = 3; tdd_config = 3;
tdd_config_s = 0; tdd_config_s = 0;
......
...@@ -157,7 +157,7 @@ static struct { ...@@ -157,7 +157,7 @@ static struct {
void exit_fun(const char* s); void exit_fun(const char* s);
void init_eNB(eNB_func_t node_function); void init_eNB(eNB_func_t node_function,int nb_inst);
void stop_eNB(void); void stop_eNB(void);
...@@ -350,7 +350,7 @@ static void* eNB_thread_rxtx( void* param ) { ...@@ -350,7 +350,7 @@ static void* eNB_thread_rxtx( void* param ) {
/* Set affinity mask to include CPUs 1 to MAX_CPUS */ /* Set affinity mask to include CPUs 1 to MAX_CPUS */
/* CPU 0 is reserved for UHD threads */ /* CPU 0 is reserved for UHD threads */
/* CPU 1 is reserved for all TX threads */ /* CPU 1 is reserved for all RX_TX threads */
/* Enable CPU Affinity only if number of CPUs >2 */ /* Enable CPU Affinity only if number of CPUs >2 */
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
...@@ -398,7 +398,7 @@ static void* eNB_thread_rxtx( void* param ) { ...@@ -398,7 +398,7 @@ static void* eNB_thread_rxtx( void* param ) {
exit_fun("Error getting thread priority"); exit_fun("Error getting thread priority");
} }
LOG_I(HW, "[SCHED][eNB] TX thread started on CPU %d TID %ld, sched_policy = %s , priority = %d, CPU Affinity=%s \n",sched_getcpu(),gettid(), LOG_I(HW, "[SCHED][eNB] RXn_TXnp4 thread started on CPU %d TID %ld, sched_policy = %s , priority = %d, CPU Affinity=%s \n",sched_getcpu(),gettid(),
(policy == SCHED_FIFO) ? "SCHED_FIFO" : (policy == SCHED_FIFO) ? "SCHED_FIFO" :
(policy == SCHED_RR) ? "SCHED_RR" : (policy == SCHED_RR) ? "SCHED_RR" :
(policy == SCHED_OTHER) ? "SCHED_OTHER" : (policy == SCHED_OTHER) ? "SCHED_OTHER" :
...@@ -644,12 +644,103 @@ static void* eNB_thread_asynch_rx( void* param ) { ...@@ -644,12 +644,103 @@ static void* eNB_thread_asynch_rx( void* param ) {
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
openair0_timestamp timestamp_rx; openair0_timestamp timestamp_rx;
int frame_rx,subframe_rx; int frame_rx,subframe_rx;
int first_rx = 1; static int first_rx = 1;
uint16_t packet_type; uint16_t packet_type;
uint32_t symbol_number=0; uint32_t symbol_number=0;
uint32_t symbol_mask, symbol_mask_full; uint32_t symbol_mask, symbol_mask_full;
int prach_rx; int prach_rx;
#ifdef DEADLINE_SCHEDULER
struct sched_attr attr;
unsigned int flags = 0;
uint64_t runtime = 870000 ;
uint64_t deadline = 1 * 1000000;
uint64_t period = 1 * 10000000; // each rx thread has a period of 10ms from the starting point
attr.size = sizeof(attr);
attr.sched_flags = 0;
attr.sched_nice = 0;
attr.sched_priority = 0;
attr.sched_policy = SCHED_DEADLINE;
attr.sched_runtime = runtime;
attr.sched_deadline = deadline;
attr.sched_period = period;
if (sched_setattr(0, &attr, flags) < 0 ) {
perror("[SCHED] eNB FH sched_setattr failed\n");
return &eNB_thread_FH_status;
}
LOG_I( HW, "[SCHED] eNB asynch RX deadline thread (TID %ld) started on CPU %d\n", gettid(), sched_getcpu() );
#else // LOW_LATENCY
int policy, s, j;
struct sched_param sparam;
char cpu_affinity[1024];
cpu_set_t cpuset;
/* Set affinity mask to include CPUs 1 to MAX_CPUS */
/* CPU 0 is reserved for UHD */
/* CPU 1 is reserved for all TX threads */
/* CPU 2..MAX_CPUS is reserved for all RX threads */
/* Set CPU Affinity only if number of CPUs >2 */
CPU_ZERO(&cpuset);
#ifdef CPU_AFFINITY
if (get_nprocs() >2) {
for (j = 1; j < get_nprocs(); j++)
CPU_SET(j, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0) {
perror( "pthread_setaffinity_np");
exit_fun (" Error setting processor affinity :");
}
}
#endif //CPU_AFFINITY
/* Check the actual affinity mask assigned to the thread */
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0) {
perror ("pthread_getaffinity_np");
exit_fun (" Error getting processor affinity :");
}
memset(cpu_affinity,0, sizeof(cpu_affinity));
for (j = 0; j < CPU_SETSIZE; j++)
if (CPU_ISSET(j, &cpuset)) {
char temp[1024];
sprintf (temp, " CPU_%d", j);
strcat(cpu_affinity, temp);
}
memset(&sparam, 0 , sizeof (sparam));
sparam.sched_priority = sched_get_priority_max(SCHED_FIFO);
policy = SCHED_FIFO ;
s = pthread_setschedparam(pthread_self(), policy, &sparam);
if (s != 0) {
perror("pthread_setschedparam : ");
exit_fun("Error setting thread priority");
}
memset(&sparam, 0 , sizeof (sparam));
s = pthread_getschedparam(pthread_self(), &policy, &sparam);
if (s != 0) {
perror("pthread_getschedparam");
exit_fun("Error getting thread priority");
}
LOG_I(HW, "[SCHED][eNB] eNB asynch RX thread started on CPU %d TID %ld, sched_policy = %s, priority = %d, CPU Affinity = %s\n", sched_getcpu(),gettid(),
(policy == SCHED_FIFO) ? "SCHED_FIFO" :
(policy == SCHED_RR) ? "SCHED_RR" :
(policy == SCHED_OTHER) ? "SCHED_OTHER" :
"???",
sparam.sched_priority, cpu_affinity);
#endif // DEADLINE_SCHEDULER
if (eNB->node_function == eNodeB_3GPP_BBU) { // acquisition from IF if (eNB->node_function == eNodeB_3GPP_BBU) { // acquisition from IF
/// **** recv_IF5 of rxdata from RRH **** /// /// **** recv_IF5 of rxdata from RRH **** ///
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF5, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF5, 1 );
...@@ -772,11 +863,11 @@ static void* eNB_thread_FH( void* param ) { ...@@ -772,11 +863,11 @@ static void* eNB_thread_FH( void* param ) {
attr.sched_period = period; attr.sched_period = period;
if (sched_setattr(0, &attr, flags) < 0 ) { if (sched_setattr(0, &attr, flags) < 0 ) {
perror("[SCHED] eNB RX sched_setattr failed\n"); perror("[SCHED] eNB FH sched_setattr failed\n");
return &eNB_thread_FH_status; return &eNB_thread_FH_status;
} }
LOG_I( HW, "[SCHED] eNB RX deadline thread (TID %ld) started on CPU %d\n", gettid(), sched_getcpu() ); LOG_I( HW, "[SCHED] eNB FH deadline thread (TID %ld) started on CPU %d\n", gettid(), sched_getcpu() );
#else // LOW_LATENCY #else // LOW_LATENCY
int policy, s, j; int policy, s, j;
struct sched_param sparam; struct sched_param sparam;
...@@ -835,7 +926,7 @@ static void* eNB_thread_FH( void* param ) { ...@@ -835,7 +926,7 @@ static void* eNB_thread_FH( void* param ) {
exit_fun("Error getting thread priority"); exit_fun("Error getting thread priority");
} }
LOG_I(HW, "[SCHED][eNB] RX thread started on CPU %d TID %ld, sched_policy = %s, priority = %d, CPU Affinity = %s\n", sched_getcpu(),gettid(), LOG_I(HW, "[SCHED][eNB] FH thread started on CPU %d TID %ld, sched_policy = %s, priority = %d, CPU Affinity = %s\n", sched_getcpu(),gettid(),
(policy == SCHED_FIFO) ? "SCHED_FIFO" : (policy == SCHED_FIFO) ? "SCHED_FIFO" :
(policy == SCHED_RR) ? "SCHED_RR" : (policy == SCHED_RR) ? "SCHED_RR" :
(policy == SCHED_OTHER) ? "SCHED_OTHER" : (policy == SCHED_OTHER) ? "SCHED_OTHER" :
...@@ -848,8 +939,8 @@ static void* eNB_thread_FH( void* param ) { ...@@ -848,8 +939,8 @@ static void* eNB_thread_FH( void* param ) {
mlockall(MCL_CURRENT | MCL_FUTURE); mlockall(MCL_CURRENT | MCL_FUTURE);
// wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe of TX and RX threads // wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe
printf( "waiting for sync (eNB_thread_rx_common)\n"); printf( "waiting for sync (eNB_thread_FH)\n");
pthread_mutex_lock( &sync_mutex ); pthread_mutex_lock( &sync_mutex );
while (sync_var<0) while (sync_var<0)
...@@ -1080,8 +1171,8 @@ static void* eNB_thread_FH( void* param ) { ...@@ -1080,8 +1171,8 @@ static void* eNB_thread_FH( void* param ) {
break; break;
} }
} else { } else {
LOG_W( PHY,"[eNB] Frame %d, FH CC_id %d thread busy!! (cnt_rxtx %i)\n",slave_proc->frame_rx,slave_proc->CC_id, cnt_slave); LOG_W( PHY,"[eNB] Frame %d, FH CC_id %d thread busy!! (cnt_FH %i)\n",slave_proc->frame_rx,slave_proc->CC_id, cnt_slave);
exit_fun( "TX thread busy" ); exit_fun( "FH thread busy" );
break; break;
} }
} }
...@@ -1324,91 +1415,94 @@ static void* eNB_thread_prach( void* param ) { ...@@ -1324,91 +1415,94 @@ static void* eNB_thread_prach( void* param ) {
} }
void init_eNB_proc(void) { void init_eNB_proc(int nb_inst) {
int i; int i;
int CC_id; int CC_id;
PHY_VARS_eNB *eNB; PHY_VARS_eNB *eNB;
eNB_proc_t *proc; eNB_proc_t *proc;
eNB_rxtx_proc_t *proc_rxtx; eNB_rxtx_proc_t *proc_rxtx;
int inst;
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
eNB = PHY_vars_eNB_g[0][CC_id]; for (inst = 0; inst < nb_inst; inst++) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
proc = &eNB->proc; eNB = PHY_vars_eNB_g[inst][CC_id];
proc_rxtx = proc->proc_rxtx; LOG_I(PHY,"Initializing eNB %d CC_id %d (%s,%s),\n",inst,CC_id,eNB_functions[eNB->node_function],eNB_timing[eNB->node_timing]);
proc = &eNB->proc;
proc_rxtx = proc->proc_rxtx;
#ifndef DEADLINE_SCHEDULER #ifndef DEADLINE_SCHEDULER
/* /*
pthread_attr_init( &attr_eNB_proc_tx[CC_id][i] ); pthread_attr_init( &attr_eNB_proc_tx[CC_id][i] );
if (pthread_attr_setstacksize( &attr_eNB_proc_tx[CC_id][i], 64 *PTHREAD_STACK_MIN ) != 0) if (pthread_attr_setstacksize( &attr_eNB_proc_tx[CC_id][i], 64 *PTHREAD_STACK_MIN ) != 0)
perror("[ENB_PROC_TX] setting thread stack size failed\n"); perror("[ENB_PROC_TX] setting thread stack size failed\n");
pthread_attr_init( &attr_eNB_proc_rx[CC_id][i] ); pthread_attr_init( &attr_eNB_proc_rx[CC_id][i] );
if (pthread_attr_setstacksize( &attr_eNB_proc_rx[CC_id][i], 64 * PTHREAD_STACK_MIN ) != 0) if (pthread_attr_setstacksize( &attr_eNB_proc_rx[CC_id][i], 64 * PTHREAD_STACK_MIN ) != 0)
perror("[ENB_PROC_RX] setting thread stack size failed\n"); perror("[ENB_PROC_RX] setting thread stack size failed\n");
*/ */
// set the kernel scheduling policy and priority // set the kernel scheduling policy and priority
proc_rxtx[0].sched_param_rxtx.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY; proc_rxtx[0].sched_param_rxtx.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&proc_rxtx[0].attr_rxtx, &proc_rxtx[0].sched_param_rxtx); pthread_attr_setschedparam (&proc_rxtx[0].attr_rxtx, &proc_rxtx[0].sched_param_rxtx);
pthread_attr_setschedpolicy (&proc_rxtx[0].attr_rxtx, SCHED_FIFO); pthread_attr_setschedpolicy (&proc_rxtx[0].attr_rxtx, SCHED_FIFO);
proc_rxtx[1].sched_param_rxtx.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY; proc_rxtx[1].sched_param_rxtx.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&proc_rxtx[1].attr_rxtx, &proc_rxtx[1].sched_param_rxtx); pthread_attr_setschedparam (&proc_rxtx[1].attr_rxtx, &proc_rxtx[1].sched_param_rxtx);
pthread_attr_setschedpolicy (&proc_rxtx[1].attr_rxtx, SCHED_FIFO); pthread_attr_setschedpolicy (&proc_rxtx[1].attr_rxtx, SCHED_FIFO);
proc->sched_param_FH.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY; proc->sched_param_FH.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&proc->attr_FH, &proc->sched_param_FH); pthread_attr_setschedparam (&proc->attr_FH, &proc->sched_param_FH);
pthread_attr_setschedpolicy (&proc->attr_FH, SCHED_FIFO); pthread_attr_setschedpolicy (&proc->attr_FH, SCHED_FIFO);
proc->sched_param_prach.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY; proc->sched_param_prach.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY;
pthread_attr_setschedparam (&proc->attr_prach, &proc->sched_param_prach); pthread_attr_setschedparam (&proc->attr_prach, &proc->sched_param_prach);
pthread_attr_setschedpolicy (&proc->attr_prach, SCHED_FIFO); pthread_attr_setschedpolicy (&proc->attr_prach, SCHED_FIFO);
printf("Setting OS scheduler to SCHED_FIFO for eNB [cc%d][thread%d] \n",CC_id, i); printf("Setting OS scheduler to SCHED_FIFO for eNB [cc%d][thread%d] \n",CC_id, i);
#endif #endif
proc_rxtx[0].instance_cnt_rxtx = -1; proc_rxtx[0].instance_cnt_rxtx = -1;
proc_rxtx[1].instance_cnt_rxtx = -1; proc_rxtx[1].instance_cnt_rxtx = -1;
proc->instance_cnt_prach = -1; proc->instance_cnt_prach = -1;
proc->instance_cnt_FH = -1; proc->instance_cnt_FH = -1;
proc->CC_id = CC_id; proc->CC_id = CC_id;
proc->first_rx=4; proc->first_rx=4;
pthread_mutex_init( &proc_rxtx[0].mutex_rxtx, NULL); pthread_mutex_init( &proc_rxtx[0].mutex_rxtx, NULL);
pthread_mutex_init( &proc_rxtx[1].mutex_rxtx, NULL); pthread_mutex_init( &proc_rxtx[1].mutex_rxtx, NULL);
pthread_mutex_init( &proc->mutex_prach, NULL); pthread_mutex_init( &proc->mutex_prach, NULL);
pthread_cond_init( &proc_rxtx[0].cond_rxtx, NULL); pthread_cond_init( &proc_rxtx[0].cond_rxtx, NULL);
pthread_cond_init( &proc_rxtx[1].cond_rxtx, NULL); pthread_cond_init( &proc_rxtx[1].cond_rxtx, NULL);
pthread_cond_init( &proc->cond_prach, NULL); pthread_cond_init( &proc->cond_prach, NULL);
pthread_cond_init( &proc->cond_FH, NULL); pthread_cond_init( &proc->cond_FH, NULL);
#ifndef DEADLINE_SCHEDULER #ifndef DEADLINE_SCHEDULER
pthread_create( &proc_rxtx[0].pthread_rxtx, &proc_rxtx[0].attr_rxtx, eNB_thread_rxtx, &proc_rxtx[0] ); pthread_create( &proc_rxtx[0].pthread_rxtx, &proc_rxtx[0].attr_rxtx, eNB_thread_rxtx, &proc_rxtx[0] );
pthread_create( &proc_rxtx[1].pthread_rxtx, &proc_rxtx[1].attr_rxtx, eNB_thread_rxtx, &proc_rxtx[1] ); pthread_create( &proc_rxtx[1].pthread_rxtx, &proc_rxtx[1].attr_rxtx, eNB_thread_rxtx, &proc_rxtx[1] );
pthread_create( &proc->pthread_FH, &proc->attr_FH, eNB_thread_FH, &eNB->proc ); pthread_create( &proc->pthread_FH, &proc->attr_FH, eNB_thread_FH, &eNB->proc );
pthread_create( &proc->pthread_prach, &proc->attr_prach, eNB_thread_prach, &eNB->proc ); pthread_create( &proc->pthread_prach, &proc->attr_prach, eNB_thread_prach, &eNB->proc );
if (eNB->node_timing == synch_to_other) if (eNB->node_timing == synch_to_other)
pthread_create( &proc->pthread_asynch_rx, &proc->attr_asynch_rx, eNB_thread_asynch_rx, &eNB->proc ); pthread_create( &proc->pthread_asynch_rx, &proc->attr_asynch_rx, eNB_thread_asynch_rx, &eNB->proc );
#else #else
pthread_create( &proc_rxtx[0].pthread_rxtx, NULL, eNB_thread_rxtx, &eNB->proc_rxtx[0] ); pthread_create( &proc_rxtx[0].pthread_rxtx, NULL, eNB_thread_rxtx, &eNB->proc_rxtx[0] );
pthread_create( &proc_rxtx[1].pthread_rxtx, NULL, eNB_thread_rxtx, &eNB->proc_rxtx[1] ); pthread_create( &proc_rxtx[1].pthread_rxtx, NULL, eNB_thread_rxtx, &eNB->proc_rxtx[1] );
pthread_create( &proc->pthread_FH, NULL, eNB_thread_FH, &eNB->proc ); pthread_create( &proc->pthread_FH, NULL, eNB_thread_FH, &eNB->proc );
pthread_create( &proc->pthread_prach, NULL, eNB_thread_prach, &eNB->proc ); pthread_create( &proc->pthread_prach, NULL, eNB_thread_prach, &eNB->proc );
if (eNB->node_timing == synch_to_other) if (eNB->node_timing == synch_to_other)
pthread_create( &proc->pthread_asynch_rx, NULL, eNB_thread_asynch_rx, &eNB->proc ); pthread_create( &proc->pthread_asynch_rx, NULL, eNB_thread_asynch_rx, &eNB->proc );
#endif #endif
char name[16]; char name[16];
snprintf( name, sizeof(name), "RXTX0 %d", i ); snprintf( name, sizeof(name), "RXTX0 %d", i );
pthread_setname_np( proc_rxtx[0].pthread_rxtx, name ); pthread_setname_np( proc_rxtx[0].pthread_rxtx, name );
snprintf( name, sizeof(name), "RXTX1 %d", i ); snprintf( name, sizeof(name), "RXTX1 %d", i );
pthread_setname_np( proc_rxtx[1].pthread_rxtx, name ); pthread_setname_np( proc_rxtx[1].pthread_rxtx, name );
snprintf( name, sizeof(name), "FH %d", i ); snprintf( name, sizeof(name), "FH %d", i );
pthread_setname_np( proc->pthread_FH, name ); pthread_setname_np( proc->pthread_FH, name );
}
/* setup PHY proc TX sync mechanism */
pthread_mutex_init(&sync_phy_proc.mutex_phy_proc_tx, NULL);
pthread_cond_init(&sync_phy_proc.cond_phy_proc_tx, NULL);
sync_phy_proc.phy_proc_CC_id = 0;
} }
/* setup PHY proc TX sync mechanism */
pthread_mutex_init(&sync_phy_proc.mutex_phy_proc_tx, NULL);
pthread_cond_init(&sync_phy_proc.cond_phy_proc_tx, NULL);
sync_phy_proc.phy_proc_CC_id = 0;
} }
...@@ -1577,14 +1671,15 @@ void print_opp_meas(void) { ...@@ -1577,14 +1671,15 @@ void print_opp_meas(void) {
} }
void init_eNB(eNB_func_t node_function) { void init_eNB(eNB_func_t node_function,int nb_inst) {
int CC_id; int CC_id;
int inst;
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) for (inst=0;inst<nb_inst;inst++)
PHY_vars_eNB_g[0][CC_id]->node_function = node_function; for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++)
PHY_vars_eNB_g[0][CC_id]->node_function = node_function;
init_eNB_proc();
init_eNB_proc(nb_inst);
sleep(1); sleep(1);
LOG_D(HW,"[lte-softmodem.c] eNB threads created\n"); LOG_D(HW,"[lte-softmodem.c] eNB threads created\n");
......
...@@ -119,14 +119,14 @@ unsigned short config_frames[4] = {2,9,11,13}; ...@@ -119,14 +119,14 @@ unsigned short config_frames[4] = {2,9,11,13};
// In lte-enb.c // In lte-enb.c
extern int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs]); extern int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs]);
extern void init_eNB(eNB_func_t); extern void init_eNB(eNB_func_t,int);
extern void stop_eNB(void); extern void stop_eNB(void);
extern void kill_eNB_proc(void); extern void kill_eNB_proc(void);
// In lte-ue.c // In lte-ue.c
extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs]); extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs]);
extern void fill_ue_band_info(void); extern void fill_ue_band_info(void);
extern void init_UE(void); extern void init_UE(int);
#ifdef XFORMS #ifdef XFORMS
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) // current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
...@@ -284,9 +284,6 @@ eth_params_t *eth_params; ...@@ -284,9 +284,6 @@ eth_params_t *eth_params;
openair0_config_t openair0_cfg[MAX_CARDS]; openair0_config_t openair0_cfg[MAX_CARDS];
// Change to openair_global to handle UE
openair0_device openair0;
double cpuf; double cpuf;
char uecap_xer[1024],uecap_xer_in=0; char uecap_xer[1024],uecap_xer_in=0;
...@@ -1677,40 +1674,15 @@ int main( int argc, char **argv ) ...@@ -1677,40 +1674,15 @@ int main( int argc, char **argv )
} }
} }
} }
/* device host type is set*/ else {
openair0.host_type = BBU_HOST; /* device host type is set*/
/* device type is initialized NONE_DEV (no RF device) when the RF device will be initiated device type will be set */ PHY_vars_UE_g[0][0]->rfdevice.host_type = BBU_HOST;
openair0.type = NONE_DEV; /* device type is initialized NONE_DEV (no RF device) when the RF device will be initiated device type will be set */
/* transport type is initialized NONE_TP (no transport protocol) when the transport protocol will be initiated transport protocol type will be set */ PHY_vars_UE_g[0][0]->rfdevice.type = NONE_DEV;
openair0.transp_type = NONE_TP; /* transport type is initialized NONE_TP (no transport protocol) when the transport protocol will be initiated transport protocol type will be set */
PHY_vars_UE_g[0][0]->rfdevice.transp_type = NONE_TP;
// Legacy BBU - RRH init }
//int returns=-1;
///* BBU can have either a local or a remote radio head */
//if (local_remote_radio == BBU_LOCAL_RADIO_HEAD) { //local radio head active - load library of radio head and initiate it
//if (mode!=loop_through_memory) {
//returns=openair0_device_load(&openair0, &openair0_cfg[0]);
//printf("openair0_device_init returns %d\n",returns);
//if (returns<0) {