Commit 62b89f82 authored by Robert Schmidt's avatar Robert Schmidt

FlexRAN: Circumvent different RRC/MAC layer user ID sorting

* RRC and MAC might sort users differently
* therefore, we have to "reverse lookup" the MAC ID from the RNTI when filling
  user info
* For this purpose, add RAN API function flexran_get_mac_ue_id_rnti()
parent 8d862dac
......@@ -558,7 +558,8 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl
if (flexran_agent_get_rrc_xface(mod_id) && flexran_agent_get_mac_xface(mod_id)
&& flexran_get_rrc_num_ues(mod_id) != flexran_get_mac_num_ues(mod_id)) {
LOG_E(FLEXRAN_AGENT, "different numbers of UEs in RRC and MAC\n");
LOG_E(FLEXRAN_AGENT, "different numbers of UEs in RRC (%d) and MAC (%d)\n",
flexran_get_rrc_num_ues(mod_id), flexran_get_mac_num_ues(mod_id));
goto error;
}
......@@ -578,7 +579,7 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl
if (flexran_agent_get_rrc_xface(mod_id))
flexran_agent_fill_rrc_ue_config(mod_id, rnti, ue_config[i]);
if (flexran_agent_get_mac_xface(mod_id)) {
const int UE_id = flexran_get_mac_ue_id(mod_id, i);
const int UE_id = flexran_get_mac_ue_id_rnti(mod_id, rnti);
flexran_agent_fill_mac_ue_config(mod_id, UE_id, ue_config[i]);
}
}
......
......@@ -249,7 +249,8 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
if (flexran_agent_get_rrc_xface(mod_id) && flexran_agent_get_mac_xface(mod_id)
&& flexran_get_rrc_num_ues(mod_id) != flexran_get_mac_num_ues(mod_id)) {
LOG_E(FLEXRAN_AGENT, "different numbers of UEs in RRC and MAC\n");
LOG_E(FLEXRAN_AGENT, "different numbers of UEs in RRC (%d) and MAC (%d)\n",
flexran_get_rrc_num_ues(mod_id), flexran_get_mac_num_ues(mod_id));
goto error;
}
report_config.ue_report_type = malloc(sizeof(ue_report_type_t) * report_config.nr_ue);
......
......@@ -129,6 +129,21 @@ int flexran_get_num_ue_lcs(mid_t mod_id, mid_t ue_id)
return 3;
}
int flexran_get_mac_ue_id_rnti(mid_t mod_id, rnti_t rnti)
{
int n;
if (!mac_is_present(mod_id)) return 0;
/* get the (active) UE with RNTI i */
for (n = 0; n < MAX_MOBILES_PER_ENB; ++n) {
if (RC.mac[mod_id]->UE_list.active[n] == TRUE
&& rnti == UE_RNTI(mod_id, n)) {
return n;
}
}
return 0;
}
int flexran_get_mac_ue_id(mid_t mod_id, int i)
{
int n;
......
......@@ -80,6 +80,8 @@ int flexran_get_num_ue_lcs(mid_t mod_id, mid_t ue_id);
/* Get the rnti of a UE with id ue_id from MAC */
rnti_t flexran_get_mac_ue_crnti(mid_t mod_id, mid_t ue_id);
int flexran_get_mac_ue_id_rnti(mid_t mod_id, rnti_t rnti);
/* Return the UE id of attached UE as opposed to the index [0,NUM UEs] (i.e.,
* the i'th active UE). Returns 0 if the i'th active UE could not be found. */
int flexran_get_mac_ue_id(mid_t mod_id, int i);
......
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