Commit Graph

2500 Commits

Author SHA1 Message Date
Harald Welte cf7a7fcebf remove dead oml_router code
We originally wanted to intrdouce an OML router which would permit
external proceses to implement certain OML MOs.  However, that code
was never completed, and all the existing implementation (in three
copies) does is to create a unix domain socket and discard what
is received there.

Change-Id: I7fcbbd5d6b64ddc666ca836dc49abb430be0d5cb
2020-10-19 18:17:36 +02: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
Vadim Yanitskiy fc1976e1a0 scheduler: get rid of useless TRX_CHAN_FLAG_PDCH
Change-Id: I951ec9b02be674936fbd0bf2e75b004813e25197
2020-10-19 15:04:22 +00:00
Vadim Yanitskiy 66be4b6785 scheduler: drop redundant check in trx_sched_set_cipher()
In this function we already do check that a given timeslot is not
a PDCH slot, so checking if TRX_CHAN_FLAG_PDCH is redundant.

Change-Id: Ie73bdaf0f6bc76ed8d2e95d1fb995333bf617e7e
2020-10-19 15:04:22 +00:00
Vadim Yanitskiy 46aa8465be scheduler: drop meaningless check in trx_sched_set_lchan()
Both TRXC_PDTCH or TRXC_PTCCH are described in 'trx_chan_desc'
(defined as 'const'), and both have TRX_CHAN_FLAG_PDCH set. So
indeed, this condition can never be true.

Change-Id: Ie185a939b48eb859ac1c8ffa0a4f667fda0cb82b
2020-10-19 15:04:22 +00:00
Vadim Yanitskiy 68323527e7 scheduler: use RSL_CHAN_NR_MASK in trx_sched_set_cipher()
Change-Id: I26fb115ce0a7c33453b05c8fcee8a21d1a2a97d5
2020-10-19 15:04:22 +00:00
Vadim Yanitskiy bdea34165b power_control: tolerate small deviations from 'rx-target'
Recently we've introduced EWMA based uplink power filtering, that
should reduce Uplink power oscillations.  However, the power loop
is still quite sensitive to small deviations from the target power
level: even such an insignificant deviation like 2-5 dBm triggers
the loop to increase or decrease the MS power level.  Even if the
EWMA based filtering is enabled with 80% smoothing (alpha = 0.2).

This change introduces a new configuration parameter - 'hysteresis':

  uplink-power-target <-110-0> hysteresis <1-25>

that together with the 'uplink-power-target' defines a range:

  [target - hysteresis .. target + hysteresis]

in which the MS power loop would not trigger any power changes.

This feature is now *enabled* by default, so given that:

  - default 'uplink-power-target' is -75 dBm, and
  - default 'hysteresis' is 3 dBm,

the default target Uplink power range is: -78 dBm ... -72 dBm.

Change-Id: Iacedbd4d69d3d74e2499af5622a07a8af0423da0
Related: SYS#4916
2020-10-19 17:30:33 +07:00
Vadim Yanitskiy 284e4c4437 power_control: do nothing if 'rx-current' equals 'rx-target'
It makes no sense to do further calculations if the actual Uplink
signal strength equals the target value configured in the VTY.

Change-Id: Id99c7013a722403e773df8367b1a9d7a856e639b
Related: SYS#4916
2020-10-19 17:29:46 +07:00
Vadim Yanitskiy 00da6dcb88 power_test: fix incorrect line termination in init_test()
Change-Id: Ic36a4e70df52b64e4d5177d5b2bcf060e0f6458f
Related: SYS#4916
2020-10-18 21:40:00 +07:00
Vadim Yanitskiy 17fd344249 measurement: use LOGPLCHAN() macro in lchan_meas_check_compute()
Change-Id: Ia73fd766ddce3fd03d0f45b72cb2d056fae781fc
2020-10-18 18:26:12 +07:00
Vadim Yanitskiy 79eab9689f measurement: remove redundant 'break' statements in modulus_by_lchan()
Change-Id: I24597dbdaa692f855be014c536f5758b8e503688
2020-10-18 18:26:12 +07:00
Vadim Yanitskiy e20baa31bf scheduler: use RSL_CHAN_NR_MASK in trx_sched_set_lchan()
Change-Id: I3dd2c90f510444cda38516bd9a1a207877bebadc
2020-10-17 15:07:33 +07:00
Vadim Yanitskiy cf2226093f scheduler: _sched_dequeue_prim(): make 'l1sap' a scoped pointer
Change-Id: Ia2d1098e25d0bbe39fd7e98eb7c96d43a32073df
2020-10-17 15:07:33 +07:00
Vadim Yanitskiy 52aa451ae2 scheduler: ensure PRIM_OP_REQUEST when adding to the queue
Change-Id: I709ba2394862fcb0f86484792b5f8d3b338b42cc
2020-10-17 15:07:33 +07:00
Vadim Yanitskiy ae09c8acb4 fix pcu_if_signal_cb(): do not send INFO.ind if PCU is not connected
Sending INFO.ind unconditionally in pcu_if_signal_cb() provokes
a lot of warnings during OML bootstrapping / termination:

  DPCU INFO pcu_sock.c:247 Sending info
  DPCU INFO pcu_sock.c:262 BTS is up
  DPCU INFO pcu_sock.c:205 (bts=0,trx=0) unavailable for PCU (op=Disabled adm=Unlocked)
  DPCU INFO pcu_sock.c:205 (bts=0,trx=1) unavailable for PCU (op=Disabled adm=Unlocked)

