lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

September 2022

  • 2 participants
  • 1860 discussions
Change in osmo-mgw[master]: Use bool type instead of int in config field
by pespin 23 Sep '22

23 Sep '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29463 ) Change subject: Use bool type instead of int in config field ...................................................................... Use bool type instead of int in config field Change-Id: Ie2624a6a6848c3c88deb39760317860d8074acb9 --- M include/osmocom/mgcp/mgcp.h M src/libosmo-mgcp/mgcp_osmux.c 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/63/29463/1 diff --git a/include/osmocom/mgcp/mgcp.h b/include/osmocom/mgcp/mgcp.h index ee419ef..c707f07 100644 --- a/include/osmocom/mgcp/mgcp.h +++ b/include/osmocom/mgcp/mgcp.h @@ -164,7 +164,7 @@ /* The BSC-NAT may ask for enabling osmux on demand. This tells us if * the osmux socket is already initialized. */ - int osmux_init; + bool osmux_init; /* osmux batch factor: from 1 to 4 maximum */ int osmux_batch; /* osmux batch size (in bytes) */ diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index 06dc705..83a96fe 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -463,7 +463,7 @@ osmo_sock_get_name2(osmux_fd.fd)); return ret; } - cfg->osmux_init = 1; + cfg->osmux_init = true; LOGP(DOSMUX, LOGL_INFO, "OSMUX socket listening on %s\n", osmo_sock_get_name2(osmux_fd.fd)); -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29463 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Ie2624a6a6848c3c88deb39760317860d8074acb9 Gerrit-Change-Number: 29463 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-mgw[master]: osmux: Rename field osmux usage policy and define it with proper type
by pespin 23 Sep '22

23 Sep '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29462 ) Change subject: osmux: Rename field osmux usage policy and define it with proper type ...................................................................... osmux: Rename field osmux usage policy and define it with proper type Change-Id: I7f41a443f488b75df792597ec3cec8f7e97a7411 --- M include/osmocom/mgcp/mgcp.h M include/osmocom/mgcp/osmux.h M src/libosmo-mgcp/mgcp_osmux.c M src/libosmo-mgcp/mgcp_protocol.c M src/libosmo-mgcp/mgcp_stat.c M src/libosmo-mgcp/mgcp_vty.c 6 files changed, 18 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/62/29462/1 diff --git a/include/osmocom/mgcp/mgcp.h b/include/osmocom/mgcp/mgcp.h index f1e6460..ee419ef 100644 --- a/include/osmocom/mgcp/mgcp.h +++ b/include/osmocom/mgcp/mgcp.h @@ -29,6 +29,7 @@ #include <osmocom/core/logging.h> #include <osmocom/mgcp/mgcp_common.h> +#include <osmocom/mgcp/osmux.h> #include <arpa/inet.h> #include <sys/types.h> @@ -156,8 +157,8 @@ enum mgcp_role role; - /* osmux translator: 0 means disabled, 1 means enabled */ - int osmux; + /* Osmux usage policy: */ + enum osmux_usage osmux_use; /* addr to bind the server to */ char osmux_addr[INET6_ADDRSTRLEN]; /* The BSC-NAT may ask for enabling osmux on demand. This tells us if diff --git a/include/osmocom/mgcp/osmux.h b/include/osmocom/mgcp/osmux.h index 736025b..26c1bdf 100644 --- a/include/osmocom/mgcp/osmux.h +++ b/include/osmocom/mgcp/osmux.h @@ -9,6 +9,10 @@ OSMUX_ROLE_BSC_NAT, }; +struct mgcp_trunk; +struct mgcp_endpoint; +struct mgcp_conn_rtp; + int osmux_init(int role, struct mgcp_trunk *trunk); int osmux_enable_conn(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn, const struct osmo_sockaddr *addr); diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index 5647348..06dc705 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -394,7 +394,7 @@ rate_ctr_inc(rate_ctr_group_get_ctr(all_rtp_stats, OSMUX_PACKETS_RX_CTR)); - if (!trunk->cfg->osmux) { + if (trunk->cfg->osmux_use == OSMUX_USAGE_OFF) { LOGP(DOSMUX, LOGL_ERROR, "bsc-nat wants to use Osmux but bsc did not request it\n"); goto out; diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c index 74ed871..7f31cfd 100644 --- a/src/libosmo-mgcp/mgcp_protocol.c +++ b/src/libosmo-mgcp/mgcp_protocol.c @@ -893,7 +893,7 @@ case 'X': if (strncasecmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) { /* If osmux is disabled, just skip setting it up */ - if (!rq->endp->trunk->cfg->osmux) + if (rq->endp->trunk->cfg->osmux_use == OSMUX_USAGE_OFF) break; osmux_cid = mgcp_osmux_setup(endp, line); break; @@ -1007,7 +1007,7 @@ rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_FAIL_NO_OSMUX)); goto error2; } - } else if (endp->trunk->cfg->osmux == OSMUX_USAGE_ONLY) { + } else if (endp->trunk->cfg->osmux_use == OSMUX_USAGE_ONLY) { LOGPCONN(_conn, DLMGCP, LOGL_ERROR, "CRCX: osmux only and no osmux offered\n"); rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_FAIL_NO_OSMUX)); @@ -1174,7 +1174,7 @@ case 'X': if (strncasecmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) { /* If osmux is disabled, just skip setting it up */ - if (!endp->trunk->cfg->osmux) + if (endp->trunk->cfg->osmux_use == OSMUX_USAGE_OFF) break; osmux_cid = mgcp_osmux_setup(endp, line); break; diff --git a/src/libosmo-mgcp/mgcp_stat.c b/src/libosmo-mgcp/mgcp_stat.c index e63feac..acc9419 100644 --- a/src/libosmo-mgcp/mgcp_stat.c +++ b/src/libosmo-mgcp/mgcp_stat.c @@ -99,7 +99,7 @@ str += nchars; str_len -= nchars; - if (conn->conn->endp->trunk->cfg->osmux != OSMUX_USAGE_OFF) { + if (conn->conn->endp->trunk->cfg->osmux_use != OSMUX_USAGE_OFF) { /* Error Counter */ nchars = snprintf(str, str_len, "\r\nX-Osmo-CP: EC TI=%" PRIu64 ", TO=%" PRIu64, diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c index 5abbf0e..34c2d4b 100644 --- a/src/libosmo-mgcp/mgcp_vty.c +++ b/src/libosmo-mgcp/mgcp_vty.c @@ -129,7 +129,7 @@ vty_out(vty, " rtp force-ptime %d%s", g_cfg->force_ptime, VTY_NEWLINE); - switch (g_cfg->osmux) { + switch (g_cfg->osmux_use) { case OSMUX_USAGE_ON: vty_out(vty, " osmux on%s", VTY_NEWLINE); break; @@ -141,7 +141,7 @@ vty_out(vty, " osmux off%s", VTY_NEWLINE); break; } - if (g_cfg->osmux) { + if (g_cfg->osmux_use != OSMUX_USAGE_OFF) { vty_out(vty, " osmux bind-ip %s%s", g_cfg->osmux_addr, VTY_NEWLINE); vty_out(vty, " osmux batch-factor %d%s", @@ -350,7 +350,7 @@ llist_for_each_entry(trunk, &g_cfg->trunks, entry) dump_trunk(vty, trunk, show_stats, active_only); - if (g_cfg->osmux) + if (g_cfg->osmux_use != OSMUX_USAGE_OFF) vty_out(vty, "Osmux used CID: %d%s", osmux_cid_pool_count_used(), VTY_NEWLINE); @@ -1547,12 +1547,12 @@ OSMO_ASSERT(trunk); if (strcmp(argv[0], "off") == 0) { - g_cfg->osmux = OSMUX_USAGE_OFF; + g_cfg->osmux_use = OSMUX_USAGE_OFF; return CMD_SUCCESS; } else if (strcmp(argv[0], "on") == 0) - g_cfg->osmux = OSMUX_USAGE_ON; + g_cfg->osmux_use = OSMUX_USAGE_ON; else if (strcmp(argv[0], "only") == 0) - g_cfg->osmux = OSMUX_USAGE_ONLY; + g_cfg->osmux_use = OSMUX_USAGE_ONLY; return CMD_SUCCESS; -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29462 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I7f41a443f488b75df792597ec3cec8f7e97a7411 Gerrit-Change-Number: 29462 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-mgw[master]: cosmetic: osmux: Fix formatting of if-else brackets
by pespin 23 Sep '22

