Commit Graph

3012 Commits

Author SHA1 Message Date
Pau Espin a3dca762dd rsl: Conditionally decrease log level if cause is normal event
This avoid a NOTICE log line like the following when gsm_lchan_release()
is called.
"""
rsl.c:2484 (bts=0,trx=0,ts=2,ss=0) Sending RTP delete indication: cause = Normal event, unspecified
"""
Change-Id: I0ce78c52644983220f5810bc5c661b07afd9e543
2022-03-02 19:07:01 +01:00
Pau Espin a6a0c6ad1e Change some log levels NOTICE->INFO
Change-Id: I65cccf2b48288353c2db2044ad1f3651ca9f68ec
2022-03-02 19:02:16 +01:00
Pau Espin bd02811e7e bts-trx: amr: Fix return code of osmo_amr_rtp_dec() checked too late
If len is < 0, it means osmo_amr_rtp_dec() failed and some of the out
variables there are not set. We should check the return code before
continuing and using potentially uninitialized values.

Change-Id: I76020c6b5dc8d3e52e8c5be8cdecdf8a0bb52ed9
2022-03-02 13:54:48 +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
Vadim Yanitskiy 41d9e2c093 phy_instance_destroy(): fix NULL pointer dereference
It's possible that a PHY instance has no associated TRX instance.

Change-Id: Id028577ef92d1b3ce63ba62b63b8b29edb2ae5a4
Fixes: OS#5377
2021-12-28 22:01:35 +06:00
Oliver Smith d4ebb1f6c4 treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: I12b250e16426b125124def49e124e40ae93d0d58
2021-12-14 12:11:11 +01:00
Vadim Yanitskiy 374939f8cc cbch: cosmetic: use talloc_zero() in bts_process_smscb_cmd()
Change-Id: Ibb5090b7cd53c1a485d0b9474c6470fa5831de67
2021-12-12 19:37:32 +03:00
Vadim Yanitskiy 7ce4fa4325 osmo-bts-trx: fix a memleak in trx_sched_set_lchan()
An additional burst buffer is allocated in rx_data_fn() for Uplink
SACCH repetition, but unlike the main buffer it never gets free()d.

Change-Id: I93310e7aed91a49c0511e2ed30e000440617f95a
Fixes: I7e4cc33cc010866e41e3b594351a7f7bf93e08ac
Related: OS#4795, SYS#5114
2021-12-12 19:03:05 +03:00
Vadim Yanitskiy 487feeb0ff osmo-bts-trx: use l1ts as talloc context for burst buffers
Before a massive refactoring of the scheduler structures [1] it was
impossible to have a clean hierarchy, in which the burst buffers
get allocated as children of their parent timeslot structures.

This change makes it easier to read talloc reports and simplifies
memory management, offloading free()ing of the burst bufferes to
talloc.

Change-Id: Idb1ceaf83c433d2d0eb84d77c2187a00a657905c
Related: [1] I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-12-12 18:59:34 +03:00
Vadim Yanitskiy 4b3fe16200 oml: assign unique names to 'struct tlv_parsed' chunks
Change-Id: Ie248d2a65a11da914324a7e65b767b894ed8644a
2021-12-12 16:22:48 +03:00
Vadim Yanitskiy 1475a45492 oml: fix copy-pasted comments in oml_rx_set_*_attr()
Change-Id: Iaa0e630b28b2a86312c069e7e55dd8bc5743759a
2021-12-12 16:22:30 +03:00
Vadim Yanitskiy 1d9106d768 oml: use ts->trx as talloc-context in oml_rx_set_chan_attr()
Change-Id: I6dc3706a486726afa9eec5d2e5369bd62c511455
2021-12-12 16:14:36 +03:00
Vadim Yanitskiy 4275bf7232 oml: use proper talloc context in oml_rx_set_radio_attr()
Change-Id: I69b6c72d85f68e4225d7786646f24259a5964998
2021-12-12 16:07:41 +03:00
Oliver Smith a271ca7fc7 debian/control: add osmo-bts meta-package
Add an osmo-bts meta-package that depends on the subpackages
osmo-bts-trx and osmo-bts-virtual. This is important, because the
downstream packaging of debian does not split osmo-bts in subpackages,
it has only one osmo-bts package. So without this, when installing
"osmo-bts" in debian while having the Osmocom binary package repository
installed and expecting to get the newer version, the user will actually
get the older version from debian.