Do not call pcu_tx_info_ind() if the PCU is not connected.

Change-Id: If8bc8bec5ad808be8d40e91278a4a4fde84920b0
2020-10-16 19:43:14 +07:00
Vadim Yanitskiy 967bca7b9e power_control: implement EWMA based Uplink power filtering
So far the Uplink power control loop did not filter the Uplink RSSI
measurements (reported by the BTS) at all.  The lack of filtering
makes our implementation too quick on the trigger, so in the real
deployments there will be unneeded Tx power oscillations.

In order to reduce this effect, let's implement a very simple EWMA
(also known as Single Pole IIR) filtering that is defined as follows:

  Avg[n] = a * Pwr[n] + (1 - a) * Avg[n - 1]

where parameter 'a' determines how much weight of the latest UL RSSI
measurement result 'Pwr[n]' carries vs the weight of the average
'Avg[n - 1]'.  The value of 'a' is usually a float in range 0 .. 1, so:

  - value 0.5 gives equal weight to both 'Pwr[n]' and 'Avg[n - 1]';
  - value 1.0 means no filtering at all (pass through);
  - value 0.0 makes no sense.

This formula was further optimized with the use of '+=' operator.
The floating point math was also eliminated by scaling everything
up (by 100).  For more details, see:

https://en.wikipedia.org/wiki/Moving_average
https://en.wikipedia.org/wiki/Low-pass_filter#Simple_infinite_impulse_response_filter
https://tomroelandts.com/articles/low-pass-single-pole-iir-filter

The EWMA filtering is now *enabled by default*, but can be disabled
or (re-)configured over the VTY at any time:

  ! Completely disable filtering
  no uplink-power-filtering

  ! Enable EWMA smoothing with the given parameters
  uplink-power-filtering algo ewma beta <1-99>

Note that the VTY command expects 'beta' instead of 'alpha':

  alpha = (100 - beta)

and the value must be in %.  This is done for simplicity:

  1% means lowest smoothing,
  99% means highest smoothing.

Let's say we have EWMA filtering enabled with alpha = 0.4, and get
-98 dBm on the input, while the last output value was -60 dBm.
The new output would be:

  Avg[n] = 0.4 * Pwr[n] + 0.6 * Avg[n - 1]
  Avg[n] = (0.4 * -98) + (0.6 * -60)
  Avg[n] = -75.2 => around -75

Of course, this is not a silver bullet, but better than nothing.

Change-Id: Ib6dcadbf14ef59696c6a546bd323bda92d399f17
Related: SYS#4916
2020-10-15 19:46:11 +07:00
Harald Welte 9a7acc1744 sysinfo: Don't broadcast SI4 GPRS INDICATOR if PCU is disconnected
Depends: libosmocore.git I9d6ed06731ae15fdcef1a1f397d6ac2b7b1ca980
Change-Id: I1fd513ea03297918d15d4b28ed454f9b6dd6ebfa
Related: OS#3075
2020-10-15 11:29:29 +00:00
Vadim Yanitskiy 8d62d66ed5 power_control: clarify argument names of lchan_ms_pwr_ctrl()
Change-Id: I821120bf5c3690f5b4c6b96c879e675b3d271c90
2020-10-15 15:50:43 +07:00
Vadim Yanitskiy 52d6e43d0e tests/power_test: do not assert in apply_power_test()
Instead, print the actual vs expected values.

Change-Id: Ie88e275ba78cef7a9ba20d34c269881216fb0ce3
Related: SYS#4916
2020-10-15 15:50:43 +07:00
Vadim Yanitskiy 8d56806c65 tests/power_test: move bts/trx/ts/lchan init to init_test()
This would allow us to introduce additional test cases.

