Commit Graph

3312 Commits

Author SHA1 Message Date
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 15247989f5 trx_toolkit: do not auto power on/off child MS Transceivers
By default, powering on/off a parent transceiver (child_idx=0) will
automatically power on/off its child transceivers (if any).  This
behavior is desirable for the BTS, but not for the MS Transceivers.

Additional MS Transceivers are going to be used by ttcn3-bts-test
for spawning multiple DCCH components in parallel.  We don't want
situations when one component powers off transceivers of the other
DCCH components - they must be independent.

Change-Id: I0cd6bac616273bed0e246ad48edc44fff484c589
2022-07-26 23:48:19 +07:00
Vadim Yanitskiy f6aada5f5f trx_toolkit: use **kwargs in Transceiver.__init__()
Change-Id: I65e85a2dc99e81e96d1b31b6bda5010b044b041d
2022-07-26 23:48:19 +07:00
Vadim Yanitskiy 8144470129 trx_toolkit: simplify Transceiver.power_event_handler()
Change-Id: I283f7ced0309bf823ad78c90e8006b9e9474dee7
2022-07-26 23:48:19 +07:00