Commit Graph

2650 Commits

Author SHA1 Message Date
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 c9635b0ad1 osmo-bts-trx: refactor parse_rsp(), fix compilation warnings
For a long time, we see this annoying -Wstringop-truncation warning:

  In function ‘parse_rsp’,
      inlined from ‘trx_ctrl_read_cb’ at trx_if.c:647:6:
  trx_if.c:416:2: warning: ‘strncat’ output may be truncated copying
                  between 0 and 45 bytes from a string of length 1495
    416 |  strncat(rsp->cmd, buf_in + 4, p - buf_in - 4);
        |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There is no real need to use strncat() in parse_rsp(), because we
do not concatenate any strings but simply copy TRXC response parts
from the input buffer to the corresponding 'name' and 'parameters'
buffers.  Let's use memcpy() instead.  This also fixes the warning.

Change-Id: Ia10adf7d76abe9a423b07e828852fbfb53b95125
2021-04-30 21:07:41 +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
Vadim Yanitskiy f3e3a3ac99 osmo-bts-trx: reduce code nasting in trx_if_send_burst()
If the PHY is not powered on and we are not supposed to send any
bursts to it, then trx_if_send_burst() should just return early.

Change-Id: I578bd5a731ad88ebff283c75bb7eb268d9e7e787
Related: SYS#4895, OS#4941, OS#4006
2021-04-30 19:02:15 +00:00
Vadim Yanitskiy 67b141c567 osmo-bts-trx: assert PDU version in trx_if_send_burst()
If somehow the TRXC logic negotiates a non-supported TRXD PDU version,
then it's a serious bug in the code.  Let's add an assert() for that.

Change-Id: I301377bcebd5e2bbcfc18b3637253ef261bb5b2e
2021-04-30 19:02:15 +00:00
Vadim Yanitskiy 7651b078b1 osmo-bts-trx: enlarge and share TRXD message buffer
Starting from TRXDv2, several PDUs may be batched together and sent in
all together a single datagram.  This requires us to increase the buffer
size that we use for sending and receiving TRXD messages.  Let's use
65536 matching the default MTU value for 'lo' interface on Linux.

Given that 65536 is quite a big number, let's allocate a shared Rx/Tx
buffer statically to avoid [potential] stack overflow.

Change-Id: I729451c8ecdc7ff2631beb423f15523db16b3ee3
Related: SYS#4895, OS#4941, OS#4006
2021-04-30 19:02:15 +00:00
Vadim Yanitskiy 010841644b osmo-bts-trx: refactor handling of version specific TRXD parts
This is a preparatory change for the upcoming TRXDv2 support:

* move common TRXDv0/v1 header parser into a separate function;
* move burst handling into a single, version independent function;
** determine modulation and burst length in trx_data_parse_pdu_v0();

Change-Id: I7aedd85a8d4f6d6191cd3b75272a688208fb2879
Related: SYS#4895, OS#4941, OS#4006
2021-04-30 19:02:15 +00:00
Harald Welte 1896c8f03e manuals: Update copyright years
Change-Id: I353013ddfc8c5506599e723e713d93f3f041f15d
2021-04-30 08:24:00 +02:00
Harald Welte 75f56805e0 manual: Remove manual revision history; we don't use it anywawy
Change-Id: I25c4d8b694756c6eed81c9b552a389ca5bd04ea7
2021-04-30 08:24:00 +02:00
Harald Welte 134062e335 manual: Include QoS chapter and add osmo-bts specific example
Change-Id: I8fcd524c550b43a851b3094effc215e5203d28be
Requires: osmo-gsm-manuals.git Id344c29eda2a9b3e36376302b425e9db1f6c0f28
Requires: libosmo-abis.git I8991dd6eb406a5b9a70498974fc1ad339452f871
2021-04-30 08:24:00 +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
Neels Hofmeyr 9c321b8486 omldummy: add cmdline arg --features
The current usage is to make osmo-bts-omldummy indicate BTS_FEAT_VAMOS
on OML, so that we can test osmo-bsc's behavior when VAMOS is enabled.

