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

October 2022

  • 2 participants
  • 2331 discussions
Change in osmo-bsc[master]: Add BTS ramping to prevent mass configuration of BTS at the same time
by lynxis lazus 18 Oct '22

18 Oct '22
lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/29788 ) Change subject: Add BTS ramping to prevent mass configuration of BTS at the same time ...................................................................... Add BTS ramping to prevent mass configuration of BTS at the same time Prevent BSC overloading in the event of too many BTS try to connect. E.g. a network outage between the BSC and BTS. The BSC will accept incoming OML connection, but will delay sending any BSC originated messages. Change-Id: Id56dde6d58f3d0d20352f6c306598d2cccc6345d --- M include/osmocom/bsc/bts.h M include/osmocom/bsc/gsm_data.h A include/osmocom/bsc/nm_bts_ramp.h M include/osmocom/bsc/nm_common_fsm.h M src/osmo-bsc/Makefile.am M src/osmo-bsc/bsc_vty.c M src/osmo-bsc/bts.c M src/osmo-bsc/bts_ipaccess_nanobts.c M src/osmo-bsc/bts_vty.c M src/osmo-bsc/net_init.c M src/osmo-bsc/nm_bb_transc_fsm.c M src/osmo-bsc/nm_bts_fsm.c A src/osmo-bsc/nm_bts_ramp.c M src/osmo-bsc/nm_bts_sm_fsm.c M src/osmo-bsc/nm_channel_fsm.c M src/osmo-bsc/nm_gprs_cell_fsm.c M src/osmo-bsc/nm_gprs_nse_fsm.c M src/osmo-bsc/nm_gprs_nsvc_fsm.c M src/osmo-bsc/nm_rcarrier_fsm.c M src/osmo-bsc/osmo_bsc_main.c 20 files changed, 449 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/88/29788/1 diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h index b690652..86f73c0 100644 --- a/include/osmocom/bsc/bts.h +++ b/include/osmocom/bsc/bts.h @@ -18,6 +18,7 @@ #include "osmocom/bsc/bts_sm.h" #include "osmocom/bsc/abis_om2000.h" #include "osmocom/bsc/paging.h" +#include "osmocom/bsc/nm_bts_ramp.h" enum bts_counter_id { BTS_CTR_CHREQ_TOTAL, @@ -662,6 +663,11 @@ struct chan_counts chan_counts; struct all_allocated all_allocated; + + struct { + enum bts_ramp_state state; + struct llist_head list; + } bts_ramp; }; #define GSM_BTS_SI2Q(bts, i) (struct gsm48_system_information_type_2quater *)((bts)->si_buf[SYSINFO_TYPE_2quater][i]) diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 481eae4..2ab0c1d 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -956,6 +956,15 @@ /* Don't refuse to start with mutually exclusive codec settings */ bool allow_unusable_timeslots; + struct { + unsigned count; + unsigned max_bts; + + struct llist_head head; + struct osmo_timer_list timer; + unsigned int seconds; + } bts_ramp; + uint8_t nri_bitlen; struct osmo_nri_ranges *null_nri_ranges; diff --git a/include/osmocom/bsc/nm_bts_ramp.h b/include/osmocom/bsc/nm_bts_ramp.h new file mode 100644 index 0000000..d260afa --- /dev/null +++ b/include/osmocom/bsc/nm_bts_ramp.h @@ -0,0 +1,69 @@ +/* (C) 2022 by sysmocom s.f.m.c. GmbH <info(a)sysmocom.de> + * + * Author: Alexander Couzens <acouzens(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 Affero General Public License as published by + * the Free Software Foundation; either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#pragma once + +#include <stdbool.h> +#include <stdint.h> + +struct gsm_bts; +struct gsm_network; + +enum bts_ramp_state { + BTS_RAMP_INIT, /** initial state */ + BTS_RAMP_WAIT, /** BTS has to wait, too many BTS configuring */ + BTS_RAMP_GO, /** BTS is allowed to configure */ +}; + +bool bts_ramp_active(struct gsm_network *net); +void bts_ramp_init_bts(struct gsm_bts *bts); +void bts_ramp_init_network(struct gsm_network *net); + +/*! + * \brief bts_ramp_activate enable the bts ramping feature + * \param net a pointer to the gsm network + * \param max_bts allow how many bts to provision + * \param seconds how long the \param max_bts limits the bts + */ +void bts_ramp_activate(struct gsm_network *net, unsigned int max_bts, unsigned int seconds); +void bts_ramp_deactivate(struct gsm_network *net); + +/*! + * \brief bts_ramp_wait called by the bts to check if it should wait + * \param bts pointer to the bts + * \return true if the bts should wait + */ +bool bts_ramp_wait(struct gsm_bts *bts); + +const char *bts_ramp_get_state_str(struct gsm_bts *bts); + +/*! + * \brief bts_ramp_remove a bts from the ramp waiting list + * \param bts pointer to the bts + */ +void bts_ramp_remove(struct gsm_bts *bts); + +/*! + * \brief bts_ramp_unblock_bts + * \param bts pointer to the bts + * \return 0 on success, -EINVAL when the BTS is not waiting. + */ +int bts_ramp_unblock_bts(struct gsm_bts *bts); diff --git a/include/osmocom/bsc/nm_common_fsm.h b/include/osmocom/bsc/nm_common_fsm.h index b41d24a..20126fc 100644 --- a/include/osmocom/bsc/nm_common_fsm.h +++ b/include/osmocom/bsc/nm_common_fsm.h @@ -38,6 +38,7 @@ NM_EV_OPSTART_ACK, NM_EV_OPSTART_NACK, NM_EV_OML_DOWN, + NM_EV_RAMP_GO, /* BTS ramp allow to continue to configure */ NM_EV_FORCE_LOCK, /* Only supported by RadioCarrier so far */ NM_EV_FEATURE_NEGOTIATED, /* Sent by BTS to NSVC MO */ NM_EV_RSL_CONNECT_ACK, /* Sent by BTS to BBTRANSC MO */ diff --git a/src/osmo-bsc/Makefile.am b/src/osmo-bsc/Makefile.am index 40381fe..baf4c91 100644 --- a/src/osmo-bsc/Makefile.am +++ b/src/osmo-bsc/Makefile.am @@ -88,6 +88,7 @@ nm_bb_transc_fsm.c \ nm_bts_sm_fsm.c \ nm_bts_fsm.c \ + nm_bts_ramp.c \ nm_gprs_cell_fsm.c \ nm_gprs_nse_fsm.c \ nm_gprs_nsvc_fsm.c \ diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index 61a1559..755c375 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -44,6 +44,7 @@ #include <osmocom/bsc/abis_nm.h> #include <osmocom/bsc/abis_om2000.h> #include <osmocom/bsc/chan_alloc.h> +#include <osmocom/bsc/nm_bts_ramp.h> #include <osmocom/bsc/system_information.h> #include <osmocom/bsc/debug.h> #include <osmocom/bsc/paging.h> @@ -1279,6 +1280,38 @@ return CMD_SUCCESS; } +DEFUN(allow_bts_conf, allow_bts_conf_cmd, + "allow-bts-configuration <0-65535>", + "Unblock and allow to configure a BTS if kept back by BTS ramping\n" + BTS_NR_STR) +{ + struct gsm_network *gsmnet; + struct gsm_bts *bts; + unsigned int bts_nr; + + gsmnet = gsmnet_from_vty(vty); + + bts_nr = atoi(argv[0]); + if (bts_nr >= gsmnet->num_bts) { + vty_out(vty, "%% BTS number must be between 0 and %d. It was %d.%s", + gsmnet->num_bts, bts_nr, VTY_NEWLINE); + return CMD_WARNING; + } + + bts = gsm_bts_num(gsmnet, bts_nr); + if (!bts) { + vty_out(vty, "%% BTS Nr. %d could not be found.%s", bts_nr, VTY_NEWLINE); + return CMD_WARNING; + } + + if (bts_ramp_unblock_bts(bts)) { + vty_out(vty, "%% The BTS is not blocked by BTS ramping.%s", VTY_NEWLINE); + return CMD_WARNING; + } + + return CMD_SUCCESS; +} + DEFUN(restart_bts, restart_bts_cmd, "restart-bts <0-65535>", "Restart ip.access nanoBTS through OML\n" @@ -2622,6 +2655,10 @@ vty_out(vty, " bsc-auto-rf-off %d%s", bsc_gsmnet->auto_off_timeout, VTY_NEWLINE); + if (bsc_gsmnet->bts_ramp.max_bts > 0) + vty_out(vty, " bts ramp limit %d within %d seconds%s", + bsc_gsmnet->bts_ramp.max_bts, bsc_gsmnet->bts_ramp.seconds, VTY_NEWLINE); + return CMD_SUCCESS; } @@ -3045,6 +3082,46 @@ return CMD_SUCCESS; } +DEFUN_ATTR(cfg_bsc_bts_ramp, + cfg_bsc_bts_ramp_cmd, + "bts ramp limit <0-999> within <0-999> seconds", + "Set BTS ramping to limit the number of BTS which configure within a time window.\n" + "Set BTS ramping to limit the number of BTS which configure within a time window.\n" + "Set BTS ramping to limit the number of BTS which configure within a time window.\n" + "Number of BTS\n" + "Set BTS ramping to limit the number of BTS which configure within a time window.\n" + "Number of seconds\n" + "Set BTS ramping to limit the number of BTS which configure within a time window.\n", + CMD_ATTR_IMMEDIATE) +{ + struct gsm_network *net = gsmnet_from_vty(vty); + + int max_bts = atoi(argv[0]); + int seconds = atoi(argv[1]); + + if (max_bts == 0) + bts_ramp_deactivate(net); + else + bts_ramp_activate(net, max_bts, seconds); + + return CMD_SUCCESS; +} + +DEFUN_ATTR(cfg_bsc_no_bts_ramp, + cfg_bsc_no_bts_ramp_cmd, + "no bts ramp limit", + NO_STR + "Disable BTS ramping and configure all waiting BTS.\n" + "Disable BTS ramping and configure all waiting BTS.\n" + "Disable BTS ramping and configure all waiting BTS.\n", + CMD_ATTR_IMMEDIATE) +{ + struct gsm_network *net = gsmnet_from_vty(vty); + + bts_ramp_deactivate(net); + return CMD_SUCCESS; +} + DEFUN(show_statistics, show_statistics_cmd, "show statistics", @@ -3459,6 +3536,7 @@ install_element(ENABLE_NODE, &drop_bts_cmd); install_element(ENABLE_NODE, &restart_bts_cmd); + install_element(ENABLE_NODE, &allow_bts_conf_cmd); install_element(ENABLE_NODE, &bts_resend_sysinfo_cmd); install_element(ENABLE_NODE, &bts_resend_power_ctrl_params_cmd); install_element(ENABLE_NODE, &bts_c0_power_red_cmd); @@ -3499,6 +3577,8 @@ install_element(BSC_NODE, &cfg_net_no_rf_off_time_cmd); install_element(BSC_NODE, &cfg_net_bsc_missing_msc_ussd_cmd); install_element(BSC_NODE, &cfg_net_bsc_no_missing_msc_text_cmd); + install_element(BSC_NODE, &cfg_bsc_bts_ramp_cmd); + install_element(BSC_NODE, &cfg_bsc_no_bts_ramp_cmd); install_node(&msc_node, config_write_msc); install_element(MSC_NODE, &cfg_net_bsc_ncc_cmd); diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c index b7d3c3c..ea0b0d6 100644 --- a/src/osmo-bsc/bts.c +++ b/src/osmo-bsc/bts.c @@ -145,6 +145,7 @@ static int gsm_bts_talloc_destructor(struct gsm_bts *bts) { paging_destructor(bts); + bts_ramp_remove(bts); osmo_timer_del(&bts->cbch_timer); diff --git a/src/osmo-bsc/bts_ipaccess_nanobts.c b/src/osmo-bsc/bts_ipaccess_nanobts.c index 624aabc..3e58c3e 100644 --- a/src/osmo-bsc/bts_ipaccess_nanobts.c +++ b/src/osmo-bsc/bts_ipaccess_nanobts.c @@ -619,6 +619,8 @@ e1inp_sign_link_destroy(bts->osmo_link); bts->osmo_link = NULL; + bts_ramp_remove(bts); + /* we have issues reconnecting RSL, drop everything. */ llist_for_each_entry(trx, &bts->trx_list, list) { ipaccess_drop_rsl(trx, "OML link drop"); diff --git a/src/osmo-bsc/bts_vty.c b/src/osmo-bsc/bts_vty.c index 2348b87..966745a 100644 --- a/src/osmo-bsc/bts_vty.c +++ b/src/osmo-bsc/bts_vty.c @@ -3984,6 +3984,8 @@ vty_out(vty, " OML Link: "); e1isl_dump_vty_tcp(vty, bts->oml_link); vty_out(vty, " OML Link state: %s", get_model_oml_status(bts)); + if (bts_ramp_active(bts->network)) + vty_out(vty, " BTS Ramping: %s", bts_ramp_get_state_str(bts)); sec = bts_uptime(bts); if (sec) vty_out(vty, " %llu days %llu hours %llu min. %llu sec.", diff --git a/src/osmo-bsc/net_init.c b/src/osmo-bsc/net_init.c index 8a8c0a6..e95e305 100644 --- a/src/osmo-bsc/net_init.c +++ b/src/osmo-bsc/net_init.c @@ -25,6 +25,7 @@ #include <osmocom/bsc/handover_cfg.h> #include <osmocom/bsc/chan_alloc.h> #include <osmocom/bsc/neighbor_ident.h> +#include <osmocom/bsc/nm_bts_ramp.h> static struct osmo_tdef gsm_network_T_defs[] = { { .T=4, .default_val=5, .desc="Timeout to receive BSSMAP RESET ACKNOWLEDGE from the MSC" }, @@ -124,5 +125,7 @@ net->null_nri_ranges = osmo_nri_ranges_alloc(net); net->nri_bitlen = OSMO_NRI_BITLEN_DEFAULT; + bts_ramp_init_network(net); + return net; } diff --git a/src/osmo-bsc/nm_bb_transc_fsm.c b/src/osmo-bsc/nm_bb_transc_fsm.c index 3a8786b..a637758 100644 --- a/src/osmo-bsc/nm_bb_transc_fsm.c +++ b/src/osmo-bsc/nm_bb_transc_fsm.c @@ -105,6 +105,9 @@ { struct gsm_bts_trx *trx = gsm_bts_bb_trx_get_trx(bb_transc); + if (bts_ramp_wait(trx->bts)) + return; + /* Request TRX-level attributes */ if (!bb_transc->mo.get_attr_sent && !bb_transc->mo.get_attr_rep_received) { bb_transc->mo.get_attr_sent = true; @@ -339,6 +342,10 @@ nm_bb_transc_fsm_state_chg(fi, NM_BB_TRANSC_ST_OP_DISABLED_NOTINSTALLED); } break; + case NM_EV_RAMP_GO: + if (fi->state != NM_BB_TRANSC_ST_OP_ENABLED) + configure_loop(bb_transc, &bb_transc->mo.nm_state, fi->state == NM_BB_TRANSC_ST_OP_DISABLED_OFFLINE); + break; default: OSMO_ASSERT(0); } @@ -405,7 +412,8 @@ .allstate_event_mask = X(NM_EV_OPSTART_ACK) | X(NM_EV_OPSTART_NACK) | - X(NM_EV_OML_DOWN), + X(NM_EV_OML_DOWN) | + X(NM_EV_RAMP_GO), .allstate_action = st_op_allstate, .event_names = nm_fsm_event_names, .log_subsys = DNM, diff --git a/src/osmo-bsc/nm_bts_fsm.c b/src/osmo-bsc/nm_bts_fsm.c index 1b71323..eb221ff 100644 --- a/src/osmo-bsc/nm_bts_fsm.c +++ b/src/osmo-bsc/nm_bts_fsm.c @@ -88,10 +88,16 @@ } } -static void configure_loop(struct gsm_bts *bts, const struct gsm_nm_state *state, bool allow_opstart) +static void configure_loop( + struct gsm_bts *bts, + const struct gsm_nm_state *state, + bool allow_opstart) { struct msgb *msgb; + if (bts_ramp_wait(bts)) + return; + /* Request generic BTS-level attributes */ if (!bts->mo.get_attr_sent && !bts->mo.get_attr_rep_received) { bts->mo.get_attr_sent = true; @@ -320,6 +326,10 @@ if (fi->state != NM_BTS_ST_OP_DISABLED_NOTINSTALLED) nm_bts_fsm_state_chg(fi, NM_BTS_ST_OP_DISABLED_NOTINSTALLED); break; + case NM_EV_RAMP_GO: + if (fi->state != NM_BTS_ST_OP_ENABLED) + configure_loop(bts, &bts->mo.nm_state, fi->state == NM_BTS_ST_OP_DISABLED_OFFLINE); + break; default: OSMO_ASSERT(0); } @@ -384,7 +394,8 @@ .allstate_event_mask = X(NM_EV_OPSTART_ACK) | X(NM_EV_OPSTART_NACK) | - X(NM_EV_OML_DOWN), + X(NM_EV_OML_DOWN) | + X(NM_EV_RAMP_GO), .allstate_action = st_op_allstate, .event_names = nm_fsm_event_names, .log_subsys = DNM, diff --git a/src/osmo-bsc/nm_bts_ramp.c b/src/osmo-bsc/nm_bts_ramp.c new file mode 100644 index 0000000..94d0a67 --- /dev/null +++ b/src/osmo-bsc/nm_bts_ramp.c @@ -0,0 +1,174 @@ +/* (C) 2022 by sysmocom s.f.m.c. GmbH <info(a)sysmocom.de> + * + * Author: Alexander Couzens <acouzens(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 Affero General Public License as published by + * the Free Software Foundation; either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <stdbool.h> + +#include <osmocom/core/fsm.h> +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/timer.h> +#include <osmocom/core/utils.h> + +#include <osmocom/bsc/bts.h> +#include <osmocom/bsc/bts_sm.h> +#include <osmocom/bsc/nm_bts_ramp.h> +#include <osmocom/bsc/nm_common_fsm.h> + + +static void _bts_ramp_unblock_bts(struct gsm_bts *bts) +{ + struct gsm_bts_trx *trx; + + llist_del(&bts->bts_ramp.list); + bts->bts_ramp.state = BTS_RAMP_GO; + + /* inform all MOs */ + osmo_fsm_inst_dispatch(bts->site_mgr->mo.fi, NM_EV_RAMP_GO, NULL); + osmo_fsm_inst_dispatch(bts->mo.fi, NM_EV_RAMP_GO, NULL); + llist_for_each_entry(trx, &bts->trx_list, list) { + osmo_fsm_inst_dispatch(trx->mo.fi, NM_EV_RAMP_GO, NULL); + osmo_fsm_inst_dispatch(trx->bb_transc.mo.fi, NM_EV_RAMP_GO, NULL); + for (unsigned long i = 0; i < ARRAY_SIZE(trx->ts); i++) { + struct gsm_bts_trx_ts *ts = &trx->ts[i]; + osmo_fsm_inst_dispatch(ts->mo.fi, NM_EV_RAMP_GO, NULL); + } + } + + /* GPRS MOs */ + osmo_fsm_inst_dispatch(bts->site_mgr->gprs.nse.mo.fi, NM_EV_RAMP_GO, NULL); + for (unsigned long i = 0; i < ARRAY_SIZE(bts->site_mgr->gprs.nsvc); i++) + osmo_fsm_inst_dispatch(bts->site_mgr->gprs.nsvc[i].mo.fi, NM_EV_RAMP_GO, NULL); + osmo_fsm_inst_dispatch(bts->gprs.cell.mo.fi, NM_EV_RAMP_GO, NULL); +} + +int bts_ramp_unblock_bts(struct gsm_bts *bts) +{ + if (llist_entry_empty(&bts->bts_ramp.list)) + return -EINVAL; + + _bts_ramp_unblock_bts(bts); + return 0; +} + + +/*! + * \brief bts_ramp_timer_cb timer callback and called by bts_ramp_deactivate + * \param _net pointer to struct gsm_network + */ +static void bts_ramp_timer_cb(void *_net) +{ + struct gsm_network *net = (struct gsm_network *) _net; + struct gsm_bts *bts, *n; + net->bts_ramp.count = 0; + + llist_for_each_entry_safe(bts, n, &net->bts_ramp.head, bts_ramp.list) { + net->bts_ramp.count++; + _bts_ramp_unblock_bts(bts); + LOG_BTS(bts, DNM, LOGL_INFO, "Unblock BTS %d from BTS ramping.\n", bts->nr); + if (bts_ramp_active(net) && + net->bts_ramp.count >= net->bts_ramp.max_bts) + break; + } + + if (net->bts_ramp.max_bts > 0) + osmo_timer_schedule(&net->bts_ramp.timer, net->bts_ramp.seconds, 0); +} + +const struct value_string bts_ramp_state_values[] = { + { BTS_RAMP_INIT, "Initial" }, + { BTS_RAMP_WAIT, "Waiting" }, + { BTS_RAMP_GO, "Go" }, + { 0, NULL }, +}; + +const char *bts_ramp_get_state_str(struct gsm_bts *bts) +{ + return get_value_string_or_null(bts_ramp_state_values, bts->bts_ramp.state); +} + +void bts_ramp_activate(struct gsm_network *net, unsigned int max_bts, unsigned int seconds) +{ + net->bts_ramp.max_bts = max_bts; + net->bts_ramp.seconds = seconds; + osmo_timer_schedule(&net->bts_ramp.timer, seconds, 0); +} + +void bts_ramp_deactivate(struct gsm_network *net) +{ + net->bts_ramp.max_bts = 0; + /* clear bts list */ + bts_ramp_timer_cb(net); + osmo_timer_del(&net->bts_ramp.timer); +} + +bool bts_ramp_active(struct gsm_network *net) +{ + return net->bts_ramp.max_bts > 0; +} + +bool bts_ramp_wait(struct gsm_bts *bts) +{ + struct gsm_network *net = bts->network; + + if (!bts_ramp_active(net)) + return false; + + switch (bts->bts_ramp.state) { + case BTS_RAMP_INIT: + break; + case BTS_RAMP_WAIT: + return true; + case BTS_RAMP_GO: + return false; + } + + if (net->bts_ramp.count < net->bts_ramp.max_bts) { + OSMO_ASSERT(llist_entry_empty(&bts->bts_ramp.list)); + LOG_BTS(bts, DNM, LOGL_INFO, + "BTS %d can configure without waiting for BTS ramping.\n", bts->nr); + + net->bts_ramp.count++; + bts->bts_ramp.state = BTS_RAMP_GO; + return false; + } + + bts->bts_ramp.state = BTS_RAMP_WAIT; + llist_add_tail(&bts->bts_ramp.list, &net->bts_ramp.head); + LOGP(DNM, LOGL_INFO, "BTS %d will wait for BTS ramping.\n", bts->nr); + + return true; +} + +void bts_ramp_init_network(struct gsm_network *net) +{ + INIT_LLIST_HEAD(&net->bts_ramp.head); + osmo_timer_setup(&net->bts_ramp.timer, bts_ramp_timer_cb, net); +} + +void bts_ramp_init_bts(struct gsm_bts *bts) +{ + bts->bts_ramp.state = BTS_RAMP_INIT; +} + +void bts_ramp_remove(struct gsm_bts *bts) +{ + if (!llist_entry_empty(&bts->bts_ramp.list)) + llist_del(&bts->bts_ramp.list); +} diff --git a/src/osmo-bsc/nm_bts_sm_fsm.c b/src/osmo-bsc/nm_bts_sm_fsm.c index 03bf43c..59f0999 100644 --- a/src/osmo-bsc/nm_bts_sm_fsm.c +++ b/src/osmo-bsc/nm_bts_sm_fsm.c @@ -99,6 +99,20 @@ } } +static void configure_loop(struct gsm_bts_sm *site_mgr) +{ + struct gsm_bts *bts = gsm_bts_sm_get_bts(site_mgr); + + if (bts_ramp_wait(bts)) + return; + + if (!site_mgr->mo.opstart_sent) { + site_mgr->mo.opstart_sent = true; + abis_nm_opstart(bts, NM_OC_SITE_MANAGER, 0xff, 0xff, 0xff); + } +} + + static void st_op_disabled_dependency(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct nm_statechg_signal_data *nsd; @@ -132,11 +146,8 @@ static void st_op_disabled_offline_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) { struct gsm_bts_sm *site_mgr = (struct gsm_bts_sm *)fi->priv; - struct gsm_bts *bts = gsm_bts_sm_get_bts(site_mgr); - if (!site_mgr->mo.opstart_sent) { - site_mgr->mo.opstart_sent = true; - abis_nm_opstart(bts, NM_OC_SITE_MANAGER, 0xff, 0xff, 0xff); - } + + configure_loop(site_mgr); } static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, void *data) @@ -144,7 +155,16 @@ struct nm_statechg_signal_data *nsd; const struct gsm_nm_state *new_state; + struct gsm_bts_sm *site_mgr = (struct gsm_bts_sm *)fi->priv; + struct gsm_bts *bts = gsm_bts_sm_get_bts(site_mgr); + switch (event) { + case NM_EV_RAMP_GO: + if (!site_mgr->mo.opstart_sent) { + site_mgr->mo.opstart_sent = true; + abis_nm_opstart(bts, NM_OC_SITE_MANAGER, 0xff, 0xff, 0xff); + } + break; case NM_EV_STATE_CHG_REP: nsd = (struct nm_statechg_signal_data *)data; new_state = &nsd->new_state; @@ -170,6 +190,7 @@ OSMO_ASSERT(0); } } + static void st_op_enabled(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct nm_statechg_signal_data *nsd; @@ -215,6 +236,10 @@ if (fi->state != NM_BTS_SM_ST_OP_DISABLED_NOTINSTALLED) nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_DISABLED_NOTINSTALLED); break; + case NM_EV_RAMP_GO: + if (fi->state != NM_BTS_SM_ST_OP_ENABLED) + configure_loop(site_mgr); + break; default: OSMO_ASSERT(0); } @@ -273,7 +298,8 @@ .allstate_event_mask = X(NM_EV_OPSTART_ACK) | X(NM_EV_OPSTART_NACK) | - X(NM_EV_OML_DOWN), + X(NM_EV_OML_DOWN) | + X(NM_EV_RAMP_GO), .allstate_action = st_op_allstate, .event_names = nm_fsm_event_names, .log_subsys = DNM, diff --git a/src/osmo-bsc/nm_channel_fsm.c b/src/osmo-bsc/nm_channel_fsm.c index c3146a4..093152e 100644 --- a/src/osmo-bsc/nm_channel_fsm.c +++ b/src/osmo-bsc/nm_channel_fsm.c @@ -92,6 +92,9 @@ enum abis_nm_chan_comb ccomb; struct gsm_bts_trx *trx = ts->trx; + if (bts_ramp_wait(ts->trx->bts)) + return; + if (!ts->mo.set_attr_sent && !ts->mo.set_attr_ack_received) { ts->mo.set_attr_sent = true; ccomb = abis_nm_chcomb4pchan(ts->pchan_from_config); @@ -276,6 +279,10 @@ if (fi->state != NM_CHAN_ST_OP_DISABLED_NOTINSTALLED) nm_chan_fsm_state_chg(fi, NM_CHAN_ST_OP_DISABLED_NOTINSTALLED); break; + case NM_EV_RAMP_GO: + if (fi->state != NM_CHAN_ST_OP_ENABLED) + configure_loop(ts, &ts->mo.nm_state, fi->state == NM_CHAN_ST_OP_DISABLED_OFFLINE); + break; default: OSMO_ASSERT(0); } @@ -338,7 +345,8 @@ .allstate_event_mask = X(NM_EV_OPSTART_ACK) | X(NM_EV_OPSTART_NACK) | - X(NM_EV_OML_DOWN), + X(NM_EV_OML_DOWN) | + X(NM_EV_RAMP_GO), .allstate_action = st_op_allstate, .event_names = nm_fsm_event_names, .log_subsys = DNM, diff --git a/src/osmo-bsc/nm_gprs_cell_fsm.c b/src/osmo-bsc/nm_gprs_cell_fsm.c index aabfc0b..cee537b 100644 --- a/src/osmo-bsc/nm_gprs_cell_fsm.c +++ b/src/osmo-bsc/nm_gprs_cell_fsm.c @@ -94,6 +94,9 @@ if (bts->gprs.mode == BTS_GPRS_NONE) return; + if (bts_ramp_wait(bts)) + return; + if (!cell->mo.set_attr_sent && !cell->mo.set_attr_ack_received) { cell->mo.set_attr_sent = true; msgb = nanobts_gen_set_cell_attr(bts); @@ -294,6 +297,10 @@ if (fi->state != NM_GPRS_CELL_ST_OP_DISABLED_NOTINSTALLED) nm_gprs_cell_fsm_state_chg(fi, NM_GPRS_CELL_ST_OP_DISABLED_NOTINSTALLED); break; + case NM_EV_RAMP_GO: + if (fi->state != NM_GPRS_CELL_ST_OP_ENABLED) + configure_loop(cell, &cell->mo.nm_state, fi->state == NM_GPRS_CELL_ST_OP_DISABLED_OFFLINE); + break; default: OSMO_ASSERT(0); } @@ -357,7 +364,8 @@ X(NM_EV_OPSTART_ACK) | X(NM_EV_OPSTART_NACK) | X(NM_EV_FORCE_LOCK) | - X(NM_EV_OML_DOWN), + X(NM_EV_OML_DOWN) | + X(NM_EV_RAMP_GO), .allstate_action = st_op_allstate, .event_names = nm_fsm_event_names, .log_subsys = DNM, diff --git a/src/osmo-bsc/nm_gprs_nse_fsm.c b/src/osmo-bsc/nm_gprs_nse_fsm.c index 49908ce..ae68a6b 100644 --- a/src/osmo-bsc/nm_gprs_nse_fsm.c +++ b/src/osmo-bsc/nm_gprs_nse_fsm.c @@ -93,6 +93,9 @@ struct gsm_bts_sm *bts_sm = container_of(nse, struct gsm_bts_sm, gprs.nse); struct gsm_bts *bts = gsm_bts_sm_get_bts(bts_sm); + if (bts_ramp_wait(bts)) + return; + if (!nse->mo.set_attr_sent && !nse->mo.set_attr_ack_received) { nse->mo.set_attr_sent = true; msgb = nanobts_gen_set_nse_attr(bts_sm); @@ -296,6 +299,10 @@ if (fi->state != NM_GPRS_NSE_ST_OP_DISABLED_NOTINSTALLED) nm_gprs_nse_fsm_state_chg(fi, NM_GPRS_NSE_ST_OP_DISABLED_NOTINSTALLED); break; + case NM_EV_RAMP_GO: + if (fi->state != NM_GPRS_NSE_ST_OP_ENABLED) + configure_loop(nse, &nse->mo.nm_state, fi->state == NM_GPRS_NSE_ST_OP_DISABLED_OFFLINE); + break; default: OSMO_ASSERT(0); } @@ -359,7 +366,8 @@ X(NM_EV_OPSTART_ACK) | X(NM_EV_OPSTART_NACK) | X(NM_EV_FORCE_LOCK) | - X(NM_EV_OML_DOWN), + X(NM_EV_OML_DOWN) | + X(NM_EV_RAMP_GO), .allstate_action = st_op_allstate, .event_names = nm_fsm_event_names, .log_subsys = DNM, diff --git a/src/osmo-bsc/nm_gprs_nsvc_fsm.c b/src/osmo-bsc/nm_gprs_nsvc_fsm.c index 29eed5c..5e649b4 100644 --- a/src/osmo-bsc/nm_gprs_nsvc_fsm.c +++ b/src/osmo-bsc/nm_gprs_nsvc_fsm.c @@ -97,6 +97,9 @@ if (nsvc->bts->gprs.mode == BTS_GPRS_NONE) return; + if (bts_ramp_wait(nsvc->bts)) + return; + /* We need to know BTS features in order to know if we can set IPv6 addresses */ if (gsm_bts_features_negotiated(nsvc->bts) && !nsvc->mo.set_attr_sent && !nsvc->mo.set_attr_ack_received) { @@ -305,6 +308,10 @@ if (fi->state != NM_GPRS_NSVC_ST_OP_DISABLED_NOTINSTALLED) nm_gprs_nsvc_fsm_state_chg(fi, NM_GPRS_NSVC_ST_OP_DISABLED_NOTINSTALLED); break; + case NM_EV_RAMP_GO: + if (fi->state != NM_GPRS_NSVC_ST_OP_ENABLED) + configure_loop(nsvc, &nsvc->mo.nm_state, fi->state == NM_GPRS_NSVC_ST_OP_DISABLED_OFFLINE); + break; default: OSMO_ASSERT(0); } @@ -370,7 +377,8 @@ .allstate_event_mask = X(NM_EV_OPSTART_ACK) | X(NM_EV_OPSTART_NACK) | - X(NM_EV_OML_DOWN), + X(NM_EV_OML_DOWN) | + X(NM_EV_RAMP_GO), .allstate_action = st_op_allstate, .event_names = nm_fsm_event_names, .log_subsys = DNM, diff --git a/src/osmo-bsc/nm_rcarrier_fsm.c b/src/osmo-bsc/nm_rcarrier_fsm.c index c8b95ad..04d0c41 100644 --- a/src/osmo-bsc/nm_rcarrier_fsm.c +++ b/src/osmo-bsc/nm_rcarrier_fsm.c @@ -100,6 +100,9 @@ { struct msgb *msgb; + if (bts_ramp_wait(trx->bts)) + return; + if (!trx->mo.set_attr_sent && !trx->mo.set_attr_ack_received) { trx->mo.set_attr_sent = true; msgb = nanobts_gen_set_radio_attr(trx->bts, trx); @@ -317,6 +320,10 @@ nm_rcarrier_fsm_state_chg(fi, NM_RCARRIER_ST_OP_DISABLED_NOTINSTALLED); } break; + case NM_EV_RAMP_GO: + if (fi->state != NM_BTS_ST_OP_ENABLED) + configure_loop(trx, &trx->mo.nm_state, fi->state == NM_RCARRIER_ST_OP_DISABLED_OFFLINE); + break; default: OSMO_ASSERT(0); } @@ -380,7 +387,8 @@ X(NM_EV_OPSTART_ACK) | X(NM_EV_OPSTART_NACK) | X(NM_EV_FORCE_LOCK) | - X(NM_EV_OML_DOWN), + X(NM_EV_OML_DOWN) | + X(NM_EV_RAMP_GO), .allstate_action = st_op_allstate, .event_names = nm_fsm_event_names, .log_subsys = DNM, diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c index 920693f..fd630a0 100644 --- a/src/osmo-bsc/osmo_bsc_main.c +++ b/src/osmo-bsc/osmo_bsc_main.c @@ -401,6 +401,8 @@ bts->si_common.chan_desc.ccch_conf = (n << 1); } + bts_ramp_init_bts(bts); + /* ACC ramping is initialized from vty/config */ /* Initialize the BTS state */ -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/29788 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Id56dde6d58f3d0d20352f6c306598d2cccc6345d Gerrit-Change-Number: 29788 Gerrit-PatchSet: 1 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-bsc[master]: bsc_vty: training_sequence_code: add missing doc string
by lynxis lazus 18 Oct '22