Closes: OS#5319
Related: https://salsa.debian.org/debian-mobcom-team/osmo-bts/-/blob/master/debian/control
Change-Id: I1a6edf2eb146616ac51b7957368a8d057caa685f
2021-11-30 09:03:12 +01:00
Harald Welte 127c419d08 [lc15,oc2g,octphy] Fix memory leak on write queue overflow
Callers of osmo_wqueue_enqueue must always check the return value
and free the message themselves in the error case.

Change-Id: Ic67fbef23e419c0c8a7bcfb16d134e1bf649de72
Related: OS#5329
2021-11-25 13:15:30 +00:00
Harald Welte cf12cee46c cbch: Fix dangling cur_msg leading to double-free in bts_cbch_reset()
If a new default message is installed via RSL, and the old default
message is currently being transmitted, we must set cur_msg to NULL.

The old default message must be talloc_free()d unconditionally whenever
a new default message is being set.

We can do that by using the TALLOC_FREE macro.

Change-Id: Id32c2074b61cd1f09957b9d1558ffb3a7691a8e0
Related: OS#5325
2021-11-24 20:02:42 +01:00
Harald Welte 79f21c4ed1 cbch: Fix bts_smscb_state_reset() to avoid double-free
If the currently transmitted message is the default message,
bts_ss->cur_msg == bts_ss->derfault_msg.  In this case we cannot
simply talloc_free() both of them, as it would result in a boudle-free.

Change-Id: I2d3645e34d31507b012a53ffe12d14223682f808
Closes: OS#5325
Fixes: Ib01d38c59ba9fa083fcc0682009c13d2db3664fe
2021-11-24 20:02:42 +01:00
Pau Espin 40e97f3d02 bts: Properly free bts->shutdown_fi when struct gsm_bts is freed
Change-Id: I8c59f030c39c83a91b8504d4c5ce3b2058206fcf
2021-11-23 14:42:09 +01:00
Pau Espin 02532bafb8 bts_shutdown_fsm.h: Remove wrong comment describing enum
Change-Id: I963234255ce5a648a842ae6dbfd9966a694d0c09
2021-11-23 14:32:26 +01:00
Pau Espin 77524ea511 Bump version: 1.3.0.348-f42287-dirty → 1.4.0
Change-Id: Ibf3ce0bfd0cf67148229dd988ebde6e6b8d744cc
2021-11-16 16:40:05 +01:00
Neels Hofmeyr f422873087 gsm_lchan_interf_meas_calc_avg(): adapt to the order of boundaries
The order of interference level boundaries is not clearly defined by
3GPP, so we should support both ascending and descending variants.

Change-Id: I88d841d8d835bde8392c7b606b28c9070b7adc6e
Related: SYS#5313
2021-11-12 03:04:47 +03:00
Vadim Yanitskiy efc0d5bf57 gsm_lchan_interf_meas_calc_avg(): fix band calculation
This patch makes osmo-bts bahave similar to ip.access nanoBTS.

Change-Id: I1bcc6d6ba154f82aef95d05fb9af0eab490923c9
Related: SYS#5313
2021-11-11 09:01:15 +00:00
Vadim Yanitskiy b9fcb85a29 oml: use ARRAY_SIZE() in oml_rx_set_bts_attr()
Change-Id: I89dab55e39fe49c8b4d3afb4b46d1b7f2bf3663c
2021-11-11 09:01:15 +00:00
Vadim Yanitskiy bc7a490dbc rsl: exclude disabled timeslots from interference reports
It may happen after the A-bis connection recovery that the RF RESource
INDication message gets sent too early, while some timeslots are not
yet configured.  This confuses the BSC and provokes error messages.

