aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx/scheduler_trx.c
AgeCommit message (Collapse)AuthorFilesLines
2018-10-21scheduler_trx.c: Switch to osmo_timerfd() of libosmocore >= 0.12.0Harald Welte1-66/+4
Change-Id: I721d493659fde57eca1543b2e63171df1be1279d Fixes: Coverity CID#178646
2018-08-17fix timespec subtraction in compute_elapsed_us()Stefan Sperling1-12/+11
The previous implementation unconditionally subtracted nanosecond values from different time measurements, causing overflow if the current measurement was taken in less of a fraction of a second than the past measurement. Use timespecsub() instead, which accounts for nanoseconds correctly. This is a similar bug as fixed in osmo-pcu for issue OS#3225 While here, switch variables which are calculated based on struct timespec to 64 bit types. While probably not strictly necessary in practice, this makes the types used in calculations more compatible. Change-Id: Idfd9c807e35cd7fb5c80625b9746121f81c24599 Related: OS#3467 Related: OS#3225
2018-08-01Clarify frame loss counter for l1sched_chan_stateVadim Yanitskiy1-2/+2
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-20trx: scheduler: Keep RTP clock up to date while in DTXu pausePau Espin Pedrol1-4/+12
Upper layer requires us to trigger all events coming from lower layers in order to keep the RTP clock in sync. In this case, this is done by sending an empty payload to indicate there's no data to send. Change-Id: I0bdfb529f35253ca7e531bb9984a3839c3bfe7e8
2018-05-24scheduler_trx: Add reminders to use libosmocore functionsHarald Welte1-0/+3
Let' wait until the just-merged osmo_timerfd_* functions of Change-Id Ibeffba7c997252c003723bcd5d14122c4ded2fe7 have made it into the next tagged release, and then replace the implementation here. Change-Id: Ic0f0a7437b6acb535177e5ad6ac7a6d336654c66
2018-04-25scheduler_trx: Fix signed integer overflow in clock calculationsPau Espin Pedrol1-2/+3
Should fix following observed run time errors: osmo-bts-trx/scheduler_trx.c:1627:65: runtime error: signed integer overflow: -1081823 * 4615 cannot be represented in type 'int' osmo-bts-trx/scheduler_trx.c:1627:21: runtime error: signed integer overflow: 1852394502 - -697645849 cannot be represented in type 'int' Related: OS#3213 Change-Id: I36e0d2d0d0c6e35e963f611135453c4a4c00bc99
2018-04-17osmo-bts-trx: perform error concealment for FR framesPhilipp Maier1-2/+16
When a bad voice frame is received, it is replaced by a silence frame. This may cause unpleasant audio effects. This change implements a functionality to craft a replacement frame from the last known good frame using ECU implementation from libosmocodec. At the moment, only FR is supported. Depends: libosmocore I06a21f60db01bfe1c2b838f93866fad1d53fdcd1 Change-Id: Iae9e69a9578ae305bca42f834694af96a29084e6
2018-03-05scheduler_trx.c: remove ToA (Time of Arrival) hackVadim Yanitskiy1-9/+0
This was useful for software simulation of burst delay, expressed by ToA (Time of Arrival). Since we have FakeTRX toolkit, ToA value may be simulated in a more flexible way, so let's remove this code. Change-Id: Ied0fcfcf58b93efdc6de9666fbbf8fea104e2543
2018-02-27trx/scheduler: Use integer math for TOA (Timing of Arrival)Harald Welte1-27/+27
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-27Move rach_busy counting above L1SAPHarald Welte1-1/+5
In the past, rach_busy counting was performed below L1SAP, while reporting was handled above. This lead to subtle differences between the BTS models, such as osmo-bts-trx missing to increment rach_busy. Let's move the rach_busy counting above L1SAP to share more code. This means we need libosmocore Change-Id I9439810c3a3ad89ea0302753617b850749af887c for the additional required parameters in ph_rach_ind_param, as well as libosmocore Change-id I2b1926a37bde860dcfeb0d613eb55a71271928c5 for osmo-bts-trx to determine the RACH bit error rate. Change-Id: I3b989580cb38082e3fd8fc50a11fedda13991092 Closes: OS#3003
2018-02-08osmo-bts-trx: init nbits to know valueMax1-1/+1
It seems like some of the functions invoked by _sched_dl_burst() do not sent nbits properly. This leads to a number of errors on startup: trx_if.c:593 Tx burst length 65535 invalid It happens in conjunction with: Transceiver.cpp:382:pushRadioVector: dumping STALE burst in TRX->USRP interface Let's fix this by initializing nbits to 0 to make sure those bursts are properly ignored. Change-Id: Iaf85826861163c185925de528c8347ab22779e30
2018-02-05bts-trx: scheduler_trx.c: Fix missing headerPau Espin Pedrol1-0/+1
It is required for bts_shutdown used in trx_fn_timer_cb, and compiler warns about implicit declaration. Change-Id: I274662cd657ce8c36ed1d262d138590808bfafea
2017-12-04osmo-bts-trx: Fix reported frame number during PRIM_INFO_MEASHarald Welte1-4/+10
The upper layers (L1SAP, the common part of L1) *always* require frame numbers in the uplink direction to be reported as the frame number of the *first* burst, not the last burst of a given block. This is particularly important in the case of passing up measurement information, as we use this frame number to detect if the measurement interval for that specific timeslot has just ended (and hence we must process the measurements and send an uplink measurement report to the BSC. Before this patch, the measurement results were reported with the *last* frame number, which caused the common/measurement.c code never detect the end of a measurement window. On TS2, tons of the following log messages were observed: <0004> measurement.c:199 (bts=0,trx=0,ts=2,ss=0) no space for uplink measurement, num_ul_meas=104 With this patch, it behves as expected: the measurements of 25 blocks (= 100 bursts) are aggregated, after which point the report is computed and sent. Subsequently, num_ul_meas is reset to 0 and the cycle restarts. Related: OS#2329 Change-Id: I1065ae9c400bb5240a63ab8213aee59aeb9ceeff
2017-12-02scheduler_trx: L1P is for PH (data), L1M for MPH (control)Harald Welte1-46/+46
Almost all log statements in scheduler_trx.c were using the wrong logging subsystem. Let's fix this. Also, make it more obvious from the log subsystem help text Change-Id: I4312f8ab0414eb38db0d62f05c95ab961f500c14
2017-12-02scheduler: Harmonize log line format; Always print TS name + decoded FNHarald Welte1-114/+66
Change-Id: I5703b46c8a59fe00a3cdc063bcf72872980ec5e5
2017-11-06trx: Don't call osmo_fr_check_sid with negative 'rc'Harald Welte1-1/+2
In rx_tchf_fn(), if gsm0503_tch_fr_decode() returns a negative result, we cannot use that result as length argument to osmo_fr_check_sid() Change-Id: Ic4080b5bf6c865be3333f923f19a2340e1e272c8 Fixes: Coverity CID#178659
2017-07-24cosmetic: Move error goto path to the end of the functionPau Espin Pedrol1-8/+9
Change-Id: I3ad15a9edbfe74de3deb7298441d54fd9d0178ad
2017-07-24cosmetic: scheduler_trx.c: Add function to get rid of ugly goto pathPau Espin Pedrol1-15/+22
Change-Id: I9c2e166e6f182f703ccf49aa883c223e377c8421
2017-07-24cosmetic: scheduler_trx: Remove trailing whitespacePau Espin Pedrol1-8/+8
Change-Id: Ib057b5e5219ad2acfaee2dcc9ade098daa9ac985
2017-07-02TRX: permit transmission of all-zero loopback framesHarald Welte1-30/+5
For some reason, osmo-bts-trx attempted to interpret/validate the contents of the downlink TCH block that it was about to transmit. If such checks are made, they should clearly be in the common part above L1SAP, and not in the bts-model specific part. Also, having the checks in place didn't allow us to send an all-zero downlink block, as is required for detection of uplink FER in a loopback testing setup, e.g. with CMU-300. Change-Id: I6388de98e4a7e20843a1be88a58bba8d2c9aa0d5
2017-07-01TRX: Rename trx_if_data() -> trx_if_send_burst()Harald Welte1-1/+1
The new name makes it clear what the function actually does: Send burst data via the trx interface. Change-Id: I5031541d4ae4244a62a18acf71139db2874927fa
2017-06-28TRX: Use timerfd and CLOCK_MONOTONIC for GSM frame timerHarald Welte1-85/+245
using gettimeofday() is not suitable for the GSM frame timer, as it relies on the normal 'wall clock' system time, which may be adjusted by ntp, gps or other means at runtime. Switching to a different clock source means we cannot use osmo_timer_list anymore, but timerfd integrates just fine with our libosmocore select() loop handling. Change-Id: I51b19adde14ebb7ef3bb863d45e06243c323e22e Closes: #2325
2017-06-15scheduler_trx.c: strip unused variableVadim Yanitskiy1-2/+0
Change-Id: I870dad2a00f68cca1c31a719221fc30a07b30c20
2017-06-15cosmetic: fix some typosVadim Yanitskiy1-2/+2
Change-Id: Ib9172735bc7a05d9d7425a0e66dd90ff2569ee05
2017-05-27rx_tchh_fn(): Avoid copy+pasting formula to determine odd-ness of fnHarald Welte1-4/+7
Change-Id: Ic2a0bdaa70cc28c1ce8237351b0a0c6b998cf0a3
2017-05-27scheduler_trx: Avoid copy+pasting determining CMR from FNHarald Welte1-8/+12
instead, let's introduce a specific function for that. Also, as this can be easily determined from the frame number, skip one argument to tx_tch_common(). Change-Id: Ibbb9b685cf0b6a45339b0874438a500dd6254bc2
2017-05-27scheduler_trx.c: Avoid code duplication for BER10k computationHarald Welte1-8/+16
Use an (inline) function rather than code copy+pasting Change-Id: I42e76a4707968e428cbd2e43d5df71ef445efece
2017-05-27scheduler_trx.c: Fix typos, improve comments, cosmeticsHarald Welte1-25/+35
Change-Id: I5e2ce70aea8d62657ce3a7d6c16e5a7f8b76c22f
2017-05-22osmo-bts-trx: use libosmocodingMax1-20/+20
Remove built-in functions and use libosmocoding instead. Change-Id: I1b41bb1a8de655639107ec1f3b75afc240fd316f
2017-03-23osmo-bts-trx: fix scheduling of broken framesMax1-2/+4
* DTXu: don't set marker for broken frames * do not attempt to send 0-length bursts to avoid flood of errors after bts startup Change-Id: Icb536f951386b9abe34c0dacbb203f3db1e41bb3
2017-02-19osmo-trx-bts: Fix incorrect bts shutdown procedure in case of clock loss ↵Ivan Klyuchnikov1-13/+1
from osmo-trx This issue occurs in case of osmo-trx restart which leads to losing clock from osmo-trx. Function bts_shutdown from common/bts.c should be used in this case for proper bts shutdown. Change-Id: Ie65cf2e8f98cb8bf3314a00048aa53c1f8cd4c25
2016-11-29osmo-bts-trx: remove obsolete include of netif/rtp.hNeels Hofmeyr1-2/+0
Change-Id: Idf364fd7d69446a7a996062f71d701d9c6cca84c
2016-11-08Initialize parameters in osmo-trx for 11bit RACHbhargava1-0/+4
The parameters related to support 11bit RACH are initialized in osmo-trx. These parameter determaine the type of the RACH received in osmo-pcu. Change-Id: I164d449303373d0757719d5204f4716975fb517a
2016-10-13TRX: fix building with latest DTX changesMax1-2/+2
Bring up-to-speed with latest changes in OpenBSC. Change-Id: I16b24b2cd09600e215de163e7b5baae329887c9e
2016-08-08osmo-bts-trx: log decoder bit errors as DEBUG, not NOTICEMike McTernan1-1/+1
It is not an exceptional situation if the air-interface is experiencing non-recoverable decoding errors. At bad signal conditions and/or interference, this is perfectly normal. Let's use DEBUG instead of NOTICE log level. Change-Id: Ifd39c53ec22f57cdb5299e5d76ff6ff1482d3beb
2016-08-08Fill measurements data for L1SAPMax1-8/+22
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-47/+112
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-09log: osmo-bts-trx: change PDTCH block logs to DEBUG levelNeels Hofmeyr1-2/+2
Many erratic PDTCH blocks are expected. To not bloat the log, notifications for this should be on debug level. See http://lists.osmocom.org/pipermail/openbsc/2016-June/009457.html (Thu, 30 Jun 2016 01:49:33 +0300 / Alexander Chemeris <alexander.chemeris@gmail.com> / Re: GPRS on osmo-trx not working) Change-Id: Ie318248aa2b8de455174e72a63c602c7aeae312c
2016-07-09log: osmo-bts-trx: change access burst logs to DEBUG levelNeels Hofmeyr1-2/+2
Many erratic bursts are expected. To not bloat the log, notifications for this should be on debug level. See http://lists.osmocom.org/pipermail/openbsc/2016-July/009482.html (Tue, 5 Jul 2016 15:38:27 -0700 / Tom Tsou <tom@tsou.cc> / Re: osmo-bts-trx error logs -- was: GPRS on osmo-trx not working) Change-Id: If591c087ba8fd48564139e32930050ee8ab07001
2016-06-27TRX: add Uplink DTX support for FR/HRMax1-3/+13
* detect SID and set RTP Marker accordingly (emulate ONSET events) * set proper FN in TCH_IND * detect speech pause and do not send dummy 'bad' frames during that time Change-Id: Id518e5c667df7773c281effb9e75b66bf898f6fc Related: OS#1750
2016-06-21Use libosmocodec functions for AMRMax1-16/+19
Switch to using libosmocodec functions as a preparation step for DTX support as they expose necessary bits. Change-Id: Ie7423032fd06779d78876182ee63538d98906328 Related: OS#1750
2016-02-22Fix ocmo-bts-octphy interaction with OsmoPCUMax1-9/+7
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-15Introduce new phy_link and phy_instance abstractionHarald Welte1-17/+16
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-2/+2
This is the final step to make the L1 scheduler generally available to other BTS models than OsmoTRX.
2016-02-15TRX: scheduler: Remove dependency to trx_if.[ch]Harald Welte1-0/+10
2016-02-15TRX: scheduler: Move trx_sched_clock() to scheduler_trx.cHarald Welte1-0/+220
This funciton (and associated static functions) are TRX specific, and scheduler.c should only contain generic code.
2016-02-15TRX: call trx_loop_sacch_clock from TRX scheduler backendHarald Welte1-0/+6
this removes the dependency of scheduler.c on loops.h
2016-02-15TRX: split scheduler in generic part and backend partHarald Welte1-0/+1234
the backend is performing the actual encoding and decoding functions, while the generic part constsits of the TDMA structures and generating the RTS.ind