18 Oct '22
lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/29785 ) Change subject: bsc_vty: training_sequence_code: add missing doc string ...................................................................... bsc_vty: training_sequence_code: add missing doc string Change-Id: Ib16e8537e252f6462ef1a90f5eb80572db4b96bb --- M src/osmo-bsc/bts_vty.c 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/85/29785/1 diff --git a/src/osmo-bsc/bts_vty.c b/src/osmo-bsc/bts_vty.c index ca0cfda..2348b87 100644 --- a/src/osmo-bsc/bts_vty.c +++ b/src/osmo-bsc/bts_vty.c @@ -302,7 +302,9 @@ DEFUN_HIDDEN(cfg_bts_tsc, cfg_bts_tsc_cmd, "training_sequence_code <0-7>", - "Set the Training Sequence Code (TSC) of this BTS\n" "TSC\n") + "Set the Training Sequence Code (TSC) of this BTS\n" + "Set the Training Sequence Code (TSC) of this BTS\n" + "TSC\n") { return CMD_SUCCESS; } -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/29785 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Ib16e8537e252f6462ef1a90f5eb80572db4b96bb Gerrit-Change-Number: 29785 Gerrit-PatchSet: 1 Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-hnbgw[master]: Clear SCTP tx queue upon SCTP RESTART notification
by fixeria 17 Oct '22