Change-Id: I00569de378f7c3ca7cc6885fc2bdf25fbc637831
Related: SYS#4916
2020-10-15 15:50:43 +07:00
Vadim Yanitskiy 43f211a77d tests/power_test: also match stderr, not only stdout
Change-Id: I68e749e9f5c15197b1de4a2aec40338e590553b0
2020-10-15 15:50:33 +07:00
Vadim Yanitskiy 7b239f40cb gsm_data: check in and use enum lchan_rel_act_kind
Change-Id: If7a7e90dda77a1989420e329c5d60805b28360c7
2020-10-15 15:20:10 +07:00
Harald Welte 1ab6412610 sysinfo: Only send SI13 if PCU is connected
If no PCU is connected, we cannot be providing GPRS services,
and hence should not transmit SI13.

Change-Id: I54320cf8073a33ed9e35b365921df178005e8967
Closes: OS#3075
2020-10-15 06:07:17 +00:00
Pau Espin ca5d1e6ba6 Drop unused param in oml_init()
Change-Id: I96d8359f4ae13c9f47cc87d87fde6d2047169a49
2020-10-13 08:54:36 +00:00
Pau Espin e1de96088d contrib/jenkins: Enable parallel make in make distcheck
Change-Id: Ib91fb2e09d5260bef03dec653e26eeb4378e8e74
Related: OS#4421
2020-10-12 19:43:04 +02:00
Vadim Yanitskiy 2db8da22d6 pcu_sock: support handling multiple BTS instances in pcu_rx()
Change-Id: Icd19f803dc69138bf2fb1b0e1389b7ce1c8a9b1f
2020-10-10 05:09:16 +07:00
Philipp Maier a73c6d6785 main: add commandline option --vty-ref-xml
The commandline option --vty-ref-xml is needed to enable automatic
generation of the VTY reference manual.

Change-Id: I895db6086748a5916874e779963caed589050109
Related: SYS#4937, OS#1601
2020-10-09 20:36:01 +02:00
Vadim Yanitskiy 6710438899 pcu_sock: fix {local,remote}_port byte ordering in pcu_tx_info_ind()
The PCUIF is a 'brilliant' protocol: some fields are expected to
be in the network byte order, some in the host order.  The NSVC
remote address and local/remote ports is a good example:

  - byte order of the address must be the network order, and
  - byte order of the ports must be the host order.

Change-Id: I383cab0b58b62734090023298da8c5a341c670d5
Fixes: I310699fabbfec4255f0474f31717f215c1201eca
Related: SYS#4915
2020-10-09 11:17:17 +00:00
Vadim Yanitskiy 74750fe2b0 oml: fix handling of NSVC local port in oml_ipa_mo_set_attr_nsvc()
This is another regresion introduced by [1].  Both local and remote
port numbers recived in the network order, and must be stored as-is.

Change-Id: I3c21a2c27dcbf6de728ce2c7ccbae9e2f517c450
Fixes: I310699fabbfec4255f0474f31717f215c1201eca
Related: SYS#4915
2020-10-08 20:50:07 +00:00
Vadim Yanitskiy 912b4df76c pcu_sock: fix pcu_sock_close(): deactivate dynamic timeslots too
Change-Id: Ib0efa6e1e2a68ac9675a18487b79d9b14bdb22c5
Fixes: OS#4785
2020-10-08 20:32:40 +00:00
Vadim Yanitskiy c0b544f103 pcu_sock: use llist_for_each_entry() in pcu_sock_close()
Using gsm_bts_trx_num() involves redundant iterations over the
list of transceivers - we definitely don't want them.

Change-Id: I4bd40ffcc1e925412a21b0a934bbfdeddbc6ad1f
2020-10-08 20:32:40 +00:00
Philipp Maier 8be3fa6f36 sched_lchan_tchh: initialize meas_avg with zeros
in function rx_tchh_fn() the variable meas_avg is not initalized. This
is not always a problem, since most of the time trx_sched_meas_avg() is
populating the variable properly. In cases where a FACCH is transmitted
(chan_state->ul_ongoing_facch = true) the variable is left unpopulated.
In order to have at least stable values for those cases, initalize the
variable with zeros for the ongoing facch phase.