Change-Id: I00bc6fe67ea1bbedcd5d8640e73bd8b16b9e667f
Related: SYS#5313, SYS#4971
2021-11-09 15:28:30 +03:00
Vadim Yanitskiy 8104922d81 common/Makefile.am: reformat {AM_CPPFLAGS,AM_CFLAGS,LDADD}
Change-Id: If475999cccc215b6792f276b9cc6c494a0c1ad81
2021-11-07 03:33:12 +03:00
Pau Espin 5dcafedc33 gsm_ts_release(): Make sure pchan{,is_want} is reset to NONE
Let's make sure all ts->pchan* related data is reset when we release the
TS. This is important for pchan_is, since in bts-trx upon shutdown
finish the PDCH lchan of a osmo dyn TS is set to
lchan->state=LCHAN_S_NONE, and as a result when the PCU tries to release
it by means of PCUIF act_req later, it may be ignored since the lchan is
already in erased state.

Related: SYS#4971
Change-Id: Ic7c34c0de23101ce094ffd03e00b4d2f6a551152
2021-11-05 13:17:09 +00:00
Vadim Yanitskiy 333d8787ff measurement: make use of gsm48_meas_res_is_valid()
Change-Id: Iea6ab7b69defd7ce88c2aa92fcf2b84370a4c135
Depends: Iae2bd508a08c4b5093d36e514c22218763e11edf
2021-11-04 17:47:02 +03:00
Vadim Yanitskiy 9833a4e198 [overpower] Turn it on and off depending on DL RxQual
Change-Id: Iaa812d4661ee17c4cd4a8c4ae4bd3e94c1a2e6cc
Depends: Ia28293a12de0af71f55e701fb65c46e905dae217
Related: SYS#5319
2021-11-04 16:05:33 +03:00
Vadim Yanitskiy fbd9aaca66 measurement: pass *mr to lchan_bs_pwr_ctrl()
As a side effect, we have to sacrifice a unit test (TC_inval_dummy)
because it becomes impossible to pass a dummy or invalid SACCH block
to lchan_bs_pwr_ctrl().

Change-Id: I937117cf26fb718d57920382f6972390ad498c51
Related: SYS#4918
2021-11-04 15:46:04 +03:00
Vadim Yanitskiy e714406632 measurement: pass *mr to repeated_dl_facch_active_decision()
Change-Id: Idbf5f95d632aa2270c49b351ad5561ca2182bf9a
Related: SYS#5114
2021-11-04 15:46:04 +03:00
Vadim Yanitskiy 81a4b3c090 measurement: get rid of *le in lchan_meas_handle_sacch()
The current Timing Advance value can be obtained either from the
L1 SACCH header (if received) or from lchan->ta_ctrl.current.

Change-Id: I2b3693a0e49f03f2b4496c9dbd30cf47e9bc86b5
2021-11-04 15:46:04 +03:00
Vadim Yanitskiy 110ec15fe9 lchan_meas_handle_sacch(): check if Measurement Result is valid
We should not rely on measurement data marked as invalid.

Change-Id: I4aaac742674ce3ac15e9a4a32fe7c72db81d32d2
2021-11-04 15:46:04 +03:00
Vadim Yanitskiy c13b325877 l1sap: rework handling of DATA.ind on SACCH
Currently an Uplink SACCH block is being passed to LAPDm first, and
then gets forwareded to the BSC in handle_ms_meas_report(), together
with the Uplink measurements collected so far.

This approach has a serious flaw: handle_ms_meas_report() won't be
called if an Uplink block contains SAPI=3 data (SMS) or was not
decoded at all (len=0) fow whatever reason.  Therefore, no RSL
MEASurement RESult message will be sent to the BSC.

Rename handle_ms_meas_report() to lchan_meas_handle_sacch(), and call
it from l1sap_ph_data_ind().  This way perioduc RSL MEASurement RESult
messages will be sent regardless of what happens on Uplink SACCH.

Change-Id: Ifed91f87fd653debc87a09da3fd31ad64a13f330
Fixes: TC_meas_res_speech_{tchf,tchh}_sapi3
Related: SYS#5319
2021-11-04 15:46:04 +03:00
Pau Espin 5c705a676d abis: Try one reconnect to previously connected BSC before trying next one
This way we keep all BTS connected to the same BSC if there was a
spurious network problem.

Related: SYS#4971
Change-Id: I16b75da5987584d099edc3a640f3a5cd61f3ad69
2021-11-03 20:21:28 +01:00
Pau Espin 84dceb5245 abis: Drop unneded if condition in else clause
priv->current_bsc will for sure be != last, otherwise it would have
entered the if clause above it.

