do not exit immediately in case of busy thread
5ms by default, easy to change (change the 10 in the loops) if the behavior is worse than before, do git revert [commit ID]
This commit is contained in:
@@ -2577,6 +2577,17 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
|
|||||||
// check if we have to detect PRACH first
|
// check if we have to detect PRACH first
|
||||||
if ((eNB->node_function != NGFI_RRU_IF5) &&
|
if ((eNB->node_function != NGFI_RRU_IF5) &&
|
||||||
(is_prach_subframe(fp,proc->frame_rx,proc->subframe_rx)>0)) { // any other node must call prach procedure
|
(is_prach_subframe(fp,proc->frame_rx,proc->subframe_rx)>0)) { // any other node must call prach procedure
|
||||||
|
/* accept some delay in processing - up to 5ms */
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 10 && proc->instance_cnt_prach == 0; i++) {
|
||||||
|
LOG_W(PHY,"[eNB] Frame %d Subframe %d, eNB PRACH thread busy (IC %d)!!\n", proc->frame_rx,proc->subframe_rx,proc->instance_cnt_prach);
|
||||||
|
usleep(500);
|
||||||
|
}
|
||||||
|
if (proc->instance_cnt_prach == 0) {
|
||||||
|
exit_fun( "PRACH thread busy" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// wake up thread for PRACH RX
|
// wake up thread for PRACH RX
|
||||||
if (pthread_mutex_lock(&proc->mutex_prach) != 0) {
|
if (pthread_mutex_lock(&proc->mutex_prach) != 0) {
|
||||||
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB PRACH thread %d (IC %d)\n", proc->instance_cnt_prach );
|
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB PRACH thread %d (IC %d)\n", proc->instance_cnt_prach );
|
||||||
@@ -2584,25 +2595,19 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cnt_prach = ++proc->instance_cnt_prach;
|
++proc->instance_cnt_prach;
|
||||||
// set timing for prach thread
|
// set timing for prach thread
|
||||||
proc->frame_prach = proc->frame_rx;
|
proc->frame_prach = proc->frame_rx;
|
||||||
proc->subframe_prach = proc->subframe_rx;
|
proc->subframe_prach = proc->subframe_rx;
|
||||||
|
|
||||||
pthread_mutex_unlock( &proc->mutex_prach );
|
// the thread can now be woken up
|
||||||
|
if (pthread_cond_signal(&proc->cond_prach) != 0) {
|
||||||
if (cnt_prach == 0) {
|
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB PRACH thread %d\n", proc->thread_index);
|
||||||
// the thread was presumably waiting where it should and can now be woken up
|
exit_fun( "ERROR pthread_cond_signal" );
|
||||||
if (pthread_cond_signal(&proc->cond_prach) != 0) {
|
|
||||||
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB PRACH thread %d\n", proc->thread_index);
|
|
||||||
exit_fun( "ERROR pthread_cond_signal" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOG_W( PHY,"[eNB] Frame %d Subframe %d, eNB PRACH thread busy (IC %d)!!\n", proc->frame_rx,proc->subframe_rx,cnt_prach);
|
|
||||||
exit_fun( "PRACH thread busy" );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pthread_mutex_unlock( &proc->mutex_prach );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { // grab transport channel information from network interface
|
} else { // grab transport channel information from network interface
|
||||||
|
|||||||
+19
-14
@@ -1242,6 +1242,16 @@ static void* eNB_thread_FH( void* param ) {
|
|||||||
// choose even or odd thread for RXn-TXnp4 processing
|
// choose even or odd thread for RXn-TXnp4 processing
|
||||||
eNB_rxtx_proc_t *proc_rxtx = &proc->proc_rxtx[proc->subframe_rx&1];
|
eNB_rxtx_proc_t *proc_rxtx = &proc->proc_rxtx[proc->subframe_rx&1];
|
||||||
|
|
||||||
|
/* accept some delay in processing - up to 5ms */
|
||||||
|
for (i = 0; i < 10 && proc_rxtx->instance_cnt_rxtx == 0; i++) {
|
||||||
|
LOG_W( PHY,"[eNB] Frame %d, eNB RXn-TXnp4 thread busy!! (cnt_rxtx %i)\n", proc_rxtx->frame_tx, proc_rxtx->instance_cnt_rxtx);
|
||||||
|
usleep(500);
|
||||||
|
}
|
||||||
|
if (proc_rxtx->instance_cnt_rxtx == 0) {
|
||||||
|
exit_fun( "TX thread busy" );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// wake up TX for subframe n+4
|
// wake up TX for subframe n+4
|
||||||
// lock the TX mutex and make sure the thread is ready
|
// lock the TX mutex and make sure the thread is ready
|
||||||
if (pthread_mutex_timedlock(&proc_rxtx->mutex_rxtx,&wait) != 0) {
|
if (pthread_mutex_timedlock(&proc_rxtx->mutex_rxtx,&wait) != 0) {
|
||||||
@@ -1249,7 +1259,8 @@ static void* eNB_thread_FH( void* param ) {
|
|||||||
exit_fun( "error locking mutex_rxtx" );
|
exit_fun( "error locking mutex_rxtx" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int cnt_rxtx = ++proc_rxtx->instance_cnt_rxtx;
|
|
||||||
|
++proc_rxtx->instance_cnt_rxtx;
|
||||||
|
|
||||||
// We have just received and processed the common part of a subframe, say n.
|
// We have just received and processed the common part of a subframe, say n.
|
||||||
// TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired
|
// TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired
|
||||||
@@ -1263,20 +1274,14 @@ static void* eNB_thread_FH( void* param ) {
|
|||||||
proc_rxtx->frame_tx = (proc_rxtx->subframe_rx > 5) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx;
|
proc_rxtx->frame_tx = (proc_rxtx->subframe_rx > 5) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx;
|
||||||
proc_rxtx->subframe_tx = (proc_rxtx->subframe_rx + 4)%10;
|
proc_rxtx->subframe_tx = (proc_rxtx->subframe_rx + 4)%10;
|
||||||
|
|
||||||
pthread_mutex_unlock( &proc_rxtx->mutex_rxtx );
|
// the thread can now be woken up
|
||||||
|
if (pthread_cond_signal(&proc_rxtx->cond_rxtx) != 0) {
|
||||||
if (cnt_rxtx == 0) {
|
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread\n");
|
||||||
// the thread was presumably waiting where it should and can now be woken up
|
exit_fun( "ERROR pthread_cond_signal" );
|
||||||
if (pthread_cond_signal(&proc_rxtx->cond_rxtx) != 0) {
|
|
||||||
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread\n");
|
|
||||||
exit_fun( "ERROR pthread_cond_signal" );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOG_W( PHY,"[eNB] Frame %d, eNB RXn-TXnp4 thread busy!! (cnt_rxtx %i)\n", proc_rxtx->frame_tx, cnt_rxtx );
|
|
||||||
exit_fun( "TX thread busy" );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pthread_mutex_unlock( &proc_rxtx->mutex_rxtx );
|
||||||
|
|
||||||
stop_meas( &softmodem_stats_rxtx_sf );
|
stop_meas( &softmodem_stats_rxtx_sf );
|
||||||
#ifdef DEADLINE_SCHEDULER
|
#ifdef DEADLINE_SCHEDULER
|
||||||
|
|||||||
Reference in New Issue
Block a user