Commit Graph

49 Commits

Author SHA1 Message Date
Philipp Maier eca195469b abis_om2000: update_op_state() does not send signal
The function update_op_state() updates the OML MO, but it does not
notify the update to other entities using S_NM_STATECHG

Change-Id: Id19c6beb2bc79c4db0ec07ef593aacb57fff8b75
Related: OS#5634
2022-08-05 11:55:41 +02:00
Philipp Maier 914e52e73a abis_om2000: constify mo in mo2obj
The function mo2obj does only read only access to mo, so mo can be
const.

Change-Id: Ia09d0c96c8938e287fdbad343b9605cbfd6ff6a1
Related: OS#5101
2022-08-05 11:55:41 +02:00
Philipp Maier cba82e60e8 abis_om2000: move switch-case to function
The switch-case in update_op_state() and update_mo_state() can be split
off into functions. This makes to code better readable.

Change-Id: I41f0d9d0d498f6f698c2c959baac50424f5ac317
Related: OS#5634
2022-08-05 11:32:02 +02:00
Philipp Maier 99262fd447 abis_om2000: fix missing signal
The normal abis nm FSMs are sending S_NM_RUNNING_CHG signals that
include an object class to notify other entities about state changes.
This also includes paging.c, which only starts paging services when it
sees NM_OC_RADIO_CARRIER becoming enabled.

Change-Id: I305df5b2f962473e33e32484c42a79ff96e53e1a
Fixes: I1b5b1a98115b4e9d821eb3330fc5b970a0e78a44
Related: OS#5634
2022-08-04 10:06:25 +02:00
Keith Whyte 61cbc5b322 Improve parsing of om2000 fault reports
Fault Reports are commonly oberved with a TLV id 0xd2
as are reports with up to 20 TLVs.
Let's not have these cause logging at level ERROR.

Closes: OS#5593
Change-Id: Ibe0b38835362c59d1576a206b2f64cea4427295f
2022-06-27 21:42:05 -05:00
Pau Espin b7ef6884f9 Update current NM object state before signalling S_NM_STATECHG
This way code triggered through signal has an updated view of the object
tree when running generic code which queries the current state of
objects.
This way for instance one can use APIs like trx_is_usable() or alike.

Change-Id: Ib46234e3f3e446e866d27b0dfee65edf4af4d2ba
2022-05-13 09:58:58 +00:00
Pau Espin b978d1582f nm_statechg_signal_data: Convert state ptr to data
There's no need to use pointers there, it is only asking for errors from
code handling the data structe from the signal by attempting to change
them. Even for mem size point of view it doesn't make sense, since it's
3 byte vs a 4 byte pointer.

Furthermore, this is a preparation for new commit, where the NM object
current state will be updated before emitting the signal. This patch
eases a lot the follow up mentioned patch.

Change-Id: I9b648dfd8392b7b40bfe2b38f3345017481f5129
2022-05-06 14:50:24 +02:00
Pau Espin 633523167d abis_nm: Merge signals S_NM_STATECHG_ADM and S_NM_STATECHG_OPER
Having 2 signals makes all code handling them more complex, specially
because S_NM_STATE_CHG_OPER could actually provide any change in
admin/oper/availability.
Both signals already provided the same kind of data (the whole
admin/oper/avail state change), so let's simply merge the signals
themselves. Current code really doesn't act differently for those 2
signals anyway.

Change-Id: Ia86d20a42b859063d0327b940ba528ec1438b04a
2022-05-05 14:51:10 +02:00
Harald Welte d3b0db5515 om2000: Don't print "should not generate any message" on FAULT_REP
Change-Id: I65184ef5aa90a993491f9393614bb499c6998169
Closes: OS#4643
2022-01-04 13:08:20 +00:00
Harald Welte 9f53838c58 om2000: Don't print "should not generate any message" on CAL_TIME_REQ
Change-Id: Ic6f576250d56707cf325886d70209a3744163d79
Closes: OS#4670
2022-01-04 13:04:22 +00:00
Harald Welte 6e250bbf82 om2000: Fix memory leak in OM2000 message handling
Change-Id: I7a94320f3b3af65003df67c11fe7221dfc7d7d62
2022-01-02 15:15:25 +01:00
Pau Espin cc75145131 Rename osmo dyn ts enums to contain SDCCH8
They will gain support to be activated as SDCCH/8 soon too.

