Commit Graph

19 Commits

Author SHA1 Message Date
Vadim Yanitskiy 9b511668a4 host/trxcon/scheduler: add initial TCH/F channel support
This change implements basic TCH/F lchan handlers for both data
reception and transmission. Only FACCH (signaling), FR and EFR
payloads are supported at the moment.

Change-Id: If6b0eaede2b484484d2a824e7219ff04483266a1
2017-12-16 15:45:38 +07:00
Vadim Yanitskiy 2937cb4c16 host/trxcon/scheduler: clean up the trx_lchan_state
There were some BTS specific variables, which are meaningless.
This change cleans them up, and also groups some measurement,
encryption, and AMR specific variables into sub-structures.

Change-Id: Ie753a7e3e7fa2b433d8319b3a05b85b8583d7be2
2017-12-16 15:24:54 +07:00
Vadim Yanitskiy cd9b850ee4 host/trxcon/scheduler: process frames in advance
In order to get the transceiver more time to process bursts,
the L1 scheduler should process the frames and send the bursts
in advance (a few frames before), like OsmoBTS does. By default,
the advance value is 20 frames, but this can be adjusted using a
new command line option of trxcon '-f'.

Change-Id: Ic258a169f3554f931d6277e18ca060d029b77f32
2017-11-23 20:05:16 +07:00
Vadim Yanitskiy 863ccb7bd2 host/trxcon/scheduler: share common declarations of lchan handlers
The training sequences, data / traffic indication and confirmation
helpers are used by several lchan handlers, like xCCC and TCH. It
would be better to have them all declared within a shared header.

Change-Id: I71980f09a0c0e023370e1a651afc24fff2491552
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 7d95f8821e host/trxcon/l1ctl.c: share primitive management code
This change introduces shared primitive management functions,
exposed from the l1ctl_rx_data_req() implementation:

  - sched_trx_init_prim() - allocates memory for a new primitive
    and its payload. Initializes primitive's header, setting
    the logical channel type and the payload length. After
    initialization, the talloc context of a primitive is
    a trx instance, which passed as the first argument.

  - sched_trx_push_prim() - decodes the timeslot index from
    chan_nr and pushes a primitive to its transimt queue.
    The talloc context of primitive is changed to the
    parent trx_ts instance after queuing.

Both functions will be used for handling both L1CTL_TRAFFIC_REQ
and L1CTL_RACH_REQ.

Change-Id: I8169a1ef4ef54d91b50f3e213e4842f54af8b499
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy c0100cd145 host/trxcon/scheduler: get rid of useless nbits argument
Change-Id: I8508676e2cb347396c6ca6b394f13113f3e63084
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 8fd143ee5a host/trxcon/scheduler: pass trx_lchan_state to lchan handlers
It's better to pass a trx_lchan_state instance directly from
caller to lchan handler instead of passing trx_lchan_type. This
way a handler wouldn't need to find lchan itself.

Change-Id: I47a40542b03ab31da12b0abb1c263c83662ff018
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 58c7faf5eb host/trxcon/scheduler: fix chan_nr parsing
Previously, the chan_nr, received from L2, was parsed in a wrong
way, so in some cases only one logical channel was activated or
some messages (such as Measurement Requests) were sent on
incorrect channel (e.g. on SDCCH instead of SACCH).

This change reimplements the sched_trx_chan_nr2lchan_type(), and
introduces a new function sched_trx_set_lchans(), whics will
parse chan_nr and (de)activate required channels.

Change-Id: I480311c65ef93bbc1644ec708dd2a68fd33091e0
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy b4dd3ac9bb host/trxcon/scheduler: use 'tn' instead of 'ts_num'
The new timeslot index designation is more generic for
Osmocom projects, so let's use one.

Change-Id: I8c0118aad439816148490e57938d7e32b6e20877
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 075c1ad738 host/trxcon/scheduler: git rid of sched_trx_find_ts()
After simplification of timeslot management API this
function does not make sense.

Change-Id: I2fc0c68d784c8f01e1452bc46f8e1eaac2917656
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy c045bc4fbe host/trxcon/scheduler: simplify timeslot management
As we know the count of timeslots per GSM TDMA frame, it would
be better to have an array of pointers to trx_ts instances instead
of linux list, which is more usable for lists with unknown length.

Change-Id: I9510a5cddde22950ceb8422e0990d59f05ed4d60
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 2001221d75 host/trxcon/scheduler: optionally reset clock counter
Change-Id: I4565620fc0c5f64133c2674d2c972fc34245cf32
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 74f8595156 host/trxcon/scheduler: implement xCCH TX capability
Change-Id: I4da4816dcecc55eb9b4d2d6c631967026a5e4f68
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 824bfa299d host/trxcon/l1ctl.c: handle L1CTL_DM_{EST,REL}_REQ
Change-Id: Ifdf229a6dd3c73ede313d2bfe384032e3887cc3a
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 2abc7a4998 host/trxcon/scheduler: implement TX queue handling
Change-Id: I2b7bae53901156524134c4904ea1179268d85601
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 85b700421f host/trxcon/scheduler: modify trx_lchan_tx_func definition
Initially, it was assumed that TX lchan handler will only
compose a burst and return a pointer to the buffer. A burst
itself could be sent somewhere outside, e.g. by caller.

It would be better to send bursts exactly from handler, because
in this case it isn't required to have an external buffer.

Change-Id: Ic9dcdd366e68cec38c5840ed8f8cdda8236d67c7
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy ec3a1ba2e5 host/trxcon/scheduler: handle bursts from TRX interface
Change-Id: Iff15daf897f30cb98d4ec4c88b9fc259cb44ea4e
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 8baa369b23 host/trxcon/scheduler: implement management functions
This change introduces some new functions to configure
TDMA scheduler. They can be grouped as follows:

  - Scheduler management functions
    - sched_trx_init()
    - sched_trx_reset()
    - sched_trx_shutdown()

  - Timeslot management functions
    - sched_trx_add_ts()
    - sched_trx_find_ts()
    - sched_trx_del_ts()
    - sched_trx_reset_ts()
    - sched_trx_configure_ts()

  - Logical channel management functions
    - sched_trx_activate_lchan()
    - sched_trx_deactivate_lchan()
    - sched_trx_find_lchan()

Change-Id: I6d0f437a68f0eb4e22bf635bf899b08673571085
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 2e18fe4631 host/trxcon/scheduler: add basic GSM PHY definitions
Change-Id: I9f4faa15d5ca61af3e3fdbb95952ab4e4e0b7a4b
2017-11-19 17:35:07 +07:00