17 Oct '22
Attention is currently required from: osmith, laforge, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/29777 ) Change subject: Clear SCTP tx queue upon SCTP RESTART notification ...................................................................... Patch Set 1: Code-Review+1 (1 comment) File src/osmo-hnbgw/hnbgw.c: https://gerrit.osmocom.org/c/osmo-hnbgw/+/29777/comment/3ff9e84b_e33ce7ca PS1, Line 272: SYS#6113 I would avoid referencing Sysmocom's internal Redmine in code. -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/29777 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I60adf35e5b5713d38c4584615e059875dcb74bd7 Gerrit-Change-Number: 29777 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: osmith <osmith(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 17 Oct 2022 17:50:19 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-bsc[master]: Introduce support for MGW-pinning per BTS
by pespin 17 Oct '22

17 Oct '22
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/29751 ) Change subject: Introduce support for MGW-pinning per BTS ...................................................................... Patch Set 5: (1 comment) Commit Message: https://gerrit.osmocom.org/c/osmo-bsc/+/29751/comment/4cfc8b40_351db82d PS1, Line 29: Related: SYS#5987 > Depends: osmo-mgw I75ce3e04cd3f6d9cc20d7b4fc0f51083780786c8 Ack -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/29751 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I9a7a5af72795faed0d12d9d73b59951b6a0e9c7d Gerrit-Change-Number: 29751 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 17 Oct 2022 17:40:14 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in osmo-bsc[master]: Introduce support for MGW-pinning per BTS
by pespin 17 Oct '22

17 Oct '22
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/29751 ) Change subject: Introduce support for MGW-pinning per BTS ...................................................................... Introduce support for MGW-pinning per BTS This feature allows pinning each BTS to a specific MGW from the configured pool. The pinning can be soft or hard (strict). If strict pinning is not set, the configured MGW is selected with priority, but other MGWs can still be selected during each call setup if the preferred MGW is found not available at that time, hence avoiding denial of service for the entire BTS if that MGW goes down. If strict mode is selected, the call will be refused if the configured preferred MGW is not available at the time the call is set up. It is useful to use this feature when Osmux is configured between the BTS and the BSC and an MGW pool is in use. This way the BSC is capable of grouping all the calls of a BTS towards one MGW, hence taking advantage of the Osmux trunking optimizations to reduce link data usage (AMR payload of several concurrent calls ending up sharing the same underlaying UPD packet). Furthermore, this allows the operator to intelligently spread load over the MGW pool in order to avoid ending up with more than 256 concurrent Osmux circuits on any of the co-located MGWs in the pool (maximum supported at the moment). Related: SYS#5987 Depends: osmo-mgw.git 5d8b5b093595e1203e288c3175c163c0994b1102 Change-Id: I9a7a5af72795faed0d12d9d73b59951b6a0e9c7d --- M TODO-RELEASE M doc/manuals/chapters/mgwpool.adoc M include/osmocom/bsc/bts.h M src/osmo-bsc/bsc_subscr_conn_fsm.c M src/osmo-bsc/bts.c M src/osmo-bsc/bts_vty.c 6 files changed, 153 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, approved diff --git a/TODO-RELEASE b/TODO-RELEASE index 532f154..d56a416 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -9,3 +9,4 @@ #library what description / commit summary line libosmogsm >1.7.0 BTS_FEAT_OSMUX, RSL_IE_OSMO_OSMUX_CID libosmocore >1.7.0 vty hexadecimal range support (location_area_code) +libosmomgcp-client >1.10.0 mgcp_client_pool_member_...() diff --git a/doc/manuals/chapters/mgwpool.adoc b/doc/manuals/chapters/mgwpool.adoc index 2221925..d27cf5b 100644 --- a/doc/manuals/chapters/mgwpool.adoc +++ b/doc/manuals/chapters/mgwpool.adoc @@ -250,3 +250,52 @@ OsmoBSC(config)# network OsmoBSC(config-net)# no mgw 2 ---- + +==== Pinning a BTS to a specific MGW + +It is sometimes desirable to assign a specific MGW to a given BTS, so that all +calls where the BTS is involved use the assigned MGW with a higher precedence if +possible. + +This is specially important if the BTS is configured to serve calls using Osmux +instead of RTP. Osmux features trunking optimizations, which allow transmission +of audio payload from different concurrent calls inside the same underlaying UDP +packet, hence reducing the total required throughput and saving costs on the +required link. + +In order for Osmux trunking optimization to work, the source and destination IP +address of uderlaying UDP packet must be of course the same for all the calls +involved. That essentially boils down to having all the concurrent calls of the +BTS be connected to the same MGW so that they can be trunked over the same UDP +connection. + +The pinning to a specific MGW can be configured per BTS, and hence it is +configured under the `bts` VTY node: + +---- +OsmoBSC> enable +OsmoBSC# configure terminal +OsmoBSC(config)# network +OsmoBSC(config-net)# bts 1 +OsmoBSC(config-bts)# mgw pool-target 1 <1> +OsmoBSC(config-bts)# exit +OsmoBSC(config-net)# bts 2 +OsmoBSC(config-mgw)# mgw pool-target 7 strict <2> +OsmoBSC(config-net)# bts 3 +OsmoBSC(config-mgw)# no mgw pool-target <3> +---- + +<1> Pin BTS1 to prefer MGW1 (node `mgw 1`). If MGW1 is not configured, +administrateivly blocked or not connected at the time a new call is to be +established, then another MGW from the pool is selected following the usual +procedures. This allows applying pinning in the usual scenario while still +keeping call service ongoing against another MGW if the preferred MGW is not +available at a given time. + +<2> Pin BTS2 to prefer MGW3 (node `mgw 7`). If MGW7 is not configured, +administrateivly blocked or not connected at the time a new call is to be +established, then the MGW assignment will fail and ultimately the call will be +terminated during establishment. + +<3> Apply no pinning at all (default). The MGW with the lowest load is the one +being selected for each new call. diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h index b690652..d71d18f 100644 --- a/include/osmocom/bsc/bts.h +++ b/include/osmocom/bsc/bts.h @@ -580,6 +580,10 @@ /* exclude the BTS from the global RF Lock handling */ int excl_from_rf_lock; + /* MGW specificities for this BTS: */ + int mgw_pool_target; /* Pin to specific MGW. -1 = wildcard */ + bool mgw_pool_target_strict; /* Only allow pinned MGW */ + /* supported codecs beside FR */ struct bts_codec_conf codec; diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c index 21988ce..2a4e387 100644 --- a/src/osmo-bsc/bsc_subscr_conn_fsm.c +++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c @@ -621,6 +621,62 @@ return true; } +static struct mgcp_client *select_mgw(struct gsm_subscriber_connection *conn, struct gsm_lchan *for_lchan) +{ + struct mgcp_client_pool_member *mgcp_pmemb; + struct mgcp_client *mgcp_client; + struct gsm_bts *bts = for_lchan->ts->trx->bts; + + /* If BTS is not pinned to a given MGW, let regular allocation which + * spreads load over available MGWs: */ + if (bts->mgw_pool_target == -1) + goto pick_any; + + /* BTS is pinned to an MGW, retrieve pointer to it: */ + mgcp_pmemb = mgcp_client_pool_find_member_by_nr(conn->network->mgw.mgw_pool, bts->mgw_pool_target); + if (!mgcp_pmemb) { + if (!bts->mgw_pool_target_strict) { + LOGPFSML(conn->fi, LOGL_NOTICE, + "mgw pool-target %u not found! selecting another one.\n", bts->mgw_pool_target); + goto pick_any; + } else { + LOGPFSML(conn->fi, LOGL_ERROR, "mgw pool-target %u not found!\n", bts->mgw_pool_target); + return NULL; + } + } + if (mgcp_client_pool_member_is_blocked(mgcp_pmemb)) { + if (!bts->mgw_pool_target_strict) { + LOGPFSML(conn->fi, LOGL_NOTICE, + "mgw pool-target %u is administratively blocked! selecting another one.\n", + bts->mgw_pool_target); + goto pick_any; + } else { + LOGPFSML(conn->fi, LOGL_ERROR, "mgw pool-target %u is administratively blocked!\n", + bts->mgw_pool_target); + return NULL; + } + } + + mgcp_client = mgcp_client_pool_member_get(mgcp_pmemb); + if (!mgcp_client) { + if (!bts->mgw_pool_target_strict) { + LOGPFSML(conn->fi, LOGL_NOTICE, + "mgw pool-target %u is not connected! selecting another one.\n", + bts->mgw_pool_target); + goto pick_any; + } else { + LOGPFSML(conn->fi, LOGL_ERROR, "mgw pool-target %u is not connected!\n", + bts->mgw_pool_target); + return NULL; + } + } + return mgcp_client; + +pick_any: + mgcp_client = mgcp_client_pool_get(conn->network->mgw.mgw_pool); + return mgcp_client; +} + /* Make sure a conn->user_plane.mgw_endpoint is allocated with the proper mgw endpoint name. For * SCCPlite, pass in msc_assigned_cic the CIC received upon BSSMAP Assignment Command or BSSMAP Handover * Request form the MSC (which is only stored in conn->user_plane after success). Ignored for AoIP. */ @@ -640,7 +696,7 @@ if (gscon_is_sccplite(conn) || gscon_is_aoip(conn)) { /* Get MGCP client from pool */ - mgcp_client = mgcp_client_pool_get(conn->network->mgw.mgw_pool); + mgcp_client = select_mgw(conn, for_lchan); if (!mgcp_client) { LOGPFSML(conn->fi, LOGL_ERROR, "cannot ensure MGW endpoint -- no MGW configured, check configuration!\n"); diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c index b7d3c3c..8d4b8c8 100644 --- a/src/osmo-bsc/bts.c +++ b/src/osmo-bsc/bts.c @@ -331,6 +331,9 @@ INIT_LLIST_HEAD(&bts->oml_fail_rep); INIT_LLIST_HEAD(&bts->chan_rqd_queue); + /* Don't pin the BTS to any MGW by default: */ + bts->mgw_pool_target = -1; + /* Enable all codecs by default. These get reset to a more fine grained selection IF a * 'codec-support' config appears in the config file (see bsc_vty.c). */ bts->codec = (struct bts_codec_conf){ diff --git a/src/osmo-bsc/bts_vty.c b/src/osmo-bsc/bts_vty.c index 0e14284..711ab06 100644 --- a/src/osmo-bsc/bts_vty.c +++ b/src/osmo-bsc/bts_vty.c @@ -3000,6 +3000,36 @@ return CMD_WARNING; } +DEFUN_USRATTR(cfg_bts_mgw_pool_target, + cfg_bts_mgw_pool_target_cmd, + X(BSC_VTY_ATTR_NEW_LCHAN), + "mgw pool-target <0-255> [strict]", + "MGW configuration for this specific BTS\n" + "Pin BTS to use a single MGW in the pool\n" + "Reference Number of the MGW (in the config) to pin to\n" + "Strictly prohibit use of other MGWs if the pinned one is not available\n") +{ + struct gsm_bts *bts = vty->index; + int mgw_nr = atoi(argv[0]); + bool strict = argc > 1; + bts->mgw_pool_target = mgw_nr; + bts->mgw_pool_target_strict = strict; + return CMD_SUCCESS; +} + +DEFUN_USRATTR(cfg_bts_no_mgw_pool_target, + cfg_bts_no_mgw_pool_target_cmd, + X(BSC_VTY_ATTR_NEW_LCHAN), + "no mgw pool-target", + NO_STR "MGW configuration for this specific BTS\n" + "Avoid pinning the BTS to any specific MGW (default)\n") +{ + struct gsm_bts *bts = vty->index; + bts->mgw_pool_target = -1; + bts->mgw_pool_target_strict = false; + return CMD_SUCCESS; +} + #define TNUM_STR "T-number, optionally preceded by 't' or 'T'\n" DEFUN_ATTR(cfg_bts_t3113_dynamic, cfg_bts_t3113_dynamic_cmd, "timer-dynamic TNNNN", @@ -4552,6 +4582,13 @@ VTY_NEWLINE); } + if (bts->mgw_pool_target > -1) { + vty_out(vty, " mgw pool-target %u%s%s", + bts->mgw_pool_target, + bts->mgw_pool_target_strict ? " strict" : "", + VTY_NEWLINE); + } + config_write_bts_gprs(vty, bts); if (bts->excl_from_rf_lock) @@ -4814,6 +4851,8 @@ install_element(BTS_NODE, &cfg_bts_amr_hr_hyst3_cmd); install_element(BTS_NODE, &cfg_bts_amr_hr_start_mode_cmd); install_element(BTS_NODE, &cfg_bts_osmux_cmd); + install_element(BTS_NODE, &cfg_bts_mgw_pool_target_cmd); + install_element(BTS_NODE, &cfg_bts_no_mgw_pool_target_cmd); install_element(BTS_NODE, &cfg_bts_pcu_sock_cmd); install_element(BTS_NODE, &cfg_bts_acc_rotate_cmd); install_element(BTS_NODE, &cfg_bts_acc_rotate_quantum_cmd); -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/29751 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I9a7a5af72795faed0d12d9d73b59951b6a0e9c7d Gerrit-Change-Number: 29751 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(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-mgw[master]: mgcp-client: Use random free local port by default
by pespin 17 Oct '22