Related: OS#5309
Depends: libosmocore.git I56dcfe4d17899630b17f80145c3ced72f1e91e68
Change-Id: Id5b89fe589a52ff88486435ac43809edb4b80f98
2021-07-06 07:16:15 +00:00
Javi 2d168bd1d7 Add command to enable RX diversity to RBS2000
Allow selection of RX diversity from VTY
Options are a,ab,b
Default is 'a' so there is no change from previous behavior

Change-Id: I430762b8cfa51060841d90ba4446de73bd557c6c
2021-03-15 18:50:32 +00:00
Javi 0a3913ee71 Add vty command for Ericsson RBS2000 sync
This commit adds support for Selection of syncronization source.
Options are internal for E1 and external for GPS

Change-Id: Ia3d1acd6b3442238b35fc911092e12a6ac989adb
2021-03-13 07:43:17 +01:00
Harald Welte ae449f32b7 abis_om2000: Handle DP object in get_om2k_mo()
This was somehow forgotten for the DP MO...

Change-Id: Ie2ef736eb712e01a3c657ae30c8422c9aa32062a
2021-01-02 22:47:18 +00:00
Harald Welte c77cea43ee abis_om2000: keep OM2K FSMs around, don't terminate
The existing code uses short-lived FSMs which are allocated straight
before START, and which are free'd after DONE state is reached.

While that works, it makes state introspection a bit hard, as one
cannot show the FSM states, etc.

Let's change to a different model where the per-OM2k-MO FSMs are
always around (in state INIT after object creation).  While at it,
also introduce a RESET event that can reset each FSM instance back
to INIT state, i.e. in case of OML link failure.

Change-Id: Ia37cffff5c451e1d79a52ccae41ab5718b4661d4
2021-01-02 22:47:18 +00:00
Harald Welte a3b91de873 abis_om2000: Mark om2k_mo_fsm_start() as static
It's not used anywhere outside of the source file

Change-Id: If9ebf07ac662607826270df0b0966c8dd5026f1c
2020-12-29 17:30:52 +00:00
Harald Welte 1a7bdb2e0d [cosmetic] abis_om2000: Re-format to use longer lines
For several years now we are using line lengths longer than 80chars,
let's re-format this code more in-line with our new style.

Change-Id: I8143280358c0e23ca7e32b882e952eac991e105b
2020-12-29 17:30:52 +00:00
Harald Welte a34ced0cc2 abis_om2000: make om2k_mo_name() an exported function
Change-Id: Idb05bcad8059ab2b2be6c7057495d0279a4b62c7
2020-12-29 17:30:52 +00:00
Harald Welte c551583fee OM2K: Skip the entire CON MO if there are no connection groups
If the user doesn't specify any CON connection groups in the config
file, then the CON is not used.  The current code runs into an error
condition, as abis_om2k_tx_con_conf_req() never sends the CON CONF REQ
if the groups list is empty, but we still wait in the FSM for the
arrival of a CFG REQ ACCEPT.  The CON FSM eventually times out in T10
and we proceed with the IS, ignoring the error.

With this patch, we simply skip the entire CON MO in case there is no
related configuration.

Change-Id: Ia4d5bd96734686381f04aa3b380b17a161a31174
2020-12-21 16:50:18 +01:00
Harald Welte 65c02aeb1d OM2K: Permit transition from WAIT_CONF_RES -> WAIT_ENABLE_ACCEPT
This is how the DP MO FSM is doing, so let's permit it.

Change-Id: I9df44f840a2818ebc877453c74bde127dce9b3e9
2020-12-21 16:50:18 +01:00
Harald Welte 2d5fa294bd abis_om2000: Force TRX NM state to UNLOCKED once TRX is up
In I68ae0bc51a565f903b47cf72f3e3dd6f1a2d2651 we started to
initialize all (TS 12.21) NM MO state to LOCKED by default,
which means BTSs  not using TS 12.21 are stumbling across
a general check in bts_isdn_sign_link() and will fail to
process and uplink RSL messages.

