Commit Graph

18 Commits

Author SHA1 Message Date
Vadim Yanitskiy 2950c0363d osmo-bts-trx: handle MTS 0b0110 indicating an Access Burst
The PCU may poll the MS requesting an ACKnowledgment message to be
sent in form of four Access Bursts instead of Normal Bursts.  The
BTS has no prior knowledge of the Uplink burst type, so a new MTS
value was specified in order to prevent the BTS from trying to
decode Access Bursts as a PDTCH block.

This patch implements parsing of the new MTS value 0b0110.
Signalling RACH.ind to the PCU is to be implemented.

Change-Id: I0fbb63006797e6be386d1f76ed97fff098c036fc
Related: OS#4006, SYS#4794
2022-10-04 16:33:10 +00:00
Vadim Yanitskiy 2de4d9baa8 osmo-bts-trx: use consistent naming for 'enum sched_meas_avg_mode'
This is a purely cosmetic change.  The new naming clearly indicates
how deep to go back in the measurement history (S) and how many
samples to average (N).  For example:

* SCHED_MEAS_AVG_M_S4N4 - go S=4 steps back and average N=4 samples;
* SCHED_MEAS_AVG_M_S6N2 - go S=6 steps back and average N=2 samples.

Change-Id: I96a8dd08084c7c179f879fc00e75c5edcfb11caa
2022-03-18 03:53:02 +03:00
Vadim Yanitskiy 487feeb0ff osmo-bts-trx: use l1ts as talloc context for burst buffers
Before a massive refactoring of the scheduler structures [1] it was
impossible to have a clean hierarchy, in which the burst buffers
get allocated as children of their parent timeslot structures.

This change makes it easier to read talloc reports and simplifies
memory management, offloading free()ing of the burst bufferes to
talloc.

Change-Id: Idb1ceaf83c433d2d0eb84d77c2187a00a657905c
Related: [1] I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-12-12 18:59:34 +03:00
Pau Espin c2ae1df890 bts-trx: sched: tx_pdtch_fn: Drop log line clogging logs
The burst is properly pre-filled to _sched_dummy_burst in
bts_sched_init_buffers(), so we are fine doing nothing on C0.

Related: SYS#5676
Related: SYS#4919
Fixes: 300e31ed13

Change-Id: Ia7045724a1a3206f5890c0b12843711ad2360ed8
2021-10-25 18:32:54 +02:00
Pau Espin 5c5982067d Revert "bts-trx: sched: tx_pdtch_fn: Handle PCU idle blocks properly"
This reverts commit 8a85b71167.

This is actually the wrong fix. Proper fix comes as a follow-up patch,
since the root cause happens earlier in upper layers. No msg with
l2h=NULL should reach this point of code ever.

Change-Id: Ie23d94924f824bd7e89437ccf73b260f542477c6
2021-10-25 18:32:52 +02:00
Pau Espin 8a85b71167 bts-trx: sched: tx_pdtch_fn: Handle PCU idle blocks properly
PCU idle blocks are identified by being 0 length, and hence msg->l2h
being null. Don't try to encode those, but simply discard them silently.

In case there's a missing block in C0, we want to log the event since
the BTS is expected to send something on C0.

Related: SYS#5676
Related: SYS#4919
Fixes: 300e31ed13
Change-Id: I57e215fedeb415db4e67fdc56bf0f1410b5f7130
2021-10-25 15:57:24 +00:00
Pau Espin 991b4f6283 bts-trx: sched_lchan_pdtch: Refactor tx_pdtch_fn to get rid of goto tag
With this change the error case is moved at the end of the function,
which is more usual. At the same time, one goto tag can be removed,
simplifying the function.

This is also a preparation for next patch improvinga bit the logic
around same place.

Related: SYS#5676
Related: SYS#4919
Change-Id: Ifbd95ccbebf4d810b1fe0a162722e63fe69106b8
2021-10-25 15:57:24 +00:00
Vadim Yanitskiy 9be6b56033 osmo-bts-trx: return -ENODEV if 'bursts_p' is NULL
In functions responsible for Downlink burst scheduling, it may happen
that the buffer, containing a complete set of to be transmitted bursts,
a) is not yet allocated or b) was de-allocated intentionally.  In this
case, we return early to avoid NULL pointer dereference.  The returned
value is then checked against 0 in _sched_dl_burst().

