BSC: introduce new "sysmobts" BTS model

so far, osmo-bts/sysmobts used to be entered as "sysmobts" type in the
configuration file.  However, there are some differences in the
protocol/behaviour and we should reflect that by a new BTS plugin (with
lots of code reuse from the nanobts driver).
This commit is contained in:
Harald Welte 2012-07-02 19:51:55 +02:00
parent 0c1bd61bb3
commit f383aa11a5
13 changed files with 101 additions and 8 deletions

View File

@ -15,4 +15,5 @@ extern int bts_model_rbs2k_init(void);
extern int bts_model_nanobts_init(void);
extern int bts_model_hslfemto_init(void);
extern int bts_model_nokia_site_init(void);
extern int bts_model_sysmobts_init(void);
#endif

View File

@ -308,10 +308,12 @@ 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_OSMO_SYSMO:
return 1;
default:
break;

View File

@ -362,6 +362,7 @@ enum gsm_bts_type {
GSM_BTS_TYPE_RBS2000,
GSM_BTS_TYPE_HSL_FEMTO,
GSM_BTS_TYPE_NOKIA_SITE,
GSM_BTS_TYPE_OSMO_SYSMO,
};
struct vty;

View File

@ -14,6 +14,7 @@ libbsc_a_SOURCES = abis_nm.c abis_nm_vty.c \
bts_nokia_site.c \
bts_hsl_femtocell.c \
bts_unknown.c \
bts_sysmobts.c \
chan_alloc.c \
gsm_subscriber_base.c \
handover_decision.c handover_logic.c meas_rep.c \

View File

@ -610,6 +610,7 @@ static int abis_nm_rcvmsg_manuf(struct msgb *mb)
switch (bts_type) {
case GSM_BTS_TYPE_NANOBTS:
case GSM_BTS_TYPE_OSMO_SYSMO:
rc = abis_nm_rx_ipacc(mb);
abis_nm_queue_send_next(sign_link->trx->bts);
break;
@ -1531,6 +1532,9 @@ static int verify_chan_comb(struct gsm_bts_trx_ts *ts, uint8_t chan_comb)
break;
}
return -EINVAL;
case GSM_BTS_TYPE_OSMO_SYSMO:
/* no known restrictions */
return 0;
default:
/* unknown BTS type */
return 0;

View File

