From a1902a03f8429590bda560d9a99776f15d719014 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Thu, 23 May 2024 09:16:04 +0200 Subject: [PATCH] Accumulate delta PUCCH for each PUCCH occasion. --- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 1 - openair2/LAYER2/NR_MAC_UE/mac_proto.h | 1 + openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 3 +-- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 27 +++++++++++++++++--- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 1 + 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 2cda190f23..b77bf953e8 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -394,7 +394,6 @@ typedef struct { int n_harq; int n_CCE; int N_CCE; - int delta_pucch; int initial_pucch_id; } PUCCH_sched_t; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 1eac68350c..7b31d999ce 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -228,6 +228,7 @@ int get_deltatf(uint16_t nb_of_prbs, int nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, int slot, + frame_t frame, uint16_t rnti, PUCCH_sched_t *pucch, fapi_nr_ul_config_pucch_pdu *pucch_pdu); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 4d74e4985a..5831bd2b11 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -930,7 +930,6 @@ void prepare_msg4_feedback(NR_UE_MAC_INST_t *mac, int pid, int ack_nack) mac->nr_ue_emul_l1.num_harqs = 1; PUCCH_sched_t pucch = {.n_CCE = current_harq->n_CCE, .N_CCE = current_harq->N_CCE, - .delta_pucch = current_harq->delta_pucch, .ack_payload = ack_nack, .n_harq = 1}; current_harq->active = false; @@ -943,7 +942,7 @@ void prepare_msg4_feedback(NR_UE_MAC_INST_t *mac, int pid, int ack_nack) fapi_nr_ul_config_request_pdu_t *pdu = lockGet_ul_config(mac, sched_frame, sched_slot, FAPI_NR_UL_CONFIG_TYPE_PUCCH); if (!pdu) return; - int ret = nr_ue_configure_pucch(mac, sched_slot, mac->ra.t_crnti, &pucch, &pdu->pucch_config_pdu); + int ret = nr_ue_configure_pucch(mac, sched_slot, sched_frame, mac->ra.t_crnti, &pucch, &pdu->pucch_config_pdu); if (ret != 0) remove_ul_config_last_item(pdu); release_ul_config(pdu, false); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 8b9b325a92..dddd20123c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -104,6 +104,7 @@ random-access procedure @returns timing advance or 0xffff if preamble doesn't match */ static void nr_ue_process_rar(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info, int pdu_id); +int get_sum_delta_pucch(NR_UE_MAC_INST_t *mac, int slot, frame_t frame); int get_pucch0_mcs(const int O_ACK, const int O_SR, const int ack_payload, const int sr_payload) { @@ -1381,6 +1382,7 @@ void set_harq_status(NR_UE_MAC_INST_t *mac, int nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, int slot, + frame_t frame, uint16_t rnti, PUCCH_sched_t *pucch, fapi_nr_ul_config_pucch_pdu *pucch_pdu) @@ -1579,10 +1581,12 @@ int nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, return -1; } + int sum_delta_pucch = get_sum_delta_pucch(mac, slot, frame); + pucch_pdu->pucch_tx_power = get_pucch_tx_power_ue(mac, scs, pucch_Config, - pucch->delta_pucch, + sum_delta_pucch, pucch_pdu->format_type, pucch_pdu->prb_size, pucch_pdu->freq_hop_flag, @@ -1629,7 +1633,7 @@ int nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac, int scs, NR_PUCCH_Config_t *pucch_Config, - int delta_pucch, + int sum_delta_pucch, uint8_t format_type, uint16_t nb_of_prbs, uint8_t freq_hop_flag, @@ -1666,7 +1670,7 @@ int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac, G_b_f_c = 0; } else { - G_b_f_c = delta_pucch; + G_b_f_c = sum_delta_pucch; LOG_E(MAC,"PUCCH Transmit power control command not yet implemented for NR\n"); return (PUCCH_POWER_DEFAULT); } @@ -2362,7 +2366,6 @@ bool get_downlink_ack(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, PUCCH_sche res_ind = temp_ind; pucch->n_CCE = current_harq->n_CCE; pucch->N_CCE = current_harq->N_CCE; - pucch->delta_pucch = current_harq->delta_pucch; LOG_D(NR_MAC,"%4d.%2d Sent %d ack on harq pid %d\n", frame, slot, current_harq->ack, dl_harq_pid); } } @@ -4065,3 +4068,19 @@ int16_t compute_nr_SSB_PL(NR_UE_MAC_INST_t *mac, short ssb_rsrp_dBm) return pathloss; } + +// This is not entirely correct. In certain k2/k1/k0 settings we might postpone accumulating delta_PUCCH until next HARQ feedback +// slot. The correct way to do this would be to calculate the K_PUCCH (delta_PUCCH summation window end) for each PUCCH occasion and +// compare PUCCH transmission symbol with the reception symbol of the DCI containing delta_PUCCH to determine if the delta_PUCCH +// should be added at each occasion. +int get_sum_delta_pucch(NR_UE_MAC_INST_t *mac, int slot, frame_t frame) +{ + int delta_tpc_sum = 0; + for (int i = 0; i < NR_MAX_HARQ_PROCESSES; i++) { + if (mac->dl_harq_info[i].active && mac->dl_harq_info[i].ul_slot == slot && mac->dl_harq_info[i].ul_frame == frame) { + delta_tpc_sum += mac->dl_harq_info[i].delta_pucch; + mac->dl_harq_info[i].delta_pucch = 0; + } + } + return delta_tpc_sum; +} diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 54065ad757..2a2f2638ac 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -2064,6 +2064,7 @@ void nr_ue_pucch_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, int slotP, voi mac->nr_ue_emul_l1.active_uci_sfn_slot = NFAPI_SFNSLOT2HEX(frameP, slotP); int ret = nr_ue_configure_pucch(mac, slotP, + frameP, mac->crnti, // FIXME not sure this is valid for all pucch instances &pucch[j], &pdu->pucch_config_pdu);