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-hnbgw[master]: hnbgw: Fix recent regression not closing conn upon rx of SCTP_SHUTDOW...
by pespin 22 Sep '22

22 Sep '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/29451 ) Change subject: hnbgw: Fix recent regression not closing conn upon rx of SCTP_SHUTDOWN_EVENT ...................................................................... hnbgw: Fix recent regression not closing conn upon rx of SCTP_SHUTDOWN_EVENT Before handling of OSMO_STREAM_SCTP_MSG_FLAGS_NOTIFICATION in recent commit (see Fixes: below), osmo_stream_srv_recv() and internal _sctp_recvmsg_wrapper() in libosmo-netif would return either -EAGAIN or 0 when an sctp notification was received from the kernel. After adding handling of OSMO_STREAM_SCTP_MSG_FLAGS_NOTIFICATION, the code paths for "rc == -EAGAIN" and "rc == 0" would not be executed anymore since the first branch takes preference in the if-else tree. For "rc == -EAGAIN" it's fine because the new branch superseeds what's done on the "rc == -EAGAIN" branch. However, for the "rc == 0", we forgot to actually destroy the connection. The "rc == 0" branch was basically reached when SCTP_SHUTDOWN_EVENT was received because osmo_stream_srv_recv() tried to resemble the interface of regular recv(); let's hence check for that explicitly and destroy the conn object (and the related hnb context in the process) when we receive that event. Fixes: 1de2091515530e531196ebca27b1445cecd1b88d Related: SYS#6113 Change-Id: I11b6af51a58dc250975a696b98d0c0c9ff3df9e0 --- M src/osmo-hnbgw/hnbgw.c 1 file changed, 11 insertions(+), 4 deletions(-) Approvals: osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c index 124a647..6d75525 100644 --- a/src/osmo-hnbgw/hnbgw.c +++ b/src/osmo-hnbgw/hnbgw.c @@ -254,6 +254,7 @@ /* Notification received */ if (msgb_sctp_msg_flags(msg) & OSMO_STREAM_SCTP_MSG_FLAGS_NOTIFICATION) { union sctp_notification *notif = (union sctp_notification *)msgb_data(msg); + rc = 0; switch (notif->sn_header.sn_type) { case SCTP_ASSOC_CHANGE: switch (notif->sn_assoc_change.sac_state) { @@ -261,17 +262,23 @@ LOGHNB(hnb, DMAIN, LOGL_NOTICE, "HNB SCTP conn RESTARTed, marking as HNBAP-unregistered\n"); hnb->hnb_registered = false; break; + case SCTP_SHUTDOWN_EVENT: + LOGHNB(hnb, DMAIN, LOGL_NOTICE, + "sctp_recvmsg(%s) = SCTP_SHUTDOWN_EVENT, closing conn\n", + osmo_sock_get_name2(osmo_stream_srv_get_ofd(conn)->fd)); + osmo_stream_srv_destroy(conn); + rc = -1; + break; } break; } - msgb_free(msg); - return 0; + goto out; } else if (rc == -EAGAIN) { /* Older versions of osmo_stream_srv_recv() not supporting * msgb_sctp_msg_flags() may still return -EAGAIN when an sctp * notification is received. */ - msgb_free(msg); - return 0; + rc = 0; + goto out; } else if (rc < 0) { LOGHNB(hnb, DMAIN, LOGL_ERROR, "Error during sctp_recvmsg(%s)\n", osmo_sock_get_name2(osmo_stream_srv_get_ofd(conn)->fd)); -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/29451 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I11b6af51a58dc250975a696b98d0c0c9ff3df9e0 Gerrit-Change-Number: 29451 Gerrit-PatchSet: 4 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-hnbgw[master]: hnbgw: Fix recent regression not closing conn upon rx of SCTP_SHUTDOW...
by pespin 22 Sep '22

