Commit Graph

208 Commits

Author SHA1 Message Date
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 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 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 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 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 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
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
Philipp Maier b89632cc67 l1sap: fix comment: sapi number is missing
Change-Id: I7922a5da0cd75eddfe019f3f5bd041ad911f1dd2
2021-02-15 11:01:34 +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 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
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 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 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 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 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 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
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
Philipp Maier 2edf5cf47f l1sap: pre-initalize pointer with NULL to avoid gcc warning
Change-Id: Ibfd18ed5268740cc73fffdb950b96c7f0fad3164
2020-11-19 17:32:16 +01: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 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 3daccb151f l1sap: do not print redundant info in l1sap_chan_act()
LOGPLCHAN() prepends the BTS/TRX/TS numbers itself.

Change-Id: I8a1dd7da7098fe8c8a015459608d9134821fb322
2020-07-09 10:43:33 +00:00
Vadim Yanitskiy 2f18578dcc Use libosmocore's TDMA frame number API (constatns & arithmetic)
Depends: (libosmocore) Ic291fd3644f34964374227a191c7045d79d77e0d
Change-Id: I61c97a62bd5dbbb4a984921ebdfc10ad6ed00f2a
2020-06-25 18:02:10 +00: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 1851781d99 gsm_data_shared: drop unused sacch_deact from struct gsm_lchan
Change-Id: I93c6bebbf715076c774248596089c77511733acc
2020-06-05 02:14:48 +07:00
Vadim Yanitskiy c4744ac24c l1sap: fix gsmtap_ph_rach(): properly pack 8-bit and 11-bit RA
According to 3GPP TS 44.004, section 7.4a, two alternative RACH
block formats are specified: 8 bit (1 octet) and 11 bit. The
bit order is little-endian (right to left).

In L1SAP PH-RACH.ind structure (see ph_rach_ind_param) we use
a field of type uint16_t to store RA values regardles of the
block format. Thus when packing it to bytes, we cannot just
cast uint16_t* to uint8_t*, we need to do some bit shifting.

Change-Id: I0e91d825bb2e1897647dd5403c311d833a89ff2e
2020-04-01 01:46:44 +07:00
Harald Welte 6a5039674f l1sap: Use msgb_pull_l2() and unify l1sap_tch_ind + l1sap_ph_data_ind
In l1sap_ph_data_ind() we can use msgb_pull_l2() which is an exact
implementation of the functionality there.

In l1sap_tch_ind(), the existing code is actually wrong by making the
assumption that the msgb contains exactly an entire osmo_phsap_prim.
Better to also dynamically compute the number of bytes to ensure
we only pull those ahead of the L2 header, no matter what their exact
count.

Change-Id: I13f7f8ba93795e40b1fb4a306fe765e059f642cf
2020-03-08 17:12:15 +01:00
Philipp Maier 5184576572 osmo-bts-sysmo: merge measurement data and payload
For osmo-bts-sysmo the MPH INFO MEAS IND indication is still sent
separately. Lets merge the measurement information into the PH DATA

Change-Id: Iffe7865727fbf9bca8eb32a96e8ea05cf718a948
Related: OS#2977
2020-02-17 12:40:07 +01:00
Pau Espin aea29c7249 l1sap: Change loglevel of Rx TCH.ind INFO->DEBUG
This line appears tens of times per second when a call is ongoing,
making it impossible to follow logs on INFO level.

Change-Id: Iadb1baf55df2f6d96f85260f2e8d03627fef7e66
2020-02-12 16:01:47 +01:00
Philipp Maier d4f67591c7 l1sap: merge MEAS IND into PRIM PH DATA / PRIM TCH
The MPH INFO MEAS IND indication, which contains the uplink measurement
data is sent in parallel to the PH DATA and TCH indications as a
separate indications. This makes the overall uplink measurement data
processing unnecessarly complex. So lets put the data that is relevant
for measurement into the PH DATA and TCH indications directly.

This change only affects osmo-bts-trx at the moment. In order to keep
the upper layers (l1sap.c) compatible we add an autodection to switch
between separate measurement indications and included measurement data.

Related: OS#2977
Depends: libosmocore I2c34b02d329f9df190c5035c396403ca0a4f9c42
Change-Id: I710d0b7cf193afa8515807836ee69b8b7db84a84
2020-01-20 14:35:19 +00:00
Vadim Yanitskiy e7d835ca8c L1SAP: use LOGL_DEBUG for logging from rach_pass_filter()
Due to relatively small training sequence of Access Bursts, there
can be frequent false-positives (basically noise). Fortunately,
we can distinguish them from the real Access Bursts by checking
the signal measurements attached to them (BER, ToA and C/I).

Let's reduce verbosity of logging messages as they are mostly
useful for debugging and may confuse the users / operators.

Change-Id: I7ab6727ffff00140a7f9e762b299b711481393f1
2020-01-14 03:51:08 +07:00
Philipp Maier 24e702b7d0 l1sap.c: ensure ms power control loop is running
When a bad SACCH frame is received the processing of the frame is ended
early and lchan_ms_pwr_ctrl() is not called. This means that the power
control loop does not get informed about a situation where the signal
level is very weak and increasing the ms power would make sense. In
order to ensure that the power control keeps working on lost SACCH
frames, lets call lchan_ms_pwr_ctrl() with the current RSSI and the
requested (BSC) power setting.

Related: OS#4281
Change-Id: I4fb85754b1a69376b02da7f4b175c6e8ec9cc35c
2020-01-03 13:03:49 +01:00
Philipp Maier 66c17cfc2d rsl: ensure measurement reports are sent
osmo-bts currently does not generate a measurement report in case the
SACCH of the related traffic channel is lost. This is a problem because
the moment when reception gets bad measurmenet reporting is crucial to
carry out handover decisions effectively.

The presence of a SACCH block controls the conclusion of the measurement
interval and the sending of the RSL measurement report. The latter one
not only requires a measurmenet indication, it also requires a fully
intact SACCH block.

Lets use the NOPE / IDLE indications from V1 of the TRXD protocol to
ensure a SACCH block is always reported up to l1sap.c. In cases where
the SACCH is bad, trigger the sending of the RSL measurement report
manually without attaching the measurmenet data from the MS (which we do
not have in this case)

Related: OS#2975
Depends: osmo-ttcn3-hacks Ib2f511991349ab15e02db9c5e45f0df3645835a4
Change-Id: Idfa8ef94e8cf131ff234dac8f93f337051663ae2
2020-01-03 12:56:00 +01:00
Pau Espin e1766f1b7d l1sap: is_fille_frame(): verify len of data compared
Change-Id: Id3d1725ff36091ed5c57927caad09a8baea6f52e
2019-12-23 18:27:47 +01:00
Harald Welte e571fd60e6 rach_pass_filter(): Add information about channel type
When logging about filtering access bursts, let's indicate if this is
on a CCCH, PDCH or handover related.

Change-Id: I03f21f2b54cbe5aad36ac71a614d5df98867df80
2019-12-04 16:40:30 +01:00