Commit Graph

22 Commits

Author SHA1 Message Date
Pau Espin b07e19d185 Properly report all states through NM FSM upon OML link up
Change-Id: Ic3358629d17baab46f467a1ab82eea1837ad7390
2023-04-11 11:16:21 +02:00
Pau Espin 914e55caf3 Clarify configuration of TSC on each timeslot
Related: OS#5856
Change-Id: Ief21daf63ba76725de9117cbe14ada8b75f147df
2023-04-04 12:50:20 +02:00
Pau Espin 767f690f05 Avoid tx RF Resource Ind for disabled TRX
Related: SYS#6370
Change-Id: I887e0cb03b2a5654accccf7a55fac51319981bfb
2023-03-17 17:02:47 +01:00
Vadim Yanitskiy df505a503f logging: get rid of logging category DSUM
DSUM is somewhat similar to DMAIN, generic logging category used
in other Osmocom projects.  This category is rarely used in a few
places, where the other categories could fit better.  Remove it.

Change-Id: Ia9db783bc92b23ba87b4fdf1e4ed07d59ea6bbce
2022-02-08 14:31:58 +06:00
Pau Espin 074672b604 Make sure lchan allocated memory from shadow_ts is properly freed
Since non-shadow TS are currently not allocated as talloc contexts,
lchan objects tend to allocate their own memory on trx talloc ctx
instead. That's fine for non-shadow TS, since the TS follow trx lifecycle
since they are part of the same talloc context. However, shadow TS are
recreated (re-allocated) each time the BTS reconnects, hence when htey
are freed we need to free substructs (lchan) memory in order to avoid it
being kept in trx talloc ctx.

Related: OS#5248
Change-Id: I73742535eb3c40a6866731acbff782940dab06c3
2021-10-11 11:38:35 +02:00
Pau Espin 33b4b15f75 Add new gsm_bts_trx_free_shadow_ts() function
Use it as a counterpart of gsm_bts_trx_init_shadow_ts()

Change-Id: I38baa2b2cfcf6221325d45860b3c7dd53235b8ff
2021-10-11 11:19:11 +02:00
Pau Espin 77e014f061 Introduce gsm_lchan_init() function helper
Let's move lchan specific struct stuff into lchan.c

Change-Id: I9cb96707c63b8b7d76591d25fe906f02e34bb76b
2021-10-07 10:26:24 +00:00
Pau Espin 2e90e0f756 Avoid sending Load Indications when BTS is not RSL-connected
Change-Id: I97e8dd7dd58ee2ec90c3a38d45dfd944db44c412
2021-09-23 14:07:53 +02:00
Pau Espin 130e2e59c6 bts_trx: Drop non-executed path in trx_link_estab()
This function is only called during sign_link_up() e1inp callback, hence
only the link!=NULL condition (UP) is ever executed. Let's drop the DOWN
path and make it a function only used to trigger events when link
becomes up, similar to what bts_link_estab() does with OML.

Here it becomes clear the NM_EV_RSL_DOWN was never sent. It's not much
of an issue though since it would only make transition RCARRIER/BBTRANSC
Enabled->DisabledOffline. However, since due to libosmo-abis limitation
we receive a sign_link_down() for the entire line when 1 of its links
goes down, we don't care much since we go for shutdown of the entire BTS
anyway. Ideally, libosmo-abis would support simply telling us 1 of the
links in the line went down and if it was not OML and not RSL TRX==C0,
then we could keep on running and simply disable the related TRX.

Change-Id: Iac553c68339c0da32fd313676995747eb4344087
2021-09-23 12:07:29 +00:00
Vadim Yanitskiy 0686ae6128 [VAMOS] Implement the concept of 'shadow' timeslots
Change-Id: I48b44b4df9ffb1cca105aebbd868c29b21f3b1d6
Depends: Ia0bd8695a3f12331b696fe69117189cdd48b584d
Related: SYS#4895, OS#4941
2021-06-05 00:34:36 +02:00
Vadim Yanitskiy bcdbb6c556 [VAMOS] gsm_data: rework and rename gsm_lchan_name_compute()
Change-Id: Id5cc40db04a654d94f5f75d4aad45439d66528cc
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy 207d56afe5 [VAMOS] osmo-bts-trx: rework handling of Training Sequence
The TSC (Training Sequence Code) value in 'struct gsm_bts_trx_ts'
is always initialized in oml_rx_set_chan_attr() during the OML
bootstrapping, so there is no need for gsm_ts_tsc() - remove it.

Store the initial TSC value in 'struct gsm_bts_trx_ts', so we can
apply a different TSC value during the RSL CHANnel ACTIVation.

Store the Training Sequence Code/Set in 'struct trx_dl_burst_req'.
These values are indicated to the transceiver (TRXDv2 PDUs, 'MTS'
field) and used by the new TRX_{GMSK,8PSK}_NB_TSC macros.

Change-Id: I3744bc308b99ef941e6e9d139444e414abebc14b
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy c74f25bdcc [VAMOS] Merge bts_trx_init() into gsm_bts_trx_alloc()
gsm_bts_trx_alloc() already does initialize some fields of the
allocated 'struct gsm_bts_trx' instance, and having an additional
function for initializing the other fields makes no sense.

Note that I intentionally didn't merge a call to bts_model_trx_init()
into gsm_bts_trx_alloc(), because this would break some assumptions
regarding the order of initialization and cause regressions.

This also allows us to not call bts_model_trx_init() from tests.

