Commit Graph

13 Commits

Author SHA1 Message Date
Vadim Yanitskiy eb3a1cde8c trxcon/l1ctl_link.c: allocate msgb after its length is read
Change-Id: I2b941c5ed91097c4ed2d859634bbe89f44546061
2018-03-11 10:05:48 +00:00
Vadim Yanitskiy 2136891b7b trxcon: clarify L1CTL message length field
Each L1CTL message gets its own length pushed in front before
sending. This isn't specified in the 'l1ctl_proto.h', but
assumed in the code. Let's clarify this.

Change-Id: I118d00613aeaf5ff0bad1188fa5f7450d4ca8122
2018-03-11 10:05:48 +00:00
Vadim Yanitskiy a92fd3388c trxcon: use meaningful names for L1CTL messages
There are two types of L1CTL messages: received and to be
transmitted. Let's use proper names to indicate this.

Change-Id: I7c17687579282fa389bca35dc7edbc3582e55701
2018-03-11 10:05:46 +00:00
Harald Welte b1b1162019 trxcon: Define event names for osmo_fsm's
Change-Id: Id3279e99966a0ab236923c497ac0abbc9ed2c93c
2018-02-28 23:18:09 +01:00
Vadim Yanitskiy e8cf6c4eef host/trxcon: fix: use valid names for FSM instances
Since 8c4f5457 in libosmocore there are some limitations on FSM
and FSM instance names. This change adjusts the names of both
l1ctl_fsm and trx_fsm instances.

Change-Id: Icaaac3f51bdcfe4f7723060179b8730c3a06529b
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 3641fe6123 host/trxcon: use LOGP instead of fprintf
There is no (performance) reason to use fprintf instead of LOGP.
Second one provides more useful information, such as a file name
and a line number.

Change-Id: I86dda5b3d746c7802442e4226578a06c04941721
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy f5bbe5ebfe host/trxcon: separate logging of L1 Control and L1 Data
L1 Data is quite verbose, while Control is typically limited.
And if you would need to debug some Control message handling,
the Data messages wont overflow your terminal anymore. This
change introduces a new logging category named 'DL1D'.

Change-Id: Id830c8bf913f7a8ddc87c47f70a337ee4623abd8
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 10fd43e586 host/trxcon/l1ctl.c: reset FBSB expire timer on shutdown
Change-Id: If3c8a34f0c1105c6acbfe4f9233482a31f6558de
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy f604869944 host/trxcon: share trxcon fsm and talloc ctx via trxcon.h
Change-Id: I9ef558f84a6dc1c9b8fc394c48e108676fa169f8
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 90a0d3c78d host/trxcon: initial release of L1CTL handlers
Now it's possible to handle the following requests
from layer23 apps:

- L1CTL_FBSB_REQ
- L1CTL_PM_REQ
- L1CTL_RESET_REQ
- L1CTL_ECHO_REQ

It should be noted, that the L1CTL_PM_REQ isn't
handled correctly yet, due to required task isn't
implemented on the TRX side yet. Instead of this,
temporary we are sending some fake responses.

Change-Id: I343eca3e20922ddd83e06231811200b26da442f3
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 423aeefc40 host/trxcon: integrate osmo-fsm framework
This change introduces the following state machines:

  - trxcon_app_fsm - main application state machine.

    This state machine handles different events, raised
    from program modules (such as trx_if.c or l1ctl.c).

  - l1ctl_link_fsm - L1CTL server state machine.

  - trx_interface_fsm - TRX interface state machine.

The program modules (such as trx_if.c or l1ctl.c) should be as
much independent from each other as possible. In other words,
one module should not call methods from another, e.g. L1CTL
handlers are not able to send any command to transceiver directly.

Instead of that, they should use shared event set to notify the
main state machine about something. Depending on current state
and received event, main state machine 'decides' what to do. This
approach would allow to easily reuse the source code almost 'as is'
anywhere outside the project.

Change-Id: I7ee6fc891abe5f775f5b7ebbf093181a97950dea
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 65664d088d host/trxcon: fix NULL-pointer deference
Change-Id: Idc036d4ea32b4aa3f4841d39144ef1733414728e
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 9f5fefe792 host/trxcon: initial release of L1CTL interface
There are two sides of the 'OsmocomBB <-> SDR' bridge. One of
them is the L1CTL interface, which is used by existing layer23
applications to drive GSM L1. Exactly this interface is provided
by the osmocon application, but instead of forwarding messages
between both host software and firmware we need to handle incoming
messages from layer23 applications, perform some GSM L1 specific
conversations (coding, mapping, interleaving, etc.), then finally
forward them to transceiver through the scheduler. And vice versa.

This code is just a basic implementation of UNIX socket handlers,
so currently we can only accept and drop connections from layer23
applications.

Change-Id: I58d069bcc7742b42c0bf95e52063933bf2c352ff
2017-11-19 17:35:07 +07:00