diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-05-17 23:30:01 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-05-17 23:30:01 +0200 |
commit | 16c8dbb65577bee5b1350ccce981bde6cd9e6281 (patch) | |
tree | da9a064029d207409d89cd54d6d1d3a86b15cd81 /openbsc | |
parent | a78b9c270bc2082d0a3fa88d6d44b6c777a86799 (diff) |
[GPRS] BSSGP: Introduce packet/byte counters
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/src/gprs/gprs_bssgp.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/openbsc/src/gprs/gprs_bssgp.c b/openbsc/src/gprs/gprs_bssgp.c index b9c3c783..304fb5e2 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); |