Change-Id: I4450cc47ede4005bf4bbd4af8d5a22c78377d4cd
Related: OSE4914
2020-12-21 16:50:18 +01:00
Vadim Yanitskiy 0098b5ce74 abis_om2000: check result of gsm_bts_trx_set_system_infos()
Ensure that osmo-bsc would not continue to work as usual, if for
some reason we cannot encode or send System Information messages.

Introduce transitional state OM2K_TRX_S_SEND_SI, from where we
can generate and send System Information messages.  Otherwise
it's confusing if we fail to do something when we're already
in state OM2K_TRX_S_DONE.

Change-Id: Ia6df539d0914c57ea80fdb29882832678b47f267
2020-09-09 11:29:06 +00:00
Pau Espin e2f1c95774 bts: Drop duplicated function to get trx by number
In the big mess of gsm_data we reached a point where we have multiple
functions doing the same thing, most probably because it's hard finding
stuff in there. Let's drop one of them (the one which less callers) and
move it to bts.*, where it belongs.

Change-Id: I9071a0ab250844619280fbe2be63ed99f2c87eb1
2020-07-18 21:45:32 +00:00
Pau Espin 388ed58482 Move struct gsm_bts: gsm_data.* => bts.*
Place all code related to the object into the related file.

Having all the data model in one file made sense in early stage of
development to make progress quickly, but nowadays it hurts more than
helps, due to constantly growing size and more and more bits being
added to the model, gaining in complexity.

Currently, having lots of different objects mixed up in gsm_data.h is a hole
of despair, where nobody can make any sense were to properly put new stuff
in, ending up with functions related to same object in different files
or with wrong prefixes, declarations of non-existing functions, etc.
because people cannot make up their mind on strict relation to objects
in the data model.
Splitting them in files really helps finding code operating on a
specific object and helping with logically splitting in the future.

Change-Id: I00c15f5285b5c1a0109279b7ab192d5467a04ece
2020-07-18 21:45:32 +00:00
Sylvain Munaut 89aa40df79 om2k: Fix invalid use of linked list when building hopping freq list
I originally assumed that after a complete scan with llist_for_each_entry
the loop counter would be either NULL or a valid entry. That's just not
the case.

Fixes: CID#210256

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Iad647b74771c4ac406a88effd371ed7748c8847e
2020-05-09 08:05:21 +00:00
Sylvain Munaut b405e6e315 om2k: Wait for OM TRX links to stabilize before trying to bring up TRX
The OM2K link "per-trx" only comes up after MCTR is setup. So that means
we need to wait for it before trying to boot the TRX itself.

He we simply apply a "dumb" 5 sec timeout as this is the most reliable
way I found to get this working reliably.

Tracking the link state proved difficult and unreliable:

 - Multiple TRX can be present with their link coming up in random
   order.

 - They can already be up at the start (BTS already initialized from
   a previous boot) and so the link may actually come up, down, and
   up again.

 - All of theses transitions might happens before/after we get to the
   OM2K_BTS_S_WAIT_TRX state depending on how the LAPD timeout
   expire, if the BTS config was actually changed or not and how much
   time it takes to apply the new config.

So all in all, what we must do is wait for the link to stabilize ...
hence just waiting 5 second.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I55a06e08b9c52ff6e97e8c72f2d55770809eba51
2020-05-08 15:16:15 +02:00
Sylvain Munaut 94033ef9a7 om2k: Properly update the 'fake' 12.21 states using OM2000 status
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I1caafa2e87c6198bf3b1a77f0fa1edc774deeef9
2020-05-08 15:16:15 +02:00
Sylvain Munaut cbaa179945 om2k: Add support for MCTR configuration
Currently only supports a single MCTR with fixed configuration

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I96b8bb2c01c05bf153fc924f62bd6aafa96725ee
2020-05-08 15:16:15 +02:00
Sylvain Munaut a40b75e44d om2k: Rename MCTR config request constants for consistency
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I776b0016837e018500ef69acb2f30a274008818e
2020-05-08 15:16:15 +02:00
Sylvain Munaut dbd1b50604 om2k: Add option to limit OML version during negotiation
Starting from G12R13 the MCTR swiches to BSC controlled mode. And
although we think we know how to configure it (via MCTR Conf Req),
something doesn't work right and the timeslot configuration is not
accepted. (TS Conf Result shows "Data not according to request").

