Commit 0c0e7b6e authored by Robert Schmidt's avatar Robert Schmidt

simplify control flow

parent bd041a34
...@@ -1472,24 +1472,6 @@ void flexran_agent_slice_update(mid_t mod_id) ...@@ -1472,24 +1472,6 @@ void flexran_agent_slice_update(mid_t mod_id)
flexran_agent_read_slice_ul_config(mod_id, i, slice_config[mod_id]->ul[i]); flexran_agent_read_slice_ul_config(mod_id, i, slice_config[mod_id]->ul[i]);
} }
/* in case we tried to add a slice and it failed (e.g. due to high sum
* percentage being too high), revert to the correct number of slices.
* Also, do not write if we try the last time */
if (perform_slice_config_update_count == 1) {
if (slice_config[mod_id]->n_dl != sc_update[mod_id]->n_dl) {
sc_update[mod_id]->n_dl = slice_config[mod_id]->n_dl;
LOG_W(FLEXRAN_AGENT, "[%d] reverting to original number of %ld DL slices\n",
mod_id, sc_update[mod_id]->n_dl);
}
if (slice_config[mod_id]->n_ul != sc_update[mod_id]->n_ul) {
sc_update[mod_id]->n_ul = slice_config[mod_id]->n_ul;
LOG_W(FLEXRAN_AGENT, "[%d] reverting to original number of %ld UL slices\n",
mod_id, sc_update[mod_id]->n_ul);
}
pthread_mutex_unlock(&sc_update_mtx);
return;
}
/********* write new config *********/ /********* write new config *********/
/* check for removal (sc_update[X]->dl[Y].percentage == 0) /* check for removal (sc_update[X]->dl[Y].percentage == 0)
* and update sc_update & slice_config accordingly */ * and update sc_update & slice_config accordingly */
...@@ -1499,22 +1481,22 @@ void flexran_agent_slice_update(mid_t mod_id) ...@@ -1499,22 +1481,22 @@ void flexran_agent_slice_update(mid_t mod_id)
for (i = slice_config[mod_id]->n_dl; i < sc_update[mod_id]->n_dl; i++) { for (i = slice_config[mod_id]->n_dl; i < sc_update[mod_id]->n_dl; i++) {
flexran_create_dl_slice(mod_id, sc_update[mod_id]->dl[i]->id); flexran_create_dl_slice(mod_id, sc_update[mod_id]->dl[i]->id);
slice_config[mod_id]->n_dl = flexran_get_num_dl_slices(mod_id); slice_config[mod_id]->n_dl = flexran_get_num_dl_slices(mod_id);
flexran_agent_read_slice_dl_config(mod_id, i, slice_config[mod_id]->dl[i]);
} }
for (i = slice_config[mod_id]->n_ul; i < sc_update[mod_id]->n_ul; i++) { for (i = slice_config[mod_id]->n_ul; i < sc_update[mod_id]->n_ul; i++) {
flexran_create_ul_slice(mod_id, sc_update[mod_id]->ul[i]->id); flexran_create_ul_slice(mod_id, sc_update[mod_id]->ul[i]->id);
slice_config[mod_id]->n_ul = flexran_get_num_ul_slices(mod_id); slice_config[mod_id]->n_ul = flexran_get_num_ul_slices(mod_id);
flexran_agent_read_slice_ul_config(mod_id, i, slice_config[mod_id]->ul[i]);
} }
for (i = 0; i < slice_config[mod_id]->n_dl; i++) { for (i = 0; i < slice_config[mod_id]->n_dl; i++) {
changes += apply_new_slice_dl_config(mod_id, changes += apply_new_slice_dl_config(mod_id,
slice_config[mod_id]->dl[i], slice_config[mod_id]->dl[i],
sc_update[mod_id]->dl[i]); sc_update[mod_id]->dl[i]);
flexran_agent_read_slice_dl_config(mod_id, i, slice_config[mod_id]->dl[i]);
} }
for (i = 0; i < slice_config[mod_id]->n_ul; i++) { for (i = 0; i < slice_config[mod_id]->n_ul; i++) {
changes += apply_new_slice_ul_config(mod_id, changes += apply_new_slice_ul_config(mod_id,
slice_config[mod_id]->ul[i], slice_config[mod_id]->ul[i],
sc_update[mod_id]->ul[i]); sc_update[mod_id]->ul[i]);
flexran_agent_read_slice_ul_config(mod_id, i, slice_config[mod_id]->ul[i]);
} }
if (n_ue_slice_assoc_updates > 0) { if (n_ue_slice_assoc_updates > 0) {
changes += apply_ue_slice_assoc_update(mod_id); changes += apply_ue_slice_assoc_update(mod_id);
......
...@@ -1365,11 +1365,7 @@ void prepare_update_slice_config(mid_t mod_id, Protocol__FlexSliceConfig *sup) ...@@ -1365,11 +1365,7 @@ void prepare_update_slice_config(mid_t mod_id, Protocol__FlexSliceConfig *sup)
} }
pthread_mutex_unlock(&sc_update_mtx); pthread_mutex_unlock(&sc_update_mtx);
/* perform the slice configuration reads a couple of times. If there are perform_slice_config_update_count = 1;
* inconsistencies (i.e. the MAC refuses a configuration), we will have a
* couple of warnings because the current configuration and the one in
* sc_update will be diverged */
perform_slice_config_update_count = 3;
} }
int apply_new_slice_dl_config(mid_t mod_id, Protocol__FlexDlSlice *oldc, Protocol__FlexDlSlice *newc) int apply_new_slice_dl_config(mid_t mod_id, Protocol__FlexDlSlice *oldc, Protocol__FlexDlSlice *newc)
......
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