22 Sep '22
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/29451 ) Change subject: hnbgw: Fix recent regression not closing conn upon rx of SCTP_SHUTDOWN_EVENT ...................................................................... Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/29451 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I11b6af51a58dc250975a696b98d0c0c9ff3df9e0 Gerrit-Change-Number: 29451 Gerrit-PatchSet: 4 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Thu, 22 Sep 2022 19:32:37 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-mgw[master]: osmux: Add connection and global rate counters
by Jenkins Builder 22 Sep '22

22 Sep '22
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29459 ) Change subject: osmux: Add connection and global rate counters ...................................................................... Patch Set 1: (2 comments) File src/libosmo-mgcp/mgcp_osmux.c: Robot Comment from checkpatch (run ID jenkins-gerrit-osmo-mgw-lint-513): https://gerrit.osmocom.org/c/osmo-mgw/+/29459/comment/cfca443e_875616c4 PS1, Line 44: const static struct rate_ctr_group_desc rate_ctr_group_osmux_desc = { Move const after static - use 'static const struct rate_ctr_group_desc ' File src/libosmo-mgcp/mgcp_ratectr.c: Robot Comment from checkpatch (run ID jenkins-gerrit-osmo-mgw-lint-513): https://gerrit.osmocom.org/c/osmo-mgw/+/29459/comment/3120d5cd_17f609d2 PS1, Line 149: const static struct rate_ctr_group_desc all_osmux_conn_rate_ctr_group_desc = { Move const after static - use 'static const struct rate_ctr_group_desc ' -- 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: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Thu, 22 Sep 2022 19:32:01 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
Change in osmo-mgw[master]: osmux: Get rid of static NULL talloc context
by pespin 22 Sep '22

22 Sep '22
pespin has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/58/29458/1 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-MessageType: newchange
1 0
0 0
Change in osmo-mgw[master]: osmux: Add connection and global rate counters
by pespin 22 Sep '22

22 Sep '22
pespin has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/59/29459/1 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..697df8f 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -41,12 +41,22 @@ int refcnt; }; +const static 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 6030ce2..46d8bf8 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 }; +const static 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: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-mgw[master]: mgcp_conn: rename field s/rate_ctr_group/ctrg/g
by pespin 22 Sep '22

22 Sep '22
pespin has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/57/29457/1 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: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-mgw[master]: Fix typo in ratectr description
by pespin 22 Sep '22

22 Sep '22
pespin has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/56/29456/1 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: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-mgw[master]: osmux: Clean up helper macro osmux_chunk_length()
by pespin 22 Sep '22

22 Sep '22
pespin has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/55/29455/1 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-MessageType: newchange
1 0
0 0
Change in osmo-mgw[master]: osmux: Attach osmux to virtual trunk
by pespin 22 Sep '22

22 Sep '22
pespin has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/54/29454/1 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-MessageType: newchange
1 0
0 0
Change in libosmo-gprs[master]: llc: make logging category configurable
by fixeria 22 Sep '22

