Commit Graph

2891 Commits

Author SHA1 Message Date
Philipp Maier 1f213a2402 rsl: parse temporary overpower value RSL CHAN ACT / MODIFY
The temporary overpower value that is to be used with FACCH and SACCH is
transferred using a proprietary RSL IE (RSL_IE_OSMO_TOP_ACCH_CAP). The
parsed value is then stored in lchan->bs_acch_overpower_db so that it
can be used.

Change-Id: I426c2510865c4a986c68f2027cc676aaac0d8a4c
Related: SYS#5319
2021-09-29 07:54:45 +00:00
Pau Espin d680a62975 scheduler: Fix lqual_cb not populated for TCH.ind
Change-Id: I79c83b974149b1e94155bc61172b57de8003891e
2021-09-28 12:02:15 +02:00
Pau Espin 0468376c53 Move TA & Power Loops further up the stack, take DTXu flag into account
Only once we receive the Measurement Result on L3 from MS we are able to
find out whether DTXu was used, and hence whether SUB or FULL
measurement set should be used.

Let's move all control loops there to have them in one place together,
and have it at a similar level where it would lay if it was to be
implemented in the BSC.

Related: SYS#4917
Change-Id: Ic152473577ff7c33d30b3f4ee7e321fcb523f723
2021-09-28 12:02:15 +02:00
Pau Espin 3871c1ff0c Decouple handling of Measurement Report from lapdm
This is a preparation commit in order to move power loops up in the
stack in order to have DTXu information available, in order to decide
whether SUB or FULL ul measurements should be used in the MS Power
Control Loop.

Function rsl_tx_meas_res() is stripped from code changing state, and it
simply encodes content and transmits the message.

Change-Id: Id67259ec9ac4c2c33bd0eef3f64450affbe3fb9f
2021-09-28 12:02:03 +02:00
Pau Espin 5f4e729122 bts-trx: Fix rxgain & maxdly VTY values being reset
Recent commit added code to reset trx_provision_fsm state fields in orer
to support re-using the FSM once BTS is reconnected to a BSC.

However, some values being reset there are not set up when reconnecting
to the BSC, but rather configured through VTY at startup. Hence those
values should be kept.

Fixes: 32b51eca7d
Change-Id: I5c31241327b98386c313cd9377cf76c009456105
2021-09-27 20:20:18 +02:00
Vadim Yanitskiy d6ef2bf12f osmo-bts-trx: implement Temporary Overpower for SACCH/FACCH
GSM/EDGE Evolution and Performance, Section 12.3 suggests Temporary
Overpower as another solution to improve SACCH/FACCH performance in
case of bad C/I. The idea here is that you increment the DL transmit
power by 2..4dB only for FACCH/SACCH bursts, while keeping all voice
bursts at the lower (normal) level as determined by BS power control.

SACCH blocks can be recognized by the channel type, since they're
always transmitted in specific frames of a multiframe.  FACCH blocks,
however, are not predictable and can substitute voice blocks at
(almost) any time.  Thus we need to mark FACCH bursts as such in
the logical channel handlers (using TRX_BR_F_FACCH).

Change-Id: Ie8a626fefccf1eb07271058e5126ec106cb1abcf
Related: SYS#5319
2021-09-27 16:02:26 +00:00
Vadim Yanitskiy 056a3632dc osmo-bts-trx: remove an 'else' branch in _sched_dl_burst()
When I introduced this branch in change [1], I was under assumption
that PDCHs never have an associated 'struct gsm_lchan'.  This is
incorrect: the association actually happens during PDCH activation,
i.e. when osmo-pcu establishes connection over the PCUIF.

Enforcing attenuation of 0 dB for other channel types makes no sense.

[1] I3dcee6e910ccc61c5c63c728db9ea04327e2fc98

Change-Id: I77a839725f22be1be4a025f579c4c9ccdfb53460
2021-09-27 16:02:26 +00:00
Vadim Yanitskiy 4034e61d03 trx_sched_set_lchan(): use LOGL_INFO for logging messages
There is no need to log channel activation / deactivation messages
as LOGL_NOTICE - this is a normal event requiring no attention.

Change-Id: I7765fecb7f7ec67c8f96e91c378626e21e48c71d
2021-09-26 13:33:38 +06:00
Vadim Yanitskiy 7b80dde7b5 osmo-bts-trx: bts_model_l1sap_down(): remove chan_nr patching
Thanks to [1], there is no need to patch chan_nr for PDCH anymore.
The upper layers are now expected to use the correct values.

[1] I01680140c7201bf5284b278bceaea8ae01c122b2

