Commit e2f35a2d authored by Chieh-Chun Chen's avatar Chieh-Chun Chen

Fix: add default slice while initializing slice

parent bdfea1d0
...@@ -59,6 +59,7 @@ static int add_mod_dl_slice(int mod_id, ...@@ -59,6 +59,7 @@ static int add_mod_dl_slice(int mod_id,
char* label, char* label,
int64_t pct_reserved) int64_t pct_reserved)
{ {
nr_pp_impl_param_dl_t *dl = &RC.nrmac[mod_id]->pre_processor_dl;
void *params = NULL; void *params = NULL;
char *slice_algo = NULL; char *slice_algo = NULL;
if (current_algo == NVS_SLICING) { if (current_algo == NVS_SLICING) {
...@@ -67,12 +68,12 @@ static int add_mod_dl_slice(int mod_id, ...@@ -67,12 +68,12 @@ static int add_mod_dl_slice(int mod_id,
// use SLICE_SM_NVS_V0_CAPACITY by default // use SLICE_SM_NVS_V0_CAPACITY by default
slice_algo = strdup("NVS_CAPACITY"); slice_algo = strdup("NVS_CAPACITY");
((nvs_nr_slice_param_t *)params)->type = NVS_RES; ((nvs_nr_slice_param_t *)params)->type = NVS_RES;
((nvs_nr_slice_param_t *)params)->pct_reserved = pct_reserved/100.0; float remain_pct = 1-((nvs_nr_slice_param_t *)dl->slices->s[0]->algo_data)->pct_reserved;
((nvs_nr_slice_param_t *)params)->pct_reserved = pct_reserved/100.0*remain_pct;
} else { } else {
assert(0 != 0 && "Unknow current_algo"); assert(0 != 0 && "Unknow current_algo");
} }
nr_pp_impl_param_dl_t *dl = &RC.nrmac[mod_id]->pre_processor_dl;
void *algo = &dl->dl_algo; void *algo = &dl->dl_algo;
char *l = NULL; char *l = NULL;
if (label) if (label)
......
...@@ -110,12 +110,10 @@ void nr_slicing_add_UE(nr_slice_info_t *si, NR_UE_info_t *new_ue) ...@@ -110,12 +110,10 @@ void nr_slicing_add_UE(nr_slice_info_t *si, NR_UE_info_t *new_ue)
} else { } else {
LOG_E(NR_MAC, "cannot add new UE rnti 0x%04x to slice idx %d, num_UEs %d\n", new_ue->rnti, i, si->s[i]->num_UEs); LOG_E(NR_MAC, "cannot add new UE rnti 0x%04x to slice idx %d, num_UEs %d\n", new_ue->rnti, i, si->s[i]->num_UEs);
} }
LOG_W(NR_MAC, LOG_W(NR_MAC, "Matched UE, Add UE rnti 0x%04x to slice idx %d, sst %d, sd %d\n",
"Add UE rnti 0x%04x to slice idx %d, sst %d, sd %d\n", new_ue->rnti, i, si->s[i]->nssai.sst, si->s[i]->nssai.sd);
new_ue->rnti, } else {
i, LOG_W(NR_MAC, "cannot find matched UE, do nothing for UE rnti 0x%04x\n", new_ue->rnti);
si->s[i]->nssai.sst,
si->s[i]->nssai.sd);
} }
} }
} }
...@@ -558,17 +556,20 @@ nr_pp_impl_param_dl_t nvs_nr_dl_init(module_id_t mod_id) ...@@ -558,17 +556,20 @@ nr_pp_impl_param_dl_t nvs_nr_dl_init(module_id_t mod_id)
/* insert default slice, all resources */ /* insert default slice, all resources */
nvs_nr_slice_param_t *dlp = malloc(sizeof(nvs_nr_slice_param_t)); nvs_nr_slice_param_t *dlp = malloc(sizeof(nvs_nr_slice_param_t));
DevAssert(dlp); DevAssert(dlp);
NR_UEs_t *UE_info = &RC.nrmac[mod_id]->UE_info;
int num_ue = 0;
UE_iterator(UE_info->list, UE) {
num_ue += 1;
}
dlp->type = NVS_RES; dlp->type = NVS_RES;
dlp->pct_reserved = 1.0f; dlp->pct_reserved = 0.05f*num_ue;
nr_dl_sched_algo_t *algo = &RC.nrmac[mod_id]->pre_processor_dl.dl_algo; nr_dl_sched_algo_t *algo = &RC.nrmac[mod_id]->pre_processor_dl.dl_algo;
algo->data = NULL; algo->data = NULL;
// default slice: sst = 1, sd = 0x000000, id = 999, label = default
nssai_t nssai = {.sst = 1, .sd = 0}; nssai_t nssai = {.sst = 1, .sd = 0};
const int rc = addmod_nvs_nr_slice_dl(si, 0, nssai, strdup("default"), algo, dlp); const int rc = addmod_nvs_nr_slice_dl(si, 99, nssai, strdup("default"), algo, dlp);
LOG_W(NR_MAC, "Add default DL slice id 999, label default, sst %d, sd %d, slice sched algo NVS_CAPACITY, pct_reserved %.2f, ue sched algo %s\n", nssai.sst, nssai.sd, dlp->pct_reserved, algo->name);
DevAssert(0 == rc); DevAssert(0 == rc);
NR_UEs_t *UE_info = &RC.nrmac[mod_id]->UE_info;
UE_iterator(UE_info->list, UE) {
nr_slicing_add_UE(si, UE);
}
nr_pp_impl_param_dl_t nvs; nr_pp_impl_param_dl_t nvs;
......
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