Change-Id: I5c3c1c41d22f9edaaf6bd4478dd04f090dca12a9
Fixes: CID#214480
2020-10-08 19:55:19 +00:00
Vadim Yanitskiy a2690a8921 pcu_sock: cosmetic: make *nsvc a scoped and const variable
Change-Id: I707bb75f15ccaee5c67fa4a7e87dc70c9b982973
2020-10-09 00:06:01 +07:00
Vadim Yanitskiy 403a37ec34 pcu_sock: cosmetic: use ARRAY_SIZE() in pcu_tx_info_ind()
Change-Id: I272ceb09a3e8cac0082dbec3a034776da71d9366
2020-10-09 00:06:01 +07:00
Vadim Yanitskiy 81ca3206ad vty: fix 'show bts' command: BTS number is optional
Change-Id: If53fb07ec38f6bbc368ce84d14e59fa8167691d3
2020-10-08 17:05:15 +00:00
Vadim Yanitskiy 132f72e76a vty: fix 'show bts' command: print proper BTS variant
Change-Id: I24fc66175f79fe64400371e27b23556054c48dfe
2020-10-08 17:05:15 +00:00
Philipp Maier 05549ae252 vty: add attributes to VTY commands indicating when they apply
Change-Id: Ifcdfcd157e5067fa2e4296d7c7e93a74087f49ff
Related: SYS#4937, OS#1601
2020-10-08 07:16:55 +00:00
Alexander Couzens 9096461507 OML: correct parse the NM_ATT_OSMO_NS_LINK_CFG field address_family
The address_family is 8 bit and have a padding byte afterwards.
By using osmo_load16be it's encoding it wrong and result in an
empty/invalid NSVC configuration.

Change-Id: Ie070b5745124d48e74a6dedd8903b74bfb3ce9d2
2020-10-08 00:33:33 +02:00
Alexander Couzens d6b82e57a3 common/bts: set feature IPV6_NSVC
Since I310699fabbfec4255f0474f31717f215c1201eca the BTS
can decode NM_ATT_OSMO_NS_LINK_CFG. This OML attribute will be
only used if the OML feature IPV6_NSVC is present.

Change-Id: I9910f2afb3ab94167938b0fd356f2f0a8c382130
2020-10-08 00:29:10 +02:00
Alexander Couzens 650a0c31a7 Introduce the new OML NM_ATT_OSMO_NS_LINK_CFG to configure IPv6 NSVC for PCU
With PCU interface version 10 it supports IPv6 NSVC. The new OML IE
NM_ATT_OSMO_NS_LINK_CFG allows to configure IPv6 NSVC.

Change-Id: I310699fabbfec4255f0474f31717f215c1201eca
2020-10-06 11:36:45 +00:00
Harald Welte 90e0c205b5 bts: Add VTY command to manually override Radio Link Timeout
There are some situations where it is useful to be able to change the
Radio Link Timeout at runtime, without restarting the BTS.

This adds a new (hidden) command for this:
	"bts <0-255> radio-link-timeout (oml|infinite|<4-64>)"

Change-Id: I64674a432cf7751b16d5d0b52f66766fa6e37028
2020-10-05 18:23:06 +02:00
Vadim Yanitskiy 17de4e708f osmo-bts-omldummy: suppress 'Unimplemented bts_model_trx_deact_rf'
There is no PHY in case of osmo-bts-omldummy, so nothing to deactivate.

Change-Id: I4bae1c7ec677e22175aa5be67b41a357ba3c3cc1
2020-10-03 07:09:33 +00:00
Vadim Yanitskiy 7dd865badd osmo-bts-omldummy: fix: do not crash on OML connection drop/failure
This regression was introduced in 2ff4592ffc.
There is simply no PHY in case of osmo-bts-omldummy.

Change-Id: I864ac3f15e06462d6ce808b3f2188c5c39a5aad2
Fixes: Ic00df9e7278d42bc10c1e1a1c0edde7e13199299
2020-10-03 07:09:33 +00:00
Philipp Maier c41b94e93b osmo-bts-trx/scheduler: fix measurement handling for SUB frames
Make sure that we pick the correct UL measurements from the
history when we deal with AMR SID frames (SUB frames).

Change-Id: I902bb47d68742d2589156f61099b67a0edbaf40b
Related: OS#2978
2020-10-03 07:05:25 +00:00
Pau Espin b62612fbde gsm_data.h: Drop unused struct field
Probably a leftover from openbsc times.

Change-Id: I0b62c41bcb992df376668c6feb6ac7ada35d471d
2020-10-01 14:47:24 +00:00
Vadim Yanitskiy 64bd96b3f8 vty: make most struct pointers const in show/write commands
Change-Id: Iacc32f7982c150d84ea4df7affa1f9e07806928f
2020-09-28 11:39:04 +07:00