ms: Replace struct var with rate_ctr

Let's use usual osmocom rate_ctr instead of having one variable +
setter/getter functions, so we can easily add new counters and also
because it makes code more clear (no need to look at what the "update"
function is doing).

Using rate counter also provides info about how recently the MS has been
interacting with the network.

Related: OS#4907
Change-Id: I744507fde4291955c1dbbb9739b18a12a80145b1
diff --git a/src/gprs_ms.h b/src/gprs_ms.h
index ade3f3b..6391f72 100644
--- a/src/gprs_ms.h
+++ b/src/gprs_ms.h
@@ -34,6 +34,7 @@
 
 #include <osmocom/core/timer.h>
 #include <osmocom/core/linuxlist.h>
+#include <osmocom/core/rate_ctr.h>
 
 #include <osmocom/gsm/protocol/gsm_23_003.h>
 #include <osmocom/gsm/gsm48.h>
@@ -44,6 +45,10 @@
 #include <stddef.h>
 #include <inttypes.h>
 
+enum ms_counter_id {
+	MS_CTR_DL_CTRL_MSG_SCHED,
+};
+
 struct BTS;
 struct gprs_rlcmac_trx;
 struct GprsMs;
@@ -94,7 +99,7 @@
 	struct gprs_codel *codel_state;
 	enum mcs_kind mode;
 
-	unsigned dl_ctrl_msg;
+	struct rate_ctr_group *ctrs;
 };
 
 struct GprsMs *ms_alloc(struct BTS *bts, uint32_t tlli);
@@ -215,16 +220,6 @@
 	return ms->nack_rate_dl;
 }
 
-static inline unsigned ms_dl_ctrl_msg(const struct GprsMs *ms)
-{
-	return ms->dl_ctrl_msg;
-}
-
-static inline void ms_update_dl_ctrl_msg(struct GprsMs *ms)
-{
-	ms->dl_ctrl_msg++;
-}
-
 static inline uint8_t ms_reserved_dl_slots(const struct GprsMs *ms)
 {
 	return ms->reserved_dl_slots;