Commit b049f0c8 authored by Navid Nikaein's avatar Navid Nikaein Committed by Anta Huang

Ue stats bugfix for dynamic reconfiguration

parent d35f52a2
...@@ -283,6 +283,7 @@ void *eNB_app_task(void *args_p) ...@@ -283,6 +283,7 @@ void *eNB_app_task(void *args_p)
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
uint32_t enb_nb = 1; /* Default number of eNB is 1 */ uint32_t enb_nb = 1; /* Default number of eNB is 1 */
uint32_t enb_id_start = 0; uint32_t enb_id_start = 0;
uint32_t enb_i;
uint32_t enb_id_end = enb_id_start + enb_nb; uint32_t enb_id_end = enb_id_start + enb_nb;
# if defined(ENABLE_USE_MME) # if defined(ENABLE_USE_MME)
uint32_t register_enb_pending; uint32_t register_enb_pending;
...@@ -318,7 +319,12 @@ void *eNB_app_task(void *args_p) ...@@ -318,7 +319,12 @@ void *eNB_app_task(void *args_p)
enb_nb, enb_properties_p->number); enb_nb, enb_properties_p->number);
enb_app_start_phy_rrc(enb_id_start, enb_id_end); enb_app_start_phy_rrc(enb_id_start, enb_id_end);
#ifdef FLEXRAN_AGENT_SB_IF
for (enb_i = 0; enb_i <1; enb_i ++){ // To be handled for all of current eNB
flexran_set_enb_vars(enb_i, RAN_LTE_OAI);
}
#endif
# if defined(ENABLE_USE_MME) # if defined(ENABLE_USE_MME)
/* Try to register each eNB */ /* Try to register each eNB */
registered_enb = 0; registered_enb = 0;
......
...@@ -186,15 +186,9 @@ pthread_t new_thread(void *(*f)(void *), void *b) { ...@@ -186,15 +186,9 @@ pthread_t new_thread(void *(*f)(void *), void *b) {
return t; return t;
} }
int channel_container_init = 0; void flexran_agent_reconfigure(mid_t mod_id){
int flexran_agent_start(mid_t mod_id)
{
int channel_id;
Enb_properties_array_t *enb_properties = enb_config_get(); Enb_properties_array_t *enb_properties = enb_config_get();
flexran_set_enb_vars(mod_id, RAN_LTE_OAI);
flexran_agent[mod_id].enb_id = mod_id;
/* /*
* check the configuration * check the configuration
*/ */
...@@ -204,7 +198,7 @@ int flexran_agent_start(mid_t mod_id) ...@@ -204,7 +198,7 @@ int flexran_agent_start(mid_t mod_id)
} else { } else {
strcpy(local_cache, DEFAULT_FLEXRAN_AGENT_CACHE); strcpy(local_cache, DEFAULT_FLEXRAN_AGENT_CACHE);
} }
if (enb_properties->properties[mod_id]->flexran_agent_ipv4_address != 0) { if (enb_properties->properties[mod_id]->flexran_agent_ipv4_address != 0) {
inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN); inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN);
} else { } else {
...@@ -220,6 +214,18 @@ int flexran_agent_start(mid_t mod_id) ...@@ -220,6 +214,18 @@ int flexran_agent_start(mid_t mod_id)
flexran_agent[mod_id].enb_id, flexran_agent[mod_id].enb_id,
in_ip, in_ip,
in_port); in_port);
}
int channel_container_init = 0;
int flexran_agent_start(mid_t mod_id)
{
int channel_id;
flexran_set_enb_vars(mod_id, RAN_LTE_OAI);
flexran_agent[mod_id].enb_id = mod_id;
flexran_agent_reconfigure(mod_id);
/* /*
* Initialize the channel container * Initialize the channel container
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
/* Initiation and termination of the eNodeB agent */ /* Initiation and termination of the eNodeB agent */
int flexran_agent_start(mid_t mod_id); int flexran_agent_start(mid_t mod_id);
int flexran_agent_stop(mid_t mod_id); int flexran_agent_stop(mid_t mod_id);
void flexran_agent_reconfigure(mid_t mod_id);
/* /*
* enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller
......
...@@ -96,9 +96,11 @@ int slicing_strategy = UEID_TO_SLICEID; ...@@ -96,9 +96,11 @@ int slicing_strategy = UEID_TO_SLICEID;
int slicing_strategy_current = UEID_TO_SLICEID; int slicing_strategy_current = UEID_TO_SLICEID;
// RB share for each slice for past and current time // RB share for each slice for past and current time
float slice_percentage[MAX_NUM_SLICES] = {1.0, 1.0, 0.0, 0.0}; float avg_slice_percentage=0.25;
float slice_percentage_current[MAX_NUM_SLICES] = {1.0, 1.0, 0.0, 0.0}; float slice_percentage[MAX_NUM_SLICES] = {1.0, 0.0, 0.0, 0.0};
float slice_percentage_current[MAX_NUM_SLICES] = {1.0, 0.0, 0.0, 0.0};
float total_slice_percentage = 0; float total_slice_percentage = 0;
float total_slice_percentage_current = 0;
// MAX MCS for each slice for past and current time // MAX MCS for each slice for past and current time
int slice_maxmcs[MAX_NUM_SLICES] = {28, 28, 28, 28}; int slice_maxmcs[MAX_NUM_SLICES] = {28, 28, 28, 28};
...@@ -724,7 +726,23 @@ flexran_schedule_ue_dl_spec_default(mid_t mod_id, ...@@ -724,7 +726,23 @@ flexran_schedule_ue_dl_spec_default(mid_t mod_id,
int i=0; int i=0;
flexran_agent_mac_create_empty_dl_config(mod_id, dl_info); flexran_agent_mac_create_empty_dl_config(mod_id, dl_info);
total_slice_percentage=0;
avg_slice_percentage=1.0/n_active_slices;
// reset the slice percentage for inactive slices
for (i = n_active_slices; i< MAX_NUM_SLICES; i++) {
slice_percentage[i]=0;
}
for (i = 0; i < n_active_slices; i++) {
if (slice_percentage[i] < 0 ){
LOG_W(MAC, "[eNB %d] frame %d subframe %d:invalid slice %d percentage %d. resetting to zero",
mod_id, frame, subframe, i, slice_percentage[i]);
slice_percentage[i]=0;
}
total_slice_percentage+=slice_percentage[i];
}
for (i = 0; i < n_active_slices; i++) { for (i = 0; i < n_active_slices; i++) {
// Load any updated functions // Load any updated functions
...@@ -732,84 +750,77 @@ flexran_schedule_ue_dl_spec_default(mid_t mod_id, ...@@ -732,84 +750,77 @@ flexran_schedule_ue_dl_spec_default(mid_t mod_id,
slice_sched_dl[i] = dlsym(NULL, dl_scheduler_type[i]); slice_sched_dl[i] = dlsym(NULL, dl_scheduler_type[i]);
update_dl_scheduler[i] = 0; update_dl_scheduler[i] = 0;
update_dl_scheduler_current[i] = 0; update_dl_scheduler_current[i] = 0;
slice_percentage_current[i]= slice_percentage[i];
total_slice_percentage+=slice_percentage[i];
LOG_N(MAC,"update dl scheduler slice %d\n", i); LOG_N(MAC,"update dl scheduler slice %d\n", i);
} }
// check if the number of slices has changed, and log
if (n_active_slices_current != n_active_slices ){
if ((n_active_slices > 0) && (n_active_slices <= MAX_NUM_SLICES)) {
LOG_N(MAC,"[eNB %d]frame %d subframe %d: number of active slices has changed: %d-->%d\n",
mod_id, frame, subframe, n_active_slices_current, n_active_slices);
n_active_slices_current = n_active_slices; if (total_slice_percentage <= 1.0){ // the new total RB share is within the range
} else { // check if the number of slices has changed, and log
LOG_W(MAC,"invalid number of slices %d, revert to the previous value %d\n",n_active_slices, n_active_slices_current); if (n_active_slices_current != n_active_slices ){
n_active_slices = n_active_slices_current; if ((n_active_slices > 0) && (n_active_slices <= MAX_NUM_SLICES)) {
LOG_N(MAC,"[eNB %d]frame %d subframe %d: number of active DL slices has changed: %d-->%d\n",
mod_id, frame, subframe, n_active_slices_current, n_active_slices);
n_active_slices_current = n_active_slices;
} else {
LOG_W(MAC,"invalid number of DL slices %d, revert to the previous value %d\n",n_active_slices, n_active_slices_current);
n_active_slices = n_active_slices_current;
}
} }
}
// check if the slice rb share has changed, and log the console
if (slice_percentage_current[i] != slice_percentage[i]){ // new slice percentage
LOG_N(MAC,"[eNB %d][SLICE %d][DL] frame %d subframe %d: total percentage %f-->%f, slice RB percentage has changed: %f-->%f\n",
mod_id, i, frame, subframe, total_slice_percentage_current, total_slice_percentage, slice_percentage_current[i], slice_percentage[i]);
total_slice_percentage_current= total_slice_percentage;
slice_percentage_current[i] = slice_percentage[i];
}
// check if the slice max MCS, and log the console
if (slice_maxmcs_current[i] != slice_maxmcs[i]){
if ((slice_maxmcs[i] >= 0) && (slice_maxmcs[i] < 29)){
LOG_N(MAC,"[eNB %d][SLICE %d][DL] frame %d subframe %d: slice MAX MCS has changed: %d-->%d\n",
mod_id, i, frame, subframe, slice_maxmcs_current[i], slice_maxmcs[i]);
slice_maxmcs_current[i] = slice_maxmcs[i];
} else {
LOG_W(MAC,"[eNB %d][SLICE %d][DL] invalid slice max mcs %d, revert the previous value %d\n",mod_id, i, slice_maxmcs[i],slice_maxmcs_current[i]);
slice_maxmcs[i]= slice_maxmcs_current[i];
}
}
// check if a new scheduler, and log the console
if (update_dl_scheduler_current[i] != update_dl_scheduler[i]){
LOG_N(MAC,"[eNB %d][SLICE %d][DL] frame %d subframe %d: DL scheduler for this slice is updated: %s \n",
mod_id, i, frame, subframe, dl_scheduler_type[i]);
update_dl_scheduler_current[i] = update_dl_scheduler[i];
}
// check if the slice rb share has changed, and log the console } else {
if (slice_percentage_current[i] != slice_percentage[i]){ // here we can correct the values, e.g. reduce proportionally
// if ((slice_percentage[i] >= 0.0) && (slice_percentage[i] <= 1.0)){
// if ((total_slice_percentage - slice_percentage_current[i] + slice_percentage[i]) <= 1.0) { if (n_active_slices == n_active_slices_current){
// total_slice_percentage=total_slice_percentage - slice_percentage_current[i] + slice_percentage[i]; LOG_W(MAC,"[eNB %d][SLICE %d][DL] invalid total RB share (%f->%f), reduce proportionally the RB share by 0.1\n",
LOG_N(MAC,"[eNB %d][SLICE %d] frame %d subframe %d: total percentage %f, slice RB percentage has changed: %f-->%f\n", mod_id,i,
mod_id, i, frame, subframe, total_slice_percentage, slice_percentage_current[i], slice_percentage[i]); total_slice_percentage_current, total_slice_percentage);
if (slice_percentage[i] >= avg_slice_percentage){
slice_percentage_current[i] = slice_percentage[i]; slice_percentage[i]-=0.1;
total_slice_percentage-=0.1;
// } else { }
// LOG_W(MAC,"[eNB %d][SLICE %d] invalid total RB share (%f->%f), revert the previous value (%f->%f)\n",
// mod_id,i,
// total_slice_percentage,
// total_slice_percentage - slice_percentage_current[i] + slice_percentage[i],
// slice_percentage[i],slice_percentage_current[i]);
// slice_percentage[i]= slice_percentage_current[i];
// }
// } else {
// LOG_W(MAC,"[eNB %d][SLICE %d] invalid slice RB share, revert the previous value (%f->%f)\n",mod_id, i, slice_percentage[i],slice_percentage_current[i]);
// slice_percentage[i]= slice_percentage_current[i];
// }
}
// check if the slice max MCS, and log the console
if (slice_maxmcs_current[i] != slice_maxmcs[i]){
if ((slice_maxmcs[i] >= 0) && (slice_maxmcs[i] < 29)){
LOG_N(MAC,"[eNB %d][SLICE %d] frame %d subframe %d: slice MAX MCS has changed: %d-->%d\n",
mod_id, i, frame, subframe, slice_maxmcs_current[i], slice_maxmcs[i]);
slice_maxmcs_current[i] = slice_maxmcs[i];
} else { } else {
// LOG_W(MAC,"[eNB %d][SLICE %d] invalid slice max mcs %d, revert the previous value %d\n",mod_id, i, slice_maxmcs[i],slice_percentage[i]); LOG_W(MAC,"[eNB %d][SLICE %d][DL] invalid total RB share (%f->%f), revert the number of slice to its previous value (%d->%d)\n",
mod_id,i,
slice_maxmcs[i]= slice_maxmcs_current[i]; total_slice_percentage_current, total_slice_percentage,
n_active_slices, n_active_slices_current );
n_active_slices = n_active_slices_current;
slice_percentage[i] = slice_percentage_current[i];
} }
} }
// check if a new scheduler, and log the console
if (update_dl_scheduler_current[i] != update_dl_scheduler[i]){
LOG_N(MAC,"[eNB %d][SLICE %d] frame %d subframe %d: DL scheduler for this slice is updated: %s \n",
mod_id, i, frame, subframe, dl_scheduler_type[i]);
update_dl_scheduler_current[i] = update_dl_scheduler[i];
}
// Run each enabled slice-specific schedulers one by one // Run each enabled slice-specific schedulers one by one
//LOG_N(MAC,"[eNB %d]frame %d subframe %d slice %d: calling the scheduler\n", mod_id, frame, subframe,i);
slice_sched_dl[i](mod_id, i, frame, subframe, mbsfn_flag,dl_info); slice_sched_dl[i](mod_id, i, frame, subframe, mbsfn_flag,dl_info);
} }
} }
uint16_t flexran_nb_rbs_allowed_slice(float rb_percentage, int total_rbs){ uint16_t flexran_nb_rbs_allowed_slice(float rb_percentage, int total_rbs){
......
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