Related: SYS#4895
Depends: I699cd27512887d64d824be680303e70fff3677c1 (libosmocore)
Change-Id: Ib50990109f07884ef999ba5a4566f5d1d457b0ae
2021-04-27 13:38:34 +00:00
Vadim Yanitskiy dd8439f889 osmo-bts-trx: pass 'struct phy_instance' to TRXD dissectors
All these functions need the PHY instance pointer for logging,
they don't really need a pointer to 'struct trx_l1h'.

Change-Id: I626b4392a8bc57a3fe5e8c931aa1ce9dd505676c
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:48:03 +00:00
Vadim Yanitskiy 8a99365281 osmo-bts-trx: generalize checking of TRXD header length
Change-Id: I7df851c3afb82133f84dc805e0926438a90efe07
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:47:56 +00:00
Vadim Yanitskiy ac55dcb5d0 osmo-bts-trx: cosmetic: get rid of TRX_CHDR_LEN macro
The 'CHDR' stands for 'Common Header', but this does not apply to
TRXDv2 because TDMA frame number may not be present in the batched
PDUs.  Let's avoid potential confusion by removing it.

Change-Id: I80495df474c432f4c0a4cfa6f917821d7b35859a
2021-04-24 08:47:00 +00:00
Vadim Yanitskiy 17350e2fd6 osmo-bts-trx: move TDMA frame number check to trx_data_read_cb()
Change-Id: Ib3c4a5ad7f16196dc5c591aa0b4d7e0ec3267f05
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:47:00 +00:00
Vadim Yanitskiy 974bf725a4 osmo-bts-trx: discard TRXD PDUs with unexpected version
Change-Id: Icdc3d12a7686428046113f9fa8f21a99569e651a
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:47:00 +00:00
Vadim Yanitskiy 16c2998069 osmo-bts-trx: move MTS parser into trx_data_parse_mts()
This would allow to re-use this code from the TRXDv2 parser.

Change-Id: I2de2cb2d58110452d8dedbcacfef28f85f6d67c1
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:47:00 +00:00
Vadim Yanitskiy b619da5e72 osmo-bts-trx: 'burst type' is actually modulation type
Burst type and modulation type are actually different things.

Change-Id: Ic06c96434ad32dd3770b88cb1fefcbefb2fc3928
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:47:00 +00:00
Vadim Yanitskiy 61fcfa6ae7 osmo-bts-trx: define TRXC/TRXD message buffer size
Change-Id: I4cb05600fa8af33e1c92e93cc1a86c14f21b9fb2
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:47:00 +00:00
Neels Hofmeyr 708fca343e omldummy: introduce using getopt_long
Prepare for adding the --features cmdline arg following in a subsequent
patch.

Related: SYS#4895
Change-Id: I72ccf65ba894e87ee7b0f6bed879f94728f34ccc
2021-04-22 20:45:02 +02:00
Neels Hofmeyr 823cd52964 Abis manual: add RSL_IE_OSMO_TRAINING_SEQUENCE
Change-Id: Ie583bd5969fdb45f772af198033e58d7c4077306
2021-04-22 20:45:02 +02:00
Neels Hofmeyr 7177e666bb Abis manual: add VAMOS to BTS features
Change-Id: I108e3300e96087f4be47bd9ea237a9d28982839f
2021-04-22 20:45:02 +02:00
Neels Hofmeyr 6072be9be4 Abis manual: add Get Attributes, add BTS features
Change-Id: I99631272334537ab49ba8c530240aaeb67dde9d7
2021-04-22 20:44:51 +02:00
Neels Hofmeyr 93b04aa4c3 Abis manual: s/TS 12.21/TS 52.021
Change-Id: I662a3419a6ec741fe162ccc7c7221df20b2780b1
2021-04-21 16:15:01 +02:00
Neels Hofmeyr b03ff89876 osmobts-abis.adoc: add missing bibliography
Change-Id: I6a86416466eba14090026a3e6ec82a0e8548209a
2021-04-21 16:15:01 +02:00
Vadim Yanitskiy b11012c1f5 osmo-bts-trx: cosmetic: use '#pragma once' in trx_if.h
Change-Id: I78b93a8f5fbbd94141d30518d37c1ce05f8a681f
2021-04-21 01:26:00 +02:00
Vadim Yanitskiy ab5cc5e6c5 osmo-bts-trx: remove outdated TRXD protocol documentation
We do have TRXC/TRXD documentation in osmo-gsm-manuals repository.
This big comment is out of sync with what we have in the manuals,
so let's better remove it to avoid maintaining docs in several places.

