From 6a630f464658f98f60cc6627df2efdf9f319f0fc Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sat, 17 Feb 2024 10:59:56 +0100 Subject: [PATCH] nr_schedule_response(): Separate dlsch_fill into DL_tti_req and TX_req part FAPI sends those independently, so we cannot treat both on the arrival of the first one. --- nfapi/oai_integration/nfapi_pnf.c | 5 +- openair1/PHY/NR_TRANSPORT/nr_dlsch.h | 5 +- openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c | 18 ++++++- openair1/SCHED_NR/fapi_nr_l1.c | 57 ++-------------------- 4 files changed, 26 insertions(+), 59 deletions(-) diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index 9d50b45bbf..1c9b4df258 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -1220,13 +1220,14 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nfapi_nr_pdu_t *tx_data = tx_data_request[sfn][slot][rel15_pdu->pduIndex]; if (tx_data != NULL) { - uint8_t *dlsch_sdu = (uint8_t *)tx_data->TLVs[0].value.direct; + //uint8_t *dlsch_sdu = (uint8_t *)tx_data->TLVs[0].value.direct; //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DLSCH:pdu_index:%d handle_nfapi_dlsch_pdu(eNB, proc_rxtx, dlsch_pdu, transport_blocks:%d sdu:%p) eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols:%d\n", __FUNCTION__, rel8_pdu->pdu_index, rel8_pdu->transport_blocks, dlsch_sdu, eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols); AssertFatal(msgTx->num_pdsch_slot < gNB->max_nb_pdsch, "Number of PDSCH PDUs %d exceeded the limit %d\n", msgTx->num_pdsch_slot, gNB->max_nb_pdsch); - handle_nr_nfapi_pdsch_pdu(msgTx, pdsch_pdu, dlsch_sdu); + AssertFatal(false, "not implemented\n"); + //handle_nr_nfapi_pdsch_pdu(msgTx, pdsch_pdu, dlsch_sdu); } else { NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() DLSCH NULL TX PDU SFN/SF:%d PDU_INDEX:%d\n", __FUNCTION__, NFAPI_SFNSLOT2DEC(sfn,slot), rel15_pdu->pduIndex); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h index 53e0c17065..89b496ba5c 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h @@ -35,9 +35,8 @@ #include "PHY/defs_gNB.h" -void nr_fill_dlsch(processingData_L1tx_t *msgTx, - nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, - unsigned char *sdu); +void nr_fill_dlsch_dl_tti_req(processingData_L1tx_t *msgTx, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu); +void nr_fill_dlsch_tx_req(processingData_L1tx_t *msgTx, int idx, uint8_t *sdu); void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c index c868334a3c..e6a03f1d59 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c @@ -44,13 +44,29 @@ void nr_emulate_dlsch_payload(uint8_t* pdu, uint16_t size) { *(pdu+i) = (uint8_t)rand(); } -void nr_fill_dlsch(processingData_L1tx_t *msgTx, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, uint8_t *sdu) +void nr_fill_dlsch_dl_tti_req(processingData_L1tx_t *msgTx, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu) { NR_gNB_DLSCH_t *dlsch = &msgTx->dlsch[msgTx->num_pdsch_slot][0]; NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; /// DLSCH struct memcpy((void*)&harq->pdsch_pdu, (void*)pdsch_pdu, sizeof(nfapi_nr_dl_tti_pdsch_pdu)); + AssertFatal(msgTx->num_pdsch_slot == pdsch_pdu->pdsch_pdu_rel15.pduIndex, + "PDSCH PDU index %d does not match msgTx index %d\n", + pdsch_pdu->pdsch_pdu_rel15.pduIndex, + msgTx->num_pdsch_slot); msgTx->num_pdsch_slot++; + harq->pdu = NULL; +} + +void nr_fill_dlsch_tx_req(processingData_L1tx_t *msgTx, int idx, uint8_t *sdu) +{ AssertFatal(sdu != NULL, "sdu is null\n"); + + /* not sure if FAPI could transmit DL_TTI_req and TX_req in different orders. + * for the moment, assume they are in the same order (and check!) */ + NR_gNB_DLSCH_t *dlsch = &msgTx->dlsch[idx][0]; + NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; + nfapi_nr_dl_tti_pdsch_pdu *pdsch = &harq->pdsch_pdu; + AssertFatal(pdsch->pdsch_pdu_rel15.pduIndex == idx, "PDSCH PDU index %d does not match %d\n", pdsch->pdsch_pdu_rel15.pduIndex, idx); harq->pdu = sdu; } diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index e7047a2da9..2c611b2af2 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -66,44 +66,6 @@ void handle_nr_nfapi_ssb_pdu(processingData_L1tx_t *msgTx,int frame,int slot, } } -/*void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int subframe,gNB_L1_rxtx_proc_t *proc, - uint8_t codeword_index, - uint8_t *sdu) -{ - - int UE_id = 0; //Hardcode UE_id for now - int harq_pid; - - NR_gNB_DLSCH_t *dlsch0=NULL, *dlsch1=NULL; - NR_DL_gNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL; - - // Based on nr_fill_dci_and_dlsch only gNB->dlsch[0][0] gets filled now. So maybe we do not need dlsch1. - dlsch0 = gNB->dlsch[UE_id][0]; - dlsch1 = gNB->dlsch[UE_id][1]; - - harq_pid = dlsch0->harq_ids[subframe]; - dlsch0_harq = dlsch0->harq_processes[harq_pid]; - dlsch1_harq = dlsch1->harq_processes[harq_pid]; - - - //if (dlsch0_harq->round==0) { //get pointer to SDU if this a new SDU - if(sdu == NULL) { - LOG_E(PHY,"NFAPI: SFN/SF:%04d%d proc:TX:[frame %d subframe %d]: programming dlsch for round 0 \n", - frame,subframe, - proc->frame_tx,proc->slot_tx); - return; - } - //AssertFatal(sdu!=NULL,"NFAPI: SFN/SF:%04d%d proc:TX:[frame %d subframe %d]: programming dlsch for round 0, rnti %x, UE_id %d, harq_pid %d : sdu is null for pdu_index %d dlsch0_harq[round:%d SFN/SF:%d%d pdu:%p mcs:%d ndi:%d pdschstart:%d]\n", - // frame,subframe, - // proc->frame_tx,proc->subframe_tx,rel8->rnti,UE_id,harq_pid, - // dl_tti_pdu->pdsch_pdu.pdsch_pdu_rel8.pdu_index,dlsch0_harq->round,dlsch0_harq->frame,dlsch0_harq->subframe,dlsch0_harq->pdu,dlsch0_harq->mcs,dlsch0_harq->ndi,dlsch0_harq->pdsch_start); - if (codeword_index == 0) dlsch0_harq->pdu = sdu; - else dlsch1_harq->pdu = sdu; - LOG_I(PHY, "SFN/SF: %d/%d DLSCH PDU filled \n",frame, subframe); -// } - -}*/ - void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx, int frame, int slot, nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu) { int found = 0; @@ -122,15 +84,6 @@ void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx, int frame, int slot LOG_E(MAC,"CSI-RS list is full\n"); } -void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx, - nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, - uint8_t *sdu) -{ - - nr_fill_dlsch(msgTx,pdsch_pdu,sdu); - -} - void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO) { // copy data from L2 interface into L1 structures @@ -155,7 +108,6 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO) uint8_t number_dl_pdu = (DL_req==NULL) ? 0 : DL_req->dl_tti_request_body.nPDUs; uint8_t number_ul_dci_pdu = (UL_dci_req==NULL) ? 0 : UL_dci_req->numPdus; uint8_t number_ul_tti_pdu = (UL_tti_req==NULL) ? 0 : UL_tti_req->n_pdus; - uint8_t number_tx_data_pdu = (TX_req == NULL) ? 0 : TX_req->Number_of_PDUs; clear_slot_beamid(gNB, slot); // reset beam_id information for the slot to be processed DevAssert(NFAPI_MODE == NFAPI_MONOLITHIC); @@ -206,6 +158,8 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO) slot, DL_req->SFN, DL_req->Slot); + nr_fill_dlsch_dl_tti_req(msgTx, &dl_tti_pdu->pdsch_pdu); + nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdu->pdsch_pdu.pdsch_pdu_rel15; uint16_t pduIndex = pdsch_pdu_rel15->pduIndex; AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, @@ -213,11 +167,8 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO) pduIndex, TX_req->pdu_list[pduIndex].num_TLV); uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct; - AssertFatal(msgTx->num_pdsch_slot < gNB->max_nb_pdsch, - "Number of PDSCH PDUs %d exceeded the limit %d\n", - msgTx->num_pdsch_slot, - gNB->max_nb_pdsch); - handle_nr_nfapi_pdsch_pdu(msgTx, &dl_tti_pdu->pdsch_pdu, sdu); + nr_fill_dlsch_tx_req(msgTx, pduIndex, sdu); + } }