[S] Change in osmo-bsc[master]: bsc: Make socket queue max. length configurable
daniel has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/33892?usp=email ) Change subject: bsc: Make socket queue max. length configurable ...................................................................... bsc: Make socket queue max. length configurable Title refers to the maximum length of the osmo_wqueue used for the PCU socket connection. Related: OS#5774 Change-Id: Ic5f19f4613bccaf582997a4d02b689adee083a0b --- M include/osmocom/bsc/gsm_data.h M src/osmo-bsc/bsc_init.c M src/osmo-bsc/bsc_vty.c M src/osmo-bsc/pcu_sock.c 4 files changed, 44 insertions(+), 4 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve daniel: Looks good to me, approved diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 275e4f1..bd51a42 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -1068,6 +1068,7 @@ /* PCU socket state */ char *pcu_sock_path; + unsigned int pcu_sock_wqueue_len_max; struct pcu_sock_state *pcu_state; }; diff --git a/src/osmo-bsc/bsc_init.c b/src/osmo-bsc/bsc_init.c index c381c0f..c6c3e79 100644 --- a/src/osmo-bsc/bsc_init.c +++ b/src/osmo-bsc/bsc_init.c @@ -204,6 +204,7 @@ net->cbc->client.remote_addr = (struct osmo_sockaddr_str){ .port = CBSP_TCP_PORT, }; net->cbc->client.local_addr = (struct osmo_sockaddr_str){}; + net->pcu_sock_wqueue_len_max = BSC_PCU_SOCK_WQUEUE_LEN_DEFAULT; return net; err_free_all: diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index bdc18b6..73c5cc2 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -416,6 +416,9 @@ if (gsmnet->pcu_sock_path) vty_out(vty, " pcu-socket %s%s", gsmnet->pcu_sock_path, VTY_NEWLINE); + if (gsmnet->pcu_sock_wqueue_len_max != BSC_PCU_SOCK_WQUEUE_LEN_DEFAULT) + vty_out(vty, " pcu-socket-wqueue-length %u%s", gsmnet->pcu_sock_wqueue_len_max, + VTY_NEWLINE); neighbor_ident_vty_write_network(vty, " "); mgcp_client_pool_config_write(vty, " "); @@ -2484,8 +2487,29 @@ return CMD_SUCCESS; } -DEFUN_ATTR(cfg_net_pcu_sock, - cfg_net_pcu_sock_cmd, +DEFUN_ATTR(cfg_bts_pcu_sock_wqueue_len, cfg_bts_pcu_sock_wqueue_len_cmd, + "pcu-socket-wqueue-length <1-2147483646>", + "Configure the PCU socket queue length\n" + "Queue length\n", + CMD_ATTR_IMMEDIATE) +{ + size_t dropped_msgs = 0; + struct gsm_network *net = gsmnet_from_vty(vty); + size_t old = net->pcu_sock_wqueue_len_max; + net->pcu_sock_wqueue_len_max = atoi(argv[0]); + if (net->pcu_state) + dropped_msgs = osmo_wqueue_set_maxlen(&net->pcu_state->upqueue, net->pcu_sock_wqueue_len_max); + if (dropped_msgs) { + LOGP(DPCU, LOGL_INFO, "Have dropped %zu messages due to shortened max. message queue size (from: %zu to %u)\n", + dropped_msgs, old, net->pcu_sock_wqueue_len_max); + vty_out(vty, "Have dropped %zu messages due to shortened max. message queue size (from: %zu to %u)%s", + dropped_msgs, old, net->pcu_sock_wqueue_len_max, VTY_NEWLINE); + } + return CMD_SUCCESS; +} + +DEFUN_ATTR(cfg_net_pcu_sock_path, + cfg_net_pcu_sock_path_cmd, "pcu-socket PATH", "PCU Socket Path for using OsmoPCU co-located with BSC\n" "Path in the file system for the unix-domain PCU socket\n", @@ -3595,7 +3619,8 @@ install_element(GSMNET_NODE, &cfg_net_meas_feed_wqueue_max_len_cmd); install_element(GSMNET_NODE, &cfg_net_timer_cmd); install_element(GSMNET_NODE, &cfg_net_allow_unusable_timeslots_cmd); - install_element(GSMNET_NODE, &cfg_net_pcu_sock_cmd); + install_element(GSMNET_NODE, &cfg_net_pcu_sock_path_cmd); + install_element(GSMNET_NODE, &cfg_bts_pcu_sock_wqueue_len_cmd); install_element(GSMNET_NODE, &cfg_net_no_pcu_sock_cmd); /* Timer configuration commands (generic osmo_tdef API) */ diff --git a/src/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c index ba11993..7b1aeae 100644 --- a/src/osmo-bsc/pcu_sock.c +++ b/src/osmo-bsc/pcu_sock.c @@ -950,7 +950,7 @@ if (!state) return -ENOMEM; - osmo_wqueue_init(&state->upqueue, BSC_PCU_SOCK_WQUEUE_LEN_DEFAULT); + osmo_wqueue_init(&state->upqueue, net->pcu_sock_wqueue_len_max); state->upqueue.read_cb = pcu_sock_read; state->upqueue.write_cb = pcu_sock_write; state->upqueue.bfd.fd = -1; -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/33892?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Ic5f19f4613bccaf582997a4d02b689adee083a0b Gerrit-Change-Number: 33892 Gerrit-PatchSet: 10 Gerrit-Owner: arehbein <arehbein@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann@sysmocom.de> Gerrit-Reviewer: dexter <pmaier@sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-MessageType: merged
participants (1)
-
daniel