Merge remote-tracking branch 'origin/feature-slice+restart-w35' into develop_integration_2018_w36

Conflicts:
	openair2/ENB_APP/flexran_agent_common_internal.c
	openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
This commit is contained in:
Cedric Roux
2018-09-07 16:13:40 +02:00
46 changed files with 5510 additions and 2621 deletions
+20 -6
View File
@@ -781,10 +781,10 @@ static void* eNB_thread_prach( void* param ) {
while (!oai_exit) {
if (oai_exit) break;
if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"eNB_prach_thread") < 0) break;
if (oai_exit) break;
LOG_D(PHY,"Running eNB prach procedures\n");
prach_procedures(eNB
@@ -822,10 +822,10 @@ static void* eNB_thread_prach_br( void* param ) {
while (!oai_exit) {
if (oai_exit) break;
if (wait_on_condition(&proc->mutex_prach_br,&proc->cond_prach_br,&proc->instance_cnt_prach_br,"eNB_prach_thread_br") < 0) break;
if (oai_exit) break;
LOG_D(PHY,"Running eNB prach procedures for BL/CE UEs\n");
prach_procedures(eNB,1);
@@ -1029,8 +1029,10 @@ void kill_eNB_proc(int inst) {
proc = &eNB->proc;
proc_rxtx = &proc->proc_rxtx[0];
kill_td_thread(eNB);
kill_te_thread(eNB);
if(get_nprocs() > 2 && codingw) {
kill_td_thread(eNB);
kill_te_thread(eNB);
}
LOG_I(PHY, "Killing TX CC_id %d inst %d\n", CC_id, inst );
for (i=0; i<2; i++) {
pthread_mutex_lock(&proc_rxtx[i].mutex_rxtx);
@@ -1039,8 +1041,10 @@ void kill_eNB_proc(int inst) {
pthread_cond_signal(&proc_rxtx[i].cond_rxtx);
pthread_mutex_unlock(&proc_rxtx[i].mutex_rxtx);
}
pthread_mutex_lock(&proc->mutex_prach);
proc->instance_cnt_prach = 0;
pthread_cond_signal( &proc->cond_prach );
pthread_mutex_unlock(&proc->mutex_prach);
pthread_cond_signal( &proc->cond_asynch_rxtx );
pthread_cond_broadcast(&sync_phy_proc.cond_phy_proc_tx);
@@ -1067,6 +1071,16 @@ void kill_eNB_proc(int inst) {
pthread_mutex_destroy( &proc_rxtx[i].mutex_rxtx );
pthread_cond_destroy( &proc_rxtx[i].cond_rxtx );
}
pthread_attr_destroy(&proc->attr_prach);
pthread_attr_destroy(&proc->attr_asynch_rxtx);
pthread_attr_destroy(&proc_rxtx[0].attr_rxtx);
pthread_attr_destroy(&proc_rxtx[1].attr_rxtx);
#ifdef Rel14
pthread_mutex_destroy(&proc->mutex_RU_PRACH_br);
pthread_attr_destroy(&proc->attr_prach_br);
#endif
}
}
@@ -1104,10 +1118,10 @@ void free_transport(PHY_VARS_eNB *eNB)
int j;
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
LOG_I(PHY, "Freeing Transport Channel Buffers for DLSCH, UE %d\n",i);
LOG_D(PHY, "Freeing Transport Channel Buffers for DLSCH, UE %d\n",i);
for (j=0; j<2; j++) free_eNB_dlsch(eNB->dlsch[i][j]);
LOG_I(PHY, "Freeing Transport Channel Buffer for ULSCH, UE %d\n",i);
LOG_D(PHY, "Freeing Transport Channel Buffer for ULSCH, UE %d\n",i);
free_eNB_ulsch(eNB->ulsch[1+i]);
}
free_eNB_ulsch(eNB->ulsch[0]);
+39 -44
View File
@@ -1080,8 +1080,8 @@ static void* ru_thread_prach( void* param ) {
while (!oai_exit) {
if (oai_exit) break;
if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"ru_prach_thread") < 0) break;
if (oai_exit) break;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 1 );
if (ru->eNB_list[0]){
prach_procedures(
@@ -1130,8 +1130,8 @@ static void* ru_thread_prach_br( void* param ) {
while (!oai_exit) {
if (oai_exit) break;
if (wait_on_condition(&proc->mutex_prach_br,&proc->cond_prach_br,&proc->instance_cnt_prach_br,"ru_prach_thread_br") < 0) break;
if (oai_exit) break;
rx_prach(NULL,
ru,
NULL,
@@ -2230,11 +2230,36 @@ void init_RU_proc(RU_t *ru) {
}
void kill_RU_proc(int inst)
void kill_RU_proc(RU_t *ru)
{
RU_t *ru = RC.ru[inst];
RU_proc_t *proc = &ru->proc;
#if defined(PRE_SCD_THREAD)
pthread_mutex_lock(&proc->mutex_pre_scd);
ru->proc.instance_pre_scd = 0;
pthread_cond_signal(&proc->cond_pre_scd);
pthread_mutex_unlock(&proc->mutex_pre_scd);
pthread_join(proc->pthread_pre_scd, NULL);
pthread_mutex_destroy(&proc->mutex_pre_scd);
pthread_cond_destroy(&proc->cond_pre_scd);
#endif
#ifdef PHY_TX_THREAD
pthread_mutex_lock(&proc->mutex_phy_tx);
proc->instance_cnt_phy_tx = 0;
pthread_cond_signal(&proc->cond_phy_tx);
pthread_mutex_unlock(&proc->mutex_phy_tx);
pthread_join(ru->proc.pthread_phy_tx, NULL);
pthread_mutex_destroy( &proc->mutex_phy_tx);
pthread_cond_destroy( &proc->cond_phy_tx);
pthread_mutex_lock(&proc->mutex_rf_tx);
proc->instance_cnt_rf_tx = 0;
pthread_cond_signal(&proc->cond_rf_tx);
pthread_mutex_unlock(&proc->mutex_rf_tx);
pthread_join(proc->pthread_rf_tx, NULL);
pthread_mutex_destroy( &proc->mutex_rf_tx);
pthread_cond_destroy( &proc->cond_rf_tx);
#endif
if (get_nprocs() > 2 && fepw) {
LOG_D(PHY, "killing FEP thread\n");
kill_fep_thread(ru);
@@ -2271,8 +2296,10 @@ void kill_RU_proc(int inst)
pthread_mutex_lock(&proc->mutex_eNBs);
proc->ru_tx_ready = 0;
proc->instance_cnt_eNBs = 0;
pthread_cond_signal(&proc->cond_eNBs);
proc->instance_cnt_eNBs = 1;
// cond_eNBs is used by both ru_thread and ru_thread_tx, so we need to send
// a broadcast to wake up both threads
pthread_cond_broadcast(&proc->cond_eNBs);
pthread_mutex_unlock(&proc->mutex_eNBs);
pthread_mutex_lock(&proc->mutex_asynch_rxtx);
@@ -2280,10 +2307,12 @@ void kill_RU_proc(int inst)
pthread_cond_signal(&proc->cond_asynch_rxtx);
pthread_mutex_unlock(&proc->mutex_asynch_rxtx);
/*LOG_D(PHY, "Joining pthread_FH\n");
LOG_D(PHY, "Joining pthread_FH\n");
pthread_join(proc->pthread_FH, NULL);
LOG_D(PHY, "Joining pthread_FHTX\n");
pthread_join(proc->pthread_FH1, NULL);*/
if (!single_thread_flag && get_nprocs() > 4) {
LOG_D(PHY, "Joining pthread_FHTX\n");
pthread_join(proc->pthread_FH1, NULL);
}
if (ru->function == NGFI_RRU_IF4p5) {
LOG_D(PHY, "Joining pthread_prach\n");
pthread_join(proc->pthread_prach, NULL);
@@ -2755,45 +2784,11 @@ void init_RU(char *rf_config_file) {
}
void stop_ru(RU_t *ru) {
#if defined(PRE_SCD_THREAD) || defined(PHY_TX_THREAD)
int *status;
#endif
printf("Stopping RU %p processing threads\n",(void*)ru);
#if defined(PRE_SCD_THREAD)
if(ru){
ru->proc.instance_pre_scd = 0;
pthread_cond_signal( &ru->proc.cond_pre_scd );
pthread_join(ru->proc.pthread_pre_scd, (void**)&status );
pthread_mutex_destroy(&ru->proc.mutex_pre_scd );
pthread_cond_destroy(&ru->proc.cond_pre_scd );
}
#endif
#ifdef PHY_TX_THREAD
if(ru){
ru->proc.instance_cnt_phy_tx = 0;
pthread_cond_signal(&ru->proc.cond_phy_tx);
pthread_join( ru->proc.pthread_phy_tx, (void**)&status );
pthread_mutex_destroy( &ru->proc.mutex_phy_tx );
pthread_cond_destroy( &ru->proc.cond_phy_tx );
ru->proc.instance_cnt_rf_tx = 0;
pthread_cond_signal(&ru->proc.cond_rf_tx);
pthread_join( ru->proc.pthread_rf_tx, (void**)&status );
pthread_mutex_destroy( &ru->proc.mutex_rf_tx );
pthread_cond_destroy( &ru->proc.cond_rf_tx );
}
#endif
}
void stop_RU(int nb_ru)
{
for (int inst = 0; inst < nb_ru; inst++) {
LOG_I(PHY, "Stopping RU %d processing threads\n", inst);
kill_RU_proc(inst);
kill_RU_proc(RC.ru[inst]);
}
}
+42 -83
View File
@@ -448,46 +448,22 @@ void *l2l1_task(void *arg) {
itti_set_task_real_time(TASK_L2L1);
itti_mark_task_ready(TASK_L2L1);
/* Wait for the initialize message */
printf("Wait for the ITTI initialize message\n");
do {
if (message_p != NULL) {
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
itti_receive_msg (TASK_L2L1, &message_p);
switch (ITTI_MSG_ID(message_p)) {
case INITIALIZE_MESSAGE:
/* Start eNB thread */
printf("L2L1 TASK received %s\n", ITTI_MSG_NAME(message_p));
start_eNB = 1;
break;
case TERMINATE_MESSAGE:
printf("received terminate message\n");
oai_exit=1;
start_eNB = 0;
itti_exit_task ();
break;
default:
printf("Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
break;
}
} while (ITTI_MSG_ID(message_p) != INITIALIZE_MESSAGE);
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
/* ???? no else but seems to be UE only ???
do {
// Wait for a message
/* Wait for the initialize message */
printf("Wait for the ITTI initialize message\n");
while (1) {
itti_receive_msg (TASK_L2L1, &message_p);
switch (ITTI_MSG_ID(message_p)) {
case INITIALIZE_MESSAGE:
/* Start eNB thread */
LOG_D(PHY, "L2L1 TASK received %s\n", ITTI_MSG_NAME(message_p));
start_eNB = 1;
break;
case TERMINATE_MESSAGE:
LOG_W(PHY, " *** Exiting L2L1 thread\n");
oai_exit=1;
start_eNB = 0;
itti_exit_task ();
break;
@@ -510,8 +486,9 @@ void *l2l1_task(void *arg) {
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
} while(!oai_exit);
*/
message_p = NULL;
};
return NULL;
}
#endif
@@ -772,12 +749,13 @@ void wait_eNBs(void) {
/*
* helper function to terminate a certain ITTI task
*/
void terminate_task(task_id_t task_id, module_id_t mod_id)
void terminate_task(module_id_t mod_id, task_id_t from, task_id_t to)
{
LOG_I(ENB_APP, "sending TERMINATE_MESSAGE to task %s (%d)\n", itti_get_task_name(task_id), task_id);
LOG_I(ENB_APP, "sending TERMINATE_MESSAGE from task %s (%d) to task %s (%d)\n",
itti_get_task_name(from), from, itti_get_task_name(to), to);
MessageDef *msg;
msg = itti_alloc_new_message (ENB_APP, TERMINATE_MESSAGE);
itti_send_msg_to_task (task_id, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg);
msg = itti_alloc_new_message (from, TERMINATE_MESSAGE);
itti_send_msg_to_task (to, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg);
}
extern void free_transport(PHY_VARS_eNB *);
@@ -786,39 +764,20 @@ extern void phy_free_RU(RU_t*);
int stop_L1L2(module_id_t enb_id)
{
LOG_W(ENB_APP, "stopping lte-softmodem\n");
oai_exit = 1;
if (!RC.ru) {
LOG_UI(ENB_APP, "no RU configured\n");
return -1;
}
/* stop trx devices, multiple carrier currently not supported by RU */
if (RC.ru[enb_id]) {
if (RC.ru[enb_id]->rfdevice.trx_stop_func) {
RC.ru[enb_id]->rfdevice.trx_stop_func(&RC.ru[enb_id]->rfdevice);
LOG_I(ENB_APP, "turned off RU rfdevice\n");
} else {
LOG_W(ENB_APP, "can not turn off rfdevice due to missing trx_stop_func callback, proceding anyway!\n");
}
if (RC.ru[enb_id]->ifdevice.trx_stop_func) {
RC.ru[enb_id]->ifdevice.trx_stop_func(&RC.ru[enb_id]->ifdevice);
LOG_I(ENB_APP, "turned off RU ifdevice\n");
} else {
LOG_W(ENB_APP, "can not turn off ifdevice due to missing trx_stop_func callback, proceding anyway!\n");
}
} else {
LOG_W(ENB_APP, "no RU found for index %d\n", enb_id);
return -1;
}
/* these tasks need to pick up new configuration */
terminate_task(TASK_RRC_ENB, enb_id);
terminate_task(TASK_L2L1, enb_id);
terminate_task(enb_id, TASK_ENB_APP, TASK_RRC_ENB);
terminate_task(enb_id, TASK_ENB_APP, TASK_L2L1);
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);
LOG_I(ENB_APP, "calling kill_RU_proc() for instance %d\n", enb_id);
kill_RU_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]);
@@ -841,7 +800,9 @@ int restart_L1L2(module_id_t enb_id)
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;
@@ -852,6 +813,9 @@ int restart_L1L2(module_id_t enb_id)
/* TODO this should be done for all RUs associated to this eNB */
memcpy(&ru->frame_parms, &RC.eNB[enb_id][0]->frame_parms, sizeof(LTE_DL_FRAME_PARMS));
set_function_spec_param(RC.ru[enb_id]);
/* reset the list of connected UEs in the MAC, since in this process with
* loose all UEs (have to reconnect) */
init_UE_list(&RC.mac[enb_id]->UE_list);
LOG_I(ENB_APP, "attempting to create ITTI tasks\n");
if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) {
@@ -1263,25 +1227,20 @@ int main( int argc, char **argv )
printf("stopping MODEM threads\n");
// cleanup
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
stop_ru(RC.ru[ru_id]);
stop_eNB(NB_eNB_INST);
stop_RU(RC.nb_RU);
/* release memory used by the RU/eNB threads (incomplete), after all
* threads have been stopped (they partially use the same memory) */
for (int inst = 0; inst < NB_eNB_INST; inst++) {
for (int cc_id = 0; cc_id < RC.nb_CC[inst]; cc_id++) {
free_transport(RC.eNB[inst][cc_id]);
phy_free_lte_eNB(RC.eNB[inst][cc_id]);
}
}
stop_eNB(NB_eNB_INST);
stop_RU(RC.nb_RU);
/* release memory used by the RU/eNB threads (incomplete), after all
* threads have been stopped (they partially use the same memory) */
for (int inst = 0; inst < NB_eNB_INST; inst++) {
for (int cc_id = 0; cc_id < RC.nb_CC[inst]; cc_id++) {
free_transport(RC.eNB[inst][cc_id]);
phy_free_lte_eNB(RC.eNB[inst][cc_id]);
}
}
for (int inst = 0; inst < RC.nb_RU; inst++) {
phy_free_RU(RC.ru[inst]);
}
free_lte_top();
for (int inst = 0; inst < RC.nb_RU; inst++) {
phy_free_RU(RC.ru[inst]);
}
free_lte_top();
printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
end_configmodule();
+1 -1
View File
@@ -252,7 +252,7 @@ extern void init_RU(const char*);
extern void stop_ru(RU_t *ru);
extern void init_RU_proc(RU_t *ru);
extern void stop_RU(int nb_ru);
extern void kill_RU_proc(int inst);
extern void kill_RU_proc(RU_t *ru);
extern void set_function_spec_param(RU_t *ru);
// In lte-ue.c