Merge remote-tracking branch 'origin/fix-nrsoftmodem-stop' into integration_2022_wk33

This commit is contained in:
Robert Schmidt
2022-08-19 18:22:23 +02:00
65 changed files with 737 additions and 693 deletions
+4 -11
View File
@@ -625,9 +625,10 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
gNB->first_run_I0_measurements = 1;
common_vars->rxdata = (int32_t **)malloc16(Prx*sizeof(int32_t*));
common_vars->txdataF = (int32_t **)malloc16(Ptx*sizeof(int32_t*));
common_vars->rxdataF = (int32_t **)malloc16(Prx*sizeof(int32_t*));
/* Do NOT allocate per-antenna txdataF/rxdataF: the gNB gets a pointer to the
* RU to copy/recover freq-domain memory from there */
common_vars->beam_id = (uint8_t **)malloc16(Ptx*sizeof(uint8_t*));
for (i=0;i<Ptx;i++){
@@ -638,10 +639,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
common_vars->beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t));
memset(common_vars->beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame);
}
for (i=0;i<Prx;i++){
common_vars->rxdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t));
common_vars->rxdata[i] = (int32_t*)malloc16_clear(fp->samples_per_frame*sizeof(int32_t));
}
common_vars->debugBuff = (int32_t*)malloc16_clear(fp->samples_per_frame*sizeof(int32_t)*100);
common_vars->debugBuff_sample_offset = 0;
@@ -784,13 +781,9 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(common_vars->beam_id[i]);
}
for (int i = 0; i < Prx; ++i) {
free_and_zero(common_vars->rxdataF[i]);
free_and_zero(common_vars->rxdata[i]);
}
/* Do NOT free per-antenna txdataF/rxdataF: the gNB gets a pointer to the
* RU's txdataF/rxdataF, and the RU will free that */
free_and_zero(common_vars->txdataF);
free_and_zero(common_vars->rxdata);
free_and_zero(common_vars->rxdataF);
free_and_zero(common_vars->beam_id);
+6 -3
View File
@@ -176,8 +176,11 @@ void nr_phy_free_RU(RU_t *ru)
LOG_I(PHY, "Feeing RU signal buffers (if_south %s) nb_tx %d\n", ru_if_types[ru->if_south], ru->nb_tx);
if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so free memory for time-domain signals
for (i = 0; i < ru->nb_tx; i++)
free_and_zero(ru->common.txdata[i]);
// Hack: undo what is done at allocation
for (i = 0; i < ru->nb_tx; i++) {
int32_t *p = &ru->common.txdata[i][-ru->sf_extension];
free_and_zero(p);
}
free_and_zero(ru->common.txdata);
for (i = 0; i < ru->nb_rx; i++)
@@ -199,7 +202,7 @@ void nr_phy_free_RU(RU_t *ru)
// free FFT output buffers (RX)
for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdataF[i]);
free_and_zero(ru->common.rxdataF);
free_and_zero(ru->common.rxdataF);
for (j=0;j<NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX;j++) {
for (i = 0; i < ru->nb_rx; i++)
+1 -1
View File
@@ -59,7 +59,7 @@
uint64_t deadline,
uint64_t period);*/
extern volatile int oai_exit;
extern int oai_exit;
void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) {
int i, r, aa, layer;
+1 -1
View File
@@ -44,7 +44,7 @@
#include <executables/split_headers.h>
extern WORKER_CONF_t get_thread_worker_conf(void);
extern volatile int oai_exit;
extern int oai_exit;
+4 -2
View File
@@ -425,11 +425,13 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
encoder_implemparams_t* perJobImpp=(encoder_implemparams_t*)NotifiedFifoData(req);
*perJobImpp=impp;
perJobImpp->macro_num=j;
pushTpool(gNB->threadPool,req);
pushTpool(&gNB->threadPool, req);
nbJobs++;
}
while(nbJobs) {
notifiedFIFO_elt_t *req=pullTpool(&nf, gNB->threadPool);
notifiedFIFO_elt_t *req=pullTpool(&nf, &gNB->threadPool);
if (req == NULL)
break; // Tpool has been stopped
delNotifiedFIFO_elt(req);
nbJobs--;
@@ -553,7 +553,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
E = nr_get_E(G, harq_process->C, Qm, n_layers, r);
union ldpcReqUnion id = {.s={ulsch->rnti,frame,nr_tti_rx,0,0}};
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(ldpcDecode_t), id.p, phy_vars_gNB->respDecode, nr_processULSegment_ptr);
notifiedFIFO_elt_t *req = newNotifiedFIFO_elt(sizeof(ldpcDecode_t), id.p, &phy_vars_gNB->respDecode, nr_processULSegment_ptr);
ldpcDecode_t * rdata=(ldpcDecode_t *) NotifiedFifoData(req);
rdata->gNB = phy_vars_gNB;
@@ -574,7 +574,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
rdata->ulsch = ulsch;
rdata->ulsch_id = ULSCH_id;
rdata->tbslbrm = pusch_pdu->maintenance_parms_v3.tbSizeLbrmBytes;
pushTpool(phy_vars_gNB->threadPool,req);
pushTpool(&phy_vars_gNB->threadPool, req);
phy_vars_gNB->nbDecode++;
LOG_D(PHY,"Added a block to decode, in pipe: %d\n",phy_vars_gNB->nbDecode);
r_offset += E;
@@ -207,8 +207,8 @@ bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool
} else {
if ( !last ) {
int nb=abortTpool(&(pool_dl), req->key);
nb+=abortNotifiedFIFO(nf_p, req->key);
int nb=abortTpoolJob(&(pool_dl), req->key);
nb+=abortNotifiedFIFOJob(nf_p, req->key);
LOG_D(PHY,"downlink segment error %d/%d, aborted %d segments\n",rdata->segment_r,rdata->nbSegments, nb);
LOG_D(PHY, "DLSCH %d in error\n",rdata->dlsch_id);
last = true;
@@ -615,6 +615,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
}
for (r=0; r<nbDecode; r++) {
notifiedFIFO_elt_t *req=pullTpool(&nf, &(pool_dl));
if (req == NULL)
break; // Tpool has been stopped
bool last = false;
if (r == nbDecode - 1)
last = true;
+6 -5
View File
@@ -982,13 +982,14 @@ typedef uint8_t(encoder_if_t)(uint8_t *input,
uint8_t *output,
uint8_t F);
extern int oai_exit;
static inline void wait_sync(char *thread_name) {
int rc;
printf( "waiting for sync (%s,%d/%p,%p,%p)\n",thread_name,sync_var,&sync_var,&sync_cond,&sync_mutex);
AssertFatal((rc = pthread_mutex_lock( &sync_mutex ))==0,"sync mutex lock error");
while (sync_var<0)
while (sync_var<0 && !oai_exit)
pthread_cond_wait( &sync_cond, &sync_mutex );
AssertFatal((rc = pthread_mutex_unlock( &sync_mutex ))==0,"sync mutex unlock error");
@@ -1011,7 +1012,7 @@ static inline int wakeup_thread(pthread_mutex_t *mutex,
int sleep_cnt=0;
AssertFatal((rc = pthread_mutex_lock(mutex))==0,"wakeup_thread(): error locking mutex for %s (%d %s, %p)\n", name, rc, strerror(rc), (void *)mutex);
while (*instance_cnt == 0) {
while (*instance_cnt == 0 && !oai_exit) {
AssertFatal((rc = pthread_mutex_unlock(mutex))==0,"wakeup_thread(): error unlocking mutex for %s (%d %s, %p)\n", name, rc, strerror(rc), (void *)mutex);
sleep_cnt++;
@@ -1046,7 +1047,7 @@ static inline int timedwait_on_condition(pthread_mutex_t *mutex,
struct timespec now, abstime;
AssertFatal((rc = pthread_mutex_lock(mutex))==0,"[SCHED][eNB] timedwait_on_condition(): error locking mutex for %s (%d %s, %p)\n", name, rc, strerror(rc), (void *)mutex);
while (*instance_cnt < 0) {
while (*instance_cnt < 0 && !oai_exit) {
clock_gettime(CLOCK_REALTIME, &now);
// most of the time the thread is waiting here
// proc->instance_cnt_rxtx is -1
@@ -1073,7 +1074,7 @@ static inline int wait_on_condition(pthread_mutex_t *mutex,
int rc;
AssertFatal((rc = pthread_mutex_lock(mutex))==0,"[SCHED][eNB] wait_on_condition(): error locking mutex for %s (%d %s, %p)\n", name, rc, strerror(rc), (void *)mutex);
while (*instance_cnt < 0) {
while (*instance_cnt < 0 && !oai_exit) {
// most of the time the thread is waiting here
// proc->instance_cnt_rxtx is -1
pthread_cond_wait(cond,mutex); // this unlocks mutex_rxtx while waiting and then locks it again
@@ -1091,7 +1092,7 @@ static inline int wait_on_busy_condition(pthread_mutex_t *mutex,
int rc;
AssertFatal((rc = pthread_mutex_lock(mutex))==0,"[SCHED][eNB] wait_on_busy_condition(): error locking mutex for %s (%d %s, %p)\n", name, rc, strerror(rc), (void *)mutex);
while (*instance_cnt == 0) {
while (*instance_cnt == 0 && !oai_exit) {
// most of the time the thread will skip this
// waits only if proc->instance_cnt_rxtx is 0
pthread_cond_wait(cond,mutex); // this unlocks mutex_rxtx while waiting and then locks it again
+7 -11
View File
@@ -396,10 +396,6 @@ typedef struct {
} NR_gNB_SRS_t;
typedef struct {
/// \brief Pointers (dynamic) to the received data in the time domain.
/// - first index: rx antenna [0..nb_antennas_rx[
/// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
int32_t **rxdata;
/// \brief Pointers (dynamic) to the received data in the frequency domain.
/// - first index: rx antenna [0..nb_antennas_rx[
/// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
@@ -890,13 +886,13 @@ typedef struct PHY_VARS_gNB_s {
time_stats_t rx_dft_stats;
time_stats_t ulsch_freq_offset_estimation_stats;
*/
notifiedFIFO_t *respDecode;
notifiedFIFO_t *resp_L1;
notifiedFIFO_t *L1_tx_free;
notifiedFIFO_t *L1_tx_filled;
notifiedFIFO_t *L1_tx_out;
notifiedFIFO_t *resp_RU_tx;
tpool_t *threadPool;
notifiedFIFO_t respDecode;
notifiedFIFO_t resp_L1;
notifiedFIFO_t L1_tx_free;
notifiedFIFO_t L1_tx_filled;
notifiedFIFO_t L1_tx_out;
notifiedFIFO_t resp_RU_tx;
tpool_t threadPool;
int nbDecode;
uint8_t thread_pool_size;
int number_of_nr_dlsch_max;
+8 -3
View File
@@ -432,7 +432,10 @@ bool dlsch_procedures(PHY_VARS_eNB *eNB,
if ( proc->threadPool->activated ) {
// Wait all other threads finish to process
while (proc->nbEncode) {
delNotifiedFIFO_elt(pullTpool(proc->respEncode, proc->threadPool));
notifiedFIFO_elt_t *res = pullTpool(proc->respEncode, proc->threadPool);
if (res == NULL)
break; // Tpool has been stopped
delNotifiedFIFO_elt(res);
proc->nbEncode--;
}
}
@@ -1328,8 +1331,8 @@ void postDecode(L1_rxtx_proc_t *proc, notifiedFIFO_elt_t *req) {
sz);
} else {
if ( rdata->nbSegments != ulsch_harq->processedSegments ) {
int nb=abortTpool(proc->threadPool, req->key);
nb+=abortNotifiedFIFO(proc->respDecode, req->key);
int nb=abortTpoolJob(proc->threadPool, req->key);
nb+=abortNotifiedFIFOJob(proc->respDecode, req->key);
proc->nbDecode-=nb;
LOG_D(PHY,"uplink segment error %d/%d, aborted %d segments\n",rdata->segment_r,rdata->nbSegments, nb);
AssertFatal(ulsch_harq->processedSegments+nb == rdata->nbSegments,"processed: %d, aborted: %d, total %d\n",
@@ -1502,6 +1505,8 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
while (proc->nbDecode > 0) {
notifiedFIFO_elt_t *req=pullTpool(proc->respDecode, proc->threadPool);
if (req == NULL)
break; // Tpool has been stopped
postDecode(proc, req);
delNotifiedFIFO_elt(req);
}
+4 -2
View File
@@ -163,7 +163,9 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT) {
notifiedFIFO_elt_t *res;
res = pullTpool(gNB->L1_tx_free, gNB->threadPool);
res = pullTpool(&gNB->L1_tx_free, &gNB->threadPool);
if (res == NULL)
return; // Tpool has been stopped, nothing to process
processingData_L1tx_t *msgTx = (processingData_L1tx_t *)NotifiedFifoData(res);
const time_stats_t ts = exec_time_stats_NotifiedFIFO(res);
merge_meas(&gNB->phy_proc_tx, &ts);
@@ -210,7 +212,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
for (int i=0; i<number_ul_dci_pdu; i++)
msgTx->ul_pdcch_pdu[i] = UL_dci_req->ul_dci_pdu_list[i];
pushNotifiedFIFO(gNB->L1_tx_filled,res);
pushNotifiedFIFO(&gNB->L1_tx_filled,res);
}
for (int i = 0; i < number_ul_tti_pdu; i++) {
+32 -2
View File
@@ -453,6 +453,24 @@ void nr_init_feptx_thread(RU_t *ru) {
}
void nr_kill_feptx_thread(RU_t *ru) {
RU_proc_t *proc = &ru->proc;
for (int i = 0; i < ru->nb_tx * 2; i++) {
RU_feptx_t *feptx = &proc->feptx[i];
if (feptx->pthread_feptx == 0)
continue;
pthread_mutex_lock(&feptx->mutex_feptx);
feptx->instance_cnt_feptx = 0;
pthread_mutex_unlock(&feptx->mutex_feptx);
pthread_cond_signal(&feptx->cond_feptx);
LOG_I(PHY, "Joining pthread_feptx %d\n", i);
pthread_join(feptx->pthread_feptx, NULL);
pthread_mutex_destroy(&feptx->mutex_feptx);
pthread_cond_destroy(&feptx->cond_feptx);
}
}
void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) {
@@ -590,6 +608,19 @@ void nr_init_feprx_thread(RU_t *ru) {
threadCreate(&proc->pthread_fep, nr_feprx_thread, (void*)ru, "feprx", -1, OAI_PRIORITY_RT);
}
void nr_kill_feprx_thread(RU_t *ru) {
RU_proc_t *proc = &ru->proc;
if (proc->pthread_fep == 0)
return;
LOG_I(PHY, "Joining pthread_feprx\n");
pthread_mutex_lock(&proc->mutex_fep);
proc->instance_cnt_fep = 0;
pthread_mutex_unlock(&proc->mutex_fep);
pthread_cond_signal(&proc->cond_fep);
pthread_join(proc->pthread_fep, NULL);
pthread_mutex_destroy(&proc->mutex_fep);
pthread_cond_destroy(&proc->cond_fep);
}
void nr_fep_full_2thread(RU_t *ru, int slot) {
@@ -617,8 +648,7 @@ void nr_fep_full_2thread(RU_t *ru, int slot) {
}
if (proc->instance_cnt_fep==0) {
printf("[RU] FEP thread busy\n");
exit_fun("FEP thread busy");
LOG_E(PHY, "RU FEP thread busy, exiting %s\n", __func__);
pthread_mutex_unlock( &proc->mutex_fep );
return;
}
+5 -30
View File
@@ -206,8 +206,8 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
} else {
if ( rdata->nbSegments != ulsch_harq->processedSegments ) {
int nb=abortTpool(gNB->threadPool, req->key);
nb+=abortNotifiedFIFO(gNB->respDecode, req->key);
int nb = abortTpoolJob(&gNB->threadPool, req->key);
nb += abortNotifiedFIFOJob(&gNB->respDecode, req->key);
gNB->nbDecode-=nb;
LOG_D(PHY,"uplink segment error %d/%d, aborted %d segments\n",rdata->segment_r,rdata->nbSegments, nb);
LOG_D(PHY, "ULSCH %d in error\n",rdata->ulsch_id);
@@ -363,7 +363,9 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
G);
while (gNB->nbDecode > 0) {
notifiedFIFO_elt_t *req=pullTpool(gNB->respDecode, gNB->threadPool);
notifiedFIFO_elt_t *req = pullTpool(&gNB->respDecode, &gNB->threadPool);
if (req == NULL)
break; // Tpool has been stopped
nr_postDecode(gNB, req);
delNotifiedFIFO_elt(req);
}
@@ -580,33 +582,6 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
}
void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
uint8_t symbol;
unsigned char aa;
for(symbol = 0; symbol < (gNB->frame_parms.Ncp==EXTENDED?12:14); symbol++) {
for (aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) {
nr_slot_fep_ul(&gNB->frame_parms,
gNB->common_vars.rxdata[aa],
gNB->common_vars.rxdataF[aa],
symbol,
slot_rx,
0);
}
}
for (aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) {
apply_nr_rotation_ul(&gNB->frame_parms,
gNB->common_vars.rxdataF[aa],
slot_rx,
0,
gNB->frame_parms.Ncp==EXTENDED?12:14,
gNB->frame_parms.ofdm_symbol_size);
}
}
int fill_srs_reported_symbol_list(nfapi_nr_srs_indication_reported_symbol_t *reported_symbol_list,
const nfapi_nr_srs_pdu_t *srs_pdu,
const int N_RB_UL,
+2 -1
View File
@@ -37,7 +37,6 @@
void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx);
void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_scf_t *cfg, NR_DL_FRAME_PARMS *fp);
void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, int frame_tx, int slot_tx, int do_meas);
void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx);
int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx);
void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot);
void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_dl_tti_ssb_pdu ssb_pdu);
@@ -45,11 +44,13 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx);
void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx);
void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa);
void nr_init_feptx_thread(RU_t *ru);
void nr_kill_feptx_thread(RU_t *ru);
void fep_full(RU_t *ru,int slot);
void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx);
void nr_init_feptx_prec_thread(RU_t *ru);
void nr_feptx_prec_control(RU_t *ru,int frame,int tti_tx);
void nr_init_feprx_thread(RU_t *ru);
void nr_kill_feprx_thread(RU_t *ru);
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);
+1 -1
View File
@@ -20,7 +20,7 @@
*/
openair0_device openair0;
volatile int oai_exit=0;
int oai_exit=0;
void exit_function(const char* file, const char* function, const int line,const char *s) {
const char * msg= s==NULL ? "no comment": s;
+1 -3
View File
@@ -363,8 +363,7 @@ int main(int argc, char **argv)
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = calloc(1, sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0];
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
initTpool(gNBthreads, gNB->threadPool, true);
initTpool(gNBthreads, &gNB->threadPool, true);
//gNB_config = &gNB->gNB_config;
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
frame_parms->nb_antennas_tx = n_tx;
@@ -625,7 +624,6 @@ int main(int argc, char **argv)
reset_DLSCH_struct(gNB, &msgDataTx);
phy_free_nr_gNB(gNB);
free(gNB->threadPool);
free(RC.gNB[0]);
free(RC.gNB);
+6 -10
View File
@@ -1042,16 +1042,12 @@ int main(int argc, char **argv)
snrRun = 0;
int n_errs = 0;
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
initTpool(gNBthreads, gNB->threadPool, true);
gNB->L1_tx_free = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
gNB->L1_tx_filled = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
gNB->L1_tx_out = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
initNotifiedFIFO(gNB->L1_tx_free);
initNotifiedFIFO(gNB->L1_tx_filled);
initNotifiedFIFO(gNB->L1_tx_out);
initTpool(gNBthreads, &gNB->threadPool, true);
initNotifiedFIFO(&gNB->L1_tx_free);
initNotifiedFIFO(&gNB->L1_tx_filled);
initNotifiedFIFO(&gNB->L1_tx_out);
// we create 2 threads for L1 tx processing
notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0,gNB->L1_tx_free,processSlotTX);
notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0,&gNB->L1_tx_free,processSlotTX);
processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx);
init_DLSCH_struct(gNB, msgDataTx);
msgDataTx->slot = slot;
@@ -1127,7 +1123,7 @@ int main(int argc, char **argv)
Sched_INFO.UL_tti_req = gNB_mac->UL_tti_req_ahead[0];
Sched_INFO.UL_dci_req = NULL;
Sched_INFO.TX_req = &gNB_mac->TX_req[0];
pushNotifiedFIFO(gNB->L1_tx_free,msgL1Tx);
pushNotifiedFIFO(&gNB->L1_tx_free,msgL1Tx);
nr_schedule_response(&Sched_INFO);
/* PTRS values for DLSIM calculations */
+1 -1
View File
@@ -33,7 +33,7 @@
#ifndef __NR_UNITARY_DEFS__H__
#define __NR_UNITARY_DEFS__H__
volatile int oai_exit=0;
int oai_exit=0;
void exit_function(const char* file, const char* function, const int line, const char *s) {
const char * msg= s==NULL ? "no comment": s;
+6
View File
@@ -390,6 +390,10 @@ int main(int argc, char **argv)
cfg->carrier_config.num_rx_ant.value = n_rx;
nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions);
phy_init_nr_gNB(gNB,0,0);
/* RU handles rxdataF, and gNB just has a pointer. Here, we don't have an RU,
* so we need to allocate that memory as well. */
for (i = 0; i < n_rx; i++)
gNB->common_vars.rxdataF[i] = malloc16_clear(gNB->frame_parms.samples_per_frame_wCP*sizeof(int32_t));
double fs,txbw,rxbw;
uint32_t samples;
@@ -702,6 +706,8 @@ int main(int argc, char **argv)
free_channel_desc_scm(UE2gNB);
term_freq_channel();
for (i = 0; i < n_rx; i++)
free(gNB->common_vars.rxdataF[i]);
phy_free_nr_gNB(gNB);
free(RC.gNB[0]);
free(RC.gNB);
+5 -9
View File
@@ -87,8 +87,8 @@ int nr_postDecode_sim(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
rdata->Kr_bytes - (ulsch_harq->F>>3) -((ulsch_harq->C>1)?3:0));
} else {
if ( rdata->nbSegments != ulsch_harq->processedSegments ) {
int nb=abortTpool(gNB->threadPool, req->key);
nb+=abortNotifiedFIFO(gNB->respDecode, req->key);
int nb=abortTpoolJob(&gNB->threadPool, req->key);
nb+=abortNotifiedFIFOJob(&gNB->respDecode, req->key);
gNB->nbDecode-=nb;
AssertFatal(ulsch_harq->processedSegments+nb == rdata->nbSegments,"processed: %d, aborted: %d, total %d\n",
ulsch_harq->processedSegments, nb, rdata->nbSegments);
@@ -387,11 +387,9 @@ int main(int argc, char **argv)
gNB = RC.gNB[0];
//gNB_config = &gNB->gNB_config;
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
char tp_param[] = "n";
initTpool(tp_param, gNB->threadPool, true);
initNotifiedFIFO(gNB->respDecode);
initTpool(tp_param, &gNB->threadPool, true);
initNotifiedFIFO(&gNB->respDecode);
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
frame_parms->N_RB_DL = N_RB_DL;
frame_parms->N_RB_UL = N_RB_UL;
@@ -586,7 +584,7 @@ int main(int argc, char **argv)
nr_ulsch_decoding(gNB, UE_id, channel_output_fixed, frame_parms, rel15_ul,
frame, subframe, harq_pid, G);
while (gNB->nbDecode > 0) {
notifiedFIFO_elt_t *req=pullTpool(gNB->respDecode, gNB->threadPool);
notifiedFIFO_elt_t *req=pullTpool(&gNB->respDecode, &gNB->threadPool);
ret = nr_postDecode_sim(gNB, req);
delNotifiedFIFO_elt(req);
}
@@ -636,8 +634,6 @@ int main(int argc, char **argv)
free(UE);
phy_free_nr_gNB(gNB);
free(gNB->threadPool);
free(gNB->respDecode);
free(RC.gNB[0]);
free(RC.gNB);
+47 -30
View File
@@ -700,9 +700,6 @@ int main(int argc, char **argv)
RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0];
gNB->ofdm_offset_divisor = UINT_MAX;
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
initNotifiedFIFO(gNB->respDecode);
char tp_param[80];
if (threadCnt>0)
sprintf(tp_param,"-1");
@@ -714,15 +711,12 @@ int main(int argc, char **argv)
s_offset += 3;
}
initTpool(tp_param, gNB->threadPool, false);
initNotifiedFIFO(gNB->respDecode);
gNB->L1_tx_free = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
gNB->L1_tx_filled = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
gNB->L1_tx_out = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
initNotifiedFIFO(gNB->L1_tx_free);
initNotifiedFIFO(gNB->L1_tx_filled);
initNotifiedFIFO(gNB->L1_tx_out);
notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0,gNB->L1_tx_free,NULL);
initTpool(tp_param, &gNB->threadPool, false);
initNotifiedFIFO(&gNB->respDecode);
initNotifiedFIFO(&gNB->L1_tx_free);
initNotifiedFIFO(&gNB->L1_tx_filled);
initNotifiedFIFO(&gNB->L1_tx_out);
notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t), 0, &gNB->L1_tx_free, NULL);
processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx);
msgDataTx->slot = -1;
//gNB_config = &gNB->gNB_config;
@@ -800,8 +794,17 @@ int main(int argc, char **argv)
gNB->chest_freq = chest_type[0];
gNB->chest_time = chest_type[1];
phy_init_nr_gNB(gNB,0,1);
/* RU handles rxdataF, and gNB just has a pointer. Here, we don't have an RU,
* so we need to allocate that memory as well. */
for (i = 0; i < n_rx; i++)
gNB->common_vars.rxdataF[i] = malloc16_clear(gNB->frame_parms.samples_per_frame_wCP*sizeof(int32_t));
N_RB_DL = gNB->frame_parms.N_RB_DL;
/* no RU: need to have rxdata */
c16_t **rxdata;
rxdata = malloc(n_rx * sizeof(*rxdata));
for (int i = 0; i < n_rx; ++i)
rxdata[i] = malloc(gNB->frame_parms.samples_per_frame * sizeof(**rxdata));
NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0];
@@ -1031,18 +1034,16 @@ int main(int argc, char **argv)
fseek(input_fd,file_offset*sizeof(int16_t)*2,SEEK_SET);
for (int irx=0; irx<frame_parms->nb_antennas_rx; irx++) {
fseek(input_fd,irx*(slot_length+15)*sizeof(int16_t)*2,SEEK_SET); // matlab adds samlples to the end to emulate channel delay
read_errors+=fread((void*)&gNB->common_vars.rxdata[irx][slot_offset-delay],
sizeof(int16_t),
slot_length<<1,
input_fd);
read_errors += fread((void *)&rxdata[irx][slot_offset-delay], sizeof(int16_t), slot_length<<1, input_fd);
if (read_errors==0) {
printf("error reading file\n");
exit(1);
}
for (int i=0;i<16;i+=2) printf("slot_offset %d : %d,%d\n",
slot_offset,
((int16_t*)&gNB->common_vars.rxdata[irx][slot_offset])[i],
((int16_t*)&gNB->common_vars.rxdata[irx][slot_offset])[1+i]);
for (int i=0;i<16;i+=2)
printf("slot_offset %d : %d,%d\n",
slot_offset,
rxdata[irx][slot_offset].r,
rxdata[irx][slot_offset].i);
}
mod_order = nr_get_Qm_ul(Imcs, mcs_table);
@@ -1168,7 +1169,7 @@ int main(int argc, char **argv)
}
// prepare ULSCH/PUSCH reception
pushNotifiedFIFO(gNB->L1_tx_free,msgL1Tx); // to unblock the process in the beginning
pushNotifiedFIFO(&gNB->L1_tx_free, msgL1Tx); // to unblock the process in the beginning
nr_schedule_response(Sched_INFO);
// --------- setting parameters for UE --------
@@ -1331,12 +1332,11 @@ int main(int argc, char **argv)
for (i=0; i<slot_length; i++) {
for (ap=0; ap<frame_parms->nb_antennas_rx; ap++) {
((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i) + (delay*2)] = (int16_t)((r_re[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); // convert to fixed point
((int16_t*) &gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1 + (delay*2)] = (int16_t)((r_im[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0)));
rxdata[ap][slot_offset+i+delay].r = (int16_t)((r_re[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0))); // convert to fixed point
rxdata[ap][slot_offset+i+delay].i = (int16_t)((r_im[ap][i]) + (sqrt(sigma/2)*gaussdouble(0.0,1.0)));
/* Add phase noise if enabled */
if (pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
phase_noise(ts, &((int16_t*)&gNB->common_vars.rxdata[ap][slot_offset])[(2*i)],
&((int16_t*)&gNB->common_vars.rxdata[ap][slot_offset])[(2*i)+1]);
phase_noise(ts, &rxdata[ap][slot_offset].r, &rxdata[ap][slot_offset].i);
}
}
}
@@ -1362,19 +1362,36 @@ int main(int argc, char **argv)
gNB->UL_INFO.rx_ind.number_of_pdus = 0;
gNB->UL_INFO.crc_ind.number_crcs = 0;
phy_procedures_gNB_common_RX(gNB, frame, slot);
for(uint8_t symbol = 0; symbol < (gNB->frame_parms.Ncp == EXTENDED ? 12 : 14); symbol++) {
for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++)
nr_slot_fep_ul(&gNB->frame_parms,
(int32_t*) rxdata[aa],
gNB->common_vars.rxdataF[aa],
symbol,
slot,
0);
}
for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) {
apply_nr_rotation_ul(&gNB->frame_parms,
gNB->common_vars.rxdataF[aa],
slot,
0,
gNB->frame_parms.Ncp == EXTENDED ? 12 : 14,
gNB->frame_parms.ofdm_symbol_size);
}
ul_proc_error = phy_procedures_gNB_uespec_RX(gNB, frame, slot);
if (n_trials==1 && round==0) {
LOG_M("rxsig0.m","rx0",&gNB->common_vars.rxdata[0][slot_offset],slot_length,1,1);
LOG_M("rxsig0.m","rx0",&rxdata[0][slot_offset],slot_length,1,1);
LOG_M("rxsigF0.m","rxsF0",gNB->common_vars.rxdataF[0],14*frame_parms->ofdm_symbol_size,1,1);
if (precod_nbr_layers > 1) {
LOG_M("rxsig1.m","rx1",&gNB->common_vars.rxdata[1][slot_offset],slot_length,1,1);
LOG_M("rxsig1.m","rx1",&rxdata[1][slot_offset],slot_length,1,1);
LOG_M("rxsigF1.m","rxsF1",gNB->common_vars.rxdataF[1],14*frame_parms->ofdm_symbol_size,1,1);
if (precod_nbr_layers==4) {
LOG_M("rxsig2.m","rx2",&gNB->common_vars.rxdata[2][slot_offset],slot_length,1,1);
LOG_M("rxsig3.m","rx3",&gNB->common_vars.rxdata[3][slot_offset],slot_length,1,1);
LOG_M("rxsig2.m","rx2",&rxdata[2][slot_offset],slot_length,1,1);
LOG_M("rxsig3.m","rx3",&rxdata[3][slot_offset],slot_length,1,1);
LOG_M("rxsigF2.m","rxsF2",gNB->common_vars.rxdataF[2],14*frame_parms->ofdm_symbol_size,1,1);
LOG_M("rxsigF3.m","rxsF3",gNB->common_vars.rxdataF[3],14*frame_parms->ofdm_symbol_size,1,1);
}