Commit Graph

2500 Commits

Author SHA1 Message Date
Vadim Yanitskiy 4785fe7622 tx_power: make trx/lchan struct pointers const where possible
Change-Id: I1b290af115730ba16f4f9887fe316e2ed15659a2
2020-09-28 11:39:04 +07:00
Vadim Yanitskiy 6e725279ca vty: cosmetic: use osmo_talloc_replace_string()
Change-Id: Ic195cef2aafec55d37152045f7714335ded0a62b
2020-09-25 09:32:01 +07:00
Vadim Yanitskiy 0c7e9354fe bts: cosmetic: make param 'net' of gsm_bts_num() const
Change-Id: I378fea4aefb2cc4253cdd99ebc9c4f01b21faf95
2020-09-25 09:24:17 +07:00
Vadim Yanitskiy 7a95af61fe vty: fix bts_dump_vty_features(): properly check BTS model flags
bts_internal_flag_get() expects a flag value, not an integer.

Change-Id: I88de79cc45fb64144df33b0ac3e3b91537039953
2020-09-25 09:08:52 +07:00
Vadim Yanitskiy 4ded469b0f osmo-bts-trx/scheduler: refactor UL burst measurement processing
Currently the UL measurements (RSSI, ToA256, C/I) of the burst that
concludes a block are passed up to the higher layers. This means
that the measurement values of the other bursts are skipped.