Change-Id: I26eb2081eddb4ce900a7867897bc69c3f77dbd73
Related: OS#5238
2021-09-26 13:23:41 +06:00
Vadim Yanitskiy e51fb333ae gsm_lchan2chan_nr(): separate RSL specific variant of this API
The ip.access style dynamic timeslots are a bit special in a way that
on the A-bis/RSL we always use the Channel Number value of TCH/F,
even in PDCH mode.  This is why gsm_lchan2chan_nr() would always
return values corresponding to TCH/F for TCH/F_PDCH.

This behavior is only acceptable in the context of RSL messages, while
other parts of the code base may not work properly due to this trick.
A good example is the scheduler in osmo-bts-trx, where we have to
patch Channel Number value to make channel activation work.

  DPCU INFO pcu_sock.c:853 Activate request received: TRX=0 TS=5
  DL1C INFO l1sap.c:2043 (bts=0,trx=0,ts=5,ss=0) Activating channel TCH/F on TS5
  DL1C NOTICE scheduler.c:1097 (bts=0,trx=0,ts=5,ss=0) Activating PDTCH
  DL1C NOTICE scheduler.c:1097 (bts=0,trx=0,ts=5,ss=0) Activating PTCCH

In the code branch responsible for channel deactivation, we somehow
forgot to add the same workaround, so deactivation does not work:

  DL1C INFO l1sap.c:2076 (bts=0,trx=0,ts=5,ss=0) Deactivating channel TCH/F on TS5
  DTRX INFO trx_if.c:255 phy0.0: Enqueuing TRX control command 'CMD NOHANDOVER 5 0'
  DRSL NOTICE rsl.c:1286 (bts=0,trx=0,ts=5,ss=0) (bts=0,trx=0,ts=5,ss=0) not sending REL ACK

Because of that, TCH/F_PDCH timeslots actually remain active after
deactivation, so the scheduler keeps producing L1SAP DATA.ind.

  DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE
  DL1P ERROR l1sap.c:732 1583426/1194/00/29/14 No lchan for DATA MEAS IND (chan_nr=PDCH on TS5)
  DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message
  DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE
  DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message
  DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE
  DL1P ERROR l1sap.c:732 1583430/1194/04/33/18 No lchan for DATA MEAS IND (chan_nr=PDCH on TS5)
  DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message
  DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE
  DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message

Instead of patching Channel Number in various places, let's rather
make the RSL specific behavior configurable by having two variants
of gsm_lchan2chan_nr().

Change-Id: I01680140c7201bf5284b278bceaea8ae01c122b2
Fixes: OS#5238
2021-09-26 13:23:41 +06:00
Vadim Yanitskiy 9e2262b667 l1sap: unify channel (de)activation/modification messages
LOGPLCHAN() prepends the contextual information for us, there
is no need to print trx->nr again.  Take a chance to apply
some additional cosmetic changes, like fixing capital letter.

Change-Id: Ia199d584c937eef4118c99af4523fd91b2e46107
2021-09-26 13:23:41 +06:00
Vadim Yanitskiy 9be6b56033 osmo-bts-trx: return -ENODEV if 'bursts_p' is NULL
In functions responsible for Downlink burst scheduling, it may happen
that the buffer, containing a complete set of to be transmitted bursts,
a) is not yet allocated or b) was de-allocated intentionally.  In this
case, we return early to avoid NULL pointer dereference.  The returned
value is then checked against 0 in _sched_dl_burst().

Returning 0 makes _sched_dl_burst() apply per-burst attenuation, as
well as the A5/x encryption (if enabled).  And this makes no sense
in either of the cases mentioned above.

Moreover, in the BCCH power reduction mode, this causes some bursts
(bid > 0) of idle PDTCH/PTCCH blocks to be transmitted at full power,
breaking the energy saving feature.

Change-Id: I18aa73cc950fdfac030b63f7a434a71b4596095d
Related: SYS#4919
2021-09-24 23:41:44 +06:00
Pau Espin 72d81b978a osmo-bts-omldummy: Fix crash accessing null phy
osmo-bts-omldummy is known to be specially in the sense that it has no
phy. This should ideally be changed to have some dummy object, but so
far that's how it is. A recent commit checking the phy's forgot about
the fact that BTS model has no phy. Let's fix it.

Fixes: 4ddc37ce71
Change-Id: Iba7873530aac74b3bf799819890641196dacf170
2021-09-23 22:48:41 +02:00
Pau Espin e12f911bbb Revert "abis: Fix line leaked & recreated upon every reconnect"
This reverts commit bc6d35f52d.

