context_map_{rua,sccp}: Re-order to always process KPIs

Prior to this patch we always decoded CS RANAP, but only decoded PS
RANAP in case PFCP support was enabled.  This meant that PS KPIs
were only counted when PFCP was enabled, too.

Let's move to a mode where we unconditionally decode RANAP and always
call the KPI module for updating the rate counters.

Change-Id: I6054b6efcc202ebd71cd6e135e49c279ba616a01
This commit is contained in:
Harald Welte 2024-03-15 20:20:10 +01:00
parent 48c1c8c369
commit 002ce83f92
2 changed files with 29 additions and 50 deletions

View File

@ -161,39 +161,33 @@ static int handle_rx_rua(struct osmo_fsm_inst *fi, struct msgb *ranap_msg)
if (!msg_has_l2_data(ranap_msg))
return 0;
/* See if it is a RAB Assignment Response message from RUA to SCCP, where we need to change the user plane
* information, for RTP mapping via MGW, or GTP mapping via UPF. */
if (!map->is_ps) {
ranap_message *message = hnbgw_decode_ranap_co(ranap_msg);
if (message) {
LOGPFSML(fi, LOGL_DEBUG, "rx from RUA: RANAP %s\n",
get_value_string(ranap_procedure_code_vals, message->procedureCode));
ranap_message *message = hnbgw_decode_ranap_co(ranap_msg);
if (message) {
LOGPFSML(fi, LOGL_DEBUG, "rx from RUA: RANAP %s\n",
get_value_string(ranap_procedure_code_vals, message->procedureCode));
kpi_ranap_process_ul(map, message);
kpi_ranap_process_ul(map, message);
if (!map->is_ps) {
/* See if it is a RAB Assignment Response message from RUA to SCCP, where we need to change the user plane
* information, for RTP mapping via MGW, or GTP mapping via UPF. */
switch (message->procedureCode) {
case RANAP_ProcedureCode_id_RAB_Assignment:
/* mgw_fsm_handle_rab_ass_resp() takes ownership of prim->oph and (ranap) message */
return mgw_fsm_handle_cs_rab_ass_resp(map, ranap_msg, message);
}
}
} else {
#if ENABLE_PFCP
} else if (hnb_gw_is_gtp_mapping_enabled()) {
/* map->is_ps == true and PFCP is enabled in osmo-hnbgw.cfg */
ranap_message *message = hnbgw_decode_ranap_co(ranap_msg);
if (message) {
LOGPFSML(fi, LOGL_DEBUG, "rx from RUA: RANAP %s\n",
get_value_string(ranap_procedure_code_vals, message->procedureCode));
kpi_ranap_process_ul(map, message);
switch (message->procedureCode) {
case RANAP_ProcedureCode_id_RAB_Assignment:
/* ps_rab_ass_fsm takes ownership of prim->oph and RANAP message */
return hnbgw_gtpmap_rx_rab_ass_resp(map, ranap_msg, message);
if (hnb_gw_is_gtp_mapping_enabled()) {
/* map->is_ps == true and PFCP is enabled in osmo-hnbgw.cfg */
switch (message->procedureCode) {
case RANAP_ProcedureCode_id_RAB_Assignment:
/* ps_rab_ass_fsm takes ownership of prim->oph and RANAP message */
return hnbgw_gtpmap_rx_rab_ass_resp(map, ranap_msg, message);
}
}
}
#endif
}
}
/* It was not a RAB Assignment Response that needed to be intercepted. Forward as-is to SCCP. */

View File

@ -204,19 +204,19 @@ static int handle_rx_sccp(struct osmo_fsm_inst *fi, struct msgb *ranap_msg)
/* See if it is a RAB Assignment Request message from SCCP to RUA, where we need to change the user plane
* information, for RTP mapping via MGW, or GTP mapping via UPF. */
if (!map->is_ps) {
ranap_message *message;
/* Circuit-Switched. Set up mapping of RTP ports via MGW */
message = talloc_zero(OTC_SELECT, ranap_message);
rc = ranap_ran_rx_co_decode(message, message, msgb_l2(ranap_msg), msgb_l2len(ranap_msg));
ranap_message *message;
message = talloc_zero(OTC_SELECT, ranap_message);
rc = ranap_ran_rx_co_decode(message, message, msgb_l2(ranap_msg), msgb_l2len(ranap_msg));
if (rc == 0) {
talloc_set_destructor(message, destruct_ranap_ran_rx_co_ies);
if (rc == 0) {
talloc_set_destructor(message, destruct_ranap_ran_rx_co_ies);
LOGPFSML(fi, LOGL_DEBUG, "rx from SCCP: RANAP %s\n",
get_value_string(ranap_procedure_code_vals, message->procedureCode));
LOGPFSML(fi, LOGL_DEBUG, "rx from SCCP: RANAP %s\n",
get_value_string(ranap_procedure_code_vals, message->procedureCode));
kpi_ranap_process_dl(map, message);
kpi_ranap_process_dl(map, message);
if (!map->is_ps) {
/* Circuit-Switched. Set up mapping of RTP ports via MGW */
switch (message->procedureCode) {
case RANAP_ProcedureCode_id_RAB_Assignment:
@ -228,24 +228,9 @@ static int handle_rx_sccp(struct osmo_fsm_inst *fi, struct msgb *ranap_msg)
mgw_fsm_release(map);
break;
}
}
#if ENABLE_PFCP
} else {
ranap_message *message;
/* Packet-Switched. Set up mapping of GTP ports via UPF */
message = talloc_zero(OTC_SELECT, ranap_message);
rc = ranap_ran_rx_co_decode(message, message, msgb_l2(ranap_msg), msgb_l2len(ranap_msg));
if (rc == 0) {
talloc_set_destructor(message, destruct_ranap_ran_rx_co_ies);
LOGPFSML(fi, LOGL_DEBUG, "rx from SCCP: RANAP %s\n",
get_value_string(ranap_procedure_code_vals, message->procedureCode));
kpi_ranap_process_dl(map, message);
} else {
switch (message->procedureCode) {
case RANAP_ProcedureCode_id_RAB_Assignment:
/* If a UPF is configured, handle the RAB Assignment via ps_rab_ass_fsm, and replace the
* GTP F-TEIDs in the RAB Assignment message before passing it on to RUA. */
@ -265,8 +250,8 @@ static int handle_rx_sccp(struct osmo_fsm_inst *fi, struct msgb *ranap_msg)
hnbgw_gtpmap_release(map);
break;
}
}
#endif
}
}
/* It was not a RAB Assignment Request that needed to be intercepted. Forward as-is to RUA. */