nat: Switch per BSC counters to the rate ctr.

This is switching the simple statistics to the rate counter
and is updating all users...
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index 431e640..0f50a2b 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -411,7 +411,9 @@
 				counter_inc(nat->stats.sccp.calls);
 
 				if (con) {
-					counter_inc(con->bsc->cfg->stats.sccp.calls);
+					struct rate_ctr_group *ctrg;
+					ctrg = con->bsc->cfg->stats.ctrg;
+					rate_ctr_inc(&ctrg->ctr[BCFG_CTR_SCCP_CALLS]);
 					if (bsc_mgcp_assign(con, msg) != 0)
 						LOGP(DNAT, LOGL_ERROR, "Failed to assign...\n");
 				} else
@@ -639,7 +641,7 @@
 
 	llist_for_each_entry(conf, &bsc->nat->bsc_configs, entry) {
 		if (strcmp(conf->token, token) == 0) {
-			counter_inc(conf->stats.net.reconn);
+			rate_ctr_inc(&conf->stats.ctrg->ctr[BCFG_CTR_NET_RECONN]);
 			bsc->authenticated = 1;
 			bsc->cfg = conf;
 			bsc_del_timer(&bsc->id_timeout);
@@ -1111,6 +1113,8 @@
 	local_addr.s_addr = INADDR_ANY;
 	handle_options(argc, argv);
 
+	rate_ctr_init(tall_bsc_ctx);
+
 	/* init vty and parse */
 	telnet_init(tall_bsc_ctx, NULL, 4244);
 	if (mgcp_parse_config(config_file, nat->mgcp_cfg) < 0) {
diff --git a/openbsc/src/nat/bsc_nat_utils.c b/openbsc/src/nat/bsc_nat_utils.c
index eed7f3a..d211853 100644
--- a/openbsc/src/nat/bsc_nat_utils.c
+++ b/openbsc/src/nat/bsc_nat_utils.c
@@ -38,6 +38,20 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
+
+static const struct rate_ctr_desc bsc_cfg_ctr_description[] = {
+	[BCFG_CTR_SCCP_CONN]     = { "sccp.conn", "SCCP Connections" },
+	[BCFG_CTR_SCCP_CALLS]    = { "sccp.calls", "SCCP Assignment Commands"},
+	[BCFG_CTR_NET_RECONN]    = { "net.reconnects", "Network reconnects"},
+};
+
+static const struct rate_ctr_group_desc bsc_cfg_ctrg_desc = {
+	.group_name_prefix = "nat.bsc",
+	.group_description = "NAT BSC Statistics",
+	.num_ctr = ARRAY_SIZE(bsc_cfg_ctr_description),
+	.ctr_desc = bsc_cfg_ctr_description,
+};
+
 struct bsc_nat *bsc_nat_alloc(void)
 {
 	struct bsc_nat *nat = talloc_zero(tall_bsc_ctx, struct bsc_nat);
@@ -94,9 +108,11 @@
 	llist_add_tail(&conf->entry, &nat->bsc_configs);
 	++nat->num_bsc;
 
-	conf->stats.sccp.conn = counter_alloc("nat.bsc.sccp.conn");
-	conf->stats.sccp.calls = counter_alloc("nat.bsc.sccp.calls");
-	conf->stats.net.reconn = counter_alloc("nat.bsc.net.reconnects");
+	conf->stats.ctrg = rate_ctr_group_alloc(conf, &bsc_cfg_ctrg_desc, conf->lac);
+	if (!conf->stats.ctrg) {
+		talloc_free(conf);
+		return NULL;
+	}
 
 	return conf;
 }
@@ -489,4 +505,4 @@
 
 	llist_add_tail(&entry->list, &lst->fltr_list);
 	return entry;
-}
\ No newline at end of file
+}
diff --git a/openbsc/src/nat/bsc_nat_vty.c b/openbsc/src/nat/bsc_nat_vty.c
index eea5dd8..c09eca4 100644
--- a/openbsc/src/nat/bsc_nat_vty.c
+++ b/openbsc/src/nat/bsc_nat_vty.c
@@ -27,6 +27,7 @@
 #include <openbsc/vty.h>
 
 #include <osmocore/talloc.h>
+#include <osmocore/rate_ctr.h>
 
 #include <sccp/sccp.h>
 
@@ -196,11 +197,7 @@
 
 		vty_out(vty, " BSC lac: %d nr: %d%s",
 			conf->lac, conf->nr, VTY_NEWLINE);
-		vty_out(vty, "   SCCP Connnections %lu total, %lu calls%s",
-			counter_get(conf->stats.sccp.conn),
-			counter_get(conf->stats.sccp.calls), VTY_NEWLINE);
-		vty_out(vty, "   BSC Connections %lu total%s",
-			counter_get(conf->stats.net.reconn), VTY_NEWLINE);
+		vty_out_rate_ctr_group(vty, " ", conf->stats.ctrg);
 	}
 
 	return CMD_SUCCESS;
diff --git a/openbsc/src/nat/bsc_sccp.c b/openbsc/src/nat/bsc_sccp.c
index 94b332a..97a4f12 100644
--- a/openbsc/src/nat/bsc_sccp.c
+++ b/openbsc/src/nat/bsc_sccp.c
@@ -128,7 +128,7 @@
 
 	bsc_mgcp_init(conn);
 	llist_add_tail(&conn->list_entry, &bsc->nat->sccp_connections);
-	counter_inc(bsc->cfg->stats.sccp.conn);
+	rate_ctr_inc(&bsc->cfg->stats.ctrg->ctr[BCFG_CTR_SCCP_CONN]);
 	counter_inc(bsc->cfg->nat->stats.sccp.conn);
 
 	LOGP(DNAT, LOGL_DEBUG, "Created 0x%x <-> 0x%x mapping for con %p\n",