mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-15 21:50:27 +00:00
Compare commits
5 Commits
pre-commit
...
ru-paralle
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c2c6068fb | ||
|
|
1085e562d5 | ||
|
|
203ff5a761 | ||
|
|
80c40c36bc | ||
|
|
e19385a527 |
@@ -722,6 +722,7 @@ void init_gNB_proc(int inst) {
|
||||
PHY_VARS_gNB *gNB;
|
||||
gNB_L1_proc_t *proc;
|
||||
gNB_L1_rxtx_proc_t *L1_proc,*L1_proc_tx;
|
||||
|
||||
LOG_I(PHY,"%s(inst:%d) RC.nb_nr_CC[inst]:%d \n",__FUNCTION__,inst,RC.nb_nr_CC[inst]);
|
||||
|
||||
for (CC_id=0; CC_id<RC.nb_nr_CC[inst]; CC_id++) {
|
||||
@@ -743,7 +744,7 @@ void init_gNB_proc(int inst) {
|
||||
proc->first_tx =1;
|
||||
proc->RU_mask =0;
|
||||
proc->RU_mask_tx = (1<<gNB->num_RU)-1;
|
||||
proc->RU_mask_prach =0;
|
||||
proc->RU_mask_prach =0;
|
||||
pthread_mutex_init( &gNB->UL_INFO_mutex, NULL);
|
||||
pthread_mutex_init( &L1_proc->mutex, NULL);
|
||||
pthread_mutex_init( &L1_proc_tx->mutex, NULL);
|
||||
@@ -759,8 +760,9 @@ void init_gNB_proc(int inst) {
|
||||
LOG_I(PHY,"gNB->single_thread_flag:%d\n", gNB->single_thread_flag);
|
||||
|
||||
if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) {
|
||||
threadCreate( &L1_proc->pthread, gNB_L1_thread, gNB, "L1_proc", -1, OAI_PRIORITY_RT );
|
||||
threadCreate( &L1_proc_tx->pthread, gNB_L1_thread_tx, gNB,"L1_proc_tx", -1, OAI_PRIORITY_RT);
|
||||
threadCreate( &L1_proc->pthread, gNB_L1_thread, (void*)gNB, "L1_proc", -1, OAI_PRIORITY_RT );
|
||||
threadCreate( &L1_proc_tx->pthread, gNB_L1_thread_tx, (void*)gNB, "L1_proc_tx", -1, OAI_PRIORITY_RT);
|
||||
nr_init_pdsch_thread(gNB);
|
||||
}
|
||||
|
||||
if(opp_enabled == 1) threadCreate(&proc->L1_stats_thread, process_stats_thread,(void *)gNB, "time_meas", -1, OAI_PRIORITY_RT_LOW);
|
||||
@@ -810,6 +812,7 @@ void kill_gNB_proc(int inst) {
|
||||
L1_proc_tx->instance_cnt = 0;
|
||||
pthread_cond_signal(&L1_proc_tx->cond);
|
||||
pthread_mutex_unlock(&L1_proc_tx->mutex);
|
||||
nr_kill_pdsch_thread(gNB);
|
||||
}
|
||||
|
||||
proc->instance_cnt_prach = 0;
|
||||
|
||||
@@ -1208,13 +1208,11 @@ static void *ru_stats_thread(void *param) {
|
||||
sleep(1);
|
||||
|
||||
if (opp_enabled == 1) {
|
||||
if (ru->feptx_prec) {
|
||||
print_meas(&ru->precoding_stats,"feptx_prec",NULL,NULL);
|
||||
}
|
||||
|
||||
if (ru->feprx) print_meas(&ru->ofdm_demod_stats,"feprx",NULL,NULL);
|
||||
|
||||
if (ru->feptx_ofdm){
|
||||
print_meas(&ru->precoding_stats,"feptx_prec",NULL,NULL);
|
||||
print_meas(&ru->txdataF_copy_stats,"txdataF_copy",NULL,NULL);
|
||||
print_meas(&ru->ofdm_mod_stats,"feptx_ofdm",NULL,NULL);
|
||||
print_meas(&ru->ofdm_total_stats,"feptx_total",NULL,NULL);
|
||||
@@ -1278,9 +1276,9 @@ static void *ru_thread_tx( void *param ) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, tti_tx );
|
||||
|
||||
// do TX front-end processing if needed (precoding and/or IDFTs)
|
||||
//if (ru->feptx_prec) ru->feptx_prec(ru,frame_tx,tti_tx);
|
||||
if (ru->feptx_prec) ru->feptx_prec(ru,frame_tx,tti_tx);
|
||||
|
||||
// do OFDM if needed
|
||||
// do OFDM with/without TX front-end processing if needed
|
||||
if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,frame_tx,tti_tx);
|
||||
|
||||
if(!emulate_rf) {
|
||||
@@ -1521,9 +1519,9 @@ static void *ru_thread( void *param ) {
|
||||
|
||||
if(get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD || ru->num_gNB==0) {
|
||||
// do TX front-end processing if needed (precoding and/or IDFTs)
|
||||
//if (ru->feptx_prec) ru->feptx_prec(ru,proc->frame_tx,proc->tti_tx);
|
||||
if (ru->feptx_prec) ru->feptx_prec(ru,proc->frame_tx,proc->tti_tx);
|
||||
|
||||
// do OFDM if needed
|
||||
// do OFDM with/without TX front-end processing if needed
|
||||
if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,proc->frame_tx,proc->tti_tx);
|
||||
|
||||
if(!emulate_rf) {
|
||||
@@ -1706,7 +1704,7 @@ void init_RU_proc(RU_t *ru) {
|
||||
threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "thread_FH", -1, OAI_PRIORITY_RT_MAX );
|
||||
|
||||
if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT)
|
||||
threadCreate( &proc->pthread_FH1, ru_thread_tx, (void *)ru, "thread_FH1", -1, OAI_PRIORITY_RT );
|
||||
threadCreate( &proc->pthread_FH1, ru_thread_tx, (void *)ru, "thread_FH_TX", -1, OAI_PRIORITY_RT );
|
||||
|
||||
if(emulate_rf)
|
||||
threadCreate( &proc->pthread_emulateRF, emulatedRF_thread, (void *)proc, "emulateRF", -1, OAI_PRIORITY_RT );
|
||||
@@ -1731,7 +1729,6 @@ void init_RU_proc(RU_t *ru) {
|
||||
if (ru->feprx) nr_init_feprx_thread(ru);
|
||||
|
||||
if (ru->feptx_ofdm) nr_init_feptx_thread(ru);
|
||||
//if (ru->feptx_prec) nr_init_feptx_prec_thread(ru);
|
||||
}
|
||||
|
||||
if (opp_enabled == 1) threadCreate(&ru->ru_stats_thread,ru_stats_thread,(void *)ru, "emulateRF", -1, OAI_PRIORITY_RT_LOW);
|
||||
@@ -2044,9 +2041,9 @@ void set_function_spec_param(RU_t *ru) {
|
||||
malloc_IF4p5_buffer(ru);
|
||||
} else if (ru->function == gNodeB_3GPP) {
|
||||
ru->do_prach = 0; // no prach processing in RU
|
||||
ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? nr_fep_full_2thread : nr_fep_full; // RX DFTs
|
||||
ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? nr_fep_full_2thread : nr_fep_full; // RX DFTs
|
||||
ru->feptx_ofdm = (get_thread_worker_conf() == WORKER_ENABLE) ? nr_feptx_ofdm_2thread : nr_feptx_ofdm; // this is fep with idft and precoding
|
||||
ru->feptx_prec = nr_feptx_prec; // this is fep with idft and precoding
|
||||
ru->feptx_prec = (get_thread_worker_conf() == WORKER_ENABLE) ? NULL : nr_feptx_prec; // this is fep with idft and precoding
|
||||
ru->fh_north_in = NULL; // no incoming fronthaul from north
|
||||
ru->fh_north_out = NULL; // no outgoing fronthaul to north
|
||||
ru->nr_start_if = NULL; // no if interface
|
||||
@@ -2074,8 +2071,8 @@ void set_function_spec_param(RU_t *ru) {
|
||||
|
||||
case REMOTE_IF5: // the remote unit is IF5 RRU
|
||||
ru->do_prach = 0;
|
||||
ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? nr_fep_full_2thread : nr_fep_full; // this is frequency-shift + DFTs
|
||||
ru->feptx_prec = nr_feptx_prec; // need to do transmit Precoding + IDFTs
|
||||
ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? nr_fep_full_2thread : nr_fep_full; // this is frequency-shift + DFTs
|
||||
ru->feptx_prec = (get_thread_worker_conf() == WORKER_ENABLE) ? NULL : nr_feptx_prec; // need to do transmit Precoding + IDFTs
|
||||
ru->feptx_ofdm = (get_thread_worker_conf() == WORKER_ENABLE) ? nr_feptx_ofdm_2thread : nr_feptx_ofdm; // need to do transmit Precoding + IDFTs
|
||||
ru->fh_south_in = fh_if5_south_in; // synchronous IF5 reception
|
||||
ru->fh_south_out = fh_if5_south_out; // synchronous IF5 transmission
|
||||
@@ -2099,7 +2096,7 @@ void set_function_spec_param(RU_t *ru) {
|
||||
case REMOTE_IF4p5:
|
||||
ru->do_prach = 0;
|
||||
ru->feprx = NULL; // DFTs
|
||||
ru->feptx_prec = nr_feptx_prec; // Precoding operation
|
||||
ru->feptx_prec = (get_thread_worker_conf() == WORKER_ENABLE) ? NULL : nr_feptx_prec; // Precoding operation
|
||||
ru->feptx_ofdm = NULL; // no OFDM mod
|
||||
ru->fh_south_in = fh_if4p5_south_in; // synchronous IF4p5 reception
|
||||
ru->fh_south_out = fh_if4p5_south_out; // synchronous IF4p5 transmission
|
||||
|
||||
@@ -145,7 +145,7 @@ int nr_beam_precoding(int32_t **txdataF,
|
||||
int slot,
|
||||
int symbol,
|
||||
int aa,
|
||||
int nb_antenna_ports)
|
||||
int nb_logical_ports)
|
||||
{
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ int nr_beam_precoding(int32_t **txdataF,
|
||||
// clear txdata_BF[aa][re] for each call of ue_spec_beamforming
|
||||
memset(&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size));
|
||||
|
||||
for (p=0; p<nb_antenna_ports; p++) {
|
||||
for (p=0; p<nb_logical_ports; p++) {
|
||||
if ((frame_parms->L_ssb >> p) & 0x01) {
|
||||
multadd_cpx_vector((int16_t*)&txdataF[p][symbol*frame_parms->ofdm_symbol_size],
|
||||
(int16_t*)beam_weights[p][aa],
|
||||
|
||||
@@ -101,7 +101,7 @@ int nr_beam_precoding(int32_t **txdataF,
|
||||
int slot,
|
||||
int symbol,
|
||||
int aa,
|
||||
int nb_antenna_ports
|
||||
int nb_logical_ports
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -170,22 +170,21 @@ typedef struct RU_prec_t_s{
|
||||
} RU_prec_t;
|
||||
|
||||
typedef struct RU_feptx_t_s{
|
||||
/// \internal This variable is protected by \ref mutex_feptx_prec
|
||||
/// \internal This variable is protected by \ref mutex_feptx
|
||||
int instance_cnt_feptx;
|
||||
/// pthread struct for RU TX FEP PREC worker thread
|
||||
/// pthread struct for RU TX FEP thread
|
||||
pthread_t pthread_feptx;
|
||||
/// pthread attributes for worker feptx prec thread
|
||||
/// pthread attributes for feptx thread
|
||||
pthread_attr_t attr_feptx;
|
||||
/// condition varible for RU TX FEP PREC thread
|
||||
/// condition varible for RU TX FEP thread
|
||||
pthread_cond_t cond_feptx;
|
||||
/// mutex for fep PREC TX worker thread
|
||||
/// mutex for fep TX thread
|
||||
pthread_mutex_t mutex_feptx;
|
||||
struct RU_t_s *ru;
|
||||
int aa;//physical MAX nb_tx
|
||||
int half_slot;//first or second half of a slot
|
||||
int aa;//number of physical antenna port (MAX nb_tx)
|
||||
int slot;//current slot
|
||||
int symbol;//current symbol
|
||||
int nb_antenna_ports;//number of logical port
|
||||
int nb_logical_ports;//number of logical antenna port (MAX Lmax)
|
||||
int index;
|
||||
}RU_feptx_t;
|
||||
|
||||
|
||||
@@ -125,6 +125,23 @@ typedef struct {
|
||||
uint32_t F;
|
||||
} NR_DL_gNB_HARQ_t;
|
||||
|
||||
typedef struct NR_gNB_DLSCH_thread_t_s{
|
||||
/// \internal This variable is protected by \ref mutex_feptx_prec
|
||||
int instance_cnt_dlsch;
|
||||
/// pthread struct for RU TX FEP PREC worker thread
|
||||
pthread_t pthread_dlsch;
|
||||
/// pthread attributes for worker feptx prec thread
|
||||
pthread_attr_t attr_dlsch;
|
||||
/// condition varible for RU TX FEP PREC thread
|
||||
pthread_cond_t cond_dlsch;
|
||||
/// mutex for fep PREC TX worker thread
|
||||
pthread_mutex_t mutex_dlsch;
|
||||
/// current frame
|
||||
int frame;
|
||||
/// current slot
|
||||
int slot;
|
||||
}NR_gNB_DLSCH_thread_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
/// Pointers to 16 HARQ processes for the DLSCH
|
||||
@@ -646,6 +663,7 @@ typedef struct PHY_VARS_gNB_s {
|
||||
// LTE_eNB_ULSCH_t *ulsch[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA
|
||||
NR_gNB_DLSCH_t *dlsch_SI,*dlsch_ra,*dlsch_p;
|
||||
NR_gNB_DLSCH_t *dlsch_PCH;
|
||||
NR_gNB_DLSCH_thread_t *dlsch_thread; //dlsch thread structure;
|
||||
/*
|
||||
LTE_eNB_UE_stats UE_stats[NUMBER_OF_UE_MAX];
|
||||
LTE_eNB_UE_stats *UE_stats_ptr[NUMBER_OF_UE_MAX];
|
||||
|
||||
@@ -121,14 +121,15 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) {
|
||||
int slot = tti_tx;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int aa = 0;
|
||||
int p = 0;
|
||||
int ret = 0;
|
||||
int nb_antenna_ports = fp->N_ssb;
|
||||
int nb_logical_ports = fp->Lmax;
|
||||
int ofdm_mask_full = (1<<(ru->nb_tx*2))-1;
|
||||
int txdataF_offset = (tti_tx%2)*fp->samples_per_slot_wCP;
|
||||
|
||||
if (nr_slot_select(cfg,slot) == SF_UL) return;
|
||||
for (aa=0; aa<fp->Lmax; aa++) {
|
||||
memset(ru->common.txdataF[aa],0,fp->samples_per_slot_wCP*sizeof(int32_t));
|
||||
for (p=0; p<nb_logical_ports; p++) {
|
||||
memset(ru->common.txdataF[p],0,fp->samples_per_slot_wCP*sizeof(int32_t));
|
||||
}
|
||||
|
||||
for(j=0; j<fp->symbols_per_slot; ++j){
|
||||
@@ -139,9 +140,9 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) {
|
||||
gNB = ru->gNB_list[0];
|
||||
cfg = &gNB->gNB_config;
|
||||
|
||||
for(i=0; i<nb_antenna_ports; ++i){
|
||||
for(i=0; i<nb_logical_ports; ++i){
|
||||
memcpy((void*)&ru->common.txdataF[i][j*fp->ofdm_symbol_size],
|
||||
(void*)&gNB->common_vars.txdataF[i][j*fp->ofdm_symbol_size + ((tti_tx%2)*fp->samples_per_slot_wCP)],
|
||||
(void*)&gNB->common_vars.txdataF[i][j*fp->ofdm_symbol_size + txdataF_offset],
|
||||
fp->ofdm_symbol_size*sizeof(int32_t));
|
||||
}
|
||||
|
||||
@@ -164,7 +165,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) {
|
||||
feptx[i].ru = ru;
|
||||
feptx[i].symbol = j;
|
||||
feptx[i].slot = slot;
|
||||
feptx[i].nb_antenna_ports = nb_antenna_ports;
|
||||
feptx[i].nb_logical_ports = nb_logical_ports;
|
||||
feptx[i].instance_cnt_feptx = 0;
|
||||
AssertFatal(pthread_cond_signal(&feptx[i].cond_feptx) == 0,"ERROR pthread_cond_signal for feptx_ofdm_thread\n");
|
||||
AssertFatal((ret=pthread_mutex_unlock(&feptx[i].mutex_feptx))==0,"mutex_lock returns %d\n",ret);
|
||||
@@ -179,7 +180,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) {
|
||||
feptx[i+ru->nb_tx].ru = ru;
|
||||
feptx[i+ru->nb_tx].symbol = j;
|
||||
feptx[i+ru->nb_tx].slot = slot;
|
||||
feptx[i+ru->nb_tx].nb_antenna_ports = nb_antenna_ports;
|
||||
feptx[i+ru->nb_tx].nb_logical_ports = nb_logical_ports;
|
||||
feptx[i+ru->nb_tx].instance_cnt_feptx = 0;
|
||||
AssertFatal(pthread_cond_signal(&feptx[i+ru->nb_tx].cond_feptx) == 0,"ERROR pthread_cond_signal for feptx_ofdm_thread\n");
|
||||
AssertFatal((ret=pthread_mutex_unlock(&feptx[i+ru->nb_tx].mutex_feptx))==0,"mutex_lock returns %d\n",ret);
|
||||
@@ -215,7 +216,7 @@ static void *nr_feptx_thread(void *param) {
|
||||
|
||||
RU_feptx_t *feptx = (RU_feptx_t *)param;
|
||||
RU_t *ru;
|
||||
int aa, slot, start, l, nb_antenna_ports, ret;
|
||||
int aa, slot, start, l, nb_logical_ports, ret;
|
||||
int32_t ***bw;
|
||||
NR_DL_FRAME_PARMS *fp;
|
||||
int ofdm_mask_full;
|
||||
@@ -233,20 +234,36 @@ static void *nr_feptx_thread(void *param) {
|
||||
l = feptx->symbol;
|
||||
fp = ru->nr_frame_parms;
|
||||
start = feptx->symbol;
|
||||
nb_antenna_ports = feptx->nb_antenna_ports;
|
||||
nb_logical_ports = feptx->nb_logical_ports;
|
||||
ofdm_mask_full = (1<<(ru->nb_tx*2))-1;
|
||||
|
||||
bw = ru->beam_weights[0];
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 1);
|
||||
start_meas(&ru->precoding_stats);
|
||||
nr_beam_precoding(ru->common.txdataF,
|
||||
if (ru->nb_tx == 1) {
|
||||
AssertFatal(fp->N_ssb==ru->nb_tx,"Attempting to transmit %d SSB while Nb_tx = %d",fp->N_ssb,ru->nb_tx);
|
||||
for (int p=0; p<nb_logical_ports; p++) {
|
||||
if ((fp->L_ssb >> p) & 0x01){
|
||||
memcpy((void*)&ru->common.txdataF_BF[0][l*fp->ofdm_symbol_size],
|
||||
(void*)&ru->common.txdataF[p][l*fp->ofdm_symbol_size],
|
||||
fp->ofdm_symbol_size*sizeof(int32_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
bw = ru->beam_weights[0];
|
||||
nr_beam_precoding(ru->common.txdataF,
|
||||
ru->common.txdataF_BF,
|
||||
fp,
|
||||
bw,
|
||||
slot,
|
||||
l,
|
||||
aa,
|
||||
nb_antenna_ports);
|
||||
nb_logical_ports);
|
||||
}
|
||||
stop_meas(&ru->precoding_stats);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 0);
|
||||
|
||||
|
||||
start_meas(&ru->ofdm_mod_stats);
|
||||
nr_feptx0(ru,slot,start,1,aa);
|
||||
@@ -267,24 +284,6 @@ static void *nr_feptx_thread(void *param) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
void nr_init_feptx_thread(RU_t *ru) {
|
||||
|
||||
RU_proc_t *proc = &ru->proc;
|
||||
RU_feptx_t *feptx = proc->feptx;
|
||||
int i = 0;
|
||||
|
||||
for(i=0; i<16; i++){
|
||||
feptx[i].instance_cnt_feptx = -1;
|
||||
|
||||
pthread_mutex_init( &feptx[i].mutex_feptx, NULL);
|
||||
pthread_cond_init( &feptx[i].cond_feptx, NULL);
|
||||
|
||||
threadCreate(&feptx[i].pthread_feptx, nr_feptx_thread, (void*)&feptx[i], "feptx", -1, OAI_PRIORITY_RT);
|
||||
LOG_I(PHY,"init feptx thread %d\n", i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// is this supposed to generate a slot or a subframe???
|
||||
// seems to be hardcoded to numerology 1 (2 slots=1 subframe)
|
||||
@@ -320,95 +319,27 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) {
|
||||
}
|
||||
|
||||
|
||||
static void *nr_feptx_prec_thread(void *param) {
|
||||
void nr_init_feptx_thread(RU_t *ru) {
|
||||
|
||||
RU_prec_t *prec = (RU_prec_t *) param;
|
||||
RU_t *ru;
|
||||
NR_DL_FRAME_PARMS *fp;
|
||||
int symbol;
|
||||
int p;
|
||||
int aa;
|
||||
int32_t *bw;
|
||||
int32_t **txdataF;
|
||||
int32_t **txdataF_BF;
|
||||
RU_proc_t *proc = &ru->proc;
|
||||
RU_feptx_t *feptx = proc->feptx;
|
||||
int i = 0;
|
||||
char name[40];
|
||||
|
||||
while(!oai_exit)
|
||||
{
|
||||
if (wait_on_condition(&prec->mutex_feptx_prec,&prec->cond_feptx_prec,&prec->instance_cnt_feptx_prec,"NR feptx prec thread")<0) break;
|
||||
ru = prec->ru;
|
||||
symbol = prec->symbol;
|
||||
p = prec->p;
|
||||
aa = prec->aa;
|
||||
fp = ru->nr_frame_parms;
|
||||
bw = ru->beam_weights[0][p][aa];
|
||||
txdataF = ru->common.txdataF;
|
||||
txdataF_BF = ru->common.txdataF_BF;
|
||||
multadd_cpx_vector((int16_t*)&txdataF[p][symbol*fp->ofdm_symbol_size],
|
||||
(int16_t*)bw,
|
||||
(int16_t*)&txdataF_BF[aa][symbol*fp->ofdm_symbol_size],
|
||||
0,
|
||||
fp->ofdm_symbol_size,
|
||||
15);
|
||||
for(i=0; i<16; i++){
|
||||
feptx[i].instance_cnt_feptx = -1;
|
||||
|
||||
pthread_mutex_init( &feptx[i].mutex_feptx, NULL);
|
||||
pthread_cond_init( &feptx[i].cond_feptx, NULL);
|
||||
|
||||
if (release_thread(&prec->mutex_feptx_prec,&prec->instance_cnt_feptx_prec,"NR feptx thread")<0) break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void nr_feptx_prec_control(RU_t *ru,int frame,int tti_tx) {
|
||||
|
||||
int ret = 0;
|
||||
int i = 0;
|
||||
int symbol = 0;
|
||||
int p = 0;
|
||||
int aa = 0;
|
||||
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
|
||||
int nb_antenna_ports = fp->Lmax; // for now logical antenna ports corresponds to SSB
|
||||
RU_prec_t *prec = ru->proc.prec;
|
||||
PHY_VARS_gNB **gNB_list = ru->gNB_list,*gNB;
|
||||
|
||||
gNB = gNB_list[0];
|
||||
|
||||
start_meas(&ru->precoding_stats);
|
||||
for(i=0; i<nb_antenna_ports; ++i)
|
||||
memcpy((void*)ru->common.txdataF[i],
|
||||
(void*)gNB->common_vars.txdataF[i],
|
||||
fp->samples_per_slot_wCP*sizeof(int32_t));
|
||||
|
||||
for(symbol = 0; symbol < fp->symbols_per_slot; ++symbol){
|
||||
for(p=0; p<nb_antenna_ports; p++){
|
||||
for(aa=0;aa<ru->nb_tx;aa++){
|
||||
if ((fp->L_ssb >> p) & 0x01){
|
||||
while(1){
|
||||
if(prec[i].instance_cnt_feptx_prec == -1){
|
||||
AssertFatal((ret=pthread_mutex_lock(&prec[i].mutex_feptx_prec))==0,"mutex_lock return %d\n",ret);
|
||||
prec[i].instance_cnt_feptx_prec = 0;
|
||||
prec[i].symbol = symbol;
|
||||
prec[i].p = p;
|
||||
prec[i].aa = aa;
|
||||
prec[i].index = i;
|
||||
prec[i].ru = ru;
|
||||
AssertFatal(pthread_cond_signal(&prec[i].cond_feptx_prec) == 0,"ERROR pthread_cond_signal for gNB_L1_thread\n");
|
||||
AssertFatal((ret=pthread_mutex_unlock(&prec[i].mutex_feptx_prec))==0,"mutex_lock returns %d\n",ret);
|
||||
i = (i+1) % 16;
|
||||
break;
|
||||
}
|
||||
i = (i+1) % 16;
|
||||
}
|
||||
}//(frame_params->Lssb >> p) & 0x01
|
||||
}//aa
|
||||
}//p
|
||||
}//symbol
|
||||
|
||||
i = 0;
|
||||
while(1){
|
||||
if(prec[i].instance_cnt_feptx_prec == -1) ++i;
|
||||
if(i == 16) break;
|
||||
snprintf( name, sizeof(name)/sizeof(name[0]), "feptx_%d", i );
|
||||
threadCreate(&feptx[i].pthread_feptx, nr_feptx_thread, (void*)&feptx[i], name, -1, OAI_PRIORITY_RT);
|
||||
LOG_I(PHY,"init feptx thread %d\n", i);
|
||||
}
|
||||
|
||||
stop_meas(&ru->precoding_stats);
|
||||
}
|
||||
|
||||
|
||||
void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) {
|
||||
|
||||
int l,aa;
|
||||
@@ -464,21 +395,6 @@ void nr_feptx_prec(RU_t *ru,int frame,int tti_tx) {
|
||||
stop_meas(&ru->precoding_stats);
|
||||
}
|
||||
|
||||
void nr_init_feptx_prec_thread(RU_t *ru){
|
||||
|
||||
RU_proc_t *proc = &ru->proc;
|
||||
RU_prec_t *prec = proc->prec;
|
||||
int i=0;
|
||||
|
||||
for(i=0; i<16; ++i){
|
||||
prec[i].instance_cnt_feptx_prec = -1;
|
||||
pthread_mutex_init( &prec[i].mutex_feptx_prec, NULL);
|
||||
pthread_cond_init( &prec[i].cond_feptx_prec, NULL);
|
||||
|
||||
threadCreate(&prec[i].pthread_feptx_prec, nr_feptx_prec_thread, (void*)&prec[i], "nr_feptx_prec", -1, OAI_PRIORITY_RT);
|
||||
}
|
||||
}
|
||||
|
||||
void nr_fep0(RU_t *ru, int first_half) {
|
||||
|
||||
uint8_t start_symbol, end_symbol, l, aa;
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
#include "PHY/MODULATION/nr_modulation.h"
|
||||
#include "T.h"
|
||||
|
||||
#include <common/utils/system.h>
|
||||
|
||||
#include "assertions.h"
|
||||
#include "msc.h"
|
||||
|
||||
@@ -48,6 +50,7 @@
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
|
||||
extern int oai_exit;
|
||||
extern uint8_t nfapi_mode;
|
||||
/*
|
||||
int return_ssb_type(nfapi_config_request_t *cfg)
|
||||
@@ -150,13 +153,18 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) {
|
||||
void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
|
||||
int frame,int slot,
|
||||
int do_meas) {
|
||||
int aa;
|
||||
int p;
|
||||
uint8_t num_dci=0,num_pdsch_rnti;
|
||||
NR_DL_FRAME_PARMS *fp=&gNB->frame_parms;
|
||||
nfapi_nr_config_request_t *cfg = &gNB->gNB_config;
|
||||
NR_gNB_DLSCH_thread_t *dlsch_thread = gNB->dlsch_thread;
|
||||
int offset = gNB->CC_id;
|
||||
uint8_t ssb_frame_periodicity; // every how many frames SSB are generated
|
||||
int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP;
|
||||
int ret = 0;
|
||||
|
||||
num_dci = gNB->pdcch_vars.num_dci;
|
||||
num_pdsch_rnti = gNB->pdcch_vars.num_pdsch_rnti;
|
||||
|
||||
if (cfg->sch_config.ssb_periodicity.value < 20)
|
||||
ssb_frame_periodicity = 1;
|
||||
@@ -170,8 +178,21 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
|
||||
if (do_meas==1) start_meas(&gNB->phy_proc_tx);
|
||||
|
||||
// clear the transmit data array for the current subframe
|
||||
for (aa=0; aa<fp->Lmax; aa++) {
|
||||
memset(&gNB->common_vars.txdataF[aa][txdataF_offset],0,fp->samples_per_slot_wCP*sizeof(int32_t));
|
||||
for (p=0; p<fp->Lmax; p++) {
|
||||
memset(&gNB->common_vars.txdataF[p][txdataF_offset],0,fp->samples_per_slot_wCP*sizeof(int32_t));
|
||||
}
|
||||
|
||||
if (num_dci && (nfapi_mode == 0 || nfapi_mode == 1) && num_pdsch_rnti) {
|
||||
LOG_D(PHY, "PDSCH generation started (%d)\n", num_pdsch_rnti);
|
||||
ret = pthread_mutex_lock(&dlsch_thread->mutex_dlsch);
|
||||
AssertFatal(ret==0,"mutex_lock return %d\n",ret);
|
||||
dlsch_thread->instance_cnt_dlsch = 0;
|
||||
dlsch_thread->frame = frame;
|
||||
dlsch_thread->slot = slot;
|
||||
ret = pthread_cond_signal(&dlsch_thread->cond_dlsch);
|
||||
AssertFatal(ret==0,"ERROR pthread_cond_signal for nr_pdsch_thread\n");
|
||||
ret = pthread_mutex_unlock(&dlsch_thread->mutex_dlsch);
|
||||
AssertFatal(ret==0,"mutex_unlock return %d\n",ret);
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_COMMON_TX,1);
|
||||
@@ -181,8 +202,6 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_COMMON_TX,0);
|
||||
|
||||
num_dci = gNB->pdcch_vars.num_dci;
|
||||
num_pdsch_rnti = gNB->pdcch_vars.num_pdsch_rnti;
|
||||
|
||||
if (num_dci) {
|
||||
LOG_D(PHY, "[gNB %d] Frame %d slot %d \
|
||||
@@ -194,8 +213,8 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
|
||||
gNB->nr_gold_pdcch_dmrs[slot],
|
||||
&gNB->common_vars.txdataF[0][txdataF_offset], // hardcoded to beam 0
|
||||
AMP, *fp, *cfg);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0);
|
||||
if (num_pdsch_rnti) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0);
|
||||
/*if (num_pdsch_rnti) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
|
||||
LOG_D(PHY, "PDSCH generation started (%d)\n", num_pdsch_rnti);
|
||||
nr_generate_pdsch(gNB->dlsch[0][0],
|
||||
@@ -208,13 +227,89 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
|
||||
&gNB->dlsch_modulation_stats);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
// wait pdsch thread to finish
|
||||
if (wait_on_busy_condition(&dlsch_thread->mutex_dlsch,&dlsch_thread->cond_dlsch,&dlsch_thread->instance_cnt_dlsch,"NR pdsch thread")<0) return;
|
||||
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,0);
|
||||
}
|
||||
|
||||
static void *nr_pdsch_thread(void *param) {
|
||||
|
||||
PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param;
|
||||
NR_gNB_DLSCH_thread_t *dlsch;
|
||||
NR_DL_FRAME_PARMS *fp;
|
||||
nfapi_nr_config_request_t *cfg;
|
||||
int frame, slot;
|
||||
int ret = 0;
|
||||
|
||||
while(!oai_exit)
|
||||
{
|
||||
dlsch = gNB->dlsch_thread;
|
||||
fp = &gNB->frame_parms;
|
||||
cfg = &gNB->gNB_config;
|
||||
frame = dlsch->frame;
|
||||
slot = dlsch->slot;
|
||||
|
||||
if (wait_on_condition(&dlsch->mutex_dlsch,&dlsch->cond_dlsch,&dlsch->instance_cnt_dlsch,"NR pdsch thread")<0) break;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
|
||||
nr_generate_pdsch(gNB->dlsch[0][0],
|
||||
&gNB->pdcch_vars.dci_alloc[0],
|
||||
gNB->nr_gold_pdsch_dmrs[slot],
|
||||
gNB->common_vars.txdataF,
|
||||
AMP, frame, slot, fp, cfg,
|
||||
&gNB->dlsch_encoding_stats,
|
||||
&gNB->dlsch_scrambling_stats,
|
||||
&gNB->dlsch_modulation_stats);
|
||||
|
||||
|
||||
ret = pthread_mutex_lock(&dlsch->mutex_dlsch);
|
||||
AssertFatal(ret==0,"mutex_lock return %d\n",ret);
|
||||
dlsch->instance_cnt_dlsch = -1;
|
||||
ret = pthread_cond_broadcast(&dlsch->cond_dlsch);
|
||||
AssertFatal(ret==0,"ERROR pthread_cond_signal for nr_pdsch_thread\n");
|
||||
ret = pthread_mutex_unlock(&dlsch->mutex_dlsch);
|
||||
AssertFatal(ret==0,"mutex_unlock return %d\n",ret);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void nr_init_pdsch_thread(PHY_VARS_gNB *gNB) {
|
||||
|
||||
gNB->dlsch_thread = (NR_gNB_DLSCH_thread_t *)malloc16(sizeof(NR_gNB_DLSCH_thread_t));
|
||||
|
||||
gNB->dlsch_thread->instance_cnt_dlsch = -1;
|
||||
gNB->dlsch_thread->frame = 0;
|
||||
gNB->dlsch_thread->slot = 0;
|
||||
|
||||
pthread_mutex_init( &gNB->dlsch_thread->mutex_dlsch, NULL);
|
||||
pthread_cond_init( &gNB->dlsch_thread->cond_dlsch, NULL);
|
||||
|
||||
threadCreate(&gNB->dlsch_thread->pthread_dlsch, nr_pdsch_thread, (void*)gNB, "pdsch", -1, OAI_PRIORITY_RT);
|
||||
LOG_I(PHY,"init pdsch thread\n");
|
||||
|
||||
}
|
||||
|
||||
void nr_kill_pdsch_thread(PHY_VARS_gNB *gNB) {
|
||||
|
||||
pthread_mutex_lock(&gNB->dlsch_thread->mutex_dlsch);
|
||||
gNB->dlsch_thread->instance_cnt_dlsch = 0;
|
||||
pthread_cond_signal(&gNB->dlsch_thread->cond_dlsch);
|
||||
pthread_mutex_unlock(&gNB->dlsch_thread->mutex_dlsch);
|
||||
|
||||
pthread_mutex_destroy( &gNB->dlsch_thread->mutex_dlsch);
|
||||
pthread_cond_destroy( &gNB->dlsch_thread->cond_dlsch);
|
||||
|
||||
free16(gNB->dlsch_thread,sizeof(NR_gNB_DLSCH_t));
|
||||
|
||||
LOG_I(PHY,"Destroying dlsch mutex/cond\n");
|
||||
}
|
||||
|
||||
void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int UE_id, uint8_t harq_pid)
|
||||
{
|
||||
|
||||
@@ -53,6 +53,8 @@ void nr_fep_full(RU_t *ru, int slot);
|
||||
void nr_fep_full_2thread(RU_t *ru, int slot);
|
||||
void feptx_prec(RU_t *ru,int frame_tx,int tti_tx);
|
||||
int nr_phy_init_RU(RU_t *ru);
|
||||
void nr_init_pdsch_thread(PHY_VARS_gNB *gNB);
|
||||
void nr_kill_pdsch_thread(PHY_VARS_gNB *gNB);
|
||||
|
||||
void nr_configure_css_dci_initial(nfapi_nr_dl_config_pdcch_parameters_rel15_t* pdcch_params,
|
||||
nr_scs_e scs_common,
|
||||
|
||||
Reference in New Issue
Block a user