22 Sep '22
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29442 ) Change subject: llc: make logging category configurable ...................................................................... llc: make logging category configurable Similar to Icfef6de126304da81120f1d7b212992ead3409aa, let's add osmo_gprs_llc_set_log_cat() allowing the API users to change logging category for libosmo-gprs-llc (DLGLOBAL is default). Change-Id: I9deb794db1c80257ba81523f815232208381bc27 --- M include/osmocom/gprs/llc/llc.h M src/llc/Makefile.am M src/llc/llc_pdu.c A src/llc/misc.c 4 files changed, 36 insertions(+), 9 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/include/osmocom/gprs/llc/llc.h b/include/osmocom/gprs/llc/llc.h index 4723a4b..510b11c 100644 --- a/include/osmocom/gprs/llc/llc.h +++ b/include/osmocom/gprs/llc/llc.h @@ -145,3 +145,5 @@ int osmo_gprs_llc_pdu_encode(struct msgb *msg, const struct osmo_gprs_llc_pdu_decoded *pdu); uint32_t osmo_gprs_llc_fcs(const uint8_t *data, size_t len); + +void osmo_gprs_llc_set_log_cat(int cat); diff --git a/src/llc/Makefile.am b/src/llc/Makefile.am index e24a3b3..a301a89 100644 --- a/src/llc/Makefile.am +++ b/src/llc/Makefile.am @@ -24,6 +24,7 @@ libosmo_gprs_llc_la_SOURCES = \ crc24.c \ llc_pdu.c \ + misc.c \ $(NULL) libosmo_gprs_llc_la_LDFLAGS = \ diff --git a/src/llc/llc_pdu.c b/src/llc/llc_pdu.c index e55e311..5430377 100644 --- a/src/llc/llc_pdu.c +++ b/src/llc/llc_pdu.c @@ -29,13 +29,12 @@ #include <osmocom/gprs/llc/llc.h> -/* TODO: make logging category configurable */ -#define DLLC DLGLOBAL - #define UI_HDR_LEN 3 #define N202 4 #define CRC24_LENGTH 3 +extern int g_log_cat; + const struct value_string osmo_gprs_llc_sapi_names[] = { { OSMO_GPRS_LLC_SAPI_GMM, "GMM" }, { OSMO_GPRS_LLC_SAPI_TOM2, "TOM2" }, @@ -254,7 +253,7 @@ ctrl[0] |= GPRS_LLC_U_XID; break; default: - LOGP(DLLC, LOGL_ERROR, + LOGP(g_log_cat, LOGL_ERROR, "Unknown UI func=0x%02x\n", pdu->func); return -EINVAL; } @@ -269,7 +268,7 @@ /* 5.5a Message Authentication Code (MAC) field */ if (pdu->flags & OSMO_GPRS_LLC_PDU_F_MAC_PRES) { /* TODO: calculate MAC (see 3GPP TS 43.020) */ - LOGP(DLLC, LOGL_ERROR, + LOGP(g_log_cat, LOGL_ERROR, "Message Authentication Code (MAC) is not implemented\n"); return -ENOTSUP; } @@ -296,7 +295,7 @@ #define check_len(len, text) \ do { \ if (data_len < (len)) { \ - LOGP(DLLC, LOGL_ERROR, "Failed to parse LLC PDU: %s\n", text); \ + LOGP(g_log_cat, LOGL_ERROR, "Failed to parse LLC PDU: %s\n", text); \ return -EINVAL; \ } \ } while (0) @@ -317,7 +316,7 @@ /* 6.2.1 Protocol Discriminator bit (PD): shall be 0 */ if (*addr & 0x80) { - LOGP(DLLC, LOGL_ERROR, "Protocol Discriminator shall be 0\n"); + LOGP(g_log_cat, LOGL_ERROR, "Protocol Discriminator shall be 0\n"); return -EINVAL; } @@ -337,7 +336,7 @@ case 0x0c: case 0x0d: case 0x0f: - LOGP(DLLC, LOGL_ERROR, "Unknown SAPI=%u\n", pdu->sapi); + LOGP(g_log_cat, LOGL_ERROR, "Unknown SAPI=%u\n", pdu->sapi); return -EINVAL; } @@ -486,7 +485,7 @@ pdu->data_len = data_len; break; default: - LOGP(DLLC, LOGL_ERROR, "Unknown U func=0x%02x\n", ctrl[0] & 0x0f); + LOGP(g_log_cat, LOGL_ERROR, "Unknown U func=0x%02x\n", ctrl[0] & 0x0f); return -ENOTSUP; } } diff --git a/src/llc/misc.c b/src/llc/misc.c new file mode 100644 index 0000000..06e2a6c --- /dev/null +++ b/src/llc/misc.c @@ -0,0 +1,25 @@ +/* + * (C) 2022 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * Author: Vadim Yanitskiy <vyanitskiy(a)sysmocom.de> + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <osmocom/core/logging.h> + +int g_log_cat = DLGLOBAL; + +void osmo_gprs_llc_set_log_cat(int cat) +{ + g_log_cat = cat; +} -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/29442 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I9deb794db1c80257ba81523f815232208381bc27 Gerrit-Change-Number: 29442 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • ...
  • 186
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.