Commit Graph

1474 Commits

Author SHA1 Message Date
Vadim Yanitskiy 178b92a108 trxcon: make burst pointer in trxcon_phyif_burst_ind const
The trx_data_rx_cb() needs to be modified because it's accessing and
modifying the receive buffer via the bi.burst pointer, which
becomes const after this patch.

Change-Id: I68773d247725a6dc2cbbc58b63c0fd19ffdb1a16
Related: OS#5599
2022-11-23 06:26:51 +07:00
Vadim Yanitskiy c568b9cebe trxcon: group Rx burst params into struct l1sched_burst_ind
Change-Id: I3363c38a43d2f54f846527b70cedac8fa57bcb27
Related: OS#5599
2022-11-23 06:26:48 +07:00
Vadim Yanitskiy bd492d830d trxcon: adjust coding style in l1sched_pull_burst()
Change-Id: I96a40fdbea5085999b9aeb98b418ae27132f6fda
Related: OS#5599
2022-11-22 23:22:21 +00:00
Vadim Yanitskiy b387df26c4 trxcon: rework l1sched_trigger(), split l1sched_pull_burst()
The key idea is to allow triggering the scheduler only for a specific
timeslot of a frame, while keeping the API for triggering all together.

Split off the main part from l1sched_trigger() to l1sched_pull_burst().
While at it, rename l1sched_trigger() to l1sched_pull_send_frame().

Change-Id: Ibb7f9d7de26733f21b0753a2c655a250286bf1f0
Related: OS#5599
2022-11-22 23:22:21 +00:00
Vadim Yanitskiy bb2b1d7657 trxcon: rx_sch_fn(): do not use sched->fn_counter_proc
Use the given Fn instead, no need to go that deep for it.  The
sched->fn_counter_proc is an internal field of the scheduler,
which is not necessarily holding a valid value when pulling
Uplink bursts synchronously via the Ready-to-Send PHYIF API.

Change-Id: I56027876b50e53b474c2f54ac216cd141142020e
Related: OS#5599
2022-11-22 23:22:21 +00:00
Pau Espin e9f24d734a host/layer23: Add modem app
This app will allow setting up a tun device to transmit/receive data
as a GPRS MS against a GSM network.

This is just the initial skeleton so that people can work on it further
in follow-up commits.

Related: OS#5503
Change-Id: I8a1121b3287da7d7330c30e3118affa8fd1da61b
2022-11-21 19:56:54 +01:00
Pau Espin dd03ea6a82 layer23/mobile: Add missing dependency cflags
The *_LIBS vars were already added, but the *_CFLAGS were missing.

Change-Id: If904589b33357395e10f078857979aaecf5dbf68
2022-11-21 18:16:09 +00:00
Vadim Yanitskiy 855d83fc2d trxcon: separate l1sched_clck_handle() from BURST.ind handling
Do not mix up Downlink burst handling with the clock delivery.  Add
a separate PHYIF API function and call it from the TRXC/TRXD PHYIF.

This way calling trxcon_phyif_handle_burst_ind() would not trigger
the internal timer-driven Uplink scheduler in libl1sched, letting
the underlaying PHYIF logic to pull Uplink bursts synchronously.

Change-Id: Ieeee25573d1142aec2fee28d884127f14573b681
Related: OS#5599
2022-11-20 07:24:25 +07:00
Vadim Yanitskiy 1a0ad45a5d trxcon: drop unneeded imports in trxcon_main.c
Change-Id: I2868f83f55a6cbf3efc59f35ab7666671d22cf93
2022-11-18 05:29:49 +07:00
Vadim Yanitskiy ff0b5ed75a trxcon: use 'trxcon_phyif_' prefix for the PHYIF API
Change-Id: Icd2fc41cb3f42a791bf619c5f7b8fa4154371ba4
Related: OS#5599
2022-11-18 05:23:36 +07:00
Vadim Yanitskiy 269fe14045 trxcon: move l1sched/phyif shim API to libtrxcon.la
Change-Id: I56701b471a6f1c30ffd107037c2b1aed65621b2c
Related: OS#5599
2022-11-18 05:16:34 +07:00
Vadim Yanitskiy 54a2ee5cef trxcon: reorganize the core logic into libtrxcon.la
This is needed for the integration with osmo-trx-ms.  It was decided
to run the scheduler within the transceiver process, so that we can
reduce scheduling latency.  The idea is to maintain trxcon as a sub-
module in osmo-trx.git and link osmo-trx-ms against the libtrxcon.

We cannot use hard-coded logging categoris in a library, so add new
API for setting them: trxcon_set_log_cfg().  Use DLGLOBAL by default.

Change-Id: Idf207947f620a7394e0a0e5bf2c37bcd8df64bbe
Related: OS#5599
2022-11-18 04:59:50 +07:00
Vadim Yanitskiy 394793b1c1 trxcon: abstract L1CTL codec from the l1ctl_server API
The L1CTL codec (implemented in l1ctl.c) is going to be part of the
upcoming libtrxcon, so let's uncouple it from the l1ctl_server API.

Change-Id: I8d80af240b0e57f76263907c552288d4184876c0
Related: OS#5599
2022-11-12 22:15:58 +07:00
Vadim Yanitskiy 724502d0f4 trxcon: use L1CTL_HEADROOM in l1ctl_alloc_msg()
The l1ctl_client_read_cb() is using L1CTL_HEADROOM, so let's avoid
inconsistency and use L1CTL_HEADROOM in the l1ctl_alloc_msg() too.

Change-Id: I248f8c662ae0836cba61fb708a5dc73c57131f4c
Related: OS#5599
2022-11-12 22:11:49 +07:00
Vadim Yanitskiy 7d1a2247fa trxcon: move trxcon_inst_{alloc,free}() to a separate file
Both functions are going to be part of the upcoming libtrxcon.

Change-Id: I98963a1da927581597f7a170239dfb8a87cba842
Related: OS#5599
2022-11-12 22:09:55 +07:00
Vadim Yanitskiy a7f399eb95 trxcon: move l1sched_logging_init() from l1sched.h to logging.h
Change-Id: I43e21ca8a14445548e1d359bb6f8a3e36cb65bfa
Related: OS#5599
2022-11-12 02:29:31 +07:00
Vadim Yanitskiy 13046f172d trxcon: cosmetic: s/trx_log_init()/trxcon_logging_init()/
Change-Id: I65ab1e6d3a3bea65aeb13ab286e33795ba57f1f3
Related: OS#5599
2022-11-11 18:26:32 +07:00
Vadim Yanitskiy c3916785d8 trxcon: cosmetic: rename trxcon.c to trxcon_main.c
Change-Id: Idc5f4217dd31b5bdcb364600f7b97d1f60e1ab6f
Related: OS#5599
2022-11-11 13:45:11 +07:00
Vadim Yanitskiy 4cf9004b96 trxcon: maintain full power scan state in the trxcon_fsm
Currently the trxcon_fsm is simply passing start and stop ARFCN values
(as received from the L1CTL peer) over the PHYIF, and expecting the
PHY to perform the measurements within the given range.  This approach
requires the PHY implementation to maintain some state internally.

Let's simplify the job of the PHY implementation(s) by maintaining the
power scan state in the trxcon_fsm and sending a PHYIF_CMDT_MEASURE
command for each ARFCN in the given start/stop boundaries separately.

Change-Id: Ic5f724a11e225b439ec10aed7697e3e03b7929e5
Related: OS#5599
2022-11-11 06:38:00 +00:00
Vadim Yanitskiy 9e1de2359e trxcon: configure.ac: call LT_INIT after setting CFLAGS
If $CFLAGS is empty prior to calling the LT_INIT, this macro will
set $CFLAGS to "-g -O2".  We don't want implicit flags out of
nowhere, so let's simply move the invocation of LT_INIT down below.

