2010-06-30 06:33:01 +00:00
|
|
|
/* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org>
|
2011-04-07 21:23:27 +00:00
|
|
|
* (C) 2009-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
|
|
|
|
* (C) 2009-2011 by On-Waves
|
2010-06-30 06:33:01 +00:00
|
|
|
* 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
|
2010-06-30 06:33:01 +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.
|
2010-06-30 06:33:01 +00:00
|
|
|
*
|
2011-01-01 14:25:50 +00:00
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
introduce an osmo_fsm for gsm_subscriber_connection
In the current implementation of osmo-bsc, the subscriber connection is
not handled (very) statefully. However, there is some state keeping in the
code that handles the mgcp connection, but there are still to much loose ends
which allow odd situations to happen, which then lead severe error situations
(see also closes tags at the end) This commit adds a number of improvements
to fix those problems.
- Use an osmo-fsm to control the gsm_subscriber_connection state and
make sure that certain operations can only take place at certain states
(e.g let connection oriented SCCP traffic only pass when an SCCP connection
actually exists.
Remove the old osmo_bsc_mgcp.c code. Use the recently developed MGCP client
FSM to handle the MGCP connections.
Also make sure that stuff that already works does not break. This in
particular refers to the internal handover capability and the respective
unit-tests.
See also OS#2823, OS#2768 and OS#2898
- Fix logic to permit assignment to a signalling channel. (OS#2762)
- Introduce T993210 to release lchan + subscr_conn if MSC fails to respond
The GSM specs don't have an explicit timer for this, so let's introdcue
a custom timer (hence starting with 99).
This timeout catches the following situation:
* we send a SCCP CR with COMPL_L3_INFO from the MS to the MSC,
* the MSC doesn't respond (e.g. SCCP routing failure, program down, ...)
The MS is supposed to timeout with T3210, 3220 or 3230. But the BSC
shouldn't trust the MS but have some timer on its own.
SCCP would have a timer T(conn est), but that one is specified to be
1-2min and hence rather long.
See also: OS#2775
- Terminate bsc_subscr_conn_fsm on SCCP N-DISC.ind from MSC
If the MSC is disconnecting the SCCP channel, we must terminate the FSM
which in turn will release all lchan's and other state.
This makes TC_chan_rel_hard_rlsd pass, see also OS#2731
As a side-effect, this fixes TC_chan_act_ack_est_ind_refused(),
where the MSC is answering with CREF to our CR/COMPL_L3.
- Release subscriber connection on RLL RELEASE IND of SAPI0 on main DCCH
The subscriber connection isn't really useful for anything after the
SAPI0 main signalling link has been released. We could try to
re-establish, but our best option is probably simply releasing the
subscriber_conn and anything related to it.
This will make TC_chan_rel_rll_rel_ind pass, see also OS#2730
This commit has been tested using the BSC_Tests TTCN3 testsuit and the
following tests were passed:
TC_chan_act_noreply
TC_chan_act_ack_noest
TC_chan_act_ack_est_ind_noreply
TC_chan_act_ack_est_ind_refused
TC_chan_act_nack
TC_chan_exhaustion
TC_ctrl
TC_chan_rel_conn_fail
TC_chan_rel_hard_clear
TC_chan_rel_hard_rlsd
TC_chan_rel_a_reset
TC_rll_est_ind_inact_lchan
TC_rll_est_ind_inval_sapi1
TC_rll_est_ind_inval_sapi3
TC_rll_est_ind_inval_sacch
TC_assignment_cic_only
TC_assignment_csd
TC_assignment_ctm
TC_assignment_fr_a5_0
TC_assignment_fr_a5_1_codec_missing
TC_assignment_fr_a5_1
TC_assignment_fr_a5_3
TC_assignment_fr_a5_4
TC_paging_imsi_nochan
TC_paging_tmsi_nochan
TC_paging_tmsi_any
TC_paging_tmsi_sdcch
TC_paging_tmsi_tch_f
TC_paging_tmsi_tch_hf
TC_paging_imsi_nochan_cgi
TC_paging_imsi_nochan_lac_ci
TC_paging_imsi_nochan_ci
TC_paging_imsi_nochan_lai
TC_paging_imsi_nochan_lac
TC_paging_imsi_nochan_all
TC_paging_imsi_nochan_plmn_lac_rnc
TC_paging_imsi_nochan_rnc
TC_paging_imsi_nochan_lac_rnc
TC_paging_imsi_nochan_lacs
TC_paging_imsi_nochan_lacs_empty
TC_paging_imsi_a_reset
TC_paging_counter
TC_rsl_drop_counter
TC_classmark
TC_unsol_ass_fail
TC_unsol_ass_compl
TC_unsol_ho_fail
TC_err_82_short_msg
TC_ho_int
Authors:
Harald Welte <laforge@gnumonks.org>
Philipp Maier <pmaier@sysmocom.de>
Neels Hofmeyr <neels@hofmeyr.de>
Closes: OS#2730
Closes: OS#2731
Closes: OS#2762
Closes: OS#2768
Closes: OS#2775
Closes: OS#2823
Closes: OS#2898
Closes: OS#2936
Change-Id: I68286d26e2014048b054f39ef29c35fef420cc97
2018-01-28 02:04:16 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/lienses/>.
|
2010-06-30 06:33:01 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-09-04 13:15:32 +00:00
|
|
|
#include <osmocom/bsc/bss.h>
|
|
|
|
#include <osmocom/bsc/debug.h>
|
|
|
|
#include <osmocom/bsc/gsm_data.h>
|
|
|
|
#include <osmocom/bsc/osmo_bsc.h>
|
|
|
|
#include <osmocom/bsc/osmo_bsc_rf.h>
|
|
|
|
#include <osmocom/bsc/bsc_msc_data.h>
|
|
|
|
#include <osmocom/bsc/signal.h>
|
|
|
|
#include <osmocom/bsc/vty.h>
|
|
|
|
#include <osmocom/bsc/ipaccess.h>
|
|
|
|
#include <osmocom/bsc/ctrl.h>
|
|
|
|
#include <osmocom/bsc/osmo_bsc_sigtran.h>
|
2017-12-07 00:57:01 +00:00
|
|
|
#include <osmocom/bsc/handover_decision.h>
|
2017-12-07 02:54:01 +00:00
|
|
|
#include <osmocom/bsc/handover_decision_2.h>
|
large refactoring: use FSMs for lchans; add inter-BSC HO
Add FSMs:
- timeslot_fsm: handle dynamic timeslots and OML+RSL availability.
- lchan_fsm: handle an individual lchan activation, RTP stream and release,
signal the appropriate calling FSMs on success, failure, release.
- mgw_endpoint_fsm: handle one entire endpoint with several CI.
- assignment_fsm: BSSMAP Assignment Request.
- handover_fsm: all of intra, inter-MO and inter-MT handover.
Above FSMs absorb large parts of the gscon FSM. The gscon FSM was surpassing
the maximum amount events (32), and it is more logical to treat assignment,
handover and MGW procedures in separate FSMs.
- Add logging macros for each FSM type:
- LOG_TS()
- LOG_LCHAN()
- LOG_MGWEP(), LOG_CI()
- LOG_ASSIGNMENT()
- LOG_HO()
These log with the osmo_fsm_inst where present.
New style decision: logging without a final newline char is awkward,
especially for gsmtap logging and when other logs interleave LOGPC() calls;
we have various cases where the final \n goes missing, and also this invokes
the log category checking N times instead of once.
So I decided to make these macros *always* append a newline, but only if
there is no final newline yet. I hope that the compiler optimizes the
strlen() of the constant format strings away. Thus I can log with or without
typing "\n" and always get an \n termination anyway.
General:
- replace osmo_timers, state enums and program-wide osmo_signal_dispatch()
with dedicated FSM timeouts, states and events.
- introduce a common way to handle Tnnn timers: gsm_timers.h/.c: struct T_def.
These can be used (with some macro magic) to define a state's timeout once,
and not make mistakes for each osmo_fsm_inst_state_chg().
Details:
bsc_subscr_conn_fsm.c:
- move most states of this FSM to lchan_fsm, assignment_fsm, handover_fsm and
mgw_endpoint_fsm.
- There is exactly one state for an ongoing Assignment, with all details
handled in conn->assignment.fi. The state relies on the assignment_fsm's
timeout.
- There is one state for an ongoing Handover; except for an incoming Handover
from a remote BSS, the gscon remains in ST_INIT until the new lchan and conn
are both established.
- move bssmap_add_lcls_status() to osmo_bsc_lcls.c
abis_rsl.c:
- move all dynamic timeslot logic away into timeslot_fsm. Only keep plain send/receive functions in
abis_rsl.c
- reduce some rsl functions to merely send a message, rename to "_tx_".
- rsl_ipacc_mdcx(): add '_tx_' in the name; move parts that change the lchan state out into the
lchan_fsm, the lchan->abis_ip.* are now set there prior to invoking this function.
- move all timers and error/release handling away into various FSMs.
- tweak ipa_smod_s_for_lchan() and ipa_rtp_pt_for_lchan() to not require an
lchan passed, but just mode,type that they require. Rename to
ipacc_speech_mode*() and ipacc_payload_type().
- add rsl_forward_layer3_info, used for inter-BSC HO MO, to just send the RR
message received during BSSMAP Handover Command.
- move various logging to LOG_LCHAN() in order to log with the lchan FSM instance.
One drawback is that the lchan FSM is limited to one logging category, i.e. this moves some logging
from DRR to DRSL. It might actually make sense to combine those categories.
- lose LOGP...LOGPC logging cascades: they are bad for gsmtap logging and for performance.
- handle_classmark_chg(): change logging, move cm2 len check out of the cm3 condition (I hope that's
correct).
- gsm48_send_ho_cmd(): split off gsm48_make_ho_cmd() which doesn't send right away, so that during
inter-bsc HO we can make an RR Handover Command to send via the MSC to the remote BSS.
assignment_fsm.c:
- the Chan Mode Modify in case of re-using the same lchan is not implemented
yet, because this was also missing in the previous implementation (OS#3357).
osmo_bsc_api.c:
- simplify bsc_mr_config() and move to lchan_fsm.c, the only caller; rename to
lchan_mr_config(). (bsc_mr_config() used to copy the values to mr_bts_lv
twice, once by member assignment and then again with a memcpy.)
- During handover, we used to copy the MR config from the old lchan. Since we
may handover between FR and HR, rather set the MR Config anew every time, so
that FR rates are always available on FR lchans, and never on HR lchans.
Depends: I03ee7ce840ecfa0b6a33358e7385528aabd4873f (libosmocore),
I1f2918418c38918c5ac70acaa51a47adfca12b5e (libosmocore)
Change-Id: I82e3f918295daa83274a4cf803f046979f284366
2018-05-14 16:14:15 +00:00
|
|
|
#include <osmocom/bsc/timeslot_fsm.h>
|
|
|
|
#include <osmocom/bsc/lchan_fsm.h>
|
|
|
|
#include <osmocom/bsc/bsc_subscr_conn_fsm.h>
|
2018-12-11 14:01:01 +00:00
|
|
|
#include <osmocom/bsc/bsc_subscriber.h>
|
large refactoring: use FSMs for lchans; add inter-BSC HO
Add FSMs:
- timeslot_fsm: handle dynamic timeslots and OML+RSL availability.
- lchan_fsm: handle an individual lchan activation, RTP stream and release,
signal the appropriate calling FSMs on success, failure, release.
- mgw_endpoint_fsm: handle one entire endpoint with several CI.
- assignment_fsm: BSSMAP Assignment Request.
- handover_fsm: all of intra, inter-MO and inter-MT handover.
Above FSMs absorb large parts of the gscon FSM. The gscon FSM was surpassing
the maximum amount events (32), and it is more logical to treat assignment,
handover and MGW procedures in separate FSMs.
- Add logging macros for each FSM type:
- LOG_TS()
- LOG_LCHAN()
- LOG_MGWEP(), LOG_CI()
- LOG_ASSIGNMENT()
- LOG_HO()
These log with the osmo_fsm_inst where present.
New style decision: logging without a final newline char is awkward,
especially for gsmtap logging and when other logs interleave LOGPC() calls;
we have various cases where the final \n goes missing, and also this invokes
the log category checking N times instead of once.
So I decided to make these macros *always* append a newline, but only if
there is no final newline yet. I hope that the compiler optimizes the
strlen() of the constant format strings away. Thus I can log with or without
typing "\n" and always get an \n termination anyway.
General:
- replace osmo_timers, state enums and program-wide osmo_signal_dispatch()
with dedicated FSM timeouts, states and events.
- introduce a common way to handle Tnnn timers: gsm_timers.h/.c: struct T_def.
These can be used (with some macro magic) to define a state's timeout once,
and not make mistakes for each osmo_fsm_inst_state_chg().
Details:
bsc_subscr_conn_fsm.c:
- move most states of this FSM to lchan_fsm, assignment_fsm, handover_fsm and
mgw_endpoint_fsm.
- There is exactly one state for an ongoing Assignment, with all details
handled in conn->assignment.fi. The state relies on the assignment_fsm's
timeout.
- There is one state for an ongoing Handover; except for an incoming Handover
from a remote BSS, the gscon remains in ST_INIT until the new lchan and conn
are both established.
- move bssmap_add_lcls_status() to osmo_bsc_lcls.c
abis_rsl.c:
- move all dynamic timeslot logic away into timeslot_fsm. Only keep plain send/receive functions in
abis_rsl.c
- reduce some rsl functions to merely send a message, rename to "_tx_".
- rsl_ipacc_mdcx(): add '_tx_' in the name; move parts that change the lchan state out into the
lchan_fsm, the lchan->abis_ip.* are now set there prior to invoking this function.
- move all timers and error/release handling away into various FSMs.
- tweak ipa_smod_s_for_lchan() and ipa_rtp_pt_for_lchan() to not require an
lchan passed, but just mode,type that they require. Rename to
ipacc_speech_mode*() and ipacc_payload_type().
- add rsl_forward_layer3_info, used for inter-BSC HO MO, to just send the RR
message received during BSSMAP Handover Command.
- move various logging to LOG_LCHAN() in order to log with the lchan FSM instance.
One drawback is that the lchan FSM is limited to one logging category, i.e. this moves some logging
from DRR to DRSL. It might actually make sense to combine those categories.
- lose LOGP...LOGPC logging cascades: they are bad for gsmtap logging and for performance.
- handle_classmark_chg(): change logging, move cm2 len check out of the cm3 condition (I hope that's
correct).
- gsm48_send_ho_cmd(): split off gsm48_make_ho_cmd() which doesn't send right away, so that during
inter-bsc HO we can make an RR Handover Command to send via the MSC to the remote BSS.
assignment_fsm.c:
- the Chan Mode Modify in case of re-using the same lchan is not implemented
yet, because this was also missing in the previous implementation (OS#3357).
osmo_bsc_api.c:
- simplify bsc_mr_config() and move to lchan_fsm.c, the only caller; rename to
lchan_mr_config(). (bsc_mr_config() used to copy the values to mr_bts_lv
twice, once by member assignment and then again with a memcpy.)
- During handover, we used to copy the MR config from the old lchan. Since we
may handover between FR and HR, rather set the MR Config anew every time, so
that FR rates are always available on FR lchans, and never on HR lchans.
Depends: I03ee7ce840ecfa0b6a33358e7385528aabd4873f (libosmocore),
I1f2918418c38918c5ac70acaa51a47adfca12b5e (libosmocore)
Change-Id: I82e3f918295daa83274a4cf803f046979f284366
2018-05-14 16:14:15 +00:00
|
|
|
#include <osmocom/bsc/assignment_fsm.h>
|
|
|
|
#include <osmocom/bsc/handover_fsm.h>
|
2019-06-13 07:41:58 +00:00
|
|
|
#include <osmocom/bsc/smscb.h>
|
2020-09-17 15:54:39 +00:00
|
|
|
#include <osmocom/bsc/lb.h>
|
2010-06-30 06:33:01 +00:00
|
|
|
|
2014-08-20 21:47:15 +00:00
|
|
|
#include <osmocom/ctrl/control_cmd.h>
|
|
|
|
#include <osmocom/ctrl/control_if.h>
|
2014-08-24 15:54:49 +00:00
|
|
|
#include <osmocom/ctrl/ports.h>
|
2016-02-23 14:10:33 +00:00
|
|
|
#include <osmocom/ctrl/control_vty.h>
|
2011-07-22 15:55:42 +00:00
|
|
|
|
2011-05-12 14:02:07 +00:00
|
|
|
#include <osmocom/core/application.h>
|
2011-06-30 09:03:07 +00:00
|
|
|
#include <osmocom/core/linuxlist.h>
|
2011-03-22 15:47:59 +00:00
|
|
|
#include <osmocom/core/talloc.h>
|
2015-10-26 15:25:37 +00:00
|
|
|
#include <osmocom/core/stats.h>
|
2011-02-18 15:17:58 +00:00
|
|
|
#include <osmocom/gsm/protocol/gsm_12_21.h>
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
#include <osmocom/vty/telnet_interface.h>
|
|
|
|
#include <osmocom/vty/ports.h>
|
2018-05-30 20:08:21 +00:00
|
|
|
#include <osmocom/vty/logging.h>
|
2018-06-15 13:46:45 +00:00
|
|
|
#include <osmocom/vty/command.h>
|
2020-08-18 10:21:17 +00:00
|
|
|
#include <osmocom/vty/cpu_sched_vty.h>
|
2010-06-30 06:59:23 +00:00
|
|
|
|
2019-04-23 16:37:37 +00:00
|
|
|
#include <osmocom/mgcp_client/mgcp_client_endpoint_fsm.h>
|
2021-07-26 11:11:27 +00:00
|
|
|
#include <osmocom/mgcp_client/mgcp_client_pool.h>
|
2019-04-23 16:37:37 +00:00
|
|
|
|
2012-03-16 10:54:55 +00:00
|
|
|
#include <osmocom/abis/abis.h>
|
2018-02-13 16:06:16 +00:00
|
|
|
#include <osmocom/bsc/abis_om2000.h>
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
#include <osmocom/bsc/abis_nm.h>
|
|
|
|
#include <osmocom/bsc/abis_rsl.h>
|
|
|
|
#include <osmocom/bsc/chan_alloc.h>
|
|
|
|
#include <osmocom/bsc/e1_config.h>
|
2018-10-05 12:59:37 +00:00
|
|
|
#include <osmocom/bsc/codec_pref.h>
|
2020-07-02 20:19:29 +00:00
|
|
|
#include <osmocom/bsc/system_information.h>
|
2020-07-15 18:53:16 +00:00
|
|
|
#include <osmocom/bsc/bts.h>
|
2021-08-29 11:18:40 +00:00
|
|
|
#include <osmocom/bsc/bsc_stats.h>
|
2012-03-16 10:54:55 +00:00
|
|
|
|
2017-09-27 13:51:34 +00:00
|
|
|
#include <osmocom/mgcp_client/mgcp_client.h>
|
2021-07-26 11:11:27 +00:00
|
|
|
#include <osmocom/mgcp_client/mgcp_client_pool.h>
|
2010-07-29 18:53:14 +00:00
|
|
|
|
2018-07-11 02:26:34 +00:00
|
|
|
#include <osmocom/sigtran/xua_msg.h>
|
|
|
|
|
2010-06-30 06:59:23 +00:00
|
|
|
#define _GNU_SOURCE
|
|
|
|
#include <getopt.h>
|
|
|
|
|
2010-09-15 14:29:25 +00:00
|
|
|
#include <signal.h>
|
2010-06-30 06:59:23 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <time.h>
|
2010-09-15 14:29:25 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
|
2010-06-30 06:59:23 +00:00
|
|
|
|
2011-03-04 12:53:51 +00:00
|
|
|
#include "../../bscconfig.h"
|
2010-06-30 06:59:23 +00:00
|
|
|
|
2017-07-09 20:09:18 +00:00
|
|
|
static const char *config_file = "osmo-bsc.cfg";
|
2011-06-04 07:32:35 +00:00
|
|
|
static const char *rf_ctrl = NULL;
|
2010-08-25 17:43:54 +00:00
|
|
|
static int daemonize = 0;
|
2010-06-30 06:59:23 +00:00
|
|
|
|
|
|
|
static void print_usage()
|
|
|
|
{
|
2011-04-13 07:17:40 +00:00
|
|
|
printf("Usage: osmo-bsc\n");
|
2010-06-30 06:59:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void print_help()
|
|
|
|
{
|
2020-10-23 13:50:21 +00:00
|
|
|
printf("Some useful options:\n");
|
2018-06-15 13:45:31 +00:00
|
|
|
printf(" -h --help This text.\n");
|
|
|
|
printf(" -D --daemonize Fork the process into a background daemon.\n");
|
|
|
|
printf(" -d --debug option --debug=DRLL:DMM:DRR:DRSL:DNM enable debugging.\n");
|
|
|
|
printf(" -s --disable-color Disable coloring log in stderr.\n");
|
|
|
|
printf(" -T --timestamp Print a timestamp in the debug output.\n");
|
2018-06-15 13:46:45 +00:00
|
|
|
printf(" -V --version Print the version of OsmoBSC.\n");
|
2018-06-15 13:45:31 +00:00
|
|
|
printf(" -c --config-file filename The config file to use.\n");
|
|
|
|
printf(" -e --log-level number Set a global loglevel.\n");
|
|
|
|
printf(" -r --rf-ctl NAME A unix domain socket to listen for cmds.\n");
|
2020-10-23 13:50:21 +00:00
|
|
|
|
|
|
|
printf("\nVTY reference generation:\n");
|
|
|
|
printf(" --vty-ref-mode MODE VTY reference generation mode (e.g. 'expert').\n");
|
|
|
|
printf(" --vty-ref-xml Generate the VTY reference XML output and exit.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void handle_long_options(const char *prog_name, const int long_option)
|
|
|
|
{
|
|
|
|
static int vty_ref_mode = VTY_REF_GEN_MODE_DEFAULT;
|
|
|
|
|
|
|
|
switch (long_option) {
|
|
|
|
case 1:
|
|
|
|
vty_ref_mode = get_string_value(vty_ref_gen_mode_names, optarg);
|
|
|
|
if (vty_ref_mode < 0) {
|
|
|
|
fprintf(stderr, "%s: Unknown VTY reference generation "
|
|
|
|
"mode '%s'\n", prog_name, optarg);
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
fprintf(stderr, "Generating the VTY reference in mode '%s' (%s)\n",
|
|
|
|
get_value_string(vty_ref_gen_mode_names, vty_ref_mode),
|
|
|
|
get_value_string(vty_ref_gen_mode_desc, vty_ref_mode));
|
|
|
|
vty_dump_xml_ref_mode(stdout, (enum vty_ref_gen_mode) vty_ref_mode);
|
|
|
|
exit(0);
|
|
|
|
default:
|
|
|
|
fprintf(stderr, "%s: error parsing cmdline options\n", prog_name);
|
|
|
|
exit(2);
|
|
|
|
}
|
2010-06-30 06:59:23 +00:00
|
|
|
}
|
|
|
|
|
2010-09-17 22:44:24 +00:00
|
|
|
static void handle_options(int argc, char **argv)
|
2010-06-30 06:59:23 +00:00
|
|
|
{
|
|
|
|
while (1) {
|
|
|
|
int option_index = 0, c;
|
2020-05-14 15:46:26 +00:00
|
|
|
static int long_option = 0;
|
2010-06-30 06:59:23 +00:00
|
|
|
static struct option long_options[] = {
|
|
|
|
{"help", 0, 0, 'h'},
|
|
|
|
{"debug", 1, 0, 'd'},
|
2010-08-25 17:43:54 +00:00
|
|
|
{"daemonize", 0, 0, 'D'},
|
2010-06-30 06:59:23 +00:00
|
|
|
{"config-file", 1, 0, 'c'},
|
|
|
|
{"disable-color", 0, 0, 's'},
|
|
|
|
{"timestamp", 0, 0, 'T'},
|
2018-06-15 13:46:45 +00:00
|
|
|
{"version", 0, 0, 'V' },
|
2010-06-30 06:59:23 +00:00
|
|
|
{"log-level", 1, 0, 'e'},
|
|
|
|
{"rf-ctl", 1, 0, 'r'},
|
2020-10-23 13:50:21 +00:00
|
|
|
{"vty-ref-mode", 1, &long_option, 1},
|
|
|
|
{"vty-ref-xml", 0, &long_option, 2},
|
2010-06-30 06:59:23 +00:00
|
|
|
{0, 0, 0, 0}
|
|
|
|
};
|
|
|
|
|
2021-10-19 13:19:23 +00:00
|
|
|
c = getopt_long(argc, argv, "hd:DsTVc:e:r:",
|
2010-06-30 06:59:23 +00:00
|
|
|
long_options, &option_index);
|
|
|
|
if (c == -1)
|
|
|
|
break;
|
|
|
|
|
|
|
|
switch (c) {
|
|
|
|
case 'h':
|
|
|
|
print_usage();
|
|
|
|
print_help();
|
|
|
|
exit(0);
|
2020-05-14 15:46:26 +00:00
|
|
|
case 0:
|
2020-10-23 13:50:21 +00:00
|
|
|
handle_long_options(argv[0], long_option);
|
|
|
|
break;
|
2010-06-30 06:59:23 +00:00
|
|
|
case 's':
|
2011-05-12 14:02:07 +00:00
|
|
|
log_set_use_color(osmo_stderr_target, 0);
|
2010-06-30 06:59:23 +00:00
|
|
|
break;
|
|
|
|
case 'd':
|
2011-05-12 14:02:07 +00:00
|
|
|
log_parse_category_mask(osmo_stderr_target, optarg);
|
2010-06-30 06:59:23 +00:00
|
|
|
break;
|
2010-08-25 17:43:54 +00:00
|
|
|
case 'D':
|
|
|
|
daemonize = 1;
|
|
|
|
break;
|
2010-06-30 06:59:23 +00:00
|
|
|
case 'c':
|
2014-06-12 09:19:38 +00:00
|
|
|
config_file = optarg;
|
2010-06-30 06:59:23 +00:00
|
|
|
break;
|
|
|
|
case 'T':
|
2011-05-12 14:02:07 +00:00
|
|
|
log_set_print_timestamp(osmo_stderr_target, 1);
|
2010-06-30 06:59:23 +00:00
|
|
|
break;
|
2018-06-15 13:46:45 +00:00
|
|
|
case 'V':
|
|
|
|
print_version(1);
|
|
|
|
exit(0);
|
|
|
|
break;
|
2010-06-30 06:59:23 +00:00
|
|
|
case 'e':
|
2011-05-12 14:02:07 +00:00
|
|
|
log_set_log_level(osmo_stderr_target, atoi(optarg));
|
2010-06-30 06:59:23 +00:00
|
|
|
break;
|
|
|
|
case 'r':
|
2011-06-04 07:32:35 +00:00
|
|
|
rf_ctrl = optarg;
|
2010-06-30 06:59:23 +00:00
|
|
|
break;
|
|
|
|
default:
|
2020-06-12 15:31:01 +00:00
|
|
|
/* catch unknown options *as well as* missing arguments. */
|
|
|
|
fprintf(stderr, "Error in command line options. Exiting.\n");
|
|
|
|
exit(-1);
|
2010-06-30 06:59:23 +00:00
|
|
|
}
|
|
|
|
}
|
2019-12-03 20:49:06 +00:00
|
|
|
|
|
|
|
if (argc > optind) {
|
|
|
|
fprintf(stderr, "Unsupported positional arguments on command line\n");
|
|
|
|
exit(2);
|
|
|
|
}
|
2010-06-30 06:59:23 +00:00
|
|
|
}
|
|
|
|
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
/* Callback function for NACK on the OML NM */
|
|
|
|
static int oml_msg_nack(struct nm_nack_signal_data *nack)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
if (!nack->bts) {
|
|
|
|
LOGP(DNM, LOGL_ERROR, "Unknown bts. Can not drop it.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_ipaccess_bts(nack->bts))
|
2018-08-22 19:54:12 +00:00
|
|
|
ipaccess_drop_oml_deferred(nack->bts);
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +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)
|
|
|
|
{
|
|
|
|
struct nm_nack_signal_data *nack;
|
|
|
|
|
|
|
|
switch (signal) {
|
|
|
|
case S_NM_NACK:
|
|
|
|
nack = signal_data;
|
|
|
|
return oml_msg_nack(nack);
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Produce a MA as specified in 10.5.2.21 */
|
2021-04-06 01:52:52 +00:00
|
|
|
static void generate_ma_for_ts(struct gsm_bts_trx_ts *ts)
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
{
|
|
|
|
/* we have three bitvecs: the per-timeslot ARFCNs, the cell chan ARFCNs
|
|
|
|
* and the MA */
|
2021-04-06 02:01:50 +00:00
|
|
|
const size_t num_cell_arfcns = ts->trx->bts->si_common.cell_chan_num;
|
2020-07-02 20:47:35 +00:00
|
|
|
const struct bitvec *cell_chan = &ts->trx->bts->si_common.cell_alloc;
|
|
|
|
const struct bitvec *ts_arfcn = &ts->hopping.arfcns;
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
struct bitvec *ma = &ts->hopping.ma;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* re-set the MA to all-zero */
|
|
|
|
ts->hopping.ma_len = 0;
|
|
|
|
memset(ma->data, 0, ma->data_len);
|
|
|
|
|
|
|
|
if (!ts->hopping.enabled)
|
2021-04-06 01:52:52 +00:00
|
|
|
return;
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
|
|
|
|
/* pad it to octet-aligned number of bits */
|
2020-09-06 07:48:11 +00:00
|
|
|
ts->hopping.ma_len = OSMO_BYTES_FOR_BITS(num_cell_arfcns);
|
2020-09-17 13:58:19 +00:00
|
|
|
ma->cur_bit = (ts->hopping.ma_len * 8) - 1;
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
|
2020-09-06 15:39:52 +00:00
|
|
|
for (i = 1; i < 1024; i++) {
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
if (!bitvec_get_bit_pos(cell_chan, i))
|
|
|
|
continue;
|
|
|
|
/* set the corresponding bit in the MA */
|
|
|
|
if (bitvec_get_bit_pos(ts_arfcn, i))
|
2020-09-17 13:58:19 +00:00
|
|
|
bitvec_set_bit_pos(ma, ma->cur_bit, 1);
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
else
|
2020-09-17 13:58:19 +00:00
|
|
|
bitvec_set_bit_pos(ma, ma->cur_bit, 0);
|
|
|
|
ma->cur_bit--;
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ARFCN 0 is special: It is coded last in the bitmask */
|
|
|
|
if (bitvec_get_bit_pos(cell_chan, 0)) {
|
|
|
|
/* set the corresponding bit in the MA */
|
|
|
|
if (bitvec_get_bit_pos(ts_arfcn, 0))
|
2020-09-17 13:58:19 +00:00
|
|
|
bitvec_set_bit_pos(ma, ma->cur_bit, 1);
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
else
|
2020-09-17 13:58:19 +00:00
|
|
|
bitvec_set_bit_pos(ma, ma->cur_bit, 0);
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-06 02:01:50 +00:00
|
|
|
static void generate_ma_for_bts(struct gsm_bts *bts)
|
|
|
|
{
|
|
|
|
struct gsm_bts_trx *trx;
|
|
|
|
unsigned int tn;
|
|
|
|
|
|
|
|
OSMO_ASSERT(bts->si_common.cell_chan_num > 0);
|
|
|
|
OSMO_ASSERT(bts->si_common.cell_chan_num <= 64);
|
|
|
|
|
|
|
|
llist_for_each_entry(trx, &bts->trx_list, list) {
|
|
|
|
for (tn = 0; tn < ARRAY_SIZE(trx->ts); tn++)
|
|
|
|
generate_ma_for_ts(&trx->ts[tn]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
static void bootstrap_rsl(struct gsm_bts_trx *trx)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
2020-12-18 23:42:14 +00:00
|
|
|
int rc;
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
|
2020-07-14 11:01:58 +00:00
|
|
|
LOG_TRX(trx, DRSL, LOGL_NOTICE, "bootstrapping RSL "
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
"on ARFCN %u using MCC-MNC %s LAC=%u CID=%u BSIC=%u\n",
|
2020-07-14 11:01:58 +00:00
|
|
|
trx->arfcn, osmo_plmn_name(&bsc_gsmnet->plmn),
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
trx->bts->location_area_code,
|
|
|
|
trx->bts->cell_identity, trx->bts->bsic);
|
|
|
|
|
|
|
|
if (trx->bts->type == GSM_BTS_TYPE_NOKIA_SITE) {
|
|
|
|
rsl_nokia_si_begin(trx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Trigger ACC ramping before sending system information to BTS.
|
|
|
|
* This ensures that RACH control in system information is configured correctly.
|
|
|
|
* TRX 0 should be usable and unlocked, otherwise starting ACC ramping is pointless.
|
|
|
|
*/
|
2020-06-22 15:57:01 +00:00
|
|
|
if (trx_is_usable(trx))
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
acc_ramp_trigger(&trx->bts->acc_ramp);
|
|
|
|
|
2020-09-03 12:16:59 +00:00
|
|
|
if (gsm_bts_trx_set_system_infos(trx) != 0) {
|
|
|
|
LOG_TRX(trx, DRSL, LOGL_ERROR, "Failed to generate System Information\n");
|
|
|
|
return;
|
|
|
|
}
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +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);
|
|
|
|
}
|
|
|
|
|
2020-12-18 23:42:14 +00:00
|
|
|
if (trx->bts->model->power_ctrl_send_def_params != NULL) {
|
|
|
|
rc = trx->bts->model->power_ctrl_send_def_params(trx);
|
|
|
|
if (rc) {
|
|
|
|
LOG_TRX(trx, DRSL, LOGL_ERROR, "Failed to send default "
|
|
|
|
"MS/BS Power control parameters (rc=%d)\n", rc);
|
|
|
|
/* TODO: should we drop RSL connection here? */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
for (i = 0; i < ARRAY_SIZE(trx->ts); i++) {
|
|
|
|
struct gsm_bts_trx_ts *ts = &trx->ts[i];
|
large refactoring: use FSMs for lchans; add inter-BSC HO
Add FSMs:
- timeslot_fsm: handle dynamic timeslots and OML+RSL availability.
- lchan_fsm: handle an individual lchan activation, RTP stream and release,
signal the appropriate calling FSMs on success, failure, release.
- mgw_endpoint_fsm: handle one entire endpoint with several CI.
- assignment_fsm: BSSMAP Assignment Request.
- handover_fsm: all of intra, inter-MO and inter-MT handover.
Above FSMs absorb large parts of the gscon FSM. The gscon FSM was surpassing
the maximum amount events (32), and it is more logical to treat assignment,
handover and MGW procedures in separate FSMs.
- Add logging macros for each FSM type:
- LOG_TS()
- LOG_LCHAN()
- LOG_MGWEP(), LOG_CI()
- LOG_ASSIGNMENT()
- LOG_HO()
These log with the osmo_fsm_inst where present.
New style decision: logging without a final newline char is awkward,
especially for gsmtap logging and when other logs interleave LOGPC() calls;
we have various cases where the final \n goes missing, and also this invokes
the log category checking N times instead of once.
So I decided to make these macros *always* append a newline, but only if
there is no final newline yet. I hope that the compiler optimizes the
strlen() of the constant format strings away. Thus I can log with or without
typing "\n" and always get an \n termination anyway.
General:
- replace osmo_timers, state enums and program-wide osmo_signal_dispatch()
with dedicated FSM timeouts, states and events.
- introduce a common way to handle Tnnn timers: gsm_timers.h/.c: struct T_def.
These can be used (with some macro magic) to define a state's timeout once,
and not make mistakes for each osmo_fsm_inst_state_chg().
Details:
bsc_subscr_conn_fsm.c:
- move most states of this FSM to lchan_fsm, assignment_fsm, handover_fsm and
mgw_endpoint_fsm.
- There is exactly one state for an ongoing Assignment, with all details
handled in conn->assignment.fi. The state relies on the assignment_fsm's
timeout.
- There is one state for an ongoing Handover; except for an incoming Handover
from a remote BSS, the gscon remains in ST_INIT until the new lchan and conn
are both established.
- move bssmap_add_lcls_status() to osmo_bsc_lcls.c
abis_rsl.c:
- move all dynamic timeslot logic away into timeslot_fsm. Only keep plain send/receive functions in
abis_rsl.c
- reduce some rsl functions to merely send a message, rename to "_tx_".
- rsl_ipacc_mdcx(): add '_tx_' in the name; move parts that change the lchan state out into the
lchan_fsm, the lchan->abis_ip.* are now set there prior to invoking this function.
- move all timers and error/release handling away into various FSMs.
- tweak ipa_smod_s_for_lchan() and ipa_rtp_pt_for_lchan() to not require an
lchan passed, but just mode,type that they require. Rename to
ipacc_speech_mode*() and ipacc_payload_type().
- add rsl_forward_layer3_info, used for inter-BSC HO MO, to just send the RR
message received during BSSMAP Handover Command.
- move various logging to LOG_LCHAN() in order to log with the lchan FSM instance.
One drawback is that the lchan FSM is limited to one logging category, i.e. this moves some logging
from DRR to DRSL. It might actually make sense to combine those categories.
- lose LOGP...LOGPC logging cascades: they are bad for gsmtap logging and for performance.
- handle_classmark_chg(): change logging, move cm2 len check out of the cm3 condition (I hope that's
correct).
- gsm48_send_ho_cmd(): split off gsm48_make_ho_cmd() which doesn't send right away, so that during
inter-bsc HO we can make an RR Handover Command to send via the MSC to the remote BSS.
assignment_fsm.c:
- the Chan Mode Modify in case of re-using the same lchan is not implemented
yet, because this was also missing in the previous implementation (OS#3357).
osmo_bsc_api.c:
- simplify bsc_mr_config() and move to lchan_fsm.c, the only caller; rename to
lchan_mr_config(). (bsc_mr_config() used to copy the values to mr_bts_lv
twice, once by member assignment and then again with a memcpy.)
- During handover, we used to copy the MR config from the old lchan. Since we
may handover between FR and HR, rather set the MR Config anew every time, so
that FR rates are always available on FR lchans, and never on HR lchans.
Depends: I03ee7ce840ecfa0b6a33358e7385528aabd4873f (libosmocore),
I1f2918418c38918c5ac70acaa51a47adfca12b5e (libosmocore)
Change-Id: I82e3f918295daa83274a4cf803f046979f284366
2018-05-14 16:14:15 +00:00
|
|
|
OSMO_ASSERT(ts->fi);
|
|
|
|
osmo_fsm_inst_dispatch(ts->fi, TS_EV_RSL_READY, NULL);
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
}
|
2019-06-13 07:41:58 +00:00
|
|
|
|
2020-09-10 18:40:35 +00:00
|
|
|
/* Drop all expired channel requests in the list */
|
|
|
|
abis_rsl_chan_rqd_queue_flush(trx->bts);
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
}
|
|
|
|
|
2021-08-29 11:31:05 +00:00
|
|
|
struct osmo_timer_list update_connection_stats_timer;
|
|
|
|
|
|
|
|
/* Periodically call bsc_update_connection_stats() to keep stat items updated.
|
|
|
|
* It would be nicer to trigger this only when OML or RSL state is seen to flip. I tried hard to find all code paths
|
|
|
|
* that should call this and failed to get accurate results; this trivial timer covers all of them. */
|
|
|
|
static void update_connection_stats_cb(void *data)
|
|
|
|
{
|
|
|
|
bsc_update_connection_stats(bsc_gsmnet);
|
|
|
|
osmo_timer_setup(&update_connection_stats_timer, update_connection_stats_cb, NULL);
|
|
|
|
osmo_timer_schedule(&update_connection_stats_timer, 1, 0);
|
|
|
|
}
|
|
|
|
|
2021-11-02 14:52:11 +00:00
|
|
|
static void bootstrap_bts(struct gsm_bts *bts)
|
|
|
|
{
|
|
|
|
unsigned int n = 0;
|
|
|
|
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
/* Control Channel Description is set from vty/config */
|
|
|
|
|
2019-11-01 18:22:20 +00:00
|
|
|
/* Determine the value of CCCH_CONF. Is TS0/C0 combined? */
|
2019-11-01 19:28:07 +00:00
|
|
|
if (bts->c0->ts[0].pchan_from_config != GSM_PCHAN_CCCH) {
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
bts->si_common.chan_desc.ccch_conf = RSL_BCCH_CCCH_CONF_1_C;
|
2019-11-01 18:22:20 +00:00
|
|
|
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +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);
|
|
|
|
bts->si_common.chan_desc.bs_ag_blks_res = 2;
|
|
|
|
}
|
2019-11-01 18:22:20 +00:00
|
|
|
} else { /* Non-combined TS0/C0 configuration */
|
|
|
|
/* There can be additional CCCHs on even timeslot numbers */
|
2019-11-01 19:28:07 +00:00
|
|
|
n += (bts->c0->ts[2].pchan_from_config == GSM_PCHAN_CCCH);
|
|
|
|
n += (bts->c0->ts[4].pchan_from_config == GSM_PCHAN_CCCH);
|
|
|
|
n += (bts->c0->ts[6].pchan_from_config == GSM_PCHAN_CCCH);
|
2019-11-01 18:22:20 +00:00
|
|
|
bts->si_common.chan_desc.ccch_conf = (n << 1);
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ACC ramping is initialized from vty/config */
|
|
|
|
|
|
|
|
/* Initialize the BTS state */
|
2020-12-01 16:25:28 +00:00
|
|
|
gsm_bts_sm_mo_reset(bts->site_mgr);
|
2021-11-09 14:05:14 +00:00
|
|
|
|
|
|
|
/* Generate Mobile Allocation bit-masks for all timeslots.
|
|
|
|
* This needs to be done here, because it's used for TS configuration. */
|
|
|
|
generate_ma_for_bts(bts);
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
}
|
|
|
|
|
2021-11-02 14:56:04 +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)
|
|
|
|
{
|
|
|
|
struct input_signal_data *isd = signal_data;
|
|
|
|
struct gsm_bts_trx *trx = isd->trx;
|
2021-11-09 14:02:50 +00:00
|
|
|
int rc;
|
2021-11-02 14:56:04 +00:00
|
|
|
|
|
|
|
if (subsys != SS_L_INPUT)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
LOGP(DLMI, LOGL_DEBUG, "%s(): Input signal '%s' received\n", __func__,
|
|
|
|
get_value_string(e1inp_signal_names, signal));
|
|
|
|
switch (signal) {
|
|
|
|
case S_L_INP_TEI_UP:
|
|
|
|
if (isd->link_type == E1INP_SIGN_OML) {
|
2021-11-09 14:02:50 +00:00
|
|
|
/* Check parameters and apply vty config dependent parameters */
|
2021-11-09 15:21:34 +00:00
|
|
|
rc = gsm_bts_check_cfg(trx->bts);
|
2021-11-09 14:02:50 +00:00
|
|
|
if (rc < 0) {
|
|
|
|
LOGP(DNM, LOGL_ERROR, "(bts=%u) Error in BTS configuration -- cannot bootstrap BTS\n",
|
|
|
|
trx->bts->nr);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
bootstrap_bts(trx->bts);
|
2021-11-02 14:56:04 +00:00
|
|
|
}
|
2021-11-09 14:02:50 +00:00
|
|
|
if (isd->link_type == E1INP_SIGN_RSL) {
|
2021-11-09 15:21:34 +00:00
|
|
|
rc = gsm_bts_check_cfg(trx->bts);
|
2021-11-09 14:02:50 +00:00
|
|
|
if (rc < 0) {
|
|
|
|
LOGP(DNM, LOGL_ERROR, "(bts=%u) Error in BTS configuration -- cannot bootstrap RSL\n",
|
|
|
|
trx->bts->nr);
|
|
|
|
return rc;
|
|
|
|
}
|
2021-11-02 14:56:04 +00:00
|
|
|
bootstrap_rsl(trx);
|
2021-11-09 14:02:50 +00:00
|
|
|
}
|
2021-11-02 14:56:04 +00:00
|
|
|
break;
|
|
|
|
case S_L_INP_TEI_DN:
|
|
|
|
LOG_TRX(trx, DLMI, LOGL_ERROR, "Lost E1 %s link\n", e1inp_signtype_name(isd->link_type));
|
|
|
|
|
|
|
|
if (isd->link_type == E1INP_SIGN_OML) {
|
|
|
|
rate_ctr_inc(rate_ctr_group_get_ctr(trx->bts->bts_ctrs, BTS_CTR_BTS_OML_FAIL));
|
2022-03-06 15:57:35 +00:00
|
|
|
/* ip.access BTS models have a single global A-bis/OML link for all
|
|
|
|
* transceivers, so once it's lost we need to notify them all. */
|
|
|
|
if (is_ipaccess_bts(trx->bts))
|
|
|
|
gsm_bts_all_ts_dispatch(trx->bts, TS_EV_OML_DOWN, NULL);
|
|
|
|
else /* Other BTS models (e.g. Ericsson) have per-TRX OML links */
|
|
|
|
gsm_trx_all_ts_dispatch(trx, TS_EV_OML_DOWN, NULL);
|
2021-11-02 14:56:04 +00:00
|
|
|
} else if (isd->link_type == E1INP_SIGN_RSL) {
|
|
|
|
rate_ctr_inc(rate_ctr_group_get_ctr(trx->bts->bts_ctrs, BTS_CTR_BTS_RSL_FAIL));
|
|
|
|
acc_ramp_abort(&trx->bts->acc_ramp);
|
2022-05-04 09:47:53 +00:00
|
|
|
gsm_trx_all_ts_dispatch(trx, TS_EV_RSL_DOWN, NULL);
|
2021-11-02 14:56:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gsm_bts_sm_mo_reset(trx->bts->site_mgr);
|
|
|
|
|
|
|
|
abis_nm_clear_queue(trx->bts);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
static int bsc_network_configure(const char *config_file)
|
|
|
|
{
|
|
|
|
struct gsm_bts *bts;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = vty_read_config_file(config_file, NULL);
|
|
|
|
if (rc < 0) {
|
|
|
|
LOGP(DNM, LOGL_FATAL, "Failed to parse the config file: '%s'\n", config_file);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
osmo_signal_register_handler(SS_NM, nm_sig_cb, NULL);
|
|
|
|
osmo_signal_register_handler(SS_L_INPUT, inp_sig_cb, NULL);
|
|
|
|
|
|
|
|
llist_for_each_entry(bts, &bsc_gsmnet->bts_list, list) {
|
2021-11-09 15:21:34 +00:00
|
|
|
rc = gsm_bts_check_cfg(bts);
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
if (rc < 0) {
|
2021-11-02 14:52:11 +00:00
|
|
|
LOGP(DNM, LOGL_FATAL, "(bts=%u) cannot bootstrap BTS, invalid BTS configuration\n", bts->nr);
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
return rc;
|
|
|
|
}
|
2021-11-02 14:52:11 +00:00
|
|
|
bootstrap_bts(bts);
|
dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.
Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).
In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.
From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)
Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.
Rationale:
1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.
2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.
Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-05-26 23:26:31 +00:00
|
|
|
rc = e1_reconfig_bts(bts);
|
|
|
|
if (rc < 0) {
|
|
|
|
LOGP(DNM, LOGL_FATAL, "Error enabling E1 input driver\n");
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-02-13 16:06:16 +00:00
|
|
|
static int bsc_vty_go_parent(struct vty *vty)
|
|
|
|
{
|
|
|
|
switch (vty->node) {
|
|
|
|
case GSMNET_NODE:
|
|
|
|
vty->node = CONFIG_NODE;
|
|
|
|
vty->index = NULL;
|
|
|
|
break;
|
|
|
|
case BTS_NODE:
|
|
|
|
vty->node = GSMNET_NODE;
|
|
|
|
{
|
|
|
|
/* set vty->index correctly ! */
|
|
|
|
struct gsm_bts *bts = vty->index;
|
|
|
|
vty->index = bts->network;
|
|
|
|
vty->index_sub = NULL;
|
|
|
|
}
|
|
|
|
break;
|
2020-12-16 21:36:59 +00:00
|
|
|
case POWER_CTRL_NODE:
|
|
|
|
vty->node = BTS_NODE;
|
|
|
|
{
|
|
|
|
const struct gsm_power_ctrl_params *cp = vty->index;
|
|
|
|
struct gsm_bts *bts;
|
|
|
|
|
|
|
|
if (cp->dir == GSM_PWR_CTRL_DIR_UL)
|
|
|
|
bts = container_of(cp, struct gsm_bts, ms_power_ctrl);
|
|
|
|
else
|
|
|
|
bts = container_of(cp, struct gsm_bts, bs_power_ctrl);
|
|
|
|
|
|
|
|
vty->index_sub = &bts->description;
|
|
|
|
vty->index = bts;
|
|
|
|
}
|
|
|
|
break;
|
2018-02-13 16:06:16 +00:00
|
|
|
case TRX_NODE:
|
|
|
|
vty->node = BTS_NODE;
|
|
|
|
{
|
|
|
|
/* set vty->index correctly ! */
|
|
|
|
struct gsm_bts_trx *trx = vty->index;
|
|
|
|
vty->index = trx->bts;
|
|
|
|
vty->index_sub = &trx->bts->description;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TS_NODE:
|
|
|
|
vty->node = TRX_NODE;
|
|
|
|
{
|
|
|
|
/* set vty->index correctly ! */
|
|
|
|
struct gsm_bts_trx_ts *ts = vty->index;
|
|
|
|
vty->index = ts->trx;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OML_NODE:
|
|
|
|
case OM2K_NODE:
|
|
|
|
vty->node = ENABLE_NODE;
|
|
|
|
/* NOTE: this only works because it's not part of the config
|
|
|
|
* tree, where outer commands are searched via vty_go_parent()
|
|
|
|
* and only (!) executed when a matching one is found.
|
|
|
|
*/
|
|
|
|
talloc_free(vty->index);
|
|
|
|
vty->index = NULL;
|
|
|
|
break;
|
|
|
|
case OM2K_CON_GROUP_NODE:
|
|
|
|
vty->node = BTS_NODE;
|
|
|
|
{
|
|
|
|
struct con_group *cg = vty->index;
|
|
|
|
struct gsm_bts *bts = cg->bts;
|
|
|
|
vty->index = bts;
|
|
|
|
vty->index_sub = &bts->description;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BSC_NODE:
|
|
|
|
case MSC_NODE:
|
|
|
|
vty->node = CONFIG_NODE;
|
|
|
|
vty->index = NULL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
osmo_ss7_vty_go_parent(vty);
|
|
|
|
}
|
|
|
|
|
|
|
|
return vty->node;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int bsc_vty_is_config_node(struct vty *vty, int node)
|
|
|
|
{
|
|
|
|
/* Check if libosmo-sccp declares the node in
|
|
|
|
* question as config node */
|
|
|
|
if (osmo_ss7_is_config_node(vty, node))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
switch (node) {
|
|
|
|
/* add items that are not config */
|
|
|
|
case OML_NODE:
|
|
|
|
case OM2K_NODE:
|
|
|
|
case CONFIG_NODE:
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2010-06-30 06:59:23 +00:00
|
|
|
|
|
|
|
static struct vty_app_info vty_info = {
|
2011-02-24 22:57:06 +00:00
|
|
|
.name = "OsmoBSC",
|
2018-02-13 15:31:21 +00:00
|
|
|
.copyright =
|
|
|
|
"Copyright (C) 2008-2018 Harald Welte, Holger Freyther\r\n"
|
|
|
|
"Contributions by Daniel Willmann, Jan Lübbe, Stefan Schmidt\r\n"
|
|
|
|
"Dieter Spaar, Andreas Eversberg, Sylvain Munaut, Neels Hofmeyr\r\n\r\n"
|
|
|
|
"License AGPLv3+: GNU AGPL version 3 or later <http://gnu.org/licenses/agpl-3.0.html>\r\n"
|
|
|
|
"This is free software: you are free to change and redistribute it.\r\n"
|
|
|
|
"There is NO WARRANTY, to the extent permitted by law.\r\n",
|
2010-06-30 06:59:23 +00:00
|
|
|
.version = PACKAGE_VERSION,
|
|
|
|
.go_parent_cb = bsc_vty_go_parent,
|
2010-08-26 07:38:42 +00:00
|
|
|
.is_config_node = bsc_vty_is_config_node,
|
2020-08-16 10:09:15 +00:00
|
|
|
.usr_attr_desc = {
|
|
|
|
[BSC_VTY_ATTR_RESTART_ABIS_OML_LINK] = \
|
|
|
|
"This command applies on A-bis OML link (re)establishment",
|
|
|
|
[BSC_VTY_ATTR_RESTART_ABIS_RSL_LINK] = \
|
|
|
|
"This command applies on A-bis RSL link (re)establishment",
|
|
|
|
[BSC_VTY_ATTR_NEW_LCHAN] = \
|
|
|
|
"This command applies for newly created lchans",
|
2020-12-10 20:44:53 +00:00
|
|
|
[BSC_VTY_ATTR_VENDOR_SPECIFIC] = \
|
|
|
|
"This command/parameter is BTS vendor specific",
|
2020-08-16 10:09:15 +00:00
|
|
|
},
|
|
|
|
.usr_attr_letters = {
|
|
|
|
[BSC_VTY_ATTR_RESTART_ABIS_OML_LINK] = 'o',
|
|
|
|
[BSC_VTY_ATTR_RESTART_ABIS_RSL_LINK] = 'r',
|
|
|
|
[BSC_VTY_ATTR_NEW_LCHAN] = 'l',
|
2020-12-10 20:44:53 +00:00
|
|
|
[BSC_VTY_ATTR_VENDOR_SPECIFIC] = 'v',
|
2020-08-16 10:09:15 +00:00
|
|
|
},
|
2010-06-30 06:59:23 +00:00
|
|
|
};
|
|
|
|
|
2010-09-15 14:29:25 +00:00
|
|
|
extern int bsc_shutdown_net(struct gsm_network *net);
|
2020-11-25 16:08:18 +00:00
|
|
|
static void signal_handler(int signum)
|
2010-09-15 14:29:25 +00:00
|
|
|
{
|
2020-11-25 16:08:18 +00:00
|
|
|
fprintf(stdout, "signal %u received\n", signum);
|
2010-09-15 14:29:25 +00:00
|
|
|
|
2020-11-25 16:08:18 +00:00
|
|
|
switch (signum) {
|
2010-09-15 14:29:25 +00:00
|
|
|
case SIGINT:
|
2017-08-20 18:50:06 +00:00
|
|
|
case SIGTERM:
|
2021-06-04 14:20:12 +00:00
|
|
|
/* If SIGTERM was already sent before, just terminate immediately. */
|
|
|
|
if (osmo_select_shutdown_requested())
|
|
|
|
exit(-1);
|
2010-09-15 14:29:25 +00:00
|
|
|
bsc_shutdown_net(bsc_gsmnet);
|
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_L_GLOBAL_SHUTDOWN, NULL);
|
2021-06-04 14:20:12 +00:00
|
|
|
osmo_select_shutdown_request();
|
2010-09-15 14:29:25 +00:00
|
|
|
break;
|
|
|
|
case SIGABRT:
|
2020-11-25 16:08:18 +00:00
|
|
|
/* in case of abort, we want to obtain a talloc report and
|
|
|
|
* then run default SIGABRT handler, who will generate coredump
|
|
|
|
* and abort the process. abort() should do this for us after we
|
|
|
|
* return, but program wouldn't exit if an external SIGABRT is
|
|
|
|
* received.
|
|
|
|
*/
|
|
|
|
talloc_report(tall_vty_ctx, stderr);
|
|
|
|
talloc_report_full(tall_bsc_ctx, stderr);
|
|
|
|
signal(SIGABRT, SIG_DFL);
|
|
|
|
raise(SIGABRT);
|
|
|
|
break;
|
2010-09-15 14:29:25 +00:00
|
|
|
case SIGUSR1:
|
|
|
|
talloc_report(tall_vty_ctx, stderr);
|
|
|
|
talloc_report_full(tall_bsc_ctx, stderr);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-06-30 06:33:01 +00:00
|
|
|
|
2018-02-13 16:16:44 +00:00
|
|
|
static const struct log_info_cat osmo_bsc_categories[] = {
|
|
|
|
[DRLL] = {
|
|
|
|
.name = "DRLL",
|
|
|
|
.description = "A-bis Radio Link Layer (RLL)",
|
|
|
|
.color = "\033[1;31m",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
|
|
|
[DMM] = {
|
|
|
|
.name = "DMM",
|
|
|
|
.description = "Layer3 Mobility Management (MM)",
|
|
|
|
.color = "\033[1;33m",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
|
|
|
[DRR] = {
|
|
|
|
.name = "DRR",
|
|
|
|
.description = "Layer3 Radio Resource (RR)",
|
|
|
|
.color = "\033[1;34m",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
|
|
|
[DRSL] = {
|
|
|
|
.name = "DRSL",
|
2018-04-16 11:40:07 +00:00
|
|
|
.description = "A-bis Radio Signalling Link (RSL)",
|
2018-02-13 16:16:44 +00:00
|
|
|
.color = "\033[1;35m",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
2018-07-11 17:53:39 +00:00
|
|
|
[DCHAN] = {
|
|
|
|
.name = "DCHAN",
|
|
|
|
.description = "lchan FSM",
|
|
|
|
.color = "\033[1;32m",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
|
|
|
[DTS] = {
|
|
|
|
.name = "DTS",
|
|
|
|
.description = "timeslot FSM",
|
|
|
|
.color = "\033[1;31m",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
|
|
|
[DAS] = {
|
|
|
|
.name = "DAS",
|
|
|
|
.description = "assignment FSM",
|
|
|
|
.color = "\033[1;33m",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
2018-02-13 16:16:44 +00:00
|
|
|
[DNM] = {
|
|
|
|
.name = "DNM",
|
|
|
|
.description = "A-bis Network Management / O&M (NM/OML)",
|
|
|
|
.color = "\033[1;36m",
|
2020-01-15 12:20:47 +00:00
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
2018-02-13 16:16:44 +00:00
|
|
|
},
|
|
|
|
[DPAG] = {
|
|
|
|
.name = "DPAG",
|
|
|
|
.description = "Paging Subsystem",
|
|
|
|
.color = "\033[1;38m",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
|
|
|
[DMEAS] = {
|
|
|
|
.name = "DMEAS",
|
|
|
|
.description = "Radio Measurement Processing",
|
|
|
|
.enabled = 0, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
|
|
|
[DMSC] = {
|
|
|
|
.name = "DMSC",
|
|
|
|
.description = "Mobile Switching Center",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
|
|
|
[DHO] = {
|
|
|
|
.name = "DHO",
|
|
|
|
.description = "Hand-Over Process",
|
|
|
|
.color = "\033[1;38m",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
|
|
|
[DHODEC] = {
|
|
|
|
.name = "DHODEC",
|
|
|
|
.description = "Hand-Over Decision",
|
|
|
|
.color = "\033[1;38m",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
|
|
|
[DREF] = {
|
|
|
|
.name = "DREF",
|
|
|
|
.description = "Reference Counting",
|
|
|
|
.enabled = 0, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
|
|
|
[DCTRL] = {
|
|
|
|
.name = "DCTRL",
|
|
|
|
.description = "Control interface",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
|
|
|
[DFILTER] = {
|
|
|
|
.name = "DFILTER",
|
|
|
|
.description = "BSC/NAT IMSI based filtering",
|
2020-01-15 12:20:47 +00:00
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
2018-02-13 16:16:44 +00:00
|
|
|
},
|
|
|
|
[DPCU] = {
|
|
|
|
.name = "DPCU",
|
|
|
|
.description = "PCU Interface",
|
2020-01-15 12:20:47 +00:00
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
2018-02-13 16:16:44 +00:00
|
|
|
},
|
2018-05-29 23:39:43 +00:00
|
|
|
[DLCLS] = {
|
|
|
|
.name = "DLCLS",
|
|
|
|
.description = "Local Call, Local Switch",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
2019-06-13 07:41:58 +00:00
|
|
|
[DCBS] = {
|
|
|
|
.name = "DCBS",
|
|
|
|
.description = "Cell Broadcast System",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
2020-09-17 15:54:39 +00:00
|
|
|
},
|
|
|
|
[DLCS] = {
|
|
|
|
.name = "DLCS",
|
|
|
|
.description = "Location Services",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
2020-10-04 19:32:52 +00:00
|
|
|
[DRESET] = {
|
|
|
|
.name = "DRESET",
|
|
|
|
.description = "RESET/ACK on A and Lb interfaces",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
2021-09-23 04:43:03 +00:00
|
|
|
[DLOOP] = {
|
|
|
|
.name = "DLOOP",
|
|
|
|
.description = "Control loops",
|
|
|
|
.color = "\033[0;34m",
|
|
|
|
.enabled = 1, .loglevel = LOGL_NOTICE,
|
|
|
|
},
|
2018-02-13 16:16:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static int filter_fn(const struct log_context *ctx, struct log_target *tar)
|
|
|
|
{
|
2018-12-11 14:01:01 +00:00
|
|
|
const struct bsc_subscr *bsub_ctx = ctx->ctx[LOG_CTX_BSC_SUBSCR];
|
|
|
|
const struct bsc_subscr *bsub_filter = tar->filter_data[LOG_FLT_BSC_SUBSCR];
|
2018-02-13 16:16:44 +00:00
|
|
|
|
|
|
|
if ((tar->filter_map & (1 << LOG_FLT_BSC_SUBSCR)) != 0
|
2018-12-11 14:01:01 +00:00
|
|
|
&& bsub_ctx && bsub_filter
|
|
|
|
&& strncmp(bsub_ctx->imsi, bsub_filter->imsi, sizeof(bsub_ctx->imsi)) == 0)
|
2018-02-13 16:16:44 +00:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct log_info log_info = {
|
|
|
|
.filter_fn = filter_fn,
|
|
|
|
.cat = osmo_bsc_categories,
|
|
|
|
.num_cat = ARRAY_SIZE(osmo_bsc_categories),
|
|
|
|
};
|
|
|
|
|
2018-02-13 20:21:42 +00:00
|
|
|
extern void *tall_paging_ctx;
|
|
|
|
extern void *tall_fle_ctx;
|
|
|
|
extern void *tall_tqe_ctx;
|
|
|
|
extern void *tall_ctr_ctx;
|
|
|
|
|
2021-07-26 11:11:27 +00:00
|
|
|
static int bsc_mgw_setup(void)
|
|
|
|
{
|
|
|
|
struct mgcp_client *mgcp_client_single;
|
|
|
|
unsigned int pool_members_initalized;
|
|
|
|
|
|
|
|
/* Initalize MGW pool. This initalizes and connects all MGCP clients that are currently configured in
|
|
|
|
* the pool. Adding additional MGCP clients to the pool is possible but the user has to configure and
|
|
|
|
* (re)connect them manually from the VTY. */
|
|
|
|
pool_members_initalized = mgcp_client_pool_connect(bsc_gsmnet->mgw.mgw_pool);
|
|
|
|
if (pool_members_initalized) {
|
|
|
|
LOGP(DNM, LOGL_NOTICE,
|
|
|
|
"MGW pool with %u pool members configured, (ignoring MGW configuration in VTY node 'msc').\n",
|
|
|
|
pool_members_initalized);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize and connect a single MGCP client. This MGCP client will appear as the one and only pool
|
|
|
|
* member if there is no MGW pool configured. */
|
|
|
|
LOGP(DNM, LOGL_NOTICE, "No MGW pool configured, using MGW configuration in VTY node 'msc'\n");
|
2022-10-17 16:00:50 +00:00
|
|
|
mgcp_client_single = mgcp_client_init(bsc_gsmnet, bsc_gsmnet->mgw.conf);
|
2021-07-26 11:11:27 +00:00
|
|
|
if (!mgcp_client_single) {
|
|
|
|
LOGP(DNM, LOGL_ERROR, "MGW (single) client initalization failed\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
if (mgcp_client_connect(mgcp_client_single)) {
|
|
|
|
LOGP(DNM, LOGL_ERROR, "MGW (single) connect failed at (%s:%u)\n",
|
|
|
|
bsc_gsmnet->mgw.conf->remote_addr,
|
|
|
|
bsc_gsmnet->mgw.conf->remote_port);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
mgcp_client_pool_register_single(bsc_gsmnet->mgw.mgw_pool, mgcp_client_single);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-06-30 06:33:01 +00:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2017-02-23 20:57:23 +00:00
|
|
|
struct bsc_msc_data *msc;
|
2010-06-30 06:59:23 +00:00
|
|
|
int rc;
|
|
|
|
|
2018-07-11 02:28:46 +00:00
|
|
|
tall_bsc_ctx = talloc_named_const(NULL, 1, "osmo-bsc");
|
2016-09-16 00:31:17 +00:00
|
|
|
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
|
2018-08-16 17:14:31 +00:00
|
|
|
osmo_signal_talloc_ctx_init(tall_bsc_ctx);
|
2018-07-11 02:26:34 +00:00
|
|
|
osmo_xua_msg_tall_ctx_init(tall_bsc_ctx);
|
2018-02-13 23:50:27 +00:00
|
|
|
vty_info.tall_ctx = tall_bsc_ctx;
|
2011-05-12 14:02:07 +00:00
|
|
|
|
2018-02-13 20:21:42 +00:00
|
|
|
tall_paging_ctx = talloc_named_const(tall_bsc_ctx, 0, "paging_request");
|
|
|
|
tall_fle_ctx = talloc_named_const(tall_bsc_ctx, 0, "bs11_file_list_entry");
|
|
|
|
tall_tqe_ctx = talloc_named_const(tall_bsc_ctx, 0, "subch_txq_entry");
|
|
|
|
tall_ctr_ctx = talloc_named_const(tall_bsc_ctx, 0, "counter");
|
|
|
|
|
2018-03-05 04:31:14 +00:00
|
|
|
osmo_init_logging2(tall_bsc_ctx, &log_info);
|
2017-10-24 16:16:43 +00:00
|
|
|
osmo_stats_init(tall_bsc_ctx);
|
2018-10-04 11:22:15 +00:00
|
|
|
rate_ctr_init(tall_bsc_ctx);
|
2017-10-24 16:16:43 +00:00
|
|
|
|
2019-10-07 23:07:38 +00:00
|
|
|
osmo_fsm_set_dealloc_ctx(OTC_SELECT);
|
2021-12-13 16:03:03 +00:00
|
|
|
osmo_fsm_log_timeouts(true);
|
2019-10-07 23:07:38 +00:00
|
|
|
|
2016-10-23 23:53:38 +00:00
|
|
|
/* Allocate global gsm_network struct */
|
2017-12-17 20:48:47 +00:00
|
|
|
rc = bsc_network_alloc();
|
2016-10-23 23:53:38 +00:00
|
|
|
if (rc) {
|
|
|
|
fprintf(stderr, "Allocation failed. exiting.\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2017-09-27 13:51:34 +00:00
|
|
|
bsc_gsmnet->mgw.conf = talloc_zero(bsc_gsmnet, struct mgcp_client_conf);
|
2021-07-26 11:11:27 +00:00
|
|
|
bsc_gsmnet->mgw.mgw_pool = mgcp_client_pool_alloc(bsc_gsmnet);
|
2017-09-27 13:51:34 +00:00
|
|
|
mgcp_client_conf_init(bsc_gsmnet->mgw.conf);
|
|
|
|
|
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
|
|
|
bts_init();
|
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
|
|
|
libosmo_abis_init(tall_bsc_ctx);
|
2010-06-30 06:59:23 +00:00
|
|
|
|
|
|
|
/* enable filters */
|
|
|
|
|
|
|
|
/* This needs to precede handle_options() */
|
|
|
|
vty_init(&vty_info);
|
2017-01-12 18:35:11 +00:00
|
|
|
bsc_vty_init(bsc_gsmnet);
|
2016-02-23 14:10:33 +00:00
|
|
|
ctrl_vty_init(tall_bsc_ctx);
|
2020-08-18 10:21:17 +00:00
|
|
|
osmo_cpu_sched_vty_init(tall_bsc_ctx);
|
2018-05-30 20:08:21 +00:00
|
|
|
logging_vty_add_deprecated_subsys(tall_bsc_ctx, "cc");
|
|
|
|
logging_vty_add_deprecated_subsys(tall_bsc_ctx, "mgcp");
|
2020-04-04 17:23:33 +00:00
|
|
|
logging_vty_add_deprecated_subsys(tall_bsc_ctx, "nat");
|
2015-04-05 17:46:20 +00:00
|
|
|
|
2019-11-13 21:10:41 +00:00
|
|
|
/* Initialize SS7 */
|
2019-12-01 12:19:05 +00:00
|
|
|
OSMO_ASSERT(osmo_ss7_init() == 0);
|
2017-04-09 10:32:51 +00:00
|
|
|
osmo_ss7_vty_init_asp(tall_bsc_ctx);
|
2018-09-26 23:54:40 +00:00
|
|
|
osmo_sccp_vty_init();
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2010-06-30 06:59:23 +00:00
|
|
|
/* parse options */
|
|
|
|
handle_options(argc, argv);
|
|
|
|
|
|
|
|
/* seed the PRNG */
|
|
|
|
srand(time(NULL));
|
|
|
|
|
large refactoring: use FSMs for lchans; add inter-BSC HO
Add FSMs:
- timeslot_fsm: handle dynamic timeslots and OML+RSL availability.
- lchan_fsm: handle an individual lchan activation, RTP stream and release,
signal the appropriate calling FSMs on success, failure, release.
- mgw_endpoint_fsm: handle one entire endpoint with several CI.
- assignment_fsm: BSSMAP Assignment Request.
- handover_fsm: all of intra, inter-MO and inter-MT handover.
Above FSMs absorb large parts of the gscon FSM. The gscon FSM was surpassing
the maximum amount events (32), and it is more logical to treat assignment,
handover and MGW procedures in separate FSMs.
- Add logging macros for each FSM type:
- LOG_TS()
- LOG_LCHAN()
- LOG_MGWEP(), LOG_CI()
- LOG_ASSIGNMENT()
- LOG_HO()
These log with the osmo_fsm_inst where present.
New style decision: logging without a final newline char is awkward,
especially for gsmtap logging and when other logs interleave LOGPC() calls;
we have various cases where the final \n goes missing, and also this invokes
the log category checking N times instead of once.
So I decided to make these macros *always* append a newline, but only if
there is no final newline yet. I hope that the compiler optimizes the
strlen() of the constant format strings away. Thus I can log with or without
typing "\n" and always get an \n termination anyway.
General:
- replace osmo_timers, state enums and program-wide osmo_signal_dispatch()
with dedicated FSM timeouts, states and events.
- introduce a common way to handle Tnnn timers: gsm_timers.h/.c: struct T_def.
These can be used (with some macro magic) to define a state's timeout once,
and not make mistakes for each osmo_fsm_inst_state_chg().
Details:
bsc_subscr_conn_fsm.c:
- move most states of this FSM to lchan_fsm, assignment_fsm, handover_fsm and
mgw_endpoint_fsm.
- There is exactly one state for an ongoing Assignment, with all details
handled in conn->assignment.fi. The state relies on the assignment_fsm's
timeout.
- There is one state for an ongoing Handover; except for an incoming Handover
from a remote BSS, the gscon remains in ST_INIT until the new lchan and conn
are both established.
- move bssmap_add_lcls_status() to osmo_bsc_lcls.c
abis_rsl.c:
- move all dynamic timeslot logic away into timeslot_fsm. Only keep plain send/receive functions in
abis_rsl.c
- reduce some rsl functions to merely send a message, rename to "_tx_".
- rsl_ipacc_mdcx(): add '_tx_' in the name; move parts that change the lchan state out into the
lchan_fsm, the lchan->abis_ip.* are now set there prior to invoking this function.
- move all timers and error/release handling away into various FSMs.
- tweak ipa_smod_s_for_lchan() and ipa_rtp_pt_for_lchan() to not require an
lchan passed, but just mode,type that they require. Rename to
ipacc_speech_mode*() and ipacc_payload_type().
- add rsl_forward_layer3_info, used for inter-BSC HO MO, to just send the RR
message received during BSSMAP Handover Command.
- move various logging to LOG_LCHAN() in order to log with the lchan FSM instance.
One drawback is that the lchan FSM is limited to one logging category, i.e. this moves some logging
from DRR to DRSL. It might actually make sense to combine those categories.
- lose LOGP...LOGPC logging cascades: they are bad for gsmtap logging and for performance.
- handle_classmark_chg(): change logging, move cm2 len check out of the cm3 condition (I hope that's
correct).
- gsm48_send_ho_cmd(): split off gsm48_make_ho_cmd() which doesn't send right away, so that during
inter-bsc HO we can make an RR Handover Command to send via the MSC to the remote BSS.
assignment_fsm.c:
- the Chan Mode Modify in case of re-using the same lchan is not implemented
yet, because this was also missing in the previous implementation (OS#3357).
osmo_bsc_api.c:
- simplify bsc_mr_config() and move to lchan_fsm.c, the only caller; rename to
lchan_mr_config(). (bsc_mr_config() used to copy the values to mr_bts_lv
twice, once by member assignment and then again with a memcpy.)
- During handover, we used to copy the MR config from the old lchan. Since we
may handover between FR and HR, rather set the MR Config anew every time, so
that FR rates are always available on FR lchans, and never on HR lchans.
Depends: I03ee7ce840ecfa0b6a33358e7385528aabd4873f (libosmocore),
I1f2918418c38918c5ac70acaa51a47adfca12b5e (libosmocore)
Change-Id: I82e3f918295daa83274a4cf803f046979f284366
2018-05-14 16:14:15 +00:00
|
|
|
lchan_fsm_init();
|
|
|
|
bsc_subscr_conn_fsm_init();
|
|
|
|
assignment_fsm_init();
|
|
|
|
handover_fsm_init();
|
2020-10-10 17:01:29 +00:00
|
|
|
lb_init();
|
2022-05-04 17:32:09 +00:00
|
|
|
acc_ramp_global_init();
|
2022-05-04 17:27:34 +00:00
|
|
|
paging_global_init();
|
2022-06-13 17:14:32 +00:00
|
|
|
smscb_global_init();
|
large refactoring: use FSMs for lchans; add inter-BSC HO
Add FSMs:
- timeslot_fsm: handle dynamic timeslots and OML+RSL availability.
- lchan_fsm: handle an individual lchan activation, RTP stream and release,
signal the appropriate calling FSMs on success, failure, release.
- mgw_endpoint_fsm: handle one entire endpoint with several CI.
- assignment_fsm: BSSMAP Assignment Request.
- handover_fsm: all of intra, inter-MO and inter-MT handover.
Above FSMs absorb large parts of the gscon FSM. The gscon FSM was surpassing
the maximum amount events (32), and it is more logical to treat assignment,
handover and MGW procedures in separate FSMs.
- Add logging macros for each FSM type:
- LOG_TS()
- LOG_LCHAN()
- LOG_MGWEP(), LOG_CI()
- LOG_ASSIGNMENT()
- LOG_HO()
These log with the osmo_fsm_inst where present.
New style decision: logging without a final newline char is awkward,
especially for gsmtap logging and when other logs interleave LOGPC() calls;
we have various cases where the final \n goes missing, and also this invokes
the log category checking N times instead of once.
So I decided to make these macros *always* append a newline, but only if
there is no final newline yet. I hope that the compiler optimizes the
strlen() of the constant format strings away. Thus I can log with or without
typing "\n" and always get an \n termination anyway.
General:
- replace osmo_timers, state enums and program-wide osmo_signal_dispatch()
with dedicated FSM timeouts, states and events.
- introduce a common way to handle Tnnn timers: gsm_timers.h/.c: struct T_def.
These can be used (with some macro magic) to define a state's timeout once,
and not make mistakes for each osmo_fsm_inst_state_chg().
Details:
bsc_subscr_conn_fsm.c:
- move most states of this FSM to lchan_fsm, assignment_fsm, handover_fsm and
mgw_endpoint_fsm.
- There is exactly one state for an ongoing Assignment, with all details
handled in conn->assignment.fi. The state relies on the assignment_fsm's
timeout.
- There is one state for an ongoing Handover; except for an incoming Handover
from a remote BSS, the gscon remains in ST_INIT until the new lchan and conn
are both established.
- move bssmap_add_lcls_status() to osmo_bsc_lcls.c
abis_rsl.c:
- move all dynamic timeslot logic away into timeslot_fsm. Only keep plain send/receive functions in
abis_rsl.c
- reduce some rsl functions to merely send a message, rename to "_tx_".
- rsl_ipacc_mdcx(): add '_tx_' in the name; move parts that change the lchan state out into the
lchan_fsm, the lchan->abis_ip.* are now set there prior to invoking this function.
- move all timers and error/release handling away into various FSMs.
- tweak ipa_smod_s_for_lchan() and ipa_rtp_pt_for_lchan() to not require an
lchan passed, but just mode,type that they require. Rename to
ipacc_speech_mode*() and ipacc_payload_type().
- add rsl_forward_layer3_info, used for inter-BSC HO MO, to just send the RR
message received during BSSMAP Handover Command.
- move various logging to LOG_LCHAN() in order to log with the lchan FSM instance.
One drawback is that the lchan FSM is limited to one logging category, i.e. this moves some logging
from DRR to DRSL. It might actually make sense to combine those categories.
- lose LOGP...LOGPC logging cascades: they are bad for gsmtap logging and for performance.
- handle_classmark_chg(): change logging, move cm2 len check out of the cm3 condition (I hope that's
correct).
- gsm48_send_ho_cmd(): split off gsm48_make_ho_cmd() which doesn't send right away, so that during
inter-bsc HO we can make an RR Handover Command to send via the MSC to the remote BSS.
assignment_fsm.c:
- the Chan Mode Modify in case of re-using the same lchan is not implemented
yet, because this was also missing in the previous implementation (OS#3357).
osmo_bsc_api.c:
- simplify bsc_mr_config() and move to lchan_fsm.c, the only caller; rename to
lchan_mr_config(). (bsc_mr_config() used to copy the values to mr_bts_lv
twice, once by member assignment and then again with a memcpy.)
- During handover, we used to copy the MR config from the old lchan. Since we
may handover between FR and HR, rather set the MR Config anew every time, so
that FR rates are always available on FR lchans, and never on HR lchans.
Depends: I03ee7ce840ecfa0b6a33358e7385528aabd4873f (libosmocore),
I1f2918418c38918c5ac70acaa51a47adfca12b5e (libosmocore)
Change-Id: I82e3f918295daa83274a4cf803f046979f284366
2018-05-14 16:14:15 +00:00
|
|
|
|
2016-10-23 23:53:38 +00:00
|
|
|
/* Read the config */
|
2016-05-11 12:12:00 +00:00
|
|
|
rc = bsc_network_configure(config_file);
|
2010-06-30 06:59:23 +00:00
|
|
|
if (rc < 0) {
|
|
|
|
fprintf(stderr, "Bootstrapping the network failed. exiting.\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2021-03-09 16:11:45 +00:00
|
|
|
if (neighbors_check_cfg()) {
|
|
|
|
fprintf(stderr, "Errors in neighbor configuration, check the DHO log. exiting.\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2016-02-23 14:10:33 +00:00
|
|
|
/* start control interface after reading config for
|
|
|
|
* ctrl_vty_get_bind_addr() */
|
|
|
|
bsc_gsmnet->ctrl = bsc_controlif_setup(bsc_gsmnet,
|
|
|
|
ctrl_vty_get_bind_addr(),
|
|
|
|
OSMO_CTRL_PORT_NITB_BSC);
|
2016-02-23 23:42:44 +00:00
|
|
|
if (!bsc_gsmnet->ctrl) {
|
2011-08-05 10:22:35 +00:00
|
|
|
fprintf(stderr, "Failed to init the control interface. Exiting.\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
2011-07-22 15:55:42 +00:00
|
|
|
|
2011-10-28 12:23:48 +00:00
|
|
|
rc = bsc_ctrl_cmds_install(bsc_gsmnet);
|
2011-08-05 10:22:35 +00:00
|
|
|
if (rc < 0) {
|
|
|
|
fprintf(stderr, "Failed to install control commands. Exiting.\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
2011-02-18 13:30:25 +00:00
|
|
|
|
2020-12-21 17:12:58 +00:00
|
|
|
if (bsc_gsmnet->neigh_ctrl.addr) {
|
|
|
|
bsc_gsmnet->neigh_ctrl.handle = neighbor_controlif_setup(bsc_gsmnet);
|
|
|
|
if (!bsc_gsmnet->neigh_ctrl.handle) {
|
|
|
|
fprintf(stderr, "Failed to bind Neighbor Resolution Service. Exiting.\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
rc = neighbor_ctrl_cmds_install(bsc_gsmnet);
|
|
|
|
if (rc < 0) {
|
|
|
|
fprintf(stderr, "Failed to install Neighbor Resolution Service commands. Exiting.\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-04 07:32:35 +00:00
|
|
|
if (rf_ctrl)
|
2020-05-26 10:41:18 +00:00
|
|
|
osmo_talloc_replace_string(bsc_gsmnet, &bsc_gsmnet->rf_ctrl_name, rf_ctrl);
|
2011-04-07 21:23:27 +00:00
|
|
|
|
2020-05-26 10:41:18 +00:00
|
|
|
bsc_gsmnet->rf_ctrl = osmo_bsc_rf_create(bsc_gsmnet->rf_ctrl_name, bsc_gsmnet);
|
|
|
|
if (!bsc_gsmnet->rf_ctrl) {
|
2014-02-07 19:07:51 +00:00
|
|
|
fprintf(stderr, "Failed to create the RF service.\n");
|
|
|
|
exit(1);
|
2010-06-30 06:59:23 +00:00
|
|
|
}
|
|
|
|
|
2020-05-26 10:41:18 +00:00
|
|
|
rc = check_codec_pref(&bsc_gsmnet->mscs);
|
2020-03-17 11:21:00 +00:00
|
|
|
if (rc < 0) {
|
|
|
|
LOGP(DMSC, LOGL_ERROR, "Configuration contains mutually exclusive codec settings -- check"
|
|
|
|
" configuration!\n");
|
|
|
|
if (!bsc_gsmnet->allow_unusable_timeslots) {
|
|
|
|
LOGP(DMSC, LOGL_ERROR, "You should really fix that! However, you can prevent OsmoBSC from"
|
|
|
|
" stopping here by setting 'allow-unusable-timeslots' in the 'network'"
|
|
|
|
" section of the config.\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
2018-10-05 12:59:37 +00:00
|
|
|
|
2020-05-26 10:41:18 +00:00
|
|
|
llist_for_each_entry(msc, &bsc_gsmnet->mscs, entry) {
|
2011-06-04 17:58:26 +00:00
|
|
|
if (osmo_bsc_msc_init(msc) != 0) {
|
2020-04-01 09:55:31 +00:00
|
|
|
LOGP(DMSC, LOGL_ERROR, "Failed to start up. Exiting.\n");
|
2011-06-04 17:58:26 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
2010-09-15 18:14:41 +00:00
|
|
|
}
|
|
|
|
|
2021-07-26 11:11:27 +00:00
|
|
|
if (bsc_mgw_setup() != 0)
|
2017-09-27 13:51:34 +00:00
|
|
|
exit(1);
|
|
|
|
|
2020-05-26 10:41:18 +00:00
|
|
|
if (osmo_bsc_sigtran_init(&bsc_gsmnet->mscs) != 0) {
|
2019-07-16 19:13:12 +00:00
|
|
|
LOGP(DNM, LOGL_ERROR, "Failed to initialize sigtran backhaul.\n");
|
2010-11-03 15:40:03 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2017-12-07 00:57:01 +00:00
|
|
|
handover_decision_1_init();
|
2017-12-07 02:54:01 +00:00
|
|
|
hodec2_init(bsc_gsmnet);
|
2019-06-13 07:41:58 +00:00
|
|
|
bsc_cbc_link_restart();
|
2020-10-10 17:01:29 +00:00
|
|
|
lb_start_or_stop();
|
2017-12-07 00:57:01 +00:00
|
|
|
|
2010-09-15 14:29:25 +00:00
|
|
|
signal(SIGINT, &signal_handler);
|
2017-08-20 18:50:06 +00:00
|
|
|
signal(SIGTERM, &signal_handler);
|
2010-09-15 14:29:25 +00:00
|
|
|
signal(SIGABRT, &signal_handler);
|
|
|
|
signal(SIGUSR1, &signal_handler);
|
|
|
|
signal(SIGUSR2, &signal_handler);
|
2011-05-12 14:02:07 +00:00
|
|
|
osmo_init_ignore_signals();
|
2010-09-15 14:29:25 +00:00
|
|
|
|
2021-08-29 11:31:05 +00:00
|
|
|
update_connection_stats_cb(NULL);
|
fix performance for chan_counts and all_allocated stats
The all_allocated_update_bsc() does inefficient iterating to count
active/inactive lchans, which scales badly for high numbers of TRX
managed by osmo-bsc.
We need to update the all_allocated flags immediately (periodic counting
alone would suffer from undersampling), so, until now, we are calling
this inefficient function every time a channel state changes.
Instead of iterating all channels for any chan state changes anywhere,
keep global state of the current channel counts, and on channel state
change only update those ts, trx, bts counts that actually change.
A desirable side effect: for connection stats and handover decision 2,
we can now also use the globally updated channel counts and save a bunch
of inefficient iterations.
To get accurate channel counts at all times, spread around some
chan_counts_ts_update() calls in pivotal places. It re-counts the given
timeslot and cascades counter changes, iff required.
Just in case I missed some channel accounting, still run an inefficient
iterating count regularly that detects errors, logs them and fixes them.
No real harm done if such error appears. None show in ttcn3 BSC_Tests.
It is fine to do the inefficient iteration once per second; channel
state changes can realistically happen hundreds of times per second.
Related: SYS#5976
Change-Id: I580bfae329aac8d4552723164741536af6512011
2022-05-30 00:39:17 +00:00
|
|
|
chan_counts_sig_init();
|
2021-08-29 11:31:05 +00:00
|
|
|
|
2010-08-25 17:43:54 +00:00
|
|
|
if (daemonize) {
|
|
|
|
rc = osmo_daemonize();
|
|
|
|
if (rc < 0) {
|
|
|
|
perror("Error during daemonize");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
2010-06-30 06:59:23 +00:00
|
|
|
|
2021-06-04 14:20:12 +00:00
|
|
|
while (!osmo_select_shutdown_done()) {
|
2019-10-07 23:07:38 +00:00
|
|
|
osmo_select_main_ctx(0);
|
2010-06-30 06:59:23 +00:00
|
|
|
}
|
|
|
|
|
2010-06-30 06:33:01 +00:00
|
|
|
return 0;
|
|
|
|
}
|