Commit Graph

1389 Commits

Author SHA1 Message Date
Vadim Yanitskiy 73da4bac97 mobile: gsm48_rr_set_mode(): print name of channel mode
Change-Id: I615e89bdd7e1cc01b3258fefa26f7ab5705ae8cc
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy c1d3c01768 mobile: allow enabling/disabling handling of voice in the L1PHY
Some L1PHY targets (e.g. Calypso based Mot C1xx phones) have built in
microphone and speaker.  Some targets do not have them.  Currently we
unconditionally instruct the L1PHY to handle TCH frames internally.
Make this behavior configurable via the VTY interface.

Change-Id: I131f213ef7c2736f7310f0183b83f3bc3064cd98
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy 8d875f3c3d mobile: add MNCC handler selection to settings
Since the mobile application is potentially able to maintain
multiple MS instances, it's better to have a possibility to
choose an MNCC (Call Control) handler per each MS separately.

This change removes the command-line option '-m', which was used
for enabling the external MNCC.  Now it's possible configure the
MNCC handler for each MS via the VTY interface and settings.

The following MNCC-handlers are available:

  - internal - built-in MNCC-handler (default);
  - external - external MNCC-handler via UNIX-socket (e.g. LCR);
  - dummy - dummy handler without CC support.

Change-Id: I2df91c7a79ba5c39bc6ceae900ef649129dd0346
Related: OS#3400
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy c46d0699cd mobile: timeout_rr_meas(): also print sub-slot for TCH/H
Change-Id: I208c159ba610450e1850e601daa2712eef8c23e1
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy fe6345e1c4 layer23: always check return value of rsl_tlv_parse()
Similar to rsl_dec_chan_nr(), this function may also fail, leaving
the given struct tlv_parsed uninitialized.

Change-Id: I13f2a97eeff78ca8ed7d0a2844e4fca430ec7768
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy c9e579cea1 layer23: always check return value of rsl_dec_chan_nr()
The rsl_dec_chan_nr() may fail to decode RSL channel number, so
variables ch_type/chan_ss/chan_ts would remain uninitialized.

Change-Id: I9ab18bdaf41a29fcd32a7060668ef9db07b8cf7e
Related: OS#5599
2022-11-29 02:15:39 +07:00
Vadim Yanitskiy b76743df71 mobile: add MNCC socket path to settings
Previously the MNCC socket path was generated automatically,
using concatenation of the '/tmp/ms_mncc_' prefix and MS name.
Let's allow the user to specify this manually, keeping the same
naming generation method for default value.

Change-Id: I643356ac579bc5e765f668265ec803b22a73739c
Related: OS#3400
2022-11-27 06:12:38 +07:00
Vadim Yanitskiy bdc5acdb13 layer23: l1ctl_tx_traffic_req(): cosmetic: drop dead code
Change-Id: I941899ab27282a495f965ae9a0f41076dceef953
Related: OS#5599
2022-11-27 06:12:38 +07:00
Vadim Yanitskiy b2815c64a6 trxcon: add a spec. reference for the trxcon_fsm
Change-Id: I184abe10f874d97f047a3720c776fdef08d880e6
2022-11-25 22:32:14 +07:00
Vadim Yanitskiy 887b141699 layer23: add 'src/modem/modem' to .gitignore
Change-Id: I37e536493ddfd3bff1674d5bc85f40a0bbd0f317
2022-11-25 22:26:20 +07:00
Vadim Yanitskiy 04b14c49f0 trxcon: trx_data_rx_cb(): support parsing 8-PSK modulated bursts
Change-Id: I78b1a79c329299ab65eb339e9447a47382983cd9
2022-11-25 14:34:55 +00:00
Vadim Yanitskiy 384a8dd3fe trxcon: trx_data_rx_cb(): check TRXD PDU version
Change-Id: If5687d7d87619c0da02cc81ab26d63e61484bc06
2022-11-25 14:34:55 +00:00
Vadim Yanitskiy 6703d5289b trxcon: trx_data_rx_cb(): print strerror(errno) if read() fails
Change-Id: I78658a706e5bfda446e3929e33abcdee3f08845b
2022-11-25 14:34:55 +00:00
Vadim Yanitskiy 0f9d483984 trxcon: trx_data_rx_cb(): properly parse timeslot number
Remove the range check because it makes no sense anymore.

Change-Id: I1010cf39f61b8845acce632c19c74df892fc5acb
2022-11-25 14:34:55 +00:00
Vadim Yanitskiy 7f1b99bc3b fixup: trxcon: make burst pointer in trxcon_phyif_burst_ind const
The for-loop was moved above the initialization of bi and kept using
bi.burst_len, which is indeed uninitialized.  Move it back.

Change-Id: I93a627233beef9157d47b35cafc42c53203619a7
Fixes: 178b92a108
Fixes: CID#300007
2022-11-24 10:57:18 +07:00
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