Remove BTS-specific attributes

Remove *bts_model_* functions as they are only useful to BSC.

Change-Id: Ic80d11d6f8167b49a94fc9c6edbc5ff9fbe36587
This commit is contained in:
Max 2017-09-15 13:51:39 +02:00
parent f953d8bbb2
commit e591d479dd
7 changed files with 2 additions and 338 deletions

View File

@ -9,8 +9,6 @@ noinst_HEADERS = \
bsc_msc.h \
bsc_msg_filter.h \
bsc_rll.h \
bss.h \
bts_ipaccess_nanobts_omlattr.h \
chan_alloc.h \
common.h \
common_bsc.h \

View File

@ -1,20 +0,0 @@
#ifndef _BSS_H_
#define _BSS_H_
#include <osmocom/msc/gsm_data.h>
struct msgb;
/* start and stop network */
extern int bsc_network_alloc(mncc_recv_cb_t mncc_recv);
extern int bsc_network_configure(const char *cfg_file);
extern int bsc_shutdown_net(struct gsm_network *net);
/* register all supported BTS */
extern int bts_init(void);
extern int bts_model_bs11_init(void);
extern int bts_model_rbs2k_init(void);
extern int bts_model_nanobts_init(void);
extern int bts_model_nokia_site_init(void);
extern int bts_model_sysmobts_init(void);
#endif

View File

@ -1,32 +0,0 @@
/* OML attribute table generator for ipaccess nanobts */
/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
* All Rights Reserved
*
* Author: Philipp Maier
*
* 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 <stdint.h>
#include <osmocom/core/msgb.h>
struct msgb *nanobts_attr_bts_get(struct gsm_bts *bts);
struct msgb *nanobts_attr_nse_get(struct gsm_bts *bts);
struct msgb *nanobts_attr_cell_get(struct gsm_bts *bts);
struct msgb *nanobts_attr_nscv_get(struct gsm_bts *bts);
struct msgb *nanobts_attr_radio_get(struct gsm_bts *bts,
struct gsm_bts_trx *trx);

View File

@ -559,8 +559,6 @@ struct gsm_sms {
extern void talloc_ctx_init(void *ctx_root);
int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type);
enum gsm_bts_type parse_btstype(const char *arg);
const char *btstype2str(enum gsm_bts_type type);
struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac,
@ -569,68 +567,6 @@ struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac,
extern void *tall_bsc_ctx;
extern int ipacc_rtp_direct;
/* this actaully refers to the IPA transport, not the BTS model */
static inline int is_ipaccess_bts(struct gsm_bts *bts)
{
switch (bts->type) {
case GSM_BTS_TYPE_NANOBTS:
case GSM_BTS_TYPE_OSMOBTS:
return 1;
default:
break;
}
return 0;
}
static inline int is_sysmobts_v2(struct gsm_bts *bts)
{
switch (bts->type) {
case GSM_BTS_TYPE_OSMOBTS:
return 1;
default:
break;
}
return 0;
}
static inline int is_siemens_bts(struct gsm_bts *bts)
{
switch (bts->type) {
case GSM_BTS_TYPE_BS11:
return 1;
default:
break;
}
return 0;
}
static inline int is_nokia_bts(struct gsm_bts *bts)
{
switch (bts->type) {
case GSM_BTS_TYPE_NOKIA_SITE:
return 1;
default:
break;
}
return 0;
}
static inline int is_e1_bts(struct gsm_bts *bts)
{
switch (bts->type) {
case GSM_BTS_TYPE_BS11:
case GSM_BTS_TYPE_RBS2000:
case GSM_BTS_TYPE_NOKIA_SITE:
return 1;
default:
break;
}
return 0;
}
enum gsm_auth_policy gsm_auth_policy_parse(const char *arg);
const char *gsm_auth_policy_name(enum gsm_auth_policy policy);
@ -639,29 +575,21 @@ const char *rrlp_mode_name(enum rrlp_mode mode);
enum bts_gprs_mode bts_gprs_mode_parse(const char *arg, int *valid);
const char *bts_gprs_mode_name(enum bts_gprs_mode mode);
int bts_gprs_mode_is_compat(struct gsm_bts *bts, enum bts_gprs_mode mode);
int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts);
void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts);
int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat);
int gsm_bts_model_register(struct gsm_bts_model *model);
struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_lchan *lchan);
void bsc_subscr_con_free(struct gsm_subscriber_connection *conn);
struct gsm_subscriber_connection *msc_subscr_con_allocate(struct gsm_network *network);
void msc_subscr_con_free(struct gsm_subscriber_connection *conn);
struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net,
enum gsm_bts_type type,
uint8_t bsic);
void set_ts_e1link(struct gsm_bts_trx_ts *ts, uint8_t e1_nr,
uint8_t e1_ts, uint8_t e1_ts_ss);
void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked);
bool gsm_btsmodel_has_feature(struct gsm_bts_model *model, enum gsm_bts_features feat);
struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr);
int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx);
int gsm_bts_set_system_infos(struct gsm_bts *bts);
@ -676,12 +604,6 @@ extern const struct value_string bts_type_descs[_NUM_GSM_BTS_TYPE+1];
int bsc_base_ctrl_cmds_install(void);
int msc_ctrl_cmds_install(struct gsm_network *net);
/* dependency handling */
void bts_depend_mark(struct gsm_bts *bts, int dep);
void bts_depend_clear(struct gsm_bts *bts, int dep);
int bts_depend_check(struct gsm_bts *bts);
int bts_depend_is_depedency(struct gsm_bts *base, struct gsm_bts *other);
bool classmark_is_r99(struct gsm_classmark *cm);
#endif /* _GSM_DATA_H */

