Commit 9b66fe83 authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge branch 'RU-RAU-split-parallel-EMUFH' into gNB_mwc18_integration

Conflicts:
	openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
	openair1/SCHED/ru_procedures.c
	targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
	targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf
	targets/RT/USER/lte-ru.c
	targets/RT/USER/lte-softmodem.c
parents 3e3dfdb7 f0e10b0d
......@@ -59,6 +59,8 @@
uint64_t deadline,
uint64_t period);*/
extern int codingw;
void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch)
{
int i;
......@@ -607,16 +609,28 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
}
stop_meas(te_main_stats);
// wait for worker to finish
start_meas(te_wait_stats);
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
wait_on_busy_condition(&proc->tep[1].mutex_te,&proc->tep[1].cond_te,&proc->tep[1].instance_cnt_te,"te thread 1");
wait_on_busy_condition(&proc->tep[2].mutex_te,&proc->tep[2].cond_te,&proc->tep[2].instance_cnt_te,"te thread 2");
if(worker_num == 1)
{
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
}
else if(worker_num == 2)
{
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
wait_on_busy_condition(&proc->tep[1].mutex_te,&proc->tep[1].cond_te,&proc->tep[1].instance_cnt_te,"te thread 1");
}
else
{
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
wait_on_busy_condition(&proc->tep[1].mutex_te,&proc->tep[1].cond_te,&proc->tep[1].instance_cnt_te,"te thread 1");
wait_on_busy_condition(&proc->tep[2].mutex_te,&proc->tep[2].cond_te,&proc->tep[2].instance_cnt_te,"te thread 2");
}
stop_meas(te_wait_stats);
if(opp_enabled == 1 && te_wait_stats->diff_now>100*3000){
/*if(opp_enabled == 1 && te_wait_stats->diff_now>100*3000){
print_meas_now(te_wait_stats,"coding_wait",stderr);
printf("delay in wait on codition in frame_rx: %d \n",proc->frame_rx);
}
printf("coding delay in wait on codition in frame_rx: %d \n",proc->frame_rx);
}*/
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
......@@ -655,7 +669,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
}
}
if(0/*C >= 8&&get_nprocs()>=6*/)//one main three worker
if(0/*C >= 8 && get_nprocs()>8 && codingw*/)//one main three worker
{
encoding_return =
dlsch_encoding_2threads(eNB,
......@@ -673,7 +687,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
i_stats,
3);
}
else if(C >= 6&&get_nprocs()>=4)//one main two worker
else if(C >= 6 && get_nprocs()>=6 && codingw)//one main two worker
{
encoding_return =
dlsch_encoding_2threads(eNB,
......@@ -691,7 +705,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
i_stats,
2);
}
else if(C >= 4&&get_nprocs()>=2)//one main one worker
else if(C >= 4 && get_nprocs()>=4 && codingw)//one main one worker
{
encoding_return =
dlsch_encoding_2threads(eNB,
......
......@@ -52,6 +52,8 @@
#include "UTIL/LOG/vcd_signal_dumper.h"
//#define DEBUG_ULSCH_DECODING
extern int codingw;
void free_eNB_ulsch(LTE_eNB_ULSCH_t *ulsch)
{
......@@ -817,7 +819,7 @@ int ulsch_decoding_data_all(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_fl
int ret = 0;
LTE_eNB_ULSCH_t *ulsch = eNB->ulsch[UE_id];
LTE_UL_eNB_HARQ_t *ulsch_harq = ulsch->harq_processes[harq_pid];
if(ulsch_harq->C>3)
if(ulsch_harq->C>3 && get_nprocs()>=2 && codingw)
{
ret = ulsch_decoding_data_2thread(eNB,UE_id,harq_pid,llr8_flag);
}
......
......@@ -222,10 +222,10 @@ void feptx_ofdm_2thread(RU_t *ru) {
start_meas(&ru->ofdm_mod_wait_stats);
wait_on_busy_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"feptx thread");
stop_meas(&ru->ofdm_mod_wait_stats);
if(opp_enabled == 1 && ru->ofdm_mod_wait_stats.diff_now>30*3000){
//print_meas_now(&ru->ofdm_mod_wait_stats,"fep wakeup",stderr);
LOG_W(PHY,"delay in feptx wait on codition in frame_rx: %d subframe_rx: %d \n",proc->frame_tx,proc->subframe_tx);
}
/*if(opp_enabled == 1 && ru->ofdm_mod_wait_stats.diff_now>30*3000){
print_meas_now(&ru->ofdm_mod_wait_stats,"fep wakeup",stderr);
printf("delay in feptx wait on codition in frame_rx: %d subframe_rx: %d \n",proc->frame_tx,proc->subframe_tx);
}*/
stop_meas(&ru->ofdm_mod_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 );
......
......@@ -71,7 +71,7 @@ schedule_ue_spec_phy_test(
uint16_t rnti = 0x1235;
uint32_t rb_alloc = 0x1FFFFFFF;
int32_t tpc = 1;
int32_t mcs = 0;
int32_t mcs = 28;
int32_t cqi = 15;
int32_t ndi = subframeP/5;
int32_t dai = 0;
......
......@@ -150,10 +150,17 @@ eNBs =
NETWORK_INTERFACES :
{
<<<<<<< HEAD
ENB_INTERFACE_NAME_FOR_S1_MME = "em1";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.155/24";
ENB_INTERFACE_NAME_FOR_S1U = "em1";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.155/24";
=======
ENB_INTERFACE_NAME_FOR_S1_MME = "eth6";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth6";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
>>>>>>> RU-RAU-split-parallel-EMUFH
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
}
......
......@@ -150,6 +150,7 @@ void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe);
#ifdef Rel14
void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe);
#endif
extern int codingw;
static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) {
......@@ -182,14 +183,25 @@ 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 , 0 );
wakeup_tx(eNB,eNB->proc.ru_proc);
//if(oai_exit) return(-1);
//phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1);
//
//pthread_mutex_lock(&eNB->proc.ru_proc->mutex_eNBs);
//++eNB->proc.ru_proc->instance_cnt_eNBs;
//pthread_cond_signal(&eNB->proc.ru_proc->cond_eNBs);
//pthread_mutex_unlock(&eNB->proc.ru_proc->mutex_eNBs);
if(get_nprocs() > 8)
{
wakeup_tx(eNB,eNB->proc.ru_proc);
}
else if(get_nprocs() > 4)
{
if(oai_exit) return(-1);
phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1);
pthread_mutex_lock(&eNB->proc.ru_proc->mutex_eNBs);
++eNB->proc.ru_proc->instance_cnt_eNBs;
pthread_cond_signal(&eNB->proc.ru_proc->cond_eNBs);
pthread_mutex_unlock(&eNB->proc.ru_proc->mutex_eNBs);
}
else
{
if(oai_exit) return(-1);
phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1);
}
stop_meas( &softmodem_stats_rxtx_sf );
......@@ -229,6 +241,9 @@ static void* tx_thread(void* param) {
pthread_mutex_lock(&eNB_proc->ru_proc->mutex_eNBs);
++eNB_proc->ru_proc->instance_cnt_eNBs;
eNB_proc->ru_proc->timestamp_tx = proc->timestamp_tx;
eNB_proc->ru_proc->subframe_tx = proc->subframe_tx;
eNB_proc->ru_proc->frame_tx = proc->frame_tx;
pthread_cond_signal(&eNB_proc->ru_proc->cond_eNBs);
pthread_mutex_unlock(&eNB_proc->ru_proc->mutex_eNBs);
}
......@@ -350,10 +365,6 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string,RU_t
if (rxtx(eNB,proc_rxtx,string) < 0) LOG_E(PHY,"eNB %d CC_id %d failed during execution\n",eNB->Mod_id,eNB->CC_id);
LOG_D(PHY,"eNB_top out %p (proc %p, CC_id %d), frame %d, subframe %d, instance_cnt_prach %d\n",
(void*)pthread_self(), proc, eNB->CC_id, proc->frame_rx,proc->subframe_rx,proc->instance_cnt_prach);
pthread_mutex_lock(&ru_proc->mutex_eNBs);
++ru_proc->instance_cnt_eNBs;
pthread_mutex_unlock(&ru_proc->mutex_eNBs);
pthread_cond_signal(&ru_proc->cond_eNBs);
}
}
......@@ -361,7 +372,8 @@ int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) {
eNB_proc_t *proc=&eNB->proc;
eNB_rxtx_proc_t *proc_rxtx=&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];
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
......@@ -369,34 +381,34 @@ int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) {
wait.tv_sec=0;
wait.tv_nsec=5000000L;
if (proc_rxtx->instance_cnt_rxtx == 0) {
LOG_E(PHY,"Frame %d, subframe %d: TX1 thread busy, dropping\n",proc_rxtx->frame_rx,proc_rxtx->subframe_rx);
if (proc_rxtx1->instance_cnt_rxtx == 0) {
LOG_E(PHY,"Frame %d, subframe %d: TX1 thread busy, dropping\n",proc_rxtx1->frame_rx,proc_rxtx1->subframe_rx);
return(-1);
}
if (pthread_mutex_timedlock(&proc_rxtx->mutex_rxtx,&wait) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB TX1 thread %d (IC %d)\n", proc_rxtx->subframe_rx&1,proc_rxtx->instance_cnt_rxtx );
if (pthread_mutex_timedlock(&proc_rxtx1->mutex_rxtx,&wait) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB TX1 thread %d (IC %d)\n", proc_rxtx1->subframe_rx&1,proc_rxtx1->instance_cnt_rxtx );
exit_fun( "error locking mutex_tx" );
return(-1);
}
++proc_rxtx->instance_cnt_rxtx;
++proc_rxtx1->instance_cnt_rxtx;
proc_rxtx->subframe_rx = ru_proc->subframe_rx;
proc_rxtx->frame_rx = ru_proc->frame_rx;
proc_rxtx->subframe_tx = (ru_proc->subframe_rx+4)%10;
proc_rxtx->frame_tx = (ru_proc->subframe_rx>5) ? (1+ru_proc->frame_rx)&1023 : ru_proc->frame_rx;
proc_rxtx->timestamp_tx = ru_proc->timestamp_tx;
proc_rxtx1->subframe_rx = proc_rxtx0->subframe_rx;
proc_rxtx1->frame_rx = proc_rxtx0->frame_rx;
proc_rxtx1->subframe_tx = proc_rxtx0->subframe_tx;
proc_rxtx1->frame_tx = proc_rxtx0->frame_tx;
proc_rxtx1->timestamp_tx = proc_rxtx0->timestamp_tx;
// the thread can now be woken up
if (pthread_cond_signal(&proc_rxtx->cond_rxtx) != 0) {
if (pthread_cond_signal(&proc_rxtx1->cond_rxtx) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n");
exit_fun( "ERROR pthread_cond_signal" );
return(-1);
}
pthread_mutex_unlock( &proc_rxtx->mutex_rxtx );
pthread_mutex_unlock( &proc_rxtx1->mutex_rxtx );
return(0);
}
......@@ -478,7 +490,7 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
proc_rxtx->frame_tx = (ru_proc->subframe_rx>5) ? (1+ru_proc->frame_rx)&1023 : ru_proc->frame_rx;
proc->frame_tx = proc_rxtx->frame_tx;
proc->frame_rx = proc_rxtx->frame_rx;
proc_rxtx->timestamp_tx = ru_proc->timestamp_tx;
proc_rxtx->timestamp_tx = ru_proc->timestamp_rx+(4*fp->samples_per_tti);
// the thread can now be woken up
if (pthread_cond_signal(&proc_rxtx->cond_rxtx) != 0) {
......@@ -824,9 +836,13 @@ void init_eNB_proc(int inst) {
//////////////////////////////////////need to modified////////////////*****
init_te_thread(eNB);
init_td_thread(eNB,attr_td);
if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void*)eNB);
//printf("//////////////////////////////////////////////////////////////////**************************************************************** codingw = %d\n",codingw);
if(get_nprocs() > 2 && codingw)
{
init_te_thread(eNB);
init_td_thread(eNB,attr_td);
}
if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void*)eNB);
}
......
......@@ -113,8 +113,7 @@ unsigned short config_frames[4] = {2,9,11,13};
extern volatile int oai_exit;
extern int numerology;
extern int fh_two_thread;
extern char threequarter_fs;
extern int fepw;
extern void phy_init_RU(RU_t*);
......@@ -682,6 +681,7 @@ void fh_if4p5_north_out(RU_t *ru) {
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 0 );
}
#ifdef EMULATE_RF
static void* emulatedRF_thread(void* param) {
RU_proc_t *proc = (RU_proc_t *) param;
int microsec = 500; // length of time to sleep, in miliseconds
......@@ -709,6 +709,7 @@ static void* emulatedRF_thread(void* param) {
}
return 0;
}
#endif
void rx_rf(RU_t *ru,int *frame,int *subframe) {
......@@ -717,7 +718,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
void *rxp[ru->nb_rx];
unsigned int rxs;
int i;
openair0_timestamp ts,old_ts;
openair0_timestamp ts=0,old_ts=0;
for (i=0; i<ru->nb_rx; i++)
rxp[i] = (void*)&ru->common.rxdata[i][*subframe*fp->samples_per_tti];
......@@ -760,9 +761,9 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_tti)%10;
// synchronize first reception to frame 0 subframe 0
proc->timestamp_tx = proc->timestamp_rx+(4*fp->samples_per_tti);
proc->subframe_tx = (proc->subframe_rx+4)%10;
proc->frame_tx = (proc->subframe_rx>5) ? (proc->frame_rx+1)&1023 : proc->frame_rx;
//proc->timestamp_tx = proc->timestamp_rx+(4*fp->samples_per_tti);
//proc->subframe_tx = (proc->subframe_rx+4)%10;
//proc->frame_tx = (proc->subframe_rx>5) ? (proc->frame_rx+1)&1023 : proc->frame_rx;
LOG_D(PHY,"RU %d/%d TS %llu (off %d), frame %d, subframe %d\n",
ru->idx,
......@@ -1155,7 +1156,7 @@ void wakeup_eNBs(RU_t *ru) {
LOG_D(PHY,"wakeup_eNBs (num %d) for RU %d\n",ru->num_eNB,ru->idx);
if (0){//(ru->num_eNB==1) {
if (get_nprocs() <= 4) {
// call eNB function directly
char string[20];
......@@ -1166,10 +1167,10 @@ void wakeup_eNBs(RU_t *ru) {
else {
for (i=0;i<ru->num_eNB;i++)
{
if (ru->wakeup_rxtx(eNB_list[i],ru) < 0)
{
if (ru->wakeup_rxtx(eNB_list[i],ru) < 0)
LOG_E(PHY,"could not wakeup eNB rxtx process for subframe %d\n", ru->proc.subframe_rx);
}
}
}
}
......@@ -1401,7 +1402,7 @@ static void* ru_stats_thread(void* param) {
while (!oai_exit) {
sleep(1);
if (opp_enabled == 1) {
if (opp_enabled == 1 && fepw) {
if (ru->feprx) print_meas(&ru->ofdm_demod_stats,"feprx",NULL,NULL);
if (ru->feptx_ofdm) print_meas(&ru->ofdm_mod_stats,"feptx_ofdm",NULL,NULL);
}
......@@ -1431,17 +1432,10 @@ static void* ru_thread_tx( void* param ) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD_TX,sched_getcpu());
if (oai_exit) break;
if (subframe==9) {
subframe=0;
frame++;
frame&=1023;
} else {
subframe++;
}
LOG_D(PHY,"ru_thread_tx: Waiting for TX processing\n");
// wait until eNBs are finished subframe RX n and TX n+4
wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx");
//printf("//////////////////instance_cnt_eNBs = %d\n",proc->instance_cnt_eNBs);//////////////////*********
#ifdef EMULATE_RF
#else
......@@ -1613,24 +1607,23 @@ static void* ru_thread( void* param ) {
// wakeup all eNB processes waiting for this RU
if (ru->num_eNB>0) wakeup_eNBs(ru);
/*
if(fh_two_thread == 0)
if(get_nprocs() <=4)
{
// wait until eNBs are finished subframe RX n and TX n+4
wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread");
// do TX front-end processing if needed (precoding and/or IDFTs)
if (ru->feptx_prec) ru->feptx_prec(ru);
// do OFDM if needed
if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru);
// do outgoing fronthaul (south) if needed
if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru);
if (ru->fh_north_out) ru->fh_north_out(ru);
#ifdef EMULATE_RF
#else
// do TX front-end processing if needed (precoding and/or IDFTs)
if (ru->feptx_prec) ru->feptx_prec(ru);
// do OFDM if needed
if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru);
// do outgoing fronthaul (south) if needed
if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru);
if (ru->fh_north_out) ru->fh_north_out(ru);
#endif
}
*/
}
......@@ -1818,7 +1811,7 @@ void init_RU_proc(RU_t *ru) {
pthread_create( &proc->pthread_emulateRF, attr_emulateRF, emulatedRF_thread, (void*)proc );
#endif
if (fh_two_thread==1)
if (get_nprocs() > 4)
pthread_create( &proc->pthread_FH1, attr_FH1, ru_thread_tx, (void*)ru );
if (ru->function == NGFI_RRU_IF4p5) {
......@@ -1841,7 +1834,7 @@ void init_RU_proc(RU_t *ru) {
}
if (get_nprocs()>=2) {
if (get_nprocs()> 2 && fepw) {
if (ru->feprx) init_fep_thread(ru,NULL);
if (ru->feptx_ofdm) init_feptx_thread(ru,NULL);
}
......
......@@ -210,7 +210,8 @@ extern void print_opp_meas(void);
int transmission_mode=1;
int numerology = 0;
int fh_two_thread = 1;
int codingw = 1;
int fepw = 1;
......
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