From 4338de5f51068dbd4ea1b8e3a61bdfdf5ede1833 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 30 Sep 2020 12:52:04 +0200 Subject: Introduce NM BTS Site Manager FSM Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e --- include/osmocom/bsc/Makefile.am | 1 + include/osmocom/bsc/bts.h | 13 ++++++++--- include/osmocom/bsc/gsm_data.h | 2 ++ include/osmocom/bsc/nm_common_fsm.h | 46 +++++++++++++++++++++++++++++++++++++ include/osmocom/bsc/signal.h | 1 + 5 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 include/osmocom/bsc/nm_common_fsm.h (limited to 'include') diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am index 05d71bb71..1f066b618 100644 --- a/include/osmocom/bsc/Makefile.am +++ b/include/osmocom/bsc/Makefile.am @@ -38,6 +38,7 @@ noinst_HEADERS = \ misdn.h \ neighbor_ident.h \ network_listen.h \ + nm_common_fsm.h \ openbscdefines.h \ osmo_bsc.h \ osmo_bsc_grace.h \ diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h index 7f369042e..a9d57a380 100644 --- a/include/osmocom/bsc/bts.h +++ b/include/osmocom/bsc/bts.h @@ -361,6 +361,11 @@ struct gsm_bts_model { uint8_t _features_data[MAX_BTS_FEATURES/8]; }; +/* BTS Site Manager */ +struct gsm_bts_sm { + struct gsm_abis_mo mo; +}; + /* One BTS */ struct gsm_bts { /* list header in net->bts_list */ @@ -425,9 +430,7 @@ struct gsm_bts { /* CCCH is on C0 */ struct gsm_bts_trx *c0; - struct { - struct gsm_abis_mo mo; - } site_mgr; + struct gsm_bts_sm site_mgr; /* bitmask of all SI that are present/valid in si_buf */ uint32_t si_valid; @@ -725,6 +728,10 @@ static inline const struct osmo_location_area_id *bts_lai(struct gsm_bts *bts) return &lai; } +static inline struct gsm_bts *gsm_bts_sm_get_bts(struct gsm_bts_sm *site_mgr) { + return (struct gsm_bts *)container_of(site_mgr, struct gsm_bts, site_mgr); +} + struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num); char *gsm_bts_name(const struct gsm_bts *bts); diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 050cd7ab8..06348be77 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -393,6 +393,8 @@ struct gsm_abis_mo { struct gsm_nm_state nm_state; struct tlv_parsed *nm_attr; struct gsm_bts *bts; + struct osmo_fsm_inst *fi; + bool opstart_sent; }; /* Ericsson OM2000 Managed Object */ diff --git a/include/osmocom/bsc/nm_common_fsm.h b/include/osmocom/bsc/nm_common_fsm.h new file mode 100644 index 000000000..a76c19894 --- /dev/null +++ b/include/osmocom/bsc/nm_common_fsm.h @@ -0,0 +1,46 @@ +/* Header for all NM FSM. Following 3GPP TS 12.21 Figure 2/GSM 12.21: + GSM 12.21 Objects' Operational state and availability status behaviour during initialization */ + +/* (C) 2020 by sysmocom - s.m.f.c. GmbH + * Author: Pau Espin Pedrol + * + * 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 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 . + * + */ + +#pragma once + +#include +#include + +/* Common */ +enum nm_fsm_events { + NM_EV_SW_ACT_REP, + NM_EV_STATE_CHG_REP, + NM_EV_OPSTART_ACK, + NM_EV_OPSTART_NACK, + NM_EV_OML_DOWN, +}; +extern const struct value_string nm_fsm_event_names[]; + +/* BTS SiteManager */ +enum nm_bts_sm_op_fsm_states { + NM_BTS_SM_ST_OP_DISABLED_NOTINSTALLED, + NM_BTS_SM_ST_OP_DISABLED_DEPENDENCY, + NM_BTS_SM_ST_OP_DISABLED_OFFLINE, + NM_BTS_SM_ST_OP_ENABLED, +}; +extern struct osmo_fsm nm_bts_sm_fsm; diff --git a/include/osmocom/bsc/signal.h b/include/osmocom/bsc/signal.h index c7d7fe129..abda67eeb 100644 --- a/include/osmocom/bsc/signal.h +++ b/include/osmocom/bsc/signal.h @@ -72,6 +72,7 @@ enum signal_nm { S_NM_STATECHG_ADM, /* Administrative State changed */ S_NM_OM2K_CONF_RES, /* OM2K Configuration Result */ S_NM_OPSTART_ACK, /* Received OPSTART ACK, arg is struct msgb *oml_msg */ + S_NM_OPSTART_NACK, /* Received OPSTART NACK, arg is struct msgb *oml_msg */ S_NM_GET_ATTR_REP, /* Received Get Attributes Response, arg is struct msgb *oml_msg */ S_NM_SET_RADIO_ATTR_ACK, /* Received Set Radio Carrier Attributes Ack, arg is struct msgb *oml_msg */ }; -- cgit v1.2.3