Commit 61e608ad authored by Robert Schmidt's avatar Robert Schmidt

Support reconfiguration of number of HARQ processes

In F1, the time until the serving cell config comes from CU can be
longer than when we want to schedule a particular UE. Then, if we don't
configure the default number of HARQ processes, we can have a segfault.

In this commit, we initially configure 8 HARQ processes. When we get the
right number from RRC, we reconfigure.
parent 048b5390
...@@ -628,16 +628,10 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ...@@ -628,16 +628,10 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
const NR_ServingCellConfig_t *servingCellConfig = CellGroup ? CellGroup->spCellConfig->spCellConfigDedicated : NULL; const NR_ServingCellConfig_t *servingCellConfig = CellGroup ? CellGroup->spCellConfig->spCellConfigDedicated : NULL;
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL; const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL;
if (sched_ctrl->available_dl_harq.len == 0) { if (get_softmodem_params()->sa) {
// add all available DL HARQ processes for this UE in SA // add all available DL HARQ processes for this UE in SA
create_dl_harq_list(sched_ctrl, pdsch); create_dl_harq_list(sched_ctrl, pdsch);
} }
else {
const int nrofHARQ = pdsch && pdsch->nrofHARQ_ProcessesForPDSCH ?
get_nrofHARQ_ProcessesForPDSCH(*pdsch->nrofHARQ_ProcessesForPDSCH) : 8;
AssertFatal(sched_ctrl->available_dl_harq.len==nrofHARQ,
"Reconfiguration of available harq processes not yet supported\n");
}
// update coreset/searchspace // update coreset/searchspace
void *bwpd = NULL; void *bwpd = NULL;
NR_BWP_t *genericParameters = NULL; NR_BWP_t *genericParameters = NULL;
......
...@@ -1942,14 +1942,46 @@ void dump_nr_list(NR_list_t *listP) ...@@ -1942,14 +1942,46 @@ void dump_nr_list(NR_list_t *listP)
void create_nr_list(NR_list_t *list, int len) void create_nr_list(NR_list_t *list, int len)
{ {
list->head = -1; list->head = -1;
list->next = calloc(len, sizeof(*list->next)); list->next = malloc(len * sizeof(*list->next));
AssertFatal(list, "cannot calloc() memory for NR_list_t->next\n"); LOG_W(NR_MAC, "NR list->next %p\n", list->next);
AssertFatal(list->next, "cannot calloc() memory for NR_list_t->next\n");
for (int i = 0; i < len; ++i) for (int i = 0; i < len; ++i)
list->next[i] = -1; list->next[i] = -1;
list->tail = -1; list->tail = -1;
list->len = len; list->len = len;
} }
/*
* Resize an NR_list
*/
void resize_nr_list(NR_list_t *list, int new_len)
{
if (new_len == list->len)
return;
if (new_len > list->len) {
/* list->head remains */
const int old_len = list->len;
int* n = realloc(list->next, new_len * sizeof(*list->next));
AssertFatal(n, "cannot realloc() memory for NR_list_t->next\n");
list->next = n;
for (int i = old_len; i < new_len; ++i)
list->next[i] = -1;
/* list->tail remains */
list->len = new_len;
} else { /* new_len < len */
AssertFatal(list->head < new_len, "shortened list head out of index %d (new len %d)\n", list->head, new_len);
AssertFatal(list->tail < new_len, "shortened list tail out of index %d (new len %d)\n", list->head, new_len);
for (int i = 0; i < list->len; ++i)
AssertFatal(list->next[i] < new_len, "shortened list entry out of index %d (new len %d)\n", list->next[i], new_len);
/* list->head remains */
int *n = realloc(list->next, new_len * sizeof(*list->next));
AssertFatal(n, "cannot realloc() memory for NR_list_t->next\n");
list->next = n;
/* list->tail remains */
list->len = new_len;
}
}
/* /*
* Destroy an NR_list * Destroy an NR_list
*/ */
...@@ -2205,10 +2237,8 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG ...@@ -2205,10 +2237,8 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG
"no pdsch-ServingCellConfig found for UE %d\n", "no pdsch-ServingCellConfig found for UE %d\n",
UE_id); UE_id);
const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL; const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL;
// add DL HARQ processes for this UE only in NSA // pdsch == NULL in SA -> will create default (8) number of HARQ processes
// (SA still doesn't have information on nrofHARQ_ProcessesForPDSCH at this stage) create_dl_harq_list(sched_ctrl, pdsch);
if (!get_softmodem_params()->sa)
create_dl_harq_list(sched_ctrl,pdsch);
// add all available UL HARQ processes for this UE // add all available UL HARQ processes for this UE
// nb of ul harq processes not configurable // nb of ul harq processes not configurable
create_nr_list(&sched_ctrl->available_ul_harq, 16); create_nr_list(&sched_ctrl->available_ul_harq, 16);
...@@ -2236,11 +2266,23 @@ void create_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl, ...@@ -2236,11 +2266,23 @@ void create_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl,
const int nrofHARQ = pdsch && pdsch->nrofHARQ_ProcessesForPDSCH ? const int nrofHARQ = pdsch && pdsch->nrofHARQ_ProcessesForPDSCH ?
get_nrofHARQ_ProcessesForPDSCH(*pdsch->nrofHARQ_ProcessesForPDSCH) : 8; get_nrofHARQ_ProcessesForPDSCH(*pdsch->nrofHARQ_ProcessesForPDSCH) : 8;
// add all available DL HARQ processes for this UE // add all available DL HARQ processes for this UE
create_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ); AssertFatal(sched_ctrl->available_dl_harq.len == sched_ctrl->feedback_dl_harq.len
for (int harq = 0; harq < nrofHARQ; harq++) && sched_ctrl->available_dl_harq.len == sched_ctrl->retrans_dl_harq.len,
add_tail_nr_list(&sched_ctrl->available_dl_harq, harq); "HARQ lists have different lengths (%d/%d/%d)\n",
create_nr_list(&sched_ctrl->feedback_dl_harq, nrofHARQ); sched_ctrl->available_dl_harq.len,
create_nr_list(&sched_ctrl->retrans_dl_harq, nrofHARQ); sched_ctrl->feedback_dl_harq.len,
sched_ctrl->retrans_dl_harq.len);
if (sched_ctrl->available_dl_harq.len == 0) {
create_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ);
for (int harq = 0; harq < nrofHARQ; harq++)
add_tail_nr_list(&sched_ctrl->available_dl_harq, harq);
create_nr_list(&sched_ctrl->feedback_dl_harq, nrofHARQ);
create_nr_list(&sched_ctrl->retrans_dl_harq, nrofHARQ);
} else {
resize_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ);
resize_nr_list(&sched_ctrl->feedback_dl_harq, nrofHARQ);
resize_nr_list(&sched_ctrl->retrans_dl_harq, nrofHARQ);
}
} }
/* hack data to remove UE in the phy */ /* hack data to remove UE in the phy */
......
...@@ -351,6 +351,7 @@ int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB); ...@@ -351,6 +351,7 @@ int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB);
/* Functions to manage an NR_list_t */ /* Functions to manage an NR_list_t */
void dump_nr_list(NR_list_t *listP); void dump_nr_list(NR_list_t *listP);
void create_nr_list(NR_list_t *listP, int len); void create_nr_list(NR_list_t *listP, int len);
void resize_nr_list(NR_list_t *list, int new_len);
void destroy_nr_list(NR_list_t *list); void destroy_nr_list(NR_list_t *list);
void add_nr_list(NR_list_t *listP, int id); void add_nr_list(NR_list_t *listP, int id);
void remove_nr_list(NR_list_t *listP, int id); void remove_nr_list(NR_list_t *listP, int id);
......
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