2009-08-17 04:55:10 +00:00
|
|
|
/* A hackish minimal BSC (+MSC +HLR) implementation */
|
|
|
|
|
2010-05-16 18:52:23 +00:00
|
|
|
/* (C) 2008-2010 by Harald Welte <laforge@gnumonks.org>
|
2009-08-17 04:55:10 +00:00
|
|
|
* (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
|
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2011-01-01 14:25:50 +00:00
|
|
|
* 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
|
2009-08-17 04:55:10 +00:00
|
|
|
* (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
|
2011-01-01 14:25:50 +00:00
|
|
|
* GNU Affero General Public License for more details.
|
2009-08-17 04:55:10 +00:00
|
|
|
*
|
2011-01-01 14:25:50 +00:00
|
|
|
* 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/>.
|
2009-08-17 04:55:10 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-09-04 13:15:32 +00:00
|
|
|
#include <osmocom/bsc/gsm_data.h>
|
2011-03-22 15:47:59 +00:00
|
|
|
#include <osmocom/gsm/gsm_utils.h>
|
2017-09-04 13:15:32 +00:00
|
|
|
#include <osmocom/bsc/abis_rsl.h>
|
|
|
|
#include <osmocom/bsc/abis_nm.h>
|
|
|
|
#include <osmocom/bsc/debug.h>
|
|
|
|
#include <osmocom/bsc/misdn.h>
|
2010-05-19 17:45:32 +00:00
|
|
|
#include <osmocom/vty/telnet_interface.h>
|
2014-08-24 15:54:49 +00:00
|
|
|
#include <osmocom/vty/ports.h>
|
2017-09-04 13:15:32 +00:00
|
|
|
#include <osmocom/bsc/system_information.h>
|
|
|
|
#include <osmocom/bsc/paging.h>
|
|
|
|
#include <osmocom/bsc/signal.h>
|
|
|
|
#include <osmocom/bsc/chan_alloc.h>
|
2011-03-22 15:47:59 +00:00
|
|
|
#include <osmocom/core/talloc.h>
|
2017-09-04 13:15:32 +00:00
|
|
|
#include <osmocom/bsc/ipaccess.h>
|
2011-09-05 22:09:50 +00:00
|
|
|
#include <osmocom/gsm/sysinfo.h>
|
2017-09-04 13:15:32 +00:00
|
|
|
#include <osmocom/bsc/e1_config.h>
|
|
|
|
#include <osmocom/bsc/common_bsc.h>
|
|
|
|
#include <osmocom/bsc/pcu_if.h>
|
2017-10-10 12:50:35 +00:00
|
|
|
|
|
|
|
#include <time.h>
|
2016-10-26 13:19:41 +00:00
|
|
|
#include <limits.h>
|
2017-10-09 15:12:53 +00:00
|
|
|
#include <stdbool.h>
|
2009-08-17 04:55:10 +00:00
|
|
|
|
|
|
|
/* global pointer to the gsm network data structure */
|
|
|
|
extern struct gsm_network *bsc_gsmnet;
|
|
|
|
|
|
|
|
/* Callback function for NACK on the OML NM */
|
2010-07-13 18:08:35 +00:00
|
|
|
static int oml_msg_nack(struct nm_nack_signal_data *nack)
|
2009-08-17 04:55:10 +00:00
|
|
|
{
|
2017-03-16 12:57:47 +00:00
|
|
|
if (nack->mt == NM_MT_GET_ATTR_NACK) {
|
|
|
|
LOGP(DNM, LOGL_ERROR, "BTS%u does not support Get Attributes "
|
|
|
|
"OML message.\n", nack->bts->nr);
|
|
|
|
return 0;
|
2011-05-20 22:05:09 +00:00
|
|
|
}
|
|
|
|
|
2017-03-16 12:57:47 +00:00
|
|
|
if (nack->mt == NM_MT_SET_BTS_ATTR_NACK)
|
|
|
|
LOGP(DNM, LOGL_ERROR, "Failed to set BTS attributes. That is fatal. "
|
|
|
|
"Was the bts type and frequency properly specified?\n");
|
|
|
|
else
|
|
|
|
LOGP(DNM, LOGL_ERROR, "Got %s NACK going to drop the OML links.\n",
|
|
|
|
abis_nm_nack_name(nack->mt));
|
2011-05-20 22:05:09 +00:00
|
|
|
|
2012-11-11 17:26:23 +00:00
|
|
|
if (!nack->bts) {
|
|
|
|
LOGP(DNM, LOGL_ERROR, "Unknown bts. Can not drop it.\n");
|
2012-10-05 13:48:54 +00:00
|
|
|
return 0;
|
2012-11-11 17:26:23 +00:00
|
|
|
}
|
2012-10-05 13:48:54 +00:00
|
|
|
|
2012-11-11 17:26:23 +00:00
|
|
|
if (is_ipaccess_bts(nack->bts))
|
|
|
|
ipaccess_drop_oml(nack->bts);
|
2009-08-17 04:55:10 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Callback function to be called every time we receive a signal from NM */
|
|
|
|
static int nm_sig_cb(unsigned int subsys, unsigned int signal,
|
|
|
|
void *handler_data, void *signal_data)
|
|
|
|
{
|
2010-07-13 18:08:35 +00:00
|
|
|
struct nm_nack_signal_data *nack;
|
2009-11-17 05:09:56 +00:00
|
|
|
|
2009-08-17 04:55:10 +00:00
|
|
|
switch (signal) {
|
|
|
|
case S_NM_NACK:
|
2010-07-13 18:08:35 +00:00
|
|
|
nack = signal_data;
|
|
|
|
return oml_msg_nack(nack);
|
2009-08-17 04:55:10 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int bsc_shutdown_net(struct gsm_network *net)
|
|
|
|
{
|
|
|
|
struct gsm_bts *bts;
|
|
|
|
|
|
|
|
llist_for_each_entry(bts, &net->bts_list, list) {
|
2011-01-14 14:55:42 +00:00
|
|
|
LOGP(DNM, LOGL_NOTICE, "shutting down OML for BTS %u\n", bts->nr);
|
src: port openBSC over libosmo-abis
This is a big patch that ports openBSC over libosmo-abis.
Sorry, the changes that are included here are all dependent
of libosmo-abis, splitting them into smaller pieces would
leave the repository in some intermediate state, which is
not desired.
The main changes are:
- The directory libabis/ has been removed as it now lives in
libosmo-abis.
- new configuration file format for nanoBTS and HSL femto, we
need to define the virtual e1_line and attach it to the OML
link.
- all the existing BTS drivers (nanoBTS, hsl femto, Nokia site,
BS11 and rbs2000) now use the new libosmo-abis framework.
- use r232 input driver available in libosmo-abis for bs11_config.
- use ipa_msg_recv instead of old ipaccess_read_msg function.
- delete definition of gsm_e1_subslot and input_signal_data.
These structures now lives in libosmo-abis.
Most of this patch are deletions of libabis/ which has been
moved to libosmo-abis.
This patch also modifies openBSC to use all the new definitions
available in libosmocore and libosmo-abis. In order to do that,
we have replaced the following:
- DINP, DMI, DMIB and DMUX by their respective DL* correspondences.
- SS_GLOBAL by SS_L_GLOBAL
- SS_INPUT by SS_L_INPUT
- S_GLOBAL_SHUTDOWN by S_L_GLOBAL_SHUTDOWN
- SS_INPUT by SS_L_INPUT
- S_INP_* by S_L_INP_* sub-signals
- E1INP_NODE by L_E1INP_NODE vty node
This patch has been tested with:
- one nanoBTS
- the HSL femto with the examples available under libosmo-abis
- BS11 with both dahdi and misdn drivers.
2011-08-17 20:44:07 +00:00
|
|
|
osmo_signal_dispatch(SS_L_GLOBAL, S_GLOBAL_BTS_CLOSE_OM, bts);
|
2009-08-17 04:55:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-10-10 12:50:35 +00:00
|
|
|
unsigned long long bts_uptime(const struct gsm_bts *bts)
|
|
|
|
{
|
|
|
|
struct timespec tp;
|
|
|
|
|
|
|
|
if (!bts->uptime || !bts->oml_link) {
|
|
|
|
LOGP(DNM, LOGL_ERROR, "BTS %u OML link uptime unavailable\n", bts->nr);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (clock_gettime(CLOCK_MONOTONIC, &tp) != 0) {
|
|
|
|
LOGP(DNM, LOGL_ERROR, "BTS %u uptime computation failure: %s\n", bts->nr, strerror(errno));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* monotonic clock helps to ensure that the conversion is valid */
|
|
|
|
return difftime(tp.tv_sec, bts->uptime);
|
|
|
|
}
|
|
|
|
|
Improved generation of SYSTEM INFORMATIONs 2* and 5* for neighbour bands
In addition to SI 2 and SI 5, the SI 2ter and 2bis is generated, if
neighbour cells in other bands exist. Also it is indicated in the rest
octets of SI3, that SI 2ter is used. If no neighbour cell in a different
band exists, the SI 2ter and SI 5ter is omitted.
A special case is P-GSM range (channels 1-124). To be compatible with
older phones, SI 2bis and SI 5bis is used. If the BCCH lays inside the
P-GSM band, only neighbour cells of the P-GSM range are included in
SI 2 and SI 5. If neighbour cells exist in the same band (900), but lay
outside the P-GSM range, the SI 2bis and SI 5bis is used to extend the
list of neighbour cells. The extension is also indicated in SI 2 and
SI 5. If the BCCH lays inside the P-GSM range, but no neighbour cell
exists in the same band outside the P-GSM range, the SI 2bis ans SI 5bis
are omitted.
2012-02-29 08:04:07 +00:00
|
|
|
static int rsl_si(struct gsm_bts_trx *trx, enum osmo_sysinfo_type i, int si_len)
|
2010-06-15 14:44:12 +00:00
|
|
|
{
|
|
|
|
struct gsm_bts *bts = trx->bts;
|
2017-06-15 13:10:53 +00:00
|
|
|
int rc, j;
|
2010-06-15 14:44:12 +00:00
|
|
|
|
2017-07-15 21:23:58 +00:00
|
|
|
if (si_len) {
|
|
|
|
DEBUGP(DRR, "SI%s: %s\n", get_value_string(osmo_sitype_strs, i),
|
|
|
|
osmo_hexdump(GSM_BTS_SI(bts, i), GSM_MACBLOCK_LEN));
|
|
|
|
} else
|
|
|
|
DEBUGP(DRR, "SI%s: OFF\n", get_value_string(osmo_sitype_strs, i));
|
2010-06-15 14:44:12 +00:00
|
|
|
|
|
|
|
switch (i) {
|
|
|
|
case SYSINFO_TYPE_5:
|
|
|
|
case SYSINFO_TYPE_5bis:
|
|
|
|
case SYSINFO_TYPE_5ter:
|
|
|
|
case SYSINFO_TYPE_6:
|
2013-07-03 14:06:20 +00:00
|
|
|
rc = rsl_sacch_filling(trx, osmo_sitype2rsl(i),
|
2017-07-15 21:23:58 +00:00
|
|
|
si_len ? GSM_BTS_SI(bts, i) : NULL, si_len);
|
2010-06-15 14:44:12 +00:00
|
|
|
break;
|
2017-06-15 13:10:53 +00:00
|
|
|
case SYSINFO_TYPE_2quater:
|
2017-07-15 21:23:58 +00:00
|
|
|
if (si_len == 0) {
|
|
|
|
rc = rsl_bcch_info(trx, i, NULL, 0);
|
|
|
|
break;
|
|
|
|
}
|
2017-11-21 13:38:18 +00:00
|
|
|
rc = 0;
|
2017-06-15 13:10:53 +00:00
|
|
|
for (j = 0; j <= bts->si2q_count; j++)
|
|
|
|
rc = rsl_bcch_info(trx, i, (const uint8_t *)GSM_BTS_SI2Q(bts, j), GSM_MACBLOCK_LEN);
|
|
|
|
break;
|
2010-06-15 14:44:12 +00:00
|
|
|
default:
|
2017-07-15 21:23:58 +00:00
|
|
|
rc = rsl_bcch_info(trx, i, si_len ? GSM_BTS_SI(bts, i) : NULL, si_len);
|
2010-06-15 14:44:12 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2015-05-30 18:40:54 +00:00
|
|
|
/* set all system information types for a TRX */
|
2014-11-21 10:18:45 +00:00
|
|
|
int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx)
|
2009-08-17 04:55:10 +00:00
|
|
|
{
|
2009-12-01 12:34:30 +00:00
|
|
|
int i, rc;
|
2009-12-21 22:12:19 +00:00
|
|
|
struct gsm_bts *bts = trx->bts;
|
Improved generation of SYSTEM INFORMATIONs 2* and 5* for neighbour bands
In addition to SI 2 and SI 5, the SI 2ter and 2bis is generated, if
neighbour cells in other bands exist. Also it is indicated in the rest
octets of SI3, that SI 2ter is used. If no neighbour cell in a different
band exists, the SI 2ter and SI 5ter is omitted.
A special case is P-GSM range (channels 1-124). To be compatible with
older phones, SI 2bis and SI 5bis is used. If the BCCH lays inside the
P-GSM band, only neighbour cells of the P-GSM range are included in
SI 2 and SI 5. If neighbour cells exist in the same band (900), but lay
outside the P-GSM range, the SI 2bis and SI 5bis is used to extend the
list of neighbour cells. The extension is also indicated in SI 2 and
SI 5. If the BCCH lays inside the P-GSM range, but no neighbour cell
exists in the same band outside the P-GSM range, the SI 2bis ans SI 5bis
are omitted.
2012-02-29 08:04:07 +00:00
|
|
|
uint8_t gen_si[_MAX_SYSINFO_TYPE], n_si = 0, n;
|
|
|
|
int si_len[_MAX_SYSINFO_TYPE];
|
2009-12-21 22:12:19 +00:00
|
|
|
|
|
|
|
bts->si_common.cell_sel_par.ms_txpwr_max_ccch =
|
|
|
|
ms_pwr_ctl_lvl(bts->band, bts->ms_max_power);
|
|
|
|
bts->si_common.cell_sel_par.neci = bts->network->neci;
|
2009-08-17 04:55:10 +00:00
|
|
|
|
2017-07-15 20:52:01 +00:00
|
|
|
/* Zero/forget the state of the dynamically computed SIs, leeping the static ones */
|
|
|
|
bts->si_valid = bts->si_mode_static;
|
2017-06-15 12:59:20 +00:00
|
|
|
|
2010-07-30 09:50:09 +00:00
|
|
|
/* First, we determine which of the SI messages we actually need */
|
|
|
|
|
2010-06-15 14:44:12 +00:00
|
|
|
if (trx == bts->c0) {
|
2010-07-30 09:50:09 +00:00
|
|
|
/* 1...4 are always present on a C0 TRX */
|
Improved generation of SYSTEM INFORMATIONs 2* and 5* for neighbour bands
In addition to SI 2 and SI 5, the SI 2ter and 2bis is generated, if
neighbour cells in other bands exist. Also it is indicated in the rest
octets of SI3, that SI 2ter is used. If no neighbour cell in a different
band exists, the SI 2ter and SI 5ter is omitted.
A special case is P-GSM range (channels 1-124). To be compatible with
older phones, SI 2bis and SI 5bis is used. If the BCCH lays inside the
P-GSM band, only neighbour cells of the P-GSM range are included in
SI 2 and SI 5. If neighbour cells exist in the same band (900), but lay
outside the P-GSM range, the SI 2bis and SI 5bis is used to extend the
list of neighbour cells. The extension is also indicated in SI 2 and
SI 5. If the BCCH lays inside the P-GSM range, but no neighbour cell
exists in the same band outside the P-GSM range, the SI 2bis ans SI 5bis
are omitted.
2012-02-29 08:04:07 +00:00
|
|
|
gen_si[n_si++] = SYSINFO_TYPE_1;
|
|
|
|
gen_si[n_si++] = SYSINFO_TYPE_2;
|
|
|
|
gen_si[n_si++] = SYSINFO_TYPE_2bis;
|
|
|
|
gen_si[n_si++] = SYSINFO_TYPE_2ter;
|
2016-04-15 14:04:44 +00:00
|
|
|
gen_si[n_si++] = SYSINFO_TYPE_2quater;
|
Improved generation of SYSTEM INFORMATIONs 2* and 5* for neighbour bands
In addition to SI 2 and SI 5, the SI 2ter and 2bis is generated, if
neighbour cells in other bands exist. Also it is indicated in the rest
octets of SI3, that SI 2ter is used. If no neighbour cell in a different
band exists, the SI 2ter and SI 5ter is omitted.
A special case is P-GSM range (channels 1-124). To be compatible with
older phones, SI 2bis and SI 5bis is used. If the BCCH lays inside the
P-GSM band, only neighbour cells of the P-GSM range are included in
SI 2 and SI 5. If neighbour cells exist in the same band (900), but lay
outside the P-GSM range, the SI 2bis and SI 5bis is used to extend the
list of neighbour cells. The extension is also indicated in SI 2 and
SI 5. If the BCCH lays inside the P-GSM range, but no neighbour cell
exists in the same band outside the P-GSM range, the SI 2bis ans SI 5bis
are omitted.
2012-02-29 08:04:07 +00:00
|
|
|
gen_si[n_si++] = SYSINFO_TYPE_3;
|
|
|
|
gen_si[n_si++] = SYSINFO_TYPE_4;
|
2010-07-30 09:50:09 +00:00
|
|
|
|
|
|
|
/* 13 is always present on a C0 TRX of a GPRS BTS */
|
|
|
|
if (bts->gprs.mode != BTS_GPRS_NONE)
|
Improved generation of SYSTEM INFORMATIONs 2* and 5* for neighbour bands
In addition to SI 2 and SI 5, the SI 2ter and 2bis is generated, if
neighbour cells in other bands exist. Also it is indicated in the rest
octets of SI3, that SI 2ter is used. If no neighbour cell in a different
band exists, the SI 2ter and SI 5ter is omitted.
A special case is P-GSM range (channels 1-124). To be compatible with
older phones, SI 2bis and SI 5bis is used. If the BCCH lays inside the
P-GSM band, only neighbour cells of the P-GSM range are included in
SI 2 and SI 5. If neighbour cells exist in the same band (900), but lay
outside the P-GSM range, the SI 2bis and SI 5bis is used to extend the
list of neighbour cells. The extension is also indicated in SI 2 and
SI 5. If the BCCH lays inside the P-GSM range, but no neighbour cell
exists in the same band outside the P-GSM range, the SI 2bis ans SI 5bis
are omitted.
2012-02-29 08:04:07 +00:00
|
|
|
gen_si[n_si++] = SYSINFO_TYPE_13;
|
2009-12-21 16:02:32 +00:00
|
|
|
}
|
|
|
|
|
2010-07-30 09:50:09 +00:00
|
|
|
/* 5 and 6 are always present on every TRX */
|
Improved generation of SYSTEM INFORMATIONs 2* and 5* for neighbour bands
In addition to SI 2 and SI 5, the SI 2ter and 2bis is generated, if
neighbour cells in other bands exist. Also it is indicated in the rest
octets of SI3, that SI 2ter is used. If no neighbour cell in a different
band exists, the SI 2ter and SI 5ter is omitted.
A special case is P-GSM range (channels 1-124). To be compatible with
older phones, SI 2bis and SI 5bis is used. If the BCCH lays inside the
P-GSM band, only neighbour cells of the P-GSM range are included in
SI 2 and SI 5. If neighbour cells exist in the same band (900), but lay
outside the P-GSM range, the SI 2bis and SI 5bis is used to extend the
list of neighbour cells. The extension is also indicated in SI 2 and
SI 5. If the BCCH lays inside the P-GSM range, but no neighbour cell
exists in the same band outside the P-GSM range, the SI 2bis ans SI 5bis
are omitted.
2012-02-29 08:04:07 +00:00
|
|
|
gen_si[n_si++] = SYSINFO_TYPE_5;
|
|
|
|
gen_si[n_si++] = SYSINFO_TYPE_5bis;
|
|
|
|
gen_si[n_si++] = SYSINFO_TYPE_5ter;
|
|
|
|
gen_si[n_si++] = SYSINFO_TYPE_6;
|
|
|
|
|
|
|
|
/* Second, we generate the selected SI via RSL */
|
|
|
|
|
|
|
|
for (n = 0; n < n_si; n++) {
|
|
|
|
i = gen_si[n];
|
|
|
|
/* Only generate SI if this SI is not in "static" (user-defined) mode */
|
|
|
|
if (!(bts->si_mode_static & (1 << i))) {
|
2013-01-08 18:33:42 +00:00
|
|
|
/* Set SI as being valid. gsm_generate_si() might unset
|
|
|
|
* it, if SI is not required. */
|
|
|
|
bts->si_valid |= (1 << i);
|
Improved generation of SYSTEM INFORMATIONs 2* and 5* for neighbour bands
In addition to SI 2 and SI 5, the SI 2ter and 2bis is generated, if
neighbour cells in other bands exist. Also it is indicated in the rest
octets of SI3, that SI 2ter is used. If no neighbour cell in a different
band exists, the SI 2ter and SI 5ter is omitted.
A special case is P-GSM range (channels 1-124). To be compatible with
older phones, SI 2bis and SI 5bis is used. If the BCCH lays inside the
P-GSM band, only neighbour cells of the P-GSM range are included in
SI 2 and SI 5. If neighbour cells exist in the same band (900), but lay
outside the P-GSM range, the SI 2bis and SI 5bis is used to extend the
list of neighbour cells. The extension is also indicated in SI 2 and
SI 5. If the BCCH lays inside the P-GSM range, but no neighbour cell
exists in the same band outside the P-GSM range, the SI 2bis ans SI 5bis
are omitted.
2012-02-29 08:04:07 +00:00
|
|
|
rc = gsm_generate_si(bts, i);
|
|
|
|
if (rc < 0)
|
|
|
|
goto err_out;
|
|
|
|
si_len[i] = rc;
|
|
|
|
} else {
|
|
|
|
if (i == SYSINFO_TYPE_5 || i == SYSINFO_TYPE_5bis
|
|
|
|
|| i == SYSINFO_TYPE_5ter)
|
|
|
|
si_len[i] = 18;
|
|
|
|
else if (i == SYSINFO_TYPE_6)
|
|
|
|
si_len[i] = 11;
|
|
|
|
else
|
|
|
|
si_len[i] = 23;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Third, we send the selected SI via RSL */
|
2010-07-30 09:50:09 +00:00
|
|
|
|
2013-01-08 18:33:42 +00:00
|
|
|
for (n = 0; n < n_si; n++) {
|
|
|
|
i = gen_si[n];
|
2017-07-15 21:23:58 +00:00
|
|
|
/* if we don't currently have this SI, we send a zero-length
|
|
|
|
* RSL BCCH FILLING / SACCH FILLING * in order to deactivate
|
|
|
|
* the SI, in case it might have previously been active */
|
2017-06-02 08:58:26 +00:00
|
|
|
if (!GSM_BTS_HAS_SI(bts, i))
|
2017-07-15 21:23:58 +00:00
|
|
|
rc = rsl_si(trx, i, 0);
|
|
|
|
else
|
|
|
|
rc = rsl_si(trx, i, si_len[i]);
|
2010-07-30 09:50:09 +00:00
|
|
|
if (rc < 0)
|
Improved generation of SYSTEM INFORMATIONs 2* and 5* for neighbour bands
In addition to SI 2 and SI 5, the SI 2ter and 2bis is generated, if
neighbour cells in other bands exist. Also it is indicated in the rest
octets of SI3, that SI 2ter is used. If no neighbour cell in a different
band exists, the SI 2ter and SI 5ter is omitted.
A special case is P-GSM range (channels 1-124). To be compatible with
older phones, SI 2bis and SI 5bis is used. If the BCCH lays inside the
P-GSM band, only neighbour cells of the P-GSM range are included in
SI 2 and SI 5. If neighbour cells exist in the same band (900), but lay
outside the P-GSM range, the SI 2bis and SI 5bis is used to extend the
list of neighbour cells. The extension is also indicated in SI 2 and
SI 5. If the BCCH lays inside the P-GSM range, but no neighbour cell
exists in the same band outside the P-GSM range, the SI 2bis ans SI 5bis
are omitted.
2012-02-29 08:04:07 +00:00
|
|
|
return rc;
|
2010-07-30 09:50:09 +00:00
|
|
|
}
|
2009-08-17 04:55:10 +00:00
|
|
|
|
2016-10-26 13:19:41 +00:00
|
|
|
/* Make sure the PCU is aware (in case anything GPRS related has
|
|
|
|
* changed in SI */
|
|
|
|
pcu_info_update(bts);
|
|
|
|
|
2009-08-17 04:55:10 +00:00
|
|
|
return 0;
|
2009-12-01 12:34:30 +00:00
|
|
|
err_out:
|
2016-12-16 17:45:51 +00:00
|
|
|
LOGP(DRR, LOGL_ERROR, "Cannot generate SI%s for BTS %u: error <%s>, "
|
2016-04-15 14:04:46 +00:00
|
|
|
"most likely a problem with neighbor cell list generation\n",
|
|
|
|
get_value_string(osmo_sitype_strs, i), bts->nr, strerror(-rc));
|
2009-12-01 12:34:30 +00:00
|
|
|
return rc;
|
2009-08-17 04:55:10 +00:00
|
|
|
}
|
|
|
|
|
2015-05-30 18:40:54 +00:00
|
|
|
/* set all system information types for a BTS */
|
|
|
|
int gsm_bts_set_system_infos(struct gsm_bts *bts)
|
|
|
|
{
|
|
|
|
struct gsm_bts_trx *trx;
|
|
|
|
|
|
|
|
/* Generate a new ID */
|
|
|
|
bts->bcch_change_mark += 1;
|
|
|
|
bts->bcch_change_mark %= 0x7;
|
|
|
|
|
|
|
|
llist_for_each_entry(trx, &bts->trx_list, list) {
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = gsm_bts_trx_set_system_infos(trx);
|
|
|
|
if (rc != 0)
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-06-15 06:52:12 +00:00
|
|
|
/* Produce a MA as specified in 10.5.2.21 */
|
|
|
|
static int generate_ma_for_ts(struct gsm_bts_trx_ts *ts)
|
|
|
|
{
|
|
|
|
/* we have three bitvecs: the per-timeslot ARFCNs, the cell chan ARFCNs
|
|
|
|
* and the MA */
|
|
|
|
struct bitvec *cell_chan = &ts->trx->bts->si_common.cell_alloc;
|
|
|
|
struct bitvec *ts_arfcn = &ts->hopping.arfcns;
|
|
|
|
struct bitvec *ma = &ts->hopping.ma;
|
2010-06-15 14:45:51 +00:00
|
|
|
unsigned int num_cell_arfcns, bitnum, n_chan;
|
2010-06-15 06:52:12 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
/* re-set the MA to all-zero */
|
|
|
|
ma->cur_bit = 0;
|
2010-06-15 14:45:51 +00:00
|
|
|
ts->hopping.ma_len = 0;
|
2010-06-15 06:52:12 +00:00
|
|
|
memset(ma->data, 0, ma->data_len);
|
|
|
|
|
|
|
|
if (!ts->hopping.enabled)
|
|
|
|
return 0;
|
|
|
|
|
2010-06-15 14:45:51 +00:00
|
|
|
/* count the number of ARFCNs in the cell channel allocation */
|
|
|
|
num_cell_arfcns = 0;
|
2012-01-29 12:24:12 +00:00
|
|
|
for (i = 0; i < 1024; i++) {
|
2010-06-15 14:45:51 +00:00
|
|
|
if (bitvec_get_bit_pos(cell_chan, i))
|
|
|
|
num_cell_arfcns++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* pad it to octet-aligned number of bits */
|
|
|
|
ts->hopping.ma_len = num_cell_arfcns / 8;
|
|
|
|
if (num_cell_arfcns % 8)
|
|
|
|
ts->hopping.ma_len++;
|
|
|
|
|
|
|
|
n_chan = 0;
|
2012-01-29 12:24:12 +00:00
|
|
|
for (i = 0; i < 1024; i++) {
|
2010-06-15 06:52:12 +00:00
|
|
|
if (!bitvec_get_bit_pos(cell_chan, i))
|
|
|
|
continue;
|
2010-06-15 14:45:51 +00:00
|
|
|
/* set the corresponding bit in the MA */
|
|
|
|
bitnum = (ts->hopping.ma_len * 8) - 1 - n_chan;
|
2010-06-15 06:52:12 +00:00
|
|
|
if (bitvec_get_bit_pos(ts_arfcn, i))
|
2010-06-15 14:45:51 +00:00
|
|
|
bitvec_set_bit_pos(ma, bitnum, 1);
|
2010-06-15 06:52:12 +00:00
|
|
|
else
|
2010-06-15 14:45:51 +00:00
|
|
|
bitvec_set_bit_pos(ma, bitnum, 0);
|
2010-06-20 13:56:50 +00:00
|
|
|
n_chan++;
|
2010-06-15 06:52:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ARFCN 0 is special: It is coded last in the bitmask */
|
|
|
|
if (bitvec_get_bit_pos(cell_chan, 0)) {
|
2010-06-15 14:45:51 +00:00
|
|
|
n_chan++;
|
|
|
|
/* set the corresponding bit in the MA */
|
|
|
|
bitnum = (ts->hopping.ma_len * 8) - 1 - n_chan;
|
2010-06-15 06:52:12 +00:00
|
|
|
if (bitvec_get_bit_pos(ts_arfcn, 0))
|
2010-06-15 14:45:51 +00:00
|
|
|
bitvec_set_bit_pos(ma, bitnum, 1);
|
2010-06-15 06:52:12 +00:00
|
|
|
else
|
2010-06-15 14:45:51 +00:00
|
|
|
bitvec_set_bit_pos(ma, bitnum, 0);
|
2010-06-15 06:52:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-08-17 04:55:10 +00:00
|
|
|
static void bootstrap_rsl(struct gsm_bts_trx *trx)
|
|
|
|
{
|
2010-06-15 06:52:12 +00:00
|
|
|
unsigned int i;
|
|
|
|
|
2009-12-17 22:10:46 +00:00
|
|
|
LOGP(DRSL, LOGL_NOTICE, "bootstrapping RSL for BTS/TRX (%u/%u) "
|
2018-03-05 01:09:40 +00:00
|
|
|
"on ARFCN %u using MCC-MNC %s LAC=%u CID=%u BSIC=%u\n",
|
|
|
|
trx->bts->nr, trx->nr, trx->arfcn,
|
|
|
|
osmo_plmn_name(&bsc_gsmnet->plmn),
|
|
|
|
trx->bts->location_area_code,
|
2015-11-20 09:43:31 +00:00
|
|
|
trx->bts->cell_identity, trx->bts->bsic);
|
2011-07-27 22:01:50 +00:00
|
|
|
|
|
|
|
if (trx->bts->type == GSM_BTS_TYPE_NOKIA_SITE) {
|
|
|
|
rsl_nokia_si_begin(trx);
|
|
|
|
}
|
|
|
|
|
2018-04-10 14:36:54 +00:00
|
|
|
/*
|
|
|
|
* Trigger ACC ramping before sending system information to BTS.
|
|
|
|
* This ensures that RACH control in system information is configured correctly.
|
2018-04-12 07:18:36 +00:00
|
|
|
* TRX 0 should be usable and unlocked, otherwise starting ACC ramping is pointless.
|
2018-04-10 14:36:54 +00:00
|
|
|
*/
|
2018-04-12 07:18:36 +00:00
|
|
|
if (trx_is_usable(trx) && trx->mo.nm_state.administrative == NM_STATE_UNLOCKED)
|
|
|
|
acc_ramp_trigger(&trx->bts->acc_ramp);
|
2018-04-10 14:36:54 +00:00
|
|
|
|
2014-11-21 10:18:45 +00:00
|
|
|
gsm_bts_trx_set_system_infos(trx);
|
2010-06-15 06:52:12 +00:00
|
|
|
|
2011-07-27 22:01:50 +00:00
|
|
|
if (trx->bts->type == GSM_BTS_TYPE_NOKIA_SITE) {
|
|
|
|
/* channel unspecific, power reduction in 2 dB steps */
|
|
|
|
rsl_bs_power_control(trx, 0xFF, trx->max_power_red / 2);
|
|
|
|
rsl_nokia_si_end(trx);
|
|
|
|
}
|
|
|
|
|
2018-04-06 16:56:48 +00:00
|
|
|
for (i = 0; i < ARRAY_SIZE(trx->ts); i++) {
|
2010-06-15 06:52:12 +00:00
|
|
|
generate_ma_for_ts(&trx->ts[i]);
|
2018-04-06 16:56:48 +00:00
|
|
|
}
|
2009-08-17 04:55:10 +00:00
|
|
|
}
|
|
|
|
|
2011-01-14 14:55:42 +00:00
|
|
|
/* 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)
|
2009-08-17 04:55:10 +00:00
|
|
|
{
|
2011-01-14 14:55:42 +00:00
|
|
|
struct input_signal_data *isd = signal_data;
|
|
|
|
struct gsm_bts_trx *trx = isd->trx;
|
2010-04-15 09:21:02 +00:00
|
|
|
int ts_no, lchan_no;
|
2017-05-29 09:48:29 +00:00
|
|
|
/* N. B: we rely on attribute order when parsing response in abis_nm_rx_get_attr_resp() */
|
|
|
|
const uint8_t bts_attr[] = { NM_ATT_MANUF_ID, NM_ATT_SW_CONFIG, };
|
|
|
|
const uint8_t trx_attr[] = { NM_ATT_MANUF_STATE, NM_ATT_SW_CONFIG, };
|
2017-05-15 08:29:54 +00:00
|
|
|
|
|
|
|
/* we should not request more attributes than we're ready to handle */
|
2017-05-29 09:48:29 +00:00
|
|
|
OSMO_ASSERT(sizeof(bts_attr) < MAX_BTS_ATTR);
|
|
|
|
OSMO_ASSERT(sizeof(trx_attr) < MAX_BTS_ATTR);
|
2010-04-15 09:21:02 +00:00
|
|
|
|
src: port openBSC over libosmo-abis
This is a big patch that ports openBSC over libosmo-abis.
Sorry, the changes that are included here are all dependent
of libosmo-abis, splitting them into smaller pieces would
leave the repository in some intermediate state, which is
not desired.
The main changes are:
- The directory libabis/ has been removed as it now lives in
libosmo-abis.
- new configuration file format for nanoBTS and HSL femto, we
need to define the virtual e1_line and attach it to the OML
link.
- all the existing BTS drivers (nanoBTS, hsl femto, Nokia site,
BS11 and rbs2000) now use the new libosmo-abis framework.
- use r232 input driver available in libosmo-abis for bs11_config.
- use ipa_msg_recv instead of old ipaccess_read_msg function.
- delete definition of gsm_e1_subslot and input_signal_data.
These structures now lives in libosmo-abis.
Most of this patch are deletions of libabis/ which has been
moved to libosmo-abis.
This patch also modifies openBSC to use all the new definitions
available in libosmocore and libosmo-abis. In order to do that,
we have replaced the following:
- DINP, DMI, DMIB and DMUX by their respective DL* correspondences.
- SS_GLOBAL by SS_L_GLOBAL
- SS_INPUT by SS_L_INPUT
- S_GLOBAL_SHUTDOWN by S_L_GLOBAL_SHUTDOWN
- SS_INPUT by SS_L_INPUT
- S_INP_* by S_L_INP_* sub-signals
- E1INP_NODE by L_E1INP_NODE vty node
This patch has been tested with:
- one nanoBTS
- the HSL femto with the examples available under libosmo-abis
- BS11 with both dahdi and misdn drivers.
2011-08-17 20:44:07 +00:00
|
|
|
if (subsys != SS_L_INPUT)
|
2011-01-14 14:55:42 +00:00
|
|
|
return -EINVAL;
|
|
|
|
|
2017-05-25 17:16:40 +00:00
|
|
|
LOGP(DLMI, LOGL_DEBUG, "%s(): Input signal '%s' received\n", __func__,
|
|
|
|
get_value_string(e1inp_signal_names, signal));
|
2011-01-14 14:55:42 +00:00
|
|
|
switch (signal) {
|
src: port openBSC over libosmo-abis
This is a big patch that ports openBSC over libosmo-abis.
Sorry, the changes that are included here are all dependent
of libosmo-abis, splitting them into smaller pieces would
leave the repository in some intermediate state, which is
not desired.
The main changes are:
- The directory libabis/ has been removed as it now lives in
libosmo-abis.
- new configuration file format for nanoBTS and HSL femto, we
need to define the virtual e1_line and attach it to the OML
link.
- all the existing BTS drivers (nanoBTS, hsl femto, Nokia site,
BS11 and rbs2000) now use the new libosmo-abis framework.
- use r232 input driver available in libosmo-abis for bs11_config.
- use ipa_msg_recv instead of old ipaccess_read_msg function.
- delete definition of gsm_e1_subslot and input_signal_data.
These structures now lives in libosmo-abis.
Most of this patch are deletions of libabis/ which has been
moved to libosmo-abis.
This patch also modifies openBSC to use all the new definitions
available in libosmocore and libosmo-abis. In order to do that,
we have replaced the following:
- DINP, DMI, DMIB and DMUX by their respective DL* correspondences.
- SS_GLOBAL by SS_L_GLOBAL
- SS_INPUT by SS_L_INPUT
- S_GLOBAL_SHUTDOWN by S_L_GLOBAL_SHUTDOWN
- SS_INPUT by SS_L_INPUT
- S_INP_* by S_L_INP_* sub-signals
- E1INP_NODE by L_E1INP_NODE vty node
This patch has been tested with:
- one nanoBTS
- the HSL femto with the examples available under libosmo-abis
- BS11 with both dahdi and misdn drivers.
2011-08-17 20:44:07 +00:00
|
|
|
case S_L_INP_TEI_UP:
|
2011-07-27 22:01:50 +00:00
|
|
|
if (isd->link_type == E1INP_SIGN_OML) {
|
|
|
|
/* TODO: this is required for the Nokia BTS, hopping is configured
|
|
|
|
during OML, other MA is not set. */
|
|
|
|
struct gsm_bts_trx *cur_trx;
|
|
|
|
/* was static in system_information.c */
|
|
|
|
extern int generate_cell_chan_list(uint8_t *chan_list, struct gsm_bts *bts);
|
|
|
|
uint8_t ca[20];
|
|
|
|
/* has to be called before generate_ma_for_ts to
|
|
|
|
set bts->si_common.cell_alloc */
|
|
|
|
generate_cell_chan_list(ca, trx->bts);
|
|
|
|
|
2017-05-29 09:48:29 +00:00
|
|
|
/* Request generic BTS-level attributes */
|
2017-06-09 15:15:45 +00:00
|
|
|
abis_nm_get_attr(trx->bts, NM_OC_BTS, 0xFF, 0xFF, 0xFF, bts_attr, sizeof(bts_attr));
|
2017-05-29 09:48:29 +00:00
|
|
|
|
2011-07-27 22:01:50 +00:00
|
|
|
llist_for_each_entry(cur_trx, &trx->bts->trx_list, list) {
|
|
|
|
int i;
|
2017-05-29 09:48:29 +00:00
|
|
|
/* Request TRX-level attributes */
|
2017-06-09 15:15:45 +00:00
|
|
|
abis_nm_get_attr(cur_trx->bts, NM_OC_BASEB_TRANSC, 0, cur_trx->nr, 0xFF,
|
2017-05-29 09:48:29 +00:00
|
|
|
trx_attr, sizeof(trx_attr));
|
2016-06-01 23:18:02 +00:00
|
|
|
for (i = 0; i < ARRAY_SIZE(cur_trx->ts); i++)
|
2011-07-27 22:01:50 +00:00
|
|
|
generate_ma_for_ts(&cur_trx->ts[i]);
|
|
|
|
}
|
|
|
|
}
|
2011-01-14 14:55:42 +00:00
|
|
|
if (isd->link_type == E1INP_SIGN_RSL)
|
2009-08-17 04:55:10 +00:00
|
|
|
bootstrap_rsl(trx);
|
|
|
|
break;
|
src: port openBSC over libosmo-abis
This is a big patch that ports openBSC over libosmo-abis.
Sorry, the changes that are included here are all dependent
of libosmo-abis, splitting them into smaller pieces would
leave the repository in some intermediate state, which is
not desired.
The main changes are:
- The directory libabis/ has been removed as it now lives in
libosmo-abis.
- new configuration file format for nanoBTS and HSL femto, we
need to define the virtual e1_line and attach it to the OML
link.
- all the existing BTS drivers (nanoBTS, hsl femto, Nokia site,
BS11 and rbs2000) now use the new libosmo-abis framework.
- use r232 input driver available in libosmo-abis for bs11_config.
- use ipa_msg_recv instead of old ipaccess_read_msg function.
- delete definition of gsm_e1_subslot and input_signal_data.
These structures now lives in libosmo-abis.
Most of this patch are deletions of libabis/ which has been
moved to libosmo-abis.
This patch also modifies openBSC to use all the new definitions
available in libosmocore and libosmo-abis. In order to do that,
we have replaced the following:
- DINP, DMI, DMIB and DMUX by their respective DL* correspondences.
- SS_GLOBAL by SS_L_GLOBAL
- SS_INPUT by SS_L_INPUT
- S_GLOBAL_SHUTDOWN by S_L_GLOBAL_SHUTDOWN
- SS_INPUT by SS_L_INPUT
- S_INP_* by S_L_INP_* sub-signals
- E1INP_NODE by L_E1INP_NODE vty node
This patch has been tested with:
- one nanoBTS
- the HSL femto with the examples available under libosmo-abis
- BS11 with both dahdi and misdn drivers.
2011-08-17 20:44:07 +00:00
|
|
|
case S_L_INP_TEI_DN:
|
|
|
|
LOGP(DLMI, LOGL_ERROR, "Lost some E1 TEI link: %d %p\n", isd->link_type, trx);
|
2010-04-15 09:21:02 +00:00
|
|
|
|
2011-01-14 14:55:42 +00:00
|
|
|
if (isd->link_type == E1INP_SIGN_OML)
|
2017-12-09 22:07:38 +00:00
|
|
|
rate_ctr_inc(&trx->bts->bts_ctrs->ctr[BTS_CTR_BTS_OML_FAIL]);
|
Add support for Access Control Class ramping.
Access Control Class (ACC) ramping is used to slowly make the cell
available to an increasing number of MS. This avoids overload at
startup time in cases where a lot of MS would discover the new
cell and try to connect to it all at once.
Ramping behaviour can be configured with new VTY commands:
[no] access-control-class-ramping
access-control-class-ramping-step-interval (<30-600>|dynamic)
access-control-class-ramping-step-size (<1-10>)
(The minimum and maximum values for these parameters are hard-coded,
but could be changed if they are found to be inadequate.)
The VTY command 'show bts' has been extended to display the
current ACC ramping configuration.
By default, ACC ramping is disabled.
When enabled, the default behaviour is to enable one ACC per
ramping step with a 'dynamic' step interval. This means the
ramping interval (time between steps) is scaled to the channel
load average of the BTS, i.e. the number of used vs. available
channels measured over a certain amount of time.
Below is an example of debug log output with ACC ramping enabled,
while many 'mobile' programs are concurrently trying to connect
to the network via an osmo-bts-virtual BTS. Initially, all ACCs
are barred, and then only one class is allowed. Then the current
BTS channel load average is consulted for scheduling the next
ramping step. While the channel load average is low, ramping
proceeds faster, and while it is is high, ramping proceeds slower:
(bts=0) ACC RAMP: barring Access Control Class 0
(bts=0) ACC RAMP: barring Access Control Class 1
(bts=0) ACC RAMP: barring Access Control Class 2
(bts=0) ACC RAMP: barring Access Control Class 3
(bts=0) ACC RAMP: barring Access Control Class 4
(bts=0) ACC RAMP: barring Access Control Class 5
(bts=0) ACC RAMP: barring Access Control Class 6
(bts=0) ACC RAMP: barring Access Control Class 7
(bts=0) ACC RAMP: barring Access Control Class 8
(bts=0) ACC RAMP: barring Access Control Class 9
(bts=0) ACC RAMP: allowing Access Control Class 0
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load average
(bts=0) ACC RAMP: allowing Access Control Class 1
(bts=0) ACC RAMP: step interval set to 354 seconds based on 59% channel load average
(bts=0) ACC RAMP: allowing Access Control Class 2
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load average
(bts=0) ACC RAMP: allowing Access Control Class 3
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load average
Change-Id: I0a5ac3a08f992f326435944f17e0a9171911afb0
Related: OS#2591
2018-02-06 13:44:54 +00:00
|
|
|
else if (isd->link_type == E1INP_SIGN_RSL) {
|
2017-12-09 22:07:38 +00:00
|
|
|
rate_ctr_inc(&trx->bts->bts_ctrs->ctr[BTS_CTR_BTS_RSL_FAIL]);
|
Add support for Access Control Class ramping.
Access Control Class (ACC) ramping is used to slowly make the cell
available to an increasing number of MS. This avoids overload at
startup time in cases where a lot of MS would discover the new
cell and try to connect to it all at once.
Ramping behaviour can be configured with new VTY commands:
[no] access-control-class-ramping
access-control-class-ramping-step-interval (<30-600>|dynamic)
access-control-class-ramping-step-size (<1-10>)
(The minimum and maximum values for these parameters are hard-coded,
but could be changed if they are found to be inadequate.)
The VTY command 'show bts' has been extended to display the
current ACC ramping configuration.
By default, ACC ramping is disabled.
When enabled, the default behaviour is to enable one ACC per
ramping step with a 'dynamic' step interval. This means the
ramping interval (time between steps) is scaled to the channel
load average of the BTS, i.e. the number of used vs. available
channels measured over a certain amount of time.
Below is an example of debug log output with ACC ramping enabled,
while many 'mobile' programs are concurrently trying to connect
to the network via an osmo-bts-virtual BTS. Initially, all ACCs
are barred, and then only one class is allowed. Then the current
BTS channel load average is consulted for scheduling the next
ramping step. While the channel load average is low, ramping
proceeds faster, and while it is is high, ramping proceeds slower:
(bts=0) ACC RAMP: barring Access Control Class 0
(bts=0) ACC RAMP: barring Access Control Class 1
(bts=0) ACC RAMP: barring Access Control Class 2
(bts=0) ACC RAMP: barring Access Control Class 3
(bts=0) ACC RAMP: barring Access Control Class 4
(bts=0) ACC RAMP: barring Access Control Class 5
(bts=0) ACC RAMP: barring Access Control Class 6
(bts=0) ACC RAMP: barring Access Control Class 7
(bts=0) ACC RAMP: barring Access Control Class 8
(bts=0) ACC RAMP: barring Access Control Class 9
(bts=0) ACC RAMP: allowing Access Control Class 0
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load average
(bts=0) ACC RAMP: allowing Access Control Class 1
(bts=0) ACC RAMP: step interval set to 354 seconds based on 59% channel load average
(bts=0) ACC RAMP: allowing Access Control Class 2
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load average
(bts=0) ACC RAMP: allowing Access Control Class 3
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load average
Change-Id: I0a5ac3a08f992f326435944f17e0a9171911afb0
Related: OS#2591
2018-02-06 13:44:54 +00:00
|
|
|
acc_ramp_abort(&trx->bts->acc_ramp);
|
|
|
|
}
|
2010-04-12 08:45:52 +00:00
|
|
|
|
2010-04-15 09:21:02 +00:00
|
|
|
/*
|
|
|
|
* free all allocated channels. change the nm_state so the
|
|
|
|
* trx and trx_ts becomes unusable and chan_alloc.c can not
|
|
|
|
* allocate from it.
|
|
|
|
*/
|
|
|
|
for (ts_no = 0; ts_no < ARRAY_SIZE(trx->ts); ++ts_no) {
|
|
|
|
struct gsm_bts_trx_ts *ts = &trx->ts[ts_no];
|
|
|
|
|
|
|
|
for (lchan_no = 0; lchan_no < ARRAY_SIZE(ts->lchan); ++lchan_no) {
|
2010-08-25 04:29:24 +00:00
|
|
|
if (ts->lchan[lchan_no].state != LCHAN_S_NONE)
|
2010-04-15 09:21:02 +00:00
|
|
|
lchan_free(&ts->lchan[lchan_no]);
|
|
|
|
lchan_reset(&ts->lchan[lchan_no]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-29 14:49:03 +00:00
|
|
|
gsm_bts_mo_reset(trx->bts);
|
2010-11-15 19:50:42 +00:00
|
|
|
|
|
|
|
abis_nm_clear_queue(trx->bts);
|
2009-08-17 04:55:10 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2011-01-14 14:55:42 +00:00
|
|
|
|
|
|
|
return 0;
|
2009-08-17 04:55:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int bootstrap_bts(struct gsm_bts *bts)
|
|
|
|
{
|
2010-04-28 19:31:29 +00:00
|
|
|
int i, n;
|
|
|
|
|
2016-04-08 09:52:34 +00:00
|
|
|
if (!bts->model)
|
|
|
|
return -EFAULT;
|
|
|
|
|
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
|
|
|
if (bts->model->start && !bts->model->started) {
|
|
|
|
int ret = bts->model->start(bts->network);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
bts->model->started = true;
|
|
|
|
}
|
|
|
|
|
2010-05-26 15:14:42 +00:00
|
|
|
/* FIXME: What about secondary TRX of a BTS? What about a BTS that has TRX
|
|
|
|
* in different bands? Why is 'band' a parameter of the BTS and not of the TRX? */
|
2009-10-02 11:19:34 +00:00
|
|
|
switch (bts->band) {
|
|
|
|
case GSM_BAND_1800:
|
2009-08-17 04:55:10 +00:00
|
|
|
if (bts->c0->arfcn < 512 || bts->c0->arfcn > 885) {
|
2009-12-17 22:10:46 +00:00
|
|
|
LOGP(DNM, LOGL_ERROR, "GSM1800 channel must be between 512-885.\n");
|
2009-08-17 04:55:10 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
break;
|
2009-10-02 11:19:34 +00:00
|
|
|
case GSM_BAND_1900:
|
|
|
|
if (bts->c0->arfcn < 512 || bts->c0->arfcn > 810) {
|
2009-12-17 22:10:46 +00:00
|
|
|
LOGP(DNM, LOGL_ERROR, "GSM1900 channel must be between 512-810.\n");
|
2009-10-02 11:19:34 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GSM_BAND_900:
|
2015-06-20 16:45:35 +00:00
|
|
|
if ((bts->c0->arfcn > 124 && bts->c0->arfcn < 955) ||
|
2010-02-09 14:44:14 +00:00
|
|
|
bts->c0->arfcn > 1023) {
|
2015-06-19 18:51:43 +00:00
|
|
|
LOGP(DNM, LOGL_ERROR, "GSM900 channel must be between 0-124, 955-1023.\n");
|
2009-08-17 04:55:10 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
break;
|
2010-05-26 15:14:42 +00:00
|
|
|
case GSM_BAND_850:
|
|
|
|
if (bts->c0->arfcn < 128 || bts->c0->arfcn > 251) {
|
|
|
|
LOGP(DNM, LOGL_ERROR, "GSM850 channel must be between 128-251.\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
break;
|
2009-10-02 11:19:34 +00:00
|
|
|
default:
|
2009-12-17 22:10:46 +00:00
|
|
|
LOGP(DNM, LOGL_ERROR, "Unsupported frequency band.\n");
|
2009-08-17 04:55:10 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2012-10-13 05:27:47 +00:00
|
|
|
/* Control Channel Description is set from vty/config */
|
2011-01-13 22:20:45 +00:00
|
|
|
|
2010-04-30 05:32:05 +00:00
|
|
|
/* T3212 is set from vty/config */
|
2010-04-28 19:31:29 +00:00
|
|
|
|
2010-04-30 05:32:05 +00:00
|
|
|
/* Set ccch config by looking at ts config */
|
2010-04-28 19:31:29 +00:00
|
|
|
for (n=0, i=0; i<8; i++)
|
|
|
|
n += bts->c0->ts[i].pchan == GSM_PCHAN_CCCH ? 1 : 0;
|
|
|
|
|
2017-02-22 01:27:59 +00:00
|
|
|
/* Indicate R99 MSC in SI3 */
|
|
|
|
bts->si_common.chan_desc.mscr = 1;
|
|
|
|
|
2010-04-28 19:31:29 +00:00
|
|
|
switch (n) {
|
|
|
|
case 0:
|
|
|
|
bts->si_common.chan_desc.ccch_conf = RSL_BCCH_CCCH_CONF_1_C;
|
2016-10-12 10:48:50 +00:00
|
|
|
/* Limit reserved block to 2 on combined channel according to
|
|
|
|
3GPP TS 44.018 Table 10.5.2.11.1 */
|
|
|
|
if (bts->si_common.chan_desc.bs_ag_blks_res > 2) {
|
|
|
|
LOGP(DNM, LOGL_NOTICE, "CCCH is combined with SDCCHs, "
|
|
|
|
"reducing BS-AG-BLKS-RES value %d -> 2\n",
|
|
|
|
bts->si_common.chan_desc.bs_ag_blks_res);
|
2012-10-13 05:27:47 +00:00
|
|
|
bts->si_common.chan_desc.bs_ag_blks_res = 2;
|
2016-10-12 10:48:50 +00:00
|
|
|
}
|
2010-04-28 19:31:29 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
bts->si_common.chan_desc.ccch_conf = RSL_BCCH_CCCH_CONF_1_NC;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
bts->si_common.chan_desc.ccch_conf = RSL_BCCH_CCCH_CONF_2_NC;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
bts->si_common.chan_desc.ccch_conf = RSL_BCCH_CCCH_CONF_3_NC;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
bts->si_common.chan_desc.ccch_conf = RSL_BCCH_CCCH_CONF_4_NC;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
LOGP(DNM, LOGL_ERROR, "Unsupported CCCH timeslot configuration\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2009-08-17 04:55:10 +00:00
|
|
|
|
2009-12-01 12:34:30 +00:00
|
|
|
bts->si_common.cell_options.pwrc = 0; /* PWRC not set */
|
|
|
|
|
|
|
|
bts->si_common.cell_sel_par.acs = 0;
|
|
|
|
|
|
|
|
bts->si_common.ncc_permitted = 0xff;
|
|
|
|
|
2018-01-30 17:14:22 +00:00
|
|
|
bts->chan_load_samples_idx = 0;
|
|
|
|
|
2018-04-09 15:02:41 +00:00
|
|
|
/* ACC ramping is initialized from vty/config */
|
Add support for Access Control Class ramping.
Access Control Class (ACC) ramping is used to slowly make the cell
available to an increasing number of MS. This avoids overload at
startup time in cases where a lot of MS would discover the new
cell and try to connect to it all at once.
Ramping behaviour can be configured with new VTY commands:
[no] access-control-class-ramping
access-control-class-ramping-step-interval (<30-600>|dynamic)
access-control-class-ramping-step-size (<1-10>)
(The minimum and maximum values for these parameters are hard-coded,
but could be changed if they are found to be inadequate.)
The VTY command 'show bts' has been extended to display the
current ACC ramping configuration.
By default, ACC ramping is disabled.
When enabled, the default behaviour is to enable one ACC per
ramping step with a 'dynamic' step interval. This means the
ramping interval (time between steps) is scaled to the channel
load average of the BTS, i.e. the number of used vs. available
channels measured over a certain amount of time.
Below is an example of debug log output with ACC ramping enabled,
while many 'mobile' programs are concurrently trying to connect
to the network via an osmo-bts-virtual BTS. Initially, all ACCs
are barred, and then only one class is allowed. Then the current
BTS channel load average is consulted for scheduling the next
ramping step. While the channel load average is low, ramping
proceeds faster, and while it is is high, ramping proceeds slower:
(bts=0) ACC RAMP: barring Access Control Class 0
(bts=0) ACC RAMP: barring Access Control Class 1
(bts=0) ACC RAMP: barring Access Control Class 2
(bts=0) ACC RAMP: barring Access Control Class 3
(bts=0) ACC RAMP: barring Access Control Class 4
(bts=0) ACC RAMP: barring Access Control Class 5
(bts=0) ACC RAMP: barring Access Control Class 6
(bts=0) ACC RAMP: barring Access Control Class 7
(bts=0) ACC RAMP: barring Access Control Class 8
(bts=0) ACC RAMP: barring Access Control Class 9
(bts=0) ACC RAMP: allowing Access Control Class 0
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load average
(bts=0) ACC RAMP: allowing Access Control Class 1
(bts=0) ACC RAMP: step interval set to 354 seconds based on 59% channel load average
(bts=0) ACC RAMP: allowing Access Control Class 2
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load average
(bts=0) ACC RAMP: allowing Access Control Class 3
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load average
Change-Id: I0a5ac3a08f992f326435944f17e0a9171911afb0
Related: OS#2591
2018-02-06 13:44:54 +00:00
|
|
|
|
2011-07-18 09:26:07 +00:00
|
|
|
/* Initialize the BTS state */
|
|
|
|
gsm_bts_mo_reset(bts);
|
|
|
|
|
2009-08-17 04:55:10 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-12-17 20:48:47 +00:00
|
|
|
int bsc_network_alloc(void)
|
2009-08-17 04:55:10 +00:00
|
|
|
{
|
2016-10-26 13:19:41 +00:00
|
|
|
/* initialize our data structures */
|
2018-02-27 11:37:26 +00:00
|
|
|
bsc_gsmnet = bsc_network_init(tall_bsc_ctx);
|
2009-08-17 04:55:10 +00:00
|
|
|
if (!bsc_gsmnet)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2016-05-11 12:12:00 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int bsc_network_configure(const char *config_file)
|
|
|
|
{
|
|
|
|
struct gsm_bts *bts;
|
|
|
|
int rc;
|
|
|
|
|
2016-05-11 11:39:33 +00:00
|
|
|
rc = vty_read_config_file(config_file, NULL);
|
2009-08-17 04:55:10 +00:00
|
|
|
if (rc < 0) {
|
2009-12-17 22:10:46 +00:00
|
|
|
LOGP(DNM, LOGL_FATAL, "Failed to parse the config file: '%s'\n", config_file);
|
2009-08-17 04:55:10 +00:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
enable telnet VTY bind address config for various programs
Following the 'line vty'/'bind A.B.C.D' command added in libosmocore, use the
configured address to set the telnet bind for the VTY line. It is now possible
to publish the VTY on a specific local interface (including 0.0.0.0 aka "any").
Implement in all of:
osmo-gbproxy
osmo-gtphub
osmo-sgsn
osmo-bsc
osmo-bsc_nat
osmo-bsc_mgcp
osmo-nitb
In some of these main programs, move the telnet initialization below the
configuration parsing.
Historically, this was not a good idea for programs using bsc_init.c (aka
bsc_bootstrap_network()), since they expected a gsm_network struct pointer in
((struct telnet_connection*)vty->priv)->priv, so that telnet had to be either
initialized or replaced by a dummy struct. In the meantime, the gsm_network
struct is not actually looked up in a priv pointer but in the static bsc_vty.c
scope (bsc_gsmnet), so this limitation is mere legacy (even though said legacy
is still there in an "#if 0" chunk).
In the other binaries I have briefly looked at the init sequence dependencies
and found no reason to initialize telnet above the config file parsing. In any
case, I have tested every single one of abovementioned binaries to verify that
they still parse the example config successfully and launch, allowing VTY
connections on the configured address(es). I hope this suffices.
In all of the above, log VTY address and port. LOGL_INFO is disabled by default
in some of the logging scopes, and since it is a single log message right at
program launch, I decided for the slightly more aggressive LOGL_NOTICE.
2016-02-23 13:09:38 +00:00
|
|
|
/* start telnet after reading config for vty_get_bind_addr() */
|
|
|
|
rc = telnet_init_dynif(tall_bsc_ctx, bsc_gsmnet, vty_get_bind_addr(),
|
|
|
|
OSMO_VTY_PORT_NITB_BSC);
|
2010-05-16 18:52:23 +00:00
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
2011-05-06 10:12:31 +00:00
|
|
|
osmo_signal_register_handler(SS_NM, nm_sig_cb, NULL);
|
src: port openBSC over libosmo-abis
This is a big patch that ports openBSC over libosmo-abis.
Sorry, the changes that are included here are all dependent
of libosmo-abis, splitting them into smaller pieces would
leave the repository in some intermediate state, which is
not desired.
The main changes are:
- The directory libabis/ has been removed as it now lives in
libosmo-abis.
- new configuration file format for nanoBTS and HSL femto, we
need to define the virtual e1_line and attach it to the OML
link.
- all the existing BTS drivers (nanoBTS, hsl femto, Nokia site,
BS11 and rbs2000) now use the new libosmo-abis framework.
- use r232 input driver available in libosmo-abis for bs11_config.
- use ipa_msg_recv instead of old ipaccess_read_msg function.
- delete definition of gsm_e1_subslot and input_signal_data.
These structures now lives in libosmo-abis.
Most of this patch are deletions of libabis/ which has been
moved to libosmo-abis.
This patch also modifies openBSC to use all the new definitions
available in libosmocore and libosmo-abis. In order to do that,
we have replaced the following:
- DINP, DMI, DMIB and DMUX by their respective DL* correspondences.
- SS_GLOBAL by SS_L_GLOBAL
- SS_INPUT by SS_L_INPUT
- S_GLOBAL_SHUTDOWN by S_L_GLOBAL_SHUTDOWN
- SS_INPUT by SS_L_INPUT
- S_INP_* by S_L_INP_* sub-signals
- E1INP_NODE by L_E1INP_NODE vty node
This patch has been tested with:
- one nanoBTS
- the HSL femto with the examples available under libosmo-abis
- BS11 with both dahdi and misdn drivers.
2011-08-17 20:44:07 +00:00
|
|
|
osmo_signal_register_handler(SS_L_INPUT, inp_sig_cb, NULL);
|
2009-08-17 04:55:10 +00:00
|
|
|
|
|
|
|
llist_for_each_entry(bts, &bsc_gsmnet->bts_list, list) {
|
2011-03-04 12:41:31 +00:00
|
|
|
rc = bootstrap_bts(bts);
|
2011-05-14 09:32:46 +00:00
|
|
|
if (rc < 0) {
|
|
|
|
LOGP(DNM, LOGL_FATAL, "Error bootstrapping BTS\n");
|
|
|
|
return rc;
|
|
|
|
}
|
src: port openBSC over libosmo-abis
This is a big patch that ports openBSC over libosmo-abis.
Sorry, the changes that are included here are all dependent
of libosmo-abis, splitting them into smaller pieces would
leave the repository in some intermediate state, which is
not desired.
The main changes are:
- The directory libabis/ has been removed as it now lives in
libosmo-abis.
- new configuration file format for nanoBTS and HSL femto, we
need to define the virtual e1_line and attach it to the OML
link.
- all the existing BTS drivers (nanoBTS, hsl femto, Nokia site,
BS11 and rbs2000) now use the new libosmo-abis framework.
- use r232 input driver available in libosmo-abis for bs11_config.
- use ipa_msg_recv instead of old ipaccess_read_msg function.
- delete definition of gsm_e1_subslot and input_signal_data.
These structures now lives in libosmo-abis.
Most of this patch are deletions of libabis/ which has been
moved to libosmo-abis.
This patch also modifies openBSC to use all the new definitions
available in libosmocore and libosmo-abis. In order to do that,
we have replaced the following:
- DINP, DMI, DMIB and DMUX by their respective DL* correspondences.
- SS_GLOBAL by SS_L_GLOBAL
- SS_INPUT by SS_L_INPUT
- S_GLOBAL_SHUTDOWN by S_L_GLOBAL_SHUTDOWN
- SS_INPUT by SS_L_INPUT
- S_INP_* by S_L_INP_* sub-signals
- E1INP_NODE by L_E1INP_NODE vty node
This patch has been tested with:
- one nanoBTS
- the HSL femto with the examples available under libosmo-abis
- BS11 with both dahdi and misdn drivers.
2011-08-17 20:44:07 +00:00
|
|
|
rc = e1_reconfig_bts(bts);
|
2011-02-05 14:41:24 +00:00
|
|
|
if (rc < 0) {
|
2011-05-14 09:32:46 +00:00
|
|
|
LOGP(DNM, LOGL_FATAL, "Error enabling E1 input driver\n");
|
|
|
|
return rc;
|
2011-02-05 14:41:24 +00:00
|
|
|
}
|
2009-08-17 04:55:10 +00:00
|
|
|
}
|
2016-10-26 13:19:41 +00:00
|
|
|
|
2009-08-17 04:55:10 +00:00
|
|
|
return 0;
|
|
|
|
}
|