pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/29470 )


Change subject: osmux: Improve per-conn tx rate counters
......................................................................

osmux: Improve per-conn tx rate counters

Change-Id: If030f5d921bdfcfcd00b015b4a9e48bb3b04e721
---
M include/osmocom/mgcp/mgcp_conn.h
M src/libosmo-mgcp/mgcp_osmux.c
2 files changed, 17 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/70/29470/1

diff --git a/include/osmocom/mgcp/mgcp_conn.h b/include/osmocom/mgcp/mgcp_conn.h
index 9ffa7dc..d9b38c0 100644
--- a/include/osmocom/mgcp/mgcp_conn.h
+++ b/include/osmocom/mgcp/mgcp_conn.h
@@ -186,7 +186,9 @@
 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 @@
 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 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."},
diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c
index 790c425..6ae0d8e 100644
--- a/src/libosmo-mgcp/mgcp_osmux.c
+++ b/src/libosmo-mgcp/mgcp_osmux.c
@@ -219,14 +219,14 @@
        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 @@
                /* 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;
 }


--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29470
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: If030f5d921bdfcfcd00b015b4a9e48bb3b04e721
Gerrit-Change-Number: 29470
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to