aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-10-05Revert "tbf: Add state WAIT_ASSIGN"sysmocom/revert_WAIT_ASSIGNNeels 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-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
2016-09-15tbf_dl: factor out EGPRS DL window size calculationAravind Sirsikar1-14/+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-09-09Fix Timing Advance handlingMax1-2/+3
* initialize with invalid TA instead of making assumption that phone is located within 550 meters (TA=0) * only set valid TA Change-Id: Idfc40ff0c11bdac13d9e28fbfa4e95dfc6b735b0 Related: OS#1526
2016-06-10tbf: replace this == NULL check in tbf->nameAlexander Couzens1-4/+1
All checks of (this == null) will be eliminated by GCC >= 6.1 (https://gcc.gnu.org/gcc-6/changes.html, Value range propagation now assumes that the this pointer of C++ member functions is non-null. Change-Id: Ifddaef70bb0a4402050c817b1000d515c3a7118b Reviewed-on: https://gerrit.osmocom.org/136 Tested-by: Jenkins Builder Reviewed-by: Harald Welte <laforge@gnumonks.org> Reviewed-by: Holger Freyther <holger@freyther.de>
2016-02-08tbf: Add state WAIT_ASSIGNJacob Erlbeck1-1/+12
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: Don't change type from CCCH to PACCH without ackJacob Erlbeck1-1/+0
Currently the CCCH flag is cleared and the PACCH flag is set when a multislot upgrade is scheduled for a downlink TBF, even if the MS has never confirmed in any way that the PACCH really exists. This can happen if the MS did not receive the DL IMM.ASS. Since the CCCH flags gets cleared in that case, the IMM.ASSS is never retried and all subsequent PACKET DOWNLINK ASSIGNMENTS will fail. This commit delays the update of these flags until the MS has responded with a corresponding CONTROL ACK. Sponsored-by: On-Waves ehf
2016-02-08tbf: Use TLLI as ID if TFI not yet assignedJacob Erlbeck1-3/+18
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-23/+68
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-6/+9
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-1/+6
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-7/+7
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: Do not reuse old TBF after RACH requestsJacob Erlbeck1-7/+8
Currently existing TBF can be reused after an MS has sent a RACH request. Since the MS can be or most probably is in packet idle mode in that case, the TBF are no longer usable even if they share the PDCHs and the control TS with the new one. There are occasional freezes where the MS does no longer react to messages sent on the PACCH. This change aborts all pending TBFs if a new TBF is or has been established via RACH. Sponsored-by: On-Waves ehf
2016-02-08tbf: Add abort method for downlink TBFJacob Erlbeck1-1/+2
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
2016-02-08tbf: Add counters for aborted TBF in state FLOWJacob Erlbeck1-5/+11
Increment CTR_TBF_DL_ABORTED/CTR_TBF_UL_ABORTED if a TBF gets freed that is still in state GPRS_RLCMAC_FLOW. Sponsored-by: On-Waves ehf
2016-02-08edge: Make window size configurableJacob Erlbeck1-1/+17
Currently the window size is fixed to 64 even for EGPRS. Support dynamic window sizes depending on the number of PDCH. The WS can be set to b + f * N_PDCH. If the result is not valid according to TS 44.060, Table 9.1.9.2.1, the value will be corrected to use the next lower valid value (or 64). The following VTY commands are added (config-pcu node): window-size <0-1024> set base (b) value and leave f unchanged window-size <0-1024> <0-256> set base (b) and factor (f) Sponsored-by: On-Waves ehf
2016-02-08edge: Work-around to use EGPRS if there was no DL RA CapJacob Erlbeck1-4/+7
If the downlink BSSGP didn't contain a RA Capabilities IE, both MS class values are 0. The phone will send valid RA Caps later on. Currently in that case, the downlink TBF is not established if EGPRS is enabled. Just force egprs_ms_class to 1 if EGPRS (only) is enabled. Sponsored-by: On-Waves ehf
2016-02-08edge: Disable GPRS/EGPRS mixed modeJacob Erlbeck1-0/+14
Currently the plain 'egprs' command enables EGPRS but doesn't prevent phones from being served in GPRS mode if they do not support EGPRS. This involves complex frame allocation implementations in dynamic mode, especially if 8PSK is being used. This is due to the inability of non-EGPRS phone to decode 8PSK USF and ES/P altogether. Since polling has a higher priority than USF, collisions will have to be prevented by the PCU by never using an GPRS USF if it refers to a FN that is already being used for polling. This commit just disables mixed usage by ignoring GPRS-only request if EGPRS is enabled. The following VTY command (config-pcu node) is changed: egprs -> egprs only Sponsored-by: On-Waves ehf
2016-02-05tbf: Remove obsolete TLLI functionsJacob Erlbeck1-27/+0
This commit removes gprs_rlcmac_tbf::extract_tlli and Decoding::tlli_from_ul_data. Sponsored-by: On-Waves ehf
2016-02-05edge: Enable EGPRS in downlink TBFsJacob Erlbeck1-2/+13
Currently GPRS is always used for downlink, which violates TS 44.060 (concurrent TBF must have the same mode). Enable EGPRS mode for downlink if the EGPRS MS class is != 0 and EGRPS has been enabled. Note that EGPRS Ack/Nack handling is not yet implemented, so enabling EGPRS will not work still. But we will now get EGPRS DL ACK/NACK messages now from the MS. Sponsored-by: On-Waves ehf
2016-02-01edge: Support EGPRS in write_packet_downlink_assignmentJacob Erlbeck1-1/+2
Add an use_egprs parameter to write_packet_downlink_assignment and add the EGPRS related fields if it is set to true. The window size is fixed at 64 blocks, link quality measurement reports have been disabled, and the other optional fields are not present. Sponsored-by: On-Waves ehf
2016-02-01edge: Replace integer cs by GprsCodingSchemeJacob Erlbeck1-10/+18
Currently the TBF and MS object use a plain integer value (current_cs) to manage the coding scheme. This makes it difficult to support the MCS schemes. GprsCodingScheme supports a partial ordering of these values (CS and MCS) and provides safe increment and decrement methods. Use the GprsCodingScheme type instead of integer for cs fields and variables. Add a 'mode' to GprsMs which can be set to either GPRS, EGPRS, or EGPRS_GMSK which also set the initial values of current_cs_ul/dl. Select the mode based on max_mcs_ul and max_mcs_dl. Sponsored-by: On-Waves ehf
2016-02-01tbf: Use LListHead instead of llist_podsJacob Erlbeck1-10/+7
LListHead does basically the same like llist_pods, but more C++ish and with type safety. This commit turns the former list field of gprs_rlcmac_tbf into a private field, provides accessors, moves the related code from pcu_vty.c to pcu_vty_functions.cpp, and removes the llist_pods type and related code. Sponsored-by: On-Waves ehf
2016-02-01tbf/vty: Move tbf_print_vty_info to pcu_vty_functions.cppJacob Erlbeck1-22/+0
This function is similar to the show_ms function already present in the target file. Since the TBF lists will be turned into LListHead based lists, they will get an iteration function in pcu_vty_functions.cpp, too. Sponsored-by: On-Waves ehf
2016-02-01tbf: Replace static casts by calls to as_ul_tbf/as_dl_tbfJacob Erlbeck1-5/+5
Currently casts from gprs_rlcmac_tbf to gprs_rlcmac_ul_tbf and gprs_rlcmac_dl_tbf are done by using static_cast. This doesn't provide protection against converting a gprs_rlcmac_ul_tbf pointer to a gprs_rlcmac_dl_tbf pointer and vice versa. This commit provides two functions as_ul_tbf and as_dl_tbf, that behave similar like dynamic_cast but use the direction field instead of RTTI. Sponsored-by: On-Waves ehf
2016-02-01edge: Set the EGPRS window parametersJacob Erlbeck1-0/+2
Currently the GPRS parameters are used, which is ok for the WS but not for the SNS. This commit uses RLC_EGPRS_SNS and RLC_EGPRS_MIN_WS for the window configuration. Sponsored-by: On-Waves ehf
2016-02-01edge: Move EGPRS setup from setup_tbf to tbf_alloc_ul_tbfJacob Erlbeck1-2/+7
Currently the EGPRS mode is enabled in setup_tbf depending on the values of egprs_ms_class and bts->egprs_enabled (both must be != 0). This makes it difficult to set different values (like window parameters) depending on the direction. This commit moved the initialisation part to tbf_alloc_ul_tbf und just leaves the setting of the ms_class to setup_tbf. Sponsored-by: On-Waves ehf
2016-02-01rlc: Add constructor to window classesJacob Erlbeck1-2/+0
Currently the gprs_rlc_dl_window and gprs_rlc_ul_window do not have constructors, but need to get initialized explicitly. This commit adds constructors to both classes and removes explicit external initialization code. Sponsored-by: On-Waves ehf
2015-12-16tbf: Refactor parts of extract_tlli into set_tlli_from_ulJacob Erlbeck1-20/+28
Currently gprs_rlcmac_tbf::extract_tlli takes care of decoding and the TBF update. These are really different things and doing the decoding in extract_tlli makes EGPRS support more complex. This commit moves the TBF state related part into a new method gprs_rlcmac_tbf::set_tlli_from_ul. Sponsored-by: On-Waves ehf
2015-12-15edge: Enable EGPRS if configured and egprs_ms_class presentJacob Erlbeck1-1/+7
Enable the TBF to use EGPRS if the bts->egprs_enabled config variable has been set via the VTY "egprs" command and if the MS has signaled a EGPRS multislot class. Tell the MS to use EGPRS if the condition above holds. Note that this will cause the MS to use EGPRS RLC block formats for further messages which are not yet understood by the PCU. Sponsored-by: On-Waves ehf
2015-12-15edge: Support EGPRS multislot class handling in tbf_allocJacob Erlbeck1-12/+13
Add an egprs_ms_class argument to the allocation functions and set/pass it where necessary. Sponsored-by: On-Waves ehf
2015-12-15edge: Add m_egprs_enabled and related methods to TBFJacob Erlbeck1-3/+5
Add the following methods to gprs_rlcmac_tbf: - is_egprs_enabled - enable_egprs - disable_egprs Also show the value of the flag in name() by displaying "EGPRS" if it is set. Sponsored-by: On-Waves ehf
2015-11-30edge: Support EGPRS in packet uplink assignment messageJacob Erlbeck1-1/+1
Currently the Encoding::write_packet_uplink_assignment method only supports the GPRS variant of the message. This commit adds the missing EGPRS variant to the encoder. Sponsored-by: On-Waves ehf
2015-09-07poll: Count failed proceduresJacob Erlbeck1-0/+3
When a timeout has occured several times, the procedures handled by poll_timeout are aborted. This happens when the number of repetitions exceed N3105. Currently only the timeouts themselves are counted. This commits adds counters that are incremented if a procedure has really failed. New counter: - rlc.ass.failed: Count failing UL and DL assigments via PACCH - rlc.ack.failed: Count failing DL Ack/Nack requests Sponsored-by: On-Waves ehf
2015-09-01tbf: Refactor reuse_tbf into releasing and DL TBF establishmentJacob Erlbeck1-0/+21
Currently reuse_tbf (partly) resets the old DL TBF and uses its PACCH to establish a new DL TBF. The method can not be used with UL TBFs. This commit replaces the reuse_tbf method into a gprs_rlcmac_dl_tbf:release method which triggers the TBF's timer based deletion (so that the TFI is still reserved for some time) and a gprs_rlcmac_tbf::establish_dl_tbf_on_pacch which can establish DL TBFs on existing PACCHs of either DL or UL TBFs. Sponsored-by: On-Waves ehf
2015-09-01tbf: Keep the old MS object alive in extract_tlliJacob Erlbeck1-1/+3
Currently when a second MS object has been created for an MS, because the TLLI was not known yet, the will be detected in gprs_rlcmac_tbf::extract_tlli and the two objects will be merged by update_ms. But when the dl_tbf is moved from the old to the new (second) MS object, the old MS object can get idle and be removed before the object are merged. This can cause LLC frame loss when the MS object is deleted immediately after getting idle (no timeout configured). This commit adds a guard to keep the MS object until extract_tlli has been executed. Sponsored-by: On-Waves ehf
2015-09-01Revert "tbf: Do not kill DL TBF on Packet Resource Request"Jacob Erlbeck1-3/+1
This reverts commit e91bd3babd5c04a154f296607b401a5050dcba31. That commit seems to cause hanging DL TBFs when there was a RACH based UL TBF establishment while it that TBF is active. This could be caused by the use of a different PDCH for the SBA. Conflicts: tests/tbf/TbfTest.cpp tests/tbf/TbfTest.err
2015-08-28tbf: Add logging for pollingJacob Erlbeck1-2/+8
This commit adds the relevant frame number to the "poll timeout" logging message. In addition, logging is added to the places where poll_fn gets set. The goal is to track down the source for frequent "poll timeout" messages. Sponsored-by: On-Waves ehf
2015-08-28tbf: Use explicit initialisations in constructor (Coverity)Jacob Erlbeck1-20/+83
Currently when allocating tbf_alloc_ul_tbf or tbf_alloc_dl_tbf objects, the allocated memory area is pre-initialised by talloc_zero before the C++ constructors are called. This is not recognised by Coverity, since there is no talloc model file yet. Thus Coverity complains about missing initialisers. On the other hand, it is still planned to convert the TBF classes into real C++ ones. So instead of silencing Coverity directly, this is an opportunity to do it the C++ way. This commit adds initialisers and initialisation code for all members that relied on talloc_zero. The corresponding calls to talloc_zero are replaced by calls to talloc to give ASAN/valgrind a chance to detect future initialisation errors. Some initialisation code is also moved from setup_tbf to the constructors, notably the initialisation of the bts pointer. Fixes: Coverity CID 1320604, 1320605, 1320606 Sponsored-by: On-Waves ehf
2015-08-24ms: Store references to replaced TBFs in the MS objectJacob Erlbeck1-1/+2
Currently when calling GprsMs::attach_tbf and a TBF of the same direction already exists, the old TBF gets detached from the MS object. Therefore that TBF object loses access to that MS object including for instance TLLI and IMSI. This leads to failing DL TBF reuses, since the downlink assigment cannot be sent on the PACCH later on because that must be sent on the old DL TBF which ms() is NULL and the new DL TBF cannot be retrieved. This commit fixes this bug by changing the GprsMs implementation to keep a list of replaced (old) TBFs. TBFs are only removed when they are being detached explicitely (see tbf_free and set_ms). Addresses: tbf.cpp:741 We have a schedule for downlink assignment at uplink TBF(TFI=1 TLLI=0xf35a680e DIR=UL STATE=RELEASING), but there is no downlink TBF Sponsored-by: On-Waves ehf
2015-08-24tbf: Use C++/talloc magic to support TBF constructors/destructorsJacob Erlbeck1-2/+31
The TBF object are currently created by using talloc_zero/talloc_free directly from plain functions. Therefore C++ constructors and destructors are not called. So the only initialisation that is done is setting every member to 0. Non POD members do not have their constructors called either, which makes it impossible to use the current LListHead class for real members when the LListHead::m_back member has to be set. This commit changes the TBF allocation functions to call the corresponding C++ constructor after the call to talloc_zero and to register the C++ destructor with the talloc context, so that is is called before talloc_free actually frees the memory. With this change, non-POD members and custom constructors/desctructors can be used with gprs_rlcmac_tbf, gprs_rlcmac_dl_tbf, and gprs_rlcmac_ul_tbf. Note that this change is only a single step of the plan to turn the TBF classes into real C++ classes. Sponsored-by: On-Waves ehf
2015-08-21tbf: Do not kill DL TBF on Packet Resource RequestJacob Erlbeck1-1/+3
Currently all active TBF of an MS are killed if a Packet Resource Request is received from the MS. In general this happens after a RACH request. This does not happen after a resource request that has been included into a Downlink Ack/Nack. Sometimes an UL TBF is requested by an MS via RACH while a DL TBF is running for instance to send a TCP Ack. This can happen, if a former request via PACCH did not work. This commit removes the killing of the DL TBF from gprs_rlcmac_pdch::rcv_resource_request(). Sponsored-by: On-Waves ehf
2015-08-21tbf: Fix typos in log messages concerning UL/DLJacob Erlbeck1-1/+1
The TBF in create_dl_ass can be of any direction. The text in rcv_resource_request uses DL instead of UL. Sponsored-by: On-Waves ehf
2015-08-18ms: Move MS information merging to GprsMSJacob Erlbeck1-9/+1
Currently the merging of the meta information (MS class, IMSI) takes place in gprs_rlcmac_tbf::merge_and_clear_ms(). This makes it difficult to merge the internal state and does not directly relate to TBFs anyway. This commit moves this into a new method GprsMs::merge_old_ms. Sponsored-by: On-Waves ehf
2015-08-17tbf: Clean old MS objects if they have the same TLLIJacob Erlbeck1-1/+57
Currently if an MS retries to access the PCU by using RACH and if there is already an entry for that MS, a duplicated MS object referring to the same TLLI is created. This is caused by blindly setting the TLLI without querying the MS storage to avoid inconsitencies. This leads to several entries in the MS storage that are assigned to the same TLLI. If that happens, 'show ms all' can display multiple entries with the same TLLI (note that an MS object can belong to several TLLIs, so there might be an intersection that is not visible in the list) or 'show tbf all' can show entries with MS_CLASS == 0 in some cases. This commit changes update_ms() to merge and clean up old entries that belong to the given TLLI if they exist. Some data (like the MS class) is copied to the new MS object. Note that TBF belonging to the old MS object are deleted immediately if they have not registered a timer. Sponsored-by: On-Waves ehf
2015-07-16tbf: Put the TFI->TBF mapping into the PDCH objectsJacob Erlbeck1-15/+2
Currently the TBFs are registered in a TFI indexed array within the TRX objects. TBFs can be searched globally by TFI and TRX number. This conflicts with the use of the same TFI for different TBF on different PDCH. This use case requires the specification of the PDCH as additional search dimension. This commit moves the TFI index TBF arrays into the PDCH objects. The related methods are updated accordingly. Ticket: #1793 Sponsored-by: On-Waves ehf
2015-07-16tbf: Move TFI selection into alloc_algorithmJacob Erlbeck1-31/+17
Currently the TFI and the TRX have to be determined before the actual TBF allocation function is called, passing TFI and TRX number as parameters. This does fit to TFI reuse for different slots, since this were tightly coupled with the slot selection. This commit just moves the TFI selection into the alloc_algorithm functions. The tfi parameter is removed from the the TFI alloc functions. The trx parameter is changed into use_trx to optionally limit the trx selection (same semantics like in tfi_find_free). Sponsored-by: On-Waves ehf
2015-07-07tbf: Add Poll Timeout countersJacob Erlbeck1-0/+8
This commits adds three poll timeout counters - RLC Assign Timeout - RLC Ack Timeout - RLC Release Timeout to help diagnosing to cause for these events. There seems to be an increased rate of these when a PDCH is shared by multiple TBFs. Sponsored-by: On-Waves ehf
2015-07-03Revert "tbf: Add GprsMs* argument to update() and use it in reuse_tbf"Jacob Erlbeck1-9/+3
This reverts commit 2272a83a13b57ea7e99fe96ac76e4ad892e19e90. The modification is no longer needed, since the call to update has been removed from reuse_tbf(). Conflicts: src/tbf_dl.cpp Sponsored-by: On-Waves ehf
2015-07-03ms: Get the set of slots currently activeJacob Erlbeck1-0/+36
This commits adds methods to GprsMs and gprs_rlcmac_tbf to retrieve the slots that are actively used. Sponsored-by: On-Waves ehf