pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/40265?usp=email )
Change subject: Get rid of cnpool->cnlink_ctrg_desc ...................................................................... Get rid of cnpool->cnlink_ctrg_desc There's no need to store that pointer in the cnpool, since the domain can be obtained from cnpool at cnlink creation time. Move the per-cnlink rate counters to the file where they belong. Change-Id: Iaa36bb52f8135ef2421931f1ea6a40885b588e1d --- M include/osmocom/hnbgw/hnbgw_cn.h M src/osmo-hnbgw/cnlink.c M src/osmo-hnbgw/hnbgw_cn.c 3 files changed, 142 insertions(+), 132 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/65/40265/1 diff --git a/include/osmocom/hnbgw/hnbgw_cn.h b/include/osmocom/hnbgw/hnbgw_cn.h index fe4f7bb..1a5288a 100644 --- a/include/osmocom/hnbgw/hnbgw_cn.h +++ b/include/osmocom/hnbgw/hnbgw_cn.h @@ -49,9 +49,6 @@ * behavior, emergency calls need a separate round-robin counter. */ unsigned int round_robin_next_emerg_nr; - /* rate counter group that child hnbgw_cnlinks should use (points to msc_ctrg_desc or sgsn_ctrg_desc) */ - const struct rate_ctr_group_desc *cnlink_ctrg_desc; - /* Running counters for this pool */ struct rate_ctr_group *ctrs; }; diff --git a/src/osmo-hnbgw/cnlink.c b/src/osmo-hnbgw/cnlink.c index ae6b266..d02d45b 100644 --- a/src/osmo-hnbgw/cnlink.c +++ b/src/osmo-hnbgw/cnlink.c @@ -20,6 +20,7 @@ #include <osmocom/core/fsm.h> #include <osmocom/core/tdef.h> +#include <osmocom/core/stats.h> #include <osmocom/gsm/gsm23236.h> @@ -34,13 +35,153 @@ #include <osmocom/hnbgw/tdefs.h> #include <osmocom/hnbgw/context_map.h> +static const struct rate_ctr_desc cnlink_ctr_description[] = { + [CNLINK_CTR_RANAP_RX_UDT_RESET] = { + "ranap:rx:udt:reset", + "RANAP Unitdata RESET messages received" + }, + [CNLINK_CTR_RANAP_RX_UDT_RESET_ACK] = { + "ranap:rx:udt:reset_ack", + "RANAP Unitdata RESET ACK messages received", + }, + [CNLINK_CTR_RANAP_RX_UDT_PAGING] = { + "ranap:rx:udt:paging", + "RANAP Unitdata PAGING messages received", + }, + [CNLINK_CTR_RANAP_RX_UDT_UNKNOWN] = { + "ranap:rx:udt:unknown", + "Unknown RANAP Unitdata messages received", + }, + [CNLINK_CTR_RANAP_RX_UDT_UNSUPPORTED] = { + "ranap:rx:udt:unsupported", + "Unsupported RANAP Unitdata messages received", + }, + [CNLINK_CTR_RANAP_RX_UDT_OVERLOAD_IND] = { + "ranap:rx:udt:overload_ind", + "RANAP Unitdata Overload Indications received", + }, + [CNLINK_CTR_RANAP_RX_UDT_ERROR_IND] = { + "ranap:rx:udt:error_ind", + "RANAP Unitdata Error Indications received", + }, + + [CNLINK_CTR_RANAP_TX_UDT_RESET] = { + "ranap:tx:udt:reset", + "RANAP Unitdata RESET messages transmitted", + }, + [CNLINK_CTR_RANAP_TX_UDT_RESET_ACK] = { + "ranap:tx:udt:reset_ack", + "RANAP Unitdata RESET ACK messages transmitted", + }, + + /* SCCP Counters: */ + [CNLINK_CTR_SCCP_N_UNITDATA_REQ] = { + "sccp:n_unit_data:req", + "Submit SCCP N-UNITDATA.req (UL)" + }, + [CNLINK_CTR_SCCP_N_UNITDATA_IND] = { + "sccp:n_unit_data:ind", + "Received SCCP N-UNITDATA.ind (DL)" + }, + [CNLINK_CTR_SCCP_N_CONNECT_REQ] = { + "sccp:n_connect:req", + "Submit SCCP N-CONNECT.req (UL SCCP CR)" + }, + [CNLINK_CTR_SCCP_N_CONNECT_CNF] = { + "sccp:n_connect:cnf", + "Received SCCP N-CONNECT.cnf (DL SCCP CC)" + }, + [CNLINK_CTR_SCCP_N_DATA_REQ] = { + "sccp:n_data:req", + "SUBMIT SCCP N-DATA.req (UL)" + }, + [CNLINK_CTR_SCCP_N_DATA_IND] = { + "sccp:n_data:ind", + "Received SCCP N-DATA.ind (DL)" + }, + [CNLINK_CTR_SCCP_N_DISCONNECT_REQ] = { + "sccp:n_disconnect:req", + "Submit SCCP N-DISCONNECT.req (UL SCCP RLC)" + }, + [CNLINK_CTR_SCCP_N_DISCONNECT_IND] = { + "sccp:n_disconnect:ind", + "Received SCCP N-DISCONNECT.ind (DL SCCP RLSD)" + }, + [CNLINK_CTR_SCCP_N_PCSTATE_IND] = { + "sccp:n_pcstate:ind", + "Received SCCP N-PCSTATE.ind" + }, + [CNLINK_CTR_SCCP_RLSD_CN_ORIGIN] = { + "sccp:rlsd_cn_origin", + "Received unexpected SCCP RSLD originated unilaterally by CN" + }, + + /* Indicators for CN pool usage */ + [CNLINK_CTR_CNPOOL_SUBSCR_NEW] = { + "cnpool:subscr:new", + "Complete Layer 3 requests assigned to this CN link by round-robin (no NRI was assigned yet).", + }, + [CNLINK_CTR_CNPOOL_SUBSCR_REATTACH] = { + "cnpool:subscr:reattach", + "Complete Layer 3 requests assigned to this CN link by round-robin because the subscriber indicates a" + " NULL-NRI (previously assigned by another CN link).", + }, + [CNLINK_CTR_CNPOOL_SUBSCR_KNOWN] = { + "cnpool:subscr:known", + "Complete Layer 3 requests directed to this CN link because the subscriber indicates an NRI of this CN link.", + }, + [CNLINK_CTR_CNPOOL_SUBSCR_PAGED] = { + "cnpool:subscr:paged", + "Paging Response directed to this CN link because the subscriber was recently paged by this CN link.", + }, + [CNLINK_CTR_CNPOOL_SUBSCR_ATTACH_LOST] = { + "cnpool:subscr:attach_lost", + "A subscriber indicates an NRI value matching this CN link, but the CN link is not connected:" + " a re-attach to another CN link (if available) was forced, with possible service failure.", + }, + [CNLINK_CTR_CNPOOL_EMERG_FORWARDED] = { + "cnpool:emerg:forwarded", + "Emergency call requests forwarded to this CN link.", + }, +}; + +static const struct rate_ctr_group_desc msc_ctrg_desc = { + "msc", + "MSC", + OSMO_STATS_CLASS_GLOBAL, + ARRAY_SIZE(cnlink_ctr_description), + cnlink_ctr_description, +}; + +static const struct rate_ctr_group_desc sgsn_ctrg_desc = { + "sgsn", + "SGSN", + OSMO_STATS_CLASS_GLOBAL, + ARRAY_SIZE(cnlink_ctr_description), + cnlink_ctr_description, +}; + struct hnbgw_cnlink *hnbgw_cnlink_alloc(struct hnbgw_cnpool *cnpool, int nr) { struct osmo_fsm_inst *fi; struct hnbgw_cnlink *cnlink; + const struct rate_ctr_group_desc *ctrg_desc; + OSMO_ASSERT(cnpool); char *name = talloc_asprintf(OTC_SELECT, "%s-%d", cnpool->peer_name, nr); + switch (cnpool->domain) { + case DOMAIN_CS: + ctrg_desc = &msc_ctrg_desc; + break; + case DOMAIN_PS: + ctrg_desc = &sgsn_ctrg_desc; + break; + default: + OSMO_ASSERT(0); + } + + fi = osmo_fsm_inst_alloc(&cnlink_fsm, g_hnbgw, NULL, LOGL_DEBUG, name); OSMO_ASSERT(fi); cnlink = talloc_zero(g_hnbgw, struct hnbgw_cnlink); @@ -56,7 +197,7 @@ .nri_ranges = osmo_nri_ranges_alloc(cnlink), }, .allow_attach = true, - .ctrs = rate_ctr_group_alloc(g_hnbgw, cnpool->cnlink_ctrg_desc, nr), + .ctrs = rate_ctr_group_alloc(g_hnbgw, ctrg_desc, nr), }; talloc_steal(cnlink, name); INIT_LLIST_HEAD(&cnlink->map_list); diff --git a/src/osmo-hnbgw/hnbgw_cn.c b/src/osmo-hnbgw/hnbgw_cn.c index e8570a2..a50c52e 100644 --- a/src/osmo-hnbgw/hnbgw_cn.c +++ b/src/osmo-hnbgw/hnbgw_cn.c @@ -418,132 +418,6 @@ return osmo_sccp_inst_addr_to_str_c(OTC_SELECT, sccp, addr); } -static const struct rate_ctr_desc cnlink_ctr_description[] = { - [CNLINK_CTR_RANAP_RX_UDT_RESET] = { - "ranap:rx:udt:reset", - "RANAP Unitdata RESET messages received" - }, - [CNLINK_CTR_RANAP_RX_UDT_RESET_ACK] = { - "ranap:rx:udt:reset_ack", - "RANAP Unitdata RESET ACK messages received", - }, - [CNLINK_CTR_RANAP_RX_UDT_PAGING] = { - "ranap:rx:udt:paging", - "RANAP Unitdata PAGING messages received", - }, - [CNLINK_CTR_RANAP_RX_UDT_UNKNOWN] = { - "ranap:rx:udt:unknown", - "Unknown RANAP Unitdata messages received", - }, - [CNLINK_CTR_RANAP_RX_UDT_UNSUPPORTED] = { - "ranap:rx:udt:unsupported", - "Unsupported RANAP Unitdata messages received", - }, - [CNLINK_CTR_RANAP_RX_UDT_OVERLOAD_IND] = { - "ranap:rx:udt:overload_ind", - "RANAP Unitdata Overload Indications received", - }, - [CNLINK_CTR_RANAP_RX_UDT_ERROR_IND] = { - "ranap:rx:udt:error_ind", - "RANAP Unitdata Error Indications received", - }, - - [CNLINK_CTR_RANAP_TX_UDT_RESET] = { - "ranap:tx:udt:reset", - "RANAP Unitdata RESET messages transmitted", - }, - [CNLINK_CTR_RANAP_TX_UDT_RESET_ACK] = { - "ranap:tx:udt:reset_ack", - "RANAP Unitdata RESET ACK messages transmitted", - }, - - /* SCCP Counters: */ - [CNLINK_CTR_SCCP_N_UNITDATA_REQ] = { - "sccp:n_unit_data:req", - "Submit SCCP N-UNITDATA.req (UL)" - }, - [CNLINK_CTR_SCCP_N_UNITDATA_IND] = { - "sccp:n_unit_data:ind", - "Received SCCP N-UNITDATA.ind (DL)" - }, - [CNLINK_CTR_SCCP_N_CONNECT_REQ] = { - "sccp:n_connect:req", - "Submit SCCP N-CONNECT.req (UL SCCP CR)" - }, - [CNLINK_CTR_SCCP_N_CONNECT_CNF] = { - "sccp:n_connect:cnf", - "Received SCCP N-CONNECT.cnf (DL SCCP CC)" - }, - [CNLINK_CTR_SCCP_N_DATA_REQ] = { - "sccp:n_data:req", - "SUBMIT SCCP N-DATA.req (UL)" - }, - [CNLINK_CTR_SCCP_N_DATA_IND] = { - "sccp:n_data:ind", - "Received SCCP N-DATA.ind (DL)" - }, - [CNLINK_CTR_SCCP_N_DISCONNECT_REQ] = { - "sccp:n_disconnect:req", - "Submit SCCP N-DISCONNECT.req (UL SCCP RLC)" - }, - [CNLINK_CTR_SCCP_N_DISCONNECT_IND] = { - "sccp:n_disconnect:ind", - "Received SCCP N-DISCONNECT.ind (DL SCCP RLSD)" - }, - [CNLINK_CTR_SCCP_N_PCSTATE_IND] = { - "sccp:n_pcstate:ind", - "Received SCCP N-PCSTATE.ind" - }, - [CNLINK_CTR_SCCP_RLSD_CN_ORIGIN] = { - "sccp:rlsd_cn_origin", - "Received unexpected SCCP RSLD originated unilaterally by CN" - }, - - /* Indicators for CN pool usage */ - [CNLINK_CTR_CNPOOL_SUBSCR_NEW] = { - "cnpool:subscr:new", - "Complete Layer 3 requests assigned to this CN link by round-robin (no NRI was assigned yet).", - }, - [CNLINK_CTR_CNPOOL_SUBSCR_REATTACH] = { - "cnpool:subscr:reattach", - "Complete Layer 3 requests assigned to this CN link by round-robin because the subscriber indicates a" - " NULL-NRI (previously assigned by another CN link).", - }, - [CNLINK_CTR_CNPOOL_SUBSCR_KNOWN] = { - "cnpool:subscr:known", - "Complete Layer 3 requests directed to this CN link because the subscriber indicates an NRI of this CN link.", - }, - [CNLINK_CTR_CNPOOL_SUBSCR_PAGED] = { - "cnpool:subscr:paged", - "Paging Response directed to this CN link because the subscriber was recently paged by this CN link.", - }, - [CNLINK_CTR_CNPOOL_SUBSCR_ATTACH_LOST] = { - "cnpool:subscr:attach_lost", - "A subscriber indicates an NRI value matching this CN link, but the CN link is not connected:" - " a re-attach to another CN link (if available) was forced, with possible service failure.", - }, - [CNLINK_CTR_CNPOOL_EMERG_FORWARDED] = { - "cnpool:emerg:forwarded", - "Emergency call requests forwarded to this CN link.", - }, -}; - -const struct rate_ctr_group_desc msc_ctrg_desc = { - "msc", - "MSC", - OSMO_STATS_CLASS_GLOBAL, - ARRAY_SIZE(cnlink_ctr_description), - cnlink_ctr_description, -}; - -const struct rate_ctr_group_desc sgsn_ctrg_desc = { - "sgsn", - "SGSN", - OSMO_STATS_CLASS_GLOBAL, - ARRAY_SIZE(cnlink_ctr_description), - cnlink_ctr_description, -}; - static const struct rate_ctr_desc cnpool_ctr_description[] = { [CNPOOL_CTR_SUBSCR_NO_CNLINK] = { "cnpool:subscr:no_cnlink", @@ -606,14 +480,12 @@ cnpool->pool_name = "iucs"; cnpool->peer_name = "msc"; cnpool->default_remote_pc = DEFAULT_PC_MSC; - cnpool->cnlink_ctrg_desc = &msc_ctrg_desc; cnpool->ctrs = rate_ctr_group_alloc(cnpool, &iucs_ctrg_desc, 0); break; case DOMAIN_PS: cnpool->pool_name = "iups"; cnpool->peer_name = "sgsn"; cnpool->default_remote_pc = DEFAULT_PC_SGSN; - cnpool->cnlink_ctrg_desc = &sgsn_ctrg_desc; cnpool->ctrs = rate_ctr_group_alloc(cnpool, &iups_ctrg_desc, 0); break; default: -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/40265?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Iaa36bb52f8135ef2421931f1ea6a40885b588e1d Gerrit-Change-Number: 40265 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pes...@sysmocom.de>