Commit Graph

3073 Commits

Author SHA1 Message Date
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
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