aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf_dl.cpp
AgeCommit message (Collapse)AuthorFilesLines
2020-03-16Use clock_gettime(CLOCK_MONOTONIC) and timespec everywherePau Espin Pedrol1-11/+11
We should really be using monotonic clock in all places that gettimeofday is used right now. Since clock_gettime() uses timespec, let's move all code to use timespecs instead to avoid having to convert in several places between timespec and timeval. Actually use osmo_clock_gettime() shim everywhere to be able to control the time everywhere from unit tests. Change-Id: Ie265d70f8ffa7dbf7efbef6030505d9fcb5dc338
2020-03-02llc_queue::{dequeue,enqueue}() refactorPau Espin Pedrol1-4/+5
As seen in OS#4420, setting the MetaInfo.recv_time outside of llc_queue before calling llc_queue::enqueue() and later on using that value in llc_queue itself at dequeue time is not a good idea, since it can provoke errors if the recv_time was not set correctly. For instance, LlcTest was not setting the value for recv_time on some test, which ended up with a huge millisec value when substracting now() from it: """ llc.cpp:215:29: runtime error: signed integer overflow: 1582738663 * 1000 cannot be represented in type 'long int' """ This issue only appeared when started building on a raspberrypi4. Let's better set/store the MetaInfo.recv_time internally during llc_queue::enqueue(). Then, enqueue() only needs the MetaInfo.expire_time, so let's change its arg list to only receive that to avoid confusions. Take the chance to move the llc_queue APIs to use osmo_gettimeofday, since we need to fake the time now that the API itself sets that time. Also take the chance during this refactor to disallow passing null pointer by default since no user needs that. Finally, update the LlcTest accordingly with all API/behavior changes. Related: OS#4420 Change-Id: Ief6b1464dc779ff22adc2b02da7a006cd772ebce
2020-01-06Pass paging group instead of imsi where later is not neededPau Espin Pedrol1-1/+4
Change-Id: Id0663a81f439f2d0b893b0d34f85a6db1927ef8e
2019-12-04tbf_dl.cpp: Fix typo in log linePau Espin Pedrol1-1/+1
Change-Id: I9fdea4246c95897f3e72604981597db828a219a3
2019-09-26tbf_dl.cpp: Remove dup call to tbf_update_ms_class() in state ↵Pau Espin Pedrol1-1/+0
GPRS_RLCMAC_WAIT_RELEASE tbf_update_ms_class() is already called two lines above in the common path. Fixes: 409efa1ec84c14aaa43bfac85ba4956e9f3cf16a Change-Id: Icbe3805c72a5c77366215be55128b586e5a00fb7
2019-09-26tbf_dl: Setup m_llc_timer in constructor using osmocom APIPau Espin Pedrol1-5/+1
Change-Id: I3e761b319326e33ab1d56c4fb30cafe3b0f96c29
2019-09-26Move tbf_{dl,ul} child constructors to respective .cpp filesPau Espin Pedrol1-0/+13
Fixes: 9d1cdb1f697057033394590a9b2815efe6c08cd9 Change-Id: Id258589d46de42ad4e27889bc396f930b7f94b79
2019-09-25Move out tbf subclasses from tbf.h to their own headersPau Espin Pedrol1-0/+2
It's a good start towards clearing current mess between parent and the 2 children classes. Change-Id: Ibc22ea2e02609af7ee058b8bc15df2115d4c6f60
2019-09-17Use osmo_tdef to implement dl-tbf-idle-timePau Espin Pedrol1-2/+4
Change-Id: I5e4f0d2f90e643600b7752525d6c2830856c9d3b
2019-09-12tbf_dl: add comments to the schedulerAlexander Couzens1-2/+13
Change-Id: Ib037f9fda30472313c7a82effb1e925c6abebbe5
2019-09-12Introduce osmo_tdef infra and timer VTY commandsPau Espin Pedrol1-4/+3
This will allow for configuration of some of the timers by the user, and allow him to inspect current values being used. It will be also useful for TTCN3 tests which may want to test some of the timers without having to wait for lots of time. Timers are splitted into 2 groups: BTS controlled ones and PCU controlled ones. The BTS controlled ones are read-only by the user (hence no "timer" VTY command is provided to change them). TbfTest.err output changes due to timers being set up correctly as a consequence of changes. Other application such as pcu_emu.cpp and pcu_main.cpp had to previosuly set the initial values by hand (and did so), but apparently TbfTest.c was missing that part, which is now fixed for free. Depends: libosmocore.git Id56a1226d724a374f04231df85fe5b49ffd2c43c Change-Id: I5cfb9ef01706124be262d4536617b9edb4601dd5
2019-09-11tbf_dl: make preemptive retransmission optionalOliver Smith1-1/+1
Since [1], OsmoPCU already starts to retransmit downlink blocks before the MS has had a chance to receive them and/or send the related acknowledgement in uplink. Make this optional with the new VTY option "no dl-tbf-preemptive-retransmission". [1] e25b5b91f60f20f61096bc6199a05b58ee6c6328 ("tbf: Only create dummy frames if necessary") Related: OS#2408 Change-Id: Id08aed513d4033aa0d4324c6ce07cbb2852f2f92
2019-04-08cosmetic: use const pointer for bts_dataMax1-2/+4
It's used several time for logging so let's call it once to make code easier to follow. Change-Id: Icfd9e5603a5d8701f487f17e9c0335d458e9e80b
2019-04-08Update MCS selection for retransmissionMax1-5/+3
In 3GPP TS 44.060 the selection of MCS for retransmissions is defined as separate tables (8.1.1.1 and 8.1.1.2) depending on the value of resegmentation bit (which is opposite to the way EGPRS_ARQ are defined in the source code). Let's follow the same idea and explicitly check for resegmentation bit value and use separate tables. This also makes it easier to add proper support for special cases (MCS-6-9 and MCS-5-7) and padding in future independently for different ARQ types. The code is also moved to c to avoid unnecessary conversions to and from cpp class. Change-Id: Ia73baeefee7a58834f0fc50e3b8bf8d5e3eb7815
2019-03-27TBF-DL: cosmetic update for helper routinesMax1-38/+32
* use enum values where appropriate * reformat to proper code style to improve readability Change-Id: If1d2bc69b0d43fc520e579457007704b7975117e
2019-03-27TBF: update MCS countersMax1-62/+57
* use enum CodingScheme directly instead of converting it to class and back * drop useless mode check * log errorneous update attempt Change-Id: I763136c2f356d63aa3d28d09c57fd5faf5336258
2019-03-26MCS: add mcs_is_*() helpersMax1-4/+4
In preparation for Channel Coding Command encoder in follow-up patches let's add necessary helpers. Those are similar to previously used helpers from GprsCodingScheme class but without CamelCase and with less typo chances between Gprs and Egprs cases. Change-Id: I6699cbc8d7ae766fa4d2b3d37e5f9ff1cf158b7e
2019-03-19TBF-DL: log MCS as stringMax1-5/+5
Log MCS name instead of numeric value. Change-Id: I3e1925a010a6def5fd14da63b73e0b75feddfafc
2019-03-19MCS: use value_string for conversionMax1-5/+6
Change-Id: I212ebb892ab162821633974d5a6c7e315d308370
2019-03-19MCS: move HeaderType enum outside of class definitionMax1-7/+7
Move functions which compute number of blocks or bits depending on header type and corresponding enum outside of GprsCodingScheme class. This will allows us to use standard libosmocore value_sting functions in upcoming patches for IA Rest Octet encoding/decoding. Change-Id: Id0873f85e1f16a72e17e7fbc4ad76b194917067f
2019-03-12MCS: move Coding Scheme enum outside of class definitionMax1-35/+35
Move generic MCS enum to C header file to simplify further modifications to GprsCodingScheme class in follow-up patches. This also allows us to use standard libosmocore value_sting functions in upcoming patches for IA Rest Octet encoding/decoding. Related: OS#3014 Change-Id: I993b49d9a82b8c7ad677d52d11003794aeabe117
2019-02-19Clarify write_immediate_assignment() signatureMax1-1/+1
* remove unused variable * use bool for boolean types * add clarification comments Change-Id: I363445063e2d873d9194b2a5924b9e59b8b7ea53
2018-02-20TBF: make network counters internalMax1-1/+1
* store N310* counters in shared array similar to corresponding timers * add functions to increment/reset counters This avoids direct access to TBF counters from PDCH. Change-Id: I8ffff9c7186f74bde7e6ac5f6e98f0b3e4c35274 Related: OS#1539
2018-02-19Update header includesMax1-2/+12
Many files include unnecessary headers and don't include headers which are actually used. Because of that combined with the fact that OsmoPCU is a mixture of C and C++, it makes it hard to modularize code. Fix this (using iwyu [1] tool): * add missing headers * remove unused headers [1] https://include-what-you-use.org/ Related: OS#1539 Change-Id: I8c9f488a43b099c72b2d30d3245e7ba50872fc00
2018-02-03TBF: add helpers for assignment type handlingMax1-6/+2
* add function to set/unset given assignment type * log assignment type flag changes * update tests output with additional logs This enables us to carefully track the TBF assignment type transitions. Change-Id: I3fe9d52472be8b7f257e8326b2f84e8e7d7bd1f4 Related: OS#1759
2018-02-03TBF: decrease logging verbosity for trafficMax1-2/+2
Change-Id: If43aa9895abf58602556c986a633ff93a6f00b06
2018-01-26Simplify TS alloc: adjust allocator signaturesMax1-3/+3
* drop unused parameters (from both functions and structs) * document used parameters and return values * tighten types used for parameters * use consistent formatting Tests are adjusted accordingly but test results are left untouched to avoid regressions. Change-Id: I39d81ab64ff790b9c4c2d0312a574485cd83e755 Related: OS#2282
2018-01-24TBF: make poll state internalMax1-2/+2
* add functions/macros for setting TBF's poll state * add function for checking TBF's poll state Change-Id: I6db1c4e7bd0a49aeb5e391afe371c36b96c6a702 Related: OS#1539
2018-01-24TBF: make UL/DL state internalMax1-1/+1
* add functions/macros for setting TBF's UL/DL state * add functions for checking TBF's UL/DL state * move pre-free check into separate function N. B: this should not be confused with TBF-UL or TBF-DL state. Change-Id: Idcbf5775d17b1247f2ed01788f9b0788ce66e871 Related: OS#1539
2018-01-19TBF: add dedicated log categoriesMax1-104/+87
Previously all TBF-related events were logged as part of DRLCMAC which is too broad to make it practically useful due to excessive amount of log messages generated. Introduce dedicated log categories for TBF-related events. Adjust test output as necessary. Change-Id: I64d660e5971263d5c63d2ba95d50625c16a594aa
2018-01-17TBF: log source of state transitionsMax1-5/+5
We use the same approach for osmo_fsm: when state transition happens, it's not very useful to always log the transition function itself, it's much more useful to see where the actual transition comes from. Change-Id: I348ba89bdda2b44c7019e9c893c764ee08c80bec Related: OS#1759
2018-01-12TBF: unify EGPRS window calculationMax1-16/+4
Move actual calculation into shared function and use it to set window size for TBF. TBT test output requires cosmetic adjuestements due to extended debug output. Change-Id: Ib9f4a277082da3c71007f5f3b4f2acac8b994540 Related: OS#1759
2018-01-12TBF: move window parameters to UL/DL levelMax1-0/+5
The UL and DL TBF use different classes implementing window management. Hence it's better to use it explicitly instead of using the common window management superclass inside common TBF superclass. While at it, also remove the direct access to window class - use accessor functions instead. Related: OS#1759 Change-Id: I0b55aa8947db65f7206adcf53ea32b74a831d9e6
2018-01-12TBF: cleanup state flag handlingMax1-13/+4
* introduce generic function to check whether particular flag was set for'a TBF and clear it if necessary. Use this instead of clear_poll_timeout_flag() * add function to explicitly set assignment and appropriate state flags Overall this makes the code easier to read and debug. Related: OS#1759 Change-Id: Ic4560280c72f91700f2e19c6c7f6658dc29625c2
2018-01-04cosmetic: clarify coding scheme and puncturingMax1-4/+4
* use appropriate types for coding scheme parameters * add comment regarding possible number of RLCMAC blocks The code in create_dl_acked_block() has underlying assumption that rlc.num_data_blocks can never be more than 2, which is true and is enforced by appropriate asserts but is not obvious when looking at the function code alone. It's equally hard for Coverity which leads to false positives in scan. Lets' make this assumption explicit by putting it into for(;;) condition alongside with corresponding comment. Fixes: CID143070 Change-Id: If599a6c8a6ef56d847604fcf41bb71decccd8a78
2018-01-04TBF-DL: mark rcvd_dl_ack() parameters as booleanMax1-2/+2
The final(_ack) parameter of rcvd_dl_ack() only used as boolean - mark it as such. Change-Id: Icc4d68f049a45d4b42c5594f50594ff0d44c1bac
2018-01-02TBF: log timer invocation sourceMax1-3/+3
When troubleshooting TBF timers we're not only interested in timer duration but also in the code which triggered it. Let's use LOGPSRC to log it: wrap t_start() in a macro for convenience. Change-Id: If5f883ae52c469e5158bad24da9904fdc455582f Related: OS#2407
2018-01-02TBF: unify timer handlingMax1-2/+1
Use generic timer handling infrastracture to handle assignment/reject internal timer. Rename timer array accordingly. Use defines with explicit second/microsecond values to make it more readable. Change-Id: I63fb7e6f0695383a83472c836a381a055f64690b
2017-12-20TBF: implement independent T31xx timersMax1-7/+7
Previously TBF got single timer so the pending timer was automatically cancelled when new one was scheduled. Let's make it more robust by implementing independent T31 xx timers from 3GPP TS 44.060 §13.2 with corresponding start/stop functions and counters. The semantics of the timers is preserved as before: pending timers are restarted unconditionally. It might be neecessary to change this later on after spec review. N. B. T0: used for assign/reject timeouts, have to be properly attributed and documented first. Change-Id: I0305873ca47534f53441247217881da59625e1f7 Related: OS#2407
2017-12-20Introduce LOGTBF* for consistent loggingMax1-25/+17
When troubleshooting complex issues with TBF lifecycle, it's much easier to follow the logs which are consistently formatted. Add LOGTBF*() macro similar to struct-specific log routines we use in other Osmocom project and use it to log TBF-related messages in a unified way. Tweak test output accordingly. Related: OS#2407 Change-Id: I388249afefc32d2f6e5cb5e5abc6daf4dbd284ea
2017-12-15TBF-DL: fix misleading idle time checkMax1-1/+1
The dl_tbf_idle_msec is uint32_t so it cannot be < 0. Change-Id: Ic88cb4698bcb9be52a5179529f81b8728bf4f93f
2017-12-05TBF: expand timer loggingMax1-4/+4
* log timer values * log start/stop cause * update test output as necessary This simplifies debugging issues with TBF timers. Related: OS#2407 Change-Id: Ib8e537416af9bec5d447356286f44e9e8bbf1b7a
2017-09-08TBF-DL: extend index check for RLC block copyMax1-0/+3
Log number of RLC blocks to copy and assert if trying to copy too many blocks. Change-Id: I01cbc26ec67400a44e9fff3f9a30d729320380f9 Fixes: CID143069
2017-09-04cosmetic: convert explicit warnings to fixme/todoMax1-1/+1
We do not use this style (#warning as an issue tracker replacement) in any other Osmocom project. Also those warnings clutter compiler output making it harder to spot warnings for the actual code. Change-Id: I72070e2a027e60e8b80c12ccfa23ff075434689f
2017-08-14Simplify polling troubleshootingMax1-3/+1
* introduce enum describing poll kind and use it in set_polling() * move state change into set_polling() * move logging into set_polling() and unify output * move duplicated code into static function * adjust tests to match unified logging output Change-Id: I14074207f8bbc18b3ebd60875bb99a0a3a4b399d Related: OS#1524
2017-08-14Move DL assignment to TBF-DLMax1-1/+35
This function does not really belongs to BTS and it heavily relies on direct access to TBF-DL members anyway. Change-Id: I04584103018675a2f35cfb565473bfd81a208d7c Closes: OS#1540
2017-07-29Remove #warnings that have been adressed since 2015Harald Welte1-2/+0
In commit 939904672961fa7e28397e27f942a7d1fff4bbdf the lookup by TLLI, TLLI-OLD and IMSI has been implemented, but the corresponding compile-time warning was never removed. Change-Id: I7a1767bc7cab01048e851fd4e63112bc676d6c78
2017-07-10Remove TBF knowledge from rcv_control*dl_ack_nackMax1-2/+24
Do not access TBF internals directly from rcv_control*dl_ack_nack() - wrap corresponding code into TBF-DL method. Change-Id: I3d1b5782001e45617b4a960612fcfc249904b37c Related: OS#1539
2017-05-26Cleanup FN schedulingMax1-16/+13
* replace magic number with defined constant * move copy-pasted code to inline functions * remove unused code Change-Id: I6fee0714453d0c3c3f3f875f88daea2d9c477331 Related: OS#1524
2017-02-14dl tbf: initialize punct values and verifyNeels Hofmeyr1-4/+8
Solves a sanitizer issue where punct2 is unset when passed to gprs_rlc_mcs_cps() and thus takes a value not defined in the enum. Change-Id: I004cbbab15e6ffa2749f4b7f1df651517c2ae693