Change-Id: I0a6519f7b93f0b45c67d19fef4f50daeeefc7340
2021-11-03 20:14:38 +01:00
Pau Espin 3ca3243e57 bts-trx: sched_lchan_tchf: Change log level to debug for line informing about missing dl prim
This scenario is actually expected when the call is being set up or torn
down, since we may not be receiving RTP from the MGW to send to the MS.
Hence, let's lower the log level to DEBUG to avoid having log clogged
for each call start/stop if INFO is used.

Related: SYS#5676
Change-Id: Ib7f274b97cc66d671316eae429ee4baf16831534
2021-11-03 18:44:08 +01:00
Pau Espin 5826136a9d scheduler: Fix FACCH msg with l2len==0 going to lower layers and logging errors
Recent commit (see below) changed a check to avoid weird results for msg
which had l2h=NULL, since l2len would return unexpected results there.
However, some code branches like FACCH or TCH seem to be always setting
l2h even if len=0. Hence, we must test either of the 2 scenarios (null
pointer and l2len()).

This commit fixes the following message appearing all the time during
calls:
"""
TCH/F: Prim has odd len=0 != 23
"""

Fixes: fb905b8d23
Related: SYS#5676
Related: SYS#4919
Change-Id: I43152bc8484a35cd004d3303d3a6e6efcdefa890
2021-11-03 18:28:44 +01:00
Pau Espin c64d7ae4a1 bts-trx: sched_lchan_tchf: Drop impossible code path
It cannot happen that msg1 is NULL and msg2 is not null, since they are
deuqueed from same place. Only possible combinations are:
msg1!=NULL && msg2!=NULL
msg1!=NULL && msg2==NULL

Change-Id: Ifd789844b1a7dfba596664de440d4c20b9f4c78f
2021-11-03 17:00:45 +01:00
Martin Hauke 7bb7889012 osmo-bts-trx-calypso.cfg: Adjust settings to work with current osmo-bts versions
* Remove deprecated configuration options:
  'osmotrx timing-advance-loop' is deprecated, Timing Advance loop is now active by default
  'osmotrx ms-power-loop <-127-127>' is deprecated, MS Power Control is now managed by BSC
* Adjust 'ipa unit-id' (1801 -> 6969) to match the one from the example osmo-bsc.cfg
* Set clock advance values to known working values:
  + 'osmotrx fn-advance' -> 20
  + 'osmotrx rts-advance' -> 5
* Set 'nominal-tx-power' since the calypso-bts tranceiver does not support NOMTXPOWER

Change-Id: I69436b914cf1bec57f9fe7acea4a896e7c46b3a9
2021-11-01 15:29:02 +01:00
Vadim Yanitskiy 98a47e8c9d rsl: fix a memory leak in handle_gprs_susp_req()
Change-Id: I65d9c12888aa5e5112680b3b3f38817e322ecc1c
2021-10-28 22:56:36 +03:00
Vadim Yanitskiy 5c93b8b671 l1sap: make 'l1sap' argument of process_l1sap_meas_data() const
Change-Id: Idc3004b0c74f7b98c96f20560c8b60a1fb4eb9c8
2021-10-28 22:38:20 +03:00
Vadim Yanitskiy 36062825de l1sap: process_l1sap_meas_data() accepts pointer to lchan
In 2/3 cases when calling process_l1sap_meas_data() we already have
a pointer to the logical channel, so let's pass it as the first
argument instead of a pointer to the transceiver.  This way we
avoid calling get_active_lchan_by_chan_nr() two times.

In l1sap_ph_data_ind(), call process_l1sap_meas_data() below the
conditional branch handling PDCH, so it won't be called for
GSM_LCHAN_PDTCH anymore.  GPRS specific measurements are handled
by the PCU and not of interest for the BSC.

Change-Id: I9de67a0b2d2b18923f2c2003b400387a0f1af411
2021-10-27 18:12:09 +03:00
Vadim Yanitskiy 7001816773 l1sap: use designated initializers in process_l1sap_meas_data()
Change-Id: I5169a6c5f6865655dbfebb6b68d5f67941d9cdb1
2021-10-27 18:12:09 +03:00
Vadim Yanitskiy a1377d9080 l1sap: move false PTCCH/U detection into PDCH branch
This check is only relevant for PDCH timeslots.

