Commit Graph

132 Commits

Author SHA1 Message Date
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
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 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 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 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 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 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 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
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 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 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 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
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
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
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 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
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
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 64bd96b3f8 vty: make most struct pointers const in show/write commands
Change-Id: Iacc32f7982c150d84ea4df7affa1f9e07806928f
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 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 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
Pau Espin f30440553c vty: Allow setting power-ramp max-initial to negative values
This allows for instance ramping up from -10 dBm -> -4 dBm if NOMTXPOWER
of SDR is really low (below 0dBm) or because the max_power_red is >=
NOMTXPOWER.

Related: SYS#4920
Change-Id: I0f27fb7b86b58c5a80f5342b66ff4f5d1b775498
2020-07-27 16:58:41 +02:00
Vadim Yanitskiy 2931fc337f vty: fix missing separator in help for power ramp commands
Change-Id: Id83fa562ba8496be8915573d2222dd64c7ca5eb9
2020-06-26 01:46:43 +07:00
Vadim Yanitskiy df26770d41 A-bis/RSL: refactor handling of BS Power IE (power reduction)
According to 3GPP TS 08.58, section 9.3.4, BS Power IE indicates
the transmission power attenuation on a particular channel:

  +--------------+---------+-----------------+
  | Reserved (3) | FPC (1) | Power level (4) |
  +--------------+---------+-----------------+

so let's change handling of this IE as follows:

  - s/bs_power/bs_power_red/g, so it reflects 'reduction';
  - store power attenuation value in dB, not in 2 db steps;
  - get rid of ms_power_ctrl.bts_tx_pwr, it's always 0 anyway;
    - fix rsl_tx_meas_res(): use lchan->bs_power_red;
  - always check if FPC (Fast Power Control) flag is set;
    - we don't support it, so reject messages containing it;
    - fix rsl_rx_chan_activ(): properly apply the bitmask.

Change-Id: I16cc50dfca102030380a06e16c234d5f6698f38f
2020-06-15 22:51:20 +07:00
Vadim Yanitskiy 578156b815 Do not mix public and private BTS features, use libosmocore's API
It was a very bad idea to mix "public" BTS features, that are
reported to the BSC via OML, and those features, that are used
locally (and exclusively) in osmo-bts.

Why? At least because we already have the BTS feature manipulation
API in libosmocore, that is used by osmo-bsc, but for some reason
not by osmo-bts. New features added to libosmocore would clash
with the existing "internal" ones like BTS_FEAT_MS_PWR_CTRL_DSP.

So what this change does can be described as follows:

  - remove duplicate definition of the "public" features,
  - use libosmocore's API for the "public" features,
  - separate both "internal" and "public" features:
    - the "public" features continue to live in bitvec,
    - the "internal" features become flags,
    - s/BTS_FEAT/BTS_INTERNAL_FLAG/g.

Change-Id: Icf792d02323bb73e3b8d46384c7890cb1eb4731e
2020-06-11 00:36:21 +07:00
Vadim Yanitskiy 301b218509 vty: fix bts_dump_vty(): properly print OML stream ID (TEI)
Change-Id: I80ceba60e4b48d5bc68de71a2b2a2036b1e78f57
2020-06-05 18:38:38 +07:00
Vadim Yanitskiy 14819d8053 vty: use gsm48_chan_mode_name() from libosmocore
Change-Id: I18cdaa26a674bd9279a4ea1946aefc6969404139
2020-06-05 02:14:48 +07:00
Vadim Yanitskiy 0a8642ab5c vty: cosmetic: make an error message more informative
Change-Id: I9aeb1780b6a64f7bec80ecb243bd01b47cf4ef24
2020-06-05 02:14:48 +07:00
Pau Espin f0171a9974 vty: Fix misleading define name
define contains strings about dB vs mdB, not dB vs dBm.

Change-Id: Ib2f1f9429d7d5ead585fb93195a890abd568e65c
2020-05-28 19:00:48 +02:00
Oliver Smith ae4d85d891 VTY: add "test send-failure-event-report"
Send test failure event report OML message to the BSC. I found this
useful while manually testing related handling code in OsmoBSC.

Related: OS#1605
Change-Id: I0c4eba1636d8faf5012db26643bdf1d9fb6bfa1e
2020-03-24 08:01:05 +00:00
Oliver Smith cb4340b8a4 rsl: make IP DSCP configurable
Related: OS#4438
Depends: libosmo-abis I41603db8c1286660ad57ac1c78a8fb393a2b080b
Change-Id: Icdef5d40243fefdeae23f3bcf9c6702e8487928a
2020-03-08 17:56:52 +01:00
Vadim Yanitskiy 7364ef15d9 vty: fix left shift by 31 cannot be represented in type 'int'
Change-Id: I3e5940e8f360bf6563f4c1b5ebd09579f9108c81
2020-02-27 23:35:09 +07:00
Vadim Yanitskiy f9115ae67a common/vty.c: get rid of generic exit / end commands
Those commands are now handled by libosmovty itself.

Change-Id: I425f9058ae15de929e2ba0283d4057bdf767aeeb
2020-01-11 00:17:10 +01:00