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
Sat Jan 30 21:15:36 UTC 2021


laforge has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/58/22558/1

diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 12cda33..35812e4 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: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210130/799eaa60/attachment.htm>


More information about the gerrit-log mailing list