Change-Id: I15063f0156ed8910795cd5ffe045e2d0cbca6276
2021-09-23 22:48:41 +02:00
Pau Espin 9a3a5cbc9c Revert "bts-trx: Keep the process ongoing trying to reconnect on Abis link down"
This reverts commit 0c44a92197.

Change-Id: Ib367d5ddfaccfad3f1b6acc53abf25a0f1834255
2021-09-23 22:23:47 +02:00
Pau Espin 0c44a92197 bts-trx: Keep the process ongoing trying to reconnect on Abis link down
Change-Id: If24c7d8d58875dd8baf4031a8fc2a8656702a2b5
2021-09-23 14:07:53 +02:00
Pau Espin bc6d35f52d abis: Fix line leaked & recreated upon every reconnect
Previous code creating a new line was really a workaroudn to have it
working while previous lines were being stacked internally inside
libosmo-abis.
Let's handle reference counts for the line properly and erase +
re-create it every time.
Recent patches to libosmo-abis fixed a crash happening when refcount
being 0 and destroying the object (object was not removed from a global
llist).

Depends: libosmo-abis Change-Id I1314d6b917ecb622994507475eb894e649a1a2ad
Change-Id: Ic37ae5bf657247e8cce99182c40d9adf890a5e41
2021-09-23 14:07:53 +02:00
Pau Espin 127e8fc416 abis: Fix memory leak of bts->osmo_link upon link going down
Commit below (see "Fixes" section) wrongly erased the code re-introduced
in this commit, due to not spotting different between "oml_link" and
"osmo_link". This commit is hence a revert of such commit, updated to
current code.

Fixes: c2ba34d9c1
Change-Id: Id436116e5cd0bec024b2f9943fbff8d0bdc956ac
2021-09-23 14:07:53 +02: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
Pau Espin 49979bb794 abis: Call bts_model_abis_close() when Abis link goes down
This way based on BTS model features it can attempt to reconnect or
simply exit the process.

Change-Id: I42b43a0128bd4b579d9695e6dd2bccf6dc7e1d41
2021-09-23 12:07:29 +00:00
Pau Espin 37f63f12f7 bts_shutdown_fsm: Allow configuring FSM to shutdown without exiting process
This feature is not yet used by any bts_shutdown_fsm caller, but will be
used in the future when Abis link goes down.

Change-Id: I5dc282fdbcf862067be326e72b6183dd544222ae
2021-09-23 12:07:29 +00:00
Pau Espin 4ddc37ce71 nm_bts_fsm: Make sure PHYs are opened when SW_ACTivating it
Since recently we support shutting down phys when BTS goes into shutdown
mode. Let's make sure they are opened again when we connect again to the
BSC.

Change-Id: Ia1df6f4a1e0e6daeffe7303d518776a04b023930
2021-09-23 12:07:29 +00:00
Pau Espin dfedf2cb76 phy_link: Introduce bts_model_phy_link_close() and use it in bts-trx
This step is required while turning off the BTS without killing the
process. Right now only osmo-bts-trx supports this feature, so this
function is only available and used by osmo-bts-trx.
Later on, when the feature is support more generally, we can move call
to this function to common place like bts_shutdown_fsm or alike.

Change-Id: I3253112700a31b85db82dc7ccadec8542bac745e
2021-09-23 12:07:29 +00:00
Pau Espin 192390c797 trx_sched_clean_ts: Clean VAMOS shadow TS too
trx_sched_init_ts does it properly, but apparently it was forgotten to
do the same upon clean up.

Change-Id: Ice751870a46548af42b14846b8482335f636a84a
2021-09-23 11:09:15 +00:00
Pau Espin ce9ec4963c bts-trx: Submit TRX SW_ACT when PHY becomes connected
Once the TRXC link is available, we can signal SW_ACT which will
transit rcarrier and bbtransc NM FSMs to Disabled Offline and announce
availability to be configured to the BSC through transmission of
Software Activated Report.

