Commit Graph

1335 Commits

Author SHA1 Message Date
Philipp Maier 6611e7f305 allow to configure multiple oml remote-ip addresses
At the moment we can only configure a single BSC in the BTS
configuration. This also means that if this single BSC fails for some
reason the BTS has no alternate BSC to connect to. Lets extend the
remote-ip parameter so that it can be used multiple times so that an
operater can configure any number of BSCs that are tried one after
another during BTS startup.

Change-Id: I205f68a3a7f35fee4c38a7cfba2b014237df2727
Related: SYS#4971
2021-07-19 10:39:06 +02:00
Pau Espin ace4e500ed Make gcc 11.1.0 false positivies happy
Make gcc 11.1.0 false positivies happy

After my system's gcc was upgraded, I get false positivies in a couple
places. Let's initialize those to make gcc happy.

"""
//git/osmo-bts/src/common/vty.c: In function ‘lchan_summary’:
//git/osmo-bts/src/common/vty.c:1881:23: error: ‘ts’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1881 |                 lchan = &ts->lchan[lchan_nr];
      |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
//git/osmo-bts/src/common/vty.c:1869:20: error: ‘trx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1869 |                 ts = &trx->ts[ts_nr];
      |                 ~~~^~~~~~~~~~~~~~~~~
//git/osmo-bts/src/common/vty.c:1852:34: error: ‘bts’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1852 |                 if (trx_nr >= bts->num_trx) {
"""

Change-Id: I93477142a5a4b3f3829b7398d6e564c127263596
2021-07-15 13:51:38 +02:00
Philipp Maier dda5cf4bb7 paging: prioritize CS related paging over PS related pagings.
When the paging queue is filled up to a critical level, pagings from the
PCU should be dropped as each immediate assignment paging from the PCU
is worth 4 normal CS pagings. Also the PCU may still issue pagings if the
paginging queue is already full and CS pagings are dropped. In a
congestion situation it is more important to get the CS rather than PS
pagings through.

Change-Id: I30f97672d7a0c369c4a656e878ab8cbbd83e31ea
Related: SYS#5306
2021-07-06 11:35:50 +02:00
Vadim Yanitskiy a5602d593c gsm_lchan_interf_meas_calc_band(): also print number of AVG samples
Change-Id: I4cebb0c5eef16f7e20fce85c506fc271127d7259
2021-07-05 12:07:55 +00:00
Vadim Yanitskiy 454a2516f2 rsl: use tlvp_val16be() in rsl_rx_ipac_XXcx()
Instead of using tlvp_val16_unal() and then doing ntohs() here
and there, convert the remote port to the host byte order once.

Change-Id: Id883a976a03fd3022ed9d66f703b01244df2d9db
2021-07-05 12:07:55 +00:00
Pau Espin ae783bcb0e Support SDCCH8 in osmo dyn ts
Change-Id: Id541dee6c224d2b8d97c07b916085883354cecbc
2021-07-05 08:03:08 +00:00
Pau Espin a4b9073989 Rename osmo dyn ts enums to contain SDCCH8
They will gain support to be activated as SDCCH/8 soon too.

Related: SYS#5309
Depends: libosmocore.git I56dcfe4d17899630b17f80145c3ced72f1e91e68
Change-Id: Ia617d20fc52f09dbab8f4516c06fa1efac08e898
2021-07-05 08:03:08 +00:00
Vadim Yanitskiy 30aea88c2c power_control: constrain BS power reduction on BCCH carrier
BS Power Control is not allowed on the BCCH/CCCH carrier, unless
the BTS is operating in the BCCH carrier power reduction mode.

Allow constrained BS power reduction (up to 6 dB) on active logical
channels iff BCCH carrier power reduction mode is enabled.

Change-Id: I3299b6cdd230d3767321c3d6c64d468b7f5e1d02
Related: SYS#4919, SYS#4918
2021-07-01 02:01:22 +02:00
Vadim Yanitskiy 0e8d68437a osmo-bts-trx: implement BCCH carrier power reduction mode
The BCCH carrier (sometimes called C0) of a BTS shall maintain
discontinuous Downlink transmission at full power in order to
stay 'visible' to the mobile stations.  Because of that, early
versions of 3GPP TS 45.008 prohibited BS power reduction on C0.

However, in the recent 3GPP TS 45.008 there is a feature called
'BCCH carrier power reduction operation'.  This is a special
mode of operation, where the variation of RF level for some
timeslots is relaxed for the purpose of energy saving.

In BCCH carrier power reduction operation, for timeslots on the
C0 carrier, except timeslots carrying BCCH/CCCH, the output power
may be lower than the output power used for timeslots carrying
BCCH/CCCH.  In this case the maximum allowed difference in output
power actually transmitted by the BTS is 6 dB.

The power reduction operation can be controlled by the BSC by
sending BS POWER CONTROL on the A-bis/RSL with the Channel Number
IE set to 0x80 (RSL_CHAN_BCCH).  This makes osmo-bts reduce the
transmission power on inactive timeslots of the BCCH carrier.

This is a non-standard, Osmocom specific extension, so indicate
support of this feature to the BSC in the feature vector.  Also
add a VTY command to allow enabling/disabling the power reduction
locally.  Add some signalling notes to the A-bis/RSL manual.

For more details, see 3GPP TS 45.008, section 7.1.

Change-Id: I3dcee6e910ccc61c5c63c728db9ea04327e2fc98
Depends: I69283b3f35988fc7a1a1dcf1a1ad3b67f08ec716
Related: SYS#4919
2021-07-01 02:01:22 +02:00
Vadim Yanitskiy c3b3ca358a Revert "power_control: BS power shall not be reduced on C0"
This reverts commit cd30a40be1.

As a part of SYS#4919 "BTS energy saving", we want to support
constrained (up to 6 dB) BS power control on BCCH carriers.

Change-Id: I0d2b48c4b2af2d8e94f4ad02fa4774dbd0a0a654
Related: SYS#4919
2021-06-30 23:45:12 +02:00
Pau Espin 8bf5cbea49 Support forwarding proto IPAC_PROTO_EXT_PCU BSC<->PCU
This new extension protocol is used to forward Osmocom PCUIF messages
BSC<->BTS<->PCU.
It will be sent re-using the IPA multiplex of the OML link between
BSC and BTS. BTS is responsible for forwarding the message over the unix
socket to the PCU.

PCUIF existing RX path needs to be reworked in order to accept
variable-size messages, in order to be able to transparently forward
messages without knowing about them (the new container message is
variable-length).

Related: SYS#5303
Change-Id: I73fdb17107494ade9263a62d1f729e67303fce87
2021-06-30 08:13:21 +00:00
Pau Espin 1fe9a89308 gsm_data: Drop unused function gsm_pchan_parse()
Change-Id: I8f49811c1b694c5ef1fb9178d5ff4558172089b0
2021-06-29 16:09:15 +02:00
Eric Wild 4d845ccbb6 osmo-bts-trx: indicate A5/4 support, handle Kc128
Change-Id: Ib8e04fe79f30b443a54c38f395a7a3626ff97c45
Related: SYS#5324
2021-06-23 21:59:31 +02:00
Vadim Yanitskiy f1bdf605b5 scheduler: fix: use ts_pchan() in trx_sched_set_cipher()
Properly handle dynamic timeslots, do not access 'pchan' directly.

Change-Id: Iccb8794253face54164af1ba344204eadab8f98b
Fixes: [1] I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-06-22 19:03:47 +02:00
Vadim Yanitskiy a6af31cd44 scheduler: fix wrong union field in trx_sched_tch_req()
I introduced this regression in [1] during a massive refactoring.
Basically, I copy-pasted a chunk from trx_sched_ph_data_req(), but
forgot to change the union field.  This broke voice calls, because
all TCH.req primitives would be enqueued to wrong timeslot.

Change-Id: If841e6ac40a3c6344c304ab970755d6a2d292156
Fixes: [1] I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-06-22 18:59:16 +02:00
Vadim Yanitskiy f47fa70b9f osmo-bts-trx: report PDCH interference levels to the PCU
The PDCH multiframe contains 48 data slots, 2 PTCCH slots, and
2 IDLE slots.  The later two can be used for the interference
measurements, since the UEs shall not transmit on them.

bts_report_interf_meas() is called every 104 TDMA frames, what
corresponds to 2 PDCH multiframe periods.  Report interference
levels on PDCH timeslots from this function.

Change-Id: I56f83db5264c246ec1b4b8a973105a4fc09931fb
Related: SYS#5313, OS#1569
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy 54d0931330 osmo-bts-trx: measure interference levels on TRXC_IDLE
We already do the intereference measurements on inactive logical
channels.  For the active channels we can still use the IDLE
slots, on which the UEs shall not transmit Uplink bursts.

Change-Id: Ic3030dba5eb223177298aa4e43559a93dc3d1392
Related: SYS#5313, OS#1569
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy 8a1a74e6ca scheduler: unset TRX_CHAN_FLAG_AUTO_ACTIVE for TRXC_IDLE
Neither we expect any Uplink bursts on IDLE channels, nor we need
to send any Downlink bursts.  Automatic activation of TRXC_IDLE
channels does not make sense.

Change-Id: Ifade0eab0605154196322ff20b1b3a44495f8a2e
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy dded16c4c9 osmo-bts-{trx,virtual}: get rid of dummy tx_idle_fn()
This logical channel handler does nothing more than just logging.

Change-Id: I438705f8dd902193e6c7b499d8ee55c56b6a1c2e
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy 6fd4f77243 osmo-bts-trx: report interference levels to the upper layers
In trx_sched_ul_burst(), treat all BURST.ind and NOPE.ind mapped
to inactive logical channels as interference.  Average the RSSI
values on the fly using a sliding average with constant a=0.5.

Report averaged values for each logical channel every 104 TDMA
frames (SACCH period) by calling gsm_lchan_interf_meas_push().

Change-Id: I4686448e42a40df56c1d27a14fd0a4d43fd144a5
Related: I78b6d8beffa5228a28231b75728e7aebdd3cb23c
Related: SYS#5313, OS#1569
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy d4efc3f9c5 Report interference levels in RSL RF RESource INDication
This change implements general interference averaging logic for
the higher layers.  In l1sap_info_time_ind(), where we receive
TDMA time updates from BTS model, call rsl_tx_rf_res() for each
transceiver according to the interval defined by the Intave
parameter received from the BSC.  In rsl_tx_rf_res() perform
the actual averaging for each inactive logical channel, and
then send everything to the BSC over the A-bis/RSL.

