diff options
author | Harald Welte <laforge@osmocom.org> | 2024-03-17 09:42:52 +0100 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2024-03-18 10:09:47 +0100 |
commit | aec0422c8f3693721935a600fbd808bb2bd1216c (patch) | |
tree | 06bff28bc0e21677c9a7b2da074c87987cf202b5 | |
parent | 3c133dc3863415ca86c3e453e664667aea44cf13 (diff) |
common: Add RTP related rate counters
Let's add some rate counters to add visibility to the BTS on what is
happening in terms of received and/or transmitted RTP packets.
This should help during debugging any RTP related issues.
Change-Id: Ide674bde10b0e4b501d6a48947b983090342dfec
-rw-r--r-- | include/osmo-bts/bts.h | 9 | ||||
-rw-r--r-- | src/common/bts.c | 9 | ||||
-rw-r--r-- | src/common/l1sap.c | 21 | ||||
-rw-r--r-- | src/common/lchan.c | 8 |
4 files changed, 43 insertions, 4 deletions
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h index c3e5dcea..8a5fb820 100644 --- a/include/osmo-bts/bts.h +++ b/include/osmo-bts/bts.h @@ -31,6 +31,15 @@ enum { BTS_CTR_AGCH_RCVD, BTS_CTR_AGCH_SENT, BTS_CTR_AGCH_DELETED, + + BTS_CTR_RTP_RX_TOTAL, + BTS_CTR_RTP_RX_MARKER, + BTS_CTR_RTP_RX_DROP_PREEN, + BTS_CTR_RTP_RX_DROP_LOOPBACK, + BTS_CTR_RTP_RX_DROP_OVERFLOW, + BTS_CTR_RTP_RX_DROP_V110_DEC, + BTS_CTR_RTP_TX_TOTAL, + BTS_CTR_RTP_TX_MARKER, }; /* Used by OML layer for BTS Attribute reporting */ diff --git a/src/common/bts.c b/src/common/bts.c index b6b84d1b..56765eca 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -104,6 +104,15 @@ static const struct rate_ctr_desc bts_ctr_desc[] = { [BTS_CTR_AGCH_RCVD] = {"agch:rcvd", "Received AGCH requests (Abis)"}, [BTS_CTR_AGCH_SENT] = {"agch:sent", "Sent AGCH requests (Abis)"}, [BTS_CTR_AGCH_DELETED] = {"agch:delete", "Sent AGCH DELETE IND (Abis)"}, + + [BTS_CTR_RTP_RX_TOTAL] = {"rtp:rx:total", "Total number of received RTP packets"}, + [BTS_CTR_RTP_RX_MARKER] = {"rtp:rx:marker", "Number of received RTP packets with marker bit set"}, + [BTS_CTR_RTP_RX_DROP_PREEN] = {"rtp:rx:drop:preen", "Total number of received RTP packets dropped during preening"}, + [BTS_CTR_RTP_RX_DROP_LOOPBACK] = {"rtp:rx:drop:loopback", "Total number of received RTP packets dropped during loopback"}, + [BTS_CTR_RTP_RX_DROP_OVERFLOW] = {"rtp:rx:drop:overflow", "Total number of received RTP packets dropped during DL queue overflow"}, + [BTS_CTR_RTP_RX_DROP_V110_DEC] = {"rtp:rx:drop:v110_dec", "Total number of received RTP packets dropped during V.110 decode"}, + [BTS_CTR_RTP_TX_TOTAL] = {"rtp:tx:total", "Total number of transmitted RTP packets"}, + [BTS_CTR_RTP_TX_MARKER] = {"rtp:tx:marker", "Number of transmitted RTP packets with marker bit set"}, }; static const struct rate_ctr_group_desc bts_ctrg_desc = { "bts", diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 7cbedd47..5f275cd8 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -1930,6 +1930,7 @@ static void gsmtap_csd_rlp_process(struct gsm_lchan *lchan, bool is_uplink, static void send_ul_rtp_packet_data(struct gsm_lchan *lchan, const struct ph_tch_param *tch_ind, const uint8_t *data, uint16_t data_len) { + struct gsm_bts *bts = lchan->ts->trx->bts; uint8_t rtp_pl[RFC4040_RTP_PLEN]; int rc; @@ -1939,6 +1940,10 @@ static void send_ul_rtp_packet_data(struct gsm_lchan *lchan, const struct ph_tch if (rc < 0) return; + rate_ctr_inc2(bts->ctrs, BTS_CTR_RTP_TX_TOTAL); + if (lchan->rtp_tx_marker) + rate_ctr_inc2(bts->ctrs, BTS_CTR_RTP_TX_MARKER); + osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket, &rtp_pl[0], sizeof(rtp_pl), fn_ms_adj(tch_ind->fn, lchan), @@ -1951,12 +1956,17 @@ static void send_ul_rtp_packet_data(struct gsm_lchan *lchan, const struct ph_tch static void send_ul_rtp_packet_speech(struct gsm_lchan *lchan, uint32_t fn, const uint8_t *rtp_pl, uint16_t rtp_pl_len) { + struct gsm_bts *bts = lchan->ts->trx->bts; + if (lchan->abis_ip.osmux.use) { lchan_osmux_send_frame(lchan, rtp_pl, rtp_pl_len, fn_ms_adj(fn, lchan), lchan->rtp_tx_marker); } else if (lchan->abis_ip.rtp_socket) { osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket, rtp_pl, rtp_pl_len, fn_ms_adj(fn, lchan), lchan->rtp_tx_marker); + rate_ctr_inc2(bts->ctrs, BTS_CTR_RTP_TX_TOTAL); + if (lchan->rtp_tx_marker) + rate_ctr_inc2(bts->ctrs, BTS_CTR_RTP_TX_MARKER); } /* Only clear the marker bit once we have sent a RTP packet with it */ lchan->rtp_tx_marker = false; @@ -2360,17 +2370,25 @@ void l1sap_rtp_rx_cb(struct osmo_rtp_socket *rs, const uint8_t *rtp_pl, uint32_t timestamp, bool marker) { struct gsm_lchan *lchan = rs->priv; + struct gsm_bts *bts = lchan->ts->trx->bts; struct msgb *msg; bool rfc5993_sid = false; + rate_ctr_inc2(bts->ctrs, BTS_CTR_RTP_RX_TOTAL); + if (marker) + rate_ctr_inc2(bts->ctrs, BTS_CTR_RTP_RX_MARKER); + /* if we're in loopback mode, we don't accept frames from the * RTP socket anymore */ - if (lchan->loopback) + if (lchan->loopback) { + rate_ctr_inc2(bts->ctrs, BTS_CTR_RTP_RX_DROP_LOOPBACK); return; + } /* initial preen */ switch (rtp_payload_input_preen(lchan, rtp_pl, rtp_pl_len, &rfc5993_sid)) { case PL_DECISION_DROP: + rate_ctr_inc2(bts->ctrs, BTS_CTR_RTP_RX_DROP_PREEN); return; case PL_DECISION_ACCEPT: break; @@ -2396,6 +2414,7 @@ void l1sap_rtp_rx_cb(struct osmo_rtp_socket *rs, const uint8_t *rtp_pl, gsmtap_csd_rlp_process(lchan, false, &fake_tch_ind, msg->tail, rc); msgb_put(msg, rc); } else { + rate_ctr_inc2(bts->ctrs, BTS_CTR_RTP_RX_DROP_V110_DEC); msgb_free(msg); return; } diff --git a/src/common/lchan.c b/src/common/lchan.c index f4ed5033..5b41a158 100644 --- a/src/common/lchan.c +++ b/src/common/lchan.c @@ -652,9 +652,11 @@ void lchan_rtp_socket_free(struct gsm_lchan *lchan) /*! limit number of queue entries to %u; drops any surplus messages */ void lchan_dl_tch_queue_enqueue(struct gsm_lchan *lchan, struct msgb *msg, unsigned int limit) { - if (lchan->dl_tch_queue_len > limit) - LOGPLCHAN(lchan, DL1P, LOGL_NOTICE, "freeing %d queued frames\n", - lchan->dl_tch_queue_len - limit); + if (lchan->dl_tch_queue_len > limit) { + unsigned int excess = lchan->dl_tch_queue_len - limit; + LOGPLCHAN(lchan, DL1P, LOGL_NOTICE, "freeing %d queued frames\n", excess); + rate_ctr_add2(lchan->ts->trx->bts->ctrs, BTS_CTR_RTP_RX_DROP_OVERFLOW, excess); + } while (lchan->dl_tch_queue_len > limit) { struct msgb *tmp = msgb_dequeue_count(&lchan->dl_tch_queue, &lchan->dl_tch_queue_len); msgb_free(tmp); |