Commit 05acd239 authored by Robert Schmidt's avatar Robert Schmidt

Keep track of used PUCCH resources

parent 0373d6b1
...@@ -350,6 +350,14 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ...@@ -350,6 +350,14 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
AssertFatal(RC.nrmac[Mod_idP]->common_channels[0].vrb_map_UL, AssertFatal(RC.nrmac[Mod_idP]->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");
for (int i = 0; i < MAX_NUM_BWP; ++i) {
RC.nrmac[Mod_idP]->pucch_index_used[i] =
calloc(n, sizeof(*RC.nrmac[Mod_idP]->pucch_index_used));
AssertFatal(RC.nrmac[Mod_idP]->pucch_index_used[i],
"could not allocate memory for RC.nrmac[]->pucch_index_used[%d]\n",
i);
}
LOG_I(MAC,"Configuring common parameters from NR ServingCellConfig\n"); LOG_I(MAC,"Configuring common parameters from NR ServingCellConfig\n");
config_common(Mod_idP, config_common(Mod_idP,
......
...@@ -456,12 +456,15 @@ bool nr_acknack_scheduling(int mod_id, ...@@ -456,12 +456,15 @@ bool nr_acknack_scheduling(int mod_id,
curr_pucch->frame = frame; curr_pucch->frame = frame;
curr_pucch->dai_c++; curr_pucch->dai_c++;
int *pucch_index_used = RC.nrmac[mod_id]->pucch_index_used[sched_ctrl->active_ubwp->bwp_Id];
if (curr_pucch->dai_c == 1) { if (curr_pucch->dai_c == 1) {
/* FIXME for first allocation: find free resource, here assume first PUCCH /* FIXME for first allocation: find free resource, here assume first PUCCH
* resource and first_ul_slot_tdd */ * resource and first_ul_slot_tdd */
const int pucch_res = 0; const int pucch_res = 0;
curr_pucch->resource_indicator = pucch_res; curr_pucch->resource_indicator = pucch_res;
curr_pucch->ul_slot = first_ul_slot_tdd; curr_pucch->ul_slot = first_ul_slot_tdd;
DevAssert(pucch_index_used[first_ul_slot_tdd] == 0);
pucch_index_used[first_ul_slot_tdd] += 1;
/* verify that at that slot and symbol, resources are free. /* verify that at that slot and symbol, resources are free.
* Note: this does not handle potential mux of PUCCH in the same symbol! */ * Note: this does not handle potential mux of PUCCH in the same symbol! */
......
...@@ -551,6 +551,10 @@ typedef struct gNB_MAC_INST_s { ...@@ -551,6 +551,10 @@ typedef struct gNB_MAC_INST_s {
time_stats_t schedule_pch; time_stats_t schedule_pch;
/// CCE lists /// CCE lists
int cce_list[MAX_NUM_BWP][MAX_NUM_CORESET][MAX_NUM_CCE]; int cce_list[MAX_NUM_BWP][MAX_NUM_CORESET][MAX_NUM_CCE];
/// PUCCH: keep track of the resources has already been used by saving the
/// highest index not yet been used in a given slot. Dynamically allocated
/// so we can have it for every slot as a function of the numerology
int *pucch_index_used[MAX_NUM_BWP];
/// DL preprocessor for differentiated scheduling /// DL preprocessor for differentiated scheduling
nr_pp_impl_dl pre_processor_dl; nr_pp_impl_dl pre_processor_dl;
......
...@@ -104,6 +104,9 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) ...@@ -104,6 +104,9 @@ void handle_nr_uci(NR_UL_IND_t *UL_info)
} }
UL_info->uci_ind.num_ucis = 0; UL_info->uci_ind.num_ucis = 0;
// mark corresponding PUCCH resources as free
// NOTE: we just assume it is BWP ID 1, to be revised for multiple BWPs
RC.nrmac[mod_id]->pucch_index_used[1][slot] = 0;
} }
......
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