Let's keep record of all UL measurements and average the values
before we pass them up to the higher layers. Use a simple ring
buffer to store the measurement history (up to 8 unique entries
for now). Remove *_num/*_sum variables from l1sched_chan_state.

Change-Id: I2b02b51fea5664f161382a4ddc63dbf14ffc9ac5
Related: OS#3032, OS#2978
2020-09-22 19:34:02 +00:00
Alexander Couzens 27c5fd9369 pcuif_proto: version 10: add support for IPv6 NSVCs
Introduce a address_type in the NSVC configuration pass the given
protocol.  The remote_ip is network byte order, the default
encoding for in_addr and in6_addr.

Change-Id: I6d60277eb5b8d938d9f38114c933d58ee1b884c9
Related: Iae854875a45dbc29cd46a267ccaf60f1f2ac2973
Related: SYS#4915
2020-09-22 00:05:02 +07:00
Vadim Yanitskiy 2302cb162c pcuif_proto: version 10: add frequency hopping parameters
Change-Id: I04782222b499d0488269544910fbd4ed9929c05d
Related: Idf11bc4ba3ff0b00b32f2beab8fd020c67119d05
Related: SYS#4868, OS#4546, OS#4547
2020-09-22 00:05:02 +07:00
Pau Espin ee92f6980f oml: Set RadioChannel operational state to Enabled only during OPSTART
Otherwise they may be set to ENABLED before CHAN SET ATTR and OPSTART
are sent, and oml_rx_opstart will blindly OPSTART ack (because they are
already enabled) and avoid configuring the timeslots.
That can happen if phy_link & rsl link get ready before receiving all
the OML CHAN SET ATTR and OPSTART commands on all RadioChannels.

Fixes: OS#4757
Change-Id: I50722c4e82faae32371817c3878bb41bfd0175ba
2020-09-17 16:37:39 +00:00
Vadim Yanitskiy 0cd8df2184 gsm_data: rename hopping.{ma,ma_len} to hopping.arfcn_{list,num}
MA (Mobile Allocation) is actually a bit-mask indicating those ARFCNs
of the Cell Allocation, which must be used as the hopping sequence.

What we store in struct gsm_bts_trx_ts is the actual list of hopping
channels, so let's name it properly and eliminate possible confusion.

Change-Id: I677d66e428fa0fe119ebc37bc2a4e6cc05c251c4
2020-09-17 15:45:48 +00:00
Vadim Yanitskiy 9b6000c6fa struct gsm_bts_trx[_ts]: remove unused parsed NM attribute list
This list is already a part of struct gsm_abis_mo.

Change-Id: I19b907bea500569c6e7e1b64b50e1c2ee2014f1c
2020-09-17 15:45:48 +00:00
Vadim Yanitskiy 86c8d2f81c struct gsm_bts_trx: remove unused per-TRX OML Link pointer
Most likely, this part of the structure was copy-pasted from the
corresponding definition in osmo-bsc.  In osmo-bts we always
establish a single per-BTS OML link, not per-TRX.

Change-Id: I1792372de484608e04211c9de4294b3c76173ead
2020-09-17 15:45:48 +00:00
Pau Espin f3161349cf Avoid sending RSL RF REL ACK if PDCH chan is disabled by administrative lock
If for whatever reason a TS stops being announced as available to the
PCU (for instance because the TRX became administratively locked), the
PCU will send a Release for that channel, but in that case we don't want
to send an RSL RF Channel Release ACK because it was not initiated by
related command from BSC.
In the case of a simple PDCH timeslot (no dynamic), the behavior is
already there but we don't print an error log since it's expected.
In the case of a dyn osmo TS, we only need to respond to RF Channel
Release when PDCH is deactivated here, but in other cases we don't need
to submit anything to BSC.

Change-Id: I8ae9ee450763a0e14edf950e38b64a32df14f44f
2020-09-16 19:38:33 +02:00
Pau Espin df17af689f pcu_sock: Only announce dyn TS already configured by lower layers
Avoid announcing to PCU as available  a dyn TS not yet fully
configured in the phy. Otherwise when we receive the Chan Activation
over the PCU sock while pchan_is still is not PDCH, and we fail to fully
activate the channel at that time.
See previous commit description for more information on the issue.

We still want to check for pchan_want because we actually want to stop
announcing the TS when it is in progress of being changed to TCH. This
configuration change is continued/finished once we receive the resulting
Release from PCU.

Change-Id: I8e2b170c1f94e7dfe2576a1fc899bf9c8a826a44
2020-09-16 19:35:52 +02:00
Pau Espin 03e9972695 Improve logging and error handling receiving act_req for dyn TS not yet configured
Something is wrong currently with dynamic TS and PDCH activation.
Apparently there's a race condition between activation in BTS lower
layers (example in TRXC) and against PCU.
Currently, when a GSM_PCHAN_TCH_F_TCH_H_PDCH is configured, we set
ts->dyn.pchan_want = GSM_PCHAN_PDCH and submit the async activation
through lower layers (CMD SETSLOT), and once the lower layer acks it we
set ts->dyn.pchan_is = pchan_want (when receiving RSP SETSLOT). However,
we seem to be advertising available TS to PCU based on pchan_want,
instead of pchan_is, which means we advertise channels not yet fully
configured. As a result, we may receive a Channel Act coming from PCU
for a given TS for which we didn't receive confirmation from upper
layers, meaning pchan_is is still GSM_PCHAN_NONE. This is by no means
expected in following code, so let's avoid going further over it.

Actual issue will be fixed in follow-up patch.

Change-Id: I9edb5b8a14ffaed3e24c10c2c7a3f618e05f3a01
2020-09-16 19:31:44 +02:00
Pau Espin c9079d9106 Improve error handling and logging in gsm_pchan2chan_nr()
It was spotted that sometimes chan_nr BCCH was printed for a TS
containing configured as GSM_PCHAN_TCH_F_TCH_H_PDCH, which was totally
confusing. Indeed the problem is somewhere else, but let's log an error
and return 0 in this case, which will be converted to "UNKNOWN" string
later on.

Change-Id: Ic455af39c668481a13d579f33ac09033fd5c4009
2020-09-16 19:30:38 +02:00
Pau Espin 666adf6a97 Improve logging around failing to (de)activate chan_nr
Change-Id: Ibc398eb5d50851cbe48f2c92f14e746938a68720
2020-09-16 19:28:38 +02:00
Alexander Couzens f1222fc724 Revert "pcuif_proto: version 0xa: add support for IPv6 NSVCs"
This reverts commit df93a448b7.
It was to early because the frequency hopping wasn't ready to be merged.

Change-Id: I6e67f4cd9828afa53ed4e783b83b039ee6a1d570
2020-09-16 03:24:18 +02:00
Alexander Couzens 9ad00d1c28 pcuif_proto: fix typo in comment
Change-Id: Iec7c41741ed093df8c60a3cda548662492f56116
2020-09-15 23:38:14 +00:00
Alexander Couzens df93a448b7 pcuif_proto: version 0xa: add support for IPv6 NSVCs
Introduce a address_type in the NSVC configuration pass the given
protocol.
The remote_ip is network byte order, the default encoding for in_addr and in6_addr.

Change-Id: I4067b1af041b2cdad60d6fb16c9caee98bc218dd
2020-09-15 23:37:55 +00:00
Pau Espin 2ff4592ffc Fix RadioCarrier OML Operative State Change report not sent on some scenarios
Operative state is mainly maintained based on 2 requirements:
* phy_link being in CONNECTED state
* RSL connection being up and ready

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

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

Related: SYS#5063
Change-Id: Ic00df9e7278d42bc10c1e1a1c0edde7e13199299
2020-09-15 14:03:29 +02:00
Vadim Yanitskiy 3d085dc6a7 osmo-bts-trx: also print 'txtune-ack' in st_open_poweroff()
Change-Id: Ifa453e101c32ee211844becf4604f3e08198da73
2020-09-10 14:15:31 +07:00
Pau Espin 81251bdbe8 scheduler: Drop unused function trx_sched_reset()
Change-Id: Id31e82b6bbfdd8030612c78737c0aa7dd7e20bd0
2020-09-07 10:23:25 +02:00
Pau Espin c84b007efb bts-trx: Ensure RFMUTE state is set properly at startup
In general, it is always set to 1 (Locked) in
st_open_poweroff_on_enter() right after initial POWEROFF, and once the
BSC unlocks it (based on VTY cfg "rf_locked (0|1)") by sending an OML
message, the bts_model_chg_adm_state() call will update it sending
RFMUTE.

This basically fixes the case where osmo-bsc.cfg is configured with
"rf_locked 1" to start with a TRX locked until manually unlocked.

Related: SYS#4920
Change-Id: I96b64cdc901d6f216df628d7be57a67af4a21e25
2020-09-07 08:08:09 +00:00
Pau Espin af4015cb91 bts-trx: Use TRXC RFMUTE instead of resetting the scheduler
Since commit 221ee92551,
bts_model_trx_deact_rf() was being called when RF locking the TRX, which
was implemented by resetting the scheduler. This proved to be a messy
and wrong way to emulate disabling RF, since it modifies tate on lots of
structures from which it is later difficult to recover from, causing
bugs and issues like:
82a35a1dbf
be15a12c87
eef420d1ca
https://osmocom.org/issues/4694
https://osmocom.org/issues/4695
https://osmocom.org/issues/4696
https://osmocom.org/issues/4697

So for all these reasons, it is believed a good solution to avoid
resetting the scheduler and simply ask lower layers (osmo-trx) to take
care of disabling RF TX/RX on a given TRX. For TRX implementations not
supporting the newly added RFMUTE command, ramping down to -10dBm still
provides for a way to emulate RF locking. In any case, none of this was
supported until recently so it's not like we are breaking some feature
here.

Related: SYS#4920
Change-Id: I1423ddb390ef327ec7d4a27de2ac5dca663773a5
2020-09-07 08:08:09 +00:00
Vadim Yanitskiy 359ca18374 osmo-bts-trx/trx_provision_fsm: add missing default labels
Change-Id: I494ea9eb64634a03575a52750273cee7c68a8b3a
2020-09-05 21:06:14 +07:00
Vadim Yanitskiy 5a2262da64 osmo-bts-trx: fix trx_init(): do not send OPSTART ACK blindly
It was reported that both osmo-bsc and osmo-bts-trx may end up
running in a half-broken state, when everything looks good and
the UEs can see the network, but all channel requests get
rejected due to "trx not usable" error:

  lchan_select.c:173 (bts=0) lchan_select_by_type(SDCCH)
  lchan_select.c:48 looking for lchan CCCH+SDCCH4: (bts=0,trx=0) trx not usable
  lchan_select.c:48 looking for lchan SDCCH8: (bts=0,trx=0) trx not usable
  lchan_select.c:239 (bts=0) Failed to select SDCCH channel

  lchan_select.c:173 (bts=0) lchan_select_by_type(TCH_H)
  lchan_select.c:48 looking for lchan TCH/H: (bts=0,trx=0) trx not usable
  lchan_select.c:239 (bts=0) Failed to select TCH_H channel

  lchan_select.c:173 (bts=0) lchan_select_by_type(TCH_F)
  lchan_select.c:48 looking for lchan TCH/F: (bts=0,trx=0) trx not usable
  lchan_select.c:239 (bts=0) Failed to select TCH_F channel

As was then figured out, this happens because the Radio Carrier
MO (Managed Object) remains Disabled even after the BSC has
sent OPSTART and the BTS ACKed it:

  oml.c:986 OC=RADIO-CARRIER(02) INST=(00,00,ff): Rx OPSTART
  l1_if.c:614 Rx OPSTART for RADIO-CARRIER MO
  l1_if.c:201 TRX_PROV(phy0-0)[0x1238c0]{OPEN_POWERON}:
              Event TRX_PROV_EV_CFG_ENABLE not permitted
  oml.c:144 OC=RADIO-CARRIER(02) INST=(00,00,ff): Tx Opstart Ack

It remains a mistery why the TRX_PROV FSM is already in state
OPEN_POWERON, while it's expected to be in state OPEN_POWEROFF,
but we definitely should not ACKnowledge the OPSTART if this
happens.  Send a NACK instead with cause NM_NACK_CANT_PERFORM.

Change-Id: I8727460acbf850b84df67a9cbdc25b47dee1fadd
Related: SYS#5063
2020-09-05 20:03:46 +07:00
Vadim Yanitskiy 6f4db8c620 osmo-bts-trx/l1_if: drop redundant logging message
We already get quite informative message originated from oml.c:

  OC=RADIO-CARRIER(02) INST=(00,00,ff): Rx OPSTART

Change-Id: I3d4a4473541327488d3393b1fa7c6391afb3728a
2020-09-05 20:02:14 +07:00
Vadim Yanitskiy 1ac4243a13 osmo-bts-trx/trx_provision_fsm: cosmetic: switch is not a function
Change-Id: I56d2777bcc43c96b9fa1672d3ad29bf9817208bb
2020-09-05 20:01:29 +07:00
Vadim Yanitskiy a12c0b16f4 osmo-bts-trx/trx_provision_fsm: fix misleading comment in header
Change-Id: Iff9f073ce65bc443109107bb895124ec38dbbb10
2020-09-05 18:15:12 +07:00
Vadim Yanitskiy f68fa09376 vty: add 'gsmtap-sapi (enable-all|disable-all)' command
It's more convenient to use one command to enable/disable sending
of all kinds of UL/DL messages at once, rather than specifying
all of them individually.

Adjust config_write_bts_single(), so it would not print unknown
GSMTAP SAPI entries if gsmtap_sapi_mask is set to UINT32_MAX.

Change-Id: Icd7fce860ecdcf8ffa107bdfee7ec94ea9ea6cb2
2020-09-04 13:00:35 +07:00
Vadim Yanitskiy 49ad9f9375 vty: clarify documentation of '[no] gsmtap-sapi' command
Change-Id: I2030992da604f27fc8cd6f9695a8095fda801f82
2020-09-04 12:26:01 +07:00
Vadim Yanitskiy eecb97146e osmo-bts-omldummy: enable BTS_FEAT_{CBCH,HOPPING} support
Otherwise osmo-bts-omldummy would reject OML Set Channel Attributes
containing the hopping parameters.  This change is needed for the
new BSC_Tests.TC_fh_params_* test cases.

Change-Id: I38692252baa7a9fc23078121db0a17557950e4d4
Related: SYS#4868, OS#4545
2020-09-02 16:36:01 +07:00
Pau Espin 063eaa80a4 pcu_sock: Fix typo in log message
Change-Id: I63f0ba277318e254cfd9ad571899f3a45529ff16
2020-08-26 13:49:30 +02:00
Pau Espin 8f1974ba1e configure.ac: Fix trailing whitespace
Change-Id: I028ebb9faf68d084759fcfae3ea84f7bdd2d0364
2020-08-20 08:40:00 +00:00
Pau Espin 345a857e14 Update dependency on libosmocore 1.4.0
Latest code relied on features from libosmocore master (> 1.3.0). New
libosmocore release 1.4.0 is now available, so drop the TODO and update
it now, since we can already refer to it.

Change-Id: I992f7e6d5884e53eab8da839d8e77736f9d751c3
2020-08-20 08:38:45 +00:00
Pau Espin 67e5a72a51 common: tx_power: Fix bug in power ramp up below max-initial value
See previous commit adding the unit test about the error description and
expected behavior.

The wrong behavior appeared due to step_size_mdB being unsigned and the
whole addition at the left side of the comparison being turned too as
unsigned, hence a small negative value turning into a big positive
value, and tpp->p_total_cur_mdBm not being updated to speed up the power
ramping.

Change-Id: I36a34362ebc90226fd8e1e190f898c3718fd923a
2020-08-18 17:22:38 +02:00
Pau Espin 1565d16a0a tests: tx_power: Extend and add extra power_ramp buggy case
The test code is extended to support testing more than one ramping loop.

A new test ramping test is added, which shows buggy behavior, since
being in -10dBm and targeting 10dBm with  max_initial_pout_mdBm=0 should
immediatelly jump -10->0 and then slowly ramp up (2dB) 0->10dB.
The issue will be fixed in next commit.

Change-Id: I5adc9008ac415eb23274755fc8270df8eebdc6fb
2020-08-18 17:22:01 +02:00
Daniel Willmann 624b5cdc22 osmo-bts-trx: Use much lower clock advance values towards PCU and TRX
osmotrx fn-advance (which is the clock_advance variable here) and
osmotrx rts-advance together make up the minimum delay the BTS can react
to a channel request, etc.

The default of 20 are around 92ms which is clearly too much. With
modern hardware and using SCHED_RR a lower value should not be an issue.

See OS#4487 for some related measurements on more CPU-limited devices like a
LimeNet-micro3.

Fixes: OS#4487
Fixes: SYS#4885
Related: SYS#4881
Change-Id: I7da3d0948f38e12342fb714b29f8edc5e9d0933d
2020-08-17 19:11:19 +02:00
Vadim Yanitskiy d6daf726a2 debian/control: change maintainer to the Osmocom team / mailing list
Change-Id: I4224989032ba1ae6da55370fa5d8f95899aa0e47
2020-08-13 16:09:02 +07:00
Pau Espin c131ce45ba common: Support setting rt prio through new libosmovty sched VTY cmds
We gain other features from libosmovty for free, like configuring
cpu-affinity of the only thread in the process.

Depends: libosmocore.git Change-Id If76a4bd2cc7b3c7adf5d84790a944d78be70e10a
Depends: osmo-gsm-masnuals.git Change-Id Icd75769ef630c3fa985fc5e2154d5521689cdd3c

Related: SYS#4986
Change-Id: Ice46e406b84fa11afcc7ba31e521e7677df73cf3
2020-08-10 20:10:50 +00:00
Vadim Yanitskiy 30458c83e5 rsl: constify the 'lchan' argument of rsl_tx_conn_fail()
Change-Id: Icec43d7c1f3b99292fa87462ad65b2c19fdd3b5f
2020-08-07 18:31:10 +00:00
Vadim Yanitskiy 4fa40f5913 l1sap: radio_link_timeout(): bad_frame is a boolean
Change-Id: Id173f69705948aafe861ec36450b147deda95246
2020-08-08 01:29:16 +07:00
Vadim Yanitskiy 089e4baef3 l1sap: radio_link_timeout(): use LOGPLCHAN() macro
Change-Id: Icc642599d85a751a750b382674dea5614b6f9ee4
2020-08-08 01:29:16 +07:00
Vadim Yanitskiy dc27771205 l1sap: radio_link_timeout(): clarify logging messages
Change-Id: Iafb190454c65cebe3de3c212fa8b10a86ec7eb67
2020-08-07 18:26:42 +00:00
Vadim Yanitskiy 017f85ab1c osmo-bts-trx: indicate support of BTS_FEAT_HOPPING
Change-Id: I81c35d76d4ca0aa54b18c6fd1909a97b4f5f7b68
Related: SYS#4868, OS#4546
2020-08-07 23:39:01 +07:00
Vadim Yanitskiy cf3635fbaa osmo-bts-trx/scheduler: implement baseband frequency hopping
The idea behind the baseband frequency hopping is quite simple: we
have several RF carriers (transceivers) transmitting and receiving
on fixed frequencies (just like in a regular multi-trx setup), and
an additional burst routing layer between the schedulear and the
transceiver interface (TRXD over UDP).

Speaking in terms of the proposed implementation:

  - on Downlink, dlfh_route_br() calculates the ARFCN corresponding
    to the current TDMA frame number according to the hopping sequence
    parametets, and picks the transceiver with matching ARFCN;

  - on Uplink, ulfh_route_bi() iterates over the transceiver list of
    of the BTS, calculating hopping ARFCNs for equivalent timeslots,
    and picks the one with ARFCN matching the received burst.

In order to avoid frequent transceiver lookups on the Downlink path,
dlfh_route_br() maintains a "cache" in the timeslot state structure.
Unfortunately, this "cache" seems to be useless on the Uplink path,
so ulfh_route_bi() always needs to lookup the matching transceiver
for each burst received over the TRXD interface.

It may also happen that the scheduler will be unable to route an
Uplink or Downlink burst, e.g. due to inconsistent / incorrect
hopping sequence parameters received from the BSC, or in case
if a transceiver gets RF-locked by the BTS operator.

Such events are logged as "FATAL" and aditionally signalled by the
following osmo-bts-trx specific rate counters:

  - trx_sched:dl_fh_no_carrier (Downlink), and
  - trx_sched:ul_fh_no_carrier (Uplink).

Change-Id: I68f4ae09fd0789ad0d8f1c1e17e17dfc4de8e462
Related: SYS#4868, OS#4546
2020-08-07 23:39:01 +07:00
Vadim Yanitskiy dc232c137b pcu_sock: use LOGPTRX() in info_ind_fill_trx()
Change-Id: I91410b32199780e41e0111b480e7611cdae7e022
2020-08-06 16:44:28 +00:00
Vadim Yanitskiy bebf458385 pcu_sock: separate trx / ts filling from pcu_tx_info_ind()
This would allow to avoid further nasting in 'for' loops.

Change-Id: Idb102c77751ccf77fd246f538e62fd7acf6ee88b
2020-08-06 16:44:28 +00:00
Vadim Yanitskiy dcfec2d993 pcu_sock: warn about maximum transceiver number constraints
Change-Id: I600860b12758a73e1bba6d9d508cf67c3d88cf34
2020-08-06 16:44:28 +00:00
Vadim Yanitskiy 2c331ee908 pcu_sock: use a 'switch' statement in ts_should_be_pdch()
Change-Id: I628c2c5198c52fb82309dfe4a31a59aeebc00f09
2020-08-06 16:44:28 +00:00