The BTS model specific code needs to report the measurements
for each logical channel every 104 TDMA frames (SACCH period)
by calling gsm_lchan_interf_meas_push().

Change-Id: Id80fdbef087de625149755165c025c0a9563dc85
Related: SYS#5313, OS#1569
2021-06-18 18:56:57 +02:00
Vadim Yanitskiy 64e1c1222e oml: fix handling of NM_ATT_INTERF_BOUND attribute
Looks like this part of the code has never been tested.  The old
code would dereference the same value in the loop and assign it
to all members in array 'bts->interference.boundary'.

Change-Id: I7f83d8e6eb6cc19e3e9529ba06617a902de23e35
Related: SYS#5313, OS#1569
2021-06-18 18:56:57 +02:00
Pau Espin b04ffc11fb pcu_sock: Transmit SI2
OsmoPCU will need this SI2 in order to gain knowledge of the BCCH
Frequency List being broadcasted, in order to build a per-MS specific
Neighbour List using NC_FREQUENCY_LIST bits in Packet Measurement Order.

Related: SYS#5303
Change-Id: If70c64f941f621a9a68aef2c846639b5c7f2f74b
2021-06-11 23:19:59 +02:00
Vadim Yanitskiy ef4a6a0f43 l1sap: fix TDMA frame number arithmetic in fn_ms_adj()
Using the normal arithmetic for TDMA frame numbers is wrong.

Change-Id: Ie17670d150489014a4a2e140cede42086100bbc0
2021-06-10 21:50:48 +00:00
Pau Espin 52f6fc5aab rsl: Use switch statement in rsl_rx_bcch_info()
This is a preparation for new commit, which makes it easier to add new
SIs being sent.

Change-Id: I27774ca36d1e740b6a502cfb280aba0ea82b9dbe
2021-06-10 12:58:18 +00:00
Vadim Yanitskiy 5acd0102e4 vty: ensure all warning messages are prefixed with '%%'
Change-Id: I23fc1cd8aa5725de06651f061c9fce6a022adfa8
2021-06-10 11:53:24 +00:00
Vadim Yanitskiy 85c2d641d5 common/vty: facilitate finding duplicate PHY/TRX associations
In cfg_trx_phy_cmd(), use phy_instance_link_to_trx() and ensure
that a PHY instance can be bound to a transceiver only once.

Change-Id: I132e08fc496abef278b94254cebfac7a4285a7c2
2021-06-10 11:53:24 +00:00
Vadim Yanitskiy bd49fd2492 [VAMOS] trx_sched_init_ts(): assign names to per-timeslot counters
Thanks to [1], it's now possible to associate a human-readable
name with a rate counter group.  Before this API, we had to use
weird index values for each timeslot, and with introduction
of the shadow timeslots the situation got even worse.

Change-Id: Ie872ab37661fa5d44f219f59c7daaa1033113289
Depends: [1] I0dc510783dd9ae8436dae8005a7b3330e80d36f3
Related: SYS#4895, OS#4941
2021-06-09 22:45:10 +02:00
Vadim Yanitskiy 43adbe200c measurement: remove over-defensive checks in is_meas_complete()
The timeslot number ts->nr is set in gsm_bts_trx_alloc() and can
never be greater than 7.  Regarding the physical channel type
returned by ts_pchan(), it's also unlikely to be greater than
_GSM_PCHAN_MAX.

Change-Id: I6d20d7cba49cc8b6d1dc2192598ca372b7d2c5bf
2021-06-09 20:20:42 +00:00
Vadim Yanitskiy fc8c9880d9 conf_lchans_as_pchan(): initialize all lchans with GSM_LCHAN_NONE
This function is called during the OML bootstrapping, and also
when a dynamic timeslot switches between PDCH and TCH/{F,H}.
In the later case, after switching from TCH/{F,H} to PDCH, some
lchans might still have the old type assigned.

Let's ensure that all logical channels are properly updated.

Change-Id: I44726f2bfb979c2fa2f5f30c5b11700cf4b3399d
Related: SYS#5313, OS#1569
2021-06-08 02:04:53 +02:00
Vadim Yanitskiy 628853de74 conf_lchans_as_pchan(): fix GSM_LCHAN_{CCCH->CBCH} regression
This regression was introduced (by me) in [1] and broke CCCH.

Change-Id: I403ad06574a8505b69dd06781f7fe0f7cabf416f
Fixes: [1] I1c5a033e89d9ca5fb01ebe9ffb521fd67d159bee
Related: SYS#4895, OS#4941
2021-06-08 01:53:14 +02:00
Vadim Yanitskiy 177799fe7e l1sap: fix TDMA frame number wrap in l1sap_info_time_ind()
Using the normal arithmetic for TDMA frame numbers may result
in getting wrong values.  Consider the following situation:

  'info_time_ind->fn' is 0 (beginning of period)
   'bts->gsm_time.fn' is 2715647 (end of period)

With these input values the following expression:

  info_time_ind->fn - bts->gsm_time.fn

will be equal to:

  0 - 2715647 or -2715647

In this case osmo-bts does not log an error, because:

  if (-2715647 > 0) // is false

As a consequence, we do not increment number of RACH slots that
have passed by since the last time indication:

  for (i = 0; i < -2715647; i++) // is false

This is why we introduced GSM_TDMA_FN_{SUB,SUM,DIFF,INC} API.

Change-Id: I6168dd75daea50bbe2e19338e637185ac9ac87ef
2021-06-07 01:49:16 +02:00
Vadim Yanitskiy 6d20a49806 [VAMOS] osmo-bts-trx: schedule bursts on 'shadow' timeslots
Change-Id: I3e0bdf8c03273f66991aa1764029ab1dd3528d7e
Related: SYS#4895, OS#4941
2021-06-05 00:34:36 +02: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 d9daa3fd9e [VAMOS] conf_lchans_as_pchan(): improve readability
Change-Id: I1c5a033e89d9ca5fb01ebe9ffb521fd67d159bee
2021-06-05 00:34:36 +02:00
Vadim Yanitskiy b99db695a7 [VAMOS] scheduler: drop meaningless channel number checks
Change-Id: Icc57e58feece51c2d1c421454352bc821e338973
2021-06-05 00:34:36 +02:00
Vadim Yanitskiy 28cd8a318f trx_sched_is_sacch_fn(): fix handling of dynamic timeslots
There is no GSM_PCHAN_TCH_F{_TCH_H}_PDCH in trx_sched_multiframes[],
so find_sched_mframe_idx() would always return -1 for these.  Fix
this by using ts_pchan(), which returns currently active pchan type.

Change-Id: Ia5e337e897b595e7de6e504664c969b583cc02a1
2021-06-04 20:06:58 +00:00
Vadim Yanitskiy 069796bcd8 [VAMOS] oml_rx_set_chan_attr(): clarify NM_ATT_CHAN_COMB handling
Change-Id: I8a4aace97515ca59ac4c6b5d50a9ee242edfe409
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy a02d9e57b0 [VAMOS] l1sap: get_lchan_by_chan_nr() may return NULL
Change-Id: Ic309622d0ee818302dfc66d69fd2914ae28261d6
2021-06-04 20:04:13 +00: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 5d888e5064 [VAMOS] rsl_lchan_lookup(): make it more readable
Change-Id: I3160929c739a521fe494716c3da3d3b72370a98a
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy 0704b29d6d [VAMOS] rsl_lchan_lookup(): use ABIS_RSL_CHAN_NR_CBITS_* macros
Change-Id: Iec3250e3a59f8d428d7e7be2ceb71f7086a68e7b
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy 24e5f72f83 [VAMOS] gsm_pchan2chan_nr(): use ABIS_RSL_CHAN_NR_CBITS_* macros
Change-Id: I2b1480d3c330951cccc15333450cf7243b9505fc
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy dd3b7d469e [VAMOS] common/oml: generalize checking BTS_FEAT_MULTI_TSC
Change-Id: Iaa5aced70e166963106c27ebdb09adaae22daea4
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy d8598005ce [VAMOS] l1sap_chan_act(): handle Osmocom specific TSC IE
This is an Osmocom specific RSL IE that, if present, takes
precedence over the values indicated via the A-bis/OML.

Change-Id: I717e5b2a6ca5b4faeaab9cae4bb971907945871b
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy 60fc1d3763 [VAMOS] scheduler: add new GMSK training sequences from 3GPP 45.002
Change-Id: I03fe712da5a3cc1a59f40a98a57f43306c3586c6
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
Philipp Maier 91054e78ef main,abis: change model name from sysmoBTS to osmo-bts
The model name when used when abis_open() is called is sysmoBTS, since
we recently decided to deprecate the type name "sysmobts" in osmo-bsc we
might consider the same thing here.

Change-Id: I3c61d92f5527ae0145316b5ff92660f8b467a8dc
2021-06-02 17:53:02 +02:00
Vadim Yanitskiy ef5c364bba [VAMOS] common/scheduler: unify symbol names for training sequences
Change-Id: Ice464e5b02b11b0f13df247fe6a01420a29bf1c5
Related: SYS#4895, OS#4941
2021-06-01 02:46:43 +00:00
Vadim Yanitskiy bdef33d527 [VAMOS] bts_supports_cm(): handle RSL_CMOD_CRT_OSMO_TCH_VAMOS_{Bm,Lm}
Change-Id: I61040df30246ff79c9b13055bb1fec92fe64f3dd
Related: SYS#5315, OS#4940
2021-06-01 02:46:43 +00:00
Vadim Yanitskiy c70196240c [VAMOS] rsl: call bts_supports_cm() from rsl_handle_chan_mod_ie()
Ensure that we check the PHY capabilities in both cases:

  * RSL CHANnel ACTIVation, and
  * RSL CHANnel MODE MODIFY,

by calling bts_supports_cm() from rsl_handle_chan_mod_ie().

Modify bts_supports_cm() to accept a 'struct rsl_ie_chan_mode',
so we can handle VAMOS enabled channel modes and CSD later on.