Change-Id: I8d8eb1e3428ffcb84ddd53230fada39328337d15
Related: OS#5749
2022-11-10 16:10:10 +00:00
Vadim Yanitskiy 9e9c1c6e29 trxcon: fixup: handle DATA.cnf/TRAFFIC.cnf via TRXCON_EV_TX_DATA_CNF
Found this problem while trying to build with "-flto":

  ../include/osmocom/bb/trxcon/l1ctl.h:21:5: error: type of
        'l1ctl_tx_dt_conf' does not match original declaration
  [-Werror=lto-type-mismatch]
     21 | int l1ctl_tx_dt_conf(struct l1ctl_client *l1c,
        |     ^
  l1ctl.c:288:5: note: type mismatch in parameter 2
    288 | int l1ctl_tx_dt_conf(struct l1ctl_client *l1c, bool traffic,
        |     ^

The trxcon_fsm is passing only two arguments to l1ctl_tx_dt_conf().
The 'traffic' flag is included in struct trxcon_param_tx_data_cnf,
so the 2rd argument is not needed and should have been removed.

Change-Id: Ifc538f940571172fa237ecb7000f3cfea3655edc
2022-11-10 16:10:10 +00:00
Vadim Yanitskiy 03ef0b4e9f trxcon: add handle_full_power_scan_req(), reduce code duplication
Allow TRXCON_ST_{FULL_POWER_SCAN->FULL_POWER_SCAN} state transition
so that we can call osmo_fsm_inst_state_chg() unconditionally.

Change-Id: I1ea69561a2d3cf73009c6244b1d0f090d744d7b2
Related: OS#5599
2022-11-08 04:34:34 +07:00
Vadim Yanitskiy 6fc090593d trxcon: move the trxcon_fsm related stuff into its own header
Change-Id: I32097b27f8de8d2b765a4399ad5fd3a1bdba85f4
Related: OS#5599
2022-11-08 04:34:28 +07:00
Vadim Yanitskiy 2b9935064b trxcon: add missing imports to trxcon.h
Change-Id: I0fa507e80a638ca7ed2ff421303e9722b33e20ea
Related: OS#5599
2022-11-08 04:33:26 +07:00
Vadim Yanitskiy 05be562b70 trxcon: abstract out trx_if.c from struct trxcon_inst
The PHYIF implementation shall not have direct access to the struct
trxcon_inst it belongs to.  All communication shall be done via the
abstract PHYIF interface (see <include/osmocom/bb/trxcon/phyif.h>).

* Introduce struct trx_if_params containing all necessary params.
* Make trx_if_open() accept a struct trx_if_params pointer.

Change-Id: I1a97c4c783ab671636ca33700eca97dede2a4a09
Related: OS#5599
2022-11-07 21:02:02 +00:00
Vadim Yanitskiy 5fbc7e50a9 trxcon: deliver measurement results via the PHYIF primitives
The PHYIF implementation shall not send events to the trxcon_fsm
directly.  The measurement command is sent in form of an abstract
PHYIF primitive (PHYIF_CMDT_MEASURE), so it's more logical that
the response is sent in form of a PHYIF primitive too.

Change-Id: Ie20616c288c16559d0a566979b24d57b50369fab
Related: OS#5599
2022-11-07 21:02:02 +00:00
Vadim Yanitskiy 6d2ea361e6 trxcon: trxcon_fsm.c: remove unused import of l1ctl_server.h
Change-Id: I81a877845160db3b9d6823091ac9243be0836729
2022-11-07 21:02:02 +00:00
Vadim Yanitskiy 1378b0d86f trxcon: l1ctl.h: remove unneeded import of l1ctl_proto.h
Change-Id: Ie66bb553cffd72a59d949979d8f97bacfc0bdad0
2022-11-07 21:02:02 +00:00
Vadim Yanitskiy 9ae0fb9339 trxcon: handle RACH.cnf via TRXCON_EV_TX_ACCESS_BURST_CNF
Change-Id: I64de7d4e8137041b373a9920296553fbfe8386d4
Related: OS#5599
2022-11-07 21:02:02 +00:00
Vadim Yanitskiy ecfff248ee trxcon: l1sched_handle_data_cnf(): make the cnf struct scoped
Change-Id: I526116c2a20970aee7881e19e283e083bc6b1911
Related: OS#5599
2022-11-07 21:02:02 +00:00
Vadim Yanitskiy 12ef3e4fc7 trxcon: handle DATA.cnf/TRAFFIC.cnf via TRXCON_EV_TX_DATA_CNF
We already handle DATA.req/TRAFFIC.req via TRXCON_EV_TX_DATA_REQ,
so let's handle the respective *.cnf messages via the FSM too.

Change-Id: Ica7a25f0bf8c7f89037a776d711ac641c57c9ad5
Related: OS#5599
2022-11-07 21:02:02 +00:00
Vadim Yanitskiy c65190bfac trxcon: merge TRXCON_EV_TX_TRAFFIC_* with TRXCON_EV_TX_DATA_*
It's not really necessary to handle signalling and traffic via
different events, so let's reduce complexity by merging them.

Change-Id: I8c2b3274f32d4d52424512d988b93d6233dd09a0
Related: OS#5599
2022-11-07 21:02:02 +00:00
Vadim Yanitskiy 01e0329243 trxcon: compose struct l1ctl_info_dl in l1ctl_tx_dt_ind()
The trxcon_fsm should not be dealing with the L1CTL protocol, so
let's better hand over the trxcon_param_rx_traffic_data_ind to
l1ctl_tx_dt_ind() and compose the l1ctl_info_dl there.

Change-Id: Ie57d86ffd9ea7c44187aafba0df1f519d1c523fb
Related: OS#5599
2022-11-07 21:02:02 +00:00
Vadim Yanitskiy 6df5177127 osmocon: add -Werror={implicit-int,int-conversion,old-style-definition}
Change-Id: I46bdc87ef07704369bdc3ccc03b384aac87fe2f7
2022-11-05 19:25:07 +07:00
Vadim Yanitskiy 136cf481c7 layer23: fix -Werror=old-style-definition problems
Change-Id: I0187acb02de6fd22ccc86c112640caa8aa3fa2bc
2022-11-05 19:18:42 +07:00
Vadim Yanitskiy 6ba147556b layer23: add -Werror={implicit-int,int-conversion,old-style-definition}
Change-Id: Ia6e0c717c782ea000f1d40ad11af2ee725f9c309
2022-11-05 19:10:55 +07:00
Vadim Yanitskiy 671ac36b11 layer23: configure.ac: print CFLAGS/CPPFLAGS using AC_MSG_RESULT()
Change-Id: Ib8d7138f7d5504176156ea5349336f5994c8fa80
2022-11-05 19:10:02 +07:00
Vadim Yanitskiy 9c922e5ef9 virt_phy: configure.ac: add --enable-werror
Change-Id: I081ae20bfc6ed5f2906756a956b9fba0ae8e55f1
2022-11-05 19:05:35 +07:00
Vadim Yanitskiy 8d7192673c virt_phy: support building with -Werror
Change-Id: Iccd2575faadee1ad3982466bf6a07fa5d52b0250
2022-11-05 19:05:15 +07:00
Vadim Yanitskiy 5bad174980 trxcon: configure.ac: add --enable-werror
Change-Id: Id9b561f59599e5eb0267e3baaa33bf9cdde22ea3
2022-11-05 18:59:41 +07:00
Vadim Yanitskiy 8d5efd7030 trxcon: drop sched->clock_cb(), expose l1sched_trigger()
It does not make sense to call function sched_frame_clck_cb() via
a configurable pointer in the l1sched_state.  Make this function
public (thus rename) and call it directly.  Remove the .clock_cb.

Having l1sched_trigger() globally available makes it possible to
call this function directly, bypassing the internal timer driven
clock module.  This is needed for the integration with osmo-trx-ms.

Change-Id: Ied0eed6d514acabb94d819b2f9485868390c0f24
Related: OS#5599
2022-11-02 16:14:12 +00:00
Vadim Yanitskiy b151ac30d5 trxcon: tune sched_clck related logging levels
Change-Id: Iad57d2d7158c6ff037630acaa08ae3b9940448e2
2022-11-02 16:14:12 +00:00
Vadim Yanitskiy bbe7363c6d trxcon: fix wrong format specifier used in trx_if_cmd_setfh()
Change-Id: Ie2d5621ebd31440ad6e1242cb990f1556a481248
Fixes: CID#282868, CID#282866
2022-11-02 01:11:51 +07:00
Vadim Yanitskiy d4b5f65b0b trxcon: l1ctl.c: remove unused headers
Change-Id: Ie2f320bf2ce9296db2c016d6ed7ddb54985e4089
2022-11-02 01:11:51 +07:00
Vadim Yanitskiy 731881712e trxcon: fixup: trx_if_cmd_poweroff(): do not complain if trx->powered_up
In commit [1] I introduced a regression by removing the conditional
part completely.  My intention was to remove the logging statement,
the return should be kept to prevent sending POWERON twice.

This regression affects the following TTCN-3 testcases:

* TC_sacch_chan_act_ho_async,
* TC_sacch_chan_act_ho_sync.

Change-Id: Iccd0bbac91a7899ef72df3dfe623b56eb66305fa
Fixes: [1] 1c75c0012b
2022-10-31 20:40:19 +07:00
Vadim Yanitskiy 1c75c0012b trxcon: trx_if_cmd_poweroff(): do not complain if trx->powered_up
With the introduction of the abstract PHYIF, the trxcon_fsm has lost
access to the internal state of the PHY, so now it may be sending the
PHYIF_CMDT_POWERON even if the PHY is already powered on.

Change-Id: Ib500c746430c9082a5fda342257cee7293f46ba0
Related: OS#5599
2022-10-31 05:31:00 +07:00
Vadim Yanitskiy c6324f8952 trxcon: implement an abstract PHYIF API
This change is aimed to simplify the integration of trxcon with
osmo-trx-ms by allowing to replace the TRXC/TRXD interface with
direct API calls.

Change-Id: I3d7c717cfc3616809d22efb1903abbf843594258
Related: OS#5599
2022-10-31 05:29:17 +07:00
Vadim Yanitskiy bdd5f61504 trxcon: use lookup tables for checking AMR CMI/CMR on Uplink
We already have the lookup tables for Downlink, so let's also add
the respective tables for Uplink.  This renders ul_amr_fn_is_cmi()
useless, so remove it together with the sched_utils.h file.

Change-Id: Ibc23b5a94bd37fba8d918ad6ee61b93a6290d8a3
2022-10-31 04:55:43 +07:00
Eric Wild 0f64b7c124 Revert "mobile/gsm48_rr.c: fix ACCH System Information parsing"
This reverts commit 1a8a80aeae.

We currently get ALL SI messages wrong - the protocol disseminator is
accidentally being used as SI msg type, and
6=radio resources management - but 6 is also type=si5ter.. so all SI we
receive end up being parsed as SI5, what a coincidence!

Change-Id: I3822f74295920680a935f3031c642ba00162d09d
2022-10-26 15:52:58 +00:00
Vadim Yanitskiy 31076646be trxcon: add new trxcon_fsm state - TRXCON_ST_PACKET_DATA
Change-Id: I7706d677c8966a6a7c6d452ae97eda84d4282ef5
2022-10-24 19:36:22 +00:00
Vadim Yanitskiy a20b9e20ed Revert "host/trxcon/trx_ic.c: use osmo_ubit2sbit() from libosmocore"
This reverts commit c5d9507b5d.

Using osmo_ubit2sbit() was a bad idea because this function treats
the input buffer as ubits (while we deal with usbits) and produces
absolute sbit values: either 127 or -127.  This is wrong, because
all intermediate usbit values are getting converted to -127.

This bug remained unnoticed so far because trxcon is mostly used in
combination with fake_trx.py, a virtual Um interface which simulates
ideal RF conditions by default and feeds trxcon with 'perfect' bits.

Change-Id: I3a32da19c9f419d51d55b301461ce28ce11b2249
2022-10-25 02:28:47 +07:00
Vadim Yanitskiy a7a6b1f344 trxcon: allow subsequent TRXCON_EV_FULL_POWER_SCAN_REQ
The remote L1CTL peer may send another L1CTL_PM_REQ message right
after getting L1CTL_PM_CONF from us.  Handle this properly.

Change-Id: I8e5fd778467567e8ca69ed420b9815073daa7e16
2022-10-25 02:28:47 +07:00
Vadim Yanitskiy 6dce788cd4 trxcon: give L1CTL API direct access to trxcon_fsm
The L1CTL interface logic currently gets access to the trxcon_fsm
via an associated struct trxcon_inst.  No other fields are used,
so we can pass trxcon->fi directly.  All communication shall be
done via the FSM anyway.

Change-Id: I5a15a676ce3917d2eddc44f1143cea8d3cd8781f
2022-10-25 02:28:47 +07:00
Vadim Yanitskiy aab53035d4 trxcon: gracefully exit on receipt of SIGTERM
Change-Id: Id33e598b5c7a7a474a383f815cdbda65b29d25a0
2022-10-25 02:28:40 +07:00
Vadim Yanitskiy 9ecd3585bb trxcon: configure.ac: set -std=gnu11
The majority of Osmocom projects require -std=gnu11, and so we do.

Change-Id: Ia22adb18ea34690ef8e46dbf02308cbb1541a7ee
2022-10-24 04:12:58 +07:00
Vadim Yanitskiy 1b0ff8ea6f mobile: check return value of gsm_arfcn2band_rc()
Change-Id: Ia5bc9f8bf4aa3ea7374c67e329db22612bb350ca
Fixes: CID#282374, CID#282375, CID#282376
2022-10-07 14:56:21 +07:00
Pau Espin a53e93fe9c trxcon: Initial support for forwarding AMR
This allows TTCN3 L1CTL module (used in BTS_Tests) to transmit and
receive AMR payloads towards osmo-bts-trx.

Related: SYS#5987
Change-Id: Ia20bc96e39726a919a556c83c8be48cb31af7331
2022-09-07 00:01:53 +07:00
Vadim Yanitskiy a8ace99d72 trxcon: cosmetic: alignment fix in trxcon_inst_alloc()
Change-Id: Icaab38b2b9e2885c4b3080140888d4b331578bb3
2022-09-03 01:10:24 +07:00
Vadim Yanitskiy 4244519cac trxcon: trx_if_open(): avoid using talloc_reparent()
For consistency with trxcon_inst_alloc():

* first allocate an instance of trx_fsm as a child of trxcon->fi,
* then allocate a trx_instance as a child of the trx_fsm.

Change-Id: Iafc486347c6ca7a80da88be73c772397fa2deb7d
2022-09-03 01:06:38 +07:00
Vadim Yanitskiy fc9d707900 trxcon: handle l1sched_config_req via TRXCON_EV_SET_PHY_CONFIG_REQ
Calling l1sched_free() from trxcon_fsm_pre_term_cb() may result in
l1sched_handle_config_req() being called when trxcon->phyif is NULL.

Handling l1sched_config_req via TRXCON_EV_SET_PHY_CONFIG_REQ guards us
against NULL pointer dereference during teardown of a trxcon_fsm
instance, if it's caused by TRXCON_EV_PHYIF_FAILURE.

Change-Id: I44bbc695e8a406a7acb9c163bf223f4ea966ea12
Related: OS#5599
2022-09-03 00:51:37 +07:00
Vadim Yanitskiy a400d87e1a trxcon: rework trxcon_inst cleanup logic, add trxcon_fsm_pre_term_cb()
* trxcon_inst_alloc(): allocate trxcon_fsm as a child of the given ctx.
* trxcon_inst_alloc(): allocate trxcon_inst as a child of trxcon_fsm.
* trxcon_inst_free(): move the cleanup logic to .pre_term() callback
  of the trxcon_fsm, represented by new trxcon_fsm_pre_term_cb().
* trxcon_allstate_action() properly handle TRXCON_EV_{PHYIF,L2IF}_FAILURE.

Change-Id: I5eb8ef6f62b1dc949dc60eaa558f123b3b93819c
Related: OS#5599
2022-09-03 00:50:58 +07:00
Pau Espin 56709b243d trxcon: Fix printf type
data_len is a size_t, and gcc warns about it.

Change-Id: Ib0c1bfefc0371b8cfb3b7a2e74a6980dd3987931
2022-09-01 13:06:58 +02:00
Vadim Yanitskiy c2d022d348 mobile: lapdm_channel_init() is deprecated, use lapdm_channel_init3()
Change-Id: I320381488046f9b1780a53b8d5d27e470da727c4
2022-08-30 12:00:04 +00:00
Vadim Yanitskiy c67a9a6a01 mobile: mobile_start(): fix grammar in logging messages
Change-Id: Ibe8afb6a79613096c4ace86cc44867d0e9f8de76
2022-08-23 20:32:56 +00:00
Vadim Yanitskiy 8f6338c4f5 mobile: fix description of 'test re-selection' command
Change-Id: I254effd067b64ae0bfe1afe646701c0c6ea942ea
2022-08-23 09:05:04 +00:00
Vadim Yanitskiy 8738627763 layer23: explicitly set chan_nr / link_id in L1CTL_RACH_REQ
The underlying L1 implementation uses both chan_nr and link_id to
determine a logical channel for sending an Access Burst.  If not
set (both 0x00), RSL_CHAN_RACH is assumed.  Indicate it implicitly.

Change-Id: Ia40f67920bd712e572b8ea5219eb83064106bd5d
2022-08-21 20:45:05 +07:00
Vadim Yanitskiy dd4d0d0354 layer23: use $(top_builddir) instead of relative paths
Change-Id: Ib2c9264b2a3cdef9b9852bdead94bae03185fec8
2022-08-21 20:45:05 +07:00
Vadim Yanitskiy 350b605e89 layer23: use $(top_srcdir) instead of relative paths
Change-Id: I320ed2295c0c8e12a46be416e3dbda8865987424
2022-08-21 20:45:05 +07:00
Vadim Yanitskiy 26edb66906 layer23: cosmetic: make Makefile.am files git-friendly
Change-Id: I26d7ff4ae278b5b465863252fe12ac1b46780dc7
2022-08-21 20:45:05 +07:00
Vadim Yanitskiy 15877ba051 trxcon: allow populating global SACCH cache via L1CTL
There is a time window between activation of a dedicated channel and
receipt of a L1CTL_DATA_REQ with the first RR Measurement Report, in
which trxcon may need to start transmission on Uplink SACCH.

In this case trxcon is using a dummy SACCH block with hard-coded L1
SACCH header values and hard-coded Measurement Results.  This mimics
behavior of the layer1 implementation in firmware for Calypso phones.

When running the mobile application, this error can be seen:

  DAPP ERROR trxcon(0)[0x55ee57bee1a0]{FBSB_SEARCH}:
             Event TRXCON_EV_RX_DATA_IND not permitted

which means that the mobile is sending L1CTL_DATA_REQ *before*
establishing a dedicated channel.  And this message contains an
RR Measurement Report.  The idea behind this is to populate the
SACCH cache in advance and thus avoid sending dummy values.

Let's allow the L2 apps populating SACCH cache before establishing
a dedicated connection using new TRXCON_EV_UPDATE_SACCH_CACHE_REQ.

Change-Id: I0f467fc07cf844cc73465f235b36ba7d00788c9f
Related: OS#5635, OS#5599
2022-08-09 10:21:17 +00:00
Vadim Yanitskiy 6c67848afd trxcon: rework TRXC/TRXD cleanup logic, add trx_fsm_cleanup_cb()
Change-Id: Ic599b51067cb5a331fca521a5b46ab0a2804e499
Related: OS#5599
2022-08-08 14:12:01 +07:00
Vadim Yanitskiy b3aece3239 trxcon: improve L1CTL connection related logging
* l1ctl_client_conn_close(): log "Closing L1CTL connection";
* l1ctl_client_read_cb(): more precise logging, use strerror().

Change-Id: Ie932513f93fd7f1a5f5e70f4d78235551f7599c8
Related: OS#5599
2022-08-08 14:11:21 +07:00
Vadim Yanitskiy 12d1b9788e trxcon: cosmetic: rename TRXCON_EV_{L1IF->PHYIF}_FAILURE
Basically, everything below layer 2 is layer 1.  Let's clarify the
domain of TRXCON_EV_L1IF_FAILURE by saying 'PHYIF' instead of 'L1IF'.

Change-Id: I9159492a04bc071b7b04d9b88d4e6fd13cc3af31
2022-08-08 13:55:37 +07:00
Vadim Yanitskiy a21f85619b trxcon: cosmetic: rename TRXCON_EV_SET_{PHY_}CONFIG_REQ
Make it clear that this event is used for setting *PHY* configuration.

Change-Id: Ib70ff0352b6fcb045d0f49535dfb0d273856f3c3
2022-08-08 13:53:32 +07:00
Vadim Yanitskiy 957661253e trxcon: l1sched: ensure n_bits_total is always initialized
Change-Id: I590cfe55365b7ad021a3d0925a0f1ea136e67125
Related: CID#205451
2022-07-30 17:25:27 +07:00
Vadim Yanitskiy b084e8569f trxcon: assert *ts is not NULL in l1sched_set_lchans
We cannot use ts->sched as logging context because ts is NULL.

Change-Id: I53b40b31f20fc9aefdfcac1406c465d226e5fde0
Related: CID#275337
2022-07-30 17:05:58 +07:00
Vadim Yanitskiy 2881889b87 trxcon: extended RACH != 11-bit RACH, correct logging messages
Change-Id: I7f977d5d2b68741a230c706f5b16cf307bc267d1
2022-07-29 20:35:19 +07:00
Vadim Yanitskiy 72da0554e8 trxcon: abstract out 'struct trxcon_inst' from L1CTL/TRXC/TRXD
This allows replacing L1CTL and/or TRXC/TRXD with something else.

Change-Id: I7282da6dd16216bb4295c4d18f993251defbdf0a
Related: OS#5599
2022-07-29 20:35:19 +07:00
Vadim Yanitskiy f8822e476d trxcon: move L1 params from struct trx_instance to trxcon_inst
Change-Id: Ifbd9bb17d63ab1d8712d0c8022a62117a48c6384
Related: OS#5599
2022-07-29 20:35:19 +07:00
Vadim Yanitskiy 3e023128dc trxcon: rework trxcon_fsm, move into a separate file
The original trxcon_fsm I wrote back in 2017 [1] was more like
a boolean flag, as there were only two states: IDLE and MANAGED.
Not surprising, given that until recently handling of multiple
L1CTL connections was not supported.  Now that we have this
implemented, lifetime of a trxcon_fsm instance is limited by
lifetime of a L1CTL connection, what renders the FSM useless.

This change removes the old 'boolean' trxcon_fsm and introduces
the new one, which will allows us to abstract the L1CTL interface
from the TRXC/TRXD interfaces, as well as the scheduler.  The new
FSM will also simplify development of the RLC/MAC layer for GPRS.

Change-Id: Ifaf63ead9dd180181358e771367b2a686ba159ca
Related: [1] I7ee6fc891abe5f775f5b7ebbf093181a97950dea
Related: OS#5599
2022-07-29 20:34:50 +07:00
Vadim Yanitskiy 40d66990e0 trxcon: trx_if_close(): power the transceiver off if needed
Currently it may happen that the transceiver (e.g. fake_trx.py) remains
powered on when we loose a L1CTL client connection.  This is going to
be fixed in change [1] re-implementing the trxcon_fsm.  For now let's
ensure that the transceiver is properly powered off by sending
"CMD POWEROFF" from trx_if_close().

Change-Id: I9c5178907304b36ec3de0ee31b7f7a9ed2e31c16
Related: [1] Ifaf63ead9dd180181358e771367b2a686ba159ca
2022-07-29 12:32:11 +00:00
Vadim Yanitskiy 38c4f7294b trxcon: make trx_if_cmd_setfh() accept const *ma
Change-Id: Id80b59260a24ccf8458c15ae8e191524a86a839c
2022-07-27 06:22:46 +07:00
Vadim Yanitskiy 57d0aa72e6 trxcon: make l1sched_start_ciphering() accept const *key
Change-Id: I042903d779b6fbae68951a94788a458bf5226046
2022-07-27 06:21:14 +07:00
Vadim Yanitskiy cea02697a9 trxcon: support handling of multiple L1CTL client connections
Change-Id: Id92e5b553487e4cf10ea291b487a3ef0c65d72ae
2022-07-26 00:50:27 +07:00
Vadim Yanitskiy 9734224875 trxcon: use trxcon->fi as the context in L1CTL logging
Change-Id: I7b923cb21638e6afc38deb7766955b43e49b60bb
Related: OS#5599
2022-07-26 00:50:26 +07:00
Vadim Yanitskiy cdc764d475 trxcon: pass fn_advance param via struct l1sched_cfg
Change-Id: I733761e46ffe03473f03f76f7612a548c9723d99
Related: OS#5599, OS#3761
2022-07-26 00:50:26 +07:00
Vadim Yanitskiy 029c9297a0 trxcon: pass lchan to tchh_block_dl_first_fn() for logging
Change-Id: I8fafd180e2539be860bf183782817690dcad2d7d
2022-07-26 00:50:26 +07:00
Vadim Yanitskiy 18d102d3d7 trxcon: make [l1sched_]tchh_block_dl_first_fn() static
Change-Id: Ic3b990aaa1a3a3e13a80a63e1933799e58e7158f
2022-07-26 00:50:26 +07:00
Vadim Yanitskiy 8f9e9806e6 trxcon: make l1sched logging configurable, use trxcon->fi as prefix
This change makes it possible to configure l1sched related logging:

* l1sched_logging_init() allows to configure logging categories for
  common and data messages (by default, DLGLOBAL is used);
* struct l1sched_cfg allows to configure a logging prefix to be
  used in l1sched messges (by default, 'l1sched[0x%p] is used)'.

Let's use osmo_fsm_inst_name(trxcon->fi) as the logging prefix.

Change-Id: I26da1a506b02502a3a6a887533c35fb09c13c429
Related: OS#5599, OS#3761
2022-07-26 00:46:43 +07:00
Vadim Yanitskiy 4a4bc0ed6e trxcon: get rid of DEBUG_DEFAULT, give an example
Change-Id: If2d2afb18238df89aa4cdaed9a38810f647b3189
2022-07-25 19:53:51 +07:00
Vadim Yanitskiy c582aedd91 trxcon: rename DTRX logging sub-system to DTRXC
This sub-system is used for TRXC related logging, so reflect this.

Change-Id: I33c8f81e37de7ee61809610e51405a96c93536ff
2022-07-25 19:53:51 +07:00
Vadim Yanitskiy 4f2d6c40d0 trxcon: ensure TRXD logging is actually using LOGPFSMSL()
This should have been done in [1], but somehow I forgot about TRXD.

Change-Id: Ia5124061fe391644267a6117ac2627cad7adf873
Fixes: [1] Ic253903e7b8635bb13e210acfe929c73f8870632
Related: OS#5599
2022-07-25 19:53:51 +07:00
Vadim Yanitskiy a986c466f0 trxcon: move osmocom/bb/{trxcon->l1sched}/l1sched.h
Change-Id: I41348b738cce9954afafa0952da050306838b908
Related: OS#5599, OS#3761
2022-07-23 16:30:26 +07:00
Vadim Yanitskiy 504f0293df trxcon: remove unused #includes in sched_lchan_common.c
Change-Id: I623b9d57258e19e4dd9d25e7432138b1379e5f4c
2022-07-22 18:35:18 +07:00
Vadim Yanitskiy 71eb55f3f9 trxcon: l1ctl_server_{start,shutdown}() -> l1ctl_server_{alloc,free}()
l1ctl_server_start() does not actually start the server, it simply
allocates memory and initializes it.  l1ctl_server_shutdown() does
the opposite.  Let's use more precise symbol names.

Change-Id: Ie039abdff3911c5b566c760b26c31203824c5764
2022-07-22 17:31:05 +07:00
Vadim Yanitskiy ae0bb5e1c7 trxcon: allocate memory in l1ctl_server_start()
Calling l1ctl_server_shutdown() whenever the server is not initialized
will result in accessing uninitialized values.  This can happen if we
goto exit before l1ctl_server_start() was called.

Initializing the server with zeroes is not an option, because we need
to initilize llist_head and osmo_fd structures with proper values.

Allocate and initialize struct l1ctl_server in l1ctl_server_start(),
deinitialize and free() in l1ctl_server_shutdown().

Change-Id: Idf13914fd0b0ae09b2ce5ece1f4203ebcae05d6e
Related: CID#275254
2022-07-22 17:31:05 +07:00
Vadim Yanitskiy 28b5934663 trxcon: fix NULL pointer dereference in trx_if_open()
Change-Id: Id40e758f6736773f7695c02bdb8974ee422b2e63
Related: CID#275253
2022-07-22 17:31:05 +07:00
Vadim Yanitskiy 78e5668d52 trxcon: remove unused #imports in sched_clck.c
Change-Id: I41e08c2a970334f87fa9fca8d21a55295b9eddc5
2022-07-22 17:31:05 +07:00
Vadim Yanitskiy 5f47751ddb trxcon: call osmo_timer_del() unconditionally
osmo_timer_del() does check if a timer is active internally.

Change-Id: I4ede5b19eeb847fe8fdaed52a8b5c801b3de209a
2022-07-22 03:21:22 +07:00
Vadim Yanitskiy 2a2babbeac trxcon: fix trx_if_close(): delete TRXC timer if it's pending
Change-Id: I669355ec03f67de437df2d3b822ed0a728b405d5
2022-07-21 18:03:17 +07:00
Vadim Yanitskiy 0e0d266812 trxcon: ensure are TRXC/TRXD logging is using LOGPFSML()
Change-Id: Ic253903e7b8635bb13e210acfe929c73f8870632
2022-07-21 18:03:17 +07:00
Vadim Yanitskiy 2576be0f63 trxcon: trx_if_open(): allocate trx->fi as a child of trxcon->fi
Change-Id: I19579d2a76c38ca972a4ca132a8e5e3bba876c67
2022-07-21 18:03:17 +07:00
Vadim Yanitskiy 5a8b0ad0ac trxcon: cosmetic: remove the '_fsm' postfix in trx_fsm.name
Change-Id: Ie867f7a59b9d9f423944606d43f2f854313053f7
2022-07-21 18:03:17 +07:00
Vadim Yanitskiy d451f0caea trxcon: cosmetic: rename 'trx->fsm' to 'trx->fi'
Make it cleaner that it's an FSM *instance*.

Change-Id: I688b903fe21086beca7fb86dcee90f6f751d7cc3
2022-07-21 18:03:17 +07:00
Vadim Yanitskiy c9a801e05c trxcon: get rid of GEN_MASK macro, define it locally
Change-Id: I9504f022ef1767276479f21b8228ac094d28a858
2022-07-21 18:03:17 +07:00
Vadim Yanitskiy 4c83590f1d trxcon: cosmetic: rename l1ctl_link.[ch] to l1ctl_server.[ch]
Change-Id: I91149087bac6c745253d99deae2e32275b446a39
2022-07-21 18:03:17 +07:00
Vadim Yanitskiy 506e9085e3 trxcon: rework L1CTL socket API to support multiple clients
Change-Id: I1cfc49f36ead6e2ba0a6110b0fb65c55412ef5e3
2022-07-21 18:02:56 +07:00
Vadim Yanitskiy a89492a4dd trxcon: move FBSB state from struct l1ctl_link to trxcon_inst
Ideally, FBSB procedure should be implemented as a state of trxcon's
FSM.  For now let's simply move the related fields to trxcon_inst.
Remove l1ctl_shutdown_cb() as it's not needed anymore.

Change-Id: I92b50cf1bb36886fbe3d6460af3c0b1c57256ae8
2022-07-21 17:37:36 +07:00
Vadim Yanitskiy 27900b3a2d trxcon: introduce and use struct 'trxcon_inst'
trxcon consists of the following three main components:

* the L1 TDMA scheduler (libl1sched),
* L1 interface (TRXC/TRXD over UDP),
* L2 interface (L1CTL).

In [1] and [2] the L1 scheduler was abstracted out from both L1
and L2 interfaces and separated into a library, so it does not
use the TRXC/TRXD nor L1CTL related API directly.

This change is the next step towards the goal of having all three
components abstracted from each other.  Moreover, this patch brings
us closer to another goal of being able to support multiple L1CTL
connections (each having its own scheduler).

The idea is to give both L1 and L2 interfaces access to the
'trxcon_inst' structure, which basically groups all three components
mentioned above into a single piece.  The end goal is to eliminate
direct interaction between the interfaces, and the scheduler, so that
one could easily replace TRXC/TRXD and/or L1CTL with something else.

Change-Id: I23319951c56577085e1092669b5534f9d6bda48d
Related: [1] I31f77976a7a225ef292fe6dcd583513aec97ed44
Related: [2] I001fb7bc2663eea308b5a8882746ed9863f2c2f8
2022-07-21 17:37:36 +07:00
Vadim Yanitskiy e1740e2fc8 trxcon: use 'unsigned int tn' for timeslot number
Timeslot Number can never be negative, so let's use unsigned.
Rename the counter to 'tn' for consistency with other projects.

Change-Id: I93b5a91341e7f79ced0591e13250632ba5e5adef
2022-07-21 17:35:12 +07:00
Vadim Yanitskiy 94bb69ab3c trxcon: cosmetic: s/app_evt_names/trxcon_fsm_event_names/
Change-Id: Iae0e753eddb7e0a1767e555653c9e9fdb58b7a7b
2022-07-21 17:35:12 +07:00
Vadim Yanitskiy fd039d4571 trxcon: fix coding style in statements applying inverted mask
Change-Id: I28b9fc34e0d40b02d0ca56e9e0bf4463cf4ff336
2022-07-21 17:35:12 +07:00
Vadim Yanitskiy 93fe00d29c trxcon: tune hard-coded logging parameters (filename)
Change-Id: I241cff113a513799d3da0c9991354ea9ea889bb6
2022-07-20 13:48:58 +00:00
Vadim Yanitskiy 682341738d trxcon: cosmetic: use ARRAY_SIZE() whenever appropriate
Change-Id: I2a246bad8d11ed45fbf849de961713ab96907d83
2022-07-18 20:34:02 +07:00
Vadim Yanitskiy c4aa60317d trxcon: cosmetic: s/ts_list/ts/ in struct l1sched_state
Change-Id: I182b2a3ae1dcb1671aaaed9394cdfea34f7966a9
2022-07-18 20:34:01 +07:00
Vadim Yanitskiy 43cd9f270d trxcon: cosmetic: s/state/clck_state/ in struct l1sched_state
Change-Id: I8a1b971abaf06c0b1339895cf1748c5eb21d45e6
2022-07-18 20:34:01 +07:00
Vadim Yanitskiy 68b6ef33ce trxcon: add missing #include for enum gsm_phys_chan_config
Change-Id: I850b9a5c34fc39829c464b563f1a78ef4e8a1dd5
2022-07-18 20:34:01 +07:00
Vadim Yanitskiy 593beee3d8 trxcon: get rid of init_defaults(), init app_data in place
Change-Id: Id59df37b249f21cd7ea7a411ab2445ffc2dae8cc
2022-07-16 04:14:20 +07:00
Vadim Yanitskiy d6525cb172 trxcon: make trxcon_gsmtap_send() static
Change-Id: I632077af0d4cd16a9f27d5a6d07a0b12575b4350
2022-07-13 02:09:25 +07:00
Vadim Yanitskiy 9523cdd4d3 trxcon: send proper slot type in TRXC SETSLOT messages
Change-Id: I42f5620b50beb7df0a3463d70c1f48d041006371
Related: OS#5599
2022-07-12 19:29:13 +07:00
Vadim Yanitskiy fb26115d71 trxcon: separate the scheduler into libl1sched.la
Change-Id: I001fb7bc2663eea308b5a8882746ed9863f2c2f8
Related: OS#5599, OS#3761
2022-07-12 19:29:13 +07:00
Vadim Yanitskiy 8428b1ea0a trxcon: abstract out the scheduler API from L1CTL/TRXD/TRXC
Change-Id: I31f77976a7a225ef292fe6dcd583513aec97ed44
Related: OS#5599, OS#3761
2022-07-12 19:29:13 +07:00
Vadim Yanitskiy 97006ff1bd trxcon: make l1ctl_tx_dt_ind() accept const pointers
Change-Id: I34f665a39c7d036efd4cbe335084fbe21142a48c
Related: OS#5599, OS#3761
2022-07-12 03:03:17 +07:00
Vadim Yanitskiy f5804d7631 trxcon: use abstract API for RACH primitives
Using L1CTL specific structures as the primitive payload was a
beautiful hack in the early days of trxcon.  But since we're
going to separate the scheduler into an interface independent
library, we have to introduce and use an abstract API.

Change-Id: I84597d44ea7d74b8840a919ecb09988ba1980a73
Related: OS#5599, OS#3761
2022-07-12 03:03:17 +07:00
Vadim Yanitskiy bac9387bba trxcon: allocate a prim in l1sched_prim_push()
Make l1sched_prim_alloc() private and call it from l1sched_prim_push().
This makes the API more convinient, because both functions are always
used together.

Change-Id: Ia9c0170fb06efcef569e987b57ab9ab7f7c7e847
Related: OS#5599, OS#3761
2022-07-12 03:03:17 +07:00
Vadim Yanitskiy b1125910c1 trxcon: fix uint8_t used for length in l1sched_prim_alloc()
Using uint8_t makes it impossible to allocate primitives with payload
of size 255 - sizeof(struct l1sched_ts_prim) and greater.

Change-Id: Ic19b8433118798f57500119f1caf10e117e5db19
Related: OS#5599, OS#3761
2022-07-12 03:03:17 +07:00
Vadim Yanitskiy 8abb8026c2 trxcon: return prim pointer from l1sched_prim_alloc()
Returning prim pointer is more convinient from the API point of view.

Change-Id: I0fa41cf55e90d191d032bca1754941cca763b03e
Related: OS#5599, OS#3761
2022-07-12 03:02:31 +07:00
Vadim Yanitskiy 98b5895200 trxcon: rename l1sched_prim_init() to l1sched_prim_alloc()
The current function name is confusing, because l1sched_prim_init()
is not only initializing a primitive, but also allocating it on heap.
Let's use '_alloc' instead of '_init' to reflect that.

Change-Id: Ie1bebb6829ba9f640455685fcd7309b6aa442ef0
Related: OS#5599, OS#3761
2022-07-12 02:55:22 +07:00
Vadim Yanitskiy a699cc6846 trxcon: remove unused include of 'logging.h' from 'l1sched.h'
Change-Id: I52e1b93e3f1f5e52beeb17ff27c2a83e24d25a96
Related: OS#5599, OS#3761
2022-07-11 05:12:16 +07:00
Vadim Yanitskiy eff2d52e75 trxcon: merge 'sched_trx.h' and 'scheduler.h' into 'l1sched.h'
Change-Id: Ide1e3ccdf32fdc255acc943e0c0936d15cf0c680
Related: OS#5599, OS#3761
2022-07-11 05:12:16 +07:00
Vadim Yanitskiy 38373ee20f trxcon: use 'l1sched_' prefix for scheduler API
Change-Id: I370aa5084a4e3eb94168b96df94dbbee606adaab
Related: OS#5599, OS#3761
2022-07-11 05:12:16 +07:00
Vadim Yanitskiy f73db50f6b trxcon: rename 'enum trx_lchan_type' and its items
Change-Id: I76a7d9fed3d6ab47725fceb803aa16ddbfd2e1a2
Related: OS#5599, OS#3761
2022-07-09 23:56:18 +07:00
Vadim Yanitskiy 19ad5c9256 trxcon: remove '\brief' marker from the comments
This marker is not required to be present in Doxygen comments.

Change-Id: If793037e2b2bc9b708617867a4d4ddb0fa2f1ddb
2022-07-04 17:41:09 +07:00
Vadim Yanitskiy 259314abae trxcon: group *.c files into 'src' directory
Change-Id: I1a3703e48507cd51cd8198f13b993f54c44bc41e
Related: OS#5599, OS#3761
2022-07-04 17:41:09 +07:00
Vadim Yanitskiy b7335dfe79 trxcon: group header files into 'include/osmocom/bb/trxcon'
This is the first step towards the goal of moving the scheduler
into a separate library.

Change-Id: Ifa6137c239c215a3d323213ee74d34b419622be4
Related: OS#5599, OS#3761
2022-07-02 19:02:49 +07:00
Vadim Yanitskiy 57ce62f4bc trxcon: Makefile.am: fix make {dist,distcheck} targets
File '.version' must be also listed in EXTRA_DIST, otherwise I get:

  echo 0.0.0 > ../../.version-t && mv ../../.version-t ../../.version
  /bin/sh: line 1: ../../.version-t: Permission denied

Change-Id: I65f7c505f5a231bab114c45f5fdd7421601dfbc0
Related: OS#5599, OS#3761
2022-07-01 19:34:21 +07:00
Vadim Yanitskiy d75cc116e2 trxcon: Makefile.am: move versioning magic to the bottom
This is a more usual place for manually added targets.

Change-Id: I69892f8689fd7062ca26b6f1337c972b11b1906e
Related: OS#5599, OS#3761
2022-07-01 19:19:23 +07:00
Vadim Yanitskiy 095b360bc8 layer23: chantype_rsl2gsmtap() is deprecated, use chantype_rsl2gsmtap2()
Change-Id: Id54b973cec8479fc32775be260f8a9fac8f09bae
2022-05-13 23:16:42 +03:00
Vadim Yanitskiy 2ac370830f trxcon: clarify L1CTL_DM_REL_REQ related logging
In reality, trxcon does not switch back to BCCH itself.  Neither
the firmware does, so let's correct this confusing log message.

Change-Id: Iad308ad980af4caa7d7d1b358ba7288885f96e04
2022-05-13 23:16:42 +03:00
Oliver Smith e634dec487 mobile/subscriber.c: fix auth resp with test sim
Do not send a dummy authentication response with the test sim.

Fixes: 39dc9c46 ("mobile/subscriber.c: consider GSM_SIM_TYPE_SAP too")
Change-Id: I0ee910c171d383fb2cdcaf5eb54eafe18da3430b
2022-02-23 17:59:32 +01:00
Oliver Smith 1741372556 treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: I73be012c01c0108fb6951dbff91d50eb19b40c51
2021-12-14 12:52:04 +00:00
Harald Welte da2793a216 gprsdecode: Don't leak memory in gsmtap_sendmsg()
Change-Id: Ib9e439ad6f24c573abb6da1523713a669898d23f
Depends: libosmocore I106b09f2a49bf24ce0e8d11fd4d4ee93e9cafdf5
Related: OS#5329
2021-11-25 15:40:02 +01:00
Philipp Maier 0af84f408d logging: use meaningful default loglevels
Some logging categories use LOGL_INFO or even LOGL_DEBUG. Lets set those
to LOGL_NOTICE to have a less crowded default log output.

Change-Id: I3faefccae2218b17bd942bc2afac7d8e515897b7
Related: OS#2577
2021-11-15 17:12:22 +00:00
Harald Welte 3e8518a44b layer23/osmocon: require libosmocore >= 1.5.0 in configure.ac
This should give a meaningful error message if people use too old
libosmocore.

Change-Id: I7d9950b5eaa836ed1ac86045bd5364fed221e369
2021-10-16 10:55:33 +02:00
Harald Welte 98219554b6 262-10 is "DB Netz AG" and not "DB Systel"
Change-Id: Idbce4bade4305fabbedcf15c5bd9253fbb371744
2021-10-08 05:46:57 +00:00
Vadim Yanitskiy 2308b58250 trxcon/scheduler: unify and enrich decoding error messages
Regarding the removal of burst_mask2str() from the TCH/H handler,
it does not make sense to print it because the mask is already
shifted and an earlier logging should already contain this info.

Change-Id: I42d20e2da73c21ca366dd246244cd716c8ccb459
Related: OS#4823
2021-07-04 20:02:53 +02:00
Vadim Yanitskiy f8bc28505f trxcon/trx_if: send NOPE indications if there is no burst
In a typical setup operating on the real radio interface, it's
the duty of the transceiver (e.g. osmo-trx) to send NOPE.ind to
the L1 implementation (e.g. osmo-bts-trx).  However, in a
virtual environment for ttcn3-bts-test we use a fake transceiver,
which due to its simplicity cannot send NOPE indications itself.

The lack of queues and buffering does not allow us to implement
NOPE indications in fake_trx.py, so the easiest approach is to
generate them from trxcon.  Send TRXD PDUs without the burst bits,
and fake_trx.py will tranform them info NOPE.ind for us.

Change-Id: I1c7f1315b8ef44f651efd6a22fb5b854f65c0946
Related: SYS#5313, OS#1569
2021-06-16 15:55:38 +02:00
Vadim Yanitskiy 529d54b13a trxcon/scheduler: introduce and use struct sched_burst_req
Similar to what we do in osmo-bts-trx, group everything related to
an Uplink burst into a structure.  Pass a pointer to this structure
to the logical channel handlers.  This makes the code easier to read,
and facilitates sending NOPE indications to the transceiver
(will be introduced in the upcoming patch).

Get rid of sched_trx_handle_tx_burst(), and instead just call
sched_trx_a5_burst_enc() directly from sched_frame_clck_cb().

Change-Id: Id45b27180c233fdc42ae1ef0b195554dd299a056
Related: SYS#5313, OS#1569
2021-06-16 15:55:32 +02:00
Vadim Yanitskiy c652349b4a trxcon/scheduler: cosmetic: move TDMA frame number calculation
Change-Id: I79efdfa543d37889dc6749eb25aab4e1639749c6
2021-06-16 15:05:51 +02:00
Vadim Yanitskiy 825716851e host/layer23/ccch_scan: skip CCCH frames with wrong length
It's not clear why do we get frames with unexpected length, but
we definitely should not crash.  Just log and ignore them.

Change-Id: I85392becbffdb3ba7365decfd8f3769abe3c02c7
Related: OS#5171
2021-06-09 22:51:07 +02:00
Vadim Yanitskiy e9b0d7488f trxcon: fix legacy length expectations for TRXDv0 Rx PDUs
158 is basically: 8 + 148 + 2, where the last two are padding bytes
sent by legacy TRXDv0 transceivers.  We don't need them, so do not
drop PDUs without these leggacy padding bytes.

Change-Id: I6c0734bc4669ccde2a93940c9cf50fdbbd67cb00
2021-04-29 14:33:25 +02:00
Pau Espin 5c3c28cc1d tests: Replace deprecated API log_set_print_filename
Change-Id: I9d24365d2be528477f1c190c698a81bfc7f2d2df
2021-02-19 14:16:53 +01:00
Vadim Yanitskiy a7298e316f trxcon/scheduler: invalidate hard-coded Measurement results
This is what trxcon sends to the network before the first SACCH
block is received from the higher layers.  The indicated values
are of course invalid because they're hard-coded.

According to 3GPP TS 44.018, table 10.5.2.20.1:

  0  The measurement results are valid
  1  The measurement results are not valid

Change-Id: I7da767e146aec7cef1de71e4d735d6a02b6c5642
Related: SYS#4918
2020-11-30 16:06:48 +01:00
Vadim Yanitskiy 1ae959fe25 trxcon/scheduler: clarify the content of Measurement results
Change-Id: I26546dcbc853166e351d00260936b1b9d584ae03
2020-11-30 16:00:13 +01:00
Vadim Yanitskiy a7b6dea829 trxcon/scheduler: clarify Measurement results padding
Table 10.5.2.20.0 "Measurement Results Contents" in 3GPP TS 44.018
is clear on what should be used as padding - '0**', i.e. zeroes.

Change-Id: I4db6845c98aded10291134f416da98fd0f4f58e3
2020-11-30 14:33:07 +01:00
Pau Espin e5a9077dbd mobile: generate coredump and exit upon SIGABRT received
Previous code relied on abort() switching sigaction to SIG_FDL +
retriggering SIGABRT in case the signal handler returns, which would
then generate the coredump + terminate the process.
However, if a SIGABRT is received from somewhere else (kill -SIGABRT),
then the process would print the talloc report and continue running,
which is not desired.

Change-Id: Ied0f47378a5d348b857424adb5c874c1c093b485
Fixes: OS#4865
2020-11-25 18:45:26 +01:00
Pau Espin efb88bf5ff trxcon: generate coredump and exit upon SIGABRT received
Previous code relied on abort() switching sigaction to SIG_FDL +
retriggering SIGABRT in case the signal handler returns, which would
then generate the coredump + terminate the process.
However, if a SIGABRT is received from somewhere else (kill -SIGABRT),
then the process would print the talloc report and continue running,
which is not desired.

Change-Id: I6d80f3f2742d397e47f4f2970c951f2cf6d58172
Fixes: OS#4865
2020-11-25 18:44:46 +01:00
Pau Espin 581cfbeba9 trxcon: Handle signal SIGABRT
The signal handler was coded as if it was handling SIGABRT, but the
signal handler was not overwritten so it is actually used.

Change-Id: I5c597f3410fc97be138db6f3976df59f393819b6
2020-11-25 18:42:09 +01:00
Harald Welte c6fb802252 Use osmo_fd_*_{disable,enable}
Change-Id: If4c7f946852d153bd472e5c704f8d517d26ca22e
Depends: libosmocore.git Idb89ba7bc7c129a6304a76900d17f47daf54d17d
2020-11-11 20:14:58 +00:00
Harald Welte 00d1223d05 Use osmo_fd_*_{disable,enable}
Change-Id: I65d37821873767e61a7eca029f9b30938a299683
Depends: libosmocore.git Idb89ba7bc7c129a6304a76900d17f47daf54d17d
2020-11-11 20:14:45 +00:00
Vadim Yanitskiy 082b618ea4 trxcon/l1ctl_link: use osmo_store16be() in l1ctl_link_send()
Change-Id: I96ca1c581d028a1f3c89c83a575fd8dbc9751962
2020-11-05 13:36:43 +07:00
Harald Welte 7c34854880 osmocon: More decoding of tpu_debug (on compal/rffe_dualband)
Let's give a more human-readable decode of the TPU instructions,
naming the TSPACT pin names as well as the device_id/strobe.

Change-Id: Iac1ac74ac3e41cff9d3d347a167b43af58cc6e59
2020-10-25 09:38:08 +01:00
Harald Welte 46cf9b1043 gsm48_rr: Don't swap ber with snr in "MON:" log line
I was quite confused why I constantly see a bit error rate reported
by gsm48_rr, while at the same time the actual L1CTL_DATA_IND did
all state num_biterr == 0.

So the log statement was broken ...

Change-Id: I09bb6c606a8437b213bb444949c78a7c8a10542c
2020-10-23 23:32:10 +02:00
Harald Welte d90ae30caa mobile: Use osmo_fd_setup() in script_lua.c
Change-Id: Ib6f97b9b8f3af63b81b92071b7fdb1fd55da89a5
2020-10-21 11:56:43 +00:00
Vadim Yanitskiy 2c0d9cdcc2 trxcon/l1ctl: fix: send confirmation for TCH mode request
Both REQ and CNF share the same message structure, so we can
cheat a bit by changing the message type and sending it back.

Change-Id: I6f403ed0506b4b1872361d9976d3186bfe514b52
Related: OS#4799
2020-10-19 21:07:26 +07:00
Harald Welte de31aa3af7 Use osmo_fd_setup() whenever applicable.
Change-Id: If9b636c295fc6b5349a54c70662f09efa616ee63
2020-10-18 23:34:46 +02:00
Harald Welte 508d8523c0 Use OSMO_FD_* instead of deprecated BSC_FD_*
Change-Id: Ibf64b18288b9109927035f650d6ef7ad9f15d688
2020-10-18 22:43:05 +02:00
Vadim Yanitskiy 39264cc3a8 fix trx_if_tx_burst(): do not drop Uplink bursts in TRX_STATE_RSP_WAIT
Some commands, such as SETTA or SETPOWER, are expected to be sent
when the transceiver is powered on.  We should not drop Uplink
bursts while waiting TRXC response.

For now it's easier to comment out the state check completely,
because the existing TRXC state machine is quite messy.

Change-Id: Iefe6030200b11b29a5790d1f4aa4070ed1d9a493
2020-10-16 23:08:38 +07:00
Vadim Yanitskiy e42e5a0789 layer23/cbch-sniff: fix: use Osmocom specific RSL channel number
This way the layer1 can activate proper CBCH task and send us
CBCH block with proper RSL channel number, so they do not end
up being routed to LAPDm and rejected there.

Change-Id: Ib1d5c99587202a9d94aeb7b63de7ae8c4fb15af0
2020-10-13 08:46:11 +00:00
Vadim Yanitskiy 3c39ba4b94 layer23/cbch-sniff: fix: do not blindly assume presence of CBCH
We cannot blindly assume that CBCH is present on TS0/SDCCH4 before
decoding CBCH Channel Description in System Information Type 4.

Change-Id: Ie8ce572df292d0b03c0f743bcf26184619176321
2020-10-13 08:46:11 +00:00
Vadim Yanitskiy 8194febb09 layer23/mobile: implement handling of TCH test loop commands
For more information, see 3GPP TS 44.014, sections:

  - 5.1 "Single-slot TCH loops", and
  - 8 "Message definitions and contents".

This feature has nothing to do with the Mobility Management, so
let's handle GSM48_PDISC_TEST messages in the Radio Resources
layer implementation (gsm48_mm.c -> gsm48_rr.c).

Change-Id: If8efc57c7017aa8ea47b37c472d1bbb1914389ca
2020-07-31 00:48:06 +07:00
Vadim Yanitskiy 8208a336ab layer23/mobile: fix a memory leak (msgb) in gsm48_rr_data_ind()
Change-Id: I55dcccf5b7d27d012908759954182eaec434d26b
2020-07-30 16:46:50 +07:00
Vadim Yanitskiy df2b46471d layer23/mobile: fix wrong message type in gsm48_rr_tx_rr_status()
Change-Id: I57c6a4e1e725da52c50e2a28e56627a3f3827c62
2020-07-30 16:07:27 +07:00
Vadim Yanitskiy e7e4d86f0e layer23/mobile: cosmetic: use GSM48_PDISC_TEST from gsm_04_08.h
Change-Id: Ie1f14b37f6138f5a019a25bdbc8a3531418df6c2
2020-07-29 03:58:23 +07:00
Vadim Yanitskiy 9d24c54f82 trxcon/scheduler: reduce default Uplink burst scheduling advance
In general, premature scheduling of to be transmitted bursts
inevitably increases the time delay between Uplink and Downlink.
The more we advance TDMA frame number, the greater gets this
delay.  20 TDMA frames is definitely more than a regular
transceiver needs to pre-process a burst before transmission.

Change-Id: Ia9b142b59d95f2cd7b2394596cf72c0bcd36d711
Related: OS#4487
2020-07-13 05:00:23 +07:00
Vadim Yanitskiy d39b841059 trxcon/scheduler: check TDMA frame order, drop out of order bursts
When running together with fake_trx.py (mostly used back-end), it
is currently possible that Downlink bursts are received in a wrong
order if more than one transceiver is configured (multi-trx mode).

This is how it looks like:

  DTRXD DEBUG trx_if.c:612 RX burst tn=3 fn=629 rssi=-86 toa=0
  DSCHD DEBUG sched_lchan_tchf.c:60 Traffic received on TCH/F: fn=629 ts=3 bid=1
  DTRXD DEBUG trx_if.c:612 RX burst tn=3 fn=630 rssi=-86 toa=0
  DSCHD DEBUG sched_lchan_tchf.c:60 Traffic received on TCH/F: fn=630 ts=3 bid=2
  DTRXD DEBUG trx_if.c:612 RX burst tn=3 fn=631 rssi=-86 toa=0
  DSCHD DEBUG sched_lchan_tchf.c:60 Traffic received on TCH/F: fn=631 ts=3 bid=3

  DTRXD DEBUG trx_if.c:612 RX burst tn=3 fn=633 (!) rssi=-86 toa=0
  DSCHD NOTICE sched_trx.c:663 Substituting (!) lost TDMA frame 632 on TCH/F
  DSCHD DEBUG sched_lchan_tchf.c:60 Traffic received on TCH/F: fn=632 ts=3 bid=0
  DSCHD DEBUG sched_lchan_tchf.c:60 Traffic received on TCH/F: fn=633 ts=3 bid=1

  DTRXD DEBUG trx_if.c:612 RX burst tn=3 fn=632 (!) rssi=-86 toa=0
  DTRXD NOTICE sched_trx.c:640 Too many (>104) contiguous TDMA frames elapsed (2715647)
                               since the last processed fn=633 (current fn=632)

so here a burst with TDMA fn=633 was received earlier than a burst
with TDMA fn=632.  The burst loss detection logic considered the
latter one as lost, and substituted it with a dummy burst.  When
finally the out-of-order burst with TDMA fn=632 was received, we
got the large number of allegedly elapsed frames:

  ((632 + 2715648) - 633) % 2715648 == 2715647

Given that late bursts get substituted, the best thing we can do
is to reject them and log an error.  Passing them to the logical
channel handler (again) might lead to undefined behaviour.

Change-Id: I873c8555ea2ca190b1689227bb0fdcba87188772
Related: OS#4658, OS#4546
2020-07-12 21:43:46 +07:00
Vadim Yanitskiy bb0609ed48 trxcon/scheduler: fix subst_frame_loss(): do not compensate too much
It's not something that we should be trying to fix, if the whole
TDMA multi-frame is lost.  For some yet unknown reason, sometimes
the difference between the last processed TDMA frame number and
the current one is so huge, so trxcon eats a lot of CPU trying
to compensate nearly the whole TDMA hyper-frame:

  sched_trx.c:640 Too many (>104) contiguous TDMA frames elapsed (2715647)
                  since the last processed fn=633 (current fn=632)

Let's just print a warning and do not compensate more than one
TDMA multi-frame period corresponding to the current layout.

Change-Id: I56251d0d2f6fa19195ff105d3bdfbc22df6db8cd
2020-07-08 15:55:05 +07:00
Vadim Yanitskiy a29277278b trxcon/scheduler: subst_frame_loss(): print current TDMA fn
Change-Id: I3d769ba3cbadc19bac0b25224460af8f06d0d776
2020-07-07 04:05:50 +07:00
Vadim Yanitskiy 3fea4de64e trxcon: use libosmocore's TDMA frame number API
Depends: (libosmocore) Ic291fd3644f34964374227a191c7045d79d77e0d
Change-Id: I49a043d8483e116cf2d91820edb511846175173f
2020-06-19 20:46:45 +00:00
Vadim Yanitskiy cf72753e6a trxcon/scheduler: cosmetic: clarify lost frame counter description
Change-Id: Ied5ea8524f2ec6c324e9fd37256111d099c23e6c
2020-06-18 11:52:06 +00:00
Vadim Yanitskiy 1c0dab9c95 trxcon/scheduler: cosmetic: use enumerated type instead of uint8_t
Change-Id: Idde328d176b4cbd89c62712e4a247095dd596105
2020-06-18 11:52:06 +00:00
Vadim Yanitskiy 55a63b1759 trxcon: use osmo_{store,load}32be() to pack / unpack TDMA fn
Change-Id: I9eff9b8e4b8ce9e0563a1ec3c485ab8b0f306491
2020-06-14 15:27:27 +07:00
Vadim Yanitskiy f8a3959cb2 trxcon: fix potential buffer overflow in l1ctl_proc_est_req_h1()
Change-Id: I10f03ca66412a4a7094b0f4a7319411d5d5818ef
2020-06-10 17:04:54 +00:00
Vadim Yanitskiy 0ed7c0ee5f trxcon: fix l1ctl_proc_est_req_h0(): convert to host byte order
L1CTL is using the network byte order, because this protocol is
spoken between different devices and architectures.  Somehow I
forgot about this while adding SETFH command back in 2018.

Change-Id: Ia2f70f0d5e35b6bf05e1fa6fb51a15c1bbe3ca4c
Related: OS#4546
2020-05-28 16:53:51 +07:00
Vadim Yanitskiy 4f677e6ba8 trxcon: refactor trx_if_cmd_setfh(): send Rx/Tx frequencies
It would make sense to send the ARFCN list in parameters of SETFH
command, if there was a clear distinction between transceivers in
fake_trx.py, i.e. which one is an MS and which is a BTS.

Right now, every Transceiver is an abstract entity that emits
and receives bursts. So when you convert an ARFCN to a pair of
Downlink/Uplink frequencies, you don't know whether it maps
as Rx/Tx or as Tx/Rx for a given Transceiver.

Of course, we could assume that this is an MS specific feature,
and a pair of Downlink/Uplink frequencies always corresponds to
Rx/Tx, but what if some day we would need to implement and test
a similar approach for the BTS side? Also, by sending frequency
values in kHz (rather than ARFCNs) we can avoid inconsistency
with the existing RXTUNE / TXTUNE commands.

Change-Id: Ia2bf08797f1a37b56cf47945694b901f92765b58
Related: I587e4f5da67c7b7f28e010ed46b24622c31a3fdd
Related: OS#4546
2020-05-17 14:46:41 +07:00
Vadim Yanitskiy d8d71f6d24 trxcon: use buffer size macros for TRXC/TRXD messages
Change-Id: I6f2b8682c4691ed3da1bf804e302a7169f33e283
2020-05-17 14:36:32 +07:00
Harald Welte e607f7ef18 virt_phy: tweak log levels
Related: SYS#4822
Change-Id: Ia7e368cda8e016a4141b21e5219697420a503124
2020-05-15 08:58:21 +02:00
Oliver Smith 901ac89735 mobile: loopback: support EFR
Related: SYS#4924
Change-Id: I73d1f88b0865ad97b85418ff76739febf2e128a7
2020-05-05 12:22:32 +02:00
Oliver Smith 8f04fa9758 mobile: traffic req check: support EFR
L1CTL handling code should not be involved in such high level checks, so
while at it, move the check into a separate function in gsm48_rr.c and
add a length check. gsm48_rr_tx_voice() is the only caller of
l1ctl_tx_traffic_req().

Related: SYS#4924
Change-Id: Iba84f5d60ff5b1a2db8fb6af5131e185965df7c9
2020-05-05 12:22:26 +02:00
Neels Hofmeyr 3622522664 mobile: implement 'loopback' TCH frame I/O handler
Use newly added audio / loopback config vty node to provide audio
loopback from mobile app. Only FR is supported for now.

Change-Id: Icd0b8d00c855db1a6ff5e35e10c8ff67b7ad5c83
2020-05-05 12:19:58 +07:00
Neels Hofmeyr 785450c4bf mobile: add audio config, with unused audio loopback setting
The aim is to add configurable audio loopback to mobile. An existing patch on a
branch from fixeria [1] adds the audio config section. Add a reduced version of
this audio config to be compatible with the future merge.

Add the audio loopback setting, so far without functionality.
Subsequent patch adds the actual loopback.

[1] osmocom-bb branch fixeria/audio,
    patch "mobile/vty_interface.c: add new 'audio' section"
    Change-id I62cd5ef22ca2290fcafe65c78537ddbcb39fb8c6

Change-Id: Ie03e4a6c6f81ea3925266dd22e87506d722a6e1a
2020-05-05 12:02:31 +07:00
Vadim Yanitskiy b217b9b3e5 trxcon/logging: print category, level and extended timestamp
Since we're heavily using trxcon in ttcn3-bts-test, the logging
output should contain as much information as possible. Ideally
we should introduce the VTY interface (see OS#3666) and get
logging configuration options as a bonus. But let's just use
some beneficial hard-coded defaults for now:

  - print category and level (huh, we use NOTICE everywhere?),
  - do not print category-hex (who needs it anyway?),
  - print extended timestamp, so we're in synce with other logs.

P.S. This configuration is based on my own debugging experience.

Change-Id: Ie3d259f3255d8af80e6780f850b808fa243f97b4
2020-04-09 05:13:59 +07:00
Vadim Yanitskiy 4162b27dae layer23/l1ctl: fix: do not pass PDCH and CBCH frames to LAPDm
GPRS (PDCH) and CBCH related frames have nothing to do with LAPDm.
The former uses LLC for the user-plane data, while CBCH involves
its own segmentation described in 3GPP TS 23.041 and TS 44.012.

There is currently no code for handling these kinds of frames, so
let's just send them to GSMTAP and release the memory (msgb).

Change-Id: I59b4acbe22217f8989f73b79b128a43e8bcdfa2f
Related: OS#4439
2020-03-17 18:25:04 +07:00
Vadim Yanitskiy f889e916a9 trxcon/scheduler: print TDMA statistics on lchan deactivation
Change-Id: If8688ca331a7b1f841aa21f7a5ebc9750327b90a
2020-03-16 10:32:42 +00:00
Vadim Yanitskiy d944f1d89d trxcon/scheduler: be safe against a theoretical integer overflow
As was noted by Pau Espin Pedrol, there is a theoretical chance
that lchan->tdma.num_proc would overflow, so as a consequence,
subst_frame_loss() will be unable to compensate one
(potentionally lost) Downlink burst.

On practice, given the size of unsigned long and duration of a
single TDMA frame, it would only happen once in roughly ~6 years.

  FRAME_DURATION = 4615 * 10e-6
  ULONG_MAX = 2 ** 32 - 1

  FRAME_DURATION * ULONG_MAX -> ~198212740 seconds
                             -> ~55059 hours
                             -> ~2294 days
                             -> ~6 years.

Chances are that trxcon would crash much earlier, or even GSM
would be completely forgotten after such a long time run, but
let's work this around and simply start counting from 1
if that overflow eventually happens.

Change-Id: I3d40ef09b06039a85df52af06ab38de314e1a434
2020-03-16 10:32:42 +00:00
Vadim Yanitskiy 9d3c2d047b trxcon/scheduler: do not abort on incomplete set of bursts
Change-Id: Iea2d1b75b50c2889d4766687ef4fe6ae4ea39a50
2020-03-16 10:32:42 +00:00
Vadim Yanitskiy c86ba06258 trxcon/scheduler: TCH/F: fix Downlink burst completeness check
A TCH/F or FACCH/F frame is interleaved over 8 bursts, not 4.

Change-Id: I2ee4a216a18e9b077b27887235d982481991d9c4
2020-03-16 10:32:42 +00:00
Vadim Yanitskiy d81231672f trxcon/scheduler: align Downlink reception to the first burst
It may happen that the burst reception would start from bid != 0:

  <0005> sched_trx.c:263 (Re)configure TDMA timeslot #2 as TCH/H+SACCH
  <0005> sched_trx.c:420 Activating lchan=TCH/H(0) on ts=2
  <0005> sched_trx.c:420 Activating lchan=SACCH/TH(0) on ts=2
  <0006> sched_lchan_xcch.c:96 Received incomplete data frame at fn=0 (0/104) for SACCH/TH(0)
  <0006> sched_lchan_xcch.c:106 Received bad data frame at fn=0 (0/104) for SACCH/TH(0)

so in that case, both measurement processing and the frame number
calculation would yield incorrect and/or incomplete results. The
Rx burst mask can be used to eliminate this problem.

In particular, if we shift it left instead of cleaning, it would
never be equal 0x00 after at least one burst is received. This
would allow us to skip decoding of an incomplete frame at the
beginning when the logical channel was just activated.

Note that TCH/H handler is not affected because it already uses
the strategy described above, so we keep it unchanged.

Change-Id: Ib8ddf2edd5ef84f2ab12155f7a8874c9fc56d436
Related: OS#3554
2020-03-16 10:32:42 +00:00
Vadim Yanitskiy f5fa7dbd19 trxcon/scheduler: constify Downlink burst bits where possible
Change-Id: Ib3e3a0a5b4551126b1a9439000d4438c58a6a90a
2020-03-16 10:32:42 +00:00
Vadim Yanitskiy 431dcd00f0 trxcon/scheduler: substitute lost TDMA frames on Downlink
It may happen that one or more Downlink bursts are lost on their
way to the MS due to a variety of reasons. Modern transceivers
supporting TRXDv1 protocol would substitute lost bursts with
so-called NOPE indications. Hovewer, neither fake_trx.py nor
grgsm_trx do support this feature at the moment.

We can still detect and compensate TDMA frame loss per logical
channels in the same way as it's already done in osmo-bts-trx.
In short, we should keep TDMA frame number of the last received
burst in the logical channel state, and using the appropriate
multiframe layout, check if there were any gaps between TDMA
frame number of the current burst and the stored one.

Change-Id: I3551d79796a3730565c2c70577e9d134e636f275
2020-03-16 10:32:42 +00:00