Commit 65e52fcf authored by Robert Schmidt's avatar Robert Schmidt

Inform MAC of control delegation and load in user plane

parent 0f641b7d
...@@ -1785,7 +1785,9 @@ Protocol__FlexranMessage *request_scheduler_timeout( ...@@ -1785,7 +1785,9 @@ Protocol__FlexranMessage *request_scheduler_timeout(
return NULL; return NULL;
} }
void prepare_update_slice_config(mid_t mod_id, Protocol__FlexSliceConfig **slice_config) { void prepare_update_slice_config(mid_t mod_id,
Protocol__FlexSliceConfig **slice_config,
int request_objects) {
if (!*slice_config) return; if (!*slice_config) return;
/* just use the memory and set to NULL in original */ /* just use the memory and set to NULL in original */
Protocol__FlexSliceConfig *sc = *slice_config; Protocol__FlexSliceConfig *sc = *slice_config;
...@@ -1797,11 +1799,13 @@ void prepare_update_slice_config(mid_t mod_id, Protocol__FlexSliceConfig **slice ...@@ -1797,11 +1799,13 @@ void prepare_update_slice_config(mid_t mod_id, Protocol__FlexSliceConfig **slice
enum lfds700_misc_flag overwrite_occurred_flag; enum lfds700_misc_flag overwrite_occurred_flag;
int put_on_hold = 0; int put_on_hold = 0;
if (sc->dl->scheduler && !check_scheduler(mod_id, sc->dl->scheduler)) { if (request_objects
&& sc->dl->scheduler
&& !check_scheduler(mod_id, sc->dl->scheduler)) {
request_scheduler(mod_id, sc->dl->scheduler, xid++); request_scheduler(mod_id, sc->dl->scheduler, xid++);
put_on_hold = 1; put_on_hold = 1;
} }
for (int i = 0; i < sc->dl->n_slices; ++i) { for (int i = 0; request_objects && i < sc->dl->n_slices; ++i) {
Protocol__FlexSlice *sl = sc->dl->slices[i]; Protocol__FlexSlice *sl = sc->dl->slices[i];
if (sl->scheduler && !check_scheduler(mod_id, sl->scheduler)) { if (sl->scheduler && !check_scheduler(mod_id, sl->scheduler)) {
request_scheduler(mod_id, sl->scheduler, xid++); request_scheduler(mod_id, sl->scheduler, xid++);
...@@ -1907,3 +1911,71 @@ void flexran_agent_slice_update(mid_t mod_id) { ...@@ -1907,3 +1911,71 @@ void flexran_agent_slice_update(mid_t mod_id) {
free(ue_config); free(ue_config);
} }
} }
void flexran_agent_mac_inform_delegation(mid_t mod_id,
Protocol__FlexControlDelegation *cdm) {
LOG_W(FLEXRAN_AGENT,
"received FlexControlDelegation message for object '%s' xid %d\n",
cdm->name,
cdm->header->xid);
if (cdm->header->xid < xid - 1) {
LOG_I(FLEXRAN_AGENT,
"waiting for %d more messages (up to xid %d)\n",
xid - 1 - cdm->header->xid,
xid - 1);
return;
}
/* should receive up to xid - 1, otherwise it means there was no request */
AssertFatal(xid > cdm->header->xid,
"received control delegation with xid %d that we never requested "
"(last request %d)\n",
cdm->header->xid,
xid - 1);
/* Load the library so the user plane can search it */
char s[512];
int rc = flexran_agent_map_name_to_delegated_object(mod_id, cdm->name, s, 512);
if (rc < 0) {
LOG_E(FLEXRAN_AGENT, "cannot map name %s\n", cdm->name);
return;
}
/* TODO where to unload/save handle?? */
void *h = dlopen(s, RTLD_NOW);
if (!h) {
LOG_E(FLEXRAN_AGENT, "dlopen(): %s\n", dlerror());
return;
}
LOG_I(FLEXRAN_AGENT, "library handle %p\n", h);
struct lfds700_misc_prng_state ls;
LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE;
lfds700_misc_prng_init(&ls);
Protocol__FlexranMessage *msg = NULL;
struct lfds700_ringbuffer_state *state = &store_slice_config_ringbuffer_state[mod_id];
if (lfds700_ringbuffer_read(state, NULL, (void **) &msg, &ls) == 0) {
LOG_E(FLEXRAN_AGENT, "%s(): could not read config from ringbuffer\n", __func__);
return;
}
AssertFatal(cdm->header->xid == msg->enb_config_reply_msg->header->xid,
"expected and retrieved xid of stored slice configuration does "
"not match (expected %d, retrieved %d)\n",
cdm->header->xid,
msg->enb_config_reply_msg->header->xid);
/* Since we recover, stop the timeout */
rc = flexran_agent_destroy_timer(mod_id, cdm->header->xid);
prepare_update_slice_config(
mod_id,
&msg->enb_config_reply_msg->cell_config[0]->slice_config,
0 /* don't do a request */);
/* we should not call flexran_agent_destroy_enb_config_reply(smsg); since
* upon timer removal, this is automatically done.
* prepare_update_slice_config() takes ownership of the slice config, it is
* freed inside */
/* TODO save dlhandle in list with name. If it has been installed and nothing
* references it after a reconfiguration, free and remove */
}
...@@ -117,7 +117,9 @@ void flexran_agent_slice_update(mid_t mod_id); ...@@ -117,7 +117,9 @@ void flexran_agent_slice_update(mid_t mod_id);
/* marks slice_config so that it can be applied later. Takes ownership of the /* marks slice_config so that it can be applied later. Takes ownership of the
* FlexSliceConfig message */ * FlexSliceConfig message */
void prepare_update_slice_config(mid_t mod_id, Protocol__FlexSliceConfig **slice); void prepare_update_slice_config(mid_t mod_id,
Protocol__FlexSliceConfig **slice,
int request_objects);
/* inserts a new ue_config into the structure keeping ue to slice association /* inserts a new ue_config into the structure keeping ue to slice association
* updates and marks so it can be applied. Takes ownership of the FlexUeConfig message */ * updates and marks so it can be applied. Takes ownership of the FlexUeConfig message */
...@@ -127,4 +129,8 @@ void prepare_ue_slice_assoc_update(mid_t mod_id, Protocol__FlexUeConfig **ue_con ...@@ -127,4 +129,8 @@ void prepare_ue_slice_assoc_update(mid_t mod_id, Protocol__FlexUeConfig **ue_con
* flexran_agent_fill_mac_cell_config() */ * flexran_agent_fill_mac_cell_config() */
void flexran_agent_destroy_mac_slice_config(Protocol__FlexCellConfig *conf); void flexran_agent_destroy_mac_slice_config(Protocol__FlexCellConfig *conf);
/* information about a new (potentially relevant) control delegation message */
void flexran_agent_mac_inform_delegation(mid_t mod_id,
Protocol__FlexControlDelegation *cdm);
#endif #endif
...@@ -478,6 +478,15 @@ int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol_ ...@@ -478,6 +478,15 @@ int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol_
LOG_E(FLEXRAN_AGENT, "cannot remove file %s: %s\n", target, strerror(errno)); LOG_E(FLEXRAN_AGENT, "cannot remove file %s: %s\n", target, strerror(errno));
} }
if (control_delegation_msg->has_delegation_type
&& control_delegation_msg->delegation_type == PROTOCOL__FLEX_CONTROL_DELEGATION_TYPE__FLCDT_MAC_DL_UE_SCHEDULER
&& control_delegation_msg->header
&& control_delegation_msg->header->has_xid) {
/* Inform the MAC subsystem that a control delegation for it has arrived */
/* TODO this should be triggered by an agent reconfiguration? */
flexran_agent_mac_inform_delegation(mod_id, control_delegation_msg);
}
return 0; return 0;
} }
...@@ -957,7 +966,9 @@ int flexran_agent_handle_enb_config_reply(mid_t mod_id, const void *params, Prot ...@@ -957,7 +966,9 @@ int flexran_agent_handle_enb_config_reply(mid_t mod_id, const void *params, Prot
if (enb_config->n_cell_config > 0) { if (enb_config->n_cell_config > 0) {
if (flexran_agent_get_mac_xface(mod_id) && enb_config->cell_config[0]->slice_config) { if (flexran_agent_get_mac_xface(mod_id) && enb_config->cell_config[0]->slice_config) {
prepare_update_slice_config(mod_id, &enb_config->cell_config[0]->slice_config); prepare_update_slice_config(mod_id,
&enb_config->cell_config[0]->slice_config,
1 /* request objects if necessary */);
} }
if (enb_config->cell_config[0]->has_eutra_band if (enb_config->cell_config[0]->has_eutra_band
&& enb_config->cell_config[0]->has_dl_freq && enb_config->cell_config[0]->has_dl_freq
......
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