Change-Id: I31a444592436705ec9d6ddade3cbfa7f8cb4bb91
Related: SYS#5315, OS#4940
2021-06-01 02:46:43 +00:00
Vadim Yanitskiy e02612d863 [VAMOS] rsl_rx_mode_modif(): handle Channel Identification IE
For some reason, handling of the Channel Identification IE was done
in l1sap_chan_act().  This function is being called on reciept
of the CHANnel ACTIVation message, but not on MODE MODIFY.

Change-Id: I07f95e69e6230a1daca62cc0a7c64954f191fa8a
Related: SYS#5315, OS#4940
2021-06-01 02:46:43 +00:00
Vadim Yanitskiy 13d595a9ef [VAMOS] osmo-bts-trx: indicate MTS in Downlink TRXDv2 PDUs
Change-Id: I1a17a25883214c068f9b1a6d651128b8f760d1fb
Related: SYS#4895, OS#4941
2021-06-01 02:46:43 +00:00
Pau Espin 272d474ccb pcuif: Set missing bsic field during Tx of info_ind
Change-Id: I5c0194644083f04799174464445ec21dae82f368
2021-05-31 16:18:13 +02:00
Pau Espin 949874433f Add missing value_string for NM_EV_* introduced recently
Fixes: 0277cddab2
Change-Id: I70266767d4f85e8c14ecf477af7fab0706698067
2021-05-27 18:58:59 +02:00
Pau Espin 1cad2f51c6 Fix regression in 'bts: Clean up TS selection in sign_link_up'
Fixes: 518ada9414
Change-Id: I63af96235eb6e0a7334936f65e1f44d4422198a5
2021-05-26 19:05:58 +02:00
Pau Espin 518ada9414 bts: Clean up TS selection in sign_link_up
Change-Id: I0c92dfd05bf2ae40887980ef10b7e4c679213b6a
2021-05-25 11:36:35 +00:00
Vadim Yanitskiy bdc5095368 common: phy_links_open(): warn about dangling PHY instances
Change-Id: I8d84bf7a00da6b985cb3dc314e86cacac8d4f48c
2021-05-23 10:36:05 +00:00
Vadim Yanitskiy d4abdd80fe [VAMOS] gsm_data.h: introduce and use BTS_TSC macro
Change-Id: I0cf915d2d3a640aa1442cf6abe9a314261b4a64e
Related: SYS#5315, OS#4940
2021-05-23 10:09:27 +00:00
Vadim Yanitskiy d7323d6f1f [VAMOS] common: make 'struct gsm_bts_trx_ts' pointers const
Change-Id: I0369ef4ae603a4afed0661a5894df6a7135b1919
2021-05-23 10:09:27 +00:00
Vadim Yanitskiy e24279508d common: make the arguments of phy_{link,instance}_name() const
Change-Id: Ic01d131148065c9143d3a90f8020e2e133941292
Related: CID#236092 "Dereference before null check"
2021-05-19 16:53:06 +02:00
Vadim Yanitskiy 6ad89f2f58 osmo-bts-{trx,virtual}: fix: pinst->trx may be NULL
We assume that it's legal to have dangling PHY instances that are
not associated with any TRX instances in the configuration file.
Obviously, such PHY instances have pinst->trx set to NULL.

The DSP based models seem to handle dangling PHY instances without
any problems, so let's ensure that we always check pinst->trx
against NULL in the osmo-bts-{trx,virtual} specific code.

Change-Id: Ib7d9cb7ae47fead723fa46454cd64bf6e88756bb
Fixes: CID#236092 "Dereference before null check"
2021-05-19 16:53:06 +02:00
Vadim Yanitskiy 462bf0952a [VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):

  - struct l1sched_trx (struct gsm_bts_trx),
  - struct l1sched_ts (struct gsm_bts_trx_ts),
  - struct l1sched_chan_state (struct gsm_lchan).

These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead.  Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.

                                 + gsm_network
                                 |
                                 --+ gsm_bts (0..255)
                                   |
  --+ l1sched_trx --------------------> gsm_bts_trx (0..255)
    |                                |
    --+ l1sched_trx_ts               --+ gsm_bts_trx_ts (8)
      |                                |
      --+ l1sched_chan_state           --+ gsm_lchan (up to 8)

I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.

In this path I slightly change the architecture as follows:

                                 + gsm_network
                                 |
                                 --+ gsm_bts (0..255)
                                   |
                                   --+ gsm_bts_trx (0..255)
                                     |
    --+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
      |                                |
      --+ l1sched_chan_state           --+ gsm_lchan (up to 8)

Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping.  The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.

osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.

Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-18 19:11:06 +00:00
Pau Espin 0277cddab2 sysmo,oc2g,lc15: Make RadioChannel MO depend on RadioCarrier MO
lower layer specific APIs require first to enable the TRX object
(GsmL1_PrimId_MphInitReq, which requires ARFCN received during Set
Radio Carrier Attributes) before enabling the per-TS structure.
Hence, OPSTART must happen in RCARRIER MO before OPSTART can be sent to
the Radio Channel MOs, otherwise the initialization of the TS objet will
fail and OPSTART for the RadioChannel MO will send back a NACK.
In order to avoid this, we need to keep the RadioChannel MO announced as
"Disabled Dependency" until RCARRIER is OPSTARTed.

Related: OS#5157
Change-Id: I8c6e5ff98c32a3cd5006f5e5ed6875bcabb1d85f
2021-05-17 14:23:30 +02:00
Vadim Yanitskiy 05493ca810 [VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
Historically the logical channel handlers like rx_data_fn() used to accept
quite a lot of arguments.  With the introduction of additional measurement
parameters it has become clear that we need to group the arguments into
structures.  This is why both 'trx_{dl,ul}_burst_{req,ind}' structures
were introduced.

However, both channel type and burst ID were kept untouched, so until
now we had them being passed between the scheduler functions here and
there.  This change is a logical conclusion of the original change
mentioned above.

As a part of this change, the new LOGL1SB() macro is introduced.  It
does accept a pointer to 'trx_{dl,ul}_burst_{req,ind}' and expands the
context information for the old LOGL1S() macro.

Change-Id: Ic5a02b074662b3e429bf18e05a982f3f3e7b7444
2021-05-11 04:00:37 +02: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 b6d3e2c360 [VAMOS] struct gsm_bts_trx: fix the PHY instance pointer
First of all, there is no reason to use a void pointer because
it's always 'struct phy_instance'.  Also, no need to encapsulate
this pointer into 'role_bts' because there are no other roles in
osmo-bts (we used to have shared headers years ago).

This commit also fixes a bug in test_sysmobts_auto_band(), where a
pointer to 'struct femtol1_hdl' was directly assigned to trx.pinst.

Change-Id: I9bd6f0921e0c6bf824d38485486ad78864cbe17e
2021-05-09 02:05:48 +02:00
Vadim Yanitskiy 0dcaf34927 common/sysinfo: make struct gsm_bts_trx const in num_agch()
Change-Id: I776defc7e9699a378c9a03304c63e15d023476d0
2021-05-08 17:41:02 +02:00
Vadim Yanitskiy 9e09441814 rsl: fix wrong value printed in rsl_handle_chan_mod_ie()
Change-Id: I724504a39702393402fae20b0e9775c3486da966
2021-05-05 02:09:26 +02:00
Vadim Yanitskiy 38cdafd656 common/abis: fix the use of deprecated e1inp_line_get() API
We need curly braces becausee1inp_line_get2() is basically a macro
that calls OSMO_ASSERT(), which in its turn contains an 'if' stmt.

Change-Id: I41a5fd13a7fa40e16bcf1a8099624b654274cee3
2021-04-30 21:07:41 +02:00
Vadim Yanitskiy d2eafadc25 vty: fix the use of deprecated osmo_bts_feature_name()
Change-Id: I67863da286b0fd1ec42088bce12d3c76e4be30ba
Depends: I9dfdb5e81037b6000effbd340af4e5db0dcfd69c
2021-04-30 21:07:02 +02:00
Harald Welte b1b100ce59 Introduce ability to set socket priority of RTP sockets
This significantly simplifies setups in which not only the IP DSCP
but also the IEEE 802.1Q PCP is to be set for RTP packets.

Depends: libosmo-abis.git I52c08f4b2a46981d002ef0c21e6549445d845a6e
Change-Id: Ia3a91e6788285be3e2e73defee63e6bd79c6258e
Related: SYS#5427
2021-04-30 08:23:56 +02:00
Vadim Yanitskiy 8de227fd13 rsl: add missing Channel Mode values to rsl_handle_chan_mod_ie()
Change-Id: I125cdaaf5adac0891a964c9834b99eb5a35ce262
Depends-On: I40eca759380c8895d7923b2b4259d37a50978160
Depends-On: Icf4c83fa443b8410f4362c119b0a85419036b9cd
2021-04-19 16:12:20 +02:00
Vadim Yanitskiy aee336eaac rsl: rename, fix and refactor lchan_tchmode_from_cmode()
In change [1] I added the missing 'default' branch to the 'switch'
statement in lchan_tchmode_from_cmode().  This caused massive
regressions in ttcn3-bts-test, because osmo-bts started to NACK
some RSL CHANnel ACTIVation messages.

What caused a lot of regressions in ttcn3-bts-test is actually the
missing branch for RSL_CMOD_SPD_SIGN in the 'switch' statement.
It was not a problem before [1], because the 'default' branch was
not there.  I was about to add the missing 'cause' when I realized
that this function needs to be reworked first...

First of all, lchan_tchmode_from_cmode() does a bit more than just
deriving RR (TS 44.018) channel mode from RSL (TS 48.058) channel
mode.  It additionally stores the 'Speech or data indicator' to
the logical channel state, and also changes some global DTXd related
flags in 'struct gsm_bts'.  Let's use a more precise name.

  lchan_tchmode_from_cmode() -> rsl_handle_chan_mod_ie()

Together with renaming, it becomes logical to have the IE presence
check in rsl_handle_chan_mod_ie(), so that we can reduce code
duplication in the calling functions a bit.

Finally, the main problem is that coding and interpretation of the
6-th octet 'Speech coding algor./data rate + transp ind' depends on
the 4-th octet of the Channel Mode IE.  We cannot handle all values
in one 'switch' statement without proper discrimination:

  a) If octet 4 indicates Speech, then octet 6 shall be interpreted
     as the GSM speech coding algorithm (FR, HR, AMR, etc.).

  b) If octet 4 indicates Signalling, then octet 6 shall be set
     to '00'O, because this is the only value defined in version
     16.0.0 of 3GPP TS 48.058.  All other values are reserved.

  c) If octet 4 indicates Data, then octet 6 shall be interpreted
     as CSD data rate further discriminated by service transparency.

