Commit 69a12690 authored by Raymond Knoppp's avatar Raymond Knoppp

final changes at slave RRU

parents 2a279bc7 1723c225
......@@ -63,6 +63,8 @@ struct vcd_module_s {
const char* eurecomVariablesNames[] = {
"frame_number_TX0_eNB",
"mask_ru",
"mask_tx_ru",
"frame_number_TX1_eNB",
"frame_number_RX0_eNB",
"frame_number_RX1_eNB",
......@@ -103,6 +105,7 @@ const char* eurecomVariablesNames[] = {
"frame_number_wakeup_rxtx_tx_ru",
"frame_number_wakeup_rxtx_tx_ru1",
"ic_enb",
"ic_enb1",
"l1_proc_ic",
"l1_proc_tx_ic",
"runtime_TX_eNB",
......@@ -247,6 +250,8 @@ const char* eurecomFunctionsNames[] = {
"ue_lock_mutex_rxtx_for_cnt_decrement1",
"ue_lock_mutex_rxtx_for_cnt_increment0",
"ue_lock_mutex_rxtx_for_cnt_increment1",
"lock_mutex_ru",
"lock_mutex_ru1",
/* simulation signals */
"do_DL_sig",
"do_UL_sig",
......
......@@ -40,6 +40,8 @@
/* WARNING: if you edit the enums below, update also string definitions in vcd_signal_dumper.c */
typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB=0,
VCD_SIGNAL_DUMPER_VARIABLES_MASK_RU,
VCD_SIGNAL_DUMPER_VARIABLES_MASK_TX_RU,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_ENB,
......@@ -80,6 +82,7 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_RXTX_TX_RU,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_RXTX_TX_RU1,
VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB1,
VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_IC,
VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_TX_IC,
VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB,
......@@ -225,6 +228,8 @@ typedef enum {
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT1,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT0,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1,
VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU,
VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU1,
/* SIMULATION signals */
VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_DL_SIGNAL,
VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_UL_SIGNAL,
......
......@@ -41,10 +41,10 @@ typedef struct {
} T_cache_t;
/* number of VCD functions (to be kept up to date! see in T_messages.txt) */
#define VCD_NUM_FUNCTIONS (218)
#define VCD_NUM_FUNCTIONS (220)
/* number of VCD variables (to be kept up to date! see in T_messages.txt) */
#define VCD_NUM_VARIABLES (155)
#define VCD_NUM_VARIABLES (158)
/* first VCD function (to be kept up to date! see in T_messages.txt) */
#define VCD_FIRST_FUNCTION ((uintptr_t)T_VCD_FUNCTION_RT_SLEEP)
......
......@@ -950,12 +950,21 @@ ID = buf_test
#to check that everything is correct you can run: make _check_vcd
#variables
ID = VCD_VARIABLE_FRAME_NUMBER_TX0_ENB
DESC = VCD variable FRAME_NUMBER_TX0_ENB
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
VCD_NAME = frame_number_TX0_eNB
ID = VCD_VARIABLE_MASK_RU
DESC = VCD variable MASK_RU
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
VCD_NAME = mask_ru
ID = VCD_VARIABLE_MASK_TX_RU
DESC = VCD variable MASK_TX_RU
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
VCD_NAME = mask_tx_ru
ID = VCD_VARIABLE_FRAME_NUMBER_TX1_ENB
DESC = VCD variable FRAME_NUMBER_TX1_ENB
GROUP = ALL:VCD:ENB:VCD_VARIABLE
......@@ -1156,6 +1165,11 @@ ID = VCD_VARIABLE_IC_ENB
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
VCD_NAME = ic_enb
ID = VCD_VARIABLE_IC_ENB1
DESC = VCD variable IC_ENB1
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
VCD_NAME = ic_enb1
ID = VCD_VARIABLE_L1_PROC_IC
DESC = VCD variable L1_PROC_IC
GROUP = ALL:VCD:ENB:VCD_VARIABLE
......@@ -1859,6 +1873,16 @@ ID = VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
VCD_NAME = ue_lock_mutex_rxtx_for_cnt_increment1
ID = VCD_FUNCTION_LOCK_MUTEX_RU
DESC = VCD function LOCK_MUTEX_RU
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
VCD_NAME = lock_mutex_ru
ID = VCD_FUNCTION_LOCK_MUTEX_RU1
DESC = VCD function LOCK_MUTEX_RU1
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
VCD_NAME = lock_mutex_ru1
ID = VCD_FUNCTION_SIM_DO_DL_SIGNAL
DESC = VCD function SIM_DO_DL_SIGNAL
GROUP = ALL:VCD:ENB:VCD_FUNCTION
......
......@@ -426,9 +426,6 @@ static void* L1_thread( void* param ) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB,proc->frame_tx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_ENB,proc->frame_rx);
if (oai_exit) break;
if (eNB->CC_id==0)
......@@ -497,21 +494,23 @@ int wakeup_txfh(L1_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) {
return(-1);
}
pthread_mutex_lock(&eNB->proc.mutex_RU_tx);
eNB->proc.RU_mask_tx = 0;
//eNB->proc.RU_mask_tx = 0;
pthread_mutex_unlock(&eNB->proc.mutex_RU_tx);
if (release_thread(&proc->mutex_RUs,&proc->instance_cnt_RUs,"wakeup_txfh")<0) return(-1);
for(int ru_id=0; ru_id<eNB->num_RU; ru_id++){
ru_proc = &eNB->RU_list[ru_id]->proc;
fp = &eNB->RU_list[ru_id]->frame_parms;
if ((fp->frame_type == TDD) && (subframe_select(fp,proc->subframe_tx)==SF_UL)){
if ((fp->frame_type == TDD) && (subframe_select(fp,proc->subframe_tx)==SF_UL)||
(eNB->RU_list[ru_id]->state == RU_SYNC)||
(eNB->RU_list[ru_id]->wait_cnt>0)){
pthread_mutex_lock(&proc->mutex_RUs);
proc->instance_cnt_RUs = 0;
pthread_mutex_unlock(&proc->mutex_RUs);
continue;//hacking only works when all RU_tx works on the same subframe #TODO: adding mask stuff
}
// skip the RUs that are not synced
if (eNB->RU_list[ru_id]->state == RU_SYNC) { LOG_D(PHY,"wakeup_txfh: eNB %d : Skipping ru %d\n",eNB->Mod_id,ru_id); continue; }
//if (eNB->RU_list[ru_id]->state == RU_SYNC /*|| eNB->RU_list[ru_id]->wait_cnt>0*/) { LOG_D(PHY,"wakeup_txfh: eNB %d : Skipping ru %d\n",eNB->Mod_id,ru_id); continue; }
//if(ru_proc == NULL) {return(0);}
......@@ -519,19 +518,19 @@ int wakeup_txfh(L1_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) {
LOG_E(PHY,"Frame %d, subframe %d: TX FH thread busy, dropping Frame %d, subframe %d\n", ru_proc->frame_tx, ru_proc->subframe_tx, proc->frame_rx, proc->subframe_rx);
return(-1);
}
if (pthread_mutex_timedlock(&ru_proc->mutex_eNBs,&wait) != 0) {
if (pthread_mutex_lock(&ru_proc->mutex_eNBs) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB TX1 thread %d (IC %d)\n", ru_proc->subframe_rx&1,ru_proc->instance_cnt_eNBs );
exit_fun( "error locking mutex_eNB" );
return(-1);
}
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB,ru_proc->instance_cnt_eNBs);
//VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB,ru_proc->instance_cnt_eNBs);
ru_proc->instance_cnt_eNBs = 0;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB,ru_proc->instance_cnt_eNBs);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB+ru_id,ru_proc->instance_cnt_eNBs);
ru_proc->timestamp_tx = proc->timestamp_tx;
ru_proc->subframe_tx = proc->subframe_tx;
ru_proc->frame_tx = proc->frame_tx;
LOG_D(PHY,"wakeup_txfh: ru_proc->subframe_tx %d\n",ru_proc->subframe_tx);
// printf("wakeup_txfh: RU %d, frame_tx %d, subframe_tx %d\n",ru_id,ru_proc->frame_tx,ru_proc->subframe_tx);
// the thread can now be woken up
if (pthread_cond_signal(&ru_proc->cond_eNBs) != 0) {
......@@ -559,7 +558,7 @@ int wakeup_tx(PHY_VARS_eNB *eNB) {
wait.tv_sec=0;
wait.tv_nsec=5000000L;
if (pthread_mutex_timedlock(&L1_proc_tx->mutex,&wait) != 0) {
if (pthread_mutex_lock(&L1_proc_tx->mutex) != 0) {
LOG_E(PHY, "[SCHED][eNB] ERROR locking mutex for eNB L1_thread_tx\n");
exit_fun("ERROR pthread_lock");
return(-1);
......@@ -609,7 +608,7 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
// wake up TX for subframe n+sf_ahead
// lock the TX mutex and make sure the thread is ready
if (pthread_mutex_timedlock(&L1_proc->mutex,&wait) != 0) {
if (pthread_mutex_lock(&L1_proc->mutex) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", L1_proc->subframe_rx&1,L1_proc->instance_cnt );
exit_fun( "error locking mutex_rxtx" );
return(-1);
......@@ -630,7 +629,12 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
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\n",L1_proc->subframe_rx,L1_proc->subframe_tx);
//printf("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);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_RXTX_TX_RU+ru->idx, L1_proc->frame_tx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_RXTX_TX_RU+ru->idx, L1_proc->subframe_tx);
// the thread can now be woken up
if (pthread_cond_signal(&L1_proc->cond) != 0) {
......@@ -640,12 +644,12 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
}
pthread_mutex_unlock( &L1_proc->mutex);
/*
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);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_RXTX_TX_RU+ru->idx, L1_proc->frame_tx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_RXTX_TX_RU+ru->idx, L1_proc->subframe_tx);
*/
return(0);
}
......
......@@ -158,7 +158,7 @@ static inline void fh_if4p5_south_out(RU_t *ru) {
if (subframe_select(&ru->frame_parms,ru->proc.subframe_tx)!=SF_UL) {
send_IF4p5(ru,ru->proc.frame_tx, ru->proc.subframe_tx, IF4p5_PDLFFT);
ru->south_out_cnt++;
LOG_D(PHY,"south_out_cnt %d\n",ru->south_out_cnt);
//printf("south_out_cnt %d, frame %d, subframe %d, RU %d\n",ru->south_out_cnt,ru->proc.frame_tx,ru->proc.subframe_tx,ru->idx);
}
/*if (ru == RC.ru[0] || ru == RC.ru[1]) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU+ru->idx, ru->proc.frame_tx );
......@@ -1166,12 +1166,21 @@ void wakeup_L1s(RU_t *ru) {
char string[20];
sprintf(string,"Incoming RU %d",ru->idx);
AssertFatal(0==pthread_mutex_lock(&proc->mutex_RU),"");
LOG_D(PHY,"wakeup_L1s: Frame %d, Subframe %d: RU %d done (wait_cnt %d),RU_mask[%d] %x\n",
ru->proc.frame_rx,ru->proc.subframe_rx,ru->idx,ru->wait_cnt,ru->proc.subframe_rx,proc->RU_mask[ru->proc.subframe_rx]);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.frame_rx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.subframe_rx);
// AssertFatal(0==pthread_mutex_lock(&proc->mutex_RU),"RE MALAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1");
if (pthread_mutex_lock(&proc->mutex_RU) !=0) {
LOG_E( PHY, "RE MALAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1");
exit_fun( "RE MALAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1" );
return(-1);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU+ru->idx, 1 );
//printf("wakeup_L1s: Frame %d, Subframe %d: RU %d done (wait_cnt %d),RU_mask[%d] %x\n",
// ru->proc.frame_rx,ru->proc.subframe_rx,ru->idx,ru->wait_cnt,ru->proc.subframe_rx,proc->RU_mask[ru->proc.subframe_rx]);
// VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.frame_rx);
// VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.subframe_rx);
clock_gettime(CLOCK_MONOTONIC,&ru->proc.t[ru->proc.subframe_rx]);
if (proc->RU_mask[ru->proc.subframe_rx] == 0){
......@@ -1181,15 +1190,19 @@ void wakeup_L1s(RU_t *ru) {
LOG_D(PHY,"RU %d starting timer for frame %d subframe %d\n",ru->idx, ru->proc.frame_rx,ru->proc.subframe_rx);
}
for (i=0;i<eNB->num_RU;i++) {
if (eNB->RU_list[i]->wait_cnt==1 && ru->proc.subframe_rx!=9) eNB->RU_list[i]->wait_cnt=0;
LOG_D(PHY,"RU %d has frame %d and subframe %d, state %s\n",eNB->RU_list[i]->idx,eNB->RU_list[i]->proc.frame_rx, eNB->RU_list[i]->proc.subframe_rx, ru_states[eNB->RU_list[i]->state]);
if (ru == eNB->RU_list[i]) {
if (ru == eNB->RU_list[i] && eNB->RU_list[i]->wait_cnt == 0 /*|| eNB->RU_list[i]->is_slave==0*/) {
// AssertFatal((proc->RU_mask&(1<<i)) == 0, "eNB %d frame %d, subframe %d : previous information from RU %d (num_RU %d,mask %x) has not been served yet!\n",eNB->Mod_id,ru->proc.frame_rx,ru->proc.subframe_rx,ru->idx,eNB->num_RU,proc->RU_mask);
proc->RU_mask[ru->proc.subframe_rx] |= (1<<i);
//printf("oooooooooooooooooooo\n");
}else if (eNB->RU_list[i]->state == RU_SYNC ||
(eNB->RU_list[i]->is_slave==1 && eNB->RU_list[i]->wait_cnt>0)){
(eNB->RU_list[i]->is_slave==1 && eNB->RU_list[i]->wait_cnt>0 && ru!=eNB->RU_list[i])){
proc->RU_mask[ru->proc.subframe_rx] |= (1<<i);
//printf("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\n");
}
//printf("RU %d, RU_mask %d, i %d\n",ru->idx,proc->RU_mask[ru->proc.subframe_rx],i);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_MASK_RU, proc->RU_mask[ru->proc.subframe_rx]);
if (ru->is_slave == 0 && ( (proc->RU_mask[ru->proc.subframe_rx]&(1<<i)) == 1) && eNB->RU_list[i]->state == RU_RUN) { // This is master & the RRU has already been received
if (check_sync(eNB->RU_list[i],eNB->RU_list[0],ru->proc.subframe_rx) == 0)
LOG_E(PHY,"RU %d is not SYNC, subframe %d, time %f this is master\n", eNB->RU_list[i]->idx, ru->proc.subframe_rx, fabs(eNB->RU_list[i]->proc.t[ru->proc.subframe_rx].tv_nsec - eNB->RU_list[0]->proc.t[ru->proc.subframe_rx].tv_nsec));
......@@ -1208,6 +1221,7 @@ void wakeup_L1s(RU_t *ru) {
LOG_D(PHY, "ru->proc.subframe_rx is %d \n", ru->proc.subframe_rx);
LOG_D(PHY,"Reseting mask frame %d, subframe %d, this is RU %d\n",ru->proc.frame_rx, ru->proc.subframe_rx, ru->idx);
proc->RU_mask[ru->proc.subframe_rx] = 0;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_MASK_RU, proc->RU_mask[ru->proc.subframe_rx]);
clock_gettime(CLOCK_MONOTONIC,&t);
//stop_meas(&proc->ru_arrival_time);
AssertFatal(t.tv_nsec < proc->t[ru->proc.subframe_rx].tv_nsec+5000000,
......@@ -1216,7 +1230,13 @@ void wakeup_L1s(RU_t *ru) {
// VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.frame_rx);
//VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.subframe_rx);
AssertFatal(0==pthread_mutex_unlock(&proc->mutex_RU),"");
// AssertFatal(0==pthread_mutex_unlock(&proc->mutex_RU),"RE MALAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2");
if (pthread_mutex_unlock(&proc->mutex_RU) !=0) {
LOG_E( PHY, "RE MALAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2");
exit_fun( "RE MALAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2" );
return(-1);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU+ru->idx, 0 );
// unlock RUs that are waiting for eNB processing to be completed
LOG_D(PHY,"RU %d wakeup eNB top for subframe %d\n", ru->idx,ru->proc.subframe_rx);
......@@ -1242,7 +1262,13 @@ void wakeup_L1s(RU_t *ru) {
}
else{ // not all RUs have provided their information
AssertFatal(0==pthread_mutex_unlock(&proc->mutex_RU),"");
// AssertFatal(0==pthread_mutex_unlock(&proc->mutex_RU),"RE MALAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3");
if (pthread_mutex_unlock(&proc->mutex_RU) !=0) {
LOG_E( PHY, "RE MALAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3");
exit_fun( "RE MALAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3" );
return(-1);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU+ru->idx, 0 );
}
// pthread_mutex_unlock(&proc->mutex_RU);
// LOG_D(PHY,"wakeup eNB top for for subframe %d\n", ru->proc.subframe_rx);
......@@ -1518,7 +1544,6 @@ static void* ru_thread_tx( void* param ) {
//pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
//wait_sync("ru_thread_tx");
wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx");
//printf( "ru_thread_tx ready\n");
while (!oai_exit) {
......@@ -1544,9 +1569,10 @@ static void* ru_thread_tx( void* param ) {
if (ru->fh_north_out) ru->fh_north_out(ru);
}
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB,proc->instance_cnt_eNBs);
//VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB,proc->instance_cnt_eNBs);
release_thread(&proc->mutex_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx");
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB,proc->instance_cnt_eNBs);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_IC_ENB+ru->idx,proc->instance_cnt_eNBs);
for(int i = 0; i<ru->num_eNB; i++)
{
......@@ -1556,28 +1582,35 @@ static void* ru_thread_tx( void* param ) {
char *L1_proc_name = (get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT)? "L1_proc_tx" : "L1_proc";
pthread_mutex_lock(&eNB_proc->mutex_RU_tx);
for (int j=0;j<eNB->num_RU;j++) {
if (ru == eNB->RU_list[j]) {
//printf("RU_id %d, RU_mask_tx %d, RU %x, eNB->RU_list[%d] %x\n",ru->idx,eNB_proc->RU_mask_tx,ru,j,eNB->RU_list[j]);
if (ru == eNB->RU_list[j] && eNB->RU_list[j]->wait_cnt == 0) {
if ((eNB_proc->RU_mask_tx&(1<<j)) > 0)
LOG_E(PHY,"eNB %d frame %d, subframe %d : previous information from RU tx %d (num_RU %d,mask %x) has not been served yet!\n",
eNB->Mod_id,eNB_proc->frame_rx,eNB_proc->subframe_rx,ru->idx,eNB->num_RU,eNB_proc->RU_mask_tx);
eNB_proc->RU_mask_tx |= (1<<j);
//printf("aaaaaaaaaaaaaaaaaaaaaa1111111111111\n");
}
else if (eNB->RU_list[j]->state == RU_SYNC){
else if (eNB->RU_list[j]->state==RU_SYNC || (eNB->RU_list[j]->is_slave==1 && eNB->RU_list[j]->wait_cnt>0 && ru != eNB->RU_list[j])){
//else if (ru->state==RU_SYNC || (eNB->RU_list[j]->is_slave==1 && ru->state==RU_RUN && eNB->RU_list[j]->wait_cnt==0)){
eNB_proc->RU_mask_tx |= (1<<j);
//printf("aaaaaaaaaaaaaaaaaaaaa22222222222\n");
}
//printf("RU_id %d, RU_mask_tx %d, subframe_tx %d\n",ru->idx,eNB_proc->RU_mask_tx,L1_proc->subframe_tx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_MASK_TX_RU, eNB_proc->RU_mask_tx);
}
if (eNB_proc->RU_mask_tx != (1<<eNB->num_RU)-1) { // not all RUs have provided their information so return
LOG_I(PHY,"Not all RUs have provided their info (mask = %d)\n", eNB_proc->RU_mask_tx);
//printf("Not all RUs have provided their info (mask = %d), RU %d, num_RUs %d\n", eNB_proc->RU_mask_tx,ru->idx,eNB->num_RU);
pthread_mutex_unlock(&eNB_proc->mutex_RU_tx);
}
else { // all RUs TX are finished so send the ready signal to eNB processing
LOG_I(PHY,"All RUs TX are finished. Ready to send wakeup signal to eNB processing\n");
//printf("All RUs TX are finished. Ready to send wakeup signal to eNB processing, num_RUs %d, RU %d, mask %d\n", eNB->num_RU,ru->idx,eNB_proc->RU_mask_tx);
eNB_proc->RU_mask_tx = 0;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_MASK_TX_RU, eNB_proc->RU_mask_tx);
pthread_mutex_unlock(&eNB_proc->mutex_RU_tx);
pthread_mutex_lock( &L1_proc->mutex_RUs);
L1_proc->instance_cnt_RUs = 0;
LOG_I(PHY,"ru_thread_tx send signal to L1_thread_tx with (mask = %d)\n", eNB_proc->RU_mask_tx);
LOG_D(PHY,"ru_thread_tx send signal to L1_thread_tx with (mask = %d)\n", eNB_proc->RU_mask_tx);
// the thread can now be woken up
if (pthread_cond_signal(&L1_proc->cond_RUs) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n");
......@@ -1586,6 +1619,8 @@ static void* ru_thread_tx( void* param ) {
pthread_mutex_unlock( &L1_proc->mutex_RUs );
}
}
//printf("ru_thread_tx: Frame %d, Subframe %d: RU %d done (wait_cnt %d),RU_mask_tx %d\n",
// eNB_proc->frame_rx,eNB_proc->subframe_rx,ru->idx,ru->wait_cnt,eNB_proc->RU_mask_tx);
}
release_thread(&proc->mutex_FH1,&proc->instance_cnt_FH1,"ru_thread_tx");
return 0;
......@@ -1793,7 +1828,7 @@ if(!emulate_rf){
AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1),"Failed to send msg to RAU\n");
resynch_done=1;
}
wakeup_L1s(ru);
/*if (ru->wait_cnt==0)*/ wakeup_L1s(ru);
}
else {
......
......@@ -705,7 +705,7 @@ void* ru_thread_control( void* param ) {
if (ru->if_south == LOCAL_RF) LOG_E(PHY,"Received RRU_config_ok msg...Ignoring\n");
else{
if (ru->is_slave == 1){
printf(PHY,"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Received RRU_sync_ok from RRU %d\n",ru->idx);
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Received RRU_sync_ok from RRU %d\n",ru->idx);
// Just change the state of the RRU to unblock ru_thread()
ru->state = RU_RUN;
}else LOG_E(PHY,"Received RRU_sync_ok from a master RRU...Ignoring\n");
......
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