From 1aed7b5802a1e5d217ea22e60ec5db0274083129 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 24 Nov 2025 11:59:00 +0100 Subject: [PATCH] Cleanly pass pusch_vars to nr_pusch_channel_estimation() Pass pointer to data. This necessitates to move delay from NR_gNB_ULSCH_t (ULSCH data, including transport channels etc) to NR_gNB_PUSCH (lower-PHY PUSCH data): 1. This allows to pass a single pointer to nr_pusch_channel_estimation() 2. To me, delay estimation seems to be a lower-PHY calculation, so it fits better anyway. Signed-off-by: Robert Schmidt --- openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c | 6 +++--- openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h | 4 ++-- openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 2 +- openair1/PHY/defs_gNB.h | 3 ++- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- openair1/SIMULATION/NR_PHY/ulsim.c | 8 ++++---- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index 4d70db6f02..68196e78c7 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -452,7 +452,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, int nl, unsigned short p, unsigned char symbol, - int ul_id, + NR_gNB_PUSCH *pusch_vars, int beam_nb, unsigned short bwp_start_subcarrier, nfapi_nr_pusch_pdu_t *pusch_pdu, @@ -534,7 +534,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, int nest_count = 0; uint64_t noise_amp2 = 0; - delay_t *delay = &gNB->ulsch[ul_id].delay; + delay_t *delay = &pusch_vars->delay; memset(delay, 0, sizeof(*delay)); int nb_antennas_rx = fp->nb_antennas_rx; @@ -579,7 +579,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, rdata->delay = &delay_arr[rdata->aarx]; rdata->beam_nb = beam_nb; rdata->frame_parms = fp; - rdata->pusch_vars = &gNB->pusch_vars[ul_id]; + rdata->pusch_vars = pusch_vars; rdata->chest_freq = gNB->chest_freq; rdata->rxdataF = gNB->common_vars.rxdataF; rdata->scope = gNB->scopeData; diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h b/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h index 540a04ec52..57bac0dccc 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h @@ -17,7 +17,7 @@ \param Ns slot number (0..19) \param p \param symbol symbol within slot -\param ul_id +\param pusch_vars lower-phy PUSCH info \param bwp_start_subcarrier first allocated subcarrier \param pusch_pdu \param max_ch maximum value of estimated channel @@ -29,7 +29,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, int nl, unsigned short p, unsigned char symbol, - int ul_id, + NR_gNB_PUSCH *pusch_vars, int beam_nb, unsigned short bwp_start_subcarrier, nfapi_nr_pusch_pdu_t *pusch_pdu, diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 82d6b0d99d..1984c4b03c 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -1159,7 +1159,7 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB, uint8_t ulsch_id, uint32_t frame, uint8_t nl, get_dmrs_port(nl, rel15_ul->dmrs_ports), symbol, - ulsch_id, + pusch_vars, beam_nb, bwp_start_subcarrier, rel15_ul, diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 9657cef20d..bd611bbe8f 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -187,7 +187,6 @@ typedef struct { bool active; /// Flag to indicate that the UL configuration has been handled. Used to remove a stale ULSCH when frame wraps around uint8_t handled; - delay_t delay; } NR_gNB_ULSCH_t; typedef struct { @@ -275,6 +274,8 @@ typedef struct { int llr_offset[14]; /// flag to indicate DTX on reception int DTX; + /// delay estimation + delay_t delay; } NR_gNB_PUSCH; /// Context data structure for RX/TX portion of slot processing diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 1f28622231..7f6ae103c5 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -542,7 +542,7 @@ static void nr_fill_indication(PHY_VARS_gNB *gNB, nfapi_nr_pusch_pdu_t *pusch_pdu = &harq_process->ulsch_pdu; // Get estimated timing advance for MAC - const int sync_pos = gNB->ulsch[ULSCH_id].delay.est_delay; + const int sync_pos = pusch->delay.est_delay; // scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size uint16_t bw_scaling = 16 * gNB->frame_parms.ofdm_symbol_size / 2048; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 0d432bfdd0..011b7ee680 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -1208,6 +1208,7 @@ int main(int argc, char *argv[]) uint8_t round = 0; crc_status = 1; errors_decoding = 0; + NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[UE_id]; while (round < max_rounds && crc_status && !stop) { @@ -1594,7 +1595,6 @@ int main(int argc, char *argv[]) } } - NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[UE_id]; if (n_trials == 1 && round == 0) { __attribute__((unused)) int off = ((nb_rb & 1) == 1) ? 4 : 0; @@ -1742,9 +1742,9 @@ int main(int argc, char *argv[]) if (!crc_status) effRate += ((double)TBS) / (double)round; - sum_pusch_delay += ulsch_gNB->delay.est_delay; - min_pusch_delay = min(ulsch_gNB->delay.est_delay, min_pusch_delay); - max_pusch_delay = max(ulsch_gNB->delay.est_delay, max_pusch_delay); + sum_pusch_delay += pusch_vars->delay.est_delay; + min_pusch_delay = min(pusch_vars->delay.est_delay, min_pusch_delay); + max_pusch_delay = max(pusch_vars->delay.est_delay, max_pusch_delay); delay_pusch_est_count++; if (do_SRS == 1) {