Commit eda5c9f4 authored by Thomas Schlichter's avatar Thomas Schlichter

gNB: increase sizes of UL_tti_req_ahead, vrb_map_UL and sched_pucch arrays for large k2 values

parent 28cd6b78
......@@ -456,6 +456,8 @@ int nr_transmission_action_indicator_stop(module_id_t module_id, rnti_t rnti)
return 0;
}
extern uint16_t NTN_gNB_k2;
void nr_mac_config_scc(gNB_MAC_INST *nrmac,
rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts,
int pusch_AntennaPorts,
......@@ -472,11 +474,10 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac,
"SSB Bitmap type %d is not valid\n",
scc->ssb_PositionsInBurst->present);
int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
if (*scc->ssbSubcarrierSpacing == 0)
n <<= 1; // to have enough room for feedback possibly beyond the frame we need a larger array at 15kHz SCS
nrmac->common_channels[0].vrb_map_UL = calloc(n * MAX_BWP_SIZE, sizeof(uint16_t));
nrmac->vrb_map_UL_size = n;
const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
nrmac->vrb_map_UL_size = n << (int)ceil(log2((NTN_gNB_k2+13)/n+1)); // 13 is upper limit for max_fb_time
nrmac->common_channels[0].vrb_map_UL = calloc(nrmac->vrb_map_UL_size * MAX_BWP_SIZE, sizeof(uint16_t));
AssertFatal(nrmac->common_channels[0].vrb_map_UL,
"could not allocate memory for RC.nrmac[]->common_channels[0].vrb_map_UL\n");
......
......@@ -2383,7 +2383,7 @@ void set_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl,
const int n_ul_slots_period = tdd ? tdd->nrofUplinkSlots + (tdd->nrofUplinkSymbols > 0 ? 1 : 0) : n_slots_frame;
// PUCCH list size is given by the number of UL slots in the PUCCH period
// the length PUCCH period is determined by max_fb_time since we may need to prepare PUCCH for ACK/NACK max_fb_time slots ahead
const int list_size = n_ul_slots_period << (ul_bwp->max_fb_time/nr_slots_period);
const int list_size = n_ul_slots_period << (int)ceil(log2(ul_bwp->max_fb_time/nr_slots_period+1));
if(!sched_ctrl->sched_pucch) {
sched_ctrl->sched_pucch = calloc(list_size, sizeof(*sched_ctrl->sched_pucch));
sched_ctrl->sched_pucch_size = list_size;
......@@ -2910,9 +2910,7 @@ void UL_tti_req_ahead_initialization(gNB_MAC_INST * gNB, NR_ServingCellConfigCom
if(gNB->UL_tti_req_ahead[CCid])
return;
int size = n;
if (scs == 0)
size <<= 1; // to have enough room for feedback possibly beyond the frame we need a larger array at 15kHz SCS
int size = n << (int)ceil(log2((NTN_gNB_k2+13)/n+1)); // 13 is upper limit for max_fb_time
gNB->UL_tti_req_ahead_size = size;
gNB->UL_tti_req_ahead[CCid] = calloc(size, sizeof(nfapi_nr_ul_tti_request_t));
......
......@@ -2128,7 +2128,6 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, n
if (get_softmodem_params()->no_harq) {
/* added to front ofthe list to reuse same harq ID */
add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_id);
LOG_D(MAC, "Ulharq id %d Released due to NO_HARQ flag. \n",harq_id);
cur_harq->feedback_slot = -1;
cur_harq->is_waiting = false;
cur_harq->ndi ^=1;
......@@ -2205,8 +2204,8 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, n
/* PUSCH in a later slot, but corresponding DCI now! */
const int index = ul_buffer_index(sched_pusch->frame, sched_pusch->slot, current_BWP->scs, nr_mac->UL_tti_req_ahead_size);
nfapi_nr_ul_tti_request_t *future_ul_tti_req = &nr_mac->UL_tti_req_ahead[0][index];
//if (future_ul_tti_req->SFN != sched_pusch->frame || future_ul_tti_req->Slot != sched_pusch->slot)
LOG_D(MAC,
if (future_ul_tti_req->SFN != sched_pusch->frame || future_ul_tti_req->Slot != sched_pusch->slot)
LOG_W(MAC,
"%d.%d future UL_tti_req's frame.slot %d.%d does not match PUSCH %d.%d\n",
frame, slot,
future_ul_tti_req->SFN,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment