diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2022-10-10 04:54:49 +0200 |
---|---|---|
committer | lynxis lazus <lynxis@fe80.eu> | 2022-11-15 11:32:16 +0000 |
commit | af189fb7864210eec3ea665be56374c8e3494d88 (patch) | |
tree | 7204a10ed1732e281175e53c08d85cdbd9adc859 /include | |
parent | 55c81a9b612e0ce6cfc38a955bb7cff0cd6b4199 (diff) |
Add BTS setup ramping to prevent BSC overloading
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
Diffstat (limited to 'include')
-rw-r--r-- | include/osmocom/bsc/Makefile.am | 1 | ||||
-rw-r--r-- | include/osmocom/bsc/bts.h | 3 | ||||
-rw-r--r-- | include/osmocom/bsc/bts_setup_ramp.h | 69 | ||||
-rw-r--r-- | include/osmocom/bsc/gsm_data.h | 3 | ||||
-rw-r--r-- | include/osmocom/bsc/nm_common_fsm.h | 3 |
5 files changed, 79 insertions, 0 deletions
diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am index 115c92b3e..53d45adbf 100644 --- a/include/osmocom/bsc/Makefile.am +++ b/include/osmocom/bsc/Makefile.am @@ -13,6 +13,7 @@ noinst_HEADERS = \ bss.h \ bts.h \ bts_sm.h \ + bts_setup_ramp.h \ bts_trx.h \ bts_ipaccess_nanobts_omlattr.h \ chan_alloc.h \ diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h index d71d18fe9..cc4db5aa3 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/bts_setup_ramp.h" enum bts_counter_id { BTS_CTR_CHREQ_TOTAL, @@ -666,6 +667,8 @@ struct gsm_bts { struct chan_counts chan_counts; struct all_allocated all_allocated; + + struct bts_setup_ramp bts_setup_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/bts_setup_ramp.h b/include/osmocom/bsc/bts_setup_ramp.h new file mode 100644 index 000000000..0278ee034 --- /dev/null +++ b/include/osmocom/bsc/bts_setup_ramp.h @@ -0,0 +1,69 @@ +/* (C) 2022 by sysmocom s.f.m.c. GmbH <info@sysmocom.de> + * + * Author: Alexander Couzens <acouzens@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> + +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/timer.h> + +struct gsm_bts; +struct gsm_network; + +enum bts_setup_ramp_state { + BTS_SETUP_RAMP_INIT, /*!< initial state */ + BTS_SETUP_RAMP_WAIT, /*!< BTS has to wait, too many BTS configuring */ + BTS_SETUP_RAMP_READY, /*!< BTS is allowed to configure */ +}; + +struct bts_setup_ramp { + enum bts_setup_ramp_state state; + struct llist_head list; +}; + +struct bts_setup_ramp_net { + unsigned count; /*!< max count */ + unsigned step_size; /*!< also the maximum concurrent bts to configure */ + + struct llist_head head; + struct osmo_timer_list timer; + unsigned int step_interval; /*!< in seconds */ + bool enabled; /*!< enabled by vty */ + bool active; /*!< if currently active */ +}; + +void bts_setup_ramp_init_bts(struct gsm_bts *bts); +void bts_setup_ramp_init_network(struct gsm_network *net); + +bool bts_setup_ramp_active(struct gsm_network *net); +bool bts_setup_ramp_wait(struct gsm_bts *bts); +void bts_setup_ramp_remove(struct gsm_bts *bts); +int bts_setup_ramp_unblock_bts(struct gsm_bts *bts); + +/* vty related functions */ +void bts_setup_ramp_enable(struct gsm_network *net); +void bts_setup_ramp_disable(struct gsm_network *net); +void bts_setup_ramp_set_step_interval(struct gsm_network *net, unsigned int step_interval); +void bts_setup_ramp_set_step_size(struct gsm_network *net, unsigned int step_size); + +const char *bts_setup_ramp_get_state_str(struct gsm_bts *bts); diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 481eae4a0..9300dfa70 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -31,6 +31,7 @@ #include <osmocom/gsm/protocol/gsm_12_21.h> #include <osmocom/gsm/protocol/gsm_03_41.h> #include <osmocom/abis/e1_input.h> +#include <osmocom/bsc/bts_setup_ramp.h> #include <osmocom/bsc/meas_rep.h> #include <osmocom/bsc/acc.h> #include <osmocom/bsc/osmux.h> @@ -956,6 +957,8 @@ struct gsm_network { /* Don't refuse to start with mutually exclusive codec settings */ bool allow_unusable_timeslots; + struct bts_setup_ramp_net bts_setup_ramp; + uint8_t nri_bitlen; struct osmo_nri_ranges *null_nri_ranges; diff --git a/include/osmocom/bsc/nm_common_fsm.h b/include/osmocom/bsc/nm_common_fsm.h index b41d24a60..4c34300a1 100644 --- a/include/osmocom/bsc/nm_common_fsm.h +++ b/include/osmocom/bsc/nm_common_fsm.h @@ -38,6 +38,7 @@ enum nm_fsm_events { NM_EV_OPSTART_ACK, NM_EV_OPSTART_NACK, NM_EV_OML_DOWN, + NM_EV_SETUP_RAMP_READY, /* BTS setup 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 */ @@ -120,3 +121,5 @@ extern struct osmo_fsm nm_gprs_nsvc_fsm; void nm_obj_fsm_becomes_enabled_disabled(struct gsm_bts *bts, void *obj, enum abis_nm_obj_class obj_class, bool running); + +void nm_fsm_dispatch_all_configuring(struct gsm_bts *bts, uint32_t event, void *data); |