Therefore, we need take both values into account.  This can be
achieved by mixing them together using the bitwise operators,
just like we do in L1SAP code.

Change-Id: Iba967f5bd0cc8ad6cd3ccd40cca38b15ffe96b2c
Related: [1] I67a70132999be6580a29e6b814763309a6df4ae9
Related: SYS#4895, OS#4941
2021-04-19 06:29:29 +02:00
Vadim Yanitskiy 5ac4456173 l1sap: fix incorrect pointer cast in l1sap_chan_act()
In [1] I introduced a regression, so osmo-bts started to complain:

  This PHY does not support lchan TSC 3 != BSIC-TSC 7

on channel activation, despite the TSC in RSL_IE_CHAN_IDENT was 7.

The problem is that this statement:

  cd = (const struct gsm48_chan_desc *) TLVP_VAL(tp, RSL_IE_CHAN_IDENT) + 1;

is basically equivalent to:

  cd = ((const struct gsm48_chan_desc *) TLVP_VAL(tp, RSL_IE_CHAN_IDENT)) + 1;

so we actually shift the pointer by sizeof(struct gsm48_chan_desc)
and skip 3 octets instead of just one (IEI octet).  Fix this.

Change-Id: Ic3a81396b60577e03c541d32839d07dc6d45c838
Fixes: [1] Id100f4c56fd5c1adad5d925d97240bed82981b9b
Fixes: OS#5121
2021-04-18 23:57:20 +02:00
Vadim Yanitskiy 976e7e51e6 rsl: do not blindly ignore unhandled/unknown Channel Mode
Change-Id: I67a70132999be6580a29e6b814763309a6df4ae9
Related: SYS#4895
2021-04-16 20:57:08 +02:00
Vadim Yanitskiy f88f539c77 l1sap: fix wrong IEI and parsing in l1sap_chan_act()
As the prefix in 'GSM48_IE_CHANDESC_2' implies, this IE belongs
to 3GPP TS 04.08 (or TS 44.018), so it can be used in the Radio
Resource assignment messages sent to the MS.  While in this
function we're dealing with 3GPP TS 48.058, and thus the IEI
may be (and actually is) different for the RSL messages.

Also, according to 3GPP TS 48.058, section 9.3.5, the Channel
Description IE is included together with its element identifier,
so we need to skip one byte when doing the pointer casting.

Change-Id: Id100f4c56fd5c1adad5d925d97240bed82981b9b
Related: SYS#4895, OS#4941
2021-04-07 04:55:48 +02:00
Vadim Yanitskiy 2915bbf4c5 l1sap: check BTS_FEAT_MULTI_TSC in l1sap_chan_act()
Instead of blindly assuming what the PHY does support, and what
it does not, let's check the related feature vector.

Change-Id: I699cdddbfab111855998853548d9cfe956f7c60c
Related: SYS#4895, OS#4941
2021-04-07 04:54:04 +02:00
Vadim Yanitskiy 1adcc27eb9 l1sap: use TLVP_PRES_LEN() macro in l1sap_chan_act()
Change-Id: I6793623622fd7303d7dc22117a163a6990497c28
Related: SYS#4895, OS#4941
2021-04-07 04:53:27 +02:00
Vadim Yanitskiy 180ddb0da3 l1sap: use the passed 'trx' pointer in l1sap_chan_act()
Change-Id: Id94363f2a22eb905ae01e68ddfdf48fc8c646aaf
Related: SYS#4895, OS#4941
2021-04-07 04:52:38 +02:00
Pau Espin 166b10059b bts-trx: Always submit rx PDTCH DATA.ind to l1sap
Similar to what we have been doing for TCH channels, we want to make
sure all MAC blocks get to the upper layers, even if containing invalid
data (flagging it with data_len=0) so that upper layers (osmo-pcu
through PCUIF in this case) can rely on FN clock without gaps due to
Rx errors.

Related: OS#5020
Change-Id: I343c7a721dab72411edbca816c8864926bc329fb
2021-03-11 17:41:48 +00:00
Pau Espin 6a1a5f988b l1sap: Transmit pdtch invalid MAC blocks to PCU
Similar to what we have been doing for TCH channels, we want to make
sure all MAC blocks get to the upper layers, even if containing invalid
data (flagging it with data_len=0) so that upper layers (osmo-pcu
through PCUIF in this case) can rely on FN clock without gaps due to
Rx errors.

Related: OS#5020
Change-Id: I0b04b013b7bad5ff53d6a969ff0128b37f7f62d5
2021-03-11 17:41:48 +00:00
Philipp Maier 3f3cdff773 l1sap: add logging and VTY introspection for ACCH repetition
At the moment osmo-bts is not looging much ACCH repetition related
information. This makes testing ACCH repetition difficult. Lets add some
debug output that informs the user when ACCH repetition is turned on or
off. Lets also add an ACCH repetition status display to the show lchan
VTY command.

Change-Id: I59d11fd03be3d29fb8a4279d9945b03006764c0e
Related: SYS#5114
2021-03-01 19:47:56 +00:00
Philipp Maier 6940d34ee5 l1sap: Store status of SRR in an lchan struct memeber
The MS sets the SRR bit in the L1 SACCH header to request DL-SACCH
repetition from the BTS. At the moment we access the l1_info stored in
tle lchan struct each time we want to check the status of the SRR bit.
However, it is more convinient to do this once at reception and store
the status of the status of the flag in a separate struct member.

Change-Id: Ieddd45d7890343d64db14b9c726f6fa2f25714f6
Related: SYS#5114
2021-03-01 19:47:56 +00:00
Vadim Yanitskiy 8777b63ef8 ta_control: fix Timing Advance control for SDCCH channels
The check in lchan_ms_ta_ctrl() breaks Timing Advance control on
SDCCH channels, because 'num_ul_meas' wraps and never reaches 4.
Neither this check makes any sense for other channel types,
because lchan_ms_ta_ctrl() is always called in the end of the
measurement period.  Let's drop it.

Change-Id: I0b86d49ec00b38d0f309c56b2519e5d487f0b65b
Fixes: If7ddf74db3abc9b9872abe620a0aeebe3327e70a
Related: OS#5024
2021-02-20 22:46:24 +01:00
Philipp Maier da084794a6 gsm_data: handle l1_info with structs
in struct gsm_lchan and also in other places l1_info is handled in its
binary form. Libosmocore now offers structs to handle l1 info, so lets
use those structs to get rid of all the manual decoding of l1_info.

Depends: libosmocore I23c1890b89d5a0574eb05dace9f64cc59d6f6df7
Change-Id: I5eb516d7849750f3dd174d48c9f07dabf2c80515
2021-02-16 22:28:18 +00:00
Neels Hofmeyr f8f806ff2a GSMTAP: make remote host for Um logging configurable via VTY
So far, the only way to configure GSMTAP Um logging is to use the
cmdline argument '-i'.  Let's deprecate it, and add a VTY command
to allow setting the remote host from configuration file.

The legacy '-i' option, if provided, overrides the configuration
file option, and will also appear in 'write file'.

Change-Id: I17676a21c4e0c9cbc88f2c5c53a39c6c6c473ca1
Tweaked by: Vadim Yanitskiy <vyanitskiy@sysmocom.de>
2021-02-16 17:35:47 +00:00
Philipp Maier db403a4e3e vty: dont put a colon after vty_out in cfg_out macro
The cfg_out macro is used like a function in the code below its
definition. This means a colon will follow after it is used. When
the vty_out call in the macro already has a colon the final result will
be vty_out(...);;. This works fine as long the macro is not used in one
line if/else if/else constructs without curly braces {}. The compiler
will interpret the double colon as two lines of code and run into an
error then. Lets fix this by removing the colon from the vty_cout in the
macro.

Change-Id: I2c23c38ce892067add0f95f3e504a9c559e24519
2021-02-15 17:24:42 +01:00
Philipp Maier b89632cc67 l1sap: fix comment: sapi number is missing
Change-Id: I7922a5da0cd75eddfe019f3f5bd041ad911f1dd2
2021-02-15 11:01:34 +00:00
Vadim Yanitskiy d37041b1ea ta_control: make 'struct bts_ul_meas' parameters const
The only reason why it was not 'const' is that in lchan_new_ul_meas()
we may need to overwrite 'ulm->is_sub'.  This can still be done after
memcpy()ing a new set of samples to the destination buffer.

Change-Id: I0cabf75f8e0bf793c01225a4a8433e994c93f562
Related: OS#5024
2021-02-15 10:58:54 +00:00
Vadim Yanitskiy 7d29ff9345 ta_control: cosmetic: use correct naming for MIN/MAX constraints
Change-Id: I112e0b51df06984e2e3f9b567d6d9897e9f9ba28
2021-02-15 10:58:54 +00:00
Vadim Yanitskiy 6b93f0f366 GSMTAP: move 'struct gsmtap_inst' and masks to 'struct gsm_bts'
Change-Id: I1c5cb8561dfdcbfd1b23ab28cf95aea7a18c7481
2021-02-13 05:15:37 +01:00
Vadim Yanitskiy 9eb37bc3cb GSMTAP: fix wrong naming of per-BTS SAPI commands
Change-Id: Ieb2d74475e4338e9dd5f3962cf14a0448de253f8
2021-02-13 05:11:30 +01:00
Vadim Yanitskiy 58952ac2b4 GSMTAP: move 'gsmtap_sapi_names' from l1sap.c to vty.c
There is no point in having it there, as VTY is the only user.

Change-Id: If919bc1b2d456559ae9ff1ce5dd27d34742ee51c
2021-02-13 04:55:55 +01:00
Vadim Yanitskiy 82aeeacd52 main: cosmetic: tweak deprecation warning messages
Change-Id: I0b87502b1af5b8ef8c235923bf966f0c76062993
2021-02-13 03:43:56 +01:00
Philipp Maier 6664f47ad7 l1sap: be sure that UL-SACCH repetition is turned off
At the beginning of repeated_ul_sacch_active_decision() The UL-SACCH
repetition capability is tested. If no UL-SACCH repetition is enabled
the function exits. However, we should also make sure that the struct
member that enabled UL-SACCH repetition on the lower level is set to
false as well. Normally that should be the case because it was never
set to true before, but it is better to be sure.

