Fix for SGWC and SMF round robin selection - select only PFCP associated SGWU/UPF nodes (#556)
This commit is contained in:
parent
8bb0a168f8
commit
56a866c46e
|
@ -451,19 +451,37 @@ static ogs_pfcp_node_t *selected_sgwu_node(
|
||||||
ogs_assert(current);
|
ogs_assert(current);
|
||||||
ogs_assert(sess);
|
ogs_assert(sess);
|
||||||
|
|
||||||
next = ogs_list_next(current);
|
int RR=0, selected=0;
|
||||||
for (node = next; node; node = ogs_list_next(node)) {
|
|
||||||
if (OGS_FSM_CHECK(&node->sm, sgwc_pfcp_state_associated) &&
|
while(!selected){
|
||||||
compare_ue_info(node, sess) == true) return node;
|
// continue search from current position
|
||||||
|
next = ogs_list_next(current);
|
||||||
|
for (node = next; node; node = ogs_list_next(node)) {
|
||||||
|
if (!RR){
|
||||||
|
if (OGS_FSM_CHECK(&node->sm, sgwc_pfcp_state_associated) &&
|
||||||
|
compare_ue_info(node, sess) == true) return node;
|
||||||
|
}else{
|
||||||
|
if (OGS_FSM_CHECK(&node->sm, sgwc_pfcp_state_associated)) return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// cyclic search from top to current position
|
||||||
|
for (node = ogs_list_first(&ogs_pfcp_self()->peer_list);
|
||||||
|
node != next; node = ogs_list_next(node)) {
|
||||||
|
if (!RR){
|
||||||
|
if (OGS_FSM_CHECK(&node->sm, sgwc_pfcp_state_associated) &&
|
||||||
|
compare_ue_info(node, sess) == true) return node;
|
||||||
|
}else{
|
||||||
|
if (OGS_FSM_CHECK(&node->sm, sgwc_pfcp_state_associated)) return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if a round robin search has already been carried out
|
||||||
|
if(RR) break;
|
||||||
|
// re-run search in round robin mode, find and use next PFCP associated node
|
||||||
|
RR = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (node = ogs_list_first(&ogs_pfcp_self()->peer_list);
|
ogs_error("No SGWUs are PFCP associated");
|
||||||
node != next; node = ogs_list_next(node)) {
|
return ogs_list_first(&ogs_pfcp_self()->peer_list);
|
||||||
if (OGS_FSM_CHECK(&node->sm, sgwc_pfcp_state_associated) &&
|
|
||||||
compare_ue_info(node, sess) == true) return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
return next ? next : ogs_list_first(&ogs_pfcp_self()->peer_list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sgwc_sess_select_sgwu(sgwc_sess_t *sess)
|
void sgwc_sess_select_sgwu(sgwc_sess_t *sess)
|
||||||
|
|
|
@ -635,19 +635,37 @@ static ogs_pfcp_node_t *selected_upf_node(
|
||||||
ogs_assert(current);
|
ogs_assert(current);
|
||||||
ogs_assert(sess);
|
ogs_assert(sess);
|
||||||
|
|
||||||
next = ogs_list_next(current);
|
int RR=0, selected=0;
|
||||||
for (node = next; node; node = ogs_list_next(node)) {
|
|
||||||
if (OGS_FSM_CHECK(&node->sm, smf_pfcp_state_associated) &&
|
while(!selected){
|
||||||
compare_ue_info(node, sess) == true) return node;
|
// continue search from current position
|
||||||
|
next = ogs_list_next(current);
|
||||||
|
for (node = next; node; node = ogs_list_next(node)) {
|
||||||
|
if (!RR){
|
||||||
|
if (OGS_FSM_CHECK(&node->sm, smf_pfcp_state_associated) &&
|
||||||
|
compare_ue_info(node, sess) == true) return node;
|
||||||
|
}else{
|
||||||
|
if (OGS_FSM_CHECK(&node->sm, smf_pfcp_state_associated)) return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// cyclic search from top to current position
|
||||||
|
for (node = ogs_list_first(&ogs_pfcp_self()->peer_list);
|
||||||
|
node != next; node = ogs_list_next(node)) {
|
||||||
|
if (!RR){
|
||||||
|
if (OGS_FSM_CHECK(&node->sm, smf_pfcp_state_associated) &&
|
||||||
|
compare_ue_info(node, sess) == true) return node;
|
||||||
|
}else{
|
||||||
|
if (OGS_FSM_CHECK(&node->sm, smf_pfcp_state_associated)) return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if a round robin search has already been carried out
|
||||||
|
if(RR) break;
|
||||||
|
// re-run search in round robin mode, find and use next PFCP associated node
|
||||||
|
RR = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (node = ogs_list_first(&ogs_pfcp_self()->peer_list);
|
ogs_error("No UPFs are PFCP associated");
|
||||||
node != next; node = ogs_list_next(node)) {
|
return ogs_list_first(&ogs_pfcp_self()->peer_list);
|
||||||
if (OGS_FSM_CHECK(&node->sm, smf_pfcp_state_associated) &&
|
|
||||||
compare_ue_info(node, sess) == true) return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
return next ? next : ogs_list_first(&ogs_pfcp_self()->peer_list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void smf_sess_select_upf(smf_sess_t *sess)
|
void smf_sess_select_upf(smf_sess_t *sess)
|
||||||
|
|
Loading…
Reference in New Issue