Change-Id: Ibfcefcbb5f30fe9b6c691578a93e6fedd5644b30
Related: SYS#4895, OS#4941, OS#4006
2021-04-21 01:26:00 +02:00
Vadim Yanitskiy 32ef94cac0 osmo-bts-trx: cosmetic: TRXD 'header version' -> 'PDU version'
TRXDv2 brings significant changes to the whole PDU structure, not
just the header.  Let's highlight this in the code / strings.

Change-Id: Id0274bd1ae5c419548596ed1852e6a28ec62b713
Related: SYS#4895, OS#4941, OS#4006
2021-04-21 01:26:00 +02:00
Vadim Yanitskiy 0b33ab8ac2 lchan2lch_par(): fix missing default branch in switch
New channel mode values have recently been added with change [1]
to 'enum gsm48_chan_mode'.  The lack of default branch in
lchan2lch_par() caused build failures on Jenkins:

  oml.c:956:2: error: enumeration value ‘GSM48_CMODE_SPEECH_V2_VAMOS’
                      not handled in switch [-Werror=switch]
  oml.c:956:2: error: enumeration value ‘GSM48_CMODE_SPEECH_V3_VAMOS’
                      not handled in switch [-Werror=switch]
  oml.c:956:2: error: enumeration value ‘GSM48_CMODE_SPEECH_V5_VAMOS’
                      not handled in switch [-Werror=switch]

This function is duplicated in osmo-bts-{lc15,oc2g,octphy,sysmo},
so we unfortunately need to apply the same fix to all copy-pasted files.

Change-Id: I557ff8cac6564d22485c101fba9212f5f0e95bb7
Related: [1] Ie0ea592da5610ae70290106d004e549cf3212a89
2021-04-20 22:50:14 +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 9cf65a7af5 manuals: document new 'gsmtap-remote-host' command
Change-Id: I7f75fbac77a612493ce187cfac3c4ae203c81b23
2021-04-18 06:53:33 +00:00
Vadim Yanitskiy 078682d7b5 manuals: remove deprecated command line parameters
Change-Id: Ie49abeb9647e3c8abdc9e110ab1a71c116f5def6
2021-04-18 06:53:33 +00: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 479ff386ff osmo-bts-trx: correct definition of 'osmotrx rx-gain' command
* Calling l1if_provision_transceiver_trx() yelds nothing.
* It does not apply immediately, full restart required.

Change-Id: I93c9e19d0543f19528cec842b8be332b4d93214e
2021-04-16 15:15:16 +00:00
Vadim Yanitskiy cabfbf470f manuals: document GSMTAP 'enable-all' / 'disable-all'
Change-Id: Iadbcf9d3184ab17c11c51e191aa3e80665839c22
2021-04-16 14:53:57 +00:00
Vadim Yanitskiy 1334316844 manuals: fix wrong VTY node for 'gsmtap-sapi' command
Change-Id: Ifcf1cf9cdbad40862d48415e004865a91a61d1b1
2021-04-16 14:42:55 +00: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
Vadim Yanitskiy 9dd7e3c907 osmo-bts-trx: fix segfault on trx_phy_inst_open() failure
If for whatever reason it fails to initialize the TRXD or TRXC
interface, trx_phy_inst_open() would return an error.  This
would cause bts_model_phy_link_open() to call trx_if_close()
on each of the PHY links, including those that were never
opened.  This leads to a segfault in trx_if_close().