Change-Id: I187fef8f3de0b41b502b0b18acfb11c56c5551f0
2021-10-27 18:12:09 +03:00
Vadim Yanitskiy 03cf6042fb l1sap: fix handling of lchan->pending_rel_ind_msg
After merging the patch [1] fixing handling of the RLL RELease
INDication message in lapdm_rll_tx_cb(), ttcn3-bts-test shows
several regressions:

  pass->fail: BTS_Tests.TC_rll_rel_ind_DCCH_0
  pass->fail: BTS_Tests.TC_rll_rel_ind_DCCH_3
  pass->fail: BTS_Tests.TC_rll_rel_ind_ACCH_0
  pass->fail: BTS_Tests.TC_rll_rel_ind_ACCH_3
  pass->fail: BTS_Tests_LAPDm.TC_sabm_dm

[1] I823c9101bcca72d5792e16379b02d3602ffc2726
    991020c049

The problem is actually *not* in patch [1], but in the older one
[2] which we attempted to fix.  While a logical channel is in
signalling mode, the lower layers do not produce PRIM_TCH_RTS,
and thus the l1sap_tch_rts_ind() is not being called.

Unlike l1sap_tch_rts_ind(), the l1sap_ph_rts_ind() is being called
regardless of the channel mode (signalling vs speech), so let's
move handling of lchan->pending_rel_ind_msg there.

Change-Id: I2c380f9045624f0a0a8f988bb207bc73d8354857
Fixes: [2] Ie4f70c75f0137b4bd72d579b3a32575bac2fca3
2021-10-27 18:12:09 +03:00
Pau Espin b71d2f5a4b scheduler: Avoid crash upon call to trx_sched_set_lchan if l1ts is uninitialized
It could happen if for instance l1 code called trx_sched_clean() when
closing the phy, and after that some code called (erroneously)
trx_sched_set_lchan(). Let's make sure we don't allow other modules to
crash the process when using this function.

Related: SYS#4971
Change-Id: I93af7c3dcf0e34e9317eec0ee183dbf18b8d2f3b
2021-10-26 18:57:24 +02:00
Pau Espin 887fa01977 l1sap: Avoid re-(de)activating already (de)active lchans
This avoids triggering all sorts of unexpected paths where one tries to
release an already released lchan, etc.
This can happen for instance if BTS shuts down due to BSC link going
down, and hence resets all lchans, announcing it to the PCU. Then the
PCU may try to deactivate the channel sending act_req (disable), but the
BTS already unilaterally dropped the channels.
That code path seems to trigger some crash, probably because something
in lchan has been freed.

Related: SYS#4971
Change-Id: I093e4d4e23b527b10bf5d6ff538460626c30a8f8
2021-10-26 18:57:16 +02:00
Pau Espin c2ae1df890 bts-trx: sched: tx_pdtch_fn: Drop log line clogging logs
The burst is properly pre-filled to _sched_dummy_burst in
bts_sched_init_buffers(), so we are fine doing nothing on C0.

Related: SYS#5676
Related: SYS#4919
Fixes: 300e31ed13

Change-Id: Ia7045724a1a3206f5890c0b12843711ad2360ed8
2021-10-25 18:32:54 +02:00
Pau Espin fb905b8d23 scheduler: Fix check against empty PDCH blocks
msgb_l2len() will return nonzero values if msg->l2h is NULL.
Let's check against msg->l2h being NULL instead.

Related: SYS#5676
Related: SYS#4919
Fixes: 300e31ed13
Change-Id: I18b61fcaa858a53887191a18d560c2e929478c64
2021-10-25 18:32:54 +02:00
Pau Espin 5c5982067d Revert "bts-trx: sched: tx_pdtch_fn: Handle PCU idle blocks properly"
This reverts commit 8a85b71167.

This is actually the wrong fix. Proper fix comes as a follow-up patch,
since the root cause happens earlier in upper layers. No msg with
l2h=NULL should reach this point of code ever.

Change-Id: Ie23d94924f824bd7e89437ccf73b260f542477c6
2021-10-25 18:32:52 +02:00