pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/39602?usp=email )
Change subject: Log RAB_STATE name instead of value ......................................................................
Log RAB_STATE name instead of value
Related: SYS#7338 Change-Id: I24593a1db1334052f3a79f59a521228393fc1ed7 --- M include/osmocom/hnbgw/context_map.h M src/osmo-hnbgw/kpi_ranap.c 2 files changed, 24 insertions(+), 6 deletions(-)
Approvals: osmith: Looks good to me, approved Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve
diff --git a/include/osmocom/hnbgw/context_map.h b/include/osmocom/hnbgw/context_map.h index 8fe478c..f9bd251 100644 --- a/include/osmocom/hnbgw/context_map.h +++ b/include/osmocom/hnbgw/context_map.h @@ -2,6 +2,7 @@
#include <stdint.h> #include <osmocom/core/linuxlist.h> +#include <osmocom/core/utils.h> #include <osmocom/hnbgw/hnbgw.h> #include <osmocom/gsm/gsm48.h>
@@ -117,6 +118,10 @@ RAB_STATE_ACTIVE, RAB_STATE_REL_REQ, }; +extern const struct value_string hnbgw_rab_state_names[]; +static inline const char *hnbgw_rab_state_name(enum rab_state val) +{ return get_value_string(hnbgw_rab_state_names, val); } +
struct hnbgw_context_map { /* entry in the per-CN list of mappings */ diff --git a/src/osmo-hnbgw/kpi_ranap.c b/src/osmo-hnbgw/kpi_ranap.c index d731c5f..3f2c1b3 100644 --- a/src/osmo-hnbgw/kpi_ranap.c +++ b/src/osmo-hnbgw/kpi_ranap.c @@ -28,6 +28,13 @@ #include <osmocom/hnbgw/context_map.h> #include <osmocom/hnbgw/kpi.h>
+const struct value_string hnbgw_rab_state_names[] = { + { RAB_STATE_INACTIVE, "INACTIVE" }, + { RAB_STATE_ACT_REQ, "ACT_REQ" }, + { RAB_STATE_ACTIVE, "ACTIVE" }, + { RAB_STATE_REL_REQ, "REL_REQ" }, + {} +};
/*********************************************************************** * DOWNLINK messages @@ -108,7 +115,8 @@ break; default: LOG_MAP(map, DRANAP, LOGL_NOTICE, - "Unexpected RAB Activation/Modification Req for RAB in state %u\n", map->rab_state[rab_id]); + "Unexpected RAB Activation/Modification Req for RAB in state %s\n", + hnbgw_rab_state_name(map->rab_state[rab_id])); break; }
@@ -154,7 +162,8 @@ break; default: LOG_MAP(map, DRANAP, LOGL_NOTICE, - "Unexpected RAB Release Req in state %u\n", map->rab_state[rab_id]); + "Unexpected RAB Release Req in state %s\n", + hnbgw_rab_state_name(map->rab_state[rab_id])); break; } /* mark that RAB as release requested */ @@ -249,7 +258,8 @@ break; default: LOG_MAP(map, DRANAP, LOGL_NOTICE, - "Unexpected RAB Activation/Modification Conf for RAB in state %u\n", map->rab_state[rab_id]); + "Unexpected RAB Activation/Modification Conf for RAB in state %s\n", + hnbgw_rab_state_name(map->rab_state[rab_id])); break; }
@@ -288,7 +298,8 @@ break; default: LOG_MAP(map, DRANAP, LOGL_NOTICE, - "Unexpected RAB Release Conf for RAB in state %u\n", map->rab_state[rab_id]); + "Unexpected RAB Release Conf for RAB in state %s\n", + hnbgw_rab_state_name(map->rab_state[rab_id])); break; } /* mark that RAB as released */ @@ -336,7 +347,8 @@ break; default: LOG_MAP(map, DRANAP, LOGL_NOTICE, - "Unexpected RAB Activation/Modification Failed for RAB in state %u\n", map->rab_state[rab_id]); + "Unexpected RAB Activation/Modification Failed for RAB in state %s\n", + hnbgw_rab_state_name(map->rab_state[rab_id])); break; }
@@ -382,7 +394,8 @@ break; default: LOG_MAP(map, DRANAP, LOGL_NOTICE, - "Unexpected RAB Release Failed for RAB in state %u\n", map->rab_state[rab_id]); + "Unexpected RAB Release Failed for RAB in state %s\n", + hnbgw_rab_state_name(map->rab_state[rab_id])); break; }