aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-05-17 23:30:01 +0200
committerHarald Welte <laforge@gnumonks.org>2010-05-17 23:30:01 +0200
commitb1b290862a1f8896157da1b38c64f516d3905357 (patch)
treeb24504569d8c3a7be43650bf12bf1aa05a0c2798
parent5fa2f44fa06a4d7e60fd7ec499e3198e85f500df (diff)
[GPRS] BSSGP: Introduce packet/byte counters
-rw-r--r--openbsc/src/gprs/gprs_bssgp.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/openbsc/src/gprs/gprs_bssgp.c b/openbsc/src/gprs/gprs_bssgp.c
index b9c3c7830..304fb5e21 100644
--- a/openbsc/src/gprs/gprs_bssgp.c
+++ b/openbsc/src/gprs/gprs_bssgp.c
@@ -42,11 +42,19 @@ void *bssgp_tall_ctx = NULL;
#define BVC_F_BLOCKED 0x0001
enum bssgp_ctr {
+ BSSGP_CTR_PKTS_IN,
+ BSSGP_CTR_PKTS_OUT,
+ BSSGP_CTR_BYTES_IN,
+ BSSGP_CTR_BYTES_OUT,
BSSGP_CTR_BLOCKED,
BSSGP_CTR_DISCARDED,
};
static const struct rate_ctr_desc bssgp_ctr_description[] = {
+ { "packets.in", "Packets at BSSGP Level ( In)" },
+ { "packets.out","Packets at BSSGP Level (Out)" },
+ { "bytes.in", "Bytes at BSSGP Level ( In)" },
+ { "bytes.out", "Bytes at BSSGP Level (Out)" },
{ "blocked", "BVC Blocking count" },
{ "discarded", "BVC LLC Discarded count" },
};
@@ -499,6 +507,12 @@ int gprs_bssgp_rcvmsg(struct msgb *msg)
return bssgp_tx_status(BSSGP_CAUSE_UNKNOWN_BVCI, NULL, msg);
}
+ if (bctx) {
+ rate_ctr_inc(&bctx->ctrg->ctr[BSSGP_CTR_PKTS_IN]);
+ rate_ctr_add(&bctx->ctrg->ctr[BSSGP_CTR_BYTES_IN],
+ msgb_bssgp_len(msg));
+ }
+
if (ns_bvci == 1)
rc = gprs_bssgp_rx_sign(msg, &tp, bctx);
else if (ns_bvci == 2)
@@ -562,6 +576,9 @@ int gprs_bssgp_tx_dl_ud(struct msgb *msg)
budh->tlli = htonl(msgb_tlli(msg));
budh->pdu_type = BSSGP_PDUT_DL_UNITDATA;
+ rate_ctr_inc(&bctx->ctrg->ctr[BSSGP_CTR_PKTS_OUT]);
+ rate_ctr_add(&bctx->ctrg->ctr[BSSGP_CTR_BYTES_OUT], msg->len);
+
/* Identifiers down: BVCI, NSEI (in msgb->cb) */
return gprs_ns_sendmsg(bssgp_nsi, msg);