[SMF/SGW-C] fix the PFCP RR selection (#953)

The configuration has changed. PFCP node rr=0 is removed as shown below.
sgwc:
  pfcp
    rr: 0 <-- Removed

Introduced a new configuration method for SMF/SGW-C

parameter:
  no_pfcp_rr_select: true

By default, PFCP round robin selection is allowed.
The above parameters prohibit selecting PFCP in a round robin manner.
This commit is contained in:
Sukchan Lee 2021-04-24 20:56:14 +09:00
parent dcfc9ef803
commit fc27f7499b
6 changed files with 45 additions and 71 deletions

View File

@ -67,15 +67,10 @@ sgwc:
#
# <SGWU_SELECTION_MODE - EPC only>
#
# o Round-Robin
# (note that round robin can be disabled for a particular node
# by setting flag 'rr' to 0)
#
# sgwu:
# pfcp:
# - addr: 127.0.0.6
# - addr: 127.0.0.12
# rr: 0
# - addr: 127.0.0.18
#
# o SGWU selection by eNodeB TAC
@ -126,6 +121,9 @@ sgwu:
# o Prefer IPv4 instead of IPv6 for estabishing new GTP connections.
# prefer_ipv4: true
#
# o Disable selection of SGW-U PFCP in Round-Robin manner
# no_pfcp_rr_select: true
#
parameter:
#

View File

@ -444,6 +444,9 @@ upf:
# o Prefer IPv4 instead of IPv6 for estabishing new GTP connections.
# prefer_ipv4: true
#
# o Disable selection of UPF PFCP in Round-Robin manner
# no_pfcp_rr_select: true
#
parameter:
#

View File

@ -354,6 +354,9 @@ int ogs_app_context_parse_config(void)
parameter_key, "no_ipv4v6_local_addr_in_packet_filter")) {
self.parameter.no_ipv4v6_local_addr_in_packet_filter =
ogs_yaml_iter_bool(&parameter_iter);
} else if (!strcmp(parameter_key, "no_pfcp_rr_select")) {
self.parameter.no_pfcp_rr_select =
ogs_yaml_iter_bool(&parameter_iter);
} else
ogs_warn("unknown key `%s`", parameter_key);
}

View File

@ -75,6 +75,8 @@ typedef struct ogs_app_context_s {
int use_openair;
int no_ipv4v6_local_addr_in_packet_filter;
int no_pfcp_rr_select;
} parameter;
struct {

View File

@ -332,48 +332,32 @@ static ogs_pfcp_node_t *selected_sgwu_node(
ogs_assert(current);
ogs_assert(sess);
int RR = 0, selected = 0;
/* continue search from current position */
next = ogs_list_next(current);
for (node = next; node; node = ogs_list_next(node)) {
if (OGS_FSM_CHECK(&node->sm, sgwc_pfcp_state_associated) &&
compare_ue_info(node, sess) == true) return node;
}
/* cyclic search from top to current position */
for (node = ogs_list_first(&ogs_pfcp_self()->pfcp_peer_list);
node != next; node = ogs_list_next(node)) {
if (OGS_FSM_CHECK(&node->sm, sgwc_pfcp_state_associated) &&
compare_ue_info(node, sess) == true) return node;
}
while (!selected) {
if (ogs_app()->parameter.no_pfcp_rr_select == 0) {
/* 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 {
/*
* we are in RR mode - use next PFCP associated
* node that is suited for full list RR
*/
if (OGS_FSM_CHECK(&node->sm, sgwc_pfcp_state_associated) &&
node->rr_enable == 1) return node;
}
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()->pfcp_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 {
/*
* we are in RR mode - use next PFCP associated
* node that is suited for full list RR
*/
if (OGS_FSM_CHECK(&node->sm, sgwc_pfcp_state_associated) &&
node->rr_enable == 1) return node;
}
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;
}
ogs_error("No SGWUs are PFCP associated that are suited to RR");

View File

@ -884,48 +884,32 @@ static ogs_pfcp_node_t *selected_upf_node(
ogs_assert(current);
ogs_assert(sess);
int RR = 0, selected = 0;
/* continue search from current position */
next = ogs_list_next(current);
for (node = next; node; node = ogs_list_next(node)) {
if (OGS_FSM_CHECK(&node->sm, smf_pfcp_state_associated) &&
compare_ue_info(node, sess) == true) return node;
}
/* cyclic search from top to current position */
for (node = ogs_list_first(&ogs_pfcp_self()->pfcp_peer_list);
node != next; node = ogs_list_next(node)) {
if (OGS_FSM_CHECK(&node->sm, smf_pfcp_state_associated) &&
compare_ue_info(node, sess) == true) return node;
}
while (!selected) {
if (ogs_app()->parameter.no_pfcp_rr_select == 0) {
/* 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 {
/*
* we are in RR mode - use next PFCP associated
* node that is suited for full list RR
*/
if (OGS_FSM_CHECK(&node->sm, smf_pfcp_state_associated) &&
node->rr_enable == 1) return node;
}
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()->pfcp_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 {
/*
* we are in RR mode - use next PFCP associated
* node that is suited for full list RR
*/
if (OGS_FSM_CHECK(&node->sm, smf_pfcp_state_associated) &&
node->rr_enable == 1) return node;
}
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;
}
ogs_error("No UPFs are PFCP associated that are suited to RR");