Returning 0 makes _sched_dl_burst() apply per-burst attenuation, as
well as the A5/x encryption (if enabled).  And this makes no sense
in either of the cases mentioned above.

Moreover, in the BCCH power reduction mode, this causes some bursts
(bid > 0) of idle PDTCH/PTCCH blocks to be transmitted at full power,
breaking the energy saving feature.

Change-Id: I18aa73cc950fdfac030b63f7a434a71b4596095d
Related: SYS#4919
2021-09-24 23:41:44 +06:00
Vadim Yanitskiy 207d56afe5 [VAMOS] osmo-bts-trx: rework handling of Training Sequence
The TSC (Training Sequence Code) value in 'struct gsm_bts_trx_ts'
is always initialized in oml_rx_set_chan_attr() during the OML
bootstrapping, so there is no need for gsm_ts_tsc() - remove it.

Store the initial TSC value in 'struct gsm_bts_trx_ts', so we can
apply a different TSC value during the RSL CHANnel ACTIVation.

Store the Training Sequence Code/Set in 'struct trx_dl_burst_req'.
These values are indicated to the transceiver (TRXDv2 PDUs, 'MTS'
field) and used by the new TRX_{GMSK,8PSK}_NB_TSC macros.

Change-Id: I3744bc308b99ef941e6e9d139444e414abebc14b
Related: SYS#4895, OS#4941
2021-06-04 20:04:13 +00:00
Vadim Yanitskiy ef5c364bba [VAMOS] common/scheduler: unify symbol names for training sequences
Change-Id: Ice464e5b02b11b0f13df247fe6a01420a29bf1c5
Related: SYS#4895, OS#4941
2021-06-01 02:46:43 +00:00
Vadim Yanitskiy 462bf0952a [VAMOS] Re-organize osmo-bts-trx specific structures
Together with the 'generic' structures which used to be shared between
osmo-bsc and osmo-bts some time ago, we also have the following
osmo-bts-trx specific structures (in hierarchical order):

  - struct l1sched_trx (struct gsm_bts_trx),
  - struct l1sched_ts (struct gsm_bts_trx_ts),
  - struct l1sched_chan_state (struct gsm_lchan).

These structures are not integrated into the tree of the generic
structures, but maintained in a _separate tree_ instead.  Until
recently, only the 'l1sched_trx' had a pointer to generic
'gsm_bts_trx', so in order to find the corresponding 'gsm_lchan' for
'l1sched_chan_state' one would need to traverse all the way up to
'l1sched_trx' and then tracerse another three backwards.

                                 + gsm_network
                                 |
                                 --+ gsm_bts (0..255)
                                   |
  --+ l1sched_trx --------------------> gsm_bts_trx (0..255)
    |                                |
    --+ l1sched_trx_ts               --+ gsm_bts_trx_ts (8)
      |                                |
      --+ l1sched_chan_state           --+ gsm_lchan (up to 8)

I find this architecture a bit over-complicated, especially given
that 'l1sched_trx' is kind of a dummy node containing nothing else
than a pointer to 'gsm_bts_trx' and the list of 'l1sched_trx_ts'.

In this path I slightly change the architecture as follows:

                                 + gsm_network
                                 |
                                 --+ gsm_bts (0..255)
                                   |
                                   --+ gsm_bts_trx (0..255)
                                     |
    --+ l1sched_trx_ts <----------------> gsm_bts_trx_ts (8)
      |                                |
      --+ l1sched_chan_state           --+ gsm_lchan (up to 8)

Note that unfortunately we cannot 1:1 map 'l1sched_chan_state' to
'gsm_lchan' (like we do for 'l1sched_trx_ts' and 'gsm_bts_trx_ts')
because there is no direct mapping.  The former is a higl-level
representation of a logical channel, while the later represents
one specific logical channel type like FCCH, SDCCH/0 or SACCH/0.

osmo-bts-virtual re-uses the osmo-bts-trx hierarchy, so it's also
affected by this change.

