mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-10-23 08:12:01 +00:00
osmux: Improve per-conn tx rate counters
Change-Id: If030f5d921bdfcfcd00b015b4a9e48bb3b04e721
This commit is contained in:
@@ -186,7 +186,9 @@ static const struct rate_ctr_desc all_rtp_conn_rate_ctr_desc[] = {
|
||||
enum {
|
||||
OSMUX_CHUNKS_RX_CTR,
|
||||
OSMUX_OCTETS_RX_CTR,
|
||||
OSMUX_DROPPED_AMR_PAYLOADS_CTR,
|
||||
OSMUX_RTP_PACKETS_TX_CTR,
|
||||
OSMUX_RTP_PACKETS_TX_DROPPED_CTR,
|
||||
OSMUX_AMR_OCTETS_TX_CTR,
|
||||
/* Only available in global stats: */
|
||||
OSMUX_NUM_CONNECTIONS,
|
||||
OSMUX_PACKETS_RX_CTR,
|
||||
@@ -200,7 +202,9 @@ enum {
|
||||
static const struct rate_ctr_desc mgcp_conn_osmux_rate_ctr_desc[] = {
|
||||
[OSMUX_CHUNKS_RX_CTR] = {"osmux:chunks_rx", "Inbound Osmux chunks."},
|
||||
[OSMUX_OCTETS_RX_CTR] = {"osmux:octets_rx", "Inbound Osmux octets."},
|
||||
[OSMUX_DROPPED_AMR_PAYLOADS_CTR] = {"osmux:dropped_amr_payloads", "Dropped outbound AMR payloads."}
|
||||
[OSMUX_RTP_PACKETS_TX_CTR] = {"osmux:rtp_packets_tx", "Tx outbound RTP packets to encode as Osmux."},
|
||||
[OSMUX_RTP_PACKETS_TX_DROPPED_CTR] = {"osmux:rtp_packets_tx_dropped", "Dropped Tx outbound RTP packets to encode as Osmux."},
|
||||
[OSMUX_AMR_OCTETS_TX_CTR] = {"osmux:amr_octets_tx", "Tx outbound AMD payload octets."},
|
||||
};
|
||||
|
||||
/* Aggregated Osmux connection stats. These are updated when an Osmux connection is freed.
|
||||
@@ -208,7 +212,9 @@ static const struct rate_ctr_desc mgcp_conn_osmux_rate_ctr_desc[] = {
|
||||
static const struct rate_ctr_desc all_osmux_conn_rate_ctr_desc[] = {
|
||||
[OSMUX_CHUNKS_RX_CTR] = {"all_osmux:chunks_rx", "Inbound Osmux chunks."},
|
||||
[OSMUX_OCTETS_RX_CTR] = {"all_osmux:octets_rx", "Inbound Osmux octets."},
|
||||
[OSMUX_DROPPED_AMR_PAYLOADS_CTR] = {"all_osmux:dropped_amr_payloads", "Dropped outbound AMR payloads."},
|
||||
[OSMUX_RTP_PACKETS_TX_CTR] = {"all_osmux:rtp_packets_tx", "Tx outbound RTP packets to encode as Osmux."},
|
||||
[OSMUX_RTP_PACKETS_TX_DROPPED_CTR] = {"all_osmux:rtp_packets_tx_dropped", "Dropped Tx outbound RTP packets to encode as Osmux."},
|
||||
[OSMUX_AMR_OCTETS_TX_CTR] = {"all_osmux:amr_octets_tx", "Tx outbound AMD payload octets."},
|
||||
/* These last counters below do not exist in per-connection stats, only here: */
|
||||
[OSMUX_NUM_CONNECTIONS] = {"all_osmux:num_closed_conns", "Total number of osmux connections closed."},
|
||||
[OSMUX_PACKETS_RX_CTR] = {"all_osmux:packets_rx", "Total inbound UDP/Osmux packets."},
|
||||
|
@@ -219,14 +219,14 @@ int osmux_xfrm_to_osmux(char *buf, int buf_len, struct mgcp_conn_rtp *conn)
|
||||
struct msgb *msg;
|
||||
|
||||
if (!conn->end.output_enabled) {
|
||||
rtpconn_osmux_rate_ctr_inc(conn, OSMUX_DROPPED_AMR_PAYLOADS_CTR);
|
||||
rtpconn_osmux_rate_ctr_inc(conn, OSMUX_RTP_PACKETS_TX_DROPPED_CTR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (conn->osmux.state != OSMUX_STATE_ENABLED) {
|
||||
LOGPCONN(conn->conn, DOSMUX, LOGL_INFO, "forwarding RTP to Osmux conn not yet enabled, dropping (cid=%d)\n",
|
||||
conn->osmux.remote_cid);
|
||||
rtpconn_osmux_rate_ctr_inc(conn, OSMUX_DROPPED_AMR_PAYLOADS_CTR);
|
||||
rtpconn_osmux_rate_ctr_inc(conn, OSMUX_RTP_PACKETS_TX_DROPPED_CTR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -241,6 +241,12 @@ int osmux_xfrm_to_osmux(char *buf, int buf_len, struct mgcp_conn_rtp *conn)
|
||||
/* batch full, build and deliver it */
|
||||
osmux_xfrm_input_deliver(conn->osmux.in);
|
||||
}
|
||||
if (ret < 0) {
|
||||
rtpconn_osmux_rate_ctr_inc(conn, OSMUX_RTP_PACKETS_TX_DROPPED_CTR);
|
||||
} else {
|
||||
rtpconn_osmux_rate_ctr_inc(conn, OSMUX_RTP_PACKETS_TX_CTR);
|
||||
rtpconn_osmux_rate_ctr_add(conn, OSMUX_AMR_OCTETS_TX_CTR, buf_len - sizeof(struct rtp_hdr));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user