Change-Id: I76a841514eb955b93f2114470b2c80402cf6883c
Related: SYS#5114
2021-02-11 23:23:20 +01:00
Philipp Maier 76308ab3fb l1sap.c: be sure that FACCH repetition is turned off
At the beginning of repeated_dl_facch_active_decision() the ACCH
repetition capabilitiy flags (command only or all LAPDM frames) are
tested. If no FACCH repetition is enabled, the function exists. However,
we should also make sure that the struct memeber that enables FACCH
repetition on the lower level is set to false as well. Normally that
should be the case because it was never set to true before, but it is
better to be sure.

Change-Id: Id07091cc89352281b41532d583a8bc004477c71a
Related: SYS#5114
2021-02-11 22:58:34 +01:00
Philipp Maier 2b3aa67a7b l1sap: fix repeated_dl_facch_active_decision()
The function checks meas_res->rxqual_sub against the lower threshold
value in order to decide when to turn FACCH repetition off. This is not
correct. It should compare against rxqual instead.

Change-Id: Id4ab101d52f419583c4f4c8a6cf69af6c9097d25
Related: SYS#5114
2021-02-11 22:49:19 +01:00
Vadim Yanitskiy dabe5d0327 oml: ensure that IPA RSL Connect ACK/NACK contains all IEs
All IEs in the BSC originated message are optional, so we assume
default values for them.  Let's reflect them all in the ACK/NACK.

Change-Id: I5c73e83daad0cea07b9cb674c393e0bfc6268a61
Related: OS#3791
2021-02-10 15:06:54 +00:00
Vadim Yanitskiy 522a33fe82 oml: reuse the given msgb in oml_fom_ack_nack()
This would allow to compose ACK/NACK messages with additional IEs
not present in the original message.  Also, this change basically
eliminates unnecessary msgb_copy() / free().

Change-Id: I17f61636e9a144017e2c46b1540d152c21529391
Related: OS#3791
2021-02-10 15:06:54 +00:00
Vadim Yanitskiy b1485cd590 power_control: implement handling of P_Con_INTERVAL parameter
Change-Id: Ibf9956b2c6d829b38e9fda7d1f29790036219f42
Related: SYS#4918
2021-02-07 23:08:57 +01:00
Vadim Yanitskiy 6b36cce2ea power_control: cosmetic: fix swapped {L,U}_RXQUAL_XX_P comments
Change-Id: I2fe198f9275f4e5407ad6fdfa68d4fa7d603e333
Related: SYS#4918
2021-02-07 23:03:04 +01:00
Vadim Yanitskiy bb04495251 oml: use regular TLVP_PRES() in rx_oml_ipa_rsl_connect()
Both NM_ATT_IPACC_DST_IP and NM_ATT_IPACC_DST_IP_PORT are defined
as TLV_TYPE_FIXED, and NM_ATT_IPACC_STREAM_ID is TLV_TYPE_TV, so
the TLV parser already does check the length for us.

Change-Id: I1e493e552bb22bb42bb196ce71214e28d23fd19e
2021-02-07 03:40:32 +00:00
Vadim Yanitskiy 187effa00d oml: make 'struct tlv_parsed' pointer const where possible
Change-Id: I077f5aba50cc4d1a86feff527784de07394c5c0a
2021-02-07 03:39:53 +00:00
Vadim Yanitskiy fe45b4eb1f oml: avoid redundant ntohl() / htonl() conversion
Change-Id: I2ae84dcd2987ff0cee5ca06ced06e65a30847a81
2021-02-07 03:39:53 +00:00
Vadim Yanitskiy a2da0e96e1 vty: register libosmocore's FSM introspection commands
Change-Id: I1eb203673259b455c339784719e288bac14145c0
2021-02-06 16:50:44 +00:00
Vadim Yanitskiy f7afeb1fa9 oml: cosmetic code style changes in rx_oml_ipa_rsl_connect()
Change-Id: I2841e15865596bbb24cfe1f27691404514d3b6f0
2021-02-06 15:14:05 +01:00
Philipp Maier ed7bca6b33 pcu_sock: fix uninitalized returncode value
In function pcu_tx_si_all(), the variable rc is not initalized. If
pcu_tx_si() fails, then rc is populated with value -EINVAL, but if all
si transmissions succeed, which is the normal case, rc remains
uninitalized.

Change-Id: I571fdb4f175fb259b77f989554f569fc2230dfe6
Related: CID#216932
2021-02-04 14:08:42 +00:00
Vadim Yanitskiy f7c7d2baf6 pcu_sock: pcu_tx_si_all(): fix returning ununitialized rc
Change-Id: Ic78614bebade701db14439aa64ecf89c7104a639
Fixes: CID#216932
2021-02-04 13:40:24 +01:00
Vadim Yanitskiy df80385f26 pcu_sock: pcu_tx_si_all(): cosmetic coding style change
Change-Id: I11f60ecdd3cfa2132d58fd3034bfe7419df0edb6
2021-02-04 12:50:19 +01:00
Vadim Yanitskiy ac38cf8e90 pcu_sock: pcu_tx_si_all(): make 'si_types' const
Change-Id: I0a6b0191187af2e14c9264c571afe53fc256d8ce
2021-02-04 12:49:17 +01:00
Harald Welte 6eb98ab25c Use osmo_fd_*_{disable,enable}
Depends: libosmocore.git Idb89ba7bc7c129a6304a76900d17f47daf54d17d
Change-Id: I0da17d851ccb83c28a70c9039d0a4d1fe63da0ec
2021-02-03 10:41:16 +01:00
Philipp Maier 98c7b44f8d pcu_sock: send SI1, SI3 and SI13 via PCUIF
This patch PCUIF extends the SAPI 4 that is used
to transfer SI13 only, so that it can transfer SI1 and SI3 as well.

The system information SI1, SI3 and SI13 is needed by the NACC RIM
application which runs inside osmo-pcu.

Depends: osmo-pcu I5138ab183793e7eee4dc494318d984e9f1f56932
Change-Id: Ib7aeb41e634ad6fcab3766a4667b0267c749436a
Related: SYS#5103
2021-02-03 08:26:25 +00:00
Oliver Smith 23ff5f8861 common/measurement.c: fix gcc 4 + -std=gnu11 error
GCC-4 doesn't like static const struct foo bar = (struct foo)...:
  measurement.c:33:1: error: initializer element is not constant

Related: OS#5004
Change-Id: Iec5a4006dfc90abe240fcf8b6c2fefd4f7071a70
2021-02-02 13:33:04 +01:00
Neels Hofmeyr 10272f7702 chan activ: activate DL SACCH only when TA is known
A channel activation for handover to another cell does not know the
Timing Advance until the handover RACH is received. It does not make
much sense to enable downlink SACCH without an accurate TA.

If the BSC omits the Access Delay IE (a.k.a. the Timing Advance), do not
enable downlink SACCH. This is expected to happen only for inter-cell
handover. In all other situations, the TA should be known either from a
Channel Request RACH for Immediate Assignment, or from the previous
lchan on the same cell upon Assignment / intra-cell handover.

Related: OS#4008 OS#4009 SYS#5192
Change-Id: I170b63c9856230d5f1a10654a9d950ada8e730d7
2021-01-28 23:57:10 +01:00
Vadim Yanitskiy f7cf5e2612 power_control: clarify the meaning of 'delta' in logging messages
One part of the algorithm simply provides a _suggested_ 'delta' that
needs to be applied to the current power level, while the other part
ensures that this suggested value does not exceed the limits.  Thus
it's possible that some logging messages would state that the power
reduction value remains unchanged, while the 'detla' != 0.

Change-Id: I7496a158b9ac6074a965056d708d8078a98cb1aa
Related: SYS#4918
2021-01-24 16:21:32 +01:00
Vadim Yanitskiy a81dfdb096 l1sap: include Uplink RSSI in GSMTAP packets
Change-Id: I99a257c0320b08b62270a35796bee7f8e862e3ab
Related: SYS#5073
2021-01-23 17:32:56 +01:00
Vadim Yanitskiy 3992249c64 l1sap: fix gsmtap_ph_{data,pdch,rach}(): use 'const'
Change-Id: If353ba78b59af2b0a62bbd0c812a46990b07776f
2021-01-23 17:30:00 +01:00
Vadim Yanitskiy dc61d6032b vty: add expert commands for MS/BS power control
These new commands are useful for debugging MS/BS power control
loops, e.g. one can change power control mode, overwrite the
current BS power reduction or MS power level at run-time.

Change-Id: I1ebb033b02c2bc3b1fa7de874e0035a07297f266
Related: SYS#4918
2021-01-20 23:54:54 +01:00
Vadim Yanitskiy f416e5a01c vty: make commands related to the loopback mode hidden
The loopback mode was added for testing, and may be dangerous if
enabled in production.  Let's make it appear only in expert mode.

Change-Id: I3f68acd7f2b0231f78516f59fb5e8ef56fb69dbf
2021-01-20 23:54:05 +01:00
Vadim Yanitskiy 510a47818a vty: extend trx / lchan number range in BTS_T_T_L_CMD
Change-Id: I8d8a4c46909daa0f2682d9662db8dffb4fbd8422
2021-01-20 22:06:08 +00:00
Vadim Yanitskiy 66637c68ae vty: add macro for 'bts <0-0> trx <0-0> ts <0-7> lchan <0-1>'
Change-Id: If8e1ee87366a0d301e21161f2d9ddde8383cb744
2021-01-20 22:06:08 +00:00
Vadim Yanitskiy 2627c28188 vty: fix error messages in lchan specific commands
Change-Id: Ic0fba0605fc8a3ffa044f65fdad03b95e7cd8331
2021-01-20 22:06:08 +00:00
Vadim Yanitskiy 66f76223c4 power_control: fix: properly print 'delta' applied to attenuation
Change-Id: I178df05c1a4cb982279b21d07bd69f75b44928da
Related: SYS#4918
2021-01-20 22:04:55 +00:00
Vadim Yanitskiy 3e1dad2a37 power_control: print current RxLev and lower/upper thresholds
This makes the logging messages easier to read and understand.

