Commit 3f075015 authored by Thomas Schlichter's avatar Thomas Schlichter

gNB: fix NTN real-time issue for large k2 values (e.g. GEO satellite)

move allocation of UL_tti_req_ahead array from scheduling to start-up phase
parent b2ce70e3
...@@ -475,13 +475,17 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, ...@@ -475,13 +475,17 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac,
scc->ssb_PositionsInBurst->present); scc->ssb_PositionsInBurst->present);
const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; 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 int 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));
nrmac->vrb_map_UL_size = size;
nrmac->common_channels[0].vrb_map_UL = calloc(size * MAX_BWP_SIZE, sizeof(uint16_t));
AssertFatal(nrmac->common_channels[0].vrb_map_UL, AssertFatal(nrmac->common_channels[0].vrb_map_UL,
"could not allocate memory for RC.nrmac[]->common_channels[0].vrb_map_UL\n"); "could not allocate memory for RC.nrmac[]->common_channels[0].vrb_map_UL\n");
nrmac->UL_tti_req_ahead_size = size;
nrmac->UL_tti_req_ahead[0] = calloc(size, sizeof(nfapi_nr_ul_tti_request_t));
AssertFatal(nrmac->UL_tti_req_ahead[0], "could not allocate memory for nrmac->UL_tti_req_ahead[0]\n");
LOG_I(NR_MAC, "Configuring common parameters from NR ServingCellConfig\n"); LOG_I(NR_MAC, "Configuring common parameters from NR ServingCellConfig\n");
int num_pdsch_antenna_ports = pdsch_AntennaPorts.N1 * pdsch_AntennaPorts.N2 * pdsch_AntennaPorts.XP; int num_pdsch_antenna_ports = pdsch_AntennaPorts.N1 * pdsch_AntennaPorts.N2 * pdsch_AntennaPorts.XP;
......
...@@ -2906,22 +2906,16 @@ int ul_buffer_index(int frame, int slot, int scs, int size) ...@@ -2906,22 +2906,16 @@ int ul_buffer_index(int frame, int slot, int scs, int size)
void UL_tti_req_ahead_initialization(gNB_MAC_INST * gNB, NR_ServingCellConfigCommon_t *scc, int n, int CCid, frame_t frameP, int slotP, int scs) void UL_tti_req_ahead_initialization(gNB_MAC_INST * gNB, NR_ServingCellConfigCommon_t *scc, int n, int CCid, frame_t frameP, int slotP, int scs)
{ {
if(gNB->UL_tti_req_ahead[CCid][1].Slot == 1)
if(gNB->UL_tti_req_ahead[CCid])
return; return;
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));
AssertFatal(gNB->UL_tti_req_ahead[CCid], "could not allocate memory for gNB->UL_tti_req_ahead[]\n");
/* fill in slot/frame numbers: slot is fixed, frame will be updated by scheduler /* fill in slot/frame numbers: slot is fixed, frame will be updated by scheduler
* consider that scheduler runs sl_ahead: the first sl_ahead slots are * consider that scheduler runs sl_ahead: the first sl_ahead slots are
* already "in the past" and thus we put frame 1 instead of 0! */ * already "in the past" and thus we put frame 1 instead of 0! */
for (int i = 0; i < size; ++i) { for (int i = 0; i < gNB->UL_tti_req_ahead_size; ++i) {
int abs_slot = frameP * n + slotP + i; int abs_slot = frameP * n + slotP + i;
nfapi_nr_ul_tti_request_t *req = &gNB->UL_tti_req_ahead[CCid][abs_slot % size]; nfapi_nr_ul_tti_request_t *req = &gNB->UL_tti_req_ahead[CCid][abs_slot % gNB->UL_tti_req_ahead_size];
req->SFN = (abs_slot / n) % MAX_FRAME_NUMBER; req->SFN = (abs_slot / n) % MAX_FRAME_NUMBER;
req->Slot = abs_slot % n; req->Slot = abs_slot % n;
} }
......
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