Commit Graph

26 Commits

Author SHA1 Message Date
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 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 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 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 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 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 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 94bb69ab3c trxcon: cosmetic: s/app_evt_names/trxcon_fsm_event_names/
Change-Id: Iae0e753eddb7e0a1767e555653c9e9fdb58b7a7b
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 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 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 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 259314abae trxcon: group *.c files into 'src' directory
Change-Id: I1a3703e48507cd51cd8198f13b993f54c44bc41e
Related: OS#5599, OS#3761
2022-07-04 17:41:09 +07:00