17 Oct '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29784 ) Change subject: mgcp-client: Use random free local port by default ...................................................................... mgcp-client: Use random free local port by default Deprecate mgcp_client_connect2() and all the related messy system where configured port is incremented until a free port is found. Let's simply use local_port=0 by default and let the kernel take care of doing all that. The mgcp_client_connect2() is actually not being used anywhere outside of libosmo-mgcp-client, so it's not a real problem deprecating it. We could poitentially remove it too. This helps in fixing a regression in recent refactoring commit f48cd95bbc1383f33ad9cd9cf0b0a02f9371b21a, which unified calls to mgcp_client_connect() and in the process dropped the code path which was setting the retry_n_ports=99. As a result, since all libosmo-mgcp-client instances set local_port=2727 and addr=NULL by default, using MGW pooling or having several osmo-bsc or osmo-msc processes would make creating the socket fail. Change-Id: I5683bcf3b2c4e8058338433f2cd1b143753f6512 --- M include/osmocom/mgcp_client/mgcp_client.h M src/libosmo-mgcp-client/mgcp_client.c M src/libosmo-mgcp-client/mgcp_client_pool.c 3 files changed, 11 insertions(+), 53 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/84/29784/1 diff --git a/include/osmocom/mgcp_client/mgcp_client.h b/include/osmocom/mgcp_client/mgcp_client.h index d421273..b40923d 100644 --- a/include/osmocom/mgcp_client/mgcp_client.h +++ b/include/osmocom/mgcp_client/mgcp_client.h @@ -7,7 +7,7 @@ /* See also: RFC 3435, chapter 3.5 Transmission over UDP */ #define MGCP_CLIENT_LOCAL_ADDR_DEFAULT NULL /* INADDR(6)_ANY */ -#define MGCP_CLIENT_LOCAL_PORT_DEFAULT 2727 +#define MGCP_CLIENT_LOCAL_PORT_DEFAULT 0 #define MGCP_CLIENT_REMOTE_ADDR_DEFAULT "127.0.0.1" #define MGCP_CLIENT_REMOTE_PORT_DEFAULT 2427 @@ -140,7 +140,7 @@ struct mgcp_client *mgcp_client_init(void *ctx, struct mgcp_client_conf *conf); int mgcp_client_connect(struct mgcp_client *mgcp); -int mgcp_client_connect2(struct mgcp_client *mgcp, unsigned int retry_n_ports); +int mgcp_client_connect2(struct mgcp_client *mgcp, unsigned int retry_n_ports) OSMO_DEPRECATED("Use mgcp_client_connect() instead"); void mgcp_client_disconnect(struct mgcp_client *mgcp); const char *mgcp_client_remote_addr_str(struct mgcp_client *mgcp); diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c index 2ca3b66..6f1ab6b 100644 --- a/src/libosmo-mgcp-client/mgcp_client.c +++ b/src/libosmo-mgcp-client/mgcp_client.c @@ -769,7 +769,7 @@ mgcp->actual.local_addr = conf->local_addr ? conf->local_addr : MGCP_CLIENT_LOCAL_ADDR_DEFAULT; - mgcp->actual.local_port = conf->local_port >= 0 ? (uint16_t)conf->local_port : + mgcp->actual.local_port = conf->local_port > 0 ? (uint16_t)conf->local_port : MGCP_CLIENT_LOCAL_PORT_DEFAULT; mgcp->actual.remote_addr = conf->remote_addr ? conf->remote_addr : @@ -799,49 +799,6 @@ return mgcp; } -static int init_socket(struct mgcp_client *mgcp, unsigned int retry_n_ports) -{ - int rc; - struct osmo_wqueue *wq; - unsigned int i; - - wq = &mgcp->wq; - - for (i = 0; i < retry_n_ports + 1; i++) { - - /* Initialize socket with the currently configured port number */ - rc = osmo_sock_init2_ofd(&wq->bfd, AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP, mgcp->actual.local_addr, - mgcp->actual.local_port, mgcp->actual.remote_addr, mgcp->actual.remote_port, - OSMO_SOCK_F_BIND | OSMO_SOCK_F_CONNECT); - if (rc > 0) - return rc; - - /* If there is a different port than the default port configured then we assume that the user has - * chosen that port conciously and we will not try to resolve this by silently choosing a different - * port. */ - if (mgcp->actual.local_port != MGCP_CLIENT_LOCAL_PORT_DEFAULT && i == 0) - return -EINVAL; - - if (i == retry_n_ports) { - /* Last try failed */ - LOGPMGW(mgcp, LOGL_NOTICE, "Failed to bind to %s:%d -- check configuration!\n", - mgcp->actual.local_addr ? mgcp->actual.local_addr : "(any)", mgcp->actual.local_port); - if (retry_n_ports == 0) - return -EINVAL; - } else { - /* Choose a new port number to try next */ - LOGPMGW(mgcp, LOGL_NOTICE, - "Failed to bind to %s:%d, retrying with port %d -- check configuration!\n", - mgcp->actual.local_addr ? mgcp->actual.local_addr : "(any)", mgcp->actual.local_port, - mgcp->actual.local_port + 1); - mgcp->actual.local_port++; - } - } - - LOGPMGW(mgcp, LOGL_FATAL, "Failed to find a port to bind on %u times -- check configuration!\n", i); - return -EINVAL; -} - /* Safely ignore the MGCP response to the DLCX sent via _mgcp_client_send_dlcx() */ static void _ignore_mgcp_response(struct mgcp_response *response, void *priv) { } @@ -878,9 +835,8 @@ /*! Initialize client connection (opens socket) * \param[in,out] mgcp MGCP client descriptor. - * \param[in] retry_n_ports number of consecutive local ports that should be used to retry on failure. * \returns 0 on success, -EINVAL on error. */ -int mgcp_client_connect2(struct mgcp_client *mgcp, unsigned int retry_n_ports) +int mgcp_client_connect(struct mgcp_client *mgcp) { struct osmo_wqueue *wq; int rc; @@ -899,7 +855,9 @@ osmo_fd_setup(&wq->bfd, -1, OSMO_FD_READ, osmo_wqueue_bfd_cb, mgcp, 0); - rc = init_socket(mgcp, retry_n_ports); + rc = osmo_sock_init2_ofd(&wq->bfd, AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP, mgcp->actual.local_addr, + mgcp->actual.local_port, mgcp->actual.remote_addr, mgcp->actual.remote_port, + OSMO_SOCK_F_BIND | OSMO_SOCK_F_CONNECT); if (rc < 0) { LOGPMGW(mgcp, LOGL_FATAL, "Failed to initialize socket %s:%u -> %s:%u for MGW: %s\n", @@ -925,12 +883,12 @@ return rc; } -/*! Initialize client connection (opens socket) +/*! DEPRECATED: Initialize client connection (opens socket) * \param[in,out] mgcp MGCP client descriptor. * \returns 0 on success, -EINVAL on error. */ -int mgcp_client_connect(struct mgcp_client *mgcp) +int mgcp_client_connect2(struct mgcp_client *mgcp, unsigned int retry_n_ports) { - return mgcp_client_connect2(mgcp, 99); + return mgcp_client_connect(mgcp); } /*! Terminate client connection diff --git a/src/libosmo-mgcp-client/mgcp_client_pool.c b/src/libosmo-mgcp-client/mgcp_client_pool.c index caec535..fe3cccd 100644 --- a/src/libosmo-mgcp-client/mgcp_client_pool.c +++ b/src/libosmo-mgcp-client/mgcp_client_pool.c @@ -236,7 +236,7 @@ pool_member->client->pool_member = pool_member; /* Connect client */ - if (mgcp_client_connect2(pool_member->client, 0)) { + if (mgcp_client_connect(pool_member->client)) { LOGPPMGW(pool_member, LOGL_ERROR, "MGCP client connect failed at (%s:%u)\n", pool_member->conf.remote_addr, pool_member->conf.remote_port); talloc_free(pool_member->client); -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29784 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I5683bcf3b2c4e8058338433f2cd1b143753f6512 Gerrit-Change-Number: 29784 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmo-netif[master]: debug: print socket info in log messages
by pespin 17 Oct '22