Change-Id: I7c4379e43a25e9d858d582a99bf6c4b65c9af481
2021-05-18 19:11:06 +00:00
Vadim Yanitskiy 05493ca810 [VAMOS] osmo-bts-trx: move {chan,bid} to trx_{dl,ul}_burst_{req,ind}
Historically the logical channel handlers like rx_data_fn() used to accept
quite a lot of arguments.  With the introduction of additional measurement
parameters it has become clear that we need to group the arguments into
structures.  This is why both 'trx_{dl,ul}_burst_{req,ind}' structures
were introduced.

However, both channel type and burst ID were kept untouched, so until
now we had them being passed between the scheduler functions here and
there.  This change is a logical conclusion of the original change
mentioned above.

As a part of this change, the new LOGL1SB() macro is introduced.  It
does accept a pointer to 'trx_{dl,ul}_burst_{req,ind}' and expands the
context information for the old LOGL1S() macro.

Change-Id: Ic5a02b074662b3e429bf18e05a982f3f3e7b7444
2021-05-11 04:00:37 +02:00
Vadim Yanitskiy b619da5e72 osmo-bts-trx: 'burst type' is actually modulation type
Burst type and modulation type are actually different things.

Change-Id: Ic06c96434ad32dd3770b88cb1fefcbefb2fc3928
Related: SYS#4895, OS#4941, OS#4006
2021-04-24 08:47:00 +00:00
Pau Espin 7a7beb9b35 bts-trx: Avoid submitting first data_ind with FN=0 to upper layers
It can happen that the first burst we receive after enabling the PDCH
channel (when PCU connects to the BTS) is bid!=0. As a result,
chan_state->ul_first_fn is never set and defautl value 0 in there is
passed to the upper layers. As a result, when the 2nd block is
transmitted, this time with correct FN, the PCU will see a huge jump in
FNs. Since in PDCH the bursts are always consecutive, let's simply use
bi->fn - 3 as a first_fn and be done with the issue.

Related: OS#5020
Change-Id: Ie982caeb29f3ffd880b44e88a89b85ea3e6e6947
2021-03-11 18:42:00 +01:00
Pau Espin 166b10059b bts-trx: Always submit rx PDTCH DATA.ind to l1sap
Similar to what we have been doing for TCH channels, we want to make
sure all MAC blocks get to the upper layers, even if containing invalid
data (flagging it with data_len=0) so that upper layers (osmo-pcu
through PCUIF in this case) can rely on FN clock without gaps due to
Rx errors.

Related: OS#5020
Change-Id: I343c7a721dab72411edbca816c8864926bc329fb
2021-03-11 17:41:48 +00:00
Vadim Yanitskiy 4ded469b0f osmo-bts-trx/scheduler: refactor UL burst measurement processing
Currently the UL measurements (RSSI, ToA256, C/I) of the burst that
concludes a block are passed up to the higher layers. This means
that the measurement values of the other bursts are skipped.

Let's keep record of all UL measurements and average the values
before we pass them up to the higher layers. Use a simple ring
buffer to store the measurement history (up to 8 unique entries
for now). Remove *_num/*_sum variables from l1sched_chan_state.

Change-Id: I2b02b51fea5664f161382a4ddc63dbf14ffc9ac5
Related: OS#3032, OS#2978
2020-09-22 19:34:02 +00:00
Vadim Yanitskiy ae781bc5cd osmo-bts-trx: introduce and use struct trx_dl_burst_req
This change is similar to what we did for Uplink bursts:

  - group all Downlink burst parameters into a single structure,
  - allocate it once and pass a pointer to lchan handlers,
  - pass a pointer to trx_if_send_burst().

Given that the structure is allocated and (zero-)initialized in
trx_sched_fn(), we can get rid of some memset() calls in lchan
handlers and thus improve the overall performance a bit.

Change-Id: If3014e69746559963569b77561dbf7b163c68ffa
2020-06-15 10:42:03 +00:00
Vadim Yanitskiy 36c5ec4881 osmo-bts-trx: move logical channel handlers to separate files
It's easier to maintain the logical channel handlers in separate
files, rather than in a huge one (scheduler_trx.c, ~2k lines).

Change-Id: Ie5663fd90596b4800a4546675a323250bbb24c80
2020-06-15 10:42:03 +00:00