Commit ff688f16 authored by Robert Schmidt's avatar Robert Schmidt

NNSF my MME code: respect selected PLMN ID

parent 6c0680db
......@@ -89,6 +89,7 @@ int s1ap_eNB_handle_nas_first_req(
mme_desc_p = s1ap_eNB_nnsf_select_mme_by_mme_code(
instance_p,
s1ap_nas_first_req_p->establishment_cause,
s1ap_nas_first_req_p->selected_plmn_identity,
s1ap_nas_first_req_p->ue_identity.s_tmsi.mme_code);
}
}
......
......@@ -92,11 +92,10 @@ s1ap_eNB_nnsf_select_mme(s1ap_eNB_instance_t *instance_p,
struct s1ap_eNB_mme_data_s *
s1ap_eNB_nnsf_select_mme_by_mme_code(s1ap_eNB_instance_t *instance_p,
rrc_establishment_cause_t cause,
int selected_plmn_identity,
uint8_t mme_code)
{
struct s1ap_eNB_mme_data_s *mme_data_p = NULL;
struct s1ap_eNB_mme_data_s *mme_highest_capacity_p = NULL;
uint8_t current_capacity = 0;
RB_FOREACH(mme_data_p, s1ap_mme_map, &instance_p->s1ap_mme_head) {
struct served_gummei_s *gummei_p = NULL;
......@@ -135,30 +134,37 @@ s1ap_eNB_nnsf_select_mme_by_mme_code(s1ap_eNB_instance_t *instance_p,
}
}
if (current_capacity < mme_data_p->relative_mme_capacity) {
/* We find a better MME, keep a reference to it */
current_capacity = mme_data_p->relative_mme_capacity;
mme_highest_capacity_p = mme_data_p;
}
/* Looking for MME code matching the one provided by NAS */
STAILQ_FOREACH(gummei_p, &mme_data_p->served_gummei, next) {
struct mme_code_s *mme_code_p = NULL;
struct plmn_identity_s *served_plmn_p = NULL;
STAILQ_FOREACH(served_plmn_p, &gummei_p->served_plmns, next) {
if ((served_plmn_p->mcc == instance_p->mcc[selected_plmn_identity]) &&
(served_plmn_p->mnc == instance_p->mnc[selected_plmn_identity])) {
break;
}
}
STAILQ_FOREACH(mme_code_p, &gummei_p->mme_codes, next) {
if (mme_code_p->mme_code == mme_code) {
return mme_data_p;
break;
}
}
/* The MME matches the parameters provided by the NAS layer ->
* the MME is knwown and the association is ready.
* Return the reference to the MME to use it for this UE.
*/
if (mme_code_p && served_plmn_p) {
return mme_data_p;
}
}
}
/* At this point no MME matches the provided GUMMEI. Select the one with the
* highest relative capacity.
* In case the list of known MME is empty, simply return NULL, that way the RRC
* layer should know about it and reject RRC connectivity.
*/
return mme_highest_capacity_p;
/* At this point no MME matches the selected PLMN and MME code. In this case,
* return NULL. That way the RRC layer should know about it and reject RRC
* connectivity. */
return NULL;
}
struct s1ap_eNB_mme_data_s *
......
......@@ -29,6 +29,7 @@ s1ap_eNB_nnsf_select_mme(s1ap_eNB_instance_t *instance_p,
struct s1ap_eNB_mme_data_s*
s1ap_eNB_nnsf_select_mme_by_mme_code(s1ap_eNB_instance_t *instance_p,
rrc_establishment_cause_t cause,
int selected_plmn_identity,
uint8_t mme_code);
struct s1ap_eNB_mme_data_s*
......
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