Change-Id: I4aefaf47b05a67ec0c4774c1ee7abcc95e04cc13
2021-05-11 03:54:07 +02:00
Vadim Yanitskiy 5f909b45c5 power_control: check-in new parameters and default values
For the sake of simplicity, the old structures that are still used
by MS/BS power control loops are kept in place.  Migration to the
new structures requires additional changes to the existing power
control logic, so it will be done in the follow-up changes.

The new parameters are integrated as follows:

  + struct gsm_bts - a BTS instance:
  |   Hard-coded default (fall-back) parameters for all transceivers.
  |
  +-+-> struct gsm_bts_trx - a TRX instance (transceiver):
    |     Default parameters for all logical channels inherited from
    |     'struct gsm_bts' at start-up.  May be overwritten by the
    |     BSC using ip.access specific 'Measurement Pre-processing
    |     Defaults' message on the A-bis/RSL interface.
    |
    +---> struct gsm_lchan - a logical channel (e.g. TCH or SDCCH):
            Connection specific parameters inherited from 'struct
            gsm_bts_trx'.  May be overwritten by parameters sent
            by the BSC in CHANnel ACTIVation and other messages.

Change-Id: I6d41eb238aa6d4f5b77596c5477c2ecbe86de2a8
Related: SYS#4918
2021-01-04 21:49:21 +00:00
Pau Espin 26cc8580f6 bts_trx.c: Dispatch missing NM_EV_RSL_UP/DOWN to the bb_transc object
Previous commit 7810a91733 forgot to
introduce this line, though it was planned to be there.

Most of the time it worked fine anyway because the RSL link is not the last
event bb_transc waits for before switching to Enabled, so later events
would trigger inside the bb_transc fsm a recheck (polling) which wuld
allow to advance to Enabled state.
However, in the situation where RSL link UP is the last event to happen,
no more inside-FSM checks are triggered and hence BB Transeiver never
goes to Enabled state, and as a result no event is triggered towards
each RadioChannel which in turn don't go to Enabled state.

Fixes: 7810a91733
Change-Id: I8c777b946e7abcb4b607ec4d136c981a0716b120
2020-10-21 16:03:47 +02:00
Pau Espin 22f59cd63a Introduce NM Channel FSM
Change-Id: I288cbfb4730b25a334ef1c3d6b9679d6f1d4cfc5
2020-10-20 13:45:57 +00:00
Pau Espin 7810a91733 Introduce NM Radio Carrier and Baseband Transceiver FSMs
All the Operative State logic to manage a RadioCarrier//BBTransc NM objects is
centralized in these FSM, where other parts of the code simply send
events to it.
This allows keeping state consistent and offloading logic from each bts
backend, since they are only required to submit events now.
The idea in the long run is to also replace other NM objects with
similar FSMs.

This improved logic fixes bug where PHY + RSL link became available before
OPSTART and hence op state changed to Enabled before receiving any OPSTART message.

Change-Id: Ifb249a821c4270918699b6375a72b3a618e8cfbe
2020-10-20 13:45:57 +00:00
Pau Espin ee92f6980f oml: Set RadioChannel operational state to Enabled only during OPSTART
Otherwise they may be set to ENABLED before CHAN SET ATTR and OPSTART
are sent, and oml_rx_opstart will blindly OPSTART ack (because they are
already enabled) and avoid configuring the timeslots.
That can happen if phy_link & rsl link get ready before receiving all
the OML CHAN SET ATTR and OPSTART commands on all RadioChannels.

Fixes: OS#4757
Change-Id: I50722c4e82faae32371817c3878bb41bfd0175ba
2020-09-17 16:37:39 +00:00
Pau Espin 2ff4592ffc Fix RadioCarrier OML Operative State Change report not sent on some scenarios
Operative state is mainly maintained based on 2 requirements:
* phy_link being in CONNECTED state
* RSL connection being up and ready

However, state change report triggered over OMl towards BSC was only
done upon the first event of the two. That means that if for whatever
reason the RSL connection was established AFTER the phy_link became
CONNECTED (ie receiving RSP POWERON in osmo-bts-trx), then the status
towards the BSC would not be updated and hence the BSC would still see
the Radio Carrier object as DISABLED.

The trx_set_available() function is renamed to trx_operability_update()
to keep the logic conditions in one place, and different events
triggering a change in state simply call the function and let it handle
the new state.

Related: SYS#5063
Change-Id: Ic00df9e7278d42bc10c1e1a1c0edde7e13199299
2020-09-15 14:03:29 +02:00
Vadim Yanitskiy 60e2919ff4 common: constify the argument of trx_ms_pwr_ctrl_is_osmo()
Change-Id: Ic7be19ed1560eae0a56ed30520ee9af1e949d71d
2020-08-03 02:08:14 +07:00
Pau Espin 22a949f38e common: Avoid changing OPSTATE to Enabled upon RSL up
the RSL link has nothing to do regarding the state of the Radio Carrier,
as in it being up is not enough to have a working (enabled) Radio
Carrier.

Change-Id: Iefb5c4e1097233b5c31e4d621c544d51516af678
2020-07-14 09:44:06 +00:00
Pau Espin 122ff83dd0 Move struct gsm_bts_trx: gsm_data.* & bts.* => bts_trx.*
Move all struct gsm_bts_trx references from bulky gsm_data to its own
file containing all related definitions and implementations. Also move a
few functions clearly related to that object which were placed in bts.*

Change-Id: Iebaf5b221c48b571f45408af867ce6f9c0cd9f4a
2020-07-14 09:44:06 +00:00