Commit d73e1a41 authored by Robert Schmidt's avatar Robert Schmidt

Handle NULL return of pullTpool()

parent 178e2773
......@@ -740,6 +740,8 @@ void pusch_procedures_fromsplit(uint8_t *bufferZone, int bufSize, PHY_VARS_eNB *
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);
}
......
......@@ -248,6 +248,8 @@ void rx_func(void *param) {
// Its a FIFO so it maitains the order in which the MAC fills the messages
// so no need for checking for right slot
res = pullTpool(&gNB->L1_tx_filled, &gNB->threadPool);
if (res == NULL)
return; // Tpool has been stopped
syncMsg = (processingData_L1tx_t *)NotifiedFifoData(res);
syncMsg->gNB = gNB;
syncMsg->timestamp_tx = info->timestamp_tx;
......@@ -255,6 +257,8 @@ void rx_func(void *param) {
pushTpool(&gNB->threadPool, res);
} else if (get_softmodem_params()->continuous_tx) {
notifiedFIFO_elt_t *res = pullTpool(&gNB->L1_tx_free, &gNB->threadPool);
if (res == NULL)
return; // Tpool has been stopped
processingData_L1tx_t *syncMsg = (processingData_L1tx_t *)NotifiedFifoData(res);
syncMsg->gNB = gNB;
syncMsg->timestamp_tx = info->timestamp_tx;
......@@ -377,6 +381,7 @@ void *tx_reorder_thread(void* param) {
resL1Reserve = pullTpool(&gNB->L1_tx_out, &gNB->threadPool);
AssertFatal(resL1Reserve != NULL, "pullTpool() did not return start message in %s\n", __func__);
int next_tx_slot=((processingData_L1tx_t *)NotifiedFifoData(resL1Reserve))->slot;
while (!oai_exit) {
......@@ -390,7 +395,7 @@ void *tx_reorder_thread(void* param) {
}
} else {
resL1 = pullTpool(&gNB->L1_tx_out, &gNB->threadPool);
if (((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot != next_tx_slot) {
if (resL1 != NULL && ((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot != next_tx_slot) {
if (resL1Reserve)
LOG_E(PHY,"error, have a stored packet, then a second one\n");
resL1Reserve = resL1;
......@@ -399,6 +404,8 @@ void *tx_reorder_thread(void* param) {
LOG_E(PHY,"error, pull two msg, none is good\n");
}
}
if (resL1 == NULL)
break; // Tpool has been stopped
processingData_L1tx_t *syncMsgL1= (processingData_L1tx_t *)NotifiedFifoData(resL1);
processingData_RU_t syncMsgRU;
syncMsgRU.frame_tx = syncMsgL1->frame;
......
......@@ -1252,6 +1252,8 @@ void *ru_thread( void *param ) {
// At this point, all information for subframe has been received on FH interface
res = pullTpool(&gNB->resp_L1, &gNB->threadPool);
if (res == NULL)
break; // Tpool has been stopped
syncMsg = (processingData_L1_t *)NotifiedFifoData(res);
syncMsg->gNB = gNB;
syncMsg->frame_rx = proc->frame_rx;
......
......@@ -692,6 +692,8 @@ void processSlotRX(void *arg) {
// Wait for PUSCH processing to finish
notifiedFIFO_elt_t *res;
res = pullTpool(&rxtxD->txFifo,&(get_nrUE_params()->Tpool));
if (res == NULL)
return; // Tpool has been stopped
delNotifiedFIFO_elt(res);
// calling UL_indication to schedule things other than PUSCH (eg, PUCCH)
......@@ -1008,6 +1010,8 @@ void *UE_thread(void *arg) {
while (nbSlotProcessing >= NR_RX_NB_TH) {
res=pullTpool(&nf, &(get_nrUE_params()->Tpool));
if (res == NULL)
break; // Tpool has been stopped
nbSlotProcessing--;
nr_rxtx_thread_data_t *tmp=(nr_rxtx_thread_data_t *)res->msgData;
......
......@@ -430,6 +430,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
}
while(nbJobs) {
notifiedFIFO_elt_t *req=pullTpool(&nf, &gNB->threadPool);
if (req == NULL)
break; // Tpool has been stopped
delNotifiedFIFO_elt(req);
nbJobs--;
......
......@@ -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;
......
......@@ -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--;
}
}
......@@ -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);
}
......
......@@ -164,6 +164,8 @@ 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);
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);
......
......@@ -364,6 +364,8 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
while (gNB->nbDecode > 0) {
notifiedFIFO_elt_t *req = pullTpool(&gNB->respDecode, &gNB->threadPool);
if (req == NULL)
break; // Tpool has been stopped
nr_postDecode(gNB, req);
delNotifiedFIFO_elt(req);
}
......
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