From c4e27cf8b4a7b95740c104d7f60fb9b9c1f8f9e4 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Tue, 21 Sep 2021 15:07:45 -0700 Subject: [PATCH] Properly assigning the rx_ind.pdu pointer Also, the ul_slot was not properly wrapping. It was increased to a value greater than the largest slot value. --- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 13 ++++++++++++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 8 ++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 8f13fdab8c..954b9867dc 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -87,8 +87,9 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[j]; rx_ind->pdu_list[j].handle = pusch_config_pdu->handle; rx_ind->pdu_list[j].harq_id = pusch_config_pdu->pusch_data.harq_process_id; - rx_ind->pdu_list[j].pdu = tx_req_body->pdu; rx_ind->pdu_list[j].pdu_length = tx_req_body->pdu_length; + rx_ind->pdu_list[j].pdu = CALLOC(tx_req_body->pdu_length, sizeof(*rx_ind->pdu_list[j].pdu)); + memcpy(rx_ind->pdu_list[j].pdu, tx_req_body->pdu, tx_req_body->pdu_length * sizeof(*rx_ind->pdu_list[j].pdu)); rx_ind->pdu_list[j].rnti = pusch_config_pdu->rnti; rx_ind->pdu_list[j].timing_advance = scheduled_response->tx_request->tx_config.timing_advance; rx_ind->pdu_list[j].ul_cqi = scheduled_response->tx_request->tx_config.ul_cqi; @@ -120,14 +121,24 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response if (!put_queue(&nr_rx_ind_queue, rx_ind)) { LOG_E(NR_MAC, "Put_queue failed for rx_ind\n"); + for (int i = 0; i < rx_ind->number_of_pdus; i++) + { + free(rx_ind->pdu_list[i].pdu); + rx_ind->pdu_list[i].pdu = NULL; + } + free(rx_ind->pdu_list); + rx_ind->pdu_list = NULL; free(rx_ind); + rx_ind = NULL; } if (!put_queue(&nr_crc_ind_queue, crc_ind)) { LOG_E(NR_MAC, "Put_queue failed for crc_ind\n"); free(crc_ind->crc_list); + crc_ind->crc_list = NULL; free(crc_ind); + crc_ind = NULL; } LOG_I(PHY, "In %s: Filled queue rx/crc_ind which was filled by ulconfig. \n", __FUNCTION__); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index d5ce9f0e21..f015e93b63 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1293,6 +1293,14 @@ int nr_acknack_scheduling(int mod_id, // advance ul_slot if it is not reachable by UE pucch->ul_slot = max(pucch->ul_slot, slot + pdsch_to_harq_feedback[0]); + /* We are not sure sure what is happening with this max() above. + It seems that the ul_slot will be updated to be + max(current ul_slot, curernt dl_slot + sf_ahead). Is this + the intention/correct? */ + if (pucch->ul_slot > 19) { + pucch->ul_slot = pucch->ul_slot % 20; + pucch->frame = (pucch->frame + 1) % 1024; + } // Find the right timing_indicator value. int i = 0;