From 77153fbf5f053b8d487b97a76b9ca09116c27cb4 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 17 Feb 2022 10:16:22 +0100 Subject: [PATCH] TBSLBRM for DL computed ad MAC (added fapi parameter) --- .../nfapi/public_inc/fapi_nr_ue_interface.h | 2 +- .../nfapi/public_inc/nfapi_nr_interface_scf.h | 5 ++ openair1/PHY/CODING/coding_defs.h | 4 -- openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c | 7 +-- openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 6 +-- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 7 +-- .../PHY/NR_UE_TRANSPORT/nr_transport_ue.h | 1 + .../PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c | 8 +-- openair1/PHY/defs_gNB.h | 1 - openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 1 + .../NR_MAC_COMMON/nr_compute_tbs_common.c | 51 +++++++++---------- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 22 ++++++++ openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 7 +++ openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 15 ++++++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 10 ++++ .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 4 ++ .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 14 ++++- 17 files changed, 106 insertions(+), 59 deletions(-) diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h index 3b429a5e84..9e051e0a48 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h @@ -464,7 +464,7 @@ typedef struct { uint8_t nEpreRatioOfPDSCHToPTRS; /// MCS table for this DLSCH uint8_t mcs_table; - + uint32_t tbslbrm; uint16_t pduBitmap; } fapi_nr_dl_config_dlsch_pdu_rel15_t; diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h index c3a173758c..ee680f7fc7 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h @@ -776,6 +776,10 @@ typedef struct { nfapi_nr_dl_dci_pdu_t dci_pdu[MAX_DCI_CORESET]; } nfapi_nr_dl_tti_pdcch_pdu_rel15_t; +typedef struct { + uint32_t tbSizeLbrmBytes; +}nfapi_v3_pdsch_maintenance_parameters_t; + typedef struct { uint16_t pduBitmap; uint16_t rnti; @@ -854,6 +858,7 @@ typedef struct { uint8_t nEpreRatioOfPDSCHToPTRS; // Beamforming nfapi_nr_tx_precoding_and_beamforming_t precodingAndBeamforming; + nfapi_v3_pdsch_maintenance_parameters_t maintenance_parms_v3; }nfapi_nr_dl_tti_pdsch_pdu_rel15_t; diff --git a/openair1/PHY/CODING/coding_defs.h b/openair1/PHY/CODING/coding_defs.h index 8fe31f208e..f6aba66830 100644 --- a/openair1/PHY/CODING/coding_defs.h +++ b/openair1/PHY/CODING/coding_defs.h @@ -481,10 +481,6 @@ uint32_t nr_compute_tbs(uint16_t Qm, uint8_t tb_scaling, uint8_t Nl); -uint32_t nr_compute_tbslbrm(uint16_t table, - uint16_t nb_rb, - uint8_t Nl); - void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f); void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index 6d16fa531c..14de9ed767 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -229,13 +229,8 @@ void ldpc8blocks( void *p) { impp->F, Kr-impp->F-2*(*impp->Zc), mod_order,nb_rb); - // for tbslbrm calculation according to 5.4.2.1 of 38.212 - uint8_t Nl = 4; - if (rel15->nrOfLayers < Nl) - Nl = rel15->nrOfLayers; - - uint32_t Tbslbrm = nr_compute_tbslbrm(rel15->mcsTable[0],nb_rb,Nl); + uint32_t Tbslbrm = rel15->maintenance_parms_v3.tbSizeLbrmBytes; uint8_t Ilbrm = 1; uint8_t e[E]; diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index 31d44736d4..250a243af1 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -259,7 +259,6 @@ void nr_processULSegment(void* arg) { int rv_index = rdata->rv_index; int r_offset = rdata->r_offset; uint8_t kc = rdata->Kc; - uint32_t Tbslbrm = rdata->Tbslbrm; short* ulsch_llr = rdata->ulsch_llr; int max_ldpc_iterations = p_decoderParms->numMaxIter; int8_t llrProcBuf[OAI_UL_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))); @@ -319,7 +318,7 @@ void nr_processULSegment(void* arg) { //start_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats); if (nr_rate_matching_ldpc_rx(Ilbrm, - Tbslbrm, + 0, p_decoderParms->BG, p_decoderParms->Z, ulsch_harq->d[r], @@ -420,7 +419,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, uint32_t r_offset; uint32_t offset; int kc; - int Tbslbrm; int E; #ifdef PRINT_CRC_CHECK @@ -559,7 +557,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, if (!frame%100) printf("K %d C %d Z %d \n", harq_process->K, harq_process->C, harq_process->Z); #endif - Tbslbrm = nr_compute_tbslbrm(0,nb_rb,n_layers); p_decParams->Z = harq_process->Z; @@ -610,7 +607,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, rdata->r_offset = r_offset; rdata->Kr_bytes = Kr_bytes; rdata->rv_index = pusch_pdu->pusch_data.rv_index; - rdata->Tbslbrm = Tbslbrm; rdata->offset = offset; rdata->ulsch = ulsch; rdata->ulsch_id = ULSCH_id; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 8064093eed..32848951c2 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -472,7 +472,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, phy_vars_ue->dl_stats[harq_process->round]++; LOG_D(PHY,"Round %d RV idx %d\n",harq_process->round,harq_process->rvidx); uint8_t kc; - uint32_t Tbslbrm;// = 950984; uint16_t nb_rb;// = 30; double Coderate;// = 0.0; uint8_t dmrs_Type = harq_process->dmrsConfigType; @@ -583,10 +582,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD) && (!frame%100)) LOG_I(PHY,"K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, p_decParams->Z, harq_process->Nl); } - if ((harq_process->Nl)<4) - Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,harq_process->Nl); - else - Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,4); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_SEGMENTATION, VCD_FUNCTION_OUT); p_decParams->Z = harq_process->Z; @@ -637,7 +632,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, rdata->r_offset = r_offset; rdata->Kr_bytes = Kr_bytes; rdata->rv_index = harq_process->rvidx; - rdata->Tbslbrm = Tbslbrm; + rdata->Tbslbrm = harq_process->tbslbrm; rdata->offset = offset; rdata->dlsch = dlsch; rdata->dlsch_id = 0; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index 9b9f1add6e..7048c97189 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -303,6 +303,7 @@ typedef struct { uint16_t ptrs_symbols; // PTRS symbol index, to be updated every PTRS symbol within a slot. uint8_t ptrs_symbol_index; + uint32_t tbslbrm; /// PDU BITMAP uint16_t pduBitmap; } NR_DL_UE_HARQ_t; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c index 553d4fa4f7..91e14fdfd4 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c @@ -233,8 +233,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, uint16_t Kr,r; uint32_t r_offset; uint32_t E,Kb; - uint8_t Ilbrm; - uint32_t Tbslbrm; + uint8_t Ilbrm; uint16_t R; float Coderate; @@ -256,7 +255,6 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, r_offset=0; F=0; Ilbrm = 0; - Tbslbrm = 950984; //max tbs Coderate = 0.0; /////////// ///////////////////////////////////////////////////////////////////////////////////////// @@ -440,12 +438,10 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, E = nr_get_E(G, harq_process->C, mod_order, harq_process->pusch_pdu.nrOfLayers, r); - Tbslbrm = nr_compute_tbslbrm(0,nb_rb,harq_process->pusch_pdu.nrOfLayers); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_IN); start_meas(&ue->ulsch_rate_matching_stats); if (nr_rate_matching_ldpc(Ilbrm, - Tbslbrm, + 0, harq_process->BG, *pz, harq_process->d[r], diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 7c7d30a6e2..5e3a541d20 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -928,7 +928,6 @@ typedef struct LDPCDecode_s { int segment_r; int r_offset; int offset; - int Tbslbrm; int decodeIterations; } ldpcDecode_t; diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 4f4757ec5a..c8386b881e 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -286,6 +286,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ dlsch0_harq->n_dmrs_cdm_groups = dlsch_config_pdu->n_dmrs_cdm_groups; dlsch0_harq->mcs = dlsch_config_pdu->mcs; dlsch0_harq->rvidx = dlsch_config_pdu->rv; + dlsch0_harq->tbslbrm = dlsch_config_pdu->tbslbrm; dlsch0->g_pucch = dlsch_config_pdu->accumulated_delta_PUCCH; //get nrOfLayers from DCI info uint8_t Nl = 0; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c index 4fcbd322db..b07659a0ea 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_compute_tbs_common.c @@ -92,12 +92,10 @@ uint32_t nr_compute_tbs(uint16_t Qm, } - //tbslbrm calculation according to 5.4.2.1 of 38.212 uint32_t nr_compute_tbslbrm(uint16_t table, uint16_t nb_rb, - uint8_t Nl) -{ + uint8_t Nl) { uint16_t R, nb_re; uint16_t nb_rb_lbrm=0; @@ -122,34 +120,31 @@ uint32_t nr_compute_tbslbrm(uint16_t table, Ninfo = (nb_re * R * Qm * Nl)>>10; if (Ninfo <=3824) { - n = max(3, floor(log2(Ninfo)) - 6); - Np_info = max(24, (Ninfo>>n)<= Np_info){ - nr_tbs = Tbstable_nr[i]; - break; - } - } + n = max(3, floor(log2(Ninfo)) - 6); + Np_info = max(24, (Ninfo>>n)<= Np_info){ + nr_tbs = Tbstable_nr[i]; + break; + } + } } else { - n = log2(Ninfo-24)-5; - Np_info = max(3840, (ROUNDIDIV((Ninfo-24),(1< 8424){ - C = CEILIDIV((Np_info+24),8424); - nr_tbs = (C<<3)*CEILIDIV((Np_info+24),(C<<3)) - 24; - } - else { - nr_tbs = ((CEILIDIV((Np_info+24),8))<<3) - 24; - } - - } + n = log2(Ninfo-24)-5; + Np_info = max(3840, (ROUNDIDIV((Ninfo-24),(1< 8424){ + C = CEILIDIV((Np_info+24),8424); + nr_tbs = (C<<3)*CEILIDIV((Np_info+24),(C<<3)) - 24; + } + else + nr_tbs = ((CEILIDIV((Np_info+24),8))<<3) - 24; + } } return nr_tbs; } diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 942e3afad1..69d245e7c1 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -4076,6 +4076,28 @@ uint16_t compute_pucch_prb_size(uint8_t format, } } +int get_bw_tbslbrm(NR_ServingCellConfigCommon_t *scc, + NR_CellGroupConfig_t *cg) { + + int bw = 0; + NR_BWP_t genericParameters; + if (cg && cg->spCellConfig && cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) { + struct NR_ServingCellConfig__downlinkBWP_ToAddModList *BWP_list = cg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList; + for (int i=0; ilist.count; i++) { + genericParameters = BWP_list->list.array[i]->bwp_Common->genericParameters; + int curr_bw = NRRIV2BW(genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + if (curr_bw > bw) + bw = curr_bw; + } + } + else { + genericParameters = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + bw = NRRIV2BW(genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } + return bw; +} + /* extract UL PTRS values from RRC and validate it based upon 38.214 6.2.3 */ bool set_ul_ptrs_values(NR_PTRS_UplinkConfig_t *ul_ptrs_config, uint16_t rbSize,uint8_t mcsIndex, uint8_t mcsTable, diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 91450fc796..bccc40b2c6 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -121,6 +121,13 @@ uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB); uint16_t get_nr_srs_offset(NR_SRS_PeriodicityAndOffset_t periodicityAndOffset); +int get_bw_tbslbrm(NR_ServingCellConfigCommon_t *scc, + NR_CellGroupConfig_t *cg); + +uint32_t nr_compute_tbslbrm(uint16_t table, + uint16_t nb_rb, + uint8_t Nl); + void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, frame_t frameP, NR_MIB_t *mib, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 85bb10290a..f852da7281 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -890,6 +890,12 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr LOG_W(MAC, "[%d.%d] MCS value %d out of bounds! Possibly due to false DCI. Ignoring DCI!\n", frame, slot, dlsch_config_pdu_1_0->mcs); return -1; } + + int bw_tbslbrm = get_bw_tbslbrm(mac->scc, mac->cg); + dlsch_config_pdu_1_0->tbslbrm = nr_compute_tbslbrm(dlsch_config_pdu_1_0->mcs_table, + bw_tbslbrm, + 1); + /* NDI (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI)*/ dlsch_config_pdu_1_0->ndi = dci->ndi; /* RV (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI)*/ @@ -1254,6 +1260,15 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dl_config->number_pdus = dl_config->number_pdus + 1; /* TODO same calculation for MCS table as done in UL */ dlsch_config_pdu_1_1->mcs_table = (pdsch_Config->mcs_Table) ? (*pdsch_Config->mcs_Table + 1) : 0; + + // TBS_LBRM according to section 5.4.2.1 of 38.212 + long *maxMIMO_Layers = mac->cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers; + AssertFatal (maxMIMO_Layers != NULL,"Option with max MIMO layers not configured is not supported\n"); + int nl_tbslbrm = *maxMIMO_Layers < 4 ? *maxMIMO_Layers : 4; + int bw_tbslbrm = get_bw_tbslbrm(mac->scc, mac->cg); + dlsch_config_pdu_1_1->tbslbrm = nr_compute_tbslbrm(dlsch_config_pdu_1_1->mcs_table, + bw_tbslbrm, + nl_tbslbrm); /*PTRS configuration */ dlsch_config_pdu_1_1->pduBitmap = 0; if(pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS != NULL) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 4261020f76..26479b4b88 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1338,6 +1338,11 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra uint8_t tb_scaling = 0; nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, tb_scaling); + int bw_tbslbrm = get_bw_tbslbrm(scc, ra->CellGroup); + pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(mcsTableIdx, + bw_tbslbrm, + 1); + // Fill PDCCH DL DCI PDU nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; pdcch_pdu_rel15->numDlDci++; @@ -1715,6 +1720,11 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra int x_Overhead = 0; nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, tb_scaling); + int bw_tbslbrm = get_bw_tbslbrm(scc, ra->CellGroup); + pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(mcsTableIdx, + bw_tbslbrm, + 1); + pdsch_pdu_rel15->precodingAndBeamforming.num_prgs=1; pdsch_pdu_rel15->precodingAndBeamforming.prg_size=275; pdsch_pdu_rel15->precodingAndBeamforming.dig_bf_interfaces=1; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 0af340725a..634d2b7d89 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -502,6 +502,10 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->dlDmrsSymbPos = dlDmrsSymbPos; LOG_D(MAC,"dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos); + pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(0, + pdsch_pdu_rel15->BWPSize, + 1); + /* Fill PDCCH DL DCI PDU */ nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; pdcch_pdu_rel15->numDlDci++; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index cb76c22292..5b39f44ee2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1140,6 +1140,16 @@ void nr_schedule_ue_spec(module_id_t module_id, pdsch_pdu->StartSymbolIndex = ps->startSymbolIndex; pdsch_pdu->NrOfSymbols = ps->nrOfSymbols; + // TBS_LBRM according to section 5.4.2.1 of 38.212 + long *maxMIMO_Layers = cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers; + AssertFatal (maxMIMO_Layers != NULL,"Option with max MIMO layers not configured is not supported\n"); + int nl_tbslbrm = *maxMIMO_Layers < 4 ? *maxMIMO_Layers : 4; + // Maximum number of PRBs across all configured DL BWPs + int bw_tbslbrm = get_bw_tbslbrm(scc, cg); + pdsch_pdu->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(ps->mcsTableIdx, + bw_tbslbrm, + nl_tbslbrm); + NR_PDSCH_Config_t *pdsch_Config=NULL; if (bwp && bwp->bwp_Dedicated && @@ -1189,7 +1199,7 @@ void nr_schedule_ue_spec(module_id_t module_id, dci_pdu_rel15_t dci_payload; memset(&dci_payload, 0, sizeof(dci_pdu_rel15_t)); // bwp indicator - const int n_dl_bwp = bwp ? UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count : 0; + const int n_dl_bwp = bwp ? cg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count : 0; AssertFatal(n_dl_bwp <= 1, "downlinkBWP_ToAddModList has %d BWP!\n", n_dl_bwp); // as per table 7.3.1.1.2-1 in 38.212 @@ -1242,7 +1252,7 @@ void nr_schedule_ue_spec(module_id_t module_id, const int rnti_type = NR_RNTI_C; fill_dci_pdu_rel15(scc, - UE_info->CellGroup[UE_id], + cg, dci_pdu, &dci_payload, dci_format,