Commit Graph

26 Commits

Author SHA1 Message Date
Vadim Yanitskiy 4bc4655bd6 trxcon/scheduler: count number of measurements
Instead of counting both RSSI and ToA measurements separately,
let's have a single counter in trx_lchan_state.meas struct.

Change-Id: I45454a3ac92b8cc85dd74092e4ab6eb350f20c9a
2019-02-21 17:20:36 +07:00
Vadim Yanitskiy 1b6be6fc24 trxcon: do not include trxcon.h everywhere
Change-Id: Ia78bd6dac7ab12970838e0b1a2929a106b898d9d
2019-01-17 10:55:41 +07:00
Vadim Yanitskiy 8f6909a94f trxcon/scheduler: fix: check primitive len before encoding
We used to trust (and still doing this) the messages coming from
L1CTL interface too much, and not to check the primitive length
before passing the payload to the libosmocoding API. As was
discovered and described in OS#3415, sending a L1CTL message
(either DATA_REQ, or TRAFFIC_REQ) with an incorrect length
(lower than expected) may cause heap overflow.

Let's explicitly check a primitive before encoding, and drop it
if its length doesn't match the expected value(s).

Change-Id: I258ee9f6d0124b183b1db23a73f1e523fcea89a8
Fixes: OS#3415
2018-07-24 22:24:13 +07:00
Vadim Yanitskiy 40e71126ab trxcon/sched_lchan_xcch.c: always send data indications
We shall always send data frame indications, even if received
frame is incomplete or decoding was failed. This is required
for proper Measurement Reporting.

Change-Id: I7beee7e797f488d04c3b59bee9501ce823717092
2018-03-11 17:38:29 +07:00
Vadim Yanitskiy 47aaf962fb trxcon/scheduler: enforce lchan handlers to set message type
Since this change, each lchan handler shall manually indicate
a type of both message indications and confirmations.

Change-Id: I02e0b87d61c127d2f6f5b9532909af78332bf707
2018-03-11 17:38:29 +07:00
Vadim Yanitskiy c066787fd5 host/trxcon: use integer math for ToA (Timing of Arrival)
There's no need to express ToA value as a float. Let's turn it into
an int16_t with 1/256 symbol period accuracy throughout the code to
avoid both float arithmetic as well as loosing any precision.

Inspired by Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec.

Change-Id: I99c0f38db08a530d5846c474aba352aa0b68fe86
2018-03-02 21:24:57 +07:00
Vadim Yanitskiy f09be8a9af trxcon/scheduler: drop meaningless TODO comment
Since both TA and AGC loops should be implemented in transceiver,
this TODO is meaningless. Let's drop it.

Change-Id: I84979712e2a1b849acaee53d5cd50de4e1e357c2
2018-01-05 14:36:03 +07:00
Vadim Yanitskiy 44838f79a2 trxcon/scheduler: preprocess UL bursts before sending
Having a possibility to preprocess UL burst before sending to
transceiver is required for the further ciphering support
integration and probably some other tasks.

Change-Id: Ia6eead5d4f51d7c0bf277b9d5ebb0a74676df567
2017-12-18 06:04:29 +07:00
Vadim Yanitskiy a403215bea trxcon/scheduler: move prim management outside lchan handlers
Previously, each lchan handler used to obtain and delete primitives
from a timeslot's tranmit queue itself. This approach entails many
potential problems and bugs:

  - The lchan handlers shall not do that by definition, they
    should encode and decode frames according to GSM 05.03.

  - In some cases (e.g. TCH), a single transmit queue may contain
    primitives of different types (e.g. TCH, FACCH and SACCH). At
    the same time, the lchan handlers don't care and don't even
    know about each other. So, this could cause an unexpected
    behaviour in some cases.

This change separates all primitive management routines,
providing a new API for obtaining and dropping them.

"Write programs that do one thing and do it well."

Change-Id: I29503ece51903784bc53541015285234471c8d15
2017-12-18 05:26:48 +07:00
Vadim Yanitskiy 60ff614446 host/trxcon/scheduler: always print error messages
Some error messages previously had incorrect logging level 'debug'.
We aren't going to hide anything, right? Let's print them!

Change-Id: I85fb37292046b667386bfe26b9bbb000600e1c6f
2017-12-16 16:33:17 +07:00
Vadim Yanitskiy a9c2ef2638 host/trxcon/scheduler: inform L2&3 about decoding errors
Previously, we used to drop a frame if decoding wasn't successful.
This way, the higher layers didn't even know about that, so the
local counters and Measurement Reports were incomplete.

This change makes scheduler to forward L2 frames in any case,
setting the num_biterr for each of them. In case of decoding
error, a dummy (payload filled by 0x00) L2 frame will be sent.

Change-Id: I31011d8f3ca8b9a12474cd0bc653faed18391033
2017-12-16 16:21:05 +07:00
Vadim Yanitskiy d2c13e3d20 host/trxcon/scheduler: use GSM_MACBLOCK_LEN definition
Change-Id: Ie3b27ecb62d6f0e84f2e3ec0c1558e32bb213d33
2017-12-16 15:45:12 +07:00
Vadim Yanitskiy 3d872d0eae host/trxcon/scheduler: drop meaningless memset call
Change-Id: I18a938cef350632673cfc820beed5e42f40d89e7
2017-12-16 15:24:54 +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 ac764e78fd host/trxcon/scheduler: separate logging of data messages
Change-Id: I3a33687a688db2a183b546425f71c7a0a7030594
2017-11-19 17:35:07 +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 28088c8910 host/trxcon/l1ctl.c: include DL frame info in L1CTL_DATA_CONF
The l1ctl_info_dl header is expected to be a part of a
L1CTL_DATA_CONF message, but was missing previously.

Change-Id: Ia8dfaed924fd84395ba9ae539164eaa94f52d30b
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 82b8c21b21 host/trxcon/l1ctl.c: don't fill l1ctl_info_ul into a primitive
The UL frame header isn't used by lchan handlers.

Change-Id: Ia1c63b6f17c3802b29f54299da1151a39edf3a03
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 14d0f67064 host/trxcon/scheduler: send stored tx_power to transceiver
Previously a fixed fake value (10) was used.

Change-Id: I8ba70bbda6c8c9249f8eb4294aeb41ab8769a19a
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy f9ab2a0b49 host/trxcon/scheduler: clean up some includes
Change-Id: I47e3b953b80f4f822d563579d15498181009ca80
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 0dc5b233e6 host/trxcon/scheduler: share common code for lchan handlers
The training sequences array is currently used by xCCH handlers,
but will be also used for handling both TCH/F and TCH/H bursts.
Moreover the code that forwards decoded L2 payloads to L1CTL
protocol handlers was separated into a new shared function.

Change-Id: I34c3de351362ebd9a070f49bb78d7bd976784b04
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy f2179e6763 host/trxcon/l1ctl.c: make l1ctl_tx_data_ind flexible
Now this function can send both DATA and TRAFFIC indications.

Change-Id: I945c10c317155917b6e6ce9d663d9cb46f2e085c
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 18bc7d5e06 host/trxcon/scheduler: ignore incomplete sets of bursts
To be able to decode one xCCH message, it's required to have
all set of bursts collected (4/4). Otherwise we should not
even try to decode an incomplete set.

Change-Id: Iaa63462efe19b8e96102fc8c8d8c968a2df2c70e
2017-11-19 17:35:07 +07:00
Vadim Yanitskiy 9760a84a6d host/trxcon: split sched_lchan_handlers.c
It would be better to have xCCH, SCH and RACH burst handlers
in separate files, because as much code we add to a single
file, as harder it becomes to read and understand one.

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