Commit 262f2217 authored by magounak's avatar magounak

Merge branch 'ru_rau_enhancement-external-timing' of...

Merge branch 'ru_rau_enhancement-external-timing' of https://gitlab.eurecom.fr/oai/openairinterface5g into ru_rau_enhancement-external-timing
parents af75d546 8649f178
...@@ -83,6 +83,10 @@ const char* eurecomVariablesNames[] = { ...@@ -83,6 +83,10 @@ const char* eurecomVariablesNames[] = {
"frame_number_if4p5_north_out", "frame_number_if4p5_north_out",
"subframe_number_if4p5_north_asynch_in", "subframe_number_if4p5_north_asynch_in",
"frame_number_if4p5_north_asynch_in", "frame_number_if4p5_north_asynch_in",
"subframe_number_if4p5_south_out",
"frame_number_if4p5_south_out",
"subframe_number_if4p5_south_in",
"frame_number_if4p5_south_in",
"runtime_TX_eNB", "runtime_TX_eNB",
"runtime_RX_eNB", "runtime_RX_eNB",
"frame_number_TX0_UE", "frame_number_TX0_UE",
......
...@@ -59,6 +59,10 @@ typedef enum { ...@@ -59,6 +59,10 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_NORTH_OUT, VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_NORTH_OUT,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN, VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN, VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_SOUTH_OUT,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_SOUTH_OUT,
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_SOUTH_IN,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_SOUTH_IN,
VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB, VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RX_ENB, VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RX_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE, VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE,
......
...@@ -1030,6 +1030,26 @@ ID = VCD_VARIABLE_FRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN ...@@ -1030,6 +1030,26 @@ ID = VCD_VARIABLE_FRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value FORMAT = ulong,value
VCD_NAME = frame_number_if4p5_north_asynch_in VCD_NAME = frame_number_if4p5_north_asynch_in
ID = VCD_VARIABLE_SUBFRAME_NUMBER_IF4P5_SOUTH_OUT
DESC = VCD variable SUBFRAME_NUMBER_IF4P5_SOUTH_OUT
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
VCD_NAME = subframe_number_if4p5_south_out
ID = VCD_VARIABLE_FRAME_NUMBER_IF4P5_SOUTH_OUT
DESC = VCD variable FRAME_NUMBER_IF4P5_SOUTH_OUT
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
VCD_NAME = frame_number_if4p5_south_out
ID = VCD_VARIABLE_SUBFRAME_NUMBER_IF4P5_SOUTH_IN
DESC = VCD variable SUBFRAME_NUMBER_IF4P5_SOUTH_IN
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
VCD_NAME = subframe_number_if4p5_south_in
ID = VCD_VARIABLE_FRAME_NUMBER_IF4P5_SOUTH_IN
DESC = VCD variable FRAME_NUMBER_IF4P5_SOUTH_IN
GROUP = ALL:VCD:ENB:VCD_VARIABLE
FORMAT = ulong,value
VCD_NAME = frame_number_if4p5_south_in
ID = VCD_VARIABLE_RUNTIME_TX_ENB ID = VCD_VARIABLE_RUNTIME_TX_ENB
DESC = VCD variable RUNTIME_TX_ENB DESC = VCD variable RUNTIME_TX_ENB
GROUP = ALL:VCD:ENB:VCD_VARIABLE GROUP = ALL:VCD:ENB:VCD_VARIABLE
......
...@@ -409,7 +409,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint ...@@ -409,7 +409,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
PRACH_BLOCK_SIZE_BYTES); PRACH_BLOCK_SIZE_BYTES);
} }
} }
LOG_D(PHY,"PRACH_IF4p5: CC_id %d : frame %d, subframe %d => %d dB\n",ru->idx,*frame,*subframe, if (frame == 0) LOG_I(PHY,"PRACH_IF4p5: CC_id %d : frame %d, subframe %d => %d dB\n",ru->idx,*frame,*subframe,
dB_fixed(signal_energy((int*)&prach_rxsigF[0][0],839))); dB_fixed(signal_energy((int*)&prach_rxsigF[0][0],839)));
for (idx=0;idx<ru->num_eNB;idx++) ru->wakeup_prach_eNB(ru->eNB_list[idx],ru,*frame,*subframe); for (idx=0;idx<ru->num_eNB;idx++) ru->wakeup_prach_eNB(ru->eNB_list[idx],ru,*frame,*subframe);
......
...@@ -189,7 +189,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe) { ...@@ -189,7 +189,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe) {
int **txdataF = eNB->common_vars.txdataF; int **txdataF = eNB->common_vars.txdataF;
uint8_t *pbch_pdu=&eNB->pbch_pdu[0]; uint8_t *pbch_pdu=&eNB->pbch_pdu[0];
//LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d fdd:%s dir:%s\n",frame,subframe,fp->frame_type == FDD?"FDD":"TDD", subframe_select(fp,subframe) == SF_DL?"DL":"UL?"); LOG_I(PHY,"common_signal_procedures: frame %d, subframe %d fdd:%s dir:%s\n",frame,subframe,fp->frame_type == FDD?"FDD":"TDD", subframe_select(fp,subframe) == SF_DL?"DL":"UL?");
// generate Cell-Specific Reference Signals for both slots // generate Cell-Specific Reference Signals for both slots
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,1);
...@@ -2081,7 +2081,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) ...@@ -2081,7 +2081,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
eNB->first_run_I0_measurements); eNB->first_run_I0_measurements);
int min_I0=1000,max_I0=0; int min_I0=1000,max_I0=0;
if ((frame==0) && (subframe==4)) { if ((frame==0) && (subframe==2)) {
for (int i=0;i<eNB->frame_parms.N_RB_UL;i++) { for (int i=0;i<eNB->frame_parms.N_RB_UL;i++) {
if (i==(eNB->frame_parms.N_RB_UL>>1) - 1) i+=2; if (i==(eNB->frame_parms.N_RB_UL>>1) - 1) i+=2;
......
...@@ -117,6 +117,7 @@ int trx_eth_start(openair0_device *device) { ...@@ -117,6 +117,7 @@ int trx_eth_start(openair0_device *device) {
/* adjust MTU wrt number of samples per packet */ /* adjust MTU wrt number of samples per packet */
//if(ethernet_tune (device,MTU_SIZE,UDP_IF4p5_PRACH_SIZE_BYTES)!=0) return -1; //if(ethernet_tune (device,MTU_SIZE,UDP_IF4p5_PRACH_SIZE_BYTES)!=0) return -1;
......
...@@ -177,7 +177,6 @@ extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset); ...@@ -177,7 +177,6 @@ extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) { static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) {
start_meas(&softmodem_stats_rxtx_sf); start_meas(&softmodem_stats_rxtx_sf);
// ******************************************************************* // *******************************************************************
if (nfapi_mode == 1) { if (nfapi_mode == 1) {
...@@ -238,10 +237,12 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam ...@@ -238,10 +237,12 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 1 );
if(!eNB->single_thread_flag && get_nprocs() >= 8){ if(!eNB->single_thread_flag && get_nprocs() >= 8){
//printf("Entering rxtx, proc1->cond_rxtx, proc1->pipe_ready, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d\n", proc->frame_rx,proc->subframe_rx,proc->frame_tx,proc->subframe_tx);
if(wait_on_condition(&proc[1].mutex_rxtx,&proc[1].cond_rxtx,&proc[1].pipe_ready,"wakeup_tx")<0) { if(wait_on_condition(&proc[1].mutex_rxtx,&proc[1].cond_rxtx,&proc[1].pipe_ready,"wakeup_tx")<0) {
LOG_E(PHY,"Frame %d, subframe %d: TX1 not ready\n",proc[1].frame_rx,proc[1].subframe_rx); LOG_E(PHY,"Frame %d, subframe %d: TX1 not ready\n",proc[1].frame_rx,proc[1].subframe_rx);
return(-1); return(-1);
} }
//printf("Passed rxtx, proc1->cond_rxtx, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d\n", proc->frame_rx,proc->subframe_rx,proc->frame_tx,proc->subframe_tx);
if (release_thread(&proc[1].mutex_rxtx,&proc[1].pipe_ready,"wakeup_tx")<0) return(-1); if (release_thread(&proc[1].mutex_rxtx,&proc[1].pipe_ready,"wakeup_tx")<0) return(-1);
} }
...@@ -319,7 +320,6 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam ...@@ -319,7 +320,6 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
static void* tx_thread(void* param) { static void* tx_thread(void* param) {
PHY_VARS_eNB *eNB = (PHY_VARS_eNB *)param; PHY_VARS_eNB *eNB = (PHY_VARS_eNB *)param;
eNB_proc_t *eNB_proc = &eNB->proc; eNB_proc_t *eNB_proc = &eNB->proc;
eNB_rxtx_proc_t *proc = &eNB_proc->proc_rxtx[1]; eNB_rxtx_proc_t *proc = &eNB_proc->proc_rxtx[1];
...@@ -332,10 +332,10 @@ static void* tx_thread(void* param) { ...@@ -332,10 +332,10 @@ static void* tx_thread(void* param) {
//wait_sync("tx_thread"); //wait_sync("tx_thread");
while (!oai_exit) { while (!oai_exit) {
//printf("Entering tx_thread, proc1->cond_rxtx, proc1->instance_cnt_rxtx, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d\n", proc->frame_rx,proc->subframe_rx,proc->frame_tx,proc->subframe_tx);
if (wait_on_condition(&proc->mutex_rxtx,&proc->cond_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break; if (wait_on_condition(&proc->mutex_rxtx,&proc->cond_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break;
if (oai_exit) break; //printf("Passed tx_thread proc1->cond_rxtx, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d\n", proc->frame_rx,proc->subframe_rx,proc->frame_tx,proc->subframe_tx);
if (oai_exit) break;
// ***************************************** // *****************************************
// TX processing for subframe n+4 // TX processing for subframe n+4
// run PHY TX procedures the one after the other for all CCs to avoid race conditions // run PHY TX procedures the one after the other for all CCs to avoid race conditions
...@@ -356,6 +356,7 @@ static void* tx_thread(void* param) { ...@@ -356,6 +356,7 @@ static void* tx_thread(void* param) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n");
exit_fun( "ERROR pthread_cond_signal" ); exit_fun( "ERROR pthread_cond_signal" );
} }
//printf("Sent tx_thread, proc1->cond_rxtx to tx_thread, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d\n", proc->frame_rx,proc->subframe_rx,proc->frame_tx,proc->subframe_tx);
pthread_mutex_unlock( &proc->mutex_rxtx ); pthread_mutex_unlock( &proc->mutex_rxtx );
wakeup_txfh(proc,eNB); wakeup_txfh(proc,eNB);
} }
...@@ -410,9 +411,9 @@ static void* eNB_thread_rxtx( void* param ) { ...@@ -410,9 +411,9 @@ static void* eNB_thread_rxtx( void* param ) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx)); T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx));
//printf("Entering eNB_thread_rxtx, proc0->cond_rxtx, instance_cnt_rxtx, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d\n", proc->frame_rx,proc->subframe_rx,proc->frame_tx,proc->subframe_tx);
if (wait_on_condition(&proc->mutex_rxtx,&proc->cond_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break; if (wait_on_condition(&proc->mutex_rxtx,&proc->cond_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break;
//printf("Passed eNB_thread_rxtx proc0->cond_rxtx , frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d\n", proc->frame_rx,proc->subframe_rx,proc->frame_tx,proc->subframe_tx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX,sched_getcpu()); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX,sched_getcpu());
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 1 );
...@@ -439,6 +440,7 @@ static void* eNB_thread_rxtx( void* param ) { ...@@ -439,6 +440,7 @@ static void* eNB_thread_rxtx( void* param ) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n");
exit_fun( "ERROR pthread_cond_signal" ); exit_fun( "ERROR pthread_cond_signal" );
} }
//printf("Sent eNB_thread_rxtx proc0-> cond_rxtx to tx_thread, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d\n", proc->frame_rx,proc->subframe_rx,proc->frame_tx,proc->subframe_tx);
pthread_mutex_unlock( &proc->mutex_rxtx ); pthread_mutex_unlock( &proc->mutex_rxtx );
if (nfapi_mode!=2){ if (nfapi_mode!=2){
if(get_nprocs() >= 8) wakeup_tx(eNB,eNB->proc.ru_proc); if(get_nprocs() >= 8) wakeup_tx(eNB,eNB->proc.ru_proc);
...@@ -451,7 +453,7 @@ static void* eNB_thread_rxtx( void* param ) { ...@@ -451,7 +453,7 @@ static void* eNB_thread_rxtx( void* param ) {
} // while !oai_exit } // while !oai_exit
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 ); // VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
LOG_D(PHY, " *** Exiting eNB thread RXn_TXnp4\n"); LOG_D(PHY, " *** Exiting eNB thread RXn_TXnp4\n");
...@@ -488,22 +490,28 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string,RU_t ...@@ -488,22 +490,28 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string,RU_t
} }
int wakeup_txfh(eNB_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) { int wakeup_txfh(eNB_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) {
RU_proc_t *ru_proc; RU_proc_t *ru_proc;
struct timespec wait; struct timespec wait;
wait.tv_sec=0; wait.tv_sec=0;
wait.tv_nsec=5000000L; wait.tv_nsec=5000000L;
LTE_DL_FRAME_PARMS *fp;
for(int ru_id=0; ru_id<eNB->num_RU; ru_id++){ for(int ru_id=0; ru_id<eNB->num_RU; ru_id++){
ru_proc = &eNB->RU_list[ru_id]->proc; 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)) continue;
// skip the RUs that are not synced
if (eNB->RU_list[ru_id]->state == RU_SYNC) { LOG_I(PHY,"wakeup_txfh: eNB %d : Skipping ru %d\n",eNB->Mod_id,ru_id); continue; }
if(ru_proc == NULL) if(ru_proc == NULL)
return(0); return(0);
//printf("Entering wakeup_txfh, ru_proc->cond_eNBs, ru_proc->ru_tx_ready, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d\n", proc->frame_rx,proc->subframe_rx,ru_proc->frame_tx,ru_proc->subframe_tx);
if(wait_on_condition(&ru_proc->mutex_eNBs,&ru_proc->cond_eNBs,&ru_proc->ru_tx_ready,"wakeup_txfh")<0) { if(wait_on_condition(&ru_proc->mutex_eNBs,&ru_proc->cond_eNBs,&ru_proc->ru_tx_ready,"wakeup_txfh")<0) {
LOG_E(PHY,"Frame %d, subframe %d: TX FH not ready\n", ru_proc->frame_tx, ru_proc->subframe_tx); LOG_E(PHY,"Frame %d, subframe %d: TX FH not ready\n", ru_proc->frame_tx, ru_proc->subframe_tx);
return(-1); return(-1);
} }
//printf("Passed wakeup_txfh ru_proc->cond_eNBs, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d\n", ru_proc->frame_rx,ru_proc->subframe_rx,ru_proc->frame_tx,ru_proc->subframe_tx);
if (release_thread(&ru_proc->mutex_eNBs,&ru_proc->ru_tx_ready,"wakeup_txfh")<0) return(-1); if (release_thread(&ru_proc->mutex_eNBs,&ru_proc->ru_tx_ready,"wakeup_txfh")<0) return(-1);
if (ru_proc->instance_cnt_eNBs == 0) { if (ru_proc->instance_cnt_eNBs == 0) {
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); 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); return(-1);
...@@ -518,27 +526,28 @@ int wakeup_txfh(eNB_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) { ...@@ -518,27 +526,28 @@ int wakeup_txfh(eNB_rxtx_proc_t *proc,PHY_VARS_eNB *eNB) {
ru_proc->timestamp_tx = proc->timestamp_tx; ru_proc->timestamp_tx = proc->timestamp_tx;
ru_proc->subframe_tx = proc->subframe_tx; ru_proc->subframe_tx = proc->subframe_tx;
ru_proc->frame_tx = proc->frame_tx; ru_proc->frame_tx = proc->frame_tx;
// the thread can now be woken up // the thread can now be woken up
if (pthread_cond_signal(&ru_proc->cond_eNBs) != 0) { if (pthread_cond_signal(&ru_proc->cond_eNBs) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n");
exit_fun( "ERROR pthread_cond_signal" ); exit_fun( "ERROR pthread_cond_signal" );
return(-1); return(-1);
} }
//printf("Sent wakeup_txfh ru_proc->cond_eNBs to tx_thread\n, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d\n", proc->frame_rx,proc->subframe_rx,ru_proc->frame_tx,ru_proc->subframe_tx);
pthread_mutex_unlock( &ru_proc->mutex_eNBs ); pthread_mutex_unlock( &ru_proc->mutex_eNBs );
} }
return(0); return(0);
} }
int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) { int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) {
eNB_proc_t *proc=&eNB->proc; eNB_proc_t *proc=&eNB->proc;
eNB_rxtx_proc_t *proc_rxtx1=&proc->proc_rxtx[1];//*proc_rxtx=&proc->proc_rxtx[proc->frame_rx&1]; eNB_rxtx_proc_t *proc_rxtx1=&proc->proc_rxtx[1];/**proc_rxtx=&proc->proc_rxtx[proc->frame_rx&1];*/
eNB_rxtx_proc_t *proc_rxtx0=&proc->proc_rxtx[0]; eNB_rxtx_proc_t *proc_rxtx0=&proc->proc_rxtx[0];
/* LTE_DL_FRAME_PARMS *fp;
fp = &eNB->frame_parms;
if ((fp->frame_type == TDD) && (subframe_select(fp,proc_rxtx0->subframe_tx)==SF_UL)) return;
*/
struct timespec wait; struct timespec wait;
wait.tv_sec=0; wait.tv_sec=0;
wait.tv_nsec=5000000L; wait.tv_nsec=5000000L;
...@@ -571,14 +580,13 @@ int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) { ...@@ -571,14 +580,13 @@ int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) {
exit_fun( "ERROR pthread_cond_signal" ); exit_fun( "ERROR pthread_cond_signal" );
return(-1); return(-1);
} }
//printf("Sent wakeup_tx proc1->cond_rxtx to tx_thread, frame_rx %d, subframe_rx %d, frame_tx %d, subframe_tx %d\n", proc_rxtx1->frame_rx,proc_rxtx1->subframe_rx,proc_rxtx1->frame_tx,proc_rxtx1->subframe_tx);
pthread_mutex_unlock( &proc_rxtx1->mutex_rxtx ); pthread_mutex_unlock( &proc_rxtx1->mutex_rxtx );
return(0); return(0);
} }
int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
eNB_proc_t *proc=&eNB->proc; eNB_proc_t *proc=&eNB->proc;
RU_proc_t *ru_proc=&ru->proc; RU_proc_t *ru_proc=&ru->proc;
...@@ -618,11 +626,12 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { ...@@ -618,11 +626,12 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
wait.tv_sec=0; wait.tv_sec=0;
wait.tv_nsec=5000000L; wait.tv_nsec=5000000L;
//printf("Entering wakeup_rxtx, cond_rxtx, proc0->pipe_ready, frame %d, subframe %d\n", proc_rxtx0->frame_rx,proc_rxtx0->subframe_rx,proc_rxtx0->frame_tx,proc_rxtx0->subframe_tx);
if(wait_on_condition(&proc_rxtx0->mutex_rxtx,&proc_rxtx0->cond_rxtx,&proc_rxtx0->pipe_ready,"wakeup_rxtx")<0) { if(wait_on_condition(&proc_rxtx0->mutex_rxtx,&proc_rxtx0->cond_rxtx,&proc_rxtx0->pipe_ready,"wakeup_rxtx")<0) {
LOG_E(PHY,"Frame %d, subframe %d: RXTX0 not ready\n",proc_rxtx0->frame_rx,proc_rxtx0->subframe_rx); LOG_E(PHY,"Frame %d, subframe %d: RXTX0 not ready\n",proc_rxtx0->frame_rx,proc_rxtx0->subframe_rx);
return(-1); return(-1);
} }
//printf("Passed wakeup_rxtx proc0->cond_rxtx, frame %d, subframe %d\n", proc_rxtx0->frame_rx,proc_rxtx0->subframe_rx,proc_rxtx0->frame_tx,proc_rxtx0->subframe_tx);
if (release_thread(&proc_rxtx0->mutex_rxtx,&proc_rxtx0->pipe_ready,"wakeup_rxtx")<0) return(-1); if (release_thread(&proc_rxtx0->mutex_rxtx,&proc_rxtx0->pipe_ready,"wakeup_rxtx")<0) return(-1);
if (proc_rxtx0->instance_cnt_rxtx == 0) { if (proc_rxtx0->instance_cnt_rxtx == 0) {
...@@ -659,7 +668,7 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { ...@@ -659,7 +668,7 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
exit_fun( "ERROR pthread_cond_signal" ); exit_fun( "ERROR pthread_cond_signal" );
return(-1); return(-1);
} }
//printf("Sent wakeup_rxtx proc0->cond_rxtx to eNB_thread_rxtx, frame %d, subframe %d\n", proc_rxtx0->frame_rx,proc_rxtx0->subframe_rx,proc_rxtx0->frame_tx,proc_rxtx0->subframe_tx);
pthread_mutex_unlock( &proc_rxtx0->mutex_rxtx ); pthread_mutex_unlock( &proc_rxtx0->mutex_rxtx );
return(0); return(0);
......
...@@ -154,11 +154,19 @@ static inline void fh_if5_south_out(RU_t *ru) { ...@@ -154,11 +154,19 @@ static inline void fh_if5_south_out(RU_t *ru) {
// southbound IF4p5 fronthaul // southbound IF4p5 fronthaul
static inline void fh_if4p5_south_out(RU_t *ru) { static inline void fh_if4p5_south_out(RU_t *ru) {
if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff ); if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff );
<<<<<<< HEAD
LOG_I(PHY,"Sending IF4p5 for frame %d subframe %d\n",ru->proc.frame_tx,ru->proc.subframe_tx); LOG_I(PHY,"Sending IF4p5 for frame %d subframe %d\n",ru->proc.frame_tx,ru->proc.subframe_tx);
if (subframe_select(&ru->frame_parms,ru->proc.subframe_tx)!=SF_UL) { 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); send_IF4p5(ru,ru->proc.frame_tx, ru->proc.subframe_tx, IF4p5_PDLFFT);
ru->south_out_cnt++; ru->south_out_cnt++;
} }
/*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 );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_RU+ru->idx, ru->proc.subframe_tx );
}*/
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_SOUTH_OUT,ru->proc.frame_tx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_SOUTH_OUT,ru->proc.subframe_tx);
} }
/*************************************************************/ /*************************************************************/
...@@ -224,7 +232,7 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) { ...@@ -224,7 +232,7 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
} else if (packet_type == IF4p5_PRACH) { } else if (packet_type == IF4p5_PRACH) {
// nothing in RU for RAU // nothing in RU for RAU
} }ru->south_out_cnt= 0;
LOG_D(PHY,"rx_fh_if4p5: subframe %d symbol mask %x\n",*subframe,proc->symbol_mask[*subframe]); LOG_D(PHY,"rx_fh_if4p5: subframe %d symbol mask %x\n",*subframe,proc->symbol_mask[*subframe]);
} while(proc->symbol_mask[*subframe] != symbol_mask_full); } while(proc->symbol_mask[*subframe] != symbol_mask_full);
...@@ -238,7 +246,7 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) { ...@@ -238,7 +246,7 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
} }
if (proc->first_rx == 0) { if (proc->first_rx == 0) {
if (proc->subframe_rx != *subframe){ if (proc->subframe_rx != *subframe){
LOG_E(PHY,"Received Timestamp (IF4p5) doesn't correspond to the time we think it is (proc->subframe_rx %d, subframe %d)\n",proc->subframe_rx,*subframe); LOG_E(PHY,"Received Timestamp (IF4p5) doesn't correspond to the time we think it is (proc->subframe_rx %d, subframe %d)\n",proc->subframe_rx,*subframe);
exit_fun("Exiting"); exit_fun("Exiting");
} }
...@@ -256,12 +264,14 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) { ...@@ -256,12 +264,14 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
*subframe = proc->subframe_rx; *subframe = proc->subframe_rx;
} }
if (ru == RC.ru[0] || ru == RC.ru[1]) { /*if (ru == RC.ru[0] || ru == RC.ru[1]) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_RU+ru->idx, f ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_RU+ru->idx, f );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_RU+ru->idx, sf ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_RU+ru->idx, sf );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU+ru->idx, proc->frame_tx );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_RU+ru->idx, proc->subframe_tx ); }*/
}
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_SOUTH_IN,f);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_SOUTH_IN,sf);
proc->symbol_mask[sf] = 0; proc->symbol_mask[sf] = 0;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, proc->timestamp_rx&0xffffffff ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, proc->timestamp_rx&0xffffffff );
...@@ -353,11 +363,13 @@ void fh_if4p5_north_in(RU_t *ru,int *frame,int *subframe) { ...@@ -353,11 +363,13 @@ void fh_if4p5_north_in(RU_t *ru,int *frame,int *subframe) {
symbol_mask = 0; symbol_mask = 0;
symbol_mask_full = (1<<ru->frame_parms.symbols_per_tti)-1; symbol_mask_full = (1<<ru->frame_parms.symbols_per_tti)-1;
LOG_I(PHY,"fh_if4p5_north_in: frame %d, subframe %d\n",*frame,*subframe); LOG_I(PHY,"fh_if4p5_north_in: frame %d, subframe %d\n",*frame,*subframe);
do { do {
recv_IF4p5(ru, frame, subframe, &packet_type, &symbol_number); recv_IF4p5(ru, frame, subframe, &packet_type, &symbol_number);
symbol_mask = symbol_mask | (1<<symbol_number); symbol_mask = symbol_mask | (1<<symbol_number);
} while (symbol_mask != symbol_mask_full); } while (symbol_mask != symbol_mask_full);
// dump VCD output for first RU in list // dump VCD output for first RU in list
if (ru == RC.ru[0]) { if (ru == RC.ru[0]) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, *frame ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, *frame );
...@@ -1473,9 +1485,9 @@ static void* ru_thread_tx( void* param ) { ...@@ -1473,9 +1485,9 @@ static void* ru_thread_tx( void* param ) {
//CPU_SET(5, &cpuset); //CPU_SET(5, &cpuset);
//pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); //pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
//wait_sync("ru_thread_tx"); //wait_sync("ru_thread_tx");
//printf("Entering ru_thread_tx, ru_proc->cond_FH1, ru_proc->instance_cnt_FH1\n");
wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx"); wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx");
//printf("Passed ru_thread_tx ru_proc->cond_FH1\n");
printf( "ru_thread_tx ready\n"); printf( "ru_thread_tx ready\n");
while (!oai_exit) { while (!oai_exit) {
...@@ -1484,11 +1496,13 @@ static void* ru_thread_tx( void* param ) { ...@@ -1484,11 +1496,13 @@ static void* ru_thread_tx( void* param ) {
if (oai_exit) break; if (oai_exit) break;
LOG_D(PHY,"ru_thread_tx: Waiting for TX processing\n"); LOG_I(PHY,"ru_thread_tx (ru %d): Waiting for TX processing\n",ru->idx);
// wait until eNBs are finished subframe RX n and TX n+4 // wait until eNBs are finished subframe RX n and TX n+4
//printf("ru_thread_tx, ru_proc->cond_eNBs, ru_proc->instance_cnt_eNBs\n");
wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx"); wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx");
LOG_D(PHY,"ru_thread_tx: Woken from condition\n"); //printf("Passed ru_thread_tx ru_proc->cond_eNBs\n");
if (oai_exit) break; LOG_I(PHY,"ru_thread_tx (ru %d): Woken from condition\n",ru->idx);
if (oai_exit) break;
// do TX front-end processing if needed (precoding and/or IDFTs) // do TX front-end processing if needed (precoding and/or IDFTs)
if (ru->feptx_prec) ru->feptx_prec(ru); if (ru->feptx_prec) ru->feptx_prec(ru);
...@@ -1505,11 +1519,13 @@ static void* ru_thread_tx( void* param ) { ...@@ -1505,11 +1519,13 @@ static void* ru_thread_tx( void* param ) {
pthread_mutex_lock( &proc->mutex_eNBs ); pthread_mutex_lock( &proc->mutex_eNBs );
proc->ru_tx_ready++; proc->ru_tx_ready++;
//printf("~~~~~~~~~~~~~~~~~~proc->ru_tx_ready = %d\n", proc->ru_tx_ready);
// the thread can now be woken up // the thread can now be woken up
if (pthread_cond_signal(&proc->cond_eNBs) != 0) { if (pthread_cond_signal(&proc->cond_eNBs) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n");
exit_fun( "ERROR pthread_cond_signal" ); exit_fun( "ERROR pthread_cond_signal" );
} }
//printf("Sent ru_thread_tx, ru_proc->cond_eNBs to tx_thread\n");
pthread_mutex_unlock( &proc->mutex_eNBs ); pthread_mutex_unlock( &proc->mutex_eNBs );
} }
release_thread(&proc->mutex_FH1,&proc->instance_cnt_FH1,"ru_thread_tx"); release_thread(&proc->mutex_FH1,&proc->instance_cnt_FH1,"ru_thread_tx");
...@@ -1723,7 +1739,7 @@ static void* ru_thread( void* param ) { ...@@ -1723,7 +1739,7 @@ static void* ru_thread( void* param ) {
} }
else { else {
LOG_D(PHY,"RU thread %d, frame %d, subframe %d \n", LOG_I(PHY,"RU thread %d, frame %d, subframe %d \n",
ru->idx,frame,subframe); ru->idx,frame,subframe);
if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)==1)) { if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)==1)) {
......
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