Commit c4a657cc authored by Robert Schmidt's avatar Robert Schmidt

Avoid additional malloc() for queues and Tpool

parent 31d5bb6f
...@@ -247,21 +247,21 @@ void rx_func(void *param) { ...@@ -247,21 +247,21 @@ void rx_func(void *param) {
processingData_L1tx_t *syncMsg; processingData_L1tx_t *syncMsg;
// Its a FIFO so it maitains the order in which the MAC fills the messages // Its a FIFO so it maitains the order in which the MAC fills the messages
// so no need for checking for right slot // so no need for checking for right slot
res = pullTpool(gNB->L1_tx_filled, gNB->threadPool); res = pullTpool(&gNB->L1_tx_filled, &gNB->threadPool);
syncMsg = (processingData_L1tx_t *)NotifiedFifoData(res); syncMsg = (processingData_L1tx_t *)NotifiedFifoData(res);
syncMsg->gNB = gNB; syncMsg->gNB = gNB;
syncMsg->timestamp_tx = info->timestamp_tx; syncMsg->timestamp_tx = info->timestamp_tx;
res->key = slot_tx; res->key = slot_tx;
pushTpool(gNB->threadPool, res); pushTpool(&gNB->threadPool, res);
} else if (get_softmodem_params()->continuous_tx) { } else if (get_softmodem_params()->continuous_tx) {
notifiedFIFO_elt_t *res = pullTpool(gNB->L1_tx_free, gNB->threadPool); notifiedFIFO_elt_t *res = pullTpool(&gNB->L1_tx_free, &gNB->threadPool);
processingData_L1tx_t *syncMsg = (processingData_L1tx_t *)NotifiedFifoData(res); processingData_L1tx_t *syncMsg = (processingData_L1tx_t *)NotifiedFifoData(res);
syncMsg->gNB = gNB; syncMsg->gNB = gNB;
syncMsg->timestamp_tx = info->timestamp_tx; syncMsg->timestamp_tx = info->timestamp_tx;
syncMsg->frame = frame_tx; syncMsg->frame = frame_tx;
syncMsg->slot = slot_tx; syncMsg->slot = slot_tx;
res->key = slot_tx; res->key = slot_tx;
pushNotifiedFIFO(gNB->L1_tx_out, res); pushNotifiedFIFO(&gNB->L1_tx_out, res);
} }
#if 0 #if 0
...@@ -376,7 +376,7 @@ void *tx_reorder_thread(void* param) { ...@@ -376,7 +376,7 @@ void *tx_reorder_thread(void* param) {
notifiedFIFO_elt_t *resL1Reserve = NULL; notifiedFIFO_elt_t *resL1Reserve = NULL;
resL1Reserve=pullTpool(gNB->L1_tx_out, gNB->threadPool); resL1Reserve = pullTpool(&gNB->L1_tx_out, &gNB->threadPool);
int next_tx_slot=((processingData_L1tx_t *)NotifiedFifoData(resL1Reserve))->slot; int next_tx_slot=((processingData_L1tx_t *)NotifiedFifoData(resL1Reserve))->slot;
while (!oai_exit) { while (!oai_exit) {
...@@ -385,16 +385,16 @@ void *tx_reorder_thread(void* param) { ...@@ -385,16 +385,16 @@ void *tx_reorder_thread(void* param) {
resL1=resL1Reserve; resL1=resL1Reserve;
if (((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot != next_tx_slot) { if (((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot != next_tx_slot) {
LOG_E(PHY,"order mistake\n"); LOG_E(PHY,"order mistake\n");
resL1Reserve=NULL; resL1Reserve = NULL;
resL1 = pullTpool(gNB->L1_tx_out, gNB->threadPool); resL1 = pullTpool(&gNB->L1_tx_out, &gNB->threadPool);
} }
} else { } else {
resL1 = pullTpool(gNB->L1_tx_out, gNB->threadPool); resL1 = pullTpool(&gNB->L1_tx_out, &gNB->threadPool);
if (((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot != next_tx_slot) { if (((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot != next_tx_slot) {
if (resL1Reserve) if (resL1Reserve)
LOG_E(PHY,"error, have a stored packet, then a second one\n"); LOG_E(PHY,"error, have a stored packet, then a second one\n");
resL1Reserve=resL1; resL1Reserve = resL1;
resL1 = pullTpool(gNB->L1_tx_out, gNB->threadPool); resL1 = pullTpool(&gNB->L1_tx_out, &gNB->threadPool);
if (((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot != next_tx_slot) if (((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot != next_tx_slot)
LOG_E(PHY,"error, pull two msg, none is good\n"); LOG_E(PHY,"error, pull two msg, none is good\n");
} }
...@@ -410,7 +410,7 @@ void *tx_reorder_thread(void* param) { ...@@ -410,7 +410,7 @@ void *tx_reorder_thread(void* param) {
next_tx_slot = (syncMsgRU.slot_tx + 1) % slots_per_frame; next_tx_slot = (syncMsgRU.slot_tx + 1) % slots_per_frame;
} else } else
next_tx_slot = get_next_downlink_slot(gNB, &gNB->gNB_config, syncMsgRU.frame_tx, syncMsgRU.slot_tx); next_tx_slot = get_next_downlink_slot(gNB, &gNB->gNB_config, syncMsgRU.frame_tx, syncMsgRU.slot_tx);
pushNotifiedFIFO(gNB->L1_tx_free, resL1); pushNotifiedFIFO(&gNB->L1_tx_free, resL1);
if (resL1==resL1Reserve) if (resL1==resL1Reserve)
resL1Reserve=NULL; resL1Reserve=NULL;
ru_tx_func((void*)&syncMsgRU); ru_tx_func((void*)&syncMsgRU);
...@@ -423,8 +423,6 @@ void init_gNB_Tpool(int inst) { ...@@ -423,8 +423,6 @@ void init_gNB_Tpool(int inst) {
gNB = RC.gNB[inst]; gNB = RC.gNB[inst];
gNB_L1_proc_t *proc = &gNB->proc; gNB_L1_proc_t *proc = &gNB->proc;
// ULSCH decoding threadpool
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
int numCPU = sysconf(_SC_NPROCESSORS_ONLN); int numCPU = sysconf(_SC_NPROCESSORS_ONLN);
LOG_I(PHY,"Number of threads requested in config file: %d, Number of threads available on this machine: %d\n",gNB->thread_pool_size,numCPU); LOG_I(PHY,"Number of threads requested in config file: %d, Number of threads available on this machine: %d\n",gNB->thread_pool_size,numCPU);
int threadCnt = min(numCPU, gNB->thread_pool_size); int threadCnt = min(numCPU, gNB->thread_pool_size);
...@@ -437,33 +435,28 @@ void init_gNB_Tpool(int inst) { ...@@ -437,33 +435,28 @@ void init_gNB_Tpool(int inst) {
s_offset += 3; s_offset += 3;
} }
if (getenv("noThreads")) strcpy(pool, "n"); if (getenv("noThreads")) strcpy(pool, "n");
initTpool(pool, gNB->threadPool, cpumeas(CPUMEAS_GETSTATE)); initTpool(pool, &gNB->threadPool, cpumeas(CPUMEAS_GETSTATE));
// ULSCH decoder result FIFO // ULSCH decoder result FIFO
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->respDecode);
initNotifiedFIFO(gNB->respDecode);
// L1 RX result FIFO // L1 RX result FIFO
gNB->resp_L1 = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->resp_L1);
initNotifiedFIFO(gNB->resp_L1); notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(processingData_L1_t), 0, &gNB->resp_L1, rx_func);
notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(processingData_L1_t),0,gNB->resp_L1,rx_func); pushNotifiedFIFO(&gNB->resp_L1, msg); // to unblock the process in the beginning
pushNotifiedFIFO(gNB->resp_L1,msg); // to unblock the process in the beginning
// L1 TX result FIFO // L1 TX result FIFO
gNB->L1_tx_free = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->L1_tx_free);
gNB->L1_tx_filled = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->L1_tx_filled);
gNB->L1_tx_out = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->L1_tx_out);
initNotifiedFIFO(gNB->L1_tx_free);
initNotifiedFIFO(gNB->L1_tx_filled);
initNotifiedFIFO(gNB->L1_tx_out);
// we create 2 threads for L1 tx processing // we create 2 threads for L1 tx processing
for (int i=0; i < 2; i++) { for (int i=0; i < 2; i++) {
notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0,gNB->L1_tx_out,tx_func); notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t), 0, &gNB->L1_tx_out, tx_func);
processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx); processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx);
memset(msgDataTx,0, sizeof(processingData_L1tx_t)); memset(msgDataTx, 0, sizeof(processingData_L1tx_t));
init_DLSCH_struct(gNB, msgDataTx); init_DLSCH_struct(gNB, msgDataTx);
memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t)); memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t));
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
} }
if ((!get_softmodem_params()->emulate_l1) && (!IS_SOFTMODEM_NOSTATS_BIT)) if ((!get_softmodem_params()->emulate_l1) && (!IS_SOFTMODEM_NOSTATS_BIT))
......
...@@ -1251,7 +1251,7 @@ void *ru_thread( void *param ) { ...@@ -1251,7 +1251,7 @@ void *ru_thread( void *param ) {
} }
// At this point, all information for subframe has been received on FH interface // At this point, all information for subframe has been received on FH interface
res = pullTpool(gNB->resp_L1, gNB->threadPool); res = pullTpool(&gNB->resp_L1, &gNB->threadPool);
syncMsg = (processingData_L1_t *)NotifiedFifoData(res); syncMsg = (processingData_L1_t *)NotifiedFifoData(res);
syncMsg->gNB = gNB; syncMsg->gNB = gNB;
syncMsg->frame_rx = proc->frame_rx; syncMsg->frame_rx = proc->frame_rx;
...@@ -1260,7 +1260,7 @@ void *ru_thread( void *param ) { ...@@ -1260,7 +1260,7 @@ void *ru_thread( void *param ) {
syncMsg->slot_tx = proc->tti_tx; syncMsg->slot_tx = proc->tti_tx;
syncMsg->timestamp_tx = proc->timestamp_tx; syncMsg->timestamp_tx = proc->timestamp_tx;
res->key = proc->tti_rx; res->key = proc->tti_rx;
pushTpool(gNB->threadPool, res); pushTpool(&gNB->threadPool, res);
} }
printf( "Exiting ru_thread \n"); printf( "Exiting ru_thread \n");
...@@ -1271,11 +1271,11 @@ void *ru_thread( void *param ) { ...@@ -1271,11 +1271,11 @@ void *ru_thread( void *param ) {
else LOG_I(PHY,"RU %d rf device stopped\n",ru->idx); else LOG_I(PHY,"RU %d rf device stopped\n",ru->idx);
} }
res = pullNotifiedFIFO(gNB->resp_L1); res = pullNotifiedFIFO(&gNB->resp_L1);
delNotifiedFIFO_elt(res); delNotifiedFIFO_elt(res);
res = pullNotifiedFIFO(gNB->L1_tx_free); res = pullNotifiedFIFO(&gNB->L1_tx_free);
delNotifiedFIFO_elt(res); delNotifiedFIFO_elt(res);
res = pullNotifiedFIFO(gNB->L1_tx_free); res = pullNotifiedFIFO(&gNB->L1_tx_free);
delNotifiedFIFO_elt(res); delNotifiedFIFO_elt(res);
ru_thread_status = 0; ru_thread_status = 0;
......
...@@ -1103,7 +1103,7 @@ notifiedFIFO_elt_t *l1tx_message_extract(PHY_VARS_gNB *gNB, int frame, int slot) ...@@ -1103,7 +1103,7 @@ notifiedFIFO_elt_t *l1tx_message_extract(PHY_VARS_gNB *gNB, int frame, int slot)
notifiedFIFO_elt_t *res; notifiedFIFO_elt_t *res;
//TODO: This needs to be reworked for nfapi to work //TODO: This needs to be reworked for nfapi to work
res = pullTpool(gNB->L1_tx_free, gNB->threadPool); res = pullTpool(&gNB->L1_tx_free, &gNB->threadPool);
return res; return res;
} }
...@@ -1130,7 +1130,7 @@ int pnf_phy_ul_dci_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, ...@@ -1130,7 +1130,7 @@ int pnf_phy_ul_dci_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
} }
} }
pushNotifiedFIFO(gNB->L1_tx_filled,res); pushNotifiedFIFO(&gNB->L1_tx_filled, res);
return 0; return 0;
} }
...@@ -1237,7 +1237,7 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, ...@@ -1237,7 +1237,7 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
else { else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() UNKNOWN:%d\n", __FUNCTION__, dl_tti_pdu_list[i].PDUType); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() UNKNOWN:%d\n", __FUNCTION__, dl_tti_pdu_list[i].PDUType);
} }
pushNotifiedFIFO(gNB->L1_tx_filled,res); pushNotifiedFIFO(&gNB->L1_tx_filled, res);
} }
if(req->vendor_extension) if(req->vendor_extension)
......
...@@ -425,11 +425,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -425,11 +425,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
encoder_implemparams_t* perJobImpp=(encoder_implemparams_t*)NotifiedFifoData(req); encoder_implemparams_t* perJobImpp=(encoder_implemparams_t*)NotifiedFifoData(req);
*perJobImpp=impp; *perJobImpp=impp;
perJobImpp->macro_num=j; perJobImpp->macro_num=j;
pushTpool(gNB->threadPool,req); pushTpool(&gNB->threadPool, req);
nbJobs++; nbJobs++;
} }
while(nbJobs) { while(nbJobs) {
notifiedFIFO_elt_t *req=pullTpool(&nf, gNB->threadPool); notifiedFIFO_elt_t *req=pullTpool(&nf, &gNB->threadPool);
delNotifiedFIFO_elt(req); delNotifiedFIFO_elt(req);
nbJobs--; nbJobs--;
......
...@@ -553,7 +553,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -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); E = nr_get_E(G, harq_process->C, Qm, n_layers, r);
union ldpcReqUnion id = {.s={ulsch->rnti,frame,nr_tti_rx,0,0}}; 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); ldpcDecode_t * rdata=(ldpcDecode_t *) NotifiedFifoData(req);
rdata->gNB = phy_vars_gNB; rdata->gNB = phy_vars_gNB;
...@@ -574,7 +574,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -574,7 +574,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
rdata->ulsch = ulsch; rdata->ulsch = ulsch;
rdata->ulsch_id = ULSCH_id; rdata->ulsch_id = ULSCH_id;
rdata->tbslbrm = pusch_pdu->maintenance_parms_v3.tbSizeLbrmBytes; rdata->tbslbrm = pusch_pdu->maintenance_parms_v3.tbSizeLbrmBytes;
pushTpool(phy_vars_gNB->threadPool,req); pushTpool(&phy_vars_gNB->threadPool, req);
phy_vars_gNB->nbDecode++; phy_vars_gNB->nbDecode++;
LOG_D(PHY,"Added a block to decode, in pipe: %d\n",phy_vars_gNB->nbDecode); LOG_D(PHY,"Added a block to decode, in pipe: %d\n",phy_vars_gNB->nbDecode);
r_offset += E; r_offset += E;
......
...@@ -890,13 +890,13 @@ typedef struct PHY_VARS_gNB_s { ...@@ -890,13 +890,13 @@ typedef struct PHY_VARS_gNB_s {
time_stats_t rx_dft_stats; time_stats_t rx_dft_stats;
time_stats_t ulsch_freq_offset_estimation_stats; time_stats_t ulsch_freq_offset_estimation_stats;
*/ */
notifiedFIFO_t *respDecode; notifiedFIFO_t respDecode;
notifiedFIFO_t *resp_L1; notifiedFIFO_t resp_L1;
notifiedFIFO_t *L1_tx_free; notifiedFIFO_t L1_tx_free;
notifiedFIFO_t *L1_tx_filled; notifiedFIFO_t L1_tx_filled;
notifiedFIFO_t *L1_tx_out; notifiedFIFO_t L1_tx_out;
notifiedFIFO_t *resp_RU_tx; notifiedFIFO_t resp_RU_tx;
tpool_t *threadPool; tpool_t threadPool;
int nbDecode; int nbDecode;
uint8_t thread_pool_size; uint8_t thread_pool_size;
int number_of_nr_dlsch_max; int number_of_nr_dlsch_max;
......
...@@ -163,7 +163,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ ...@@ -163,7 +163,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT) { if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT) {
notifiedFIFO_elt_t *res; notifiedFIFO_elt_t *res;
res = pullTpool(gNB->L1_tx_free, gNB->threadPool); res = pullTpool(&gNB->L1_tx_free, &gNB->threadPool);
processingData_L1tx_t *msgTx = (processingData_L1tx_t *)NotifiedFifoData(res); processingData_L1tx_t *msgTx = (processingData_L1tx_t *)NotifiedFifoData(res);
const time_stats_t ts = exec_time_stats_NotifiedFIFO(res); const time_stats_t ts = exec_time_stats_NotifiedFIFO(res);
merge_meas(&gNB->phy_proc_tx, &ts); merge_meas(&gNB->phy_proc_tx, &ts);
...@@ -210,7 +210,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ ...@@ -210,7 +210,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
for (int i=0; i<number_ul_dci_pdu; i++) for (int i=0; i<number_ul_dci_pdu; i++)
msgTx->ul_pdcch_pdu[i] = UL_dci_req->ul_dci_pdu_list[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++) { for (int i = 0; i < number_ul_tti_pdu; i++) {
......
...@@ -206,8 +206,8 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { ...@@ -206,8 +206,8 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
} else { } else {
if ( rdata->nbSegments != ulsch_harq->processedSegments ) { if ( rdata->nbSegments != ulsch_harq->processedSegments ) {
int nb=abortTpoolJob(gNB->threadPool, req->key); int nb = abortTpoolJob(&gNB->threadPool, req->key);
nb+=abortNotifiedFIFO(gNB->respDecode, req->key); nb += abortNotifiedFIFO(&gNB->respDecode, req->key);
gNB->nbDecode-=nb; gNB->nbDecode-=nb;
LOG_D(PHY,"uplink segment error %d/%d, aborted %d segments\n",rdata->segment_r,rdata->nbSegments, 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); LOG_D(PHY, "ULSCH %d in error\n",rdata->ulsch_id);
...@@ -363,7 +363,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH ...@@ -363,7 +363,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
G); G);
while (gNB->nbDecode > 0) { while (gNB->nbDecode > 0) {
notifiedFIFO_elt_t *req=pullTpool(gNB->respDecode, gNB->threadPool); notifiedFIFO_elt_t *req = pullTpool(&gNB->respDecode, &gNB->threadPool);
nr_postDecode(gNB, req); nr_postDecode(gNB, req);
delNotifiedFIFO_elt(req); delNotifiedFIFO_elt(req);
} }
......
...@@ -363,8 +363,7 @@ int main(int argc, char **argv) ...@@ -363,8 +363,7 @@ int main(int argc, char **argv)
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *)); RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = calloc(1, sizeof(PHY_VARS_gNB)); RC.gNB[0] = calloc(1, sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0]; 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; //gNB_config = &gNB->gNB_config;
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH) frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
frame_parms->nb_antennas_tx = n_tx; frame_parms->nb_antennas_tx = n_tx;
...@@ -625,7 +624,6 @@ int main(int argc, char **argv) ...@@ -625,7 +624,6 @@ int main(int argc, char **argv)
reset_DLSCH_struct(gNB, &msgDataTx); reset_DLSCH_struct(gNB, &msgDataTx);
phy_free_nr_gNB(gNB); phy_free_nr_gNB(gNB);
free(gNB->threadPool);
free(RC.gNB[0]); free(RC.gNB[0]);
free(RC.gNB); free(RC.gNB);
......
...@@ -1034,16 +1034,12 @@ int main(int argc, char **argv) ...@@ -1034,16 +1034,12 @@ int main(int argc, char **argv)
snrRun = 0; snrRun = 0;
int n_errs = 0; int n_errs = 0;
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); initTpool(gNBthreads, &gNB->threadPool, true);
initTpool(gNBthreads, gNB->threadPool, true); initNotifiedFIFO(&gNB->L1_tx_free);
gNB->L1_tx_free = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->L1_tx_filled);
gNB->L1_tx_filled = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->L1_tx_out);
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);
// we create 2 threads for L1 tx processing // 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); processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx);
init_DLSCH_struct(gNB, msgDataTx); init_DLSCH_struct(gNB, msgDataTx);
msgDataTx->slot = slot; msgDataTx->slot = slot;
...@@ -1119,7 +1115,7 @@ int main(int argc, char **argv) ...@@ -1119,7 +1115,7 @@ int main(int argc, char **argv)
Sched_INFO.UL_tti_req = gNB_mac->UL_tti_req_ahead[0]; Sched_INFO.UL_tti_req = gNB_mac->UL_tti_req_ahead[0];
Sched_INFO.UL_dci_req = NULL; Sched_INFO.UL_dci_req = NULL;
Sched_INFO.TX_req = &gNB_mac->TX_req[0]; 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); nr_schedule_response(&Sched_INFO);
/* PTRS values for DLSIM calculations */ /* PTRS values for DLSIM calculations */
......
...@@ -87,8 +87,8 @@ int nr_postDecode_sim(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { ...@@ -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)); rdata->Kr_bytes - (ulsch_harq->F>>3) -((ulsch_harq->C>1)?3:0));
} else { } else {
if ( rdata->nbSegments != ulsch_harq->processedSegments ) { if ( rdata->nbSegments != ulsch_harq->processedSegments ) {
int nb=abortTpoolJob(gNB->threadPool, req->key); int nb=abortTpoolJob(&gNB->threadPool, req->key);
nb+=abortNotifiedFIFO(gNB->respDecode, req->key); nb+=abortNotifiedFIFO(&gNB->respDecode, req->key);
gNB->nbDecode-=nb; gNB->nbDecode-=nb;
AssertFatal(ulsch_harq->processedSegments+nb == rdata->nbSegments,"processed: %d, aborted: %d, total %d\n", AssertFatal(ulsch_harq->processedSegments+nb == rdata->nbSegments,"processed: %d, aborted: %d, total %d\n",
ulsch_harq->processedSegments, nb, rdata->nbSegments); ulsch_harq->processedSegments, nb, rdata->nbSegments);
...@@ -387,11 +387,9 @@ int main(int argc, char **argv) ...@@ -387,11 +387,9 @@ int main(int argc, char **argv)
gNB = RC.gNB[0]; gNB = RC.gNB[0];
//gNB_config = &gNB->gNB_config; //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"; char tp_param[] = "n";
initTpool(tp_param, gNB->threadPool, true); initTpool(tp_param, &gNB->threadPool, true);
initNotifiedFIFO(gNB->respDecode); initNotifiedFIFO(&gNB->respDecode);
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH) 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_DL = N_RB_DL;
frame_parms->N_RB_UL = N_RB_UL; frame_parms->N_RB_UL = N_RB_UL;
...@@ -586,7 +584,7 @@ int main(int argc, char **argv) ...@@ -586,7 +584,7 @@ int main(int argc, char **argv)
nr_ulsch_decoding(gNB, UE_id, channel_output_fixed, frame_parms, rel15_ul, nr_ulsch_decoding(gNB, UE_id, channel_output_fixed, frame_parms, rel15_ul,
frame, subframe, harq_pid, G); frame, subframe, harq_pid, G);
while (gNB->nbDecode > 0) { 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); ret = nr_postDecode_sim(gNB, req);
delNotifiedFIFO_elt(req); delNotifiedFIFO_elt(req);
} }
...@@ -636,8 +634,6 @@ int main(int argc, char **argv) ...@@ -636,8 +634,6 @@ int main(int argc, char **argv)
free(UE); free(UE);
phy_free_nr_gNB(gNB); phy_free_nr_gNB(gNB);
free(gNB->threadPool);
free(gNB->respDecode);
free(RC.gNB[0]); free(RC.gNB[0]);
free(RC.gNB); free(RC.gNB);
......
...@@ -700,9 +700,6 @@ int main(int argc, char **argv) ...@@ -700,9 +700,6 @@ int main(int argc, char **argv)
RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB)); RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0]; gNB = RC.gNB[0];
gNB->ofdm_offset_divisor = UINT_MAX; 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]; char tp_param[80];
if (threadCnt>0) if (threadCnt>0)
sprintf(tp_param,"-1"); sprintf(tp_param,"-1");
...@@ -714,15 +711,12 @@ int main(int argc, char **argv) ...@@ -714,15 +711,12 @@ int main(int argc, char **argv)
s_offset += 3; s_offset += 3;
} }
initTpool(tp_param, gNB->threadPool, false); initTpool(tp_param, &gNB->threadPool, false);
initNotifiedFIFO(gNB->respDecode); initNotifiedFIFO(&gNB->respDecode);
gNB->L1_tx_free = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->L1_tx_free);
gNB->L1_tx_filled = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->L1_tx_filled);
gNB->L1_tx_out = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->L1_tx_out);
initNotifiedFIFO(gNB->L1_tx_free); notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t), 0, &gNB->L1_tx_free, NULL);
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); processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx);
msgDataTx->slot = -1; msgDataTx->slot = -1;
//gNB_config = &gNB->gNB_config; //gNB_config = &gNB->gNB_config;
...@@ -1168,7 +1162,7 @@ int main(int argc, char **argv) ...@@ -1168,7 +1162,7 @@ int main(int argc, char **argv)
} }
// prepare ULSCH/PUSCH reception // 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); nr_schedule_response(Sched_INFO);
// --------- setting parameters for UE -------- // --------- setting parameters for UE --------
......
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