So as a workaround for now, we use this version of the protocol where
we don't configure the MCTR (it's in "BTS controlled mode") and with
this protocol, the BTS accepts our timeslot config and we can bring
the system up.

This commit add a generic option to limit either OML or RSL IWD
version to any value. It also keeps track of the actual negotation
version so we can react to it in other places of the code.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I8f0b0ba72056ea4250fe490e7a38630c77c04f65

better version limit

Change-Id: Ia789f8ede3eab7eeca6c759da0109e0b53398f60
2020-05-08 15:16:15 +02:00
Sylvain Munaut 4a048d363b om2k: Fix the frequency specifier for TX/RX/TS conf requests
* OM2K_DEI_FREQ_SPEC_RX:

  (hop << 15) | (rx_addr << 10) | arfcn

  . hop     Hopping marker
  . rx_addr is not really the TRX number, it's just a sequential number
            different for all TRX, doesn't need to be 'in-order' of TRX
  . arfcn   The ARFCN number (0 for hopping and 1023 for 'no frequency')

* OM2K_DEI_FREQ_SPEC_TX:

  (hop << 15) | (tx_id << 10) | arfcn

  tx_id Pretty much same as rx_id except here we know that the order
  doesn't have to match TRX order. It seems to even vary from one
  reboot to another on some real-world capture we got.

  . hop     Hopping marker
  . tx_addr Same as 'rx_addr' above but for TX
  . arfcn   The ARFCN number (0 for hopping and 1023 for 'no frequency')

* OM2K_DEI_FREQ_LIST:

  Groups of 3 bytes (24 bits), 1 per frequency used.

  (tx_addr << 20) | (rx_addr << 16) | (is_c0 << 10) | arfcn

  . tx_addr See above
  . rx_addr See above
  . is_c0   Must be 1 if that ARFCN hosts the C0. (first TRX of a MCTR)
  . arfcn   The ARFCN number

  (Note MAIO must also be set properly on the different TRX/TS sharing
   a frequency ... )

The way we generate theses here is what we gathered from real-world
traces:
 - Each 'TX' of each TRX is set to the ARFCN set in that TRX config
 - Each 'RX' of each TRX is configures as 'hopping'
   (which I assume means it will just pick the appropriate freq ?)
 - For each TS, we use :
   . tx_addr of the TRX that has the ARFCN we want to TX on
   . rx_addr of the TRX where the TS we're configuring is
   . arfcn   The actual ARFCN we want to add to the list

This is incomplete but will work for the 1 MCTR case.

