aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-01-30 21:51:15 +0100
committerHarald Welte <laforge@osmocom.org>2021-01-31 12:34:36 +0100
commite5f55f73bd4e2fed1691394bfc30cb4082c21587 (patch)
tree665952653e2b679b38ede771432b73326b7c075d /src
parent5a5bf720a8baeaf4601cb4f8b8250b5b1ba180f4 (diff)
ns2: Increment Rx and Tx byte / packet counters
Diffstat (limited to 'src')
-rw-r--r--src/gb/gprs_ns2.c3
-rw-r--r--src/gb/gprs_ns2_message.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 6be16a22..d3c1e699 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -1053,6 +1053,9 @@ int ns2_recv_vc(struct gprs_ns2_vc *nsvc,
log_set_context(LOG_CTX_GB_NSE, nsvc->nse);
log_set_context(LOG_CTX_GB_NSVC, nsvc);
+ rate_ctr_inc(&nsvc->ctrg->ctr[NS_CTR_PKTS_IN]);
+ rate_ctr_add(&nsvc->ctrg->ctr[NS_CTR_BYTES_IN], msg->len);
+
if (msg->len < sizeof(struct gprs_ns_hdr))
return -EINVAL;
diff --git a/src/gb/gprs_ns2_message.c b/src/gb/gprs_ns2_message.c
index d97c2a56..cd498969 100644
--- a/src/gb/gprs_ns2_message.c
+++ b/src/gb/gprs_ns2_message.c
@@ -168,6 +168,9 @@ int ns2_validate(struct gprs_ns2_vc *nsvc,
static int ns_vc_tx(struct gprs_ns2_vc *nsvc, struct msgb *msg)
{
+ rate_ctr_inc(&nsvc->ctrg->ctr[NS_CTR_PKTS_OUT]);
+ rate_ctr_add(&nsvc->ctrg->ctr[NS_CTR_BYTES_OUT], msgb_length(msg));
+
return nsvc->bind->send_vc(nsvc, msg);
}