aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf.cpp
AgeCommit message (Collapse)AuthorFilesLines
2018-07-11tbf: Replace '.' in counter names with ':'Pau Espin Pedrol1-32/+32
The '.' is illegal character in counter names, as they are exported via CTRL interface, where '.' has a special meaning that cannot be used by strings comprising the variable name. Change-Id: Ieb7496e1a30ab4f2bfe36c7b664dcdc034010a15
2018-07-11tbf: Use incrementing id for rate_ctr_group_allocPau Espin Pedrol1-8/+18
Wrap-around of var handling next id will luckly happen long after initially assigned TBFs are already released. Change-Id: I90ef64133986c556c1a529f5b966e847e6cabbad
2018-05-25read monotonic clock with clock_gettime() instead of gettimeofday()Stefan Sperling1-6/+7
There have been test failures on the osmo-pcu Jenkins builders due to apparent clock drift. Switch relevant code from gettimeofday() to clock_gettime() with CLOCK_MONOTONIC to prevent time from going backwards and causing negative time deltas in calculations. Change-Id: I775d85d0d3ac740330879e588bdab6fce7f0b46c Related: OS#3225
2018-05-16tbf: Fix memset(0) on object with no trivial copy-assignmentPau Espin Pedrol1-1/+1
As warned by gcc 8.1.0: osmo-pcu/src/tbf.cpp: In constructor ‘gprs_rlcmac_tbf::gprs_rlcmac_tbf(BTS*, gprs_rlcmac_tbf_direction)’: osmo-pcu/src/tbf.cpp:222:33: error: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct gprs_rlc’ with no trivial copy-assignment; use assignment or value-initialization instead [-Werror=class-memaccess] memset(&m_rlc, 0, sizeof(m_rlc)); ^ In file included from osmo-pcu/src/tbf.h:24, from osmo-pcu/src/bts.h:37, from osmo-pcu/src/tbf.cpp:22: osmo-pcu/src/rlc.h:234:8: note: ‘struct gprs_rlc’ declared here struct gprs_rlc { ^~~~~~~~ Change-Id: Ifb0529b9ae6cd4300e5cbbd9151054792edbfe06
2018-04-12tbf: add frame number to log outputPhilipp Maier1-7/+11
Currently, the TBF timer log messages lack the frame number in the logoutput - Add frame number to TBF timer related log-statements Change-Id: I5a744dc5cd7c1de1baea13fffac026c83d091429 Related: SYS#4139 Patch-by: Octasic inc.
2018-02-20TBF: make network counters internalMax1-18/+64
* 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-19Move PDCH-related functions into separate filesMax1-0/+1
The PDCH class and corresponding functions are rather self-contained and independent from BTS implementation. Let's move them into separate file to make bts.cpp more manageable. As additional benefit it allow us to somewhat untangle all the different cross-dependent includes. Change-Id: Ie05e25361e6741a81b024679f9675c98d4923683 Related: OS#1539
2018-02-19Update header includesMax1-2/+8
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-01-26Simplify TS alloc: fix allocation callsMax1-2/+3
Using the semantic patch below, adjust allocation-related calls to match updated allocator signatures. // spatch --c++ --dir src -I src --sp-file callfix.spatch --in-place --recursive-includes // spatch --c++ --dir tests -I src --sp-file callfix.spatch --in-place --recursive-includes @@ expression A, B, C, D, E; @@ tbf_alloc_ul_tbf(A, B, C, D, E, ( - 1 + true | - 0 + false ) ) @@ expression A, B, C, D, E; @@ tbf_alloc_dl_tbf(A, B, C, D, E, ( - 1 + true | - 0 + false ) ) Change-Id: I43c76cb49093b40eb854d324e898e821270053dc Related: OS#2282
2018-01-26Simplify TS alloc: adjust allocator signaturesMax1-13/+8
* 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-1/+7
* 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 ack state internalMax1-1/+8
* add functions/macros for setting TBF's UL ack state * add functions for checking TBF's UL ack state N. B: this should not be confused with TBF-UL state. Change-Id: I144483447d4b0b93e775da0e926ee45eb8ab39f3 Related: OS#1539
2018-01-24TBF: make UL/DL state internalMax1-18/+4
* 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-95/+81
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-9/+9
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-3/+11
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-4/+2
* 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-12Make TBF state privateMax1-1/+1
Let's make sure no external function can mess with the TBF state. Change-Id: I217f4c4bac21dd584c8682928a080a1a6e9507e1
2018-01-03Fix llc_queue_size() typeMax1-1/+1
It either returns 0 or LLC queue size() which has size_t return type. This means it can never be negative - hence it's better to use size_t as return type. Change-Id: I2a6e849d349ab12854976bd0d68537a370a9c83d Fixes: CID181478
2018-01-02TBF: bail out for unknown timersMax1-0/+2
Return right after logging error if attempting to start or stop unknown timer. Change-Id: Ie6ae564d41a5e03270685c6bafb3504278eb3551 Fixes: CID181512, CID181514
2018-01-02TBF: log timer invocation sourceMax1-16/+19
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-53/+22
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: add N3101 counterMax1-0/+9
Properly reset the counter when receiving valid RLCMAC block and update it when no data is received as per 3GPP TS 44.060 §8.1.1.1 Change-Id: I2f79c6153dc4073c9d293b2824979e6381576682 Fixes: OS#2407
2017-12-20TBF: implement independent T31xx timersMax1-66/+145
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-63/+48
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: remove unused variableMax1-4/+0
The num_T_exp is write-only so it can be safely dropped. Change-Id: I94d83ca8c9b2f0732b53fdf42b17ba93cd7f1c15
2017-12-14TBF: move EGPRS enablement into (U|D)L-TBFMax1-2/+0
This is preparation patch for transition to separate UL/DL window variables instead of current shared generic window. The setting of window parameters is performed in functions specific to UL/DL TBFs but the general EGPRS flag remains the same and is set via the same function which is now marked as protected since it's only meant to be used by UL/DL subclasses. Related: OS#1759 Change-Id: I6056194b28a1eb9d69093d1dfdc65a11bc1fc579
2017-12-05TBF: expand timer loggingMax1-16/+17
* 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-12-04TBF: log timer overrideMax1-7/+7
Currently TBF support only single Txxxx timer so scheduling another timer will cancel out the one which is already running. Until the proper fix is in place, let's at least log this situation as error. Note: cosmetic adjustement to test output is required - we do not report restart of the same timer twice because "restarting" assumes it anyway. Change-Id: I462464a1e6df937b72cad65d19cd48e95dc4db45 Related: OS#2407
2017-09-04cosmetic: convert explicit warnings to fixme/todoMax1-2/+2
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-14/+40
* 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-2/+2
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-08-14Encapsulate handling of UL ACK timeoutMax1-12/+10
Use helper methods instead checking and manipulating flag directly. Change-Id: Ia3f009c52118db95b38a077e08eecda844e7f8d1 Related: OS#1539
2017-07-12check for missing result of rate_ctr_group_alloc()Harald Welte1-0/+24
In case the counter group allocation fails, we must handle this gracefully and fail the allocation of the parent object, too. Change-Id: Id6d780c67b4af15aaa5c6f2b8b00f2a0b70a7385 Related: OS#2361
2017-05-26Cleanup FN schedulingMax1-3/+2
* replace magic number with defined constant * move copy-pasted code to inline functions * remove unused code Change-Id: I6fee0714453d0c3c3f3f875f88daea2d9c477331 Related: OS#1524
2017-05-15remove pcu own bitvector implementationAlexander Couzens1-3/+3
The osmocore bitvec is exact the same, but use a pointer instead of a reference. Change-Id: Id8f797631d89aa12b6e48efb2dc153a3e2f059f7
2017-05-01tbf.cpp: use new tlli instead of old tlliAlexander Couzens1-2/+2
The old tlli might be 0x00000000. Change-Id: I2fd6fec022506e203d05e91c36ccd9e020ff816c
2017-02-08Fix dozens of compiler warnings across the boardNeels Hofmeyr1-4/+4
Change-Id: I166109dc05d3323b92cd2a42f0c7e6009950e15d
2017-01-24Handle packet access reject during packet resource requestaravind sirsikar1-0/+40
When Packet resource request is received, PCU will generate the packet access reject if no resources are present. The encoding is done based on section 7.1.3.2.1 and 8.1.2.5 of 44.060 version 7.27.0 Release 7. This patch also includes the test case to validate the generated packet access reject message. This patch is integration tested on Osmo-trx setup with Ettus B210 board and LG F70 MS with some simulation code changes in Osmo-pcu. Change-Id: I05ff25124b58905586caa0c0c37023d69724f121
2017-01-23Add compression support in EGPRS PUANsivasankari1-2/+4
This adds compression of bitmap in PUAN. The compressed bitmap is used only if the number of bits in the bitmap does not fit in the message and there is a gain after compression. The algorithm is part of libosmocore and so there is dependency on the libosmocore for compilation. The algorithm is tested on integration setup by forcing compression. Change-Id: Id2eec4b5eb6da0ebd24054b541b09b700b9b40ba
2017-01-05Improve loggingMax1-4/+23
Add value_string describing UL and DL TBF states and use it for logging errors while freeing TBFs. Change-Id: I292ec81ab602c65ef86e6e3e85740182b63474b6
2016-12-22Add counter at BTS level And statistics at TBF/MS level.sivasankari1-1/+44
Adds spb counters at BTS level(show bts statistics). Adds RLC/MAC downlink control msg at ms level(show ms imsi <imsi_val>). Adds the number of coding schemes counter for UL at TBF level. Change-Id: Icbe4ba95e34bea89ee36f532d099db68204b7c38
2016-12-09Add statistics in the ms and tbf level.sivasankari1-4/+70
Adds DL throughput in show ms imsi <imsi_value>. Adds the number of coding schemes counter and rlc nacked counter at TBf level. Change-Id: Ia95b0404989b00db0e7ba416bc40d09ef41fde1c
2016-11-25Add new BTS level counterssivasankari1-0/+2
Adds counters for Immediate Assignment Reject, Packet Access Reject, Channel Request Description and Final Block resend. Change-Id: I23e326d4ea489aa4967e452fe02773b44ab146f7
2016-11-14Add BTS level countersMrinal Mishra1-1/+12
Adds counters for MCS blocks, 11 bit Rach counters and others. Change-Id: I605b0d66eb217decd35cbb8f87abfa577760245a
2016-11-11Handle packet access reject during EPDAN/PDAN with channel descriptionaravind sirsikar1-0/+23
When PDAN/EPDAN with channel description is received, PCU will generate the packet access reject if no resources are present. The encoding is done based on section 7.1.3.2.1 and 8.1.2.5 of 44.060 version 7.27.0 Release 7. This patch also includes the test case to validate the generated packet access reject message. This patch is integration tested on Osmo-trx setup with Ettus B210 board and LG F70 MS with some simulation code changes in Osmo-pcu. Change-Id: I096a3bb44a65533b9e9b091925dd5f70a8696d6
2016-10-18Revert "tbf: Add state WAIT_ASSIGN"Neels Hofmeyr1-12/+1
This reverts commit f1a7b8fc6651f92a8b7f3f27b7ca05d07f4e44e0. Conflicts: tests/tbf/TbfTest.err The commit broke GPRS service at least for osmo-bts-sysmo on a SysmoBTS 1002 with current master of osmo-bts (ef30f50d5d6d5f863fc147d05ccdceb89284934e). The error observed is the following log output (was viewing both osmo-bts-sysmo and osmo-pcu logs interleaved): <0002> tbf.cpp:874 TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=WAIT ASSIGN) T3169 timeout during transsmission <0002> tbf.cpp:893 - Assignment was on CCCH <0002> tbf.cpp:899 - No uplink data received yet <0007> l1sap.c:904 RACH for packet access <0001> pcu_l1_if.cpp:311 RACH request received: sapi=1 qta=0, ra=121, fn=13653 [repeat] When removing this single commit from current osmo-pcu master, GPRS service works well on SysmoBTS, with current osmo-bts master. The TbfTest.err expected output needed adjustment after the revert. Disclaimer: I am not aware of adverse effects this commit may have. I have no idea what the WAIT_ASSIGN state is used for -- further review is required. Change-Id: I1532f8e93194368cdc1e3846f82afa6d68cd5fbd
2016-10-18tbf: add llc_queue_size() to check llc_queue is valid before calling size()Alexander Couzens1-0/+7
gcc6 is optimizing if (!this) {CODE} as this is assumed to never be a std::nullptr here. Move the null check to the caller. In preparation of removing the check within llc_queue->size(), all callers must check the object before calling it. Make sure of that: make the llc_queue() access function protected and offer only a public llc_queue_size() function that incorporates the NULL check. All current callers are only interested in the llc_queue_size(). Tweaked-by: nhofmeyr Change-Id: I88cc3180f8f86785e3f07981895dabddf50b60a2
2016-09-15Fix EGPRS DL window calculation during tbf updateAravind Sirsikar1-0/+6
Earlier there was no handling for recalculation of DL window size during tbf update. Which has been fixed in this patch. Related: OS#1808 Change-Id: I41aa807068520460fd665a55e3529e60f6bbb630