Commit 9293f65b authored by Siddharth Rana's avatar Siddharth Rana

Additional changes to RAN/executables directory

parent 0f2a2698
......@@ -111,6 +111,8 @@ extern int transmission_mode;
extern int oaisim_flag;
//uint16_t sf_ahead=4;
extern uint16_t sf_ahead;
#include "executables/thread-common.h"
//extern PARALLEL_CONF_t get_thread_parallel_conf(void);
//extern WORKER_CONF_t get_thread_worker_conf(void);
......@@ -255,7 +257,67 @@ static inline int rxtx(PHY_VARS_eNB *eNB,
eNB->UL_INFO.subframe = proc->subframe_rx;
eNB->UL_INFO.module_id = eNB->Mod_id;
eNB->UL_INFO.CC_id = eNB->CC_id;
eNB->if_inst->UL_indication(&eNB->UL_INFO, (void*)proc);
//#ifdef ENB_SS
if (RC.ss.mode >= SS_SOFTMODEM)
{
MessageDef *message_p = itti_alloc_new_message(TASK_ENB_APP, 0, SS_UPD_TIM_INFO);
if (message_p)
{
SS_UPD_TIM_INFO(message_p).sf = eNB->UL_INFO.subframe;
SS_UPD_TIM_INFO(message_p).sfn = eNB->UL_INFO.frame;
int send_res = itti_send_msg_to_task(TASK_SYS, 0, message_p);
if (send_res < 0)
{
printf("Error in itti_send_msg_to_task");
// LOG_E( PHY, "[SS] Error in L1_Thread itti_send_msg_to_task"); /** TODO: Need separate logging for SS */
}
LOG_D(PHY, "[SS] SS_UPD_TIM_INFO from L1_Thread to SYS task itti_send_msg_to_task sfn %d sf %d",
eNB->UL_INFO.subframe, eNB->UL_INFO.frame); /** TODO: Need separate logging for SS */
}
MessageDef *message_p_vtp = itti_alloc_new_message(TASK_ENB_APP, 0, SS_UPD_TIM_INFO);
if (message_p_vtp && RC.ss.vtp_ready)
{
SS_UPD_TIM_INFO(message_p_vtp).sf = eNB->UL_INFO.subframe;
SS_UPD_TIM_INFO(message_p_vtp).sfn = eNB->UL_INFO.frame;
SS_UPD_TIM_INFO(message_p).physCellId = RC.rrc[eNB->UL_INFO.module_id]->carrier[eNB->UL_INFO.CC_id].physCellId;
int send_res = itti_send_msg_to_task(TASK_VTP, 0, message_p_vtp);
if (send_res < 0)
{
printf("Error in itti_send_msg_to_task");
// LOG_E( PHY, "[SS] Error in L1_Thread itti_send_msg_to_task"); /** TODO: Need separate logging for SS */
}
LOG_D(PHY, "[SS] SS_UPD_TIM_INFO from L1_Thread to VTP task itti_send_msg_to_task sfn %d sf %d",
eNB->UL_INFO.subframe, eNB->UL_INFO.frame); /** TODO: Need separate logging for SS */
}
MessageDef *message_p_vt_timer = itti_alloc_new_message(TASK_ENB_APP, 0, SS_UPD_TIM_INFO);
if (message_p_vt_timer)
{
SS_UPD_TIM_INFO(message_p_vt_timer).sf = eNB->UL_INFO.subframe;
SS_UPD_TIM_INFO(message_p_vt_timer).sfn = eNB->UL_INFO.frame;
int send_res = itti_send_msg_to_task(TASK_VT_TIMER, 0, message_p_vt_timer);
if (send_res < 0)
{
printf("Error in itti_send_msg_to_task");
// LOG_E( PHY, "[SS] Error in L1_Thread itti_send_msg_to_task"); /** TODO: Need separate logging for SS */
}
LOG_D(PHY, "[SS] SS_UPD_TIM_INFO from L1_Thread to TASK_VT_TIMER task itti_send_msg_to_task sfn %d sf %d",
eNB->UL_INFO.subframe, eNB->UL_INFO.frame); /** TODO: Need separate logging for SS */
}
}
int tem_proc_ccid = proc->CC_id;
/* MultiCell: Function modify for Multiple CC */
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
eNB->UL_INFO.CC_id = CC_id;
proc->CC_id = CC_id;//Temp solution need to be fixed later
eNB->if_inst->UL_indication(&eNB->UL_INFO, proc);
}
proc->CC_id = tem_proc_ccid;
//#endif /** ENB_SS */
AssertFatal((ret= pthread_mutex_unlock(&eNB->UL_INFO_mutex))==0,"error unlocking UL_INFO_mutex, return %d\n",ret);
/* this conflict resolution may be totally wrong, to be tested */
/* CONFLICT RESOLUTION: BEGIN */
......@@ -325,6 +387,7 @@ static void *L1_thread_tx(void *param) {
//wait_sync("tx_thread");
proc->respEncode = eNB->proc.L1_proc.respEncode;
while (!oai_exit) {
LOG_D(PHY,"Waiting for TX (IC %d)\n",proc->instance_cnt);
......@@ -386,8 +449,10 @@ static void *L1_thread( void *param ) {
char thread_name[100];
#if 0 /* MultiCell: Not Required for MultiCell case */
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
#endif
// set default return value
eNB_thread_rxtx_status = 0;
sprintf(thread_name,"RXn_TXnp4_%d\n",&eNB->proc.L1_proc == proc ? 0 : 1);
......@@ -424,9 +489,9 @@ static void *L1_thread( void *param ) {
if (oai_exit) break;
if (eNB->CC_id==0) {
if (rxtx(eNB,proc,thread_name) < 0) break;
}
/* MultiCell: Condition modified for MultiCell case */
/* This thread can only be wakeup for one cell SUBFRAME Ind under VNF as proxy would only send one SUBFRAME Ind for all cells. */
if (rxtx(eNB,proc,thread_name) < 0) break;
LOG_D(PHY,"L1 RX %d.%d done\n",proc->frame_rx,proc->subframe_rx);
......@@ -462,11 +527,11 @@ void eNB_top(PHY_VARS_eNB *eNB,
if (!oai_exit) {
T(T_ENB_MASTER_TICK, T_INT(0), T_INT(ru_proc->frame_rx), T_INT(ru_proc->tti_rx));
L1_proc->timestamp_tx = ru_proc->timestamp_rx + (ru->sf_ahead*fp->samples_per_tti);
L1_proc->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_tti);
L1_proc->frame_rx = ru_proc->frame_rx;
L1_proc->subframe_rx = ru_proc->tti_rx;
L1_proc->frame_tx = (L1_proc->subframe_rx > (9-ru->sf_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
L1_proc->subframe_tx = (L1_proc->subframe_rx + ru->sf_ahead)%10;
L1_proc->frame_tx = (L1_proc->subframe_rx > (9-sf_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
L1_proc->subframe_tx = (L1_proc->subframe_rx + sf_ahead)%10;
if (rxtx(eNB,L1_proc,string) < 0)
LOG_E(PHY,"eNB %d CC_id %d failed during execution\n",eNB->Mod_id,eNB->CC_id);
......@@ -610,11 +675,11 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,
// The last (TS_rx mod samples_per_frame) was n*samples_per_tti,
// we want to generate subframe (n+sf_ahead), so TS_tx = TX_rx+sf_ahead*samples_per_tti,
// and proc->subframe_tx = proc->subframe_rx+sf_ahead
L1_proc->timestamp_tx = ru_proc->timestamp_rx + (ru->sf_ahead*fp->samples_per_tti);
L1_proc->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_tti);
L1_proc->frame_rx = ru_proc->frame_rx;
L1_proc->subframe_rx = ru_proc->tti_rx;
L1_proc->frame_tx = (L1_proc->subframe_rx > (9-ru->sf_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
L1_proc->subframe_tx = (L1_proc->subframe_rx + ru->sf_ahead)%10;
L1_proc->frame_tx = (L1_proc->subframe_rx > (9-sf_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
L1_proc->subframe_tx = (L1_proc->subframe_rx + sf_ahead)%10;
LOG_D(PHY,"wakeup_rxtx: L1_proc->subframe_rx %d, L1_proc->subframe_tx %d, RU %d\n",L1_proc->subframe_rx,L1_proc->subframe_tx,ru->idx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_RXTX_RX_RU+ru->idx, L1_proc->frame_rx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_RXTX_RX_RU+ru->idx, L1_proc->subframe_rx);
......@@ -833,9 +898,14 @@ static void *process_stats_thread(void *param) {
print_meas(&eNB->dlsch_turbo_encoding_preperation_stats,"dlsch_coding_crc",NULL,NULL);
print_meas(&eNB->dlsch_turbo_encoding_segmentation_stats,"dlsch_segmentation",NULL,NULL);
print_meas(&eNB->dlsch_encoding_stats,"dlsch_encoding",NULL,NULL);
print_meas(&eNB->dlsch_turbo_encoding_signal_stats,"coding_signal",NULL,NULL);
print_meas(&eNB->dlsch_turbo_encoding_main_stats,"coding_main",NULL,NULL);
print_meas(&eNB->dlsch_turbo_encoding_stats,"turbo_encoding",NULL,NULL);
print_meas(&eNB->dlsch_interleaving_stats,"turbo_interleaving",NULL,NULL);
print_meas(&eNB->dlsch_rate_matching_stats,"turbo_rate_matching",NULL,NULL);
print_meas(&eNB->dlsch_turbo_encoding_waiting_stats,"coding_wait",NULL,NULL);
print_meas(&eNB->dlsch_turbo_encoding_wakeup_stats0,"coding_worker_0",NULL,NULL);
print_meas(&eNB->dlsch_turbo_encoding_wakeup_stats1,"coding_worker_1",NULL,NULL);
}
print_meas(&eNB->dlsch_modulation_stats,"dlsch_modulation",NULL,NULL);
......@@ -886,6 +956,8 @@ void init_eNB_proc(int inst) {
proc->instance_cnt_asynch_rxtx = -1;
proc->instance_cnt_synch = -1;
proc->CC_id = CC_id;
L1_proc->CC_id = CC_id; /* MultiCell: Added for Multiple CC */
L1_proc_tx->CC_id = CC_id; /* MultiCell: Added for Multiple CC */
proc->first_rx =1;
proc->first_tx =1;
proc->RU_mask_tx = (1<<eNB->num_RU)-1;
......@@ -917,6 +989,14 @@ void init_eNB_proc(int inst) {
pthread_mutex_init( &proc->mutex_RU_PRACH_br,NULL);
pthread_cond_init( &proc->cond_prach_br, NULL);
pthread_attr_init( &proc->attr_prach_br);
#ifndef DEADLINE_SCHEDULER
attr0 = &L1_proc->attr;
attr1 = &L1_proc_tx->attr;
attr_prach = &proc->attr_prach;
attr_prach_br = &proc->attr_prach_br;
// attr_td = &proc->attr_td;
// attr_te = &proc->attr_te;
#endif
if(get_thread_worker_conf() == WORKER_ENABLE) {
init_te_thread(eNB);
......@@ -1120,7 +1200,7 @@ void init_transport(PHY_VARS_eNB *eNB) {
}
for (int i=0;i<NUMBER_OF_ULSCH_MAX; i++) {
LOG_I(PHY,"Allocating Transport Channel Buffers for ULSCH %d/%d\n",i,NUMBER_OF_ULSCH_MAX);
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH %d/%d\n",i,NUMBER_OF_ULSCH_MAX);
eNB->ulsch[i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,fp->N_RB_UL, 0);
if (!eNB->ulsch[i]) {
......
......@@ -96,6 +96,7 @@ pthread_cond_t nfapi_sync_cond;
pthread_mutex_t nfapi_sync_mutex;
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
uint16_t sf_ahead=4;
pthread_cond_t sync_cond;
pthread_mutex_t sync_mutex;
......@@ -105,6 +106,10 @@ int config_sync_var=-1;
uint16_t runtime_phy_rx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
/** FC Cell config */
pthread_cond_t cell_config_done_cond;
pthread_mutex_t cell_config_done_mutex;
int cell_config_done=-1;
int oai_exit = 0;
......@@ -388,6 +393,92 @@ void terminate_task(module_id_t mod_id, task_id_t from, task_id_t to) {
extern void free_transport(PHY_VARS_eNB *);
extern void phy_free_RU(RU_t *);
int stop_L1L2(module_id_t enb_id) {
LOG_W(ENB_APP, "stopping lte-softmodem\n");
if (!RC.ru) {
LOG_UI(ENB_APP, "no RU configured\n");
return -1;
}
/* these tasks need to pick up new configuration */
terminate_task(enb_id, TASK_ENB_APP, TASK_RRC_ENB);
oai_exit = 1;
LOG_I(ENB_APP, "calling kill_RU_proc() for instance %d\n", enb_id);
kill_RU_proc(RC.ru[enb_id]);
LOG_I(ENB_APP, "calling kill_eNB_proc() for instance %d\n", enb_id);
kill_eNB_proc(enb_id);
oai_exit = 0;
for (int cc_id = 0; cc_id < RC.nb_CC[enb_id]; cc_id++) {
free_transport(RC.eNB[enb_id][cc_id]);
phy_free_lte_eNB(RC.eNB[enb_id][cc_id]);
}
phy_free_RU(RC.ru[enb_id]);
free_lte_top();
return 0;
}
/*
* Restart the lte-softmodem after it has been soft-stopped with stop_L1L2()
*/
int restart_L1L2(module_id_t enb_id) {
int cc_id;
MessageDef *msg_p = NULL;
LOG_W(ENB_APP, "restarting lte-softmodem\n");
/* block threads */
pthread_mutex_lock(&sync_mutex);
sync_var = -1;
pthread_mutex_unlock(&sync_mutex);
for (cc_id = 0; cc_id < RC.nb_L1_CC[enb_id]; cc_id++) {
RC.eNB[enb_id][cc_id]->configured = 0;
for (int ru_id=0;ru_id<RC.eNB[enb_id][cc_id]->num_RU;ru_id++) {
int ru_idx = RC.eNB[enb_id][cc_id]->RU_list[ru_id]->idx;
RC.ru_mask |= (1 << ru_idx);
set_function_spec_param(RC.ru[ru_idx]);
}
}
/* reset the list of connected UEs in the MAC, since in this process with
* loose all UEs (have to reconnect) */
init_UE_info(&RC.mac[enb_id]->UE_info);
LOG_I(ENB_APP, "attempting to create ITTI tasks\n");
if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) {
LOG_E(RRC, "Create task for RRC eNB failed\n");
return -1;
} else {
LOG_I(RRC, "Re-created task for RRC eNB successfully\n");
}
/* pass a reconfiguration request which will configure everything down to
* RC.eNB[i][j]->frame_parms, too */
msg_p = itti_alloc_new_message(TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ);
RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration;
itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
/* TODO XForms might need to be restarted, but it is currently (09/02/18)
* broken, so we cannot test it */
wait_eNBs();
for (int cc_id=0;cc_id<RC.nb_L1_CC[enb_id]; cc_id++) {
for (int ru_id=0;ru_id<RC.eNB[enb_id][cc_id]->num_RU;ru_id++) {
int ru_idx = RC.eNB[enb_id][cc_id]->RU_list[ru_id]->idx;
init_RU_proc(RC.ru[ru_idx]);
RC.ru[ru_idx]->rf_map.card = 0;
RC.ru[ru_idx]->rf_map.chain = 0; /* CC_id + chain_offset;*/
}
}
wait_RUs();
init_eNB_afterRU();
printf("Sending sync to all threads\n");
pthread_mutex_lock(&sync_mutex);
sync_var=0;
pthread_cond_broadcast(&sync_cond);
pthread_mutex_unlock(&sync_mutex);
return 0;
}
static void init_pdcp(void) {
if (!NODE_IS_DU(RC.rrc[0]->node_type)) {
pdcp_layer_init();
......@@ -410,6 +501,17 @@ static void init_pdcp(void) {
}
}
static void wait_cell_config(char *thread_name) {
printf( "waiting for [SYS] CELL CONFIG Indication (%s)\n",thread_name);
pthread_mutex_lock( &cell_config_done_mutex );
while ( cell_config_done < 0 )
pthread_cond_wait( &cell_config_done_cond, &cell_config_done_mutex );
pthread_mutex_unlock(&cell_config_done_mutex );
printf( "SYS: got cell config (%s)\n", thread_name);
}
static void wait_nfapi_init(char *thread_name) {
printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name);
pthread_mutex_lock( &nfapi_sync_mutex );
......@@ -423,6 +525,7 @@ static void wait_nfapi_init(char *thread_name) {
int main ( int argc, char **argv )
{
int i;
int CC_id = 0;
int ru_id;
int node_type = ngran_eNB;
......@@ -477,7 +580,22 @@ int main ( int argc, char **argv )
RCconfig_L1();
}
/* We need to read RU configuration before FlexRAN starts so it knows what
* splits to report. Actual RU start comes later. */
if (RC.nb_RU > 0 && NFAPI_MODE != NFAPI_MODE_VNF) {
RC.ru = RCconfig_RU(RC.nb_RU,RC.nb_L1_inst,RC.eNB,&RC.ru_mask,&RC.ru_mutex,&RC.ru_cond);
LOG_I(PHY,
"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",
RC.nb_L1_inst, RC.nb_RU, get_nprocs());
}
if (RC.nb_inst > 0) {
/* Start the agent. If it is turned off in the configuration, it won't start */
for (i = 0; i < RC.nb_inst; i++) {
if(NFAPI_MODE != NFAPI_MODE_PNF)
flexran_agent_start(i);
}
/* initializes PDCP and sets correct RLC Request/PDCP Indication callbacks
* for monolithic/F1 modes */
init_pdcp();
......@@ -487,10 +605,19 @@ int main ( int argc, char **argv )
exit(-1);
}
for (int enb_id = 0; enb_id < RC.nb_inst; enb_id++) {
MessageDef *msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ);
RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration;
itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
/** TODO FC: Wait for Cell config, if SS RRC_CONFIGURATION_REQ will be triggered by TASK_SYS */
if (RC.ss.mode == SS_SOFTMODEM) {
/** wait for signal */
wait_cell_config("TASK_SYS");
} else
{
for (int enb_id = 0; enb_id < RC.nb_inst; enb_id++) {
MessageDef *msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ);
RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration;
itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
}
}
node_type = RC.rrc[0]->node_type;
}
......
......@@ -25,6 +25,7 @@
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
#include "flexran_agent.h"
#include "s1ap_eNB.h"
#include "SIMULATION/ETH_TRANSPORT/proto.h"
#include "executables/softmodem-common.h"
......@@ -47,6 +48,7 @@
{"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{"loop-memory", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \
{"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
}
#define CMDLINE_CALIBUERX_IDX 0
......@@ -115,6 +117,15 @@
/*-----------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters specific to UE threads */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*-----------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_UETHREADSPARAMS_DESC { \
{"threadOneSubframe", NULL, 0, iptr:&(threads.one), defintval:1, TYPE_INT, 0}, \
{"threadTwoSubframe", NULL, 0, iptr:&(threads.two), defintval:1, TYPE_INT, 0}, \
{"threadThreeSubframe", NULL, 0, iptr:&(threads.three), defintval:1, TYPE_INT, 0}, \
{"threadSlot1ProcOne", NULL, 0, iptr:&(threads.slot1_proc_one), defintval:1, TYPE_INT, 0}, \
{"threadSlot1ProcTwo", NULL, 0, iptr:&(threads.slot1_proc_two), defintval:1, TYPE_INT, 0}, \
}
// {"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0},
#define DEFAULT_DLF 2680000000
......@@ -193,6 +204,8 @@ extern void init_ue_devices(PHY_VARS_UE *);
PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, uint8_t abstraction_flag);
void init_eNB_afterRU(void);
extern int stop_L1L2(module_id_t enb_id);
extern int restart_L1L2(module_id_t enb_id);
extern void init_UE_stub_single_thread(int nb_inst, int eMBMS_active, int uecap_xer_in, char *emul_iface);
extern void init_UE_standalone_thread(int ue_idx);
......
This diff is collapsed.
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