Change-Id: I5f8c987054b2b01acdb9f525d06ca15bbc577070
Related: SYS#4918
2021-01-20 22:04:55 +00:00
Vadim Yanitskiy bb6765a93c paging: refactor and optimize fill_paging_type_1()
As far as I can see from my perf measurements, bitvec_fill() is called
quite often and takes 0.27% of the CPU.  A more detailed look reveals
that it's indirectly called by fill_paging_type_1() in order to fill
the remaining octets with constant '2B'O padding.

Let's optimize this function:

  - use memset() for padding *before* writing optional P1 Rest Octets;
  - conditionally initialize the bit vector for P1 Rest Octets;
  - use designated initializers instead of memset().

It's generally better to avoid using bitvec_fill() when using memset()
is possible, because the former operates on bits rather than bytes.

Change-Id: I90473356b396e5dd9326598aca025afacca4afc8
2021-01-15 17:36:46 +01:00
Vadim Yanitskiy cd30a40be1 power_control: BS power shall not be reduced on C0
It does not make sense to trigger the BS power control loop on C0,
as it's only allowed to reduce power on additional transceivers.

Change-Id: I4fdfe097ae6f9edde5f39ed4da8a559a14b3b38f
Related: SYS#4918
2021-01-13 09:52:58 +00:00
Philipp Maier 25b11f473a l1sap: use rxlev_full when no DTX was used
At the moment only rxlev_sub is used to decide when the facch repetition
should be activated, regardless if DTX is used. Lets check if DTX is
actually used and use rxlev_full when DTX is not applied.

Change-Id: I01ba57cf661f0e41b8df209c905f8d135013e472
Related: SYS#5114
2021-01-13 00:32:26 +01:00
Philipp Maier b327c9598c l1sap: acch_repetition fix hysthereis threshold table
The table in repeated_ul_sacch_active_decision() is derived from the
second table in GSM 05.08 8.2.4 but the first table would be correct.
Also the lower threshold is not properly choosen. A lower threshold,
that derives from upper threshold shifted by 2 makes sense (BER must
improved by 2 RXQUAL steps before repetition is turned off.)

Change-Id: I1d9b5c8abb79938cdecdafed84ed2e5d47e0bd3a
Related: SYS#5114
2021-01-12 22:35:56 +01:00
Vadim Yanitskiy ef53ffe8bb power_control: rework handling of DL RxQual measurements
This change makes BS power control loop:

  - take the lower RxQual threshold (L_RXQUAL_XX_P) into account, so
    the BS power is increased only if RxQual exceeds this threshold;

  - apply the configured increase step size instead of reducing the
    current attenuation by half.

MS power loop is not affected, it does not even handle RxQual yet.

Change-Id: Ib3c740b9a0f3ba5dfb027e144dc13f456cb26ae2
Related: SYS#4918
2021-01-08 20:14:00 +01:00
Vadim Yanitskiy ef99e36626 power_control: use more reasonable reduce step size
It makes more sense to use a reduce step size that is smaller than
the increase step size.  This way both MS/BS power control loops
would be able to react quickly of the signal gets weaker, while
the good signal would not trigger radical power reduction.

Change-Id: Ie358fd828a68bfa1d23559197e8df8478fb4535e
Related: SYS#4918
2021-01-08 19:42:22 +01:00
Vadim Yanitskiy e920902e25 power_control: properly track the first initial state
Change-Id: I16e7474b5affbd90855a2e407b305e9dec581dfa
Related: SYS#4918, SYS#4917
2021-01-08 02:30:46 +01:00
Vadim Yanitskiy 834ba05cd2 power_control: generalize measurement pre-processing state
This way EWMA based filtering can also be applied to RxQual.

Change-Id: I439c00b394da670e314f217b3246cc85ce8213c6
Related: SYS#4918, SYS#4917
2021-01-08 02:23:56 +01:00
Vadim Yanitskiy e8f857453d power_control: migrate MS/BS control loops to the new params
In change [1] the new power control structures and default params
were introduced.  In change [2], the existing VTY commands for MS
power control in the BTS were deprecated and changed to use the
new structures as storage.  Finally, in change [3], handling of
the power control parameters on the A-bis/RSL was implemented.

This change is the final logical step in the mentioned chain: it
makes both MS/BS power control loops use the new parameters, and
removes the old structures.  The actual implementation of both
power control loops remains the same, however the expected output
of some unit tests for the Downlink loop needs to be changed:

  - TC_fixed_mode: disabling dynamic power control becomes a separate
    step of the test script since the field 'fixed' is removed;

  - TC_rxlev_target: RxLev thresholds are printed 'as-is'.

Not all of the new parameters are used by the power control loops
yet.  Further improvements to be done in the follow up commits.

[1] I6d41eb238aa6d4f5b77596c5477c2ecbe86de2a8
[2] Icbd9a7d31ce6723294130a31a179a002fccb4612
[3] I5a901eca5a78a0335a6954064e602e65cda85390

Change-Id: Ib18f84c40227841d95a36063a6789bf63054fc2e
Related: SYS#4918
2021-01-08 02:05:27 +01:00
Vadim Yanitskiy 4a0a6fd014 vty: add a command to show GPRS related info
Here is a sample output:

  OsmoBTS# show bts 0 gprs
  BTS 0, RAC 0, NSEI 101, BVCI 2
    Cell NM state: Oper 'Enabled', Admin 'Unlocked', Avail 'OK'
    NSE NM state: Oper 'Enabled', Admin 'Unlocked', Avail 'OK'
    NSVC0 (NSVCI 101) NM state: Oper 'Enabled', Admin 'Unlocked', Avail 'OK'
      Address: r=127.0.0.1:23010<->l=0.0.0.0:55385
    NSVC1 (NSVCI 0) NM state: Oper 'Disabled', Admin 'Locked', Avail 'Off line'

This command is useful for debugging NS connection problems.

Change-Id: I149eea0b1c109020406eb67c9082c335a77aab06
2021-01-07 13:58:21 +01:00
Vadim Yanitskiy 9238c3549d power_control: handle MS/BS Power control params on A-bis/RSL
Change-Id: I5a901eca5a78a0335a6954064e602e65cda85390
Depends: I2f4ed56837dd479dbbd10c0a7df0ed7565d3946a
Related: SYS#4918
2021-01-07 00:38:55 +00:00
Vadim Yanitskiy f0089a8495 power_control: vty: deprecate 'uplink-power-control' commands
MS/BS Power Control parameters have been recently moved to the BSC
and now signaled to the BTS over the A-bis/RSL link.  Let's make
sure that the existing VTY commands for Uplink Power Control do:

  - trigger deprecation warnings if present in the config file,
  - not show up in the online VTY help nor VTY reference,
  - affect the fall-back parameters in 'struct gsm_bts',
  - still get printed by 'show running-config' command.

Change-Id: Icbd9a7d31ce6723294130a31a179a002fccb4612
Related: SYS#4918
2021-01-07 00:38:55 +00:00
Vadim Yanitskiy 7a8c9dbad7 power_control: vty: re-use cfg_bts_ul_power_target()
This reduces code duplication by defining an alias.

Change-Id: I37f51d426fcf008c9d9e933827de70ab7b072a94
Related: SYS#4918
2021-01-07 00:38:55 +00:00
Vadim Yanitskiy 9b6c149e42 sysinfo: fix less-than-zero comparison of an unsigned value
size_t is an unsigned type, while get_si4_ro_offset() returns int.

Change-Id: I3b216b70fbcc653ced734835ccb2c7f1932d9f0a
Fixes: CID#215888
2021-01-05 14:12:06 +00:00
Vadim Yanitskiy e476629bcf l1sap: fix: enable UL SACCH repetition if RxQual threshold is 0
It is expected that setting RxQual threshold to 0 would make the
L1SAP logic enable repetition for both Uplink SACCH and Downlink
FACCH unconditionally.  However, this was only valid for the
later.  Let's add the missing check and make it consistent.

Change-Id: Ia44a134e7f28ea990798d1b79c87b644504c0876
Related: SYS#5114
2021-01-05 12:21:23 +01:00
Vadim Yanitskiy 763ce0627a power_control: add VTY introspection commands for MS/BS params
Change-Id: I34095673bf49deb390d5e8383c4ee05a6915b82f
Related: SYS#4918
2021-01-04 21:49:21 +00: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
Harald Welte ecf4879403 fix-up missed review comment in CBCH SI4 patching fix
This is a follow-up fix for I0ee0cf736e2fb74a6759a68101f699b4ec2ef54e

get_si4_ro_offset() itself already checks if it's less than GSM_MACBLOCK_LEN,
so we must check if it's not negative.

Change-Id: Iba99e5de625af6bed6720a38fec26c2acc6251c0
2021-01-03 10:28:55 +01:00
Harald Welte 129cb51597 sysinfo.c: Fix SI4 GPRS patching which overwrote CBCH IE
In Change-Id I1fd513ea03297918d15d4b28ed454f9b6dd6ebfa we introduced
patching of SI4 to indicate GPRS presence in terms of PCU connection
status.  Unfortauntely this didn't account for optional IEs being
present in SI4, and hence overwrote any CBCH related information
elements, if present.

This in turn meant that since the above-mentioned commit, you could
have either a GPRS-capable, network, or a Cell Broadcast capable one.

Change-Id: I0ee0cf736e2fb74a6759a68101f699b4ec2ef54e
Related: OS#3075
2021-01-03 00:46:16 +01:00
Vadim Yanitskiy f158bb614c rsl: remove redundant boolean flag in rsl_rx_chan_activ()
Checking if a given RSL IE is present is a straightforward task,
so there is no need for a special boolean flag.

Change-Id: I6a12930314c79b9c3efabfa575b17f78105fea4c
2020-12-30 18:33:40 +01:00
Vadim Yanitskiy 538c56ef34 vty: fix dump_lchan_trx_ts(): dump dedicated channels only
It does not make sense to dump CCCH/CBCH as dedicated channels:

  OsmoBTS# show lchan
  BTS 0, TRX 0, Timeslot 0, Lchan 4: Type CCCH
    State: ACTIVE
    BS (Downlink) Power Control (autonomous):
      Channel reduction: 0 dB (max 0 dB)
      TRX reduction: 0 dB
      Actual / Nominal power: 13 dBm / 13 dBm
    MS (Uplink) Power Control (autonomous):
      Current power level: 0, -39 dBm (max 0, -39 dBm)
    Channel Mode / Codec: SIGNALLING
    LAPDm SAPIs: DCCH --, SACCH --
    Valid System Information: 0x00000060
    MS Timing Offset: 0, propagation delay: 0 symbols
    Radio Link Failure Counter 'S': 0

