diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/LTE_TRANSPORT/if4_tools.c index e1fd1668004d5011b19ba87a28715f5dee346fdb..1e2e59056cb9ca743e9ea2664e872423b6e6aede 100755 --- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.c @@ -40,6 +40,7 @@ #include "PHY/defs.h" #include "PHY/TOOLS/alaw_lut.h" +#include "PHY/extern.h" //#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h" #include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h" @@ -47,7 +48,7 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type, int k) { LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; - int32_t **txdataF = eNB->common_vars.txdataF[0]; + int32_t **txdataF = (eNB->CC_id==0) ? eNB->common_vars.txdataF[0] : PHY_vars_eNB_g[0][0]->common_vars.txdataF[0]; int32_t **rxdataF = eNB->common_vars.rxdataF[0]; int16_t **rxsigF = eNB->prach_vars.rxsigF; void *tx_buffer = eNB->ifbuffer.tx; @@ -61,7 +62,8 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type IF4p5_header_t *packet_header=NULL; eth_state_t *eth = (eth_state_t*) (eNB->ifdevice.priv); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 1 ); + + if (eNB->CC_id==0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 1 ); if (packet_type == IF4p5_PDLFFT) { db_fulllength = 12*fp->N_RB_DL; @@ -81,10 +83,10 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type for (symbol_id=0; symbol_id<fp->symbols_per_tti; symbol_id++) { for (element_id=0; element_id<db_halflength; element_id++) { - i = (uint16_t*) &txdataF[0][blockoffsetF+element_id]; + i = (uint16_t*) &txdataF[eNB->CC_id][blockoffsetF+element_id]; data_block[element_id] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8); - i = (uint16_t*) &txdataF[0][slotoffsetF+element_id]; + i = (uint16_t*) &txdataF[eNB->CC_id][slotoffsetF+element_id]; data_block[element_id+db_halflength] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8); } @@ -177,7 +179,7 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type AssertFatal(1==0, "send_IF4p5 - Unknown packet_type %x", packet_type); } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 0 ); + if (eNB->CC_id==0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 0 ); return; } @@ -194,7 +196,7 @@ void recv_IF4p5(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_t int slotoffsetF=0, blockoffsetF=0; eth_state_t *eth = (eth_state_t*) (eNB->ifdevice.priv); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 1 ); + if (eNB->CC_id==0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 1 ); if (eNB->node_function == NGFI_RRU_IF4p5) { db_fulllength = (12*fp->N_RB_DL); @@ -281,7 +283,7 @@ void recv_IF4p5(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_t AssertFatal(1==0, "recv_IF4p5 - Unknown packet_type %x", *packet_type); } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 0 ); + if (eNB->CC_id==0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 0 ); return; } diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h index e42157769db93e13298a39bed5de914718825ca8..90c26431c954dd7fdbf1458578bfc5bfbb7698a8 100755 --- a/openair1/PHY/defs.h +++ b/openair1/PHY/defs.h @@ -242,6 +242,8 @@ typedef struct eNB_proc_t_s { int subframe_prach; /// frame to act upon for reception int frame_rx; + /// frame offset for secondary eNBs (to correct for frame asynchronism at startup) + int frame_offset; /// frame to act upon for PRACH int frame_prach; /// \internal This variable is protected by \ref mutex_fep. diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 5603ac842187c1d596447c2d332a3e326c98c5dd..0ee6c1ff112b760eafb22f7b243e1de5da55cd4c 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1103,7 +1103,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; DCI_ALLOC_t *dci_alloc=(DCI_ALLOC_t *)NULL; - int offset = proc == &eNB->proc.proc_rxtx[0] ? 0 : 1; + int offset = eNB->CC_id;//proc == &eNB->proc.proc_rxtx[0] ? 0 : 1; #if defined(SMBV) // counts number of allocations in subframe @@ -2741,7 +2741,7 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB){ LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; const int subframe = proc->subframe_rx; const int frame = proc->frame_rx; - int offset = (eNB->single_thread_flag==1) ? 0 : (subframe&1); + int offset = eNB->CC_id;//(eNB->single_thread_flag==1) ? 0 : (subframe&1); if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) return; @@ -2775,7 +2775,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const const int subframe = proc->subframe_rx; const int frame = proc->frame_rx; - int offset = (proc == &eNB->proc.proc_rxtx[0]) ? 0 : 1; + int offset = eNB->CC_id;//(proc == &eNB->proc.proc_rxtx[0]) ? 0 : 1; if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) return; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index b2f286dfcf10ebc85cf4e6bb4406bb0c77c3f183..823e1322cea5fdd8bd713ebe8fab5ae0d2667a5f 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -419,7 +419,7 @@ void tx_fh_if5_mobipass(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { } void tx_fh_if4p5(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { - send_IF4p5(eNB,proc->frame_tx, proc->subframe_tx, IF4p5_PDLFFT, 0); + send_IF4p5(eNB,proc->frame_tx,proc->subframe_tx, IF4p5_PDLFFT, 0); } void proc_tx_high0(PHY_VARS_eNB *eNB, @@ -427,7 +427,7 @@ void proc_tx_high0(PHY_VARS_eNB *eNB, relaying_type_t r_type, PHY_VARS_RN *rn) { - int offset = proc == &eNB->proc.proc_rxtx[0] ? 0 : 1; + int offset = eNB->CC_id;//proc == &eNB->proc.proc_rxtx[0] ? 0 : 1; VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB+offset, proc->frame_tx ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_ENB+offset, proc->subframe_tx ); @@ -604,7 +604,8 @@ static void* eNB_thread_rxtx( void* param ) { if (oai_exit) break; - if (rxtx(eNB,proc,thread_name) < 0) break; + if (eNB->CC_id==0) + if (rxtx(eNB,proc,thread_name) < 0) break; } // while !oai_exit @@ -854,7 +855,7 @@ void rx_rf(PHY_VARS_eNB *eNB,int *frame,int *subframe) { // prepare tx buffer pointers for (i=0; i<fp->nb_antennas_tx; i++) - txp[i] = (void*)&eNB->common_vars.txdata[0][i][((proc->subframe_rx+tx_sfoffset)%10)*fp->samples_per_tti]; + txp[i] = (void*)&eNB->common_vars.txdata[0][i][((proc->subframe_rx+tx_sfoffset)%10)*fp->samples_per_tti]; txs = eNB->rfdevice.trx_write_func(&eNB->rfdevice, proc->timestamp_rx+(tx_sfoffset*fp->samples_per_tti)-openair0_cfg[0].tx_sample_advance, @@ -981,6 +982,7 @@ void rx_fh_if4p5(PHY_VARS_eNB *eNB,int *frame,int *subframe) { do { // Blocking, we need a timeout on this !!!!!!!!!!!!!!!!!!!!!!! recv_IF4p5(eNB, &proc->frame_rx, &proc->subframe_rx, &packet_type, &symbol_number); + proc->frame_rx = (proc->frame_rx + proc->frame_offset)&1023; if (packet_type == IF4p5_PULFFT) { symbol_mask = symbol_mask | (1<<symbol_number); @@ -998,7 +1000,15 @@ void rx_fh_if4p5(PHY_VARS_eNB *eNB,int *frame,int *subframe) { if (proc->first_rx == 0) { if (proc->subframe_rx != *subframe){ - LOG_E(PHY,"rx_fh_if4p5: Received Timestamp doesn't correspond to the time we think it is (proc->subframe_rx %d, subframe %d,CCid %d)\n",proc->subframe_rx,*subframe,eNB->CC_id); + LOG_E(PHY,"rx_fh_if4p5, CC_id %d: Received Timestamp doesn't correspond to the time we think it is (proc->subframe_rx %d, subframe %d,CCid %d)\n",eNB->CC_id,proc->subframe_rx,*subframe,eNB->CC_id); + /* + if (proc->subframe_rx> *subframe) { + LOG_E(PHY,"rx_fh_if4p5, CC_id %d: this is ahead of time, so adjusting\n",eNB->CC_id); + *subframe = proc->subframe_rx; + } + else { + LOG_E(PHY,"rx_fh_ip4p5, CC_id %d: this is behind time, dropping\n"); + }*/ exit_fun("Exiting"); } if (proc->frame_rx != *frame) { @@ -1007,7 +1017,12 @@ void rx_fh_if4p5(PHY_VARS_eNB *eNB,int *frame,int *subframe) { } } else { proc->first_rx = 0; - *frame = proc->frame_rx; + if (eNB->CC_id==0) + proc->frame_offset = 0; + else + proc->frame_offset = PHY_vars_eNB_g[0][0]->proc.frame_rx; + + *frame = (proc->frame_rx + proc->frame_offset)&1023; *subframe = proc->subframe_rx; } @@ -1452,7 +1467,7 @@ static void* eNB_thread_single( void* param ) { eNB->rfdevice.openair0_cfg->rx_freq[i] = temp_freq1; eNB->rfdevice.openair0_cfg->rx_freq[i] = temp_freq2; } - eNB->rfdevice.trx_set_freq_func(&eNB->rfdevice,eNB->rfdevice.openair0_cfg,0); + eNB->rfdevice.trx_set_freq_func(&eNB->rfdevice,eNB->rfdevice.openair0_cfg,1); } // if RRU and slave @@ -1528,6 +1543,7 @@ void init_eNB_proc(int inst) { proc->first_rx=1; proc->first_tx=1; + proc->frame_offset = 0; pthread_mutex_init( &proc_rxtx[0].mutex_rxtx, NULL); pthread_mutex_init( &proc_rxtx[1].mutex_rxtx, NULL);