summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-11-04 14:39:37 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-11-04 14:39:37 +0100
commit495b0dbd24627a9289e9bdb8ef2f80af6af3445f (patch)
tree454e24f9271537ea211cf3ad41050a9086c54236
parent6e149b1f1aceb86e694e090b5ba4ccb349edcbf2 (diff)
gprs-ns/stats: When the NSVCI is updated, update the stats counter
The NS object is created with an unknown identity and only after the reset procedure has progressed (completed?) we know the real ID for this peer. Before nobody has looked at the idx values (this could have been seen with the CTRL interface) but with statsd the wrong NSVCI becomes obvious. Add routines to update the idx and I don't know if the change of idx is causing any issues but we will find that out soon.
-rw-r--r--include/osmocom/core/rate_ctr.h5
-rw-r--r--include/osmocom/core/stat_item.h6
-rw-r--r--src/gb/gprs_ns.c2
3 files changed, 13 insertions, 0 deletions
diff --git a/include/osmocom/core/rate_ctr.h b/include/osmocom/core/rate_ctr.h
index 03b1bfbe..4fecdfae 100644
--- a/include/osmocom/core/rate_ctr.h
+++ b/include/osmocom/core/rate_ctr.h
@@ -71,6 +71,11 @@ struct rate_ctr_group *rate_ctr_group_alloc(void *ctx,
const struct rate_ctr_group_desc *desc,
unsigned int idx);
+static inline void rate_ctr_group_upd_idx(struct rate_ctr_group *grp, unsigned int idx)
+{
+ grp->idx = idx;
+}
+
void rate_ctr_group_free(struct rate_ctr_group *grp);
void rate_ctr_add(struct rate_ctr *ctr, int inc);
diff --git a/include/osmocom/core/stat_item.h b/include/osmocom/core/stat_item.h
index c2ad8cfd..c1466f8c 100644
--- a/include/osmocom/core/stat_item.h
+++ b/include/osmocom/core/stat_item.h
@@ -70,6 +70,12 @@ struct osmo_stat_item_group *osmo_stat_item_group_alloc(
const struct osmo_stat_item_group_desc *desc,
unsigned int idx);
+static inline void osmo_stat_item_group_udp_idx(
+ struct osmo_stat_item_group *grp, unsigned int idx)
+{
+ grp->idx = idx;
+}
+
void osmo_stat_item_group_free(struct osmo_stat_item_group *statg);
void osmo_stat_item_set(struct osmo_stat_item *item, int32_t value);
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index d0be754d..061fe589 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -886,6 +886,8 @@ static int gprs_ns_rx_reset(struct gprs_nsvc **nsvc, struct msgb *msg)
(*nsvc)->nsei = nsei;
(*nsvc)->nsvci = nsvci;
(*nsvc)->nsvci_is_valid = 1;
+ rate_ctr_group_upd_idx((*nsvc)->ctrg, nsvci);
+ osmo_stat_item_group_udp_idx((*nsvc)->statg, nsvci);
}
/* inform interested parties about the fact that this NSVC