aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-10-04 15:24:27 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-10-04 15:24:27 +0200
commit1a1aa0c73902b526e09263ab02d48a2e6963e729 (patch)
tree2cb307fd0bc6eb880c56c8d3efa41f63d3db4835
parent2f79ae9b66dba654d77cb4ba76e8019ceb8556b4 (diff)
ctr: Count number of dropped messages
In case of back pressure we can not send messages quick enough and will drop messages. Add a counter so we can count how often this happened per link/linkset. The SCTP M2UA code is not changed as we don't have a link in the hands and adding it is too risky without tests (not all M2UA have a link index so some might not have a link).
-rw-r--r--include/counter.h2
-rw-r--r--src/counter.c2
-rw-r--r--src/link_udp.c3
-rw-r--r--src/sctp_m3ua_client.c3
4 files changed, 10 insertions, 0 deletions
diff --git a/include/counter.h b/include/counter.h
index 781187a..6e5c6bd 100644
--- a/include/counter.h
+++ b/include/counter.h
@@ -29,6 +29,7 @@ enum {
MTP_LSET_SCCP_IN_MSG,
MTP_LSET_IUSP_IN_MSG,
MTP_LSET_TOTA_OUT_MSG,
+ MTP_LSET_TOTA_DRP_MSG,
MTP_LSET_SCCP_OUT_MSG,
MTP_LSET_ISUP_OUT_MSG,
};
@@ -37,6 +38,7 @@ enum {
MTP_LNK_IN,
MTP_LNK_OUT,
MTP_LNK_ERROR,
+ MTP_LNK_DRP,
MTP_LNK_SLTM_TOUT,
};
diff --git a/src/counter.c b/src/counter.c
index cc35557..68c9c31 100644
--- a/src/counter.c
+++ b/src/counter.c
@@ -31,12 +31,14 @@ static const struct rate_ctr_desc mtp_lset_cfg_description[] = {
[MTP_LSET_TOTA_OUT_MSG] = { "total.out", "Total messages out "},
[MTP_LSET_SCCP_OUT_MSG] = { "sccp.out", "SCCP messages out "},
[MTP_LSET_ISUP_OUT_MSG] = { "isup.out", "ISUP messages out "},
+ [MTP_LSET_TOTA_DRP_MSG] = { "total.dropped", "Total dropped msgs "},
};
static const struct rate_ctr_desc mtp_link_cfg_description[] = {
[MTP_LNK_IN] = { "total.in", "Messages in "},
[MTP_LNK_OUT] = { "total.out", "Messages out "},
[MTP_LNK_ERROR] = { "total.error", "Errors occured "},
+ [MTP_LNK_DRP] = { "total.dropped", "Messages dropped "},
[MTP_LNK_SLTM_TOUT] = { "sltm.timeouts", "SLTM timeouts "},
};
diff --git a/src/link_udp.c b/src/link_udp.c
index 13d338f..e1fabc6 100644
--- a/src/link_udp.c
+++ b/src/link_udp.c
@@ -25,6 +25,7 @@
#include <mtp_pcap.h>
#include <snmp_mtp.h>
#include <cellmgr_debug.h>
+#include <counter.h>
#include <osmocom/core/talloc.h>
@@ -216,6 +217,8 @@ static int udp_link_write(struct mtp_link *link, struct msgb *msg)
if (osmo_wqueue_enqueue(&ulnk->data->write_queue, msg) != 0) {
LOGP(DINP, LOGL_ERROR, "Failed to enqueue msg on link %d/%s of %d/%s.\n",
link->nr, link->name, link->set->nr, link->set->name);
+ rate_ctr_inc(&link->ctrg->ctr[MTP_LNK_DRP]);
+ rate_ctr_inc(&link->set->ctrg->ctr[MTP_LSET_TOTA_DRP_MSG]);
msgb_free(msg);
return -1;
}
diff --git a/src/sctp_m3ua_client.c b/src/sctp_m3ua_client.c
index 2211e92..dcc1610 100644
--- a/src/sctp_m3ua_client.c
+++ b/src/sctp_m3ua_client.c
@@ -19,6 +19,7 @@
#include <cellmgr_debug.h>
#include <string.h>
#include <bsc_data.h>
+#include <counter.h>
#include <osmocom/sigtran/xua_msg.h>
#include <osmocom/sigtran/m3ua_types.h>
@@ -129,6 +130,8 @@ static int m3ua_conn_send(struct mtp_m3ua_client_link *link,
if (osmo_wqueue_enqueue(&link->queue, msg) != 0) {
LOGP(DINP, LOGL_ERROR, "Failed to enqueue.\n");
+ rate_ctr_inc(&link->base->ctrg->ctr[MTP_LNK_DRP]);
+ rate_ctr_inc(&link->base->set->ctrg->ctr[MTP_LSET_TOTA_DRP_MSG]);
msgb_free(msg);
return -1;
}