17 Oct '22
Attention is currently required from: msuraev. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29674 ) Change subject: debug: print socket info in log messages ...................................................................... Patch Set 1: (1 comment) File src/stream.c: https://gerrit.osmocom.org/c/libosmo-netif/+/29674/comment/1cf33e40_ef307b87 PS1, Line 1577: osmo_stream_srv_link_get_sockname(osmo_stream_srv_get_master(conn))); > That affects test output since we're printing connection details which includes random client port. A test printing different stuff doesn't look like a valid reason to me. Either fix the test to use always the same stuff, or modify the test expectations in the log to filter that part in the line (we have some filtering features available when matching test output IIRC, @neels probably remembers betters). -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29674 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ic8c9b0e5a67f0454fe850a80dfd7e6c2b3208b2c Gerrit-Change-Number: 29674 Gerrit-PatchSet: 1 Gerrit-Owner: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: msuraev <msuraev(a)sysmocom.de> Gerrit-Comment-Date: Mon, 17 Oct 2022 17:28:21 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Comment-In-Reply-To: msuraev <msuraev(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-netif[master]: debug: print socket info in log messages
by msuraev 17 Oct '22

17 Oct '22
Attention is currently required from: pespin. msuraev has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29674 ) Change subject: debug: print socket info in log messages ...................................................................... Patch Set 1: (1 comment) File src/stream.c: https://gerrit.osmocom.org/c/libosmo-netif/+/29674/comment/70a51979_aef18444 PS1, Line 1577: osmo_stream_srv_link_get_sockname(osmo_stream_srv_get_master(conn))); > why do you use something different here? That affects test output since we're printing connection details which includes random client port. -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29674 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Ic8c9b0e5a67f0454fe850a80dfd7e6c2b3208b2c Gerrit-Change-Number: 29674 Gerrit-PatchSet: 1 Gerrit-Owner: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 17 Oct 2022 17:09:24 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in osmo-msc[master]: Introduce support for libosmo-mgcp-client MGW pooling
by pespin 17 Oct '22

