aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/scheduler.c
AgeCommit message (Collapse)AuthorFilesLines
2020-04-25dtx: add detection of AMR DTX frames for osmo-bts-trxPhilipp Maier1-1/+3
Currently we do not detect any of the DTX frames (SID_FIRST, SID_UPDATE etc.) Detecting and tagging those frames as is_sub is important for measurement processing. Also the RTP marker bit must be set on each ONSET frame. - Add detection of DTX frames - Tag DTX frames as is_sub and set frame type to AMR_SID - Set RTP marker bit when ONSET frames are received Change-Id: I5afe730fff2fa3199a5913b0de4f5c7b23a39f31 Depends: libosmocore I2bbdb39ea20461ca08b2e6f1a33532cb55cd5195 Related: OS#2978
2020-04-04scheduler: always call Uplink burst handler on NOPE.indPhilipp Maier1-34/+11
When a NOPE indication is received from the TRX normally a separate handler (.nope_fn) is called. It turned out that calling the Uplink handler (.ul_fn) on NOPE indications is the usual case, so let's remove the .nope_fn member and call the Uplink handler directly. Since a NOPE.ind comes without burst bits, the Uplink handlers must check bi->burst_len to avoid uninitialized memory access. For some logical channels (in particular RACH, PDTCH/U, and PTCCH/U) it does not make sense to call the Uplink handler, so we ignore them. Change-Id: Ice45d5986610d9bcef2a7e41f0a395ec779e3928 Related: OS#4461
2020-03-22trx: Use NOPE indications on SDCCHHarld Welte1-0/+12
Without using the NOPE indication it might happen that we get into the following situation: * bursts 0,1,2 of a given block are received * burst 3 is lost on the radio interface, OsmoTRX sends NOPE * osmo-bts-trx doesn't pass the NOPE the the rx_tch*_fn() * we never detect the end of the block, never perform decoding and even if the burst could be fully decoded, we loose the block Related: OS#4661 Related: OS#2975 Change-Id: Idfc5c9a23db808c5f87ef5646c7e1d1cd3127371
2020-03-22trx: Use NOPE indications from OsmoTRX for TCH/F and TCH/HHarld Welte1-0/+3
Without using the NOPE indication it might happen that we get into the following situation: * bursts 0,1,2 of a given block are received * burst 3 is lost on the radio interface, OsmoTRX sends NOPE * osmo-bts-trx doesn't pass the NOPE the the rx_tch*_fn() * we never detect the end of the block, never perform decoding and even if the burst could be fully decoded, we loose the block For voice, it can lead to lost RTP frames in uplink, which is also problematic. Let's deal with burst_len=0 in rx_tch*_fn() and use it as nope_fn. Closes: OS#4661 Related: OS#2975 Change-Id: I0fbf4617daf24bd8aecfd9cfe1efd66cf73a277a
2020-01-20l1sap: merge MEAS IND into PRIM PH DATA / PRIM TCHPhilipp Maier1-1/+6
The MPH INFO MEAS IND indication, which contains the uplink measurement data is sent in parallel to the PH DATA and TCH indications as a separate indications. This makes the overall uplink measurement data processing unnecessarly complex. So lets put the data that is relevant for measurement into the PH DATA and TCH indications directly. This change only affects osmo-bts-trx at the moment. In order to keep the upper layers (l1sap.c) compatible we add an autodection to switch between separate measurement indications and included measurement data. Related: OS#2977 Depends: libosmocore I2c34b02d329f9df190c5035c396403ca0a4f9c42 Change-Id: I710d0b7cf193afa8515807836ee69b8b7db84a84
2020-01-03rsl: ensure measurement reports are sentPhilipp Maier1-0/+15
osmo-bts currently does not generate a measurement report in case the SACCH of the related traffic channel is lost. This is a problem because the moment when reception gets bad measurmenet reporting is crucial to carry out handover decisions effectively. The presence of a SACCH block controls the conclusion of the measurement interval and the sending of the RSL measurement report. The latter one not only requires a measurmenet indication, it also requires a fully intact SACCH block. Lets use the NOPE / IDLE indications from V1 of the TRXD protocol to ensure a SACCH block is always reported up to l1sap.c. In cases where the SACCH is bad, trigger the sending of the RSL measurement report manually without attaching the measurmenet data from the MS (which we do not have in this case) Related: OS#2975 Depends: osmo-ttcn3-hacks Ib2f511991349ab15e02db9c5e45f0df3645835a4 Change-Id: Idfa8ef94e8cf131ff234dac8f93f337051663ae2
2019-11-19osmo-bts-trx: general handling of NOPE / IDLE indicationsVadim Yanitskiy1-0/+15
Each logical channel can now optionally have an additional handler, that will be called when a NOPE / IDLE indication is received from the transceiver. The aim of that handler is to keep the logical channel state updated in case if one or more Uplink bursts are lost. Change-Id: I71c552f44c25e56e9779d8b8ef5d4de9f8475637 Related: OS#3428
2019-10-17Fix common misspellings and typosMartin Hauke1-2/+2
Change-Id: I403b9029f57fec3fdec2c1e2cbeac0f6eab53f24
2019-10-04scheduler: fix handling of PTCCH/U and PTCCH/D logical channelsVadim Yanitskiy1-3/+7
According to 3GPP TS 45.010, section 5.6.2, for packet-switched channels the BTS shall monitor the delay of the Access Bursts sent by the MS on PTCCH and respond with timing advance values for all MS performing the procedure on that PDCH. According to 3GPP TS 45.002, section 3.3.4.2, PTCCH (Packet Timing advance control channel) is a packet dedicated channel, that is used for continuous Timing Advance control (mentioned above). There are two sub-types of that logical channel: - PTCCH/U (Uplink): used to transmit random Access Bursts to allow estimation of the Timing Advance for one MS in packet transfer mode. - PTCCH/D (Downlink): used by the network to transmit Timing Advance updates for several MS. As per 3GPP TS 45.003, section 5.2, the coding scheme used for PTCCH/U is the same as for PRACH as specified in subclause 5.3, while the coding scheme used for PTCCH/D is the same as for CS-1 as specified in subclause 5.1.1. The way we used to handle both PTCCH/U and PTCCH/D is absolutely wrong - they have nothing to do with xCCH coding. Instead, we need to use tx_pdtch_fn() for Downlink and rx_rach_fn() for Uplink. In l1sap_ph_rach_ind() we need to check if an Access Burst was received on PTCCH/U and forward it to OsmoPCU with proper SAPI value (PCU_IF_SAPI_PTCCH). To be able to specify a SAPI, a new parameter is introduced to pcu_tx_rach_ind(). Change-Id: I232e5f514fbad2c51daaa59ff516004aba97c8a3 Related: OS#4102
2019-10-02scheduler: Use OSMO_ASSERT instead of abortPau Espin Pedrol1-4/+3
Change-Id: I594842b08cdb97a473273ba7097a05502f5751b8
2019-10-02scheduler.c: Move some message log level to DEBUGPau Espin Pedrol1-4/+4
Otherwise using "logging level set-all info" makes it impossible to see anything in VTY due to tons of those two lines appearing. Change-Id: I9c7500c1e56db0c4dcb474f93c882a9c7c004d55
2019-07-16osmo-bts-trx/scheduler: pass trx_ul_burst_ind to lchan handlersVadim Yanitskiy1-6/+15
This change needs to be done in order avoid adding more and more arguments to the UL logical channel handlers (such as rx_rach_fn). Since we have different versions of the TRXD header, and may have other burst-based PHYs in the future, some fields of an Uplink burst indication have conditional presence. Change-Id: Iae6b78bafa4b86d0c681684de47320d641d3f7c0 Related: OS#4006, OS#1855
2019-06-27osmo-bts-trx/trx_if.c: introduce TRXD header version handlingVadim Yanitskiy1-13/+13
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
2019-06-08common/scheduler.c: refactor description of TRXC_* lchansVadim Yanitskiy1-98/+452
Let's avoid fancy alignment in the description of logical channels for the benefits of having better readability, the ability to add more comments and fields without making it look ugly. Get rid of value-string array 'trx_chan_type_names', since each logical channel has its name defined in 'trx_chan_desc'. Get rid of field 'chan' of 'trx_lchan_desc' structure since it's not used anywhere, and not actually needed because the position of each lchan description is defined by its TRXC_* type. Replace both 'pdch' and 'auto_active' fields with more generic bitmask field called 'flags', and define the following flags: - TRX_CHAN_FLAG_AUTO_ACTIVE, - TRX_CHAN_FLAG_PDCH. Use RSL channel mode #defines from libosmogsm instead of having hard-coded numbers. This increases readability. As a bonus, let's add a human readable description to each lchan definition, so it can be printed in the VTY some day. Change-Id: I9d5d49ec569f133d37b8164b22607d4700474315 Backported from: I2fc61e1cdca4690a34e2861b9ee3b7c64ea64843 I7ab4958801b3422973b67ff0452b90afa8a3f501
2018-10-25common/scheduler.c: track TDMA frame loss per logical channelsVadim Yanitskiy1-67/+142
This change modifies the logic of TDMA frame loss tracking. To be more precise, the tracking logic was moved from per timeslot level to per logical channel level, what makes OsmoBTS more accurate in its measurements. But before getting into details, it's important to clarify some things about the Uplink burst processing in transceiver (OsmoTRX). If an Uplink burst is detected, OsmoTRX demodulates it and sends to OsmoBTS. If nothing is detected on a particular timeslot, OsmoTRX will do nothing. In other words, it will not notify OsmoBTS about this. Meanwhile, there are usually a few logical channels mapped to a single TDMA timeslot. Let's use SDCCH8 channel configuration as an example (simplified layout): /* SDCCH/8 (ss=0), subscriber A (active) */ { TRXC_SDCCH8_0, bid=0 }, { TRXC_SDCCH8_0, bid=1 }, { TRXC_SDCCH8_0, bid=2 }, { TRXC_SDCCH8_0, bid=3 }, // <-- last_fn=X /* SDCCH/8 (ss=1), subscriber B (inactive) */ { TRXC_SDCCH8_1, bid=0 }, { TRXC_SDCCH8_1, bid=1 }, { TRXC_SDCCH8_1, bid=2 }, { TRXC_SDCCH8_1, bid=3 }, /* SDCCH/8 (ss=2), subscriber C (active) */ { TRXC_SDCCH8_2, bid=0 }, // <-- current_fn=X+5 { TRXC_SDCCH8_2, bid=1 }, { TRXC_SDCCH8_2, bid=2 }, { TRXC_SDCCH8_2, bid=3 }, SDCCH8 has 8 sub-slots, so up to 8 subscribers can use a single timeslot. Let's imagine there are three subscribers: A, B, and C. Both A and C are active subscribers, i.e. they are continuously transmitting UL bursts, while B is not using ss=1 anymore. The original way of TDMA frame loss tracking was the following: - when an UL burst is received, store it's frame number in the timeslot state structure (last_fn); - when the next UL burst is received on same timeslot, compute how many frames elapsed since the last_fn; - if elapsed = (current_fn - last_fn) is lower than 10, then iterate from (last_fn + 1) until the current_fn and send dummy zero-filled bursts to the higher layers; - otherwise (elapsed > 10), process the current burst, and do nothing :/ According to our example, subscriber A is sending 4 bursts, then nobody is sending anything, and then subscriber C is sending 4 bursts. So, there is a 4 frames long gap between the both transmissions, which is being substituted by dummy bursts. But, as the logical channel on ss=1 is not active, they are dropped. This is not that scary, but the current algorithm produces lots of false-positives, and moreover is not able to track real frame drops in longer periods (i.e. >10). So, tracking the frame loss per individual logical channels makes much more sense. Let's finally drop this hackish 'while (42) { ... }', and track the amount of lost / received TDMA frames (bursts) individually per logical channels. Let's also use the multiframe period as the loss detection period, instead of hardcoded 10. And finally, let's print more informative debug messages. Also, it makes sense to use the amount of lost / received bursts during the calculation of the measurement reports, instead of sending dummy bursts, but let's do this separately. Change-Id: I70d05b67a35ddcbdd1b6394dbd7198404a440e76 Related: OS#3428
2018-09-17l1sap/scheduler: Consistently print chan_nr as hex numberHarald Welte1-2/+2
It's very confusing if some log messages log chan_nr as decimal, while most log it as hexadecimal. Let's standardize on hex everywhere. Change-Id: Ia6566d5bbee8124fb7c689c962ce34d714208503
2018-09-09CBCH: Implement CBCH support for osmo-bts-{trx,virtual}Harald Welte1-0/+3
This patch adds scheduler support for the channel combinations that substitute SDCCH index 2 for a CBCH in either a SDCCH/8 or SDCCH/4. Change-Id: Icc15603079a1709ec094f400a9bcf0008211890f Closes: OS#1617
2018-08-01Clarify frame loss counter for l1sched_chan_stateVadim Yanitskiy1-3/+3
Each logical channel (e.g. SACCH, SDCCH, etc.) has a counter of lost L2 frames. Let's use a bit better name for it, and correct its description in the 'l1sched_chan_state' struct definition. Change-Id: I92ef95f6b3f647170cfd434a970701406b0a7c82
2018-07-20scheduler: Log error on fn jumpPau Espin Pedrol1-2/+5
Change-Id: I28f01e3f7fff6f1fb52a3c593a837f4f924bb2d9
2018-07-20sched: Log RX->RTP packet like we do in add_l1sap_headerPau Espin Pedrol1-1/+7
Other backends use already msgb in lower layers and eventually call add_l1sap_header to push TCH data up the stack. backends using common/scheduler.c (bts-trx, bts-virt) are the only ones not yet using msgb in lower layer but only creating the msgb immediatelly before sending it in _sched_compose_tch_ind. Let's add a log message there too to have similar output in all BTS backends. Change-Id: Ia90b051f308abcd8b88b84e861da593844b0d81a
2018-02-27L1SAP: Increase resolution of reported burst timingHarald Welte1-2/+2
Before this patch we had: * osmo-bts-trx internally using 1/256th bit/symbol period * osmo-bts-sysmo internally using 1/4 bit/smbol period * PCU interface using 1/4 * L1SAP interface using 1/4 * measurement processing code on top of L1SAP using 1/256 So for sysmo/lc15/octphy we are not loosing resolution, but for osmo-bts-trx we're arbitrarily reducing the resolution via L1SAP only then to compute with higher resolution again. Let's change L1SAP to use 1/256 bits and hence not loose any resolution. This requires a corresponding change in libosmocore for l1sap.h, which is found in Change-Id Ibb58113c2819fe2d6d23ecbcfb8b3fce4055025d Change-Id: If9b0f617845ba6c4aa47969f521734388197c9a7
2018-02-27trx/scheduler: Use integer math for TOA (Timing of Arrival)Harald Welte1-2/+2
There's no need to express TOA as a float: * We receive it as signed 16bit integer in units 1/256 symbol periods * We pass it to L1SAP as signed integer in 1/4 symbol periods So 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. Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec
2018-02-26scheduler: Add missing \n at end of LOG statementHarald Welte1-1/+1
Change-Id: I55419dfa884b4170dfed696a7e1334940a46ba82
2018-02-26split scheduler_mframe.c from scheduler.cHarald Welte1-815/+0
There are use cases for the multiframe scheduler tables outside the context of the entire scheduler. Let's prepare for that. Related: OS#2978 Change-Id: I6a501e66c47809ae3cdc55bef2cb6390ee0096b1
2018-02-23scheduler.c: Print message when burst substitution happensHarald Welte1-1/+4
Whenever we receive discontinuous frame numbers from the TRX socket, osmo-bts-trx is substituting zero-filled bursts for those frame numbers which we missed. Don't just do this silently, but actually log about it, as it is an error. Note: This [currently] happens when using a virtual air interface with trxcon as opposed to a real SDR receiver with osmo-trx. Change-Id: If79eab37c80647c9ab64f399fa4676d97af3e9ad
2018-02-23scheduler: add trx_sched_is_sacch_fn() functionHarald Welte1-0/+40
For proper measurement processing of RX{LEV,QUAL}-SUB, we will need this information. Related: OS#2978 Change-Id: I768fde62452a74dce471ebf946e56eb1e4de1abc
2018-02-23scheduler.c: Factor out find_sched_mframe_idx() functionHarald Welte1-15/+22
Let's split the look-up of the multiframe scheduler from the asignment to a given l1ts in trx_sched_set_pchan. Related: OS#2978 Change-Id: I79548b25aae647ce993a9d83c771d22b08cb1c74
2017-12-02scheduler: Harmonize log line format; Always print TS name + decoded FNHarald Welte1-30/+21
Change-Id: I5703b46c8a59fe00a3cdc063bcf72872980ec5e5
2017-08-09L1SAP: Use RSL_CHAN_OSMO_PDCH across L1SAPHarald Welte1-2/+2
So far, L1SAP code is hiding RSL_CHAN_OSMO_PDCH from the bts specific code below L1SAP. This is some kind of a hack/workaround, making code and debug output / logs more difficult to understand. So let's teach the lower layer how to treat RSL_CHAN_OSMO_PDCH and remove the "hiding" code from the common l1sap.c code. Change-Id: Iaaa833febe45b82166d3901f10cc5466a7591c19
2017-07-19scheduler: Fix wrong log subsystem: L1C is L1 *control* not user dataHarald Welte1-9/+9
RTS.ind, DATA.* and TCH.* primitives are L1P, not L1C. Change-Id: I4a32b83225e931ced561fdf457fa962e8ad44bd2
2017-06-15cosmetic: fix some typosVadim Yanitskiy1-3/+3
Change-Id: Ib9172735bc7a05d9d7425a0e66dd90ff2569ee05
2017-04-28osmo-bts-trx: cosmetic log fixMax1-9/+11
Print actual value causing error and the check range. Change-Id: Ic36c0558cdbd1790c167f290a40007b42f5de65d
2017-01-10scheduler: log lchan on which prim error occuredMax1-4/+49
Log both lchan and trx_chan_type (using introduced value_string). Change-Id: I80c581b54eeee371ee524a75a400d1e9ece16c68
2016-12-05TRX: prevent segfault upon phy initMax1-0/+3
Previously if multiply phy instances were configured but not used osmo-bts-trx would segfault. Terminate with clear error message instead so user can correct configuration. Example configuration which caused problem: ... phy 0 instance 0 instance 1 ... trx 0 phy 0 instance 0 Note the 2nd instance of phy 0 which is not used in trx later on. Change-Id: Id979506731ea92401458f1060e87aeb690901539
2016-11-11Replace link_id constant with defineMax1-38/+38
Instead of using constant for link_id directly, use shared define value. Change-Id: Ibf3d439d8893bd994ba089796175b6c635db2cf8
2016-08-08Fill measurements data for L1SAPMax1-1/+8
Fill in values for BER, BTO, Link quality in L1SAP and send them to PCU. Note: this increases the version of BTS <-> PCU protocol. It also requires corresponding changes in libosmocore. All BTS models provide measurements data unless direct DSP access for PCU is enabled. For BTS-specific notes see below. Octphy: conversion from sSNRDb to Link Quality uses formulae which works in practice instead of what's documented for sSNRDb value. Subject to change in future revisions. TRX: C / I link quality estimator is not computed. Change-Id: Ic9693a044756fb1c7bd2ff3cfa0db042c3c4e01c Related: OS#1616
2016-07-28trx: Enable EGPRS handling through burst lengthsTom Tsou1-11/+15
Existing interfaces are coded with the implicit expectation of using a burst sequence length of 148, which is constant with GSM and GPRS. That changes with EGPRS, where the burst length may be 444 due to the use of 8-PSK instead of GMSK modulation. Setup the interface to accept and return a length value with the burst sequence. This allows 444 length bit vectors to/from the EGPRS decoder/encoder. Length is explicitly used as a identifier for 8-PSK vs. GMSK modulated sequences. Change-Id: I90b46b46b11b6ce280e7f8232d5a2fccec2d4f18 Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-07-27log typo: trx_sched_set_pchan()Neels Hofmeyr1-1/+1
Change-Id: Icdb193ec6dbb95cf0c3e441c196b309aa599efe6
2016-07-25trx: Add EGPRS tables, sequences, and mappingsTom Tsou1-0/+27
Includes EGPRS specific convolutional codes, interleaving tables and functions, burst mappings, training sequences, and parity checks from 3GPP TS 44.060 needed to handle MCS codings 1-9. Change-Id: Ie270398dd7a72f282ba53e646853d8de1eabee93 Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
2016-02-22Fix ocmo-bts-octphy interaction with OsmoPCUMax1-1/+2
Previously osmo-bts-octphy have not provided in-band presence information which cause off-by-one errors and misinterpretation of ph_data_ind by PCU. This fixed now by adding support for explicitly passing PH-DATA presence info. Corresponding check and in-band passing of presence information are removed. Note: this requires libosmocore version with osmo_ph_pres_info_type support integrated. [hfreyther/max: Remove + 1 from the decoded length]
2016-02-15scheduler: Fix ARRAY_SIZE() in trx_sched_init()Harald Welte1-1/+1
We want the size of the array, not of the pointer to the array. Found by coverity (CID 1351422).
2016-02-15use unsigned int to compare wih ARRAY_SIZEHarald Welte1-1/+1
This is not really an issue, but makes coverity happy (CID 1351422).
2016-02-15Introduce new phy_link and phy_instance abstractionHarald Welte1-2/+4
This way we can model a flexible mapping between any number of PHYs, each having multiple instances, and then map BTSs with TRXx on top of those PHYs.
2016-02-15TRX: Move scheduler to src/commonHarald Welte1-0/+1621
This is the final step to make the L1 scheduler generally available to other BTS models than OsmoTRX.