Commit 30feed86 authored by wangdong's avatar wangdong

addmod_complete

parent dc6e10f6
...@@ -1035,6 +1035,7 @@ void update_or_remove_dl(mid_t mod_id, Protocol__FlexSlice *s) { ...@@ -1035,6 +1035,7 @@ void update_or_remove_dl(mid_t mod_id, Protocol__FlexSlice *s) {
} else { } else {
LOG_I(FLEXRAN_AGENT, "updating DL slice ID %d\n", s->id); LOG_I(FLEXRAN_AGENT, "updating DL slice ID %d\n", s->id);
const int rc = flexran_create_dl_slice(mod_id, s); const int rc = flexran_create_dl_slice(mod_id, s);
//pack
if (rc < 0){ if (rc < 0){
LOG_W(FLEXRAN_AGENT, LOG_W(FLEXRAN_AGENT,
"error while update slice ID %d: flexran_create_dl_slice() -> %d\n ", "error while update slice ID %d: flexran_create_dl_slice() -> %d\n ",
......
...@@ -84,6 +84,7 @@ message flex_slice_scn19 { ...@@ -84,6 +84,7 @@ message flex_slice_scn19 {
optional uint32 tau = 7; optional uint32 tau = 7;
optional uint32 delay = 8; optional uint32 delay = 8;
optional string type = 9; optional string type = 9;
optional uint32 typeid = 10;
} }
......
...@@ -3142,6 +3142,8 @@ int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s) { ...@@ -3142,6 +3142,8 @@ int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s) {
params = malloc(sizeof(scn19_slice_param_t)); params = malloc(sizeof(scn19_slice_param_t));
if (!params) return 0; if (!params) return 0;
((scn19_slice_param_t *)params)->type = s->scn19->type; ((scn19_slice_param_t *)params)->type = s->scn19->type;
if(s->scn19->has_typeid_)
((scn19_slice_param_t *)params)->typeid = s->scn19->typeid_;
if(s->scn19->has_poshigh){ if(s->scn19->has_poshigh){
((scn19_slice_param_t *)params)->posLow = s->scn19->poslow; ((scn19_slice_param_t *)params)->posLow = s->scn19->poslow;
((scn19_slice_param_t *)params)->posHigh = s->scn19->poshigh; ((scn19_slice_param_t *)params)->posHigh = s->scn19->poshigh;
...@@ -3149,7 +3151,7 @@ int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s) { ...@@ -3149,7 +3151,7 @@ int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s) {
((scn19_slice_param_t *)params)->posLow = NULL; ((scn19_slice_param_t *)params)->posLow = NULL;
((scn19_slice_param_t *)params)->posHigh = NULL; ((scn19_slice_param_t *)params)->posHigh = NULL;
} }
if(s->scn19->has_kpsrequired){ if(s->scn19->kpsreference){
((scn19_slice_param_t *)params)->kpsRequired = s->scn19->kpsrequired; ((scn19_slice_param_t *)params)->kpsRequired = s->scn19->kpsrequired;
((scn19_slice_param_t *)params)->kpsReference = s->scn19->kpsreference; ((scn19_slice_param_t *)params)->kpsReference = s->scn19->kpsreference;
}else{ }else{
...@@ -3157,6 +3159,7 @@ int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s) { ...@@ -3157,6 +3159,7 @@ int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s) {
((scn19_slice_param_t *)params)->kpsReference = NULL; ((scn19_slice_param_t *)params)->kpsReference = NULL;
} }
if(s->scn19->has_tau){ if(s->scn19->has_tau){
((scn19_slice_param_t *)params)->kpsRequired = s->scn19->kpsrequired;
((scn19_slice_param_t *)params)->tmax = s->scn19->tmax; ((scn19_slice_param_t *)params)->tmax = s->scn19->tmax;
((scn19_slice_param_t *)params)->logdelta = s->scn19->logdelta; ((scn19_slice_param_t *)params)->logdelta = s->scn19->logdelta;
((scn19_slice_param_t *)params)->tau = s->scn19->tau; ((scn19_slice_param_t *)params)->tau = s->scn19->tau;
...@@ -3183,6 +3186,7 @@ int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s) { ...@@ -3183,6 +3186,7 @@ int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s) {
return -15; return -15;
} }
} }
return dl->addmod_slice(dl->slices, s->id, l, algo, params); return dl->addmod_slice(dl->slices, s->id, l, algo, params);
} }
...@@ -3231,41 +3235,30 @@ void flexran_get_dl_slice(mid_t mod_id, ...@@ -3231,41 +3235,30 @@ void flexran_get_dl_slice(mid_t mod_id,
protocol__flex_slice_scn19__init(slice->scn19); protocol__flex_slice_scn19__init(slice->scn19);
// slice->scn19->has_type = 1; // slice->scn19->has_type = 1;
slice->scn19->type = ((scn19_slice_param_t *)s_->algo_data)->type; slice->scn19->type = ((scn19_slice_param_t *)s_->algo_data)->type;
if(((scn19_slice_param_t *)s_->algo_data)->kpsRequired != NULL){ slice->scn19->typeid_ = ((scn19_slice_param_t *)s_->algo_data)->typeid;
if(strcmp(slice->scn19->type ,"dynamic")==0){
slice->scn19->has_kpsrequired = 1; slice->scn19->has_kpsrequired = 1;
slice->scn19->kpsrequired = ((scn19_slice_param_t *)s_->algo_data)->kpsRequired; slice->scn19->kpsrequired = ((scn19_slice_param_t *)s_->algo_data)->kpsRequired;
}
if(((scn19_slice_param_t *)s_->algo_data)->kpsReference != NULL){
slice->scn19->has_kpsreference = 1; slice->scn19->has_kpsreference = 1;
slice->scn19->kpsrequired = ((scn19_slice_param_t *)s_->algo_data)->kpsRequired; slice->scn19->kpsreference = ((scn19_slice_param_t *)s_->algo_data)->kpsReference;
} }
if(((scn19_slice_param_t *)s_->algo_data)->posLow != NULL){ if(strcmp(slice->scn19->type ,"static")==0){
slice->scn19->has_poslow = 1; slice->scn19->has_poslow = 1;
slice->scn19->poslow = ((scn19_slice_param_t *)s_->algo_data)->posLow; slice->scn19->poslow = ((scn19_slice_param_t *)s_->algo_data)->posLow;
}
if(((scn19_slice_param_t *)s_->algo_data)->posHigh != NULL){
slice->scn19->has_poshigh = 1; slice->scn19->has_poshigh = 1;
slice->scn19->poshigh = ((scn19_slice_param_t *)s_->algo_data)->posHigh; slice->scn19->poshigh = ((scn19_slice_param_t *)s_->algo_data)->posHigh;
} }
if(((scn19_slice_param_t *)s_->algo_data)->posHigh != NULL){ if(strcmp(slice->scn19->type ,"ondemand")==0 ){
slice->scn19->has_poshigh = 1; slice->scn19->has_kpsrequired = 1;
slice->scn19->poshigh = ((scn19_slice_param_t *)s_->algo_data)->posHigh; slice->scn19->kpsrequired = ((scn19_slice_param_t *)s_->algo_data)->kpsRequired;
}
if(((scn19_slice_param_t *)s_->algo_data)->tmax != NULL){
slice->scn19->has_tmax = 1; slice->scn19->has_tmax = 1;
slice->scn19->tmax = ((scn19_slice_param_t *)s_->algo_data)->tmax; slice->scn19->tmax = ((scn19_slice_param_t *)s_->algo_data)->tmax;
}
if(((scn19_slice_param_t *)s_->algo_data)->logdelta != NULL){
slice->scn19->has_logdelta = 1; slice->scn19->has_logdelta = 1;
slice->scn19->logdelta = ((scn19_slice_param_t *)s_->algo_data)->logdelta; slice->scn19->logdelta = ((scn19_slice_param_t *)s_->algo_data)->logdelta;
}
if(((scn19_slice_param_t *)s_->algo_data)->tau != NULL){
slice->scn19->has_tau = 1; slice->scn19->has_tau = 1;
slice->scn19->tau = ((scn19_slice_param_t *)s_->algo_data)->tau; slice->scn19->tau = ((scn19_slice_param_t *)s_->algo_data)->tau;
}
if(((scn19_slice_param_t *)s_->algo_data)->delay != NULL){
slice->scn19->has_delay = 1; slice->scn19->has_delay = 1;
slice->scn19->delay = ((scn19_slice_param_t *)s_->algo_data)->delay; slice->scn19->delay = ((scn19_slice_param_t *)s_->algo_data)->delay;
} }
slice->params_case = PROTOCOL__FLEX_SLICE__PARAMS_SCN19; slice->params_case = PROTOCOL__FLEX_SLICE__PARAMS_SCN19;
break; break;
......
...@@ -122,76 +122,242 @@ int addmod_static_slice_dl(slice_info_t *si, ...@@ -122,76 +122,242 @@ int addmod_static_slice_dl(slice_info_t *si,
char *label, char *label,
void *algo, void *algo,
void *slice_params_dl) { void *slice_params_dl) {
LOG_I(FLEXRAN_AGENT, "Begin addmod_static_slice_dl in Static Slicing Implementation\n");
scn19_slice_param_t *dl = slice_params_dl; scn19_slice_param_t *dl = slice_params_dl;
LOG_I(FLEXRAN_AGENT, "slice type %s\t \n",dl->type);
if (dl && dl->posLow > dl->posHigh)
RET_FAIL(-1, "%s(): slice id %d posLow > posHigh\n", __func__, id);
uint8_t rbgMap[25] = { 0 };
int index = _exists_slice(si->num, si->s, id);
if (index >= 0) {
LOG_I(FLEXRAN_AGENT, "Updating addmod_static_slice_dl in Static Slicing Implementation %d\n");
for (int s = 0; s < si->num; ++s) { if(dl->typeid==1){
static_slice_param_t *sd = dl && si->s[s]->id == id ? dl : si->s[s]->algo_data; LOG_I(FLEXRAN_AGENT, "Begin addmod_static_slice_dl in Static Slicing Implementation\n");
for (int i = sd->posLow; i <= sd->posHigh; ++i) {
if (rbgMap[i]) if (dl && dl->posLow > dl->posHigh)
RET_FAIL(-33, "%s(): overlap of slices detected at RBG %d\n", __func__, i); RET_FAIL(-1, "%s(): slice id %d posLow > posHigh\n", __func__, id);
rbgMap[i] = 1;
} uint8_t rbgMap[25] = { 0 };
} int index = _exists_slice(si->num, si->s, id);
/* no problem, can allocate */ if (index >= 0) {
slice_t *s = si->s[index]; LOG_I(FLEXRAN_AGENT, "Updating addmod_static_slice_dl in Static Slicing Implementation \n");
if (label) {
if (s->label) free(s->label); for (int s = 0; s < si->num; ++s) {
s->label = label; scn19_slice_param_t *sd = dl && si->s[s]->id == id ? dl : si->s[s]->algo_data;
} if(sd->typeid!=1) continue;
if (algo) { for (int i = sd->posLow; i <= sd->posHigh; ++i) {
s->dl_algo.unset(&s->dl_algo.data); if (rbgMap[i])
s->dl_algo = *(default_sched_dl_algo_t *) algo; RET_FAIL(-33, "%s(): overlap of slices detected at RBG %d\n", __func__, i);
if (!s->dl_algo.data) rbgMap[i] = 1;
s->dl_algo.data = s->dl_algo.setup(); }
} }
if (dl) { /* no problem, can allocate */
free(s->algo_data); slice_t *s = si->s[index];
s->algo_data = dl; if (label) {
} if (s->label) free(s->label);
return index; s->label = label;
}
if (algo) {
s->dl_algo.unset(&s->dl_algo.data);
s->dl_algo = *(default_sched_dl_algo_t *) algo;
if (!s->dl_algo.data)
s->dl_algo.data = s->dl_algo.setup();
}
if (dl) {
free(s->algo_data);
s->algo_data = dl;
}
LOG_I(FLEXRAN_AGENT, "Updating %d \n", index);
return index;
}
if (!dl)
RET_FAIL(-100, "%s(): no parameters for new slice %d, aborting\n", __func__, id);
if (si->num >= MAX_STATIC_SLICES)
RET_FAIL(-2, "%s(): cannot have more than %d slices\n", __func__, MAX_STATIC_SLICES);
for (int s = 0; s < si->num; ++s) {
scn19_slice_param_t *sd = si->s[s]->algo_data;
if(sd->typeid!=1) continue;
for (int i = sd->posLow; i <= sd->posHigh; ++i)
rbgMap[i] = 1;
}
for (int i = dl->posLow; i <= dl->posHigh; ++i)
if (rbgMap[i])
RET_FAIL(-3, "%s(): overlap of slices detected at RBG %d\n", __func__, i);
if (!algo)
RET_FAIL(-14, "%s(): no scheduler algorithm provided\n", __func__);
slice_t *ns = _add_slice(&si->num, si->s);
if (!ns)
RET_FAIL(-4, "%s(): could not create new slice\n", __func__);
ns->id = id;
ns->label = label;
ns->dl_algo = *(default_sched_dl_algo_t *) algo;
if (!ns->dl_algo.data)
ns->dl_algo.data = ns->dl_algo.setup();
ns->algo_data = dl;
LOG_I(FLEXRAN_AGENT, "End addmod_static_slice_dl in Static Slicing Implementation \n");
return si->num - 1;
} }
if (!dl) if(dl->typeid==2){
RET_FAIL(-100, "%s(): no parameters for new slice %d, aborting\n", __func__, id);
LOG_I(FLEXRAN_AGENT, "Begin addmod_dynamic_slice_dl in dynamic dynamic Implementation \n");
if (si->num >= MAX_STATIC_SLICES) if (dl && dl->kpsRequired > dl->kpsReference)
RET_FAIL(-2, "%s(): cannot have more than %d slices\n", __func__, MAX_STATIC_SLICES); RET_FAIL(-1, "%s(): slice id %d kpsRequired > kpsReference\n", __func__, id);
for (int s = 0; s < si->num; ++s) {
static_slice_param_t *sd = si->s[s]->algo_data; uint8_t rbgMap[25] = { 0 };
for (int i = sd->posLow; i <= sd->posHigh; ++i) int index = _exists_slice(si->num, si->s, id);
rbgMap[i] = 1; if (index >= 0) {
LOG_I(FLEXRAN_AGENT, "Updating addmod_dynamic_slice_dl in dynamic dynamic Implementation \n");
for (int s = 0; s < si->num; ++s) {
scn19_slice_param_t *sd = dl && si->s[s]->id == id ? dl : si->s[s]->algo_data;
for (int i = sd->posLow; i <= sd->posHigh; ++i) {
if (rbgMap[i])
RET_FAIL(-33, "%s(): overlap of slices detected at RBG %d\n", __func__, i);
rbgMap[i] = 1;
}
}
/* no problem, can allocate */
slice_t *s = si->s[index];
if (label) {
if (s->label) free(s->label);
s->label = label;
}
if (algo) {
s->dl_algo.unset(&s->dl_algo.data);
s->dl_algo = *(default_sched_dl_algo_t *) algo;
if (!s->dl_algo.data)
s->dl_algo.data = s->dl_algo.setup();
}
if (dl) {
free(s->algo_data);
s->algo_data = dl;
}
return index;
}
if (!dl)
RET_FAIL(-100, "%s(): no parameters for new slice %d, aborting\n", __func__, id);
if (si->num >= MAX_DYNAMIC_SLICES)
RET_FAIL(-2, "%s(): cannot have more than %d slices\n", __func__, MAX_DYNAMIC_SLICES);
// for (int s = 0; s < si->num; ++s) {
// scn19_slice_param_t *sd = si->s[s]->algo_data;
// sd->fexp = sd->kpsRequired;
// sd->rbs = 0;
// sd->eff = (sd->kpsReference / RB_NUMS)
// }
dl->fexp = dl->kpsRequired;
dl->rbs = 0;
dl->eff = (dl->kpsReference / RB_NUMS);
if (!algo)
RET_FAIL(-14, "%s(): no scheduler algorithm provided\n", __func__);
slice_t *ns = _add_slice(&si->num, si->s);
if (!ns)
RET_FAIL(-4, "%s(): could not create new slice\n", __func__);
ns->id = id;
ns->label = label;
ns->dl_algo = *(default_sched_dl_algo_t *) algo;
if (!ns->dl_algo.data)
ns->dl_algo.data = ns->dl_algo.setup();
ns->algo_data = dl;
LOG_I(FLEXRAN_AGENT, "End addmod_dynamic_slice_dl in dynamic dynamic Implementation \n");
return si->num - 1;
} }
for (int i = dl->posLow; i <= dl->posHigh; ++i) //ondemand
if (rbgMap[i]) if(dl->typeid==3){
RET_FAIL(-3, "%s(): overlap of slices detected at RBG %d\n", __func__, i);
LOG_I(FLEXRAN_AGENT, "Begin addmod_ondemand_slice_dl in OnDemand Implementation \n");
if (!algo) // if (dl && !(((dl->tmax * RB_NUMS)%1)>0.001))
RET_FAIL(-14, "%s(): no scheduler algorithm provided\n", __func__); // RET_FAIL(-1, "%s(): slice id %d tmax of OnDemand slice not on RB boundary\n", __func__, id);
uint8_t rbgMap[25] = { 0 };
int index = _exists_slice(si->num, si->s, id);
if (index >= 0) {
LOG_I(FLEXRAN_AGENT, "Updating addmod_OnDemand_slice_dl in OnDemand Implementation \n");
// for (int s = 0; s < si->num; ++s) {
// scn19_slice_param_t *sd = dl && si->s[s]->id == id ? dl : si->s[s]->algo_data;
// for (int i = sd->posLow; i <= sd->posHigh; ++i) {
// if (rbgMap[i])
// RET_FAIL(-33, "%s(): overlap of slices detected at RBG %d\n", __func__, i);
// rbgMap[i] = 1;
// }
// }
dl->fexp = dl->kpsRequired;
dl->rbs = 0;
dl->texp =dl->tmax;
dl->fexp = dl->tmax * 5000;
/* no problem, can allocate */
slice_t *s = si->s[index];
if (label) {
if (s->label) free(s->label);
s->label = label;
}
if (algo) {
s->dl_algo.unset(&s->dl_algo.data);
s->dl_algo = *(default_sched_dl_algo_t *) algo;
if (!s->dl_algo.data)
s->dl_algo.data = s->dl_algo.setup();
}
if (dl) {
free(s->algo_data);
s->algo_data = dl;
}
return index;
}
if (!dl)
RET_FAIL(-100, "%s(): no parameters for new slice %d, aborting\n", __func__, id);
if (si->num >= MAX_DYNAMIC_SLICES)
RET_FAIL(-2, "%s(): cannot have more than %d slices\n", __func__, MAX_DYNAMIC_SLICES);
// for (int s = 0; s < si->num; ++s) {
// scn19_slice_param_t *sd = si->s[s]->algo_data;
// sd->fexp = sd->kpsRequired;
// sd->rbs = 0;
// sd->eff = (sd->kpsReference / RB_NUMS)
// }
dl->fexp = dl->kpsRequired;
dl->rbs = 0;
dl->texp =dl->tmax;
dl->fexp = dl->tmax * 5000;
if (!algo)
RET_FAIL(-14, "%s(): no scheduler algorithm provided\n", __func__);
slice_t *ns = _add_slice(&si->num, si->s);
if (!ns)
RET_FAIL(-4, "%s(): could not create new slice\n", __func__);
ns->id = id;
ns->label = label;
ns->dl_algo = *(default_sched_dl_algo_t *) algo;
if (!ns->dl_algo.data)
ns->dl_algo.data = ns->dl_algo.setup();
ns->algo_data = dl;
LOG_I(FLEXRAN_AGENT, "End addmod_OnDemand_slice_dl in OnDemand Implementation \n");
return si->num - 1;
}
slice_t *ns = _add_slice(&si->num, si->s);
if (!ns)
RET_FAIL(-4, "%s(): could not create new slice\n", __func__);
ns->id = id;
ns->label = label;
ns->dl_algo = *(default_sched_dl_algo_t *) algo;
if (!ns->dl_algo.data)
ns->dl_algo.data = ns->dl_algo.setup();
ns->algo_data = dl;
LOG_I(FLEXRAN_AGENT, "End addmod_static_slice_dl in Static Slicing Implementation %d\n");
return si->num - 1;
} }
int addmod_static_slice_ul(slice_info_t *si, int addmod_static_slice_ul(slice_info_t *si,
...@@ -544,7 +710,9 @@ pp_impl_param_t static_dl_init(module_id_t mod_id, int CC_id) { ...@@ -544,7 +710,9 @@ pp_impl_param_t static_dl_init(module_id_t mod_id, int CC_id) {
si->UE_assoc_slice[i] = -1; si->UE_assoc_slice[i] = -1;
/* insert default slice, all resources */ /* insert default slice, all resources */
static_slice_param_t *dlp = malloc(sizeof(static_slice_param_t)); scn19_slice_param_t *dlp = malloc(sizeof(scn19_slice_param_t));
dlp->type="static";
dlp->typeid=1;
dlp->posLow = 0; dlp->posLow = 0;
dlp->posHigh = to_rbg(RC.mac[mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth) - 1; dlp->posHigh = to_rbg(RC.mac[mod_id]->common_channels[CC_id].mib->message.dl_Bandwidth) - 1;
default_sched_dl_algo_t *algo = &RC.mac[mod_id]->pre_processor_dl.dl_algo; default_sched_dl_algo_t *algo = &RC.mac[mod_id]->pre_processor_dl.dl_algo;
...@@ -555,7 +723,7 @@ pp_impl_param_t static_dl_init(module_id_t mod_id, int CC_id) { ...@@ -555,7 +723,7 @@ pp_impl_param_t static_dl_init(module_id_t mod_id, int CC_id) {
slicing_add_UE(si, UE_id); slicing_add_UE(si, UE_id);
pp_impl_param_t sttc; pp_impl_param_t sttc;
sttc.algorithm = STATIC_SLICING; sttc.algorithm = SCN19_SLICING;
sttc.add_UE = slicing_add_UE; sttc.add_UE = slicing_add_UE;
sttc.remove_UE = slicing_remove_UE; sttc.remove_UE = slicing_remove_UE;
sttc.move_UE = slicing_move_UE; sttc.move_UE = slicing_move_UE;
...@@ -636,11 +804,26 @@ pp_impl_param_t static_ul_init(module_id_t mod_id, int CC_id) { ...@@ -636,11 +804,26 @@ pp_impl_param_t static_ul_init(module_id_t mod_id, int CC_id) {
* B. Then, following the QoS requirements of on-demand slices, we allocate * B. Then, following the QoS requirements of on-demand slices, we allocate
* necessary resources. * necessary resources.
* C. Finally, we schedule resources for dynamic slices. * C. Finally, we schedule resources for dynamic slices.
*/
/************************ SVN19 Slicing Implementation ************************/
/**
* On-demand Slices:
* SLA requirments in slice k:
* 1. A delay-threshold ∆k (ms)
* 2. A packet-loss probability ∂k
* 3. A long-run maximum resouce share t_(k,max)
* *
* For each slice scheduling interval, the sclice tells the number of bits B_k to be
* scheduled to satisfy its ∆k.
* *
* Based on the above parameters (i.e., B_k and t_(k,max)) as well as measured statistics
* (e.g., channel quality, user number), an on-demand slice can estimate its delay bound
* of the scheduling process.
* *
* W_k(t_k) = B_k / (N * b¬_k) * log(t_k) = T_k * log(t_k)
* *
* * Weight w'_k = (∂ W_k(t_k)) / (∂ t_k) = T_k / t_k = B_k / b_k, in which b_k = N * b¬_k * t_k
*/ */
int addmod_scn19_slice_dl(slice_info_t *si, int addmod_scn19_slice_dl(slice_info_t *si,
...@@ -648,73 +831,239 @@ int addmod_scn19_slice_dl(slice_info_t *si, ...@@ -648,73 +831,239 @@ int addmod_scn19_slice_dl(slice_info_t *si,
char *label, char *label,
void *algo, void *algo,
void *slice_params_dl) { void *slice_params_dl) {
LOG_I(FLEXRAN_AGENT, "Begin addmod_static_slice_dl in Static Slicing Implementation %d\n"); LOG_I(FLEXRAN_AGENT, "Begin addmod_static_slice_dl in Static Slicing Implementation\n");
static_slice_param_t *dl = slice_params_dl;
if (dl && dl->posLow > dl->posHigh)
RET_FAIL(-1, "%s(): slice id %d posLow > posHigh\n", __func__, id);
uint8_t rbgMap[25] = { 0 }; scn19_slice_param_t *dl = slice_params_dl;
int index = _exists_slice(si->num, si->s, id);
if (index >= 0) {
LOG_I(FLEXRAN_AGENT, "Updating addmod_static_slice_dl in Static Slicing Implementation %d\n");
for (int s = 0; s < si->num; ++s) {
static_slice_param_t *sd = dl && si->s[s]->id == id ? dl : si->s[s]->algo_data; //static
for (int i = sd->posLow; i <= sd->posHigh; ++i) { if(dl->typeid==1){
if (rbgMap[i])
RET_FAIL(-33, "%s(): overlap of slices detected at RBG %d\n", __func__, i);
rbgMap[i] = 1; if (dl && dl->posLow > dl->posHigh)
} RET_FAIL(-1, "%s(): slice id %d posLow > posHigh\n", __func__, id);
}
/* no problem, can allocate */ uint8_t rbgMap[25] = { 0 };
slice_t *s = si->s[index]; int index = _exists_slice(si->num, si->s, id);
if (label) { if (index >= 0) {
if (s->label) free(s->label); LOG_I(FLEXRAN_AGENT, "Updating addmod_static_slice_dl in Static Slicing Implementation \n");
s->label = label;
} for (int s = 0; s < si->num; ++s) {
if (algo) { scn19_slice_param_t *sd = dl && si->s[s]->id == id ? dl : si->s[s]->algo_data;
s->dl_algo.unset(&s->dl_algo.data); for (int i = sd->posLow; i <= sd->posHigh; ++i) {
s->dl_algo = *(default_sched_dl_algo_t *) algo; if (rbgMap[i])
if (!s->dl_algo.data) RET_FAIL(-33, "%s(): overlap of slices detected at RBG %d\n", __func__, i);
s->dl_algo.data = s->dl_algo.setup(); rbgMap[i] = 1;
} }
if (dl) { }
free(s->algo_data); /* no problem, can allocate */
s->algo_data = dl; slice_t *s = si->s[index];
} if (label) {
return index; if (s->label) free(s->label);
s->label = label;
}
if (algo) {
s->dl_algo.unset(&s->dl_algo.data);
s->dl_algo = *(default_sched_dl_algo_t *) algo;
if (!s->dl_algo.data)
s->dl_algo.data = s->dl_algo.setup();
}
if (dl) {
free(s->algo_data);
s->algo_data = dl;
}
return index;
}
if (!dl)
RET_FAIL(-100, "%s(): no parameters for new slice %d, aborting\n", __func__, id);
if (si->num >= MAX_STATIC_SLICES)
RET_FAIL(-2, "%s(): cannot have more than %d slices\n", __func__, MAX_STATIC_SLICES);
for (int s = 0; s < si->num; ++s) {
scn19_slice_param_t *sd = si->s[s]->algo_data;
for (int i = sd->posLow; i <= sd->posHigh; ++i)
rbgMap[i] = 1;
}
for (int i = dl->posLow; i <= dl->posHigh; ++i)
if (rbgMap[i])
RET_FAIL(-3, "%s(): overlap of slices detected at RBG %d\n", __func__, i);
if (!algo)
RET_FAIL(-14, "%s(): no scheduler algorithm provided\n", __func__);
slice_t *ns = _add_slice(&si->num, si->s);
if (!ns)
RET_FAIL(-4, "%s(): could not create new slice\n", __func__);
ns->id = id;
ns->label = label;
ns->dl_algo = *(default_sched_dl_algo_t *) algo;
if (!ns->dl_algo.data)
ns->dl_algo.data = ns->dl_algo.setup();
ns->algo_data = dl;
LOG_I(FLEXRAN_AGENT, "End addmod_static_slice_dl in Static Slicing Implementation \n");
return si->num - 1;
} }
//dynamic
if (!dl) if(dl->typeid==2){
RET_FAIL(-100, "%s(): no parameters for new slice %d, aborting\n", __func__, id);
LOG_I(FLEXRAN_AGENT, "Begin addmod_dynamic_slice_dl in dynamic dynamic Implementation \n");
if (si->num >= MAX_STATIC_SLICES) if (dl && dl->kpsRequired > dl->kpsReference)
RET_FAIL(-2, "%s(): cannot have more than %d slices\n", __func__, MAX_STATIC_SLICES); RET_FAIL(-1, "%s(): slice id %d kpsRequired > kpsReference\n", __func__, id);
for (int s = 0; s < si->num; ++s) {
static_slice_param_t *sd = si->s[s]->algo_data; uint8_t rbgMap[25] = { 0 };
for (int i = sd->posLow; i <= sd->posHigh; ++i) int index = _exists_slice(si->num, si->s, id);
rbgMap[i] = 1; if (index >= 0) {
LOG_I(FLEXRAN_AGENT, "Updating addmod_dynamic_slice_dl in dynamic dynamic Implementation \n");
// for (int s = 0; s < si->num; ++s) {
// scn19_slice_param_t *sd = dl && si->s[s]->id == id ? dl : si->s[s]->algo_data;
// for (int i = sd->posLow; i <= sd->posHigh; ++i) {
// if (rbgMap[i])
// RET_FAIL(-33, "%s(): overlap of slices detected at RBG %d\n", __func__, i);
// rbgMap[i] = 1;
// }
// }
/* no problem, can allocate */
dl->fexp = dl->kpsRequired;
dl->rbs = 0;
dl->eff = (dl->kpsReference / RB_NUMS);
slice_t *s = si->s[index];
if (label) {
if (s->label) free(s->label);
s->label = label;
}
if (algo) {
s->dl_algo.unset(&s->dl_algo.data);
s->dl_algo = *(default_sched_dl_algo_t *) algo;
if (!s->dl_algo.data)
s->dl_algo.data = s->dl_algo.setup();
}
if (dl) {
free(s->algo_data);
s->algo_data = dl;
}
return index;
}
if (!dl)
RET_FAIL(-100, "%s(): no parameters for new slice %d, aborting\n", __func__, id);
if (si->num >= MAX_DYNAMIC_SLICES)
RET_FAIL(-2, "%s(): cannot have more than %d slices\n", __func__, MAX_DYNAMIC_SLICES);
// for (int s = 0; s < si->num; ++s) {
// scn19_slice_param_t *sd = si->s[s]->algo_data;
// sd->fexp = sd->kpsRequired;
// sd->rbs = 0;
// sd->eff = (sd->kpsReference / RB_NUMS)
// }
dl->fexp = dl->kpsRequired;
dl->rbs = 0;
dl->eff = (dl->kpsReference / RB_NUMS);
if (!algo)
RET_FAIL(-14, "%s(): no scheduler algorithm provided\n", __func__);
slice_t *ns = _add_slice(&si->num, si->s);
if (!ns)
RET_FAIL(-4, "%s(): could not create new slice\n", __func__);
ns->id = id;
ns->label = label;
ns->dl_algo = *(default_sched_dl_algo_t *) algo;
if (!ns->dl_algo.data)
ns->dl_algo.data = ns->dl_algo.setup();
ns->algo_data = dl;
LOG_I(FLEXRAN_AGENT, "End addmod_dynamic_slice_dl in dynamic dynamic Implementation \n");
return si->num - 1;
}
//ondemand
if(dl->typeid==3){
LOG_I(FLEXRAN_AGENT, "Begin addmod_ondemand_slice_dl in dynamic dynamic Implementation \n");
if (dl && !(((dl->tmax * RB_NUMS)%1)>0.001))
RET_FAIL(-1, "%s(): slice id %d tmax of OnDemand slice not on RB boundary\n", __func__, id);
uint8_t rbgMap[25] = { 0 };
int index = _exists_slice(si->num, si->s, id);
if (index >= 0) {
LOG_I(FLEXRAN_AGENT, "Updating addmod_dynamic_slice_dl in dynamic dynamic Implementation \n");
// for (int s = 0; s < si->num; ++s) {
// scn19_slice_param_t *sd = dl && si->s[s]->id == id ? dl : si->s[s]->algo_data;
// for (int i = sd->posLow; i <= sd->posHigh; ++i) {
// if (rbgMap[i])
// RET_FAIL(-33, "%s(): overlap of slices detected at RBG %d\n", __func__, i);
// rbgMap[i] = 1;
// }
// }
dl->fexp = dl->kpsRequired;
dl->rbs = 0;
dl->texp =dl->tmax;
dl->fexp = dl->tmax * 5000;
/* no problem, can allocate */
slice_t *s = si->s[index];
if (label) {
if (s->label) free(s->label);
s->label = label;
}
if (algo) {
s->dl_algo.unset(&s->dl_algo.data);
s->dl_algo = *(default_sched_dl_algo_t *) algo;
if (!s->dl_algo.data)
s->dl_algo.data = s->dl_algo.setup();
}
if (dl) {
free(s->algo_data);
s->algo_data = dl;
}
return index;
}
if (!dl)
RET_FAIL(-100, "%s(): no parameters for new slice %d, aborting\n", __func__, id);
if (si->num >= MAX_DYNAMIC_SLICES)
RET_FAIL(-2, "%s(): cannot have more than %d slices\n", __func__, MAX_DYNAMIC_SLICES);
// for (int s = 0; s < si->num; ++s) {
// scn19_slice_param_t *sd = si->s[s]->algo_data;
// sd->fexp = sd->kpsRequired;
// sd->rbs = 0;
// sd->eff = (sd->kpsReference / RB_NUMS)
// }
dl->fexp = dl->kpsRequired;
dl->rbs = 0;
dl->texp =dl->tmax;
dl->fexp = dl->tmax * 5000;
if (!algo)
RET_FAIL(-14, "%s(): no scheduler algorithm provided\n", __func__);
slice_t *ns = _add_slice(&si->num, si->s);
if (!ns)
RET_FAIL(-4, "%s(): could not create new slice\n", __func__);
ns->id = id;
ns->label = label;
ns->dl_algo = *(default_sched_dl_algo_t *) algo;
if (!ns->dl_algo.data)
ns->dl_algo.data = ns->dl_algo.setup();
ns->algo_data = dl;
LOG_I(FLEXRAN_AGENT, "End addmod_dynamic_slice_dl in dynamic dynamic Implementation \n");
return si->num - 1;
} }
for (int i = dl->posLow; i <= dl->posHigh; ++i)
if (rbgMap[i])
RET_FAIL(-3, "%s(): overlap of slices detected at RBG %d\n", __func__, i);
if (!algo)
RET_FAIL(-14, "%s(): no scheduler algorithm provided\n", __func__);
slice_t *ns = _add_slice(&si->num, si->s);
if (!ns)
RET_FAIL(-4, "%s(): could not create new slice\n", __func__);
ns->id = id;
ns->label = label;
ns->dl_algo = *(default_sched_dl_algo_t *) algo;
if (!ns->dl_algo.data)
ns->dl_algo.data = ns->dl_algo.setup();
ns->algo_data = dl;
LOG_I(FLEXRAN_AGENT, "End addmod_static_slice_dl in Static Slicing Implementation %d\n");
return si->num - 1;
} }
......
...@@ -64,6 +64,8 @@ int slicing_get_UE_slice_idx(slice_info_t *si, int UE_id); ...@@ -64,6 +64,8 @@ int slicing_get_UE_slice_idx(slice_info_t *si, int UE_id);
#define SCN19_SLICING 11 #define SCN19_SLICING 11
/* only four static slices for UL, DL resp. (not enough DCIs) */ /* only four static slices for UL, DL resp. (not enough DCIs) */
#define MAX_STATIC_SLICES 4 #define MAX_STATIC_SLICES 4
#define MAX_DYNAMIC_SLICES 10
#define RB_NUMS 25
typedef struct { typedef struct {
uint16_t posLow; uint16_t posLow;
uint16_t posHigh; uint16_t posHigh;
...@@ -79,6 +81,8 @@ typedef struct { ...@@ -79,6 +81,8 @@ typedef struct {
uint16_t tau; uint16_t tau;
uint16_t delay; uint16_t delay;
} ondemand_slice_param_t; } ondemand_slice_param_t;
typedef struct { typedef struct {
uint16_t posLow; uint16_t posLow;
uint16_t posHigh; uint16_t posHigh;
...@@ -88,8 +92,20 @@ typedef struct { ...@@ -88,8 +92,20 @@ typedef struct {
uint16_t logdelta; uint16_t logdelta;
uint16_t tau; uint16_t tau;
uint16_t delay; uint16_t delay;
uint16_t typeid;
char *type; char *type;
uint16_t fexp;
uint16_t rbs;
uint16_t texp;
uint16_t eff;
} scn19_slice_param_t; } scn19_slice_param_t;
typedef struct {
uint16_t fexp;
uint16_t rbs;
uint16_t texp;
} stats_param_t;
pp_impl_param_t static_dl_init(module_id_t mod_id, int CC_id); pp_impl_param_t static_dl_init(module_id_t mod_id, int CC_id);
pp_impl_param_t static_ul_init(module_id_t mod_id, int CC_id); pp_impl_param_t static_ul_init(module_id_t mod_id, int CC_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