Commit 750b96e1 authored by Haruki NAOI's avatar Haruki NAOI

Clean PHY_TX_THREAD build option.

parent bbf6d514
......@@ -632,7 +632,6 @@ add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchange
add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams")
add_boolean_option(UE_EXPANSION False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE")
add_boolean_option(PHY_RM False "enable PHY_RM with phy resource management")
add_boolean_option(UDP_1MS False "enable using UDP socket for VNF-PNF interface")
......
......@@ -64,27 +64,13 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t Nacc=4;
uint16_t j0,j,idelta;
uint16_t i = (Ns>>1) + (10*frame);
#ifdef PHY_TX_THREAD
uint16_t i0 = dlsch->harq_processes[harq_pid]->i0;
#else
uint16_t i0 = dlsch->i0;
#endif
#ifdef PHY_TX_THREAD
if (dlsch->harq_processes[harq_pid]->sib1_br_flag==1) Nacc=1;
#else
if (dlsch->sib1_br_flag==1) Nacc=1;
#endif
else if (dlsch->rnti == 0xFFFF || dlsch->rnti == 0xFFFE) Nacc = (frame_parms->frame_type == TDD) ? 10 : 4;
#ifdef PHY_TX_THREAD
// Note: above SC-RNTI will also have to be added when/if implemented
else if (dlsch->harq_processes[harq_pid]->CEmode == CEmodeA) Nacc=1;
else if (dlsch->harq_processes[harq_pid]->CEmode == CEmodeB) Nacc = (frame_parms->frame_type == TDD) ? 10 : 4;
#else
// Note: above SC-RNTI will also have to be added when/if implemented
else if (dlsch->CEmode == CEmodeA) Nacc=1;
else if (dlsch->CEmode == CEmodeB) Nacc = (frame_parms->frame_type == TDD) ? 10 : 4;
#endif
if (frame_parms->frame_type == FDD || Nacc == 1) idelta = 0;
else idelta = Nacc-2;
......@@ -97,11 +83,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
// x1 is set in lte_gold_generic
if (mbsfn_flag == 0) {
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
#ifdef PHY_TX_THREAD
if (dlsch->harq_processes[harq_pid]->i0 != 0xFFFF) {
#else
if (dlsch->i0 != 0xFFFF) {
#endif
// rule for BL/CE UEs from Section 6.3.1 in 36.211
x2= (dlsch->rnti<<14) + (q<<13) + ((((j0+j)*Nacc)%10)<<9) + frame_parms->Nid_cell;
if ((frame&1023) < 200) LOG_D(PHY,"Scrambling init for (i0 %d, i %d, j0 %d, j %d, Nacc %d) => x2 %d\n",i0,i,j0,j,Nacc,x2);
......
......@@ -126,15 +126,6 @@ typedef struct {
uint8_t first_layer;
/// codeword this transport block is mapped to
uint8_t codeword;
#ifdef PHY_TX_THREAD
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// indicator that this DLSCH corresponds to SIB1-BR, needed for c_init for scrambling
uint8_t sib1_br_flag;
/// initial absolute subframe (see 36.211 Section 6.3.1), needed for c_init for scrambling
uint16_t i0;
CEmode_t CEmode;
#endif
#endif
} LTE_DL_eNB_HARQ_t;
......@@ -181,7 +172,6 @@ typedef struct {
int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b;
#ifndef PHY_TX_THREAD
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// indicator that this DLSCH corresponds to SIB1-BR, needed for c_init for scrambling
uint8_t sib1_br_flag;
......@@ -189,7 +179,6 @@ typedef struct {
uint16_t i0;
CEmode_t CEmode;
#endif
#endif
} LTE_eNB_DLSCH_t;
......
......@@ -254,26 +254,7 @@ typedef struct RU_proc_t_s {
int num_slaves;
/// array of pointers to slaves
struct RU_proc_t_s **slave_proc;
#ifdef PHY_TX_THREAD
/// pthread structure for PRACH thread
pthread_t pthread_phy_tx;
pthread_mutex_t mutex_phy_tx;
pthread_cond_t cond_phy_tx;
/// \internal This variable is protected by \ref mutex_phy_tx.
int instance_cnt_phy_tx;
/// frame to act upon for transmission
int frame_phy_tx;
/// subframe to act upon for transmission
int subframe_phy_tx;
/// timestamp to send to "slave rru"
openair0_timestamp timestamp_phy_tx;
/// pthread structure for RF TX thread
pthread_t pthread_rf_tx;
pthread_mutex_t mutex_rf_tx;
pthread_cond_t cond_rf_tx;
/// \internal This variable is protected by \ref mutex_rf_tx.
int instance_cnt_rf_tx;
#endif
int emulate_rf_busy;
} RU_proc_t;
......
......@@ -243,11 +243,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro
}
#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
#ifdef PHY_TX_THREAD
dlsch0_harq->sib1_br_flag=0;
#else
dlsch0->sib1_br_flag=0;
#endif
if ((rel13->pdsch_payload_type <2) && (rel13->ue_type>0)) { // this is a BR/CE UE and SIB1-BR/SI-BR
UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE);
......@@ -271,16 +267,9 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro
dlsch0->harq_ids[proc->frame_tx%2][proc->subframe_rx] = 0;
dlsch0_harq->frame = proc->frame_tx;
dlsch0_harq->subframe = proc->subframe_tx;
#ifdef PHY_TX_THREAD
if (rel13->pdsch_payload_type == 0) dlsch0_harq->sib1_br_flag=1;
#else
if (rel13->pdsch_payload_type == 0) dlsch0->sib1_br_flag=1;
#endif
// configure PDSCH
switch (eNB->frame_parms.N_RB_DL) {
case 6:
......@@ -340,11 +329,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
LOG_D(PHY,"dlsch->i0:%04x dlsch0_harq[pdsch_start:%d nb_rb:%d vrb_type:%d rvidx:%d Nl:%d mimo_mode:%d dl_power_off:%d round:%d status:%d TBS:%d Qm:%d codeword:%d rb_alloc:%d] rel8[length:%d]\n",
#ifdef PHY_TX_THREAD
dlsch0_harq->i0,
#else
dlsch0->i0,
#endif
dlsch0_harq->pdsch_start, dlsch0_harq->nb_rb, dlsch0_harq->vrb_type, dlsch0_harq->rvidx, dlsch0_harq->Nl, dlsch0_harq->mimo_mode, dlsch0_harq->dl_power_off, dlsch0_harq->round, dlsch0_harq->status,
dlsch0_harq->TBS, dlsch0_harq->Qm, dlsch0_harq->codeword, dlsch0_harq->rb_alloc[0],
rel8->length
......
......@@ -256,9 +256,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
if(oai_exit) return(-1);
if(get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD) {
#ifndef PHY_TX_THREAD
phy_procedures_eNB_TX(eNB, proc, 1);
#endif
}
/* CONFLICT RESOLUTION: what about this release_thread call, has it to be done? if yes, where? */
......
......@@ -694,11 +694,6 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
if (ru->fh_north_asynch_in == NULL) {
#ifdef PHY_TX_THREAD
proc->timestamp_phy_tx = proc->timestamp_rx+((sf_ahead-1)*fp->samples_per_tti);
proc->subframe_phy_tx = (proc->subframe_rx+(sf_ahead-1))%10;
proc->frame_phy_tx = (proc->subframe_rx>(9-(sf_ahead-1))) ? (proc->frame_rx+1)&1023 : proc->frame_rx;
#endif
LOG_D(PHY,"RU %d/%d TS %llu (off %d), frame %d, subframe %d\n",
ru->idx,
0,
......@@ -1571,12 +1566,6 @@ void* ru_stats_thread(void* param) {
return(NULL);
}
#ifdef PHY_TX_THREAD
int first_phy_tx = 1;
volatile int16_t phy_tx_txdataF_end;
volatile int16_t phy_tx_end;
#endif
void *ru_thread_tx( void *param ) {
RU_t *ru = (RU_t *)param;
RU_proc_t *proc = &ru->proc;
......@@ -1864,39 +1853,6 @@ void *ru_thread( void *param ) {
return NULL;
}
#ifdef PHY_TX_THREAD
if(first_phy_tx == 0)
{
phy_tx_end = 0;
phy_tx_txdataF_end = 0;
if ((ret=pthread_mutex_lock(&ru->proc.mutex_phy_tx))!=0) {
LOG_E(PHY,"[RU] ERROR pthread_mutex_lock for phy tx thread (IC %d)\n", ru->proc.instance_cnt_phy_tx);
return NULL;
}
if (ru->proc.instance_cnt_phy_tx==-1) {
++ru->proc.instance_cnt_phy_tx;
// the thread can now be woken up
if (pthread_cond_signal(&ru->proc.cond_phy_tx) != 0) {
LOG_E(PHY, "ERROR pthread_cond_signal for phy_tx thread\n");
return NULL;
}
}else{
LOG_E(PHY,"phy tx thread busy, skipping\n");
++ru->proc.instance_cnt_phy_tx;
}
if ((ret=pthread_mutex_unlock( &ru->proc.mutex_phy_tx ))!=0) {
LOG_E(PHY,"mutex_unlock returns %d\n",ret);
return NULL;
}
} else {
phy_tx_end = 1;
phy_tx_txdataF_end = 1;
}
first_phy_tx = 0;
#endif
if (ru->stop_rf && ru->cmd == STOP_RU) {
ru->stop_rf(ru);
ru->state = RU_IDLE;
......@@ -1979,8 +1935,6 @@ void *ru_thread( void *param ) {
// wakeup all eNB processes waiting for this RU
if (ru->num_eNB>0) wakeup_L1s(ru);
#ifndef PHY_TX_THREAD
if(get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD || ru->num_eNB==0) {
// do TX front-end processing if needed (precoding and/or IDFTs)
if (ru->feptx_prec) ru->feptx_prec(ru);
......@@ -1998,16 +1952,6 @@ void *ru_thread( void *param ) {
proc->emulate_rf_busy = 0;
}
#else
struct timespec time_req, time_rem;
time_req.tv_sec = 0;
time_req.tv_nsec = 10000;
while((!oai_exit)&&(phy_tx_end == 0)){
nanosleep(&time_req,&time_rem);
continue;
}
#endif
} // else wait_cnt == 0
} // ru->state = RU_RUN
} // while !oai_exit
......@@ -2087,121 +2031,6 @@ void *ru_thread_synch(void *arg) {
return &ru_thread_synch_status;
}
#ifdef PHY_TX_THREAD
/*!
* \brief The phy tx thread of eNB.
* \param param is a \ref L1_proc_t structure which contains the info what to process.
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
static void *eNB_thread_phy_tx( void *param ) {
static int eNB_thread_phy_tx_status;
RU_t *ru = (RU_t *)param;
RU_proc_t *proc = &ru->proc;
PHY_VARS_eNB **eNB_list = ru->eNB_list;
L1_rxtx_proc_t L1_proc;
// set default return value
eNB_thread_phy_tx_status = 0;
int ret;
thread_top_init("eNB_thread_phy_tx",1,500000L,1000000L,20000000L);
while (!oai_exit) {
if (oai_exit) break;
if (wait_on_condition(&proc->mutex_phy_tx,&proc->cond_phy_tx,&proc->instance_cnt_phy_tx,"eNB_phy_tx_thread") < 0) break;
LOG_D(PHY,"Running eNB phy tx procedures\n");
if (ru->num_eNB != 1) {
LOG_E(PHY, "handle multiple L1 case\n");
return NULL;
}
L1_proc.subframe_tx = proc->subframe_phy_tx;
L1_proc.frame_tx = proc->frame_phy_tx;
phy_procedures_eNB_TX(eNB_list[0], &L1_proc, 1);
phy_tx_txdataF_end = 1;
if ((ret=pthread_mutex_lock(&ru->proc.mutex_rf_tx))!=0) {
LOG_E(PHY,"[RU] ERROR pthread_mutex_lock for rf tx thread (IC %d)\n", ru->proc.instance_cnt_rf_tx);
return NULL;
}
if (ru->proc.instance_cnt_rf_tx==-1) {
++ru->proc.instance_cnt_rf_tx;
ru->proc.frame_tx = proc->frame_phy_tx;
ru->proc.subframe_tx = proc->subframe_phy_tx;
ru->proc.timestamp_tx = proc->timestamp_phy_tx;
// the thread can now be woken up
if (pthread_cond_signal(&ru->proc.cond_rf_tx) != 0) {
LOG_E(PHY, "ERROR pthread_cond_signal for rf_tx thread\n");
return NULL;
}
} else {
LOG_E(PHY,"rf tx thread busy, skipping\n");
late_control=STATE_BURST_TERMINATE;
}
if ((ret=pthread_mutex_unlock( &ru->proc.mutex_rf_tx ))!=0) {
LOG_E(PHY,"mutex_unlock returns %d\n",ret);
return NULL;
}
if (release_thread(&proc->mutex_phy_tx,&proc->instance_cnt_phy_tx,"eNB_thread_phy_tx") < 0) break;
phy_tx_end = 1;
}
LOG_I(PHY, "Exiting eNB thread PHY TX\n");
eNB_thread_phy_tx_status = 0;
return &eNB_thread_phy_tx_status;
}
static void *rf_tx( void *param ) {
static int rf_tx_status;
RU_t *ru = (RU_t *)param;
RU_proc_t *proc = &ru->proc;
// set default return value
rf_tx_status = 0;
thread_top_init("rf_tx",1,500000L,1000000L,20000000L);
while (!oai_exit) {
if (oai_exit) break;
if (wait_on_condition(&proc->mutex_rf_tx,&proc->cond_rf_tx,&proc->instance_cnt_rf_tx,"rf_tx_thread") < 0) break;
LOG_D(PHY,"Running eNB rf tx procedures\n");
if(ru->num_eNB == 1) {
// 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);
if(!emulate_rf) {
// 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);
}
}
if (release_thread(&proc->mutex_rf_tx,&proc->instance_cnt_rf_tx,"rf_tx") < 0) break;
if(proc->instance_cnt_rf_tx >= 0) {
late_control=STATE_BURST_TERMINATE;
LOG_E(PHY,"detect rf tx busy change mode TX failsafe\n");
}
}
LOG_I(PHY, "Exiting rf TX\n");
rf_tx_status = 0;
return &rf_tx_status;
}
#endif
int start_if(struct RU_t_s *ru,struct PHY_VARS_eNB_s *eNB) {
return(ru->ifdevice.trx_start_func(&ru->ifdevice));
}
......@@ -2315,14 +2144,6 @@ void init_RU_proc(RU_t *ru) {
pthread_cond_init( &proc->cond_prach_br, NULL);
pthread_attr_init( &proc->attr_prach_br);
#endif
#ifdef PHY_TX_THREAD
proc->instance_cnt_phy_tx = -1;
pthread_mutex_init( &proc->mutex_phy_tx, NULL);
pthread_cond_init( &proc->cond_phy_tx, NULL);
proc->instance_cnt_rf_tx = -1;
pthread_mutex_init( &proc->mutex_rf_tx, NULL);
pthread_cond_init( &proc->cond_rf_tx, NULL);
#endif
#ifndef DEADLINE_SCHEDULER
attr_FH = &proc->attr_FH;
attr_FH1 = &proc->attr_FH1;
......@@ -2340,12 +2161,6 @@ void init_RU_proc(RU_t *ru) {
pthread_create( &proc->pthread_FH, attr_FH, ru_thread, (void*)ru );
#ifdef PHY_TX_THREAD
pthread_create( &proc->pthread_phy_tx, NULL, eNB_thread_phy_tx, (void *)ru );
pthread_setname_np( proc->pthread_phy_tx, "phy_tx_thread" );
pthread_create( &proc->pthread_rf_tx, NULL, rf_tx, (void *)ru );
#endif
if(get_softmodem_params()->emulate_rf)
pthread_create( &proc->pthread_emulateRF, attr_emulateRF, emulatedRF_thread, (void *)proc );
......@@ -2422,34 +2237,6 @@ void init_RU_proc(RU_t *ru) {
void kill_RU_proc(RU_t *ru) {
int ret;
RU_proc_t *proc = &ru->proc;
#ifdef PHY_TX_THREAD
if ((ret=pthread_mutex_lock(&proc->mutex_phy_tx))!=0) {
LOG_E(PHY,"mutex_lock returns %d\n",ret);
return;
}
proc->instance_cnt_phy_tx = 0;
pthread_cond_signal(&proc->cond_phy_tx);
if ((ret=pthread_mutex_unlock(&proc->mutex_phy_tx))!=0) {
LOG_E(PHY,"mutex_unlock returns %d\n",ret);
return;
}
pthread_join(ru->proc.pthread_phy_tx, NULL);
pthread_mutex_destroy( &proc->mutex_phy_tx);
pthread_cond_destroy( &proc->cond_phy_tx);
if ((ret=pthread_mutex_lock(&proc->mutex_rf_tx))!=0) {
LOG_E(PHY,"mutex_lock returns %d\n",ret);
return;
}
proc->instance_cnt_rf_tx = 0;
pthread_cond_signal(&proc->cond_rf_tx);
if ((ret=pthread_mutex_unlock(&proc->mutex_rf_tx))!=0) {
LOG_E(PHY,"mutex_unlock returns %d\n",ret);
return;
}
pthread_join(proc->pthread_rf_tx, NULL);
pthread_mutex_destroy( &proc->mutex_rf_tx);
pthread_cond_destroy( &proc->cond_rf_tx);
#endif
if (get_thread_worker_conf() == WORKER_ENABLE) {
LOG_D(PHY, "killing FEP thread\n");
......@@ -2880,28 +2667,6 @@ void init_RU(char *rf_config_file, clock_source_t clock_source,clock_source_t ti
LOG_D(HW,"[lte-softmodem.c] RU threads created\n");
}
void stop_ru(RU_t *ru) {
#if defined(PHY_TX_THREAD)
int *status;
#endif
printf("Stopping RU %p processing threads\n",(void*)ru);
#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++) {
......
......@@ -312,7 +312,6 @@ extern void kill_eNB_proc(int inst);
// In lte-ru.c
extern void init_RU(char*,clock_source_t clock_source,clock_source_t time_source,int send_dmrssync);
extern void stop_ru(RU_t *ru);
extern void init_ru_vnf(void);
extern void init_RU_proc(RU_t *ru);
extern void stop_RU(int nb_ru);
......
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