From 40788580ea64ff8ad8e01f26609d66480930a8c1 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 27 Feb 2025 16:02:37 +0100 Subject: [PATCH] remove unnecessary tbs function --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 53 ------------------- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 19 +++---- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 5 -- 3 files changed, 8 insertions(+), 69 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index ccee11d37e..f59e506bc9 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2170,59 +2170,6 @@ static const uint16_t table_7_3_1_1_2_32[3][15] = { {0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, }; -void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, - int x_overhead, - uint8_t numdmrscdmgroupnodata, - uint8_t tb_scaling) { - - LOG_D(MAC, "TBS calculation\n"); - - nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_rel15 = &pdsch_pdu->pdsch_pdu_rel15; - uint16_t N_PRB_oh = x_overhead; - uint8_t N_PRB_DMRS; - if (pdsch_rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1) { - // if no data in dmrs cdm group is 1 only even REs have no data - // if no data in dmrs cdm group is 2 both odd and even REs have no data - N_PRB_DMRS = numdmrscdmgroupnodata*6; - } - else { - N_PRB_DMRS = numdmrscdmgroupnodata*4; - } - uint8_t N_sh_symb = pdsch_rel15->NrOfSymbols; - uint8_t Imcs = pdsch_rel15->mcsIndex[0]; - uint16_t dmrs_length = get_num_dmrs(pdsch_rel15->dlDmrsSymbPos); - uint16_t N_RE_prime = NR_NB_SC_PER_RB*N_sh_symb - N_PRB_DMRS*dmrs_length - N_PRB_oh; - LOG_D(MAC, "N_RE_prime %d for %d symbols %d DMRS per PRB and %d overhead\n", N_RE_prime, N_sh_symb, N_PRB_DMRS, N_PRB_oh); - - uint32_t TBS=0; - - /*uint8_t mcs_table = config.pdsch_config.mcs_table.value; - uint8_t ss_type = params_rel15.search_space_type; - uint8_t dci_format = params_rel15.dci_format; - get_table_idx(mcs_table, dci_format, rnti_type, ss_type);*/ - uint8_t table_idx = 0; - uint16_t R = nr_get_code_rate_dl(Imcs, table_idx); - uint8_t Qm = nr_get_Qm_dl(Imcs, table_idx); - - TBS = nr_compute_tbs(Qm, - R, - pdsch_rel15->rbSize, - N_sh_symb, - N_PRB_DMRS*dmrs_length, - N_PRB_oh, - tb_scaling, - pdsch_rel15->nrOfLayers)>>3; - - pdsch_rel15->targetCodeRate[0] = R; - pdsch_rel15->qamModOrder[0] = Qm; - pdsch_rel15->TBSize[0] = TBS; - // pdsch_rel15->nb_mod_symbols = N_RE_prime*pdsch_rel15->n_prb*pdsch_rel15->nb_codewords; - pdsch_rel15->mcsTable[0] = table_idx; - - LOG_D(MAC, "TBS %d bytes: N_PRB_DMRS %d N_sh_symb %d N_PRB_oh %d R %d Qm %d table %d nb_symbols %d\n", - TBS, N_PRB_DMRS, N_sh_symb, N_PRB_oh, R, Qm, table_idx,N_RE_prime*pdsch_rel15->rbSize*pdsch_rel15->NrOfCodewords ); -} - // the following tables contain 10 times the value reported in 214 (in line with SCF specification and to avoid fractional values) //Table 5.1.3.1-1 of 38.214 static const uint16_t Table_51311[32][2] = {{2, 1200}, {2, 1570}, {2, 1930}, {2, 2510}, {2, 3080}, {2, 3790}, {2, 4490}, {2, 5260}, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index a8c434b62c..9ae74d9f68 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1774,10 +1774,10 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac, } nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; - memset((void *)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + memset((void *)dl_tti_pdsch_pdu, 0, sizeof(nfapi_nr_dl_tti_request_pdu_t)); dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; - dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu)); - dl_req->nPDUs+=1; + dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2 + sizeof(nfapi_nr_dl_tti_pdsch_pdu)); + dl_req->nPDUs += 1; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id]; @@ -1810,6 +1810,7 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac, pdsch_pdu_rel15->targetCodeRate[0] = R; int Qm = nr_get_Qm_dl(mcsIndex, mcsTableIdx); pdsch_pdu_rel15->qamModOrder[0] = Qm; + pdsch_pdu_rel15->TBSize[0] = tb_size; pdsch_pdu_rel15->mcsIndex[0] = mcsIndex; pdsch_pdu_rel15->mcsTable[0] = mcsTableIdx; pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[round % 4]; @@ -1829,16 +1830,12 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac, pdsch_pdu_rel15->StartSymbolIndex = tda.startSymbolIndex; pdsch_pdu_rel15->NrOfSymbols = tda.nrOfSymbols; pdsch_pdu_rel15->dlDmrsSymbPos = dmrs_info.dl_dmrs_symb_pos; - - int x_Overhead = 0; - nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, tb_scaling); - pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(mcsTableIdx, ra->sc_info.dl_bw_tbslbrm, 1); - pdsch_pdu_rel15->maintenance_parms_v3.ldpcBaseGraph = get_BG(tb_size<<3,R); + pdsch_pdu_rel15->maintenance_parms_v3.ldpcBaseGraph = get_BG(tb_size << 3, R); - pdsch_pdu_rel15->precodingAndBeamforming.num_prgs=1; - pdsch_pdu_rel15->precodingAndBeamforming.prg_size=275; - pdsch_pdu_rel15->precodingAndBeamforming.dig_bf_interfaces=1; + pdsch_pdu_rel15->precodingAndBeamforming.num_prgs = 1; + pdsch_pdu_rel15->precodingAndBeamforming.prg_size = 275; + pdsch_pdu_rel15->precodingAndBeamforming.dig_bf_interfaces = 1; pdsch_pdu_rel15->precodingAndBeamforming.prgs_list[0].pm_idx = 0; pdsch_pdu_rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = ra->beam_id; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index a138d41b1a..f6bcbf7506 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -305,11 +305,6 @@ int get_spf(nfapi_nr_config_request_scf_t *cfg); int to_absslot(nfapi_nr_config_request_scf_t *cfg,int frame,int slot); -void nr_get_tbs_dl(nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, - int x_overhead, - uint8_t numdmrscdmgroupnodata, - uint8_t tb_scaling); - int NRRIV2BW(int locationAndBandwidth,int N_RB); int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB);