From 337abd5716748ce6a33cfd97950e3414b44ee5c6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 24 Nov 2025 17:16:04 +0100 Subject: [PATCH] Remove superfluous tbs parameter Signed-off-by: Robert Schmidt --- openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 5 ++--- openair1/PHY/defs_gNB.h | 2 -- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 13 +++++++------ openair1/SIMULATION/NR_PHY/ulschsim.c | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index e3b44e99ec..9cb6e22c03 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -145,10 +145,9 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, // ------------------------------------------------------------------ TB_parameters->processedSegments = &harq_process->processedSegments; - harq_process->TBS = pusch_pdu->pusch_data.tb_size; TB_parameters->BG = pusch_pdu->maintenance_parms_v3.ldpcBaseGraph; - TB_parameters->A = (harq_process->TBS) << 3; + TB_parameters->A = pusch_pdu->pusch_data.tb_size << 3; NR_gNB_PHY_STATS_t *stats = get_phy_stats(phy_vars_gNB, ulsch->rnti); if (stats) { stats->frame = frame; @@ -160,7 +159,7 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, if (!harq_process->harq_to_be_cleared) { stats->ulsch_stats.current_Qm = TB_parameters->Qm; stats->ulsch_stats.current_RI = TB_parameters->nb_layers; - stats->ulsch_stats.total_bytes_tx += harq_process->TBS; + stats->ulsch_stats.total_bytes_tx += pusch_pdu->pusch_data.tb_size; } } diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index bd611bbe8f..8ab19981dd 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -136,8 +136,6 @@ typedef struct { /// flag used to clear d properly (together with d_to_be_cleared below) /// set to true in nr_fill_ulsch() when new_data_indicator is received bool harq_to_be_cleared; - /// Transport block size (This is A from 38.212 V15.4.0 section 5.1) - uint32_t TBS; /// Pointer to the payload (38.212 V15.4.0 section 5.1) uint8_t *b; /// Pointers to code blocks after code block segmentation and CRC attachment (38.212 V15.4.0 section 5.2.2) diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 70b9c15a44..b2ed09a6ec 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -347,7 +347,8 @@ static int nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int // if all segments are done if (ulsch_harq->processedSegments == ulsch_harq->C) { if (ulsch_harq->C > 1) { - crc_valid = check_crc(ulsch_harq->b, lenWithCrc(1, (ulsch_harq->TBS) << 3), crcType(1, (ulsch_harq->TBS) << 3)); + int tbs = pusch_pdu->pusch_data.tb_size; + crc_valid = check_crc(ulsch_harq->b, lenWithCrc(1, tbs << 3), crcType(1, tbs << 3)); } else { // When the number of code blocks is 1 (C = 1) and ulsch_harq->processedSegments = 1, we can assume a good TB because of the // CRC check made by the LDPC for early termination, so, no need to perform CRC check twice for a single code block @@ -412,8 +413,8 @@ static int nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int T_INT((int)dmrs_port), // dmrs_antenna_port T_INT((int)pusch_pdu->scid), // dmrs_nscid T_INT((int)frame_parms->nb_antennas_rx), // rx antenna - T_INT(((ulsch_harq->TBS) << 3)), // number_of_bits - T_BUFFER((uint8_t *)((ulsch_harq->b)), ((ulsch_harq->TBS) << 3) / 8)); // data + T_INT((pusch_pdu->pusch_data.tb_size << 3)), // number_of_bits + T_BUFFER((uint8_t *)((ulsch_harq->b)), pusch_pdu->pusch_data.tb_size)); // data } #endif @@ -432,7 +433,7 @@ static int nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int pusch_pdu->pusch_data.new_data_indicator, ulsch->active, ulsch_harq->round, - ulsch_harq->TBS, + pusch_pdu->pusch_data.tb_size, ulsch->max_ldpc_iterations); nr_fill_indication(gNB, ulsch->frame, ulsch->slot, ULSCH_id, ulsch->harq_pid, 0, 0, crc, pdu); LOG_D(PHY, "ULSCH received ok \n"); @@ -453,7 +454,7 @@ static int nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ulsch_harq->ulsch_pdu.pusch_data.rv_index, ulsch_harq->ulsch_pdu.rb_start, ulsch_harq->ulsch_pdu.rb_size, - ulsch_harq->TBS); + pusch_pdu->pusch_data.tb_size); nr_fill_indication(gNB, ulsch->frame, ulsch->slot, ULSCH_id, ulsch->harq_pid, 1, 0, crc, pdu); gNBdumpScopeData(gNB, ulsch->slot, ulsch->frame, "ULSCH_NACK"); ulsch->handled = 1; @@ -547,7 +548,7 @@ static void nr_fill_indication(PHY_VARS_gNB *gNB, if (crc_flag) pdu->pdu_length = 0; else { - pdu->pdu_length = harq_process->TBS; + pdu->pdu_length = pusch_pdu->pusch_data.tb_size; pdu->pdu = harq_process->b; } } diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 7d193f5119..c5b8723908 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -562,7 +562,7 @@ int main(int argc, char **argv) #endif nr_ulsch_decoding(gNB, frame_parms, frame, subframe, &UE_id, 1); if (harq_process_gNB->processedSegments == harq_process_gNB->C) { - bool crc_valid = check_crc(harq_process_gNB->b, lenWithCrc(1, (harq_process_gNB->TBS) << 3), crcType(1, (harq_process_gNB->TBS) << 3)); + bool crc_valid = check_crc(harq_process_gNB->b, lenWithCrc(1, TBS << 3), crcType(1, TBS << 3)); if (!crc_valid) { n_false_positive++; }