2011-03-04 12:41:31 +00:00
|
|
|
/* OpenBSC support code for HSL Femtocell */
|
|
|
|
|
|
|
|
/* (C) 2011 by Harald Welte <laforge@gnumonks.org>
|
|
|
|
* (C) 2011 by OnWaves
|
|
|
|
*
|
|
|
|
* 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>
|
|
|
|
|
2011-03-22 15:47:59 +00:00
|
|
|
#include <osmocom/gsm/tlv.h>
|
2011-03-04 12:41:31 +00:00
|
|
|
#include <openbsc/gsm_data.h>
|
|
|
|
#include <openbsc/abis_nm.h>
|
|
|
|
#include <openbsc/abis_rsl.h>
|
|
|
|
#include <openbsc/signal.h>
|
|
|
|
#include <openbsc/e1_input.h>
|
|
|
|
|
bsc: on-demand setup of nanoBTS and HSL femto sockets
The daemons set up nanoBTS and HSL femto sockets by default, ie. the
three sockets to support these two drivers are open even if we have
no BTS of that kind.
This patch enables on-demand socket creation, ie. we only enable them
if we have one BTS at least that requires it.
I added two new attributes to the gsm_bts object, they are:
* the start() function includes the code that we need to run to start
the BTS. This new function contains the socket creation in the
particular case of nanoBTS and HSL femto.
* the started boolean, which is used to know if we have already
started the BTS, ie. we have already invoked start().
Note that, I have splitted the bts_model_*_init() function into two
functions, the _init() functions that register the BTS driver
and the _start() functions that start BTS driver on-demand.
While I was at it, I added several changes/cleanups to this patch:
* Group all bts_model_*_init() calls into one function bts_init(),
which is called in the initialization path of osmo-nitb and
osmo-bsc.
* Add openbsc/bss.h that contains the declaration of
bsc_bootstrap_network, bsc_shutdown_net and bts_init.
* Add missing e1inp_init() in osmo-bsc.
* Fix missing declaration of hsl_setup in openbsc/e1_input.h
2011-05-14 09:32:48 +00:00
|
|
|
static int bts_model_hslfemto_start(struct gsm_network *net);
|
|
|
|
|
2011-03-04 12:41:31 +00:00
|
|
|
static struct gsm_bts_model model_hslfemto = {
|
|
|
|
.type = GSM_BTS_TYPE_HSL_FEMTO,
|
bsc: on-demand setup of nanoBTS and HSL femto sockets
The daemons set up nanoBTS and HSL femto sockets by default, ie. the
three sockets to support these two drivers are open even if we have
no BTS of that kind.
This patch enables on-demand socket creation, ie. we only enable them
if we have one BTS at least that requires it.
I added two new attributes to the gsm_bts object, they are:
* the start() function includes the code that we need to run to start
the BTS. This new function contains the socket creation in the
particular case of nanoBTS and HSL femto.
* the started boolean, which is used to know if we have already
started the BTS, ie. we have already invoked start().
Note that, I have splitted the bts_model_*_init() function into two
functions, the _init() functions that register the BTS driver
and the _start() functions that start BTS driver on-demand.
While I was at it, I added several changes/cleanups to this patch:
* Group all bts_model_*_init() calls into one function bts_init(),
which is called in the initialization path of osmo-nitb and
osmo-bsc.
* Add openbsc/bss.h that contains the declaration of
bsc_bootstrap_network, bsc_shutdown_net and bts_init.
* Add missing e1inp_init() in osmo-bsc.
* Fix missing declaration of hsl_setup in openbsc/e1_input.h
2011-05-14 09:32:48 +00:00
|
|
|
.start = bts_model_hslfemto_start,
|
2011-03-04 12:41:31 +00:00
|
|
|
.nm_att_tlvdef = {
|
|
|
|
.def = {
|
|
|
|
/* no HSL specific OML attributes that we know of */
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static const uint8_t l1_msg[] = {
|
2011-01-15 17:07:34 +00:00
|
|
|
#ifdef HSL_SR_1_0
|
2011-03-04 12:41:31 +00:00
|
|
|
0x80, 0x8a,
|
2011-01-15 17:07:34 +00:00
|
|
|
#else
|
|
|
|
0x81, 0x8a,
|
|
|
|
#endif
|
2011-03-04 12:41:31 +00:00
|
|
|
0xC4, 0x0b,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const uint8_t conn_trau_msg[] = {
|
2011-01-15 17:07:34 +00:00
|
|
|
#ifdef HSL_SR_1_0
|
2011-03-04 12:41:31 +00:00
|
|
|
0x80, 0x81,
|
2011-01-15 17:07:34 +00:00
|
|
|
#else
|
|
|
|
0x81, 0x81,
|
|
|
|
#endif
|
2011-03-04 12:41:31 +00:00
|
|
|
0xC1, 16,
|
|
|
|
0x02, 0x00, 0x00, 0x00, 0xC0, 0xA8, 0xEA, 0x01,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
|
|
};
|
|
|
|
|
|
|
|
static const uint8_t conn_trau_msg2[] = {
|
2011-01-15 17:07:34 +00:00
|
|
|
#ifdef HSL_SR_1_0
|
2011-03-04 12:41:31 +00:00
|
|
|
0x80, 0x81,
|
2011-01-15 17:07:34 +00:00
|
|
|
#else
|
|
|
|
0x81, 0x81,
|
|
|
|
#endif
|
2011-03-04 12:41:31 +00:00
|
|
|
0xC1, 16,
|
|
|
|
0x02, 0x00, 0xd4, 0x07, 0xC0, 0xA8, 0xEA, 0x01,
|
|
|
|
0x38, 0xA4, 0x45, 0x00, 0x04, 0x59, 0x40, 0x00
|
|
|
|
};
|
|
|
|
|
|
|
|
static uint8_t oml_arfcn_bsic[] = {
|
2011-01-14 22:18:59 +00:00
|
|
|
#ifdef HSL_SR_1_0
|
2011-03-04 12:41:31 +00:00
|
|
|
0x81, 0x80, 0x00, 10,
|
2011-01-14 22:18:59 +00:00
|
|
|
#else
|
|
|
|
0x80, 0x80, 0x00, 10,
|
|
|
|
#endif
|
2011-03-04 12:41:31 +00:00
|
|
|
NM_MT_SET_BTS_ATTR, NM_OC_BTS, 0xff, 0xff, 0xff,
|
|
|
|
NM_ATT_BCCH_ARFCN, 0x03, 0x67,
|
|
|
|
NM_ATT_BSIC, 0x00
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct msgb *hsl_alloc_msgb(void)
|
|
|
|
{
|
|
|
|
return msgb_alloc_headroom(1024, 127, "HSL");
|
|
|
|
}
|
|
|
|
|
|
|
|
static int hslfemto_bootstrap_om(struct gsm_bts *bts)
|
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
uint8_t *cur;
|
|
|
|
|
|
|
|
msg = hsl_alloc_msgb();
|
|
|
|
cur = msgb_put(msg, sizeof(l1_msg));
|
|
|
|
memcpy(msg->data, l1_msg, sizeof(l1_msg));
|
|
|
|
msg->trx = bts->c0;
|
|
|
|
abis_rsl_sendmsg(msg);
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
msg = hsl_alloc_msgb();
|
|
|
|
cur = msgb_put(msg, sizeof(conn_trau_msg));
|
|
|
|
memcpy(msg->data, conn_trau_msg, sizeof(conn_trau_msg));
|
|
|
|
msg->trx = bts->c0;
|
|
|
|
abis_rsl_sendmsg(msg);
|
|
|
|
#endif
|
|
|
|
msg = hsl_alloc_msgb();
|
|
|
|
cur = msgb_put(msg, sizeof(conn_trau_msg2));
|
|
|
|
memcpy(msg->data, conn_trau_msg2, sizeof(conn_trau_msg2));
|
|
|
|
msg->trx = bts->c0;
|
|
|
|
abis_rsl_sendmsg(msg);
|
|
|
|
|
|
|
|
*((uint16_t *)oml_arfcn_bsic+10) = htons(bts->c0->arfcn);
|
|
|
|
oml_arfcn_bsic[13] = bts->bsic;
|
|
|
|
|
|
|
|
msg = hsl_alloc_msgb();
|
|
|
|
cur = msgb_put(msg, sizeof(oml_arfcn_bsic));
|
|
|
|
memcpy(msg->data, oml_arfcn_bsic, sizeof(oml_arfcn_bsic));
|
|
|
|
msg->trx = bts->c0;
|
|
|
|
_abis_nm_sendmsg(msg, 0);
|
|
|
|
|
|
|
|
/* Delay the OPSTART until after SI have been set via RSL */
|
|
|
|
//abis_nm_opstart(bts, NM_OC_BTS, 255, 255, 255);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Callback function to be called every time we receive a signal from INPUT */
|
|
|
|
static int inp_sig_cb(unsigned int subsys, unsigned int signal,
|
|
|
|
void *handler_data, void *signal_data)
|
|
|
|
{
|
|
|
|
struct input_signal_data *isd = signal_data;
|
|
|
|
|
|
|
|
if (subsys != SS_INPUT)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (signal) {
|
|
|
|
case S_INP_TEI_UP:
|
|
|
|
switch (isd->link_type) {
|
|
|
|
case E1INP_SIGN_OML:
|
2011-03-05 15:24:20 +00:00
|
|
|
if (isd->trx->bts->type == GSM_BTS_TYPE_HSL_FEMTO)
|
|
|
|
hslfemto_bootstrap_om(isd->trx->bts);
|
2011-03-04 12:41:31 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
bsc: on-demand setup of nanoBTS and HSL femto sockets
The daemons set up nanoBTS and HSL femto sockets by default, ie. the
three sockets to support these two drivers are open even if we have
no BTS of that kind.
This patch enables on-demand socket creation, ie. we only enable them
if we have one BTS at least that requires it.
I added two new attributes to the gsm_bts object, they are:
* the start() function includes the code that we need to run to start
the BTS. This new function contains the socket creation in the
particular case of nanoBTS and HSL femto.
* the started boolean, which is used to know if we have already
started the BTS, ie. we have already invoked start().
Note that, I have splitted the bts_model_*_init() function into two
functions, the _init() functions that register the BTS driver
and the _start() functions that start BTS driver on-demand.
While I was at it, I added several changes/cleanups to this patch:
* Group all bts_model_*_init() calls into one function bts_init(),
which is called in the initialization path of osmo-nitb and
osmo-bsc.
* Add openbsc/bss.h that contains the declaration of
bsc_bootstrap_network, bsc_shutdown_net and bts_init.
* Add missing e1inp_init() in osmo-bsc.
* Fix missing declaration of hsl_setup in openbsc/e1_input.h
2011-05-14 09:32:48 +00:00
|
|
|
static int bts_model_hslfemto_start(struct gsm_network *net)
|
2011-03-04 12:41:31 +00:00
|
|
|
{
|
|
|
|
model_hslfemto.features.data = &model_hslfemto._features_data[0];
|
|
|
|
model_hslfemto.features.data_len = sizeof(model_hslfemto._features_data);
|
|
|
|
|
|
|
|
gsm_btsmodel_set_feature(&model_hslfemto, BTS_FEAT_GPRS);
|
|
|
|
gsm_btsmodel_set_feature(&model_hslfemto, BTS_FEAT_EGPRS);
|
|
|
|
|
2011-05-06 10:12:31 +00:00
|
|
|
osmo_signal_register_handler(SS_INPUT, inp_sig_cb, NULL);
|
2011-03-04 12:41:31 +00:00
|
|
|
|
bsc: on-demand setup of nanoBTS and HSL femto sockets
The daemons set up nanoBTS and HSL femto sockets by default, ie. the
three sockets to support these two drivers are open even if we have
no BTS of that kind.
This patch enables on-demand socket creation, ie. we only enable them
if we have one BTS at least that requires it.
I added two new attributes to the gsm_bts object, they are:
* the start() function includes the code that we need to run to start
the BTS. This new function contains the socket creation in the
particular case of nanoBTS and HSL femto.
* the started boolean, which is used to know if we have already
started the BTS, ie. we have already invoked start().
Note that, I have splitted the bts_model_*_init() function into two
functions, the _init() functions that register the BTS driver
and the _start() functions that start BTS driver on-demand.
While I was at it, I added several changes/cleanups to this patch:
* Group all bts_model_*_init() calls into one function bts_init(),
which is called in the initialization path of osmo-nitb and
osmo-bsc.
* Add openbsc/bss.h that contains the declaration of
bsc_bootstrap_network, bsc_shutdown_net and bts_init.
* Add missing e1inp_init() in osmo-bsc.
* Fix missing declaration of hsl_setup in openbsc/e1_input.h
2011-05-14 09:32:48 +00:00
|
|
|
/* Call A-bis input driver, start socket for OML and RSL. */
|
|
|
|
return hsl_setup(net);
|
|
|
|
}
|
|
|
|
|
|
|
|
int bts_model_hslfemto_init(void)
|
|
|
|
{
|
2011-03-04 12:41:31 +00:00
|
|
|
return gsm_bts_model_register(&model_hslfemto);
|
|
|
|
}
|