diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2019-06-25 18:23:14 +0700 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2019-06-27 12:51:02 +0700 |
commit | b06cd9f439200869c96ed5d82113c3eba0453229 (patch) | |
tree | 4c25c2cd29ae55e0d64b17f19398b8d390314d5e /src/common/scheduler.c | |
parent | d1e7d0dafa93220ffb657661b3a1c9bc2b7a700a (diff) |
osmo-bts-trx/trx_if.c: introduce TRXD header version handling
It may be necessary to extend the message specific header with
more information. Since this is not a TLV-based protocol, we
need to include the header format version.
+-----------------+---------------------------+
| 7 6 5 4 3 2 1 0 | bit numbers (value range) |
+-----------------+---------------------------+
| X X X X . . . . | header version (0..15) |
+-----------------+---------------------------+
| . . . . . X X X | TDMA TN (0..7) |
+-----------------+---------------------------+
| . . . . X . . . | RESERVED (0) |
+-----------------+---------------------------+
Instead of prepending an additional byte, it was decided to use
4 MSB bits of the first octet, which used to be zero-initialized
due to the value range of TDMA TN (0..7). Therefore the current
header format has implicit version 0.
Otherwise Wireshark (or trx_sniff.py) would have to guess the
header version, or alternatively follow the control channel
looking for the version setting command.
This change introduces a new structure 'trx_ul_burst_ind', which
represents an Uplink burst and the corresponding meta info. The
purpose of this structure is to avoid overloading the existing
functions, such as trx_sched_ul_burst(), with more and more
arguments every time we bump the version.
On receipt of a TRXD message, trx_data_read_cb() now parses
the header version, and calls the corresponding dissector
functions, e.g. trx_data_handle_(hdr|burst)_v0().
Change-Id: I171c18229ca3e5cab70de0064a31e47c78602c0c
Related: OS#4006
Diffstat (limited to 'src/common/scheduler.c')
-rw-r--r-- | src/common/scheduler.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/common/scheduler.c b/src/common/scheduler.c index 3f804a90..83779d79 100644 --- a/src/common/scheduler.c +++ b/src/common/scheduler.c @@ -1313,11 +1313,10 @@ static int trx_sched_calc_frame_loss(struct l1sched_trx *l1t, return 0; } -/* process uplink burst */ -int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - sbit_t *bits, uint16_t nbits, int8_t rssi, int16_t toa256) +/* Process an Uplink burst indication */ +int trx_sched_ul_burst(struct l1sched_trx *l1t, struct trx_ul_burst_ind *bi) { - struct l1sched_ts *l1ts = l1sched_trx_get_ts(l1t, tn); + struct l1sched_ts *l1ts = l1sched_trx_get_ts(l1t, bi->tn); struct l1sched_chan_state *l1cs; const struct trx_sched_frame *frame; uint8_t offset, period, bid; @@ -1329,7 +1328,7 @@ int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, /* get frame from multiframe */ period = l1ts->mf_period; - offset = fn % period; + offset = bi->fn % period; frame = l1ts->mf_frames + offset; chan = frame->ul_chan; @@ -1346,28 +1345,29 @@ int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, return -EINVAL; /* calculate how many TDMA frames were potentially lost */ - trx_sched_calc_frame_loss(l1t, l1cs, tn, fn); + trx_sched_calc_frame_loss(l1t, l1cs, bi->tn, bi->fn); /* update TDMA frame counters */ - l1cs->last_tdma_fn = fn; + l1cs->last_tdma_fn = bi->fn; l1cs->proc_tdma_fs++; /* decrypt */ - if (bits && l1cs->ul_encr_algo) { + if (bi->burst_len && l1cs->ul_encr_algo) { ubit_t ks[114]; int i; - osmo_a5(l1cs->ul_encr_algo, l1cs->ul_encr_key, fn, NULL, ks); + osmo_a5(l1cs->ul_encr_algo, l1cs->ul_encr_key, bi->fn, NULL, ks); for (i = 0; i < 57; i++) { if (ks[i]) - bits[i + 3] = - bits[i + 3]; + bi->burst[i + 3] = - bi->burst[i + 3]; if (ks[i + 57]) - bits[i + 88] = - bits[i + 88]; + bi->burst[i + 88] = - bi->burst[i + 88]; } } - /* put burst to function */ - func(l1t, tn, fn, chan, bid, bits, nbits, rssi, toa256); + /* put burst to function + * TODO: rather pass a pointer to trx_ul_burst_ind */ + func(l1t, bi->tn, bi->fn, chan, bid, bi->burst, bi->burst_len, bi->rssi, bi->toa256); return 0; } |