diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index ef1d4e22fa..db8dd4babf 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -115,14 +115,14 @@ void tx_func(void *param) { processingData_L1tx_t *info = (processingData_L1tx_t *) param; PHY_VARS_gNB *gNB = info->gNB; - int frame_tx = info->frame_tx; - int slot_tx = info->slot_tx; + int frame_tx = info->frame; + int slot_tx = info->slot; phy_procedures_gNB_TX(info, frame_tx, slot_tx, 1); - info->status = NOT_FILLED; + info->slot = -1; if ((frame_tx&127) == 0) dump_pdsch_stats(gNB); // If the later of the 2 L1 tx thread finishes first, @@ -281,16 +281,13 @@ void rx_func(void *param) { notifiedFIFO_elt_t *res; res = pullTpool(gNB->resp_L1_tx, gNB->threadPool); processingData_L1tx_t *syncMsg = (processingData_L1tx_t *)NotifiedFifoData(res); - while (syncMsg->status == NOT_FILLED) { + while (syncMsg->slot != slot_tx) { pushNotifiedFIFO(gNB->resp_L1_tx, res); res = pullTpool(gNB->resp_L1_tx, gNB->threadPool); syncMsg = (processingData_L1tx_t *)NotifiedFifoData(res); } syncMsg->gNB = gNB; - syncMsg->frame_rx = frame_rx; - syncMsg->slot_rx = slot_rx; - syncMsg->frame_tx = frame_tx; - syncMsg->slot_tx = slot_tx; + AssertFatal(syncMsg->slot == slot_tx, "Thread message slot and logical slot number do not match\n"); syncMsg->timestamp_tx = info->timestamp_tx; res->key = slot_tx; pushTpool(gNB->threadPool, res); @@ -415,6 +412,7 @@ void init_gNB_Tpool(int inst) { notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0,gNB->resp_L1_tx,tx_func); processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx); init_DLSCH_struct(gNB, msgDataTx); + msgDataTx->slot = -1; memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t)); reset_meas(&msgDataTx->phy_proc_tx); gNB->phy_proc_tx_0 = &msgDataTx->phy_proc_tx; @@ -423,6 +421,7 @@ void init_gNB_Tpool(int inst) { msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0,gNB->resp_L1_tx,tx_func); msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx); init_DLSCH_struct(gNB, msgDataTx); + msgDataTx->slot = -1; memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t)); reset_meas(&msgDataTx->phy_proc_tx); gNB->phy_proc_tx_1 = &msgDataTx->phy_proc_tx; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 54e6b2ac79..13c2f5ce4d 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -132,8 +132,8 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, dci_pdu->AggregationLevel, 0,NULL); polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI,1,currentPtr); -#ifdef DEBUG_CHANNEL_CODING - printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]); +#if DEBUG_CHANNEL_CODING + printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,dci_pdu->AggregationLevel); printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n", ((uint64_t*)dci_pdu->Payload)[0], ((uint64_t*)dci_pdu->Payload)[1]); printf("Encoded Payload (length:%d dwords):\n", encoded_length>>5); diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index b11f902dd2..c88bcf1c18 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -945,10 +945,8 @@ typedef enum { } msgStatus_t; typedef struct processingData_L1tx { - int frame_rx; - int frame_tx; - int slot_rx; - int slot_tx; + int frame; + int slot; openair0_timestamp timestamp_tx; PHY_VARS_gNB *gNB; nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu; @@ -958,7 +956,6 @@ typedef struct processingData_L1tx { NR_gNB_SSB_t ssb[64]; uint16_t num_pdsch_slot; time_stats_t phy_proc_tx; - msgStatus_t status; } processingData_L1tx_t; #endif diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index e06d66ed02..ddcc6000b6 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -165,6 +165,10 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ int pdcch_received=0; msgTx->num_pdsch_slot=0; + msgTx->pdcch_pdu.pdcch_pdu_rel15.numDlDci = 0; + msgTx->ul_pdcch_pdu.pdcch_pdu.pdcch_pdu_rel15.numDlDci = 0; + msgTx->slot = slot; + msgTx->frame = frame; for (int i=0;idl_tti_request_body.dl_tti_pdu_list[i]; @@ -212,7 +216,6 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ if(NFAPI_MODE != NFAPI_MODE_VNF) msgTx->ul_pdcch_pdu = UL_dci_req->ul_dci_pdu_list[number_ul_dci_pdu-1]; // copy the last pdu - msgTx->status = FILLED; pushNotifiedFIFO(gNB->resp_L1_tx,res); if(NFAPI_MODE != NFAPI_MODE_VNF) diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 22d97be0c3..140e055655 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -164,7 +164,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, if (num_dl_dci > 0 || num_ul_dci > 0) { LOG_D(PHY, "[gNB %d] Frame %d slot %d Calling nr_generate_dci_top (number of UL/DL DCI %d/%d)\n", - gNB->Mod_id, frame, slot, num_dl_dci, num_ul_dci); + gNB->Mod_id, frame, slot, num_ul_dci, num_dl_dci); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,1); @@ -178,10 +178,12 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,0); } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1); - LOG_D(PHY, "PDSCH generation started (%d) in frame %d.%d\n", msgTx->num_pdsch_slot,frame,slot); - nr_generate_pdsch(msgTx, frame, slot); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0); + if (msgTx->num_pdsch_slot > 0) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1); + LOG_I(PHY, "PDSCH generation started (%d) in frame %d.%d\n", msgTx->num_pdsch_slot,frame,slot); + nr_generate_pdsch(msgTx, frame, slot); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0); + } for (int i=0;icsirs_pdu[i];