so let's only dump SDCCH, TCH/F, and TCH/H.

Change-Id: Id7880de56a93cc9fa4ca576b094cef35ee269822
2020-12-10 15:27:37 +00:00
Neels Hofmeyr 7233fa8623 log: rsl_rx_chan_activ: show chan type as human readable string
Change-Id: I3acf6c18309d3b4093dbc295be622363cb6dbcdc
2020-12-10 15:23:42 +00:00
Vadim Yanitskiy 6904d7dd5d vty: resurrect per-lchan BS/MS Power Control information
Change-Id: I48812383ef0a125e83b9b3761f3f15873d3b37b4
Related: SYS#4918
2020-12-09 21:39:52 +00:00
Vadim Yanitskiy 675618b4f8 power_control: make raise/lower step limitation configurable
Change-Id: Ic37742f46f533865043b3dbcf16ea702e1746f98
Related: SYS#4918
2020-12-09 21:39:52 +00:00
Pau Espin Pedrol 2b416d6d2b nm_channel_fsm: Fix several FSM internal transitions not being made
During the initial implementation I used the wrong function to change
state. As a result, from BSC point of view the BTS was changing state
but the FSM internally was not. "Fortunately", while in state Dependency
the BTS still could cope with that in order to still be operative with
older osmo-bsc, so there was no major breakage, only some error log
message being printed.

Related: OS#4873
Change-Id: Ifd2eefc362fca0aa9e6ae102c7e6dbc1b4f295d6
2020-12-09 14:04:19 +01:00
Vadim Yanitskiy 75162427ad rsl: properly initialize MS/BS Power Control state
struct lchan_power_ctrl_state actually contains more fields,
which also must be initialized on CHANnel ACTIVation.

Change-Id: Id9719088fc6e9479c13e9b327a3466d9e2810a3a
Related: SYS#4918
2020-12-08 13:10:46 +01:00
Vadim Yanitskiy 237ec6194b power_control: clarify units in 'struct bts_power_ctrl_params'
Change-Id: Icb059ca1f555397be116a424800e4536883b9106
Related: SYS#4918
2020-12-06 18:59:05 +01:00
Vadim Yanitskiy 63c1838c7a power_control: cosmetic: fix weird spacing
Change-Id: Ia5661e82372f958e7cda4041d7b5a1cfb1d64afe
2020-12-06 18:58:11 +01:00
Vadim Yanitskiy 0698c58ebe power_control: implement BS (Downlink) Power Control
We already have MS Power Control, which according to 3GPP 45.008
shall be implemented in the MS to minimize the transmit power in
the Uplink direction.  The BS Power Control may optionally be
implemented by the network side for the same purpose.

Using Downlink signal measurements reported by the MS, the BSS
(either BSC, or BTS) may control Downlink attenuation in a way
that the transmit power remains as low as possible, or remains
in a specific range corresponding to good RxLev values on the
MS side.  This change implements autonomous BS Power Control,
that can optionally be enabled by the BSC.

BS Power Control re-uses parts of the MS Power Control code,
so all parameters can be configured in the same way - via the
VTY interface or a configuration file.  This basically means
that features like hysteresis and EWMA based filtering are
also available for BS Power Control.

The only difference is that RxQual values higher than 0 would
trigger the logic to reduce the current attenuation twice.

Note that one of the unit tests ('TC_rxlev_max_min') fails,
as the power step limitations for raising and lowering look
wrong to me, and the related discussion is still ongoing.

Change-Id: I5b509e71d5f668b6b8b2abf8053c27f2a7c78451
Related: SYS#4918
2020-12-06 18:57:43 +01:00
Vadim Yanitskiy 0ced8dd03e power_control: derive calc_delta() from lchan_ms_pwr_ctrl()
This function will also be used by the BS Power Control logic.

Change-Id: I2525eb2c3f1fdb3d0847a8ad50b30a44d7741a55
Related: SYS#4918
2020-12-04 09:27:48 +01:00
Vadim Yanitskiy 2f53fae01f power_control: do not log averaged RSSI values as 'rx-current'
Similar to I3c07cb6e14acd5a988761bbc51a9c3b60fb22d87, this change
is another step towards separating the common delta calculation
logic from lchan_ms_pwr_ctrl(), since this function will loose
access to the averaged values.

On the one hand, the affected logging statements are getting
less precise; on the other, logging the averaged value as the
actual value ('rx-current') may be even more confusing.

Change-Id: I07007e45c859b4080fbbe520ffb5ccc0bb9c4244
Related: SYS#4918
2020-12-04 09:27:48 +01:00
Vadim Yanitskiy 567ea2a079 power_control: remove a logging statement and early return
This change would allow to separate the common logic from
lchan_ms_pwr_ctrl() and re-use it for Downlink power control.

The logging statement was quite useful during early stages
of development and testing of hysteresis and filtering,
but now we can sacrifice it.

Change-Id: I3c07cb6e14acd5a988761bbc51a9c3b60fb22d87
Related: SYS#4918
2020-12-04 09:27:48 +01:00
Vadim Yanitskiy 2b59a625e8 power_control: lchan_ms_pwr_ctrl(): make use of params/state pointers
Change-Id: I177d82cd61d59256976007fed2f7da400b814789
Related: SYS#4918
2020-12-04 09:27:48 +01:00
Vadim Yanitskiy 08f3eafd02 power_control: generalize and rename lchan_ul_pf_ewma()
This way EWMA based filtering logic can be used not only for
MS Power Control, but also for BS Power Control.

Change-Id: I16c2e1b997f2b8af44d47809420293f072335bbd
Related: SYS#4918
2020-12-04 09:27:48 +01:00
Vadim Yanitskiy f15c44df52 power_control: lchan_ms_pwr_ctrl(): use existing 'trx' pointer
Change-Id: Idf46e47f20f031ff9dded1be1e6c4337d7b423e7
Related: SYS#4918
2020-12-04 09:27:48 +01:00
Vadim Yanitskiy 0e24ace2f1 power_control: lchan_ul_pf_ewma(): do not use lchan->meas.res_nr
This would allow to pass only two pointers:

  - 'struct bts_power_ctrl_params', and
  - 'struct lchan_power_ctrl_state',

and get rid of 'struct gsm_lchan' dependency.  The later is
exactly where all state variables are supposed to be kept.

Change-Id: Idfefca30f4944bc722b4e9d8f1685eb77670a9db
Related: SYS#4918
2020-12-04 09:27:48 +01:00
Vadim Yanitskiy 9381576e18 power_control: generalize power control state structure
Change-Id: I8c6ad8d14349e8a05084c2912644c5202f951f52
Related: SYS#4918
2020-12-04 09:27:48 +01:00
Vadim Yanitskiy 3b1e66af9e l1sap: make sure that UL SACCH is always 23 octets long
Change-Id: I1c8a43337fbc1acfab3c0f0713c75ded95d69512
Related: SYS#4918
2020-12-02 15:01:10 +01:00
Vadim Yanitskiy 369c852022 bts: add Downlink power control parameters
Change-Id: I724f661e9ce5dd75f95fb7b270a89b2e2a73c951
Related: SYS#4918
2020-12-02 13:56:49 +00:00
Vadim Yanitskiy ca9ab523e1 bts: rename MS_UL_PF_ALGO_{NONE,EWMA} to BTS_PF_ALGO_{NONE,EWMA}
Change-Id: I580512eea1d329a4d25ccbd6fc2ab98b083ec51d
Related: SYS#4918
2020-12-02 13:56:49 +00:00
Vadim Yanitskiy af4eec056e struct gsm_bts: move ul_power_{target,hysteresis} to ul_power_ctrl
Change-Id: I3886c7aedf3870536f1750f864cf698302ddf2df
Related: SYS#4918
2020-12-02 13:56:49 +00:00
Philipp Maier 7c87612b42 l1sap: add repeated uplink SACCH
3GPP TS 44.006, section 11 describes a method how the uplink
SACCH transmission can be repeated to increase transmission
reliability.

Change-Id: I7e4cc33cc010866e41e3b594351a7f7bf93e08ac
Related: OS#4795, SYS#5114
2020-11-28 22:35:12 +01:00
Philipp Maier a36d6832a1 l1sap: add repeated downlink SACCH
3GPP TS 44.006, section 11 describes a method how the downlink
SACCH transmission can be repeated to increase transmission
reliability.

Change-Id: I00806f936b15fbaf6a4e7bbd61f3bec262cdbb28
Related: OS#4794, SYS#5114
2020-11-27 16:02:45 +01:00
Philipp Maier 7e38cf4e66 l1sap: also include SRR bit in RSL l1 info field.
The SRR bit, which got specified in 3gpp release 6 to support repeated
ACCH capability is not yet included in the L1 Information IE on RSL
level. Also lets update the spec reference to more modern 3gpp spec ref
numbers.

Change-Id: I987c61608b737521ba36756dabf2f6215b34c2d6
Related: OS#4796 SYS#5114
2020-11-27 16:02:45 +01:00
Philipp Maier 33dfe2bcec l1sap: add repeated downlink FACCH
3GPP TS 44.006, section 10 describes a method how the downlink
FACCH transmission can be repeated to increase transmission
reliability.

Change-Id: I72f0cf7eaaef9f80fc35e752c90ae0e2d24d0c75
Depends: libosmocore I6dda239e9cd7033297bed1deb5eb1d9f87b8433f
Related: OS#4796 SYS#5114
2020-11-27 16:02:45 +01:00
Neels Hofmeyr 6158525433 part 3 of: fix SAPIs for handover, osmo-bts-trx
Change-Id: I0b34855f0374e9ee7071ce14c1472eb3ead50970
2020-11-26 09:22:38 +00:00
Neels Hofmeyr f733cf8263 part 1 of: fix SAPIs for handover to match 48.058 4.1.{3,4}
This part adds the common lchan flags to indicate whether DL SACCH
should be activated.

Note that currently, osmo-bsc *always* sends the MS Power IE as well as
the TA IE, also for inter-cell HO, so in the osmoverse, nothing will
change until we also adjust osmo-bsc. See OS#4858.