Make sure that in trx_if_init() we properly init 'struct trx_l1h',
so it's safe to call trx_if_close() at any time and in any state.

Change-Id: I1f128813528f505fede04799e84456f6271058d0
2021-04-01 15:21:44 +00:00
Philipp Maier fd5151668c sched_lchan_tchh: fix frame number and fill FACCH gap
The measurement results / TCH indications that are handed when decoding
the TCH/H are off by two bursts. Since a measurement result / TCH block
is expected every two bursts anyway the problem can only be noticed when
a FACCH transmission is going on and the frame numbers of the BFI TCH
blocks appear to be missaligned towards the FACCH block.

The reason is that the incoming bursts are shifted into a 6 burst wide
buffer. The decoding functions always look at the beginning of that
buffer while the bursts are shifted into the buffer from the end. A
facch will always fit exactly in that buffer but TCH/H blocks are only
4 bursts wide and thereofre they need two additional bursts until they
reach the coverage of the decoding function. Lets fix this by putting
the correct frame number (from two bursts before) into the remap
functions in order to get the correct beginning of the block.

Since the FACCH transmission uses six blocks it takes out two TCH
blocks. This means that if we count the FACCH block we end up with a gap
of one TCH voice block. Lets generate a dummy measurement to compensate
the gap. This will also match the behavior of the osmo-bts-sysmo phy.

Change-Id: I1ad9fa3815feb2b4da608ab7df716a87ba1f2f91
Related: OS#4799
2021-03-27 18:37:55 +00:00
Vadim Yanitskiy ca1628fb7a osmo-bts-trx: fix: do not call trx_if_close() two times
It's called by trx_phy_inst_open() if trx_if_open() fails.

Change-Id: Ic672f865ab513043a58979471a254a59d44daa6d
2021-03-18 07:52:45 +01:00
Pau Espin 29c4f3173f bts-trx: reorder first timerfd schedule to decrease first timeout skew
By reordering the instruction, we scheduler the timerfd prior to
processing the FN on the upper layers. This means the first timerfd
expiration even will happen more inline with the expected time, that is,
CLOCK IND time + GSM_TDMA_FN_DURATION_nS.

Let T(trx_sched_fn) be the time spent executing function trx_sched_fn().
With previous order, the timerfd would have been scheduled later, which
in the end would mean expiration would happen at time CLOCK_IND +
GSM_TDMA_FN_DURATION_nS + T(trx_sched_fn), hence ending up with an extra
skew of T(trx_sched_fn) added by ourselves.
This extra skew added may be important specially at startup time (when
this code path is used), since usually the load in the system is high
and skew is usually already higher, which means helping crossing
unacceptable thresholds which may end up in osmo-bts-trx stopping with
"No clock from osmo-trx" reason.

Change-Id: Ie2ba35cd87f0bd4078ac3b4b5ec2eacad36c4258
2021-03-15 18:33:14 +01:00
Pau Espin 8593b38616 bts-trx: Drop duplicate set of last_clk_ind
These fields are always aready set by the only caller of the function
trx_setup_clock(), so there's no use in re-setting them.

Change-Id: Id8a7141984e07eb11abae08e0c63ae7ebc333511
2021-03-15 18:12:41 +01:00
Pau Espin 7a7beb9b35 bts-trx: Avoid submitting first data_ind with FN=0 to upper layers
It can happen that the first burst we receive after enabling the PDCH
channel (when PCU connects to the BTS) is bid!=0. As a result,
chan_state->ul_first_fn is never set and defautl value 0 in there is
passed to the upper layers. As a result, when the 2nd block is
transmitted, this time with correct FN, the PCU will see a huge jump in
FNs. Since in PDCH the bursts are always consecutive, let's simply use
bi->fn - 3 as a first_fn and be done with the issue.

Related: OS#5020
Change-Id: Ie982caeb29f3ffd880b44e88a89b85ea3e6e6947
2021-03-11 18:42:00 +01:00