aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf.h
AgeCommit message (Collapse)AuthorFilesLines
2018-02-27Simplify TS alloc: adjust allocator signaturesMax1-6/+4
* 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-02-27TBF: make poll state internalMax1-1/+27
* add functions/macros for setting TBF's poll state * add function for checking TBF's poll state Change-Id: I6db1c4e7bd0a49aeb5e391afe371c36b96c6a702 Related: OS#1539
2018-02-27TBF: make UL ack state internalMax1-2/+20
* 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-02-27TBF: make UL/DL state internalMax1-2/+52
* 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-02-27TBF: add dedicated log categoriesMax1-4/+4
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-02-27TBF: log source of state transitionsMax1-6/+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-2/+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-DL: move priority computation into functionMax1-0/+9
Improve readability by moving priority computation into separate function. Change-Id: Icdca0106a544036eaa94a25f0d4f84e4282f4568
2018-01-12TBF: move window parameters to UL/DL levelMax1-16/+16
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-1/+24
* 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-4/+1
Let's make sure no external function can mess with the TBF state. Change-Id: I217f4c4bac21dd584c8682928a080a1a6e9507e1
2018-01-04window: move encoding into functionsMax1-2/+12
* move window size encoding and writing into separate functions * introduce necessary TBF wrappers to avoid direct m_window access This is part of preparation work to move to separate UL/DL windows. Related: OS#1759 Change-Id: I60184d5049bc7d7b119df5a9eb82d1c4b788c840
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-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: log timer invocation sourceMax1-1/+4
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-11/+7
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/+2
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-2/+23
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-0/+4
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-18Remove unused includes and forward declarationsMax1-2/+0
Change-Id: I59da04edd1b8ff965bbfbe00ccae1f7c9b6e5301
2017-12-15TBF: remove unused variableMax1-1/+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-4/+15
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-2/+2
* 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-01Fix compiler warningMax1-0/+9
Move function declarations which use gprs_rlcmac_ul_tbf into tbf.h to avoid compiler warning: In file included from pcu_vty.c:15:0: bts.h:166:27: warning: ‘struct gprs_rlcmac_ul_tbf’ declared inside parameter list will not be visible outside of this definition or declaration void update_tbf_ta(struct gprs_rlcmac_ul_tbf *tbf, int8_t ta_delta); ^~~~~~~~~~~~~~~~~~ bts.h:167:24: warning: ‘struct gprs_rlcmac_ul_tbf’ declared inside parameter list will not be visible outside of this definition or declaration void set_tbf_ta(struct gprs_rlcmac_ul_tbf *tbf, uint8_t ta); ^~~~~~~~~~~~~~~~~~ Change-Id: Ic34c72c8bff6d7c775f56bb6026fec5425f7dcb4
2017-08-14Simplify polling troubleshootingMax1-1/+8
* 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-0/+1
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-0/+2
Use helper methods instead checking and manipulating flag directly. Change-Id: Ia3f009c52118db95b38a077e08eecda844e7f8d1 Related: OS#1539
2017-07-10Remove TBF knowledge from rcv_control*dl_ack_nackMax1-0/+2
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-01-24Handle packet access reject during packet resource requestaravind sirsikar1-0/+4
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-0/+2
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-0/+7
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-0/+22
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-0/+29
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-14Add BTS level countersMrinal Mishra1-0/+3
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/+2
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-4/+6
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-2/+4
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-15tbf_dl: factor out EGPRS DL window size calculationAravind Sirsikar1-0/+2
A subsequent patch needs to call this from gprs_rlcmac_tbf::update(), so to avoid code dup, put the calculation in a separate function. Related: OS#1808 Change-Id: I7c7777d43f843bbd3421503fc2a8600f148ca035
2016-08-25Modify EGPRS DL TBF flow to support SPBAravind Sirsikar1-0/+5
Modify the EGPRS DL TBF flow to support Split block during Retx. This patch will also Upgrade the test suite with test cases to validate the EGPRS Downlink SPB for Retransmission Scenarios like MCS6->MCS3, MCS4->MCS1, MCS5->MCS2, MCS9->MCS3 MCS7->MCS2, MCS8->MCS3 have been simulated and Integration tested in NuRAN 1.0 hardware thoroughly. Change-Id: I242afdd8ae7622dec8593b26382ad66bad5b9516
2016-08-02Add support for SPB handling for EGPRS UL TBFAravind Sirsikar1-0/+15
This patch will modify the EGPRS UL TBF flow to support Split block handling. This patch also contains test suite modification for SPB UL. Scenarios like MCS6->MCS3, MCS4->MCS1, MCS5->MCS2, MCS9->MCS3 MCS7->MCS2, MCS8->MCS3 have been simulated and Integration tested in NuRAN 1.0 hardware thoroughly. The scope of Unit testing is limited. Change-Id: I39ca53218b6e0982abc2ab9c703c24c8bf0a09c0
2016-02-08edge: Compare len instead of using cs.isCombinableJacob Erlbeck1-1/+1
Comparing the coding scheme properties doesn't seem to be strong enough, since create_dl_acked_block(fn, ts, index, index2) sometimes had to combine data units of different size this way. Check the registered size of the BSN blocks instead, since these must match if two blocks are to be combined in a single RLC data message with MCS7-9. It is not yet clear, what exactly goes wrong with the current implementation, but this commit fixes the problem which trigger the assertion in create_dl_acked_block. Sponsored-by: On-Waves ehf
2016-02-08edge: Send a second BSN block in an RLC message if possibleJacob Erlbeck1-1/+4
Currently only one BSN block is encoded in each RLC data message, even if MSC7-9 are used, which transport two independant (except for a max BSN delta of 512) BSN blocks. In that case, the same block is just put twice into the same message. The current create_dl_acked_block(fn, ts) method handles block selection (resend, new BSN, dummy block, ...) and restart handling in one method and is too complex to extend it accordingly. Therefore this commit move the block selection/creation handling into a new method (take_next_bsn) which delivers the next BSN along with a hint, whether it may be combined with another block. In that case, the function can be called a second time (this time with a valid previous BSN, that's the one returned by the first call) to get the second BSN. The real block generation method create_dl_acked_block(fn, ts, index, index2) is then called with both BSNs as indices (the second must be -1, if there is only one BSN). Note that every BSN returned by take_next_bsn should be passed to create_dl_acked_block to avoid state inconsistencies. Sponsored-by: On-Waves ehf
2016-02-08edge: Refactor create_dl_acked_block for multi-block supportJacob Erlbeck1-1/+1
Currently the method is hard-coded to support a single BSN only. MCS-7 to MCS-9 encode 2 data blocks into a single RLC data message. This commit refactors create_dl_acked_block to process any number of blocks internally. Note that this does not extend the parameter list accordingly and just duplicates the BSN if these MCS are being used. Sponsored-by: On-Waves ehf
2016-02-08tbf: Add state WAIT_ASSIGNJacob Erlbeck1-6/+4
Currently the state on the TBF is set to ASSIGN when it is created and in general changed to FLOW when it is acknowledged by the MS. The moment when the assignment is really transmitted to the MS (which can take some time) is not reflected by the state. A TBF can considered to be valid, when the assignment is received by the MS. Add the state WAIT_ASSIGN that is entered when the assigment has been send to the MS (more precisely: when the corresponding RTS has been processed or the message has been sent to the BTS). The TBF, its PDCH(s), and its TFI can be assumed to be valid, when the TBF has a state of WAIT_ASSIGN or higher (assuming that the TBF starting time has not been set, which is currently only done for SBA, which are not associated with a TBF). Note that due to queuing in the BTS there can still be a invalid time period for immediate assignments, when the request is lingering in the AGCH or PCH queues. Sponsored-by: On-Waves ehf
2016-02-08tbf: Use TLLI as ID if TFI not yet assignedJacob Erlbeck1-0/+11
Currently the old TFI is always used as ID when a PACKET DOWNLINK ASSIGNMENT is generated. This fails if the old TBF has not been fully assigned yet. The MS will then ignore the PDA. This commit changes write_packet_downlink_assignment to accept an additional parameter old_tfi_is_valid and uses the new TBF's TLLI instead of the olf TFI if that parameter is set to false. Sponsored-by: On-Waves ehf
2016-02-08tbf: Add check_polling/set_pollingJacob Erlbeck1-0/+3
Currently the checks for and the actual polling is done in several places by copy & paste of several lines of code. This hinders changes of they polling is handled internally and also is likely source of programming mistakes. Separate this into a check_polling function, that checks whether polling is possible and returns the FN and the RRBP to be used in that case. Otherwise the cause is logged (LOGL_DEBUG) and a negative error value is returned. There are no other side effect beside the logging. If the call is successful, the set_polling method can be used to actually register the polling. Extend the encoder functions' parameters lists by an rrbp parameter. Sponsored-by: On-Waves ehf
2016-02-08tbf: Add and use tbf->poll_tsJacob Erlbeck1-0/+1
Currently tbf->control_ts is used to look up an incoming poll response. Since that may eventually change, poll timeouts could theoretically happen in that case. Store the real poll TS in tbf->poll_ts at all places where tbf->poll_fn is set. Do not use tbf->control_ts to look up outstanding polls. Sponsored-by: On-Waves ehf
2016-02-08tbf: Use is_control_ts() instead of comparing TS values directlyJacob Erlbeck1-4/+2
Currently there are some places where tbf->control_ts != ts is evaluated to check, whether ts is a control slot. Replace these expressions by tbf->is_control_ts(ts) which does the same whitout exposing internal fields. Sponsored-by: On-Waves ehf
2016-02-08sched: Pass the current TS to the control create functionsJacob Erlbeck1-3/+3
Currently the checks in that function are based on the different internal TS values of a TBF. It is assumed that they match the TS that the current RTS refers to. This commit adds a TS parameter to create_ul_ass, create_dl_ass, and create_ul_ack to make this more explicit. Sponsored-by: On-Waves ehf
2016-02-08tbf: Add abort method for downlink TBFJacob Erlbeck1-0/+1
Currently the is a release() function which takes care of statistics and shutdown of properly finished TBFs, but which cannot be used for aborted TBFs. This commit add an abort() method which handles unacked RLC blocks as lost and doesn't start a release timer. This method will be invoked by tbf_free() for downlink TBF. Sponsored-by: On-Waves ehf