diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-12-01 17:25:28 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-12-03 16:31:36 +0100 |
commit | 64c422858db9388e210875dc681f2d1952e0d0bb (patch) | |
tree | 85d8baa6526562e89c9912d3da76507e0ce4fba3 /include | |
parent | 8c03bf3f3c58afa582ed000ba05e886b593256f9 (diff) |
Store GPRS MOs directly under BTS SiteMgr object
The only real 1-1 relationship between BTS NM objects is the one between
GPRS Cell and BTS (which is actually a BTS cell).
In our current osmo-bts implementation we don't care much since we only
handle 1-cell BTSses, but let's make the data structure organization
more generic.
Implementation notes:
The gsm_bts_sm is moved to its own file, APIs to allocate are added and
the new public object is hooked correctly in the allocation process of
osmo-bsc.
Change-Id: I06461b7784fa2a78de37383406e35beae85fbad8
Diffstat (limited to 'include')
-rw-r--r-- | include/osmocom/bsc/Makefile.am | 1 | ||||
-rw-r--r-- | include/osmocom/bsc/bts.h | 34 | ||||
-rw-r--r-- | include/osmocom/bsc/bts_sm.h | 72 | ||||
-rw-r--r-- | include/osmocom/bsc/gsm_data.h | 11 |
4 files changed, 81 insertions, 37 deletions
diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am index 1f066b618..e2d5db85c 100644 --- a/include/osmocom/bsc/Makefile.am +++ b/include/osmocom/bsc/Makefile.am @@ -11,6 +11,7 @@ noinst_HEADERS = \ bsc_subscr_conn_fsm.h \ bss.h \ bts.h \ + bts_sm.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 22839d612..fd968fa1c 100644 --- a/include/osmocom/bsc/bts.h +++ b/include/osmocom/bsc/bts.h @@ -14,6 +14,7 @@ #include "osmocom/bsc/gsm_data.h" #include "osmocom/bsc/bts_trx.h" +#include "osmocom/bsc/bts_sm.h" enum bts_counter_id { BTS_CTR_CHREQ_TOTAL, @@ -197,15 +198,11 @@ struct gsm_bts_model { uint8_t _features_data[MAX_BTS_FEATURES/8]; }; -/* BTS Site Manager */ -struct gsm_bts_sm { +struct gsm_gprs_cell { struct gsm_abis_mo mo; - /* nanoBTS and old versions of osmo-bts behaves this way due to - broken FSMs not following TS 12.21: they never do - Dependency->Offline transition, but they should be OPSTARTed - nevertheless during Dependnecy state to work. This field is - used by all dependent NM objects. */ - bool peer_has_no_avstate_offline; + uint16_t bvci; + uint8_t timer[11]; + struct gprs_rlc_cfg rlc_cfg; }; /* One BTS */ @@ -272,7 +269,7 @@ struct gsm_bts { /* CCCH is on C0 */ struct gsm_bts_trx *c0; - struct gsm_bts_sm site_mgr; + struct gsm_bts_sm *site_mgr; /* backpointer */ /* bitmask of all SI that are present/valid in si_buf */ uint32_t si_valid; @@ -354,18 +351,7 @@ struct gsm_bts { /* Not entirely sure how ip.access specific this is */ struct { enum bts_gprs_mode mode; - struct { - struct gsm_abis_mo mo; - uint16_t nsei; - uint8_t timer[7]; - } nse; - struct { - struct gsm_abis_mo mo; - uint16_t bvci; - uint8_t timer[11]; - struct gprs_rlc_cfg rlc_cfg; - } cell; - struct gsm_bts_gprs_nsvc nsvc[2]; + struct gsm_gprs_cell cell; uint8_t rac; uint8_t net_ctrl_ord; bool ctrl_ack_type_use_block; @@ -574,11 +560,7 @@ 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); +struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, struct gsm_bts_sm *bts_sm, uint8_t bts_num); char *gsm_bts_name(const struct gsm_bts *bts); diff --git a/include/osmocom/bsc/bts_sm.h b/include/osmocom/bsc/bts_sm.h new file mode 100644 index 000000000..37ace7731 --- /dev/null +++ b/include/osmocom/bsc/bts_sm.h @@ -0,0 +1,72 @@ +/* BTS Site Manager */ + +/* (C) 2020 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de> + * Author: Pau Espin Pedrol <pespin@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 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 <unistd.h> +#include <stdint.h> + +#include "osmocom/bsc/gsm_data.h" + +struct gsm_bts; + +struct gsm_gprs_nse { + struct gsm_abis_mo mo; + uint16_t nsei; + uint8_t timer[7]; +}; + +struct gsm_gprs_nsvc { + struct gsm_bts *bts; + /* data read via VTY config file, to configure the BTS + * via OML from BSC */ + int id; + uint16_t nsvci; + uint16_t local_port; /* on the BTS */ + struct osmo_sockaddr remote; + struct gsm_abis_mo mo; +}; + + +/* BTS Site Manager */ +struct gsm_bts_sm { + struct gsm_bts *bts[1]; /* only one bts supported so far */ + struct gsm_abis_mo mo; + /* nanoBTS and old versions of osmo-bts behaves this way due to + broken FSMs not following TS 12.21: they never do + Dependency->Offline transition, but they should be OPSTARTed + nevertheless during Dependnecy state to work. This field is + used by all dependent NM objects. */ + bool peer_has_no_avstate_offline; + struct { + struct gsm_gprs_nse nse; + struct gsm_gprs_nsvc nsvc[2]; + } gprs; +}; + +static inline struct gsm_bts *gsm_bts_sm_get_bts(struct gsm_bts_sm *site_mgr) { + return site_mgr->bts[0]; +} + +struct gsm_bts_sm *gsm_bts_sm_alloc(struct gsm_network *net, uint8_t bts_num); + +void gsm_bts_sm_mo_reset(struct gsm_bts_sm *bts_sm); diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index a5b5a50f7..d8f8be25c 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -767,17 +767,6 @@ struct gsm_envabtse { struct gsm_abis_mo mo; }; -struct gsm_bts_gprs_nsvc { - struct gsm_bts *bts; - /* data read via VTY config file, to configure the BTS - * via OML from BSC */ - int id; - uint16_t nsvci; - uint16_t local_port; /* on the BTS */ - struct osmo_sockaddr remote; - struct gsm_abis_mo mo; -}; - enum gprs_rlc_par { RLC_T3142, RLC_T3169, |