View File

@ -523,30 +523,6 @@ enum bts_attribute {
struct vty;
struct gsm_bts_model {
struct llist_head list;
enum gsm_bts_type type;
enum gsm_bts_type_variant variant;
const char *name;
bool started;
int (*start)(struct gsm_network *net);
int (*oml_rcvmsg)(struct msgb *msg);
void (*e1line_bind_ops)(struct e1inp_line *line);
void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts);
void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx);
void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts);
struct tlv_definition nm_att_tlvdef;
/* features of a given BTS model set via gsm_bts_model_register() locally */
struct bitvec features;
uint8_t _features_data[MAX_BTS_FEATURES/8];
};
/* N. B: always add new features to the end of the list (right before _NUM_BTS_FEAT) to avoid breaking compatibility
with BTS compiled against earlier version of this header */
enum gsm_bts_features {
@ -690,7 +666,7 @@ struct gsm_bts {
/* type of BTS */
enum gsm_bts_type type;
enum gsm_bts_type_variant variant;
struct gsm_bts_model *model;
enum gsm_band band;
char version[MAX_VERSION_LENGTH];
char sub_model[MAX_VERSION_LENGTH];

View File

@ -49,28 +49,6 @@ void set_ts_e1link(struct gsm_bts_trx_ts *ts, uint8_t e1_nr,
ts->e1_link.e1_ts_ss = e1_ts_ss;
}
static struct gsm_bts_model *bts_model_find(enum gsm_bts_type type)
{
struct gsm_bts_model *model;
llist_for_each_entry(model, &bts_models, list) {
if (model->type == type)
return model;
}
return NULL;
}
int gsm_bts_model_register(struct gsm_bts_model *model)
{
if (bts_model_find(model->type))
return -EEXIST;
tlv_def_patch(&model->nm_att_tlvdef, &abis_nm_att_tlvdef);
llist_add_tail(&model->list, &bts_models);
return 0;
}
const struct value_string bts_type_descs[_NUM_GSM_BTS_TYPE+1] = {
{ GSM_BTS_TYPE_UNKNOWN, "Unknown BTS Type" },
{ GSM_BTS_TYPE_BS11, "Siemens BTS (BS-11 or compatible)" },
@ -177,107 +155,6 @@ const char *bts_gprs_mode_name(enum bts_gprs_mode mode)
return get_value_string(bts_gprs_mode_names, mode);
}
int bts_gprs_mode_is_compat(struct gsm_bts *bts, enum bts_gprs_mode mode)
{
if (mode != BTS_GPRS_NONE &&
!gsm_btsmodel_has_feature(bts->model, BTS_FEAT_GPRS)) {
return 0;
}
if (mode == BTS_GPRS_EGPRS &&
!gsm_btsmodel_has_feature(bts->model, BTS_FEAT_EGPRS)) {
return 0;
}
return 1;
}
int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat)
{
OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES);
return bitvec_set_bit_pos(&model->features, feat, 1);
}
bool gsm_btsmodel_has_feature(struct gsm_bts_model *model, enum gsm_bts_features feat)
{
OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES);
return bitvec_get_bit_pos(&model->features, feat);
}
int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type)
{
struct gsm_bts_model *model;
model = bts_model_find(type);
if (!model)
return -EINVAL;
bts->type = type;
bts->model = model;
if (model->start && !model->started) {
int ret = model->start(bts->network);
if (ret < 0)
return ret;
model->started = true;
}
switch (bts->type) {
case GSM_BTS_TYPE_NANOBTS:
case GSM_BTS_TYPE_OSMOBTS:
/* Set the default OML Stream ID to 0xff */
bts->oml_tei = 0xff;
bts->c0->nominal_power = 23;
break;
case GSM_BTS_TYPE_RBS2000:
INIT_LLIST_HEAD(&bts->rbs2000.is.conn_groups);
INIT_LLIST_HEAD(&bts->rbs2000.con.conn_groups);
break;
case GSM_BTS_TYPE_BS11:
case GSM_BTS_TYPE_UNKNOWN:
case GSM_BTS_TYPE_NOKIA_SITE:
/* Set default BTS reset timer */
bts->nokia.bts_reset_timer_cnf = 15;
case _NUM_GSM_BTS_TYPE:
break;
}
return 0;
}
struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net, enum gsm_bts_type type,
uint8_t bsic)
{
struct gsm_bts_model *model = bts_model_find(type);
struct gsm_bts *bts;
if (!model && type != GSM_BTS_TYPE_UNKNOWN)
return NULL;
bts = gsm_bts_alloc(net, net->num_bts);
if (!bts)
return NULL;
net->num_bts++;
bts->network = net;
bts->type = type;
bts->model = model;
bts->bsic = bsic;
bts->dtxu = GSM48_DTX_SHALL_NOT_BE_USED;
bts->dtxd = false;
bts->gprs.ctrl_ack_type_use_block = true; /* use RLC/MAC control block */
bts->neigh_list_manual_mode = 0;
llist_add_tail(&bts->list, &net->bts_list);
INIT_LLIST_HEAD(&bts->abis_queue);
INIT_LLIST_HEAD(&bts->loc_list);
return bts;
}
void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts)
{
raid->mcc = bts->network->country_code;
@ -322,62 +199,6 @@ int gsm_parse_reg(void *ctx, regex_t *reg, char **str, int argc, const char **ar
/* Assume there are only 256 possible bts */
osmo_static_assert(sizeof(((struct gsm_bts *) 0)->nr) == 1, _bts_nr_is_256);
static void depends_calc_index_bit(int bts_nr, int *idx, int *bit)
{
*idx = bts_nr / (8 * 4);
*bit = bts_nr % (8 * 4);
}
void bts_depend_mark(struct gsm_bts *bts, int dep)
{
int idx, bit;
depends_calc_index_bit(dep, &idx, &bit);
bts->depends_on[idx] |= 1 << bit;
}
void bts_depend_clear(struct gsm_bts *bts, int dep)
{
int idx, bit;
depends_calc_index_bit(dep, &idx, &bit);
bts->depends_on[idx] &= ~(1 << bit);
}
int bts_depend_is_depedency(struct gsm_bts *base, struct gsm_bts *other)
{
int idx, bit;
depends_calc_index_bit(other->nr, &idx, &bit);
/* Check if there is a depends bit */
return (base->depends_on[idx] & (1 << bit)) > 0;
}
static int bts_is_online(struct gsm_bts *bts)
{
/* TODO: support E1 BTS too */
if (!is_ipaccess_bts(bts))
return 1;
if (!bts->oml_link)
return 0;
return bts->mo.nm_state.operational == NM_OPSTATE_ENABLED;
}
int bts_depend_check(struct gsm_bts *bts)
{
struct gsm_bts *other_bts;
llist_for_each_entry(other_bts, &bts->network->bts_list, list) {
if (!bts_depend_is_depedency(bts, other_bts))
continue;
if (bts_is_online(other_bts))
continue;
return 0;
}
return 1;
}
bool classmark_is_r99(struct gsm_classmark *cm)
{

View File

@ -53,7 +53,6 @@
#include <osmocom/vty/ports.h>
#include <osmocom/vty/logging.h>
#include <osmocom/msc/vty.h>
#include <osmocom/msc/bss.h>
#include <osmocom/msc/mncc.h>
#include <osmocom/msc/handover_decision.h>
#include <osmocom/msc/rrlp.h>