Change-Id: I6e62ec2fdd4cae58b52d83fa851552f7ed51c821
2021-09-23 11:09:15 +00:00
Pau Espin ddd357f3e3 bts-trx: Avoid race condition configuring TS-specific TSC values
In OML, if Set Attributes comes first for Channel object and then for
BTS object, BSIC will still not be set. Hence, when applying Channel
(TS) specific TSC, the code would compare against an unset value,
enabling use of TRXC extensions (which osmo-trx doesn't support)
without need for it, since actually the TSC of the TS matches the BSIC
of the BTS once both are set.

In order to fix it, don't check for the BSIC when receiving the OML
messages, but rather later when we apply the settings to the the lower
layers once trx_provision_fsm allows for it.

Fixes: 3c1151f945
Change-Id: I49fc7e35acb44ecc4f37ae71acd4c684248548e7
2021-09-23 11:09:15 +00:00
Pau Espin 300e31ed13 l1sap: Support rx of empty rlcmac blocks from PCU
This way the PCU can signal idle RLCMAC blocks (no transmission
required) to the BTS, which can then send dummy/fill blocks aplying
power reduction as needed by TRX.

The block with len=0 is submitted to lower layers up to the scheduler,
which will finally drop it in trx_sched_ph_data_req().

Change-Id: I734c66e236bf3e2015a4571ea1fd84849a9ef02c
Related: SYS#4919
2021-09-23 10:03:23 +00:00
Pau Espin 2f3cd4b697 MS Power Control Loop: Disable threshold comparison on {LOWER,UPPER}_CMP_N=0
This way we provide an effective way to disable C/I based decision
taking in the MS Power Control Loop. With this set up, MS Power Level is
decided only based on RxLev. This allows for working setup in following
scenarios:
* BTS L1 not passing proper C/I values to upper layers (eg. TRXDv0).
* User not willing to spend time configuring proper C/I levels for each
  channel type.

Related: SYS#4917
Change-Id: Ibd10eb96a5d072d5c19f7449a8b11e64aad1cd4c
2021-09-23 10:02:59 +00:00
Pau Espin 137166fd5f bts-trx: Get rid of check_transceiver_availability_trx()
Get rid of this helper function, which is a remain of past epochs
(pre-FSM). In the current uses, there's only 2 real cases: the "if" path
upon SET BTS ATTR received (and even that one should be moved as per
what the code comment states), and the one happening when the TRX is
closed.

it really makes no sense to DISABLE the TRX as a result of SET BTS ATTR.

Change-Id: I48adfeecd722684152c589bcba827079b0a78c3a
2021-09-23 10:00:24 +00:00
Pau Espin 7c466d8cc7 bts-trx: Submit TRX_PROV_EV_CFG_ARFCN for C0 during SetBtsAttr
In oml_rx_set_bts_attr, arfcn for C0 is assigned from NM_ATT_BCCH_ARFCN.
The rest of the TRX get their arfcn from oml_rx_set_radio_attr()
NM_ATT_ARFCN_LIST.

Change-Id: I8aa9652622107fe0a707b2cbcbe8be6c71e19087
2021-09-23 10:00:24 +00:00
Pau Espin 32b51eca7d trx_provision_fsm: Properly reset FSM state upon starting listening for events
Change-Id: If0d078bc0170091efbca351c44ee412dad1e944a
2021-09-23 10:00:24 +00:00
Pau Espin eab7068d58 trx_if: delete retrans timer when flushing the Tx queue
Change-Id: Ic31dc5629ed950f3b4b8feb9917d11779696f6eb
2021-09-23 10:00:24 +00:00
Pau Espin 4444262a6a trx_if: Allow calling trx_if_flush/close from within TRXC callback
Change-Id: Ic3baa95ffe4e6ca95c6d02276ea8eb0cb9fa0064
2021-09-23 09:59:29 +00:00
Philipp Maier 3bf40e4f3a rsl: simplfy parse_repeated_acch_capability
The separate TLVP_PRESENT and TLVP_LEN calls can be replaced by
a single TLVP_PRES_LEN

Change-Id: I6bde1b9df50fdf355e768f5066e86422238b98e9
2021-09-23 08:21:57 +00:00
Pau Espin 03c74baa83 trx_if: Set pointer to null after freeing it
Change-Id: Icd93c9968095a8801aafe9440806cb5786320cbc
2021-09-22 12:57:02 +02:00
Pau Espin 3c56335094 bts_shutdown_fsm: Fix event name
Change-Id: Id042ae37f7c9dbd2edbb76932abb91d605d85e26
2021-09-22 12:57:02 +02:00
Pau Espin 68a39a8617 nm_*fsm: Make FSMs aware of object being properly configured or not
This will allow in the future advertising children objects that the
parent object has been configured. It is useful for instance to let TRX
know that the BTS is configured.

Change-Id: Ie319465fd0e991bab8451ea34ec72ff3702533d2
2021-09-22 12:56:58 +02:00
Pau Espin 5a2d8716ef abis: Drop internal OML msg queue
There's no real use for this queue. If the link is gone, it makes no
sense to keep old messages. Instead, BTS should generate new messages
sharing current state when link becomes established (it actually does
so already).

Change-Id: Iecd3c7cb96f5fff3b4c7e04c74e031df0f7a6987
2021-09-20 16:25:47 +02:00
Pau Espin 92186c672d nm_*_fsm: Move to state Disabled NotInstalled Locked when shtudown proc ends
Change-Id: I5c070adbba6b4abb19467a02d6449a443657ae2b
2021-09-20 16:25:47 +02:00
Pau Espin c56d120b29 MS Power Control Loop: Fix oscillations within good MS Power Levels
Related: SYS#4917
Change-Id: Ib33a94eba92004f9327c91e020a506dfa9a957c3
2021-09-20 14:57:15 +02:00
Pau Espin 43a4a1d5e7 nm_*_fsm: Set adminsitrative state 'shutting down' when shutdown procedure starts
Change-Id: I0d14840a55642812b865687a6cb208e7ffd22829
2021-09-20 12:22:53 +02:00
Pau Espin ea53ad454e Allow setting administrative state through oml_mo_state_chg()
This way it can be changed together with operative/availability state,
and changes announced to the BSC if present.

This commit presents no real change in osmo-bts behavior, since the only
place where adm_state is passed different than -1 is in
st_op_disabled_notinstalled_on_enter(), which is actually never called
(yet) since it's the initial state and no other states transition later
to it.

However, this will change in the future once we support re-connecting to
a (possibly different) BSC, which means objects will need to be moved to
that state to restart the whole OML install procedure on the new BSC.

Change-Id: Ifdc6a1dfb673c0ab915ddf2a9d372928f4f86b4c
2021-09-20 12:22:53 +02:00
Pau Espin 729aff7938 nm_*_fsm: Add missing item in event mask list for state ENABLED
Change-Id: Iebaa7dcfc01978cee2e4b08609503eb4e25598b7
2021-09-20 12:22:53 +02:00
Pau Espin 82275d5eb2 trx_provision_fsm: Add missing state transition OPEN_WAIT_POWEROFF_CNF => OPEN_POWEROFF
Change-Id: I361c1acddfe7ebffb44d886d0545240ef1bbd347
2021-09-20 12:22:53 +02:00
Pau Espin 8dd699e545 abis.c: Loop over list of BSCs until connection succeeds
Do not exit if all BSCs in the list fail to connect, keep trying
forever. This commit still doesn't change the logic after BTS has
successfully connected to a BSC. In that situation, if the link goes
down, BTS will exit in order to reset all state and let the user/system
restart it.

Related: SYS#4971
Change-Id: I67bba3b7e2d9d62b98a59a74987ae55206a3ec51
2021-09-20 12:22:53 +02:00
Pau Espin 3f7bd192a6 abis.c: Fix mess with priv->bsc_oml_host
The pointer was used as "struct bsc_oml_host" sometimes, and other times
as "struct llist_head". It just worked because bsc_oml_host->list is the
first item in the script. The code was really confusing, also because
the bts list of items has a name really similar to the one currently
assigned. Let's rename the currently assigned address to "current_bsc",
store it always as "struct bsc_oml_host*" and finally use llist_entry
helpers when needed.

The related code is also moved to a helper function to enclose there the
logic to get next BSC in list. This change actually changes the logic
where a remote address is removed from VTY, since now the next address
in list is picked at the time, and later when reconnecting the list is
forwarded another time, meaning one address will be skipped.
This could be considered a bug, but this situation is really special
and anyway the entire logic will be changed in new commits where we'll
keep reconnecting in loop without exiting when reaching the end of the
list, so we are fine with it. Think of this commit as a preparation
commit for next ones.

Change-Id: I3cc8a4148b3d63bc185b72dab8108105a6644910
2021-09-20 12:22:53 +02:00
Pau Espin 65c0341f3d abis.c: Transition to CONNECTED state only when OML link is up
This clarifies the different states and transitions between them:
OML LINK UP: CONNECTING->CONNECTED
ANY LINK DOWN: CONNECTING->CONNECTING, CONNECTED->FAILED
In follow up commits, support to reconnect instead of exit after the BTS
has already connected will be added, so only the last transition needs
to be changed.

Related: SYS#4971
Change-Id: I43e83b1b04fbaa1f87818c096e6ad3920801b1f6
2021-09-20 12:22:53 +02:00
Pau Espin 79a92cfc50 abis: Shorten string names of events
Change-Id: I7a5dab3d38e917a8f37c72765e27f263c324ed96
2021-09-20 12:22:53 +02:00
Pau Espin 5831512c2c abis: Move FSM registration to constructor function
We commonly do it this way since there's only need to call it once at
the startup of the program.

Change-Id: I6ee5b89175ee32bc12a8afc9682a8f90d1713291
2021-09-20 12:22:53 +02:00