From 975aeb956daa5b46d77a697bc1dd05f18f0cd18c Mon Sep 17 00:00:00 2001 From: Andreas Schultz Date: Mon, 23 Jan 2023 10:16:47 +0100 Subject: [PATCH] remove support for pre 3GPP Rel.16 PFCP and UPF features The PFCP User Plane IP Resource Information IE has been removed in 3GPP Release 16 and UP based TEID assignment is mandatory since that release as well. User Plane IP Resource Information where never really useful, therefore dropping it helps us simplifying the code without losing anything. UP based TEID assignment (FTUP feature flag) is mandatory if multiple SMFs want to control the same UPF. This is also an important feature (which part of why it become mandatory in 3GPP Rel. 16). --- upf/test/test_upf.py | 2 -- upf/upf.c | 1 - upf/upf.h | 2 -- upf/upf_cli.c | 52 ---------------------------- upf/upf_pfcp.c | 17 ++++------ upf/upf_pfcp_api.c | 80 +++++--------------------------------------- 6 files changed, 16 insertions(+), 138 deletions(-) diff --git a/upf/test/test_upf.py b/upf/test/test_upf.py index 2d5c283..ca540cc 100644 --- a/upf/test/test_upf.py +++ b/upf/test/test_upf.py @@ -118,7 +118,6 @@ def pgw_setup_cmds(cls): "upf nwi name cp vrf 0", "upf nwi name epc vrf 100", "upf nwi name sgi vrf 200", - "upf specification release 16", "upf node-id fqdn upg", "upf pfcp endpoint ip %s vrf 0" % cls.if_cp.local_ip4, "ip route add 0.0.0.0/0 table 200 via %s %s" % @@ -263,7 +262,6 @@ def pgw_setup_cmds(cls): "upf nwi name cp vrf 0", "upf nwi name epc vrf 100", "upf nwi name sgi vrf 200", - "upf specification release 16", "upf node-id ip6 %s" % cls.if_cp.local_ip6, "upf pfcp endpoint ip %s vrf 0" % cls.if_cp.local_ip6, "ip route add ::/0 table 200 via %s %s" % diff --git a/upf/upf.c b/upf/upf.c index f693843..8da8bfb 100644 --- a/upf/upf.c +++ b/upf/upf.c @@ -566,7 +566,6 @@ upf_init (vlib_main_t * vm) sm->vnet_main = vnet_get_main (); sm->vlib_main = vm; - sm->pfcp_spec_version = 15; sm->rand_base = random_default_seed (); sm->log_class = vlib_log_register_class ("upf", 0); diff --git a/upf/upf.h b/upf/upf.h index 31f9104..1db196c 100644 --- a/upf/upf.h +++ b/upf/upf.h @@ -1015,8 +1015,6 @@ typedef struct /* adf apps vector */ upf_adf_app_t *upf_apps; - //TODO: Change to UPF flags? - u32 pfcp_spec_version; u32 rand_base; pfcp_node_id_t node_id; diff --git a/upf/upf_cli.c b/upf/upf_cli.c index 2e0f73e..edd1276 100644 --- a/upf/upf_cli.c +++ b/upf/upf_cli.c @@ -785,58 +785,6 @@ VLIB_CLI_COMMAND (upf_tdf_ul_enable_command, static) = { }; /* *INDENT-ON* */ -static clib_error_t * -upf_spec_release_command_fn (vlib_main_t * vm, - unformat_input_t * main_input, - vlib_cli_command_t * cmd) -{ - unformat_input_t _line_input, *line_input = &_line_input; - upf_main_t *gtm = &upf_main; - u32 spec_version = 0; - - if (!unformat_user (main_input, unformat_line_input, line_input)) - return 0; - - while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) - { - if (unformat (line_input, "release %u", &spec_version)) - break; - else - return 0; - } - - gtm->pfcp_spec_version = spec_version; - return NULL; -} - -/* *INDENT-OFF* */ -VLIB_CLI_COMMAND (upf_spec_release_command, static) = { - .path = "upf specification", - .short_help = "upf specification release [MAJOR.MINOR.PATCH]", - .function = upf_spec_release_command_fn, -}; -/* *INDENT-ON* */ - -static clib_error_t * -upf_show_spec_release_command_fn (vlib_main_t * vm, - unformat_input_t * main_input, - vlib_cli_command_t * cmd) -{ - upf_main_t *gtm = &upf_main; - vlib_cli_output (vm, "PFCP version: %u", gtm->pfcp_spec_version); - return NULL; -} - -/* *INDENT-OFF* */ -VLIB_CLI_COMMAND (upf_show_spec_release_command, static) = -{ - .path = "show upf specification release", - .short_help = - "show upf specification release", - .function = upf_show_spec_release_command_fn, -}; -/* *INDENT-ON* */ - static clib_error_t * upf_node_id_command_fn (vlib_main_t * vm, unformat_input_t * main_input, diff --git a/upf/upf_pfcp.c b/upf/upf_pfcp.c index 775fd92..6321443 100644 --- a/upf/upf_pfcp.c +++ b/upf/upf_pfcp.c @@ -2830,18 +2830,15 @@ format_pfcp_session (u8 * s, va_list * args) vlib_time_now (gtm->vlib_main) - sx->last_ul_traffic, rules->inactivity_timer.handle); - if (gtm->pfcp_spec_version == 16) + u16 idx = 1; + s = format (s, " TEID assignment per choose ID\n"); + for (idx = 0; idx < 256 /* U8_MAX limits value of CHID */ ; idx++) { - u16 idx = 1; - s = format (s, " TEID assignment per choose ID\n"); - for (idx = 0; idx < 256 /* U8_MAX limits value of CHID */ ; idx++) - { - u32 teid = *sparse_vec_elt_at_index (sx->teid_by_chid, idx); - if (teid) - s = format (s, " %3u: %u (0x%08x)\n", idx, teid, teid); + u32 teid = *sparse_vec_elt_at_index (sx->teid_by_chid, idx); + if (teid) + s = format (s, " %3u: %u (0x%08x)\n", idx, teid, teid); - idx += 1; - } + idx += 1; } vec_foreach (pdr, rules->pdr) diff --git a/upf/upf_pfcp_api.c b/upf/upf_pfcp_api.c index 924a869..064dfc0 100644 --- a/upf/upf_pfcp_api.c +++ b/upf/upf_pfcp_api.c @@ -189,56 +189,6 @@ build_ue_ip_address_information (pfcp_ue_ip_address_pool_information_t ** } } -static void - build_user_plane_ip_resource_information - (pfcp_user_plane_ip_resource_information_t ** upip) -{ - upf_main_t *gtm = &upf_main; - upf_upip_res_t *res; - - vec_alloc (*upip, pool_elts (gtm->upip_res)); - - pool_foreach (res, gtm->upip_res) - { - pfcp_user_plane_ip_resource_information_t *r; - - vec_add2 (*upip, r, 1); - - if (res->nwi_index != ~0) - { - upf_nwi_t *nwi = pool_elt_at_index (gtm->nwis, res->nwi_index); - - r->flags |= USER_PLANE_IP_RESOURCE_INFORMATION_ASSONI; - r->network_instance = vec_dup (nwi->name); - } - - if (INTF_INVALID != res->intf) - { - - r->flags |= USER_PLANE_IP_RESOURCE_INFORMATION_ASSOSI; - r->source_intf = res->intf; - } - - if (res->mask != 0) - { - r->teid_range_indication = __builtin_popcount (res->mask); - r->teid_range = (res->teid >> 24); - } - - if (!is_zero_ip4_address (&res->ip4)) - { - r->flags |= USER_PLANE_IP_RESOURCE_INFORMATION_V4; - r->ip4 = res->ip4; - } - - if (!is_zero_ip6_address (&res->ip6)) - { - r->flags |= USER_PLANE_IP_RESOURCE_INFORMATION_V6; - r->ip6 = res->ip6; - } - } -} - /* message handlers */ static int @@ -371,27 +321,15 @@ handle_association_setup_request (pfcp_msg_t * msg, pfcp_decoded_msg_t * dmsg) SET_BIT (resp->grp.fields, ASSOCIATION_PROCEDURE_RESPONSE_UP_FUNCTION_FEATURES); - resp->up_function_features |= F_UPFF_EMPU; - if (gtm->pfcp_spec_version >= 16) - { - resp->up_function_features |= F_UPFF_VTIME; - resp->up_function_features |= F_UPFF_FTUP; - build_ue_ip_address_information (&resp->ue_ip_address_pool_information); - if (vec_len (resp->ue_ip_address_pool_information) != 0) - SET_BIT (resp->grp.fields, - ASSOCIATION_PROCEDURE_RESPONSE_UE_IP_ADDRESS_POOL_INFORMATION); - SET_BIT (resp->grp.fields, - ASSOCIATION_PROCEDURE_RESPONSE_BBF_UP_FUNCTION_FEATURES); - resp->bbf_up_function_features |= BBF_UP_NAT; - } - else - { - build_user_plane_ip_resource_information - (&resp->user_plane_ip_resource_information); - if (vec_len (resp->user_plane_ip_resource_information) != 0) - SET_BIT (resp->grp.fields, - ASSOCIATION_PROCEDURE_RESPONSE_USER_PLANE_IP_RESOURCE_INFORMATION); - } + resp->up_function_features |= (F_UPFF_EMPU | F_UPFF_VTIME | F_UPFF_FTUP); + build_ue_ip_address_information (&resp->ue_ip_address_pool_information); + if (vec_len (resp->ue_ip_address_pool_information) != 0) + SET_BIT (resp->grp.fields, + ASSOCIATION_PROCEDURE_RESPONSE_UE_IP_ADDRESS_POOL_INFORMATION); + SET_BIT (resp->grp.fields, + ASSOCIATION_PROCEDURE_RESPONSE_BBF_UP_FUNCTION_FEATURES); + resp->bbf_up_function_features |= BBF_UP_NAT; + if (r == 0) { n->heartbeat_handle = upf_pfcp_server_start_timer