Config for multiple MCTR or multiple virtual-bts still need to be
handled but it's not yet known exactly how those need to be
configured.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ie39a857543adaa11d1822346d8563ce3718412c8
2020-05-08 15:16:15 +02:00
Sylvain Munaut 586c0114b3 om2k: Dispatch TS_EV_OML_READY to TS FSM only when it's actually ready
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ic2a84ea406e9a39332313d63b27d73f334d4e0a0
2020-05-08 14:50:26 +02:00
Sylvain Munaut 540e98f259 om2k: Use the "from config" TS config to setup OM objects
During the configuration of the TS object through OML we must use
pchan_from_config since it's too early to use anything else.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Iecdc911a79b66d8f3d746347710ad697cb288174
2020-05-08 14:50:26 +02:00
Sylvain Munaut 7d10c80a7d om2k: Properly name message 0x0136, found to be MCTR Statistics Report
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I4b4389fd2e7bf0b3078b8ff60f6ea109114a4475
2020-05-08 14:50:26 +02:00
Sylvain Munaut 7ab23b75af om2k: Acknowledge the unknown MCTR messages we get from time to time
This is probably a fault report of some kind, but didn't get any
confirmation or naming from anywhere for it yet.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I8333093d09f27f61094c7f5854573aa16e4bf28c
2020-05-05 21:15:53 +02:00
Sylvain Munaut eebb1ad0a0 om2k: Acknowledge the HW Infos Reports
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ida92c9ca59a608854737ba9e330a5394cceff0fe
2020-05-05 21:15:52 +02:00
Sylvain Munaut 4a97d46cb1 om2k: Fix type of msg_type in abis_om2k_tx_simple
Thoses messages IDs are 16 bits and the upper 8 bits are sort of
important :D

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ifcc1a01fdbf66a0f6f44cf8fed60dc19e72dd56a
2020-05-05 21:15:51 +02:00
Sylvain Munaut 9d2375407e om2k: Fix TS channel config payload for non-superchannel case
* In superchannel mode, those 3 are required.
* In normal mode, "Config Type" is optional and the two others are
forbidden.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: If02d02c067ae8af8ce693ddfb8747212f3f4e441
2020-05-05 21:15:50 +02:00
Sylvain Munaut e619675d84 om2k: Don't use slashes in FSM IDs and use dashes instead
slashes are invalid so we can't use om2k_mo_name() directly, so we just
build it manually with dashes.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I3cfc19670e6d7bb607d796cabcee5e86a15d1985
2020-05-05 21:15:49 +02:00
Sylvain Munaut e55e76f4c7 om2k: Add VTY command to allow TX of arbitrary message for testing
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I5a385614fc670946f83ea79cc176c2d448675672
2020-04-28 09:50:59 +02:00
Sylvain Munaut 63d7661147 om2k: Add definitions for the TG object
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I6d90554a54baa78f454281a486e4b5e95784fdee
2020-04-28 09:29:14 +02:00
Harald Welte 2fa9763fb8 OM2000: Add some more message types and IEs we now understand
OM2000 is not only used for the venerable RBS2000 family, but also
for the more modern RBS6000 family, specifically the DUG 20 GSM
baseband unit.

In RBS6000, there are some protocol extensions which are not yet fully
understood. However, we are understanding some bits around the MCTR
(multi carrier transceiver?), a new MO that appears to be present for
every physical RUS (Radio Unit) attached to the DUG 20.

Let's add what we have learned so far.

Thanks to Sylvain Munaut for his help with this.

Change-Id: Ib868358eca12b94c4fcca58e94ec8ab1a4edfda2
2020-01-29 09:21:00 +01:00
Harald Welte 6d3d1c1019 check for osmo_fsm_register() error return value
Change-Id: I77e8ace007a3d6b9c40d3e158d1cdb7576aab77b
2019-12-01 13:18:20 +01:00
Martin Hauke a29affda98 Fix some typos
Fix typos and common misspellings in code comments and in the manual.

Change-Id: I46fc9d424620c77ae9ccf78b58081bd303386d7c
2019-11-13 22:10:41 +01:00
Neels Hofmeyr a6078fe1d8 use libosmocore osmo_tdef
Move the T_defs API to libosmocore as osmo_tdefs: remove the local T_defs API
and use libosmocore's osmo_tdef* API instead.

The root reason is moving the mgw_endpoint_fsm to libosmo-mgcp-client to be
able to use it in osmo-msc for inter-MSC handover.

When adding osmo_tdef, the new concept of timer groups was added to the API. It
would make sense to apply group names here as well, but do not modify the VTY
configuration for timers. The future might bring separate groups (or not).

Depends: Ibd6b1ed7f1bd6e1f2e0fde53352055a4468f23e5 (libosmocore)
Change-Id: I66674a5d8403d820038762888c846bae10ceac58
2019-04-23 21:57:44 +02:00
Neels Hofmeyr 31f525e756 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-07-28 12:18:23 +02:00
Neels Hofmeyr 596c402835 add gsm_timers, for Tnnn definitions usable by FSMs
Change-Id: If212fcd042051b6fa53484254223614c5b93a9c6
2018-07-28 12:18:23 +02:00
Neels Hofmeyr 958f259f95 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-06-07 19:09:06 +02:00