23 Sep '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29461 ) Change subject: cosmetic: osmux: Fix formatting of if-else brackets ...................................................................... cosmetic: osmux: Fix formatting of if-else brackets Change-Id: I748d41cd110841ef121f70560e70c07de56aa9da --- M src/libosmo-mgcp/mgcp_osmux.c 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index 5ba48e8..5647348 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -598,8 +598,9 @@ "no available Osmux CID to allocate!\n"); return -1; } - } else + } else { osmux_cid_pool_get(osmux_cid); + } conn->osmux.cid = (uint8_t) osmux_cid; conn->osmux.cid_allocated = true; -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29461 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I748d41cd110841ef121f70560e70c07de56aa9da Gerrit-Change-Number: 29461 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-mgw[master]: osmux: Add connection and global rate counters
by pespin 23 Sep '22

23 Sep '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29459 ) Change subject: osmux: Add connection and global rate counters ...................................................................... osmux: Add connection and global rate counters Change-Id: I200a4aa3908cac0ec729d980a66f3df7f55e4da7 --- M include/osmocom/mgcp/mgcp_conn.h M include/osmocom/mgcp/mgcp_network.h M include/osmocom/mgcp/mgcp_ratectr.h M src/libosmo-mgcp/mgcp_network.c M src/libosmo-mgcp/mgcp_osmux.c M src/libosmo-mgcp/mgcp_ratectr.c M src/libosmo-mgcp/mgcp_stat.c M src/libosmo-mgcp/mgcp_vty.c 8 files changed, 112 insertions(+), 17 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve daniel: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/include/osmocom/mgcp/mgcp_conn.h b/include/osmocom/mgcp/mgcp_conn.h index ce864b8..14ddfbb 100644 --- a/include/osmocom/mgcp/mgcp_conn.h +++ b/include/osmocom/mgcp/mgcp_conn.h @@ -88,11 +88,8 @@ struct osmux_in_handle *in; /* handle to unbatch messages, one allocated and owned per conn */ struct osmux_out_handle *out; - /* statistics */ - struct { - uint32_t chunks; - uint32_t octets; - } stats; + /* statistics: */ + struct rate_ctr_group *ctrg; } osmux; struct { @@ -181,6 +178,40 @@ [RTP_NUM_CONNECTIONS] = {"all_rtp:num_closed_conns", "Total number of rtp connections closed."} }; +/* Osmux connection related counters */ +enum { + OSMUX_CHUNKS_RX_CTR, + OSMUX_OCTETS_RX_CTR, + OSMUX_DROPPED_AMR_PAYLOADS_CTR, + /* Only available in global stats: */ + OSMUX_NUM_CONNECTIONS, + OSMUX_PACKETS_RX_CTR, + OSMUX_PACKETS_TX_CTR, + OSMUX_DROPPED_PACKETS_CTR, +}; + +/* RTP per-connection statistics. Instances of the corresponding rate counter group + * exist for the lifetime of an RTP connection. + * Must be kept in sync with all_rtp_conn_rate_ctr_desc below */ +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."} +}; + +/* Aggregated Osmux connection stats. These are updated when an Osmux connection is freed. + * Must be kept in sync with mgcp_conn_osmux_rate_ctr_desc above */ +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."}, + /* 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."}, + [OSMUX_PACKETS_TX_CTR] = {"all_osmux:packets_tx", "Total outbound UDP/Osmux packets."}, + [OSMUX_DROPPED_PACKETS_CTR] = {"all_osmux:dropped_packets", "Dropped outbound UDP/Osmux packets."} +}; + /* Was conn configured to handle Osmux? */ static inline bool mgcp_conn_rtp_is_osmux(const struct mgcp_conn_rtp *conn) { return conn->type == MGCP_OSMUX_BSC || conn->type == MGCP_OSMUX_BSC_NAT; diff --git a/include/osmocom/mgcp/mgcp_network.h b/include/osmocom/mgcp/mgcp_network.h index 9c075b0..5668711 100644 --- a/include/osmocom/mgcp/mgcp_network.h +++ b/include/osmocom/mgcp/mgcp_network.h @@ -178,5 +178,7 @@ void rtpconn_rate_ctr_add(struct mgcp_conn_rtp *conn_rtp, struct mgcp_endpoint *endp, int id, int inc); +void rtpconn_rate_ctr_inc(struct mgcp_conn_rtp *conn_rtp, struct mgcp_endpoint *endp, + int id); void forward_data_tap(int fd, struct mgcp_rtp_tap *tap, struct msgb *msg); uint32_t mgcp_get_current_ts(unsigned codec_rate); diff --git a/include/osmocom/mgcp/mgcp_ratectr.h b/include/osmocom/mgcp/mgcp_ratectr.h index c03c4e1..f566625 100644 --- a/include/osmocom/mgcp/mgcp_ratectr.h +++ b/include/osmocom/mgcp/mgcp_ratectr.h @@ -80,6 +80,8 @@ struct rate_ctr_group *mgcp_dlcx_ctr_group; /* Rate counter group which aggregates stats of individual RTP connections. */ struct rate_ctr_group *all_rtp_conn_stats; + /* Rate counter group which aggregates stats of individual Osmux connections. */ + struct rate_ctr_group *all_osmux_conn_stats; /* Rate counter group which contains stats for E1 events (only valid for E1 trunks) */ struct rate_ctr_group *e1_stats; }; diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c index dfbe4d3..d492563 100644 --- a/src/libosmo-mgcp/mgcp_network.c +++ b/src/libosmo-mgcp/mgcp_network.c @@ -70,7 +70,7 @@ rate_ctr_add(rate_ctr_group_get_ctr(mgw_stats, id), inc); } -static void rtpconn_rate_ctr_inc(struct mgcp_conn_rtp *conn_rtp, struct mgcp_endpoint *endp, int id) +void rtpconn_rate_ctr_inc(struct mgcp_conn_rtp *conn_rtp, struct mgcp_endpoint *endp, int id) { rtpconn_rate_ctr_add(conn_rtp, endp, id, 1); } diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index 4ad3f10..5ba48e8 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -41,12 +41,22 @@ int refcnt; }; +static const struct rate_ctr_group_desc rate_ctr_group_osmux_desc = { + .group_name_prefix = "conn_osmux", + .group_description = "Osmux connection statistics", + .class_id = 1, + .num_ctr = ARRAY_SIZE(mgcp_conn_osmux_rate_ctr_desc), + .ctr_desc = mgcp_conn_osmux_rate_ctr_desc +}; + /* Deliver OSMUX batch to the remote end */ static void osmux_deliver_cb(struct msgb *batch_msg, void *data) { struct osmux_handle *handle = data; socklen_t dest_len; int rc; + struct mgcp_trunk *trunk = (struct mgcp_trunk *)osmux_fd.data; + struct rate_ctr_group *all_osmux_stats = trunk->ratectr.all_osmux_conn_stats; switch (handle->rem_addr.u.sa.sa_family) { case AF_INET6: @@ -64,6 +74,9 @@ strerror_r(errno, errbuf, sizeof(errbuf)); LOGP(DOSMUX, LOGL_NOTICE, "osmux sendto(%s) failed: %s\n", osmo_sockaddr_to_str(&handle->rem_addr), errbuf); + rate_ctr_inc(rate_ctr_group_get_ctr(all_osmux_stats, OSMUX_DROPPED_PACKETS_CTR)); + } else { + rate_ctr_inc(rate_ctr_group_get_ctr(all_osmux_stats, OSMUX_PACKETS_TX_CTR)); } msgb_free(batch_msg); } @@ -190,12 +203,15 @@ int ret; struct msgb *msg; - if (!conn->end.output_enabled) + if (!conn->end.output_enabled) { + rtpconn_rate_ctr_inc(conn, conn->conn->endp, OSMUX_DROPPED_AMR_PAYLOADS_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.cid); + rtpconn_rate_ctr_inc(conn, conn->conn->endp, OSMUX_DROPPED_AMR_PAYLOADS_CTR); return -1; } @@ -368,14 +384,16 @@ struct msgb *msg; struct osmux_hdr *osmuxh; struct osmo_sockaddr rem_addr; - struct mgcp_trunk *trunk = ofd->data; uint32_t rem; - struct mgcp_conn_rtp *conn_src; + struct mgcp_trunk *trunk = ofd->data; + struct rate_ctr_group *all_rtp_stats = trunk->ratectr.all_osmux_conn_stats; msg = osmux_recv(ofd, &rem_addr); if (!msg) return -1; + rate_ctr_inc(rate_ctr_group_get_ctr(all_rtp_stats, OSMUX_PACKETS_RX_CTR)); + if (!trunk->cfg->osmux) { LOGP(DOSMUX, LOGL_ERROR, "bsc-nat wants to use Osmux but bsc did not request it\n"); @@ -388,7 +406,8 @@ rem = msg->len; while((osmuxh = osmux_xfrm_output_pull(msg)) != NULL) { - + struct mgcp_endpoint *endp; + struct mgcp_conn_rtp *conn_src; conn_src = osmux_conn_lookup(trunk, osmuxh->circuit_id, &rem_addr); if (!conn_src) { @@ -397,7 +416,7 @@ osmuxh->circuit_id); goto out; } - + endp = conn_src->conn->endp; mgcp_conn_watchdog_kick(conn_src->conn); /*conn_dst = mgcp_find_dst_conn(conn_src->conn); @@ -407,10 +426,10 @@ osmuxh->circuit_id); goto out; }*/ - - if (endp_osmux_state_check(conn_src->conn->endp, conn_src, false) == 0) { - conn_src->osmux.stats.octets += osmux_chunk_length(msg, rem); - conn_src->osmux.stats.chunks++; + if (endp_osmux_state_check(endp, conn_src, false) == 0) { + rtpconn_rate_ctr_inc(conn_src, endp, OSMUX_CHUNKS_RX_CTR); + rtpconn_rate_ctr_add(conn_src, endp, OSMUX_OCTETS_RX_CTR, + osmux_chunk_length(msg, rem)); osmux_xfrm_output_sched(conn_src->osmux.out, osmuxh); } rem = msg->len; @@ -513,6 +532,8 @@ osmux_xfrm_output_set_tx_cb(conn->osmux.out, scheduled_from_osmux_tx_rtp_cb, conn); + conn->osmux.ctrg = rate_ctr_group_alloc(conn->conn, &rate_ctr_group_osmux_desc, conn->ctrg->idx); + conn->osmux.state = OSMUX_STATE_ENABLED; return 0; @@ -528,6 +549,9 @@ LOGPCONN(conn->conn, DOSMUX, LOGL_INFO, "Releasing connection using Osmux CID %u\n", conn->osmux.cid); + struct rate_ctr_group *all_osmux_stats = conn->conn->endp->trunk->ratectr.all_osmux_conn_stats; + rate_ctr_inc(rate_ctr_group_get_ctr(all_osmux_stats, OSMUX_NUM_CONNECTIONS)); + if (conn->osmux.state == OSMUX_STATE_ENABLED) { /* We are closing, we don't need pending RTP packets to be transmitted */ osmux_xfrm_output_set_tx_cb(conn->osmux.out, NULL, NULL); @@ -536,6 +560,9 @@ osmux_xfrm_input_close_circuit(conn->osmux.in, conn->osmux.cid); conn->osmux.state = OSMUX_STATE_DISABLED; osmux_handle_put(conn->osmux.in); + + rate_ctr_group_free(conn->osmux.ctrg); + conn->osmux.ctrg = NULL; } conn_osmux_release_cid(conn); } diff --git a/src/libosmo-mgcp/mgcp_ratectr.c b/src/libosmo-mgcp/mgcp_ratectr.c index bc6aa3c..bf3d9d3 100644 --- a/src/libosmo-mgcp/mgcp_ratectr.c +++ b/src/libosmo-mgcp/mgcp_ratectr.c @@ -146,6 +146,14 @@ .ctr_desc = all_rtp_conn_rate_ctr_desc }; +static const struct rate_ctr_group_desc all_osmux_conn_rate_ctr_group_desc = { + .group_name_prefix = "all_osmux_conn", + .group_description = "aggregated statistics for all osmux connections", + .class_id = 1, + .num_ctr = ARRAY_SIZE(all_osmux_conn_rate_ctr_desc), + .ctr_desc = all_rtp_conn_rate_ctr_desc +}; + /*! allocate global rate counters * (called once at startup). * \param[in] cfg mgw configuration for which the rate counters are allocated. @@ -191,6 +199,7 @@ static atomic_uint mdcx_rate_ctr_index = 0; static atomic_uint dlcx_rate_ctr_index = 0; static atomic_uint all_rtp_conn_rate_ctr_index = 0; + static atomic_uint all_osmux_conn_rate_ctr_index = 0; char ctr_name[256]; if (ratectr->mgcp_crcx_ctr_group == NULL) { @@ -229,6 +238,15 @@ trunk->trunk_nr); rate_ctr_group_set_name(ratectr->all_rtp_conn_stats, ctr_name); } + if (ratectr->all_osmux_conn_stats == NULL) { + ratectr->all_osmux_conn_stats = rate_ctr_group_alloc(trunk, &all_osmux_conn_rate_ctr_group_desc, + all_osmux_conn_rate_ctr_index++); + if (!ratectr->all_osmux_conn_stats) + return -EINVAL; + snprintf(ctr_name, sizeof(ctr_name), "%s-%u:osmux_conn", mgcp_trunk_type_strs_str(trunk->trunk_type), + trunk->trunk_nr); + rate_ctr_group_set_name(ratectr->all_osmux_conn_stats, ctr_name); + } /* E1 specific */ if (trunk->trunk_type == MGCP_TRUNK_E1 && ratectr->e1_stats == NULL) { @@ -265,6 +283,10 @@ rate_ctr_group_free(ratectr->all_rtp_conn_stats); ratectr->all_rtp_conn_stats = NULL; } + if (ratectr->all_osmux_conn_stats) { + rate_ctr_group_free(ratectr->all_osmux_conn_stats); + ratectr->all_osmux_conn_stats = NULL; + } /* E1 specific */ if (ratectr->e1_stats) { diff --git a/src/libosmo-mgcp/mgcp_stat.c b/src/libosmo-mgcp/mgcp_stat.c index d134526..e63feac 100644 --- a/src/libosmo-mgcp/mgcp_stat.c +++ b/src/libosmo-mgcp/mgcp_stat.c @@ -112,9 +112,12 @@ str_len -= nchars; if (conn->osmux.state == OSMUX_STATE_ENABLED) { + struct rate_ctr *osmux_chunks_rx, *osmux_octets_rx; + osmux_chunks_rx = rate_ctr_group_get_ctr(conn->ctrg, OSMUX_CHUNKS_RX_CTR); + osmux_octets_rx = rate_ctr_group_get_ctr(conn->ctrg, OSMUX_OCTETS_RX_CTR); snprintf(str, str_len, - "\r\nX-Osmux-ST: CR=%u, BR=%u", - conn->osmux.stats.chunks, conn->osmux.stats.octets); + "\r\nX-Osmux-ST: CR=%" PRIu64 ", BR=%" PRIu64, + osmux_chunks_rx->current, osmux_octets_rx->current); } } diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c index 6183867..5abbf0e 100644 --- a/src/libosmo-mgcp/mgcp_vty.c +++ b/src/libosmo-mgcp/mgcp_vty.c @@ -289,6 +289,14 @@ " %25n: %10c (%S/s %M/m %H/h %D/d) %d", ratectr->all_rtp_conn_stats); } + if (ratectr->all_osmux_conn_stats) { + vty_out(vty, " %s:%s", + ratectr->all_osmux_conn_stats->desc->group_description, + VTY_NEWLINE); + vty_out_rate_ctr_group_fmt(vty, + " %25n: %10c (%S/s %M/m %H/h %D/d) %d", + ratectr->all_osmux_conn_stats); + } if (ratectr->e1_stats && trunk->trunk_type == MGCP_TRUNK_E1) { vty_out(vty, " %s:%s", -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29459 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I200a4aa3908cac0ec729d980a66f3df7f55e4da7 Gerrit-Change-Number: 29459 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-mgw[master]: Use 'static const' instead of 'const static' everywhere
by pespin 23 Sep '22

23 Sep '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29460 ) Change subject: Use 'static const' instead of 'const static' everywhere ...................................................................... Use 'static const' instead of 'const static' everywhere As requested by the linter on a new patch being submitted. Change-Id: I692624da6a1c7f59ac2989509f074cb52d089907 --- M src/libosmo-mgcp/mgcp_conn.c M src/libosmo-mgcp/mgcp_ratectr.c 2 files changed, 7 insertions(+), 7 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, approved diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c index 7ab6eca..d963a56 100644 --- a/src/libosmo-mgcp/mgcp_conn.c +++ b/src/libosmo-mgcp/mgcp_conn.c @@ -37,7 +37,7 @@ #include <osmocom/core/timer.h> #include <ctype.h> -const static struct rate_ctr_group_desc rate_ctr_group_desc = { +static const struct rate_ctr_group_desc rate_ctr_group_desc = { .group_name_prefix = "conn_rtp", .group_description = "rtp connection statistics", .class_id = 1, diff --git a/src/libosmo-mgcp/mgcp_ratectr.c b/src/libosmo-mgcp/mgcp_ratectr.c index 6030ce2..bc6aa3c 100644 --- a/src/libosmo-mgcp/mgcp_ratectr.c +++ b/src/libosmo-mgcp/mgcp_ratectr.c @@ -43,7 +43,7 @@ { "mgcp:err_rx_no_endpoint", "can't find MGCP endpoint, probably we've used all allocated endpoints." }, }; -const static struct rate_ctr_group_desc mgcp_general_ctr_group_desc = { +static const struct rate_ctr_group_desc mgcp_general_ctr_group_desc = { .group_name_prefix = "mgcp", .group_description = "mgcp general statistics", .class_id = OSMO_STATS_CLASS_GLOBAL, @@ -71,7 +71,7 @@ [MGCP_CRCX_FAIL_CLAIM] = { "crcx:claim", "endpoint can not be claimed." }, }; -const static struct rate_ctr_group_desc mgcp_crcx_ctr_group_desc = { +static const struct rate_ctr_group_desc mgcp_crcx_ctr_group_desc = { .group_name_prefix = "crcx", .group_description = "crxc statistics", .class_id = OSMO_STATS_CLASS_GLOBAL, @@ -97,7 +97,7 @@ [MGCP_MDCX_FAIL_AVAIL] = { "mdcx:unavailable", "endpoint unavailable." }, }; -const static struct rate_ctr_group_desc mgcp_mdcx_ctr_group_desc = { +static const struct rate_ctr_group_desc mgcp_mdcx_ctr_group_desc = { .group_name_prefix = "mdcx", .group_description = "mdcx statistics", .class_id = OSMO_STATS_CLASS_GLOBAL, @@ -116,7 +116,7 @@ [MGCP_DLCX_FAIL_AVAIL] = { "dlcx:unavailable", "endpoint unavailable." }, }; -const static struct rate_ctr_group_desc mgcp_dlcx_ctr_group_desc = { +static const struct rate_ctr_group_desc mgcp_dlcx_ctr_group_desc = { .group_name_prefix = "dlcx", .group_description = "dlcx statistics", .class_id = OSMO_STATS_CLASS_GLOBAL, @@ -130,7 +130,7 @@ [E1_I460_TRAU_MUX_EMPTY_CTR] = { "e1:i460", "Outbound I.460 MUX queue empty." } }; -const static struct rate_ctr_group_desc e1_rate_ctr_group_desc = { +static const struct rate_ctr_group_desc e1_rate_ctr_group_desc = { .group_name_prefix = "e1", .group_description = "e1 statistics", .class_id = OSMO_STATS_CLASS_GLOBAL, @@ -138,7 +138,7 @@ .ctr_desc = e1_rate_ctr_desc }; -const static struct rate_ctr_group_desc all_rtp_conn_rate_ctr_group_desc = { +static const struct rate_ctr_group_desc all_rtp_conn_rate_ctr_group_desc = { .group_name_prefix = "all_rtp_conn", .group_description = "aggregated statistics for all rtp connections", .class_id = 1, -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29460 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I692624da6a1c7f59ac2989509f074cb52d089907 Gerrit-Change-Number: 29460 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-mgw[master]: mgcp_conn: rename field s/rate_ctr_group/ctrg/g
by pespin 23 Sep '22

23 Sep '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29457 ) Change subject: mgcp_conn: rename field s/rate_ctr_group/ctrg/g ...................................................................... mgcp_conn: rename field s/rate_ctr_group/ctrg/g This makes all lines operating on rate groups way shorter. The "ctrg" naming is already used in tons of places in osmocom code. Change-Id: I745eddbf66e7d811bb73c8ae9bb54ea93073c71b --- M include/osmocom/mgcp/mgcp_conn.h M src/libosmo-mgcp/mgcp_conn.c M src/libosmo-mgcp/mgcp_network.c M src/libosmo-mgcp/mgcp_stat.c M src/libosmo-mgcp/mgcp_vty.c M tests/mgcp/mgcp_test.c 6 files changed, 21 insertions(+), 21 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve diff --git a/include/osmocom/mgcp/mgcp_conn.h b/include/osmocom/mgcp/mgcp_conn.h index 5e262c3..ce864b8 100644 --- a/include/osmocom/mgcp/mgcp_conn.h +++ b/include/osmocom/mgcp/mgcp_conn.h @@ -103,7 +103,7 @@ struct osmo_iuup_rnl_prim *init_ind; } iuup; - struct rate_ctr_group *rate_ctr_group; + struct rate_ctr_group *ctrg; }; /*! MGCP connection (untyped) */ diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c index 6dc0199..7ab6eca 100644 --- a/src/libosmo-mgcp/mgcp_conn.c +++ b/src/libosmo-mgcp/mgcp_conn.c @@ -113,12 +113,12 @@ end->output_enabled = false; end->maximum_packet_time = -1; - conn_rtp->rate_ctr_group = rate_ctr_group_alloc(conn, &rate_ctr_group_desc, rate_ctr_index++); - if (!conn_rtp->rate_ctr_group) + conn_rtp->ctrg = rate_ctr_group_alloc(conn, &rate_ctr_group_desc, rate_ctr_index++); + if (!conn_rtp->ctrg) return -1; - conn_rtp->state.in_stream.err_ts_ctr = rate_ctr_group_get_ctr(conn_rtp->rate_ctr_group, IN_STREAM_ERR_TSTMP_CTR); - conn_rtp->state.out_stream.err_ts_ctr = rate_ctr_group_get_ctr(conn_rtp->rate_ctr_group, OUT_STREAM_ERR_TSTMP_CTR); + conn_rtp->state.in_stream.err_ts_ctr = rate_ctr_group_get_ctr(conn_rtp->ctrg, IN_STREAM_ERR_TSTMP_CTR); + conn_rtp->state.out_stream.err_ts_ctr = rate_ctr_group_get_ctr(conn_rtp->ctrg, OUT_STREAM_ERR_TSTMP_CTR); /* Make sure codec table is reset */ mgcp_codec_reset_all(conn_rtp); @@ -134,7 +134,7 @@ if (mgcp_conn_rtp_is_iuup(conn_rtp)) mgcp_conn_iuup_cleanup(conn_rtp); mgcp_free_rtp_port(&conn_rtp->end); - rate_ctr_group_free(conn_rtp->rate_ctr_group); + rate_ctr_group_free(conn_rtp->ctrg); mgcp_codec_reset_all(conn_rtp); } @@ -263,7 +263,7 @@ static void aggregate_rtp_conn_stats(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn_rtp) { struct rate_ctr_group *all_stats = endp->trunk->ratectr.all_rtp_conn_stats; - struct rate_ctr_group *conn_stats = conn_rtp->rate_ctr_group; + struct rate_ctr_group *conn_stats = conn_rtp->ctrg; if (all_stats == NULL || conn_stats == NULL) return; diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c index 70193e9..dfbe4d3 100644 --- a/src/libosmo-mgcp/mgcp_network.c +++ b/src/libosmo-mgcp/mgcp_network.c @@ -62,7 +62,7 @@ void rtpconn_rate_ctr_add(struct mgcp_conn_rtp *conn_rtp, struct mgcp_endpoint *endp, int id, int inc) { - struct rate_ctr_group *conn_stats = conn_rtp->rate_ctr_group; + struct rate_ctr_group *conn_stats = conn_rtp->ctrg; struct rate_ctr_group *mgw_stats = endp->trunk->ratectr.all_rtp_conn_stats; /* add to both the per-connection and the global stats */ @@ -1515,8 +1515,8 @@ sizeof(struct sockaddr_in))); /* Increment RX statistics */ - rate_ctr_inc(rate_ctr_group_get_ctr(conn_src->rate_ctr_group, RTP_PACKETS_RX_CTR)); - rate_ctr_add(rate_ctr_group_get_ctr(conn_src->rate_ctr_group, RTP_OCTETS_RX_CTR), msgb_length(msg)); + rate_ctr_inc(rate_ctr_group_get_ctr(conn_src->ctrg, RTP_PACKETS_RX_CTR)); + rate_ctr_add(rate_ctr_group_get_ctr(conn_src->ctrg, RTP_OCTETS_RX_CTR), msgb_length(msg)); /* FIXME: count RTP and RTCP separately, also count IuUP payload-less separately */ /* Forward a copy of the RTP data to a debug ip/port */ diff --git a/src/libosmo-mgcp/mgcp_stat.c b/src/libosmo-mgcp/mgcp_stat.c index e679882..d134526 100644 --- a/src/libosmo-mgcp/mgcp_stat.c +++ b/src/libosmo-mgcp/mgcp_stat.c @@ -39,7 +39,7 @@ void calc_loss(struct mgcp_conn_rtp *conn, uint32_t *expected, int *loss) { struct mgcp_rtp_state *state = &conn->state; - struct rate_ctr *packets_rx = rate_ctr_group_get_ctr(conn->rate_ctr_group, RTP_PACKETS_RX_CTR); + struct rate_ctr *packets_rx = rate_ctr_group_get_ctr(conn->ctrg, RTP_PACKETS_RX_CTR); *expected = state->stats.cycles + state->stats.max_seq; *expected = *expected - state->stats.base_seq + 1; @@ -80,10 +80,10 @@ int ploss; int nchars; - struct rate_ctr *packets_rx = rate_ctr_group_get_ctr(conn->rate_ctr_group, RTP_PACKETS_RX_CTR); - struct rate_ctr *octets_rx = rate_ctr_group_get_ctr(conn->rate_ctr_group, RTP_OCTETS_RX_CTR); - struct rate_ctr *packets_tx = rate_ctr_group_get_ctr(conn->rate_ctr_group, RTP_PACKETS_TX_CTR); - struct rate_ctr *octets_tx = rate_ctr_group_get_ctr(conn->rate_ctr_group, RTP_OCTETS_TX_CTR); + struct rate_ctr *packets_rx = rate_ctr_group_get_ctr(conn->ctrg, RTP_PACKETS_RX_CTR); + struct rate_ctr *octets_rx = rate_ctr_group_get_ctr(conn->ctrg, RTP_OCTETS_RX_CTR); + struct rate_ctr *packets_tx = rate_ctr_group_get_ctr(conn->ctrg, RTP_PACKETS_TX_CTR); + struct rate_ctr *octets_tx = rate_ctr_group_get_ctr(conn->ctrg, RTP_OCTETS_TX_CTR); calc_loss(conn, &expected, &ploss); jitter = calc_jitter(&conn->state); diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c index f6c3c75..6183867 100644 --- a/src/libosmo-mgcp/mgcp_vty.c +++ b/src/libosmo-mgcp/mgcp_vty.c @@ -169,11 +169,11 @@ struct rate_ctr *rx_packets, *rx_bytes; struct rate_ctr *dropped_packets; - tx_packets = rate_ctr_group_get_ctr(conn->rate_ctr_group, RTP_PACKETS_TX_CTR); - tx_bytes = rate_ctr_group_get_ctr(conn->rate_ctr_group, RTP_OCTETS_TX_CTR); - rx_packets = rate_ctr_group_get_ctr(conn->rate_ctr_group, RTP_PACKETS_RX_CTR); - rx_bytes = rate_ctr_group_get_ctr(conn->rate_ctr_group, RTP_OCTETS_RX_CTR); - dropped_packets = rate_ctr_group_get_ctr(conn->rate_ctr_group, RTP_DROPPED_PACKETS_CTR); + tx_packets = rate_ctr_group_get_ctr(conn->ctrg, RTP_PACKETS_TX_CTR); + tx_bytes = rate_ctr_group_get_ctr(conn->ctrg, RTP_OCTETS_TX_CTR); + rx_packets = rate_ctr_group_get_ctr(conn->ctrg, RTP_PACKETS_RX_CTR); + rx_bytes = rate_ctr_group_get_ctr(conn->ctrg, RTP_OCTETS_RX_CTR); + dropped_packets = rate_ctr_group_get_ctr(conn->ctrg, RTP_DROPPED_PACKETS_CTR); vty_out(vty, " Packets Sent: %" PRIu64 " (%" PRIu64 " bytes total)%s" diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c index 4ed18c2..e28a574 100644 --- a/tests/mgcp/mgcp_test.c +++ b/tests/mgcp/mgcp_test.c @@ -1071,7 +1071,7 @@ "test-connection"); conn = mgcp_conn_get_rtp(&endp, _conn->id); state = &conn->state; - packets_rx = rate_ctr_group_get_ctr(conn->rate_ctr_group, RTP_PACKETS_RX_CTR); + packets_rx = rate_ctr_group_get_ctr(conn->ctrg, RTP_PACKETS_RX_CTR); state->stats.initialized = 1; state->stats.base_seq = pl_test_dat[i].base_seq; -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29457 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I745eddbf66e7d811bb73c8ae9bb54ea93073c71b Gerrit-Change-Number: 29457 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-mgw[master]: osmux: Get rid of static NULL talloc context
by pespin 23 Sep '22

23 Sep '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29458 ) Change subject: osmux: Get rid of static NULL talloc context ...................................................................... osmux: Get rid of static NULL talloc context struct osmux_handle, which is shared by several rtp_conn, is attached to the trunk object, since the socket also attaches to it. Related: SYS#5987 Change-Id: If4980424cdb8e3dc26a23e9ee419c0a38912f38f --- M src/libosmo-mgcp/mgcp_osmux.c 1 file changed, 4 insertions(+), 5 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve daniel: Looks good to me, but someone else must approve diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index 0109342..4ad3f10 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -41,8 +41,6 @@ int refcnt; }; -static void *osmux; - /* Deliver OSMUX batch to the remote end */ static void osmux_deliver_cb(struct msgb *batch_msg, void *data) { @@ -125,9 +123,10 @@ osmux_handle_alloc(struct mgcp_conn_rtp *conn, const struct osmo_sockaddr *rem_addr) { struct osmux_handle *h; - struct mgcp_config *cfg = conn->conn->endp->trunk->cfg; + struct mgcp_trunk *trunk = conn->conn->endp->trunk; + struct mgcp_config *cfg = trunk->cfg; - h = talloc_zero(osmux, struct osmux_handle); + h = talloc_zero(trunk, struct osmux_handle); if (!h) return NULL; h->rem_addr = *rem_addr; @@ -506,7 +505,7 @@ return -1; } - conn->osmux.out = osmux_xfrm_output_alloc(osmux); + conn->osmux.out = osmux_xfrm_output_alloc(conn->conn); osmux_xfrm_output_set_rtp_ssrc(conn->osmux.out, (conn->osmux.cid * rtp_ssrc_winlen) + (random() % rtp_ssrc_winlen)); -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29458 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: If4980424cdb8e3dc26a23e9ee419c0a38912f38f Gerrit-Change-Number: 29458 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-mgw[master]: Fix typo in ratectr description
by pespin 23 Sep '22

23 Sep '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29456 ) Change subject: Fix typo in ratectr description ...................................................................... Fix typo in ratectr description Change-Id: I2ac8581f13814f320767ba188ef7cf3286fa443d --- M include/osmocom/mgcp/mgcp_conn.h 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve diff --git a/include/osmocom/mgcp/mgcp_conn.h b/include/osmocom/mgcp/mgcp_conn.h index 3eca2f8..5e262c3 100644 --- a/include/osmocom/mgcp/mgcp_conn.h +++ b/include/osmocom/mgcp/mgcp_conn.h @@ -163,7 +163,7 @@ [RTP_OCTETS_RX_CTR] = {"rtp:octets_rx", "Inbound rtp octets."}, [RTP_PACKETS_TX_CTR] = {"rtp:packets_tx", "Outbound rtp packets."}, [RTP_OCTETS_TX_CTR] = {"rtp:octets_tx", "Outbound rtp octets."}, - [RTP_DROPPED_PACKETS_CTR] = {"rtp:dropped", "dropped rtp packets."} + [RTP_DROPPED_PACKETS_CTR] = {"rtp:dropped", "Dropped rtp packets."} }; /* Aggregated RTP connection stats. These are updated when an RTP connection is freed. -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29456 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I2ac8581f13814f320767ba188ef7cf3286fa443d Gerrit-Change-Number: 29456 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-mgw[master]: osmux: Attach osmux to virtual trunk
by pespin 23 Sep '22

23 Sep '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29454 ) Change subject: osmux: Attach osmux to virtual trunk ...................................................................... osmux: Attach osmux to virtual trunk It makes sense to handle one osmux socket per trunk. Since we only so far operate one RTP/osmux trunk, let's stick to that only one for simplicity. Change-Id: I173266c4058d5db9479d773d7dec1304bc8f1f99 --- M include/osmocom/mgcp/osmux.h M src/libosmo-mgcp/mgcp_osmux.c M src/libosmo-mgcp/mgcp_protocol.c 3 files changed, 15 insertions(+), 12 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve daniel: Looks good to me, approved diff --git a/include/osmocom/mgcp/osmux.h b/include/osmocom/mgcp/osmux.h index 62245a9..736025b 100644 --- a/include/osmocom/mgcp/osmux.h +++ b/include/osmocom/mgcp/osmux.h @@ -9,7 +9,7 @@ OSMUX_ROLE_BSC_NAT, }; -int osmux_init(int role, struct mgcp_config *cfg); +int osmux_init(int role, struct mgcp_trunk *trunk); int osmux_enable_conn(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn, const struct osmo_sockaddr *addr); void conn_osmux_disable(struct mgcp_conn_rtp *conn); diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index f15f37c..81de5fd 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -216,9 +216,8 @@ /* Lookup the endpoint that corresponds to the specified address (port) */ static struct mgcp_conn_rtp* -osmux_conn_lookup(struct mgcp_config *cfg, uint8_t cid, const struct osmo_sockaddr *rem_addr) +osmux_conn_lookup(struct mgcp_trunk *trunk, uint8_t cid, const struct osmo_sockaddr *rem_addr) { - struct mgcp_trunk *trunk = mgcp_trunk_by_num(cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID); struct mgcp_endpoint *endp; struct mgcp_conn *conn = NULL; struct mgcp_conn_rtp * conn_rtp; @@ -341,7 +340,7 @@ } /* This is called from the bsc-nat */ -static int osmux_handle_dummy(struct mgcp_config *cfg, const struct osmo_sockaddr *rem_addr, +static int osmux_handle_dummy(struct mgcp_trunk *trunk, const struct osmo_sockaddr *rem_addr, struct msgb *msg) { uint8_t osmux_cid; @@ -350,7 +349,7 @@ if (osmux_legacy_dummy_parse_cid(rem_addr, msg, &osmux_cid) < 0) goto out; - conn = osmux_conn_lookup(cfg, osmux_cid, rem_addr); + conn = osmux_conn_lookup(trunk, osmux_cid, rem_addr); if (!conn) { LOGP(DOSMUX, LOGL_ERROR, "Cannot find conn for Osmux CID %d\n", osmux_cid); @@ -371,7 +370,7 @@ struct msgb *msg; struct osmux_hdr *osmuxh; struct osmo_sockaddr rem_addr; - struct mgcp_config *cfg = ofd->data; + struct mgcp_trunk *trunk = ofd->data; uint32_t rem; struct mgcp_conn_rtp *conn_src; @@ -379,7 +378,7 @@ if (!msg) return -1; - if (!cfg->osmux) { + if (!trunk->cfg->osmux) { LOGP(DOSMUX, LOGL_ERROR, "bsc-nat wants to use Osmux but bsc did not request it\n"); goto out; @@ -387,12 +386,12 @@ /* not any further processing dummy messages */ if (mgcp_is_rtp_dummy_payload(msg)) - return osmux_handle_dummy(cfg, &rem_addr, msg); + return osmux_handle_dummy(trunk, &rem_addr, msg); rem = msg->len; while((osmuxh = osmux_xfrm_output_pull(msg)) != NULL) { - conn_src = osmux_conn_lookup(cfg, osmuxh->circuit_id, + conn_src = osmux_conn_lookup(trunk, osmuxh->circuit_id, &rem_addr); if (!conn_src) { LOGP(DOSMUX, LOGL_ERROR, @@ -423,11 +422,15 @@ return 0; } -int osmux_init(int role, struct mgcp_config *cfg) +int osmux_init(int role, struct mgcp_trunk *trunk) { int ret; + struct mgcp_config *cfg = trunk->cfg; - osmo_fd_setup(&osmux_fd, -1, OSMO_FD_READ, osmux_read_fd_cb, cfg, 0); + /* So far we only support running on one trunk: */ + OSMO_ASSERT(trunk == mgcp_trunk_by_num(cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID)); + + osmo_fd_setup(&osmux_fd, -1, OSMO_FD_READ, osmux_read_fd_cb, trunk, 0); ret = mgcp_create_bind(cfg->osmux_addr, &osmux_fd, cfg->osmux_port, cfg->endp_dscp, cfg->endp_priority); diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c index a9e8818..74ed871 100644 --- a/src/libosmo-mgcp/mgcp_protocol.c +++ b/src/libosmo-mgcp/mgcp_protocol.c @@ -741,7 +741,7 @@ static int mgcp_osmux_setup(struct mgcp_endpoint *endp, const char *line) { if (!endp->trunk->cfg->osmux_init) { - if (osmux_init(OSMUX_ROLE_BSC, endp->trunk->cfg) < 0) { + if (osmux_init(OSMUX_ROLE_BSC, endp->trunk) < 0) { LOGPENDP(endp, DLMGCP, LOGL_ERROR, "Cannot init OSMUX\n"); return -3; } -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29454 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I173266c4058d5db9479d773d7dec1304bc8f1f99 Gerrit-Change-Number: 29454 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-mgw[master]: osmux: Clean up helper macro osmux_chunk_length()
by pespin 23 Sep '22

23 Sep '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29455 ) Change subject: osmux: Clean up helper macro osmux_chunk_length() ...................................................................... osmux: Clean up helper macro osmux_chunk_length() Change-Id: I482d8c5be08610788c2ed98e3b87ae4184075e8d --- M src/libosmo-mgcp/mgcp_osmux.c 1 file changed, 1 insertion(+), 2 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index 81de5fd..0109342 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -363,8 +363,7 @@ return 0; } -#define osmux_chunk_length(msg, rem) (rem - msg->len); - +#define osmux_chunk_length(msg, rem) ((rem) - (msg)->len) static int osmux_read_fd_cb(struct osmo_fd *ofd, unsigned int what) { struct msgb *msg; -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29455 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I482d8c5be08610788c2ed98e3b87ae4184075e8d Gerrit-Change-Number: 29455 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • ...
  • 186
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.