Change-Id: Ibea973ccadf5d424213f141f97a61395856b76de
2020-11-26 09:22:38 +00:00
Pau Espin 48ffeb8139 common: generate coredump and exit upon SIGABRT received
Previous code relied on abort() switching sigaction to SIG_FDL +
retriggering SIGABRT in case the signal handler returns, which would
then generate the coredump + terminate the process.
However, if a SIGABRT is received from somewhere else (kill -SIGABRT),
then the process would print the talloc report and continue running,
which is not desired.

Change-Id: Ic3b7c223046a80b51f0bd70ef1b15e12e6487ad0
Fixes: OS#4865
2020-11-25 19:03:35 +01:00
Pau Espin 251fc3c06c common: Enable SIGABRT signal handler
The signal handler function was coded to expect SIGABRT but the signal
handler itself was never enabled for this signal.

Change-Id: Id95d64efe8765fcf19eb09cd3db7895166c6adab
2020-11-25 19:02:55 +01:00
Philipp Maier 2edf5cf47f l1sap: pre-initalize pointer with NULL to avoid gcc warning
Change-Id: Ibfd18ed5268740cc73fffdb950b96c7f0fad3164
2020-11-19 17:32:16 +01:00
Vadim Yanitskiy 44d25af9cd main: do not print asciiart to stdout, use stderr instead
Otherwise it ends up in the generated XML VTY reference:

  $ head doc/manuals/vty/bts_trx_vty_reference.xml
    ((*))
      |
     / \ OsmoBTS
    <vtydoc xmlns='urn:osmocom:xml:libosmocore:vty:doc:1.0'>
      <node id='_common_cmds_'>
        <name>Common Commands</name>

Also, take a chance to move it below handle_options(), so it
will only be printed if all arguments are parsed successfully.

Change-Id: I5c35f36fdd2a8a80bd501b996f0b161c388d3510
Related: SYS#4937, OS#3036
2020-11-04 19:33:57 +00:00
Vadim Yanitskiy 5c7b709027 vty: call bts_model_vty_init() from bts_vty_init()
Similar to bts_vty_init(), BTS specific bts_model_vty_init()
requires a pointer to 'struct gsm_bts'.  Not only it's used
as a parent talloc context, but also stored locally, so then
it can be used by some VTY commands.

Let's expose the global 'struct gsm_bts' from main, and pass
the application's talloc context like was done in [1].

This finally makes the BTS model specific options appear in
the automatically generated VTY reference (--vty-ref-xml).

[1] Ic356a950da85de02c82e9882a5fbadaaa6929680

Change-Id: Iee7fee6747dd1e7c0af36f9b27326f651ae37aaf
Related: SYS#4937, OS#3036
2020-11-02 18:08:24 +00:00
Philipp Maier 484952a3e5 measurement.c: fix integer overflow problem
The variables num_meas_sub_expect - num_meas_sub must not be subtracted
without prior checking. Depending on the input (which might be
errornous), num_meas_sub might be greater then num_meas_sub_expect. This
eventually leads into odd behavior, which can be difficult to debug.

Change-Id: I381cc637d1c125f279ccf88db114609946fe24fe
Related: OS#4799
2020-11-02 15:46:10 +01:00
Vadim Yanitskiy 90e01e47cb vty: fix missing / wrong documentation for some commands
Change-Id: Ie2f9e401c0f8f55307d98fa5afe5eb4182add43a
Related: SYS#4937, OS#3036
2020-11-02 12:34:54 +00:00
Vadim Yanitskiy 9076b3947b vty: fix double '%' in description of some commands
Command description is not a format string => no need to escape.

Change-Id: Ib2e339efccec1fc5416ab4b9460a27fa1f8e8044
2020-11-02 12:33:42 +00:00
Vadim Yanitskiy fa3e22bc17 main: move general options from bts_vty_init()
These are not BTS specific options, so register them in main().

Change-Id: Ib6be66537791d489cb709d4d653c4cb434896f77
Related: SYS#4937, OS#3036
2020-11-02 11:17:05 +00:00
Vadim Yanitskiy a72a0765a4 main: register VTY commands before handle_options()
Otherwise only those commands that are registered by libosmocore
appear in the generated XML VTY reference - change the order.

Instead of a pointer to 'struct gsm_bts', pass the application's
talloc context, as it's only used for dynamic command allocation.

Change-Id: Ic356a950da85de02c82e9882a5fbadaaa6929680
Related: SYS#4937, OS#3036
2020-11-02 11:16:59 +00:00
Philipp Maier 07aa8927e1 measurement: fix expected number of measurements
The logic in measurement.c checks the amount of collected measurement
values. This is done for the total amount of measurements and the amount
of SUB blocks measurements.

The functions that return the expected number of measurement values
currently do not take into account that the mode of a TCH/F or TCH/H has
an effect on the number of expected SUB blocks. (In signalling channels
all blocks count as SUB). Also a TCH/H in signalling mode generates only
half the amount of measurements because the blocks in signalling mode
are sepreded over 6 bursts instead of 4. This also needs to be taken
into account.

Change-Id: I01c7b6cc908c647263ab88f6b6281c4732f88779
Related: OS#4799
2020-10-26 17:53:57 +01:00
Philipp Maier 79294134dd measurement: count all blocks as SUB for TCH/F in signalling mode
SUB frames exist only in voice (or CSD) channels. When a TCH/F is in
signalling mode, all blocks must be counted as SUB blocks. (for TCH/H
the current implementation is correct.)

Change-Id: I04be21200afa1d03afa0d7e476c66fa79cf42249
Related: OS#4799
2020-10-26 15:11:27 +01:00
Vadim Yanitskiy 1325443dc3 main: add --vty-ref-mode, use vty_dump_xml_ref_mode()
Change-Id: I744520199ef448ff095d0fe703d79ac08f08f7fe
Depends: Ie2022a7f9e167e5ceacf15350c037dd43768ff40
Related: SYS#4910
2020-10-24 05:08:49 +07:00
Vadim Yanitskiy 0b6e568d05 main: increase spacing between commands and description
Otherwise it's hard to fit new options with long names.

Change-Id: If9a418545abff6d22602ba07cfd4447f5ace7742
Related: SYS#4910
2020-10-24 05:00:33 +07:00
Vadim Yanitskiy c3a293fde1 main: do not print deprecated '-r' / '--realtime' in help
Change-Id: I516a71124a49f6d6adb6db939a91da07576e63e7
2020-10-24 04:42:53 +07:00
Philipp Maier 5f95a16ec1 cosmetic: add missing semicolon after OSMO_ASSERT()
Change-Id: Ib886115418939990ecfb6ecc1a4528f7a015b913
2020-10-23 21:46:35 +02:00
Pau Espin 4d7c6ad860 oml: Set NM_OPSTATE_DISABLED by default
Otherwise, some objects are announced at startup of osmo-bts towards BSC
during State Changed Report as being "NULL".

According to TS 12.21:
"NULL(Operat. state not supported) FF"

Which doesn't make much sense in startup situation. They are in known
state Disabled until they are OPSTARTed.

Change-Id: I5ba6756ea069d0f995f453ee4b27e6839c914eb1
2020-10-21 18:32:08 +02: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
Vadim Yanitskiy 6e27523d11 power_control: fix default EWMA smoothing coefficient (80% -> 50%)
80% (alpha=0.2) is clearly too much, let's use 50% (alpha=0.5).

Change-Id: Ib7aec6c7223ffb2d4a312eee77247925beb8c905
Fixes: Ib6dcadbf14ef59696c6a546bd323bda92d399f17
Related: SYS#4916
2020-10-20 22:42:24 +07: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 ae6e3e8f8b Introduce NM BTS FSM
Change-Id: Iae631bcc7acdf955296b124707e42d5e565af186
2020-10-20 13:45:57 +00:00
Pau Espin 88fe4b079d Introduce NM BTS Site Manager FSM
This fixes old behavior mimicing broken behavior in nanoBTS (according to TS 12.21)
where BTS Site Mgr NM object was announced as Enabled despite no OPSTART
was sent by the BSC.
With this new FSM, BTS SiteManager will be announced as Disabled Offline
during OML startup conversation, instead of Enabled.

The new osmo-bsc OML management FSMs use this change in behavior to find
out whether it should use the old broken management states (without
Offline state, as per nanoBTS) or use the new state transitions (which
allow fixing several race conditions).

Change-Id: Iab2d17c45c9642860cd2d5d523c1baae24502243
2020-10-20 13:45:57 +00:00
Harald Welte 629824ac14 use osmo_fd_setup() everywhere
Change-Id: I9be55f791a15fae2362dc431dc778b9b9d8db349
2020-10-19 15:06:08 +00:00
Vadim Yanitskiy 1b5b629624 scheduler: remove pending Tx prims on lchan deactivation
Sometimes the following messages appear in the logging output:

  TCH/F: Prim has wrong chan_nr=0xc5 link_id=00, expecting chan_nr=0x0d link_id=00
  TCH/F: Prim has wrong chan_nr=0xc2 link_id=00, expecting chan_nr=0x0a link_id=00

when a dynamic timeslot is switched from PDCH to TCH/F (or to TCH/H).

This means that the transmit queue of a timeslot still contains
PDCH frames, that were not properly cleaned on PDCH deactivation.

Let's finally do this in trx_sched_set_lchan().

Change-Id: Ic6560c660c658f36b84e7efa2f1d93e3a870962b
Related: SYS#5108, OS#4804
2020-10-19 15:04:22 +00:00
Vadim Yanitskiy debfbb6965 scheduler: join conditions in trx_sched_set_lchan()
Change-Id: If2b68e3c7bf01badaaa4666198a4a4c5709f0040
2020-10-19 15:04:22 +00:00
Vadim Yanitskiy 4cc38b8a72 scheduler: treat subsequent lchan (de)activation as error
Trying to (de)activate logical channels that are already (de)activated
is not something that we normally expect.  Treat this as error.

Change-Id: I6256280cae35b2b4d7a8ba4b3913ca69cde22611
2020-10-19 15:04:22 +00:00
Vadim Yanitskiy 2e28b3859d scheduler: reduce nesting in trx_sched_set_lchan()
Change-Id: I476dabb059325058a4327bb96430ce6ade199580
2020-10-19 15:04:22 +00:00