@ -517,6 +517,7 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
}
switch (bts->type) {
case GSM_BTS_TYPE_NANOBTS:
case GSM_BTS_TYPE_OSMO_SYSMO:
vty_out(vty, " ip.access unit_id %u %u%s",
bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
vty_out(vty, " oml ip.access stream_id %u line %u%s",

View File

@ -25,6 +25,7 @@ int bts_init(void)
bts_model_nanobts_init();
bts_model_hslfemto_init();
bts_model_nokia_site_init();
bts_model_sysmobts_init();
/* Your new BTS here. */
return 0;
}

View File

@ -41,7 +41,7 @@
static int bts_model_nanobts_start(struct gsm_network *net);
static void bts_model_nanobts_e1line_bind_ops(struct e1inp_line *line);
static struct gsm_bts_model model_nanobts = {
struct gsm_bts_model bts_model_nanobts = {
.type = GSM_BTS_TYPE_NANOBTS,
.name = "nanobts",
.start = bts_model_nanobts_start,
@ -438,7 +438,7 @@ static int sw_activ_rep(struct msgb *mb)
}
/* Callback function to be called every time we receive a signal from NM */
static int nm_sig_cb(unsigned int subsys, unsigned int signal,
int bts_ipa_nm_sig_cb(unsigned int subsys, unsigned int signal,
void *handler_data, void *signal_data)
{
if (subsys != SS_NM)
@ -460,13 +460,14 @@ static struct gsm_network *ipaccess_gsmnet;
static int bts_model_nanobts_start(struct gsm_network *net)
{
model_nanobts.features.data = &model_nanobts._features_data[0];
model_nanobts.features.data_len = sizeof(model_nanobts._features_data);
bts_model_nanobts.features.data = &bts_model_nanobts._features_data[0];
bts_model_nanobts.features.data_len =
sizeof(bts_model_nanobts._features_data);
gsm_btsmodel_set_feature(&model_nanobts, BTS_FEAT_GPRS);
gsm_btsmodel_set_feature(&model_nanobts, BTS_FEAT_EGPRS);
gsm_btsmodel_set_feature(&bts_model_nanobts, BTS_FEAT_GPRS);
gsm_btsmodel_set_feature(&bts_model_nanobts, BTS_FEAT_EGPRS);
osmo_signal_register_handler(SS_NM, nm_sig_cb, NULL);
osmo_signal_register_handler(SS_NM, bts_ipa_nm_sig_cb, NULL);
ipaccess_gsmnet = net;
return 0;
@ -474,7 +475,7 @@ static int bts_model_nanobts_start(struct gsm_network *net)
int bts_model_nanobts_init(void)
{
return gsm_bts_model_register(&model_nanobts);
return gsm_bts_model_register(&bts_model_nanobts);
}
#define OML_UP 0x0001

View File

@ -0,0 +1,71 @@
/* sysmocom sysmoBTS specific code */
/* (C) 2010-2012 by Harald Welte <laforge@gnumonks.org>
*
* 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 <arpa/inet.h>
#include <osmocom/gsm/tlv.h>
#include <openbsc/gsm_data.h>
#include <openbsc/signal.h>
#include <openbsc/abis_nm.h>
#include <osmocom/abis/e1_input.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
#include <openbsc/gsm_data.h>
#include <openbsc/abis_nm.h>
#include <openbsc/abis_rsl.h>
#include <openbsc/debug.h>
#include <osmocom/abis/subchan_demux.h>
#include <osmocom/abis/ipaccess.h>
#include <osmocom/core/logging.h>
extern int bts_ipa_nm_sig_cb(unsigned int subsys, unsigned int signal,
void *handler_data, void *signal_data);
extern struct gsm_bts_model bts_model_nanobts;
static struct gsm_bts_model model_sysmobts;
static int bts_model_sysmobts_start(struct gsm_network *net)
{
model_sysmobts.features.data = &model_sysmobts._features_data[0];
model_sysmobts.features.data_len =
sizeof(model_sysmobts._features_data);
gsm_btsmodel_set_feature(&model_sysmobts, BTS_FEAT_GPRS);
gsm_btsmodel_set_feature(&model_sysmobts, BTS_FEAT_EGPRS);
osmo_signal_register_handler(SS_NM, bts_ipa_nm_sig_cb, NULL);
return 0;
}
int bts_model_sysmobts_init(void)
{
memcpy(&model_sysmobts, &bts_model_nanobts, sizeof(model_sysmobts));
model_sysmobts.name = "sysmobts";
model_sysmobts.start = bts_model_sysmobts_start;
model_sysmobts.type = GSM_BTS_TYPE_OSMO_SYSMO;
return gsm_bts_model_register(&model_sysmobts);
}

View File

@ -185,6 +185,7 @@ int e1_reconfig_bts(struct gsm_bts *bts)
/* skip signal link initialization, this is done later for these BTS. */
if (bts->type == GSM_BTS_TYPE_NANOBTS ||
bts->type == GSM_BTS_TYPE_OSMO_SYSMO ||
bts->type == GSM_BTS_TYPE_HSL_FEMTO)
return e1inp_line_update(line);

View File

@ -470,6 +470,7 @@ static int generate_si5(uint8_t *output, struct gsm_bts *bts)
/* ip.access nanoBTS needs l2_plen!! */
switch (bts->type) {
case GSM_BTS_TYPE_NANOBTS:
case GSM_BTS_TYPE_OSMO_SYSMO:
case GSM_BTS_TYPE_HSL_FEMTO:
*output++ = (l2_plen << 2) | 1;
l2_plen++;
@ -505,6 +506,7 @@ static int generate_si5bis(uint8_t *output, struct gsm_bts *bts)
/* ip.access nanoBTS needs l2_plen!! */
switch (bts->type) {
case GSM_BTS_TYPE_NANOBTS:
case GSM_BTS_TYPE_OSMO_SYSMO:
case GSM_BTS_TYPE_HSL_FEMTO:
*output++ = (l2_plen << 2) | 1;
l2_plen++;
@ -549,6 +551,7 @@ static int generate_si5ter(uint8_t *output, struct gsm_bts *bts)
/* ip.access nanoBTS needs l2_plen!! */
switch (bts->type) {
case GSM_BTS_TYPE_NANOBTS:
case GSM_BTS_TYPE_OSMO_SYSMO:
case GSM_BTS_TYPE_HSL_FEMTO:
*output++ = (l2_plen << 2) | 1;
l2_plen++;
@ -585,6 +588,7 @@ static int generate_si6(uint8_t *output, struct gsm_bts *bts)
/* ip.access nanoBTS needs l2_plen!! */
switch (bts->type) {
case GSM_BTS_TYPE_NANOBTS:
case GSM_BTS_TYPE_OSMO_SYSMO:
case GSM_BTS_TYPE_HSL_FEMTO:
*output++ = (l2_plen << 2) | 1;
l2_plen++;

View File

@ -189,6 +189,7 @@ static const struct value_string bts_types[] = {
{ GSM_BTS_TYPE_RBS2000, "rbs2000" },
{ GSM_BTS_TYPE_HSL_FEMTO, "hsl_femto" },
{ GSM_BTS_TYPE_NOKIA_SITE, "nokia_site" },
{ GSM_BTS_TYPE_OSMO_SYSMO, "sysmobts" },
{ 0, NULL }
};
@ -338,6 +339,7 @@ int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type)
case GSM_BTS_TYPE_HSL_FEMTO:
bts->c0->rsl_tei = 0;
case GSM_BTS_TYPE_NANOBTS:
case GSM_BTS_TYPE_OSMO_SYSMO:
/* Set the default OML Stream ID to 0xff */
bts->oml_tei = 0xff;
bts->c0->nominal_power = 23;

View File

@ -1500,6 +1500,7 @@ static int tch_map(struct gsm_lchan *lchan, struct gsm_lchan *remote_lchan)
// todo: map between different bts types
switch (bts->type) {
case GSM_BTS_TYPE_NANOBTS:
case GSM_BTS_TYPE_OSMO_SYSMO:
if (!ipacc_rtp_direct) {
/* connect the TCH's to our RTP proxy */
rc = rsl_ipacc_mdcx_to_rtpsock(lchan);
@ -1571,6 +1572,7 @@ static int tch_recv_mncc(struct gsm_network *net, uint32_t callref, int enable)
switch (bts->type) {
case GSM_BTS_TYPE_NANOBTS:
case GSM_BTS_TYPE_OSMO_SYSMO:
if (ipacc_rtp_direct) {
LOGP(DCC, LOGL_ERROR, "Error: RTP proxy is disabled\n");
return -EINVAL;
@ -2879,6 +2881,7 @@ int mncc_tx_to_cc(struct gsm_network *net, int msg_type, void *arg)
bts = trans->conn->lchan->ts->trx->bts;
switch (bts->type) {
case GSM_BTS_TYPE_NANOBTS:
case GSM_BTS_TYPE_OSMO_SYSMO:
if (!trans->conn->lchan->abis_ip.rtp_socket) {
DEBUGP(DMNCC, "TCH frame to lchan without RTP connection\n");
return 0;