17 Oct '22
Attention is currently required from: pespin. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-msc/+/29782 to look at the new patch set (#3). Change subject: Introduce support for libosmo-mgcp-client MGW pooling ...................................................................... Introduce support for libosmo-mgcp-client MGW pooling Change-Id: I7670ba56fe989706579224a364595fdd4b4708ff --- M include/osmocom/msc/gsm_data.h M include/osmocom/msc/vty.h M src/libmsc/call_leg.c M src/libmsc/msc_vty.c M src/osmo-msc/msc_main.c M tests/msc_vlr/msc_vlr_tests.c M tests/test_nodes.vty 7 files changed, 63 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/82/29782/3 -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/29782 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I7670ba56fe989706579224a364595fdd4b4708ff Gerrit-Change-Number: 29782 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
Change in libosmocore[master]: msgb: introduce extended copy functions
by pespin 17 Oct '22

17 Oct '22
Attention is currently required from: laforge, fixeria, msuraev. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/29761 ) Change subject: msgb: introduce extended copy functions ...................................................................... Patch Set 4: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/29761 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I36d4c16241d19f0f73c325be4d0e0bdef6813615 Gerrit-Change-Number: 29761 Gerrit-PatchSet: 4 Gerrit-Owner: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: msuraev <msuraev(a)sysmocom.de> Gerrit-Comment-Date: Mon, 17 Oct 2022 16:48:08 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • ...
  • 234
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.