Change in libosmocore[master]: ns2: Increment Rx and Tx byte / packet counters

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Feb 1 08:32:14 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/22558 )

Change subject: ns2: Increment Rx and Tx byte / packet counters
......................................................................

ns2: Increment Rx and Tx byte / packet counters

Change-Id: If5e93f69cddbc8962cbbae38c07b504dd9b1ecd1
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_message.c
2 files changed, 6 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  lynxis lazus: Looks good to me, approved



diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 6be16a2..d3c1e69 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -1053,6 +1053,9 @@
 	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 d97c2a5..cd49896 100644
--- a/src/gb/gprs_ns2_message.c
+++ b/src/gb/gprs_ns2_message.c
@@ -168,6 +168,9 @@
 
 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);
 }
 

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/22558
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If5e93f69cddbc8962cbbae38c07b504dd9b1ecd1
Gerrit-Change-Number: 22558
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210201/2db1c880/attachment.htm>


More information about the gerrit-log mailing list