aboutsummaryrefslogtreecommitdiffstats
path: root/src/bts.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-07-07tbf: Keep a set of used TFI and USF per PDCHJacob Erlbeck1-4/+24
Currently is is rather expensive to get TFI and USF usage per PDCH, because the TBFs need to be scanned to get that information. This commit adds corresponding bit sets which get updated by the attach_tbf/detach_tbf methods of the gprs_rlcmac_pdch class. Sponsored-by: On-Waves ehf
2015-07-07tbf: Add Poll Timeout countersJacob Erlbeck1-0/+3
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-03ms: Add support for slot reservationJacob Erlbeck1-0/+29
In contrast to the slots currently used by existing TBFs, the reserved slots refer to the time slots that can be used for newly allocated TBFs without causing conflicts (given that the first common TS does not change). They correspond to the potential use of the PDCHs and can be used to achieve a more uniform slot allocation. This commit adds bit set based methods to GprsMs and gprs_rlcmac_trx and a counter to gprs_rlcmac_pdch. The current TRX will also be stored in the MS object. Sponsored-by: On-Waves ehf
2015-07-03tbf: Maintain the number of TBF per PDCHJacob Erlbeck1-0/+16
Currently the PDCH object do not know anything about the TBFs using them. To make the slot allocation load dependant, at least some numbers are required. This commit adds TBF counters (one per direction) and the related methods attach_tbf, detach_tbf, and num_tbfs to gprs_rlcmac_pdch. Sponsored-by: On-Waves ehf
2015-06-29tbf: Add BTS::ms_alloc methodJacob Erlbeck1-0/+11
Currently the code that creates the MS objects with tbf.cpp is duplicated. This commit moves the corresponding code into a new method. Since there is no TLLI available there, the GprsMsStorage::create_ms method has been refactored into two variants: one with TLLI/direction and one without. Sponsored-by: On-Waves ehf
2015-06-29tbf: Always create an MS object on TBF allocationJacob Erlbeck1-1/+1
Currently the MS object are created when the TLLI gets known. Therefore some information (TA, MS class) must be stored in the TBF itself and is copied to the MS object later on. This would get even more complex, if the allocation algorithms were extended based on this scheme. This commit ensures, that an MS object will always be created on TBF allocation, even if the TLLI is not yet known. These 'anonymous' objects are still managed by the MS storage. To avoid dangling entries without a TLLI there (which cannnot be retrieved anyway), the timer in the MS objects is not started after all TBF have been detached, so that they get deleted immediately in that case. Note that an MS object can still be removed (e.g. by replacement) from an existing TBF, so tbf->ms() can be NULL. Ticket: #1794 Sponsored-by: On-Waves ehf
2015-06-29tbf: Pass the MS object around instead of old_tbfJacob Erlbeck1-1/+1
Currently the old TBF (either uplink or downlink) is passed around at TBF allocation mainly to get information about the MS. To implement more complex allocation algorithms, the MS object itself will be needed anyway. This commit replaces the old_tbf arguments by MS object arguments. Sponsored-by: On-Waves ehf
2015-06-29tbf: Remove update_tlli methodJacob Erlbeck1-1/+0
This method does not do anything anymore, it's functionality has been taken over by update_ms. This commit removes gprs_rlcmac_tbf::update_tlli completely. Sponsored-by: On-Waves ehf
2015-06-22l1: Add debug log messages for I_LEVELJacob Erlbeck1-2/+10
The I_LEVEL values that are obtained now look suspicious. They do not seem to be contained in messages recorded via gsmtab. To help debugging this issue, this commit adds related debug messages that are generated while the encoded values are taken from the RLC/MAC messages. Sponsored-by: On-Waves ehf
2015-06-22l1: Store measurement values sent by the MSJacob Erlbeck1-1/+63
This commit extends the pcu_l1_meas structure by MS side measurement values which are transmitted by PACKET DOWNLINK ACK/NACK and PACKET RESOURCE REQUEST messages. The encoded values are remapped to dB respectively % values. The values are stored in the corresponding MS object (if there is one). Note that the values are store as (rounded) integers, so some different encodings are mapped to the same decoded value. Sponsored-by: On-Waves ehf
2015-06-22l1: Pass all L1 measurements upwardsJacob Erlbeck1-4/+6
Currently only the RSSI value is passed to the upper layers. Other values like TA and BER which are needed for TA update respectively CS selection are not propagated. This commit introduces and passes a struct that contains a set of measurement values. Sponsored-by: On-Waves ehf
2015-06-08ms: Add back pointer to BTSJacob Erlbeck1-0/+1
Since more functionality will be moved to the GprsMs class, a pointer to the current BTS object is added to allow access to configuration data and other methods. Sponsored-by: On-Waves ehf
2015-06-08tbf: Store MS class in GprsMs objectsJacob Erlbeck1-1/+1
The ms_class value is a property of the MS and thus belongs to the GprsMs class. Nevertheless the MS object is created after the TLLI gets known, so the value still has to be stored in the TBF initially. This commit add the ms_class value to the GprsMs class and introduces TBF accessor functions which either access that object or, if that is not available, the value stored locally. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-28tbf: Remove TimingAdvance storageJacob Erlbeck1-1/+7
Currently the TA storage stores up to 30 TLLI->TA mappings, if more entries are created the oldest one is dropped. In theory this can lead to missing TA information if many MS are present. This commit removes the TimingAdvance class completely, since the TA value is now stored in the GprsMs objects. Note that the GprsMs objects are currently not kept after the TBFs have detached from them, so the TA values are now kept for a shorter time than before. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-28tbf: Store the timing advance (TA) value in the GprsMs objectJacob Erlbeck1-14/+6
The TA value rather relates to an MS and not to a single TBF. So all TBFs share the same TA value. Currently the TA value is stored per TBF and eventually copied from an old TBF to a new one. It is in general only passed with an RACH request when the TLLI and thus the MS is not yet known. This commit adds a TA member to the GprsMs class and uses that one when the TBF is associated to an MS object. Since the TBF is not always associated with an MS object (after RACH or when it has been replaced by another TBF), the TA value is still stored in each TBF and that value is used as long as no MS object is being associated. Sponsored-by: On-Waves ehf
2015-05-28tbf/test: Add tests for single and two phase accessJacob Erlbeck1-2/+4
These tests cover the message exchange from receiving from the first RACH request to the first data block when establishing an uplink TBF. This will be used to check, whether TA and other values are passed to an MS object correctly. In addition, the RX RACH log message in rcv_rach is extended to contain the single block fn. Sponsored-by: On-Waves ehf
2015-05-28tbf: Remove TBF chaining (m_new_tbf and m_old_tbf)Jacob Erlbeck1-11/+8
Currently a new TBF is chained to an existing older one, either of the other direction (active or releasing) or of the same direction (releasing). This does not work properly work if and uplink and a downlink TBF are being established at the same time while an old TBF is being released. In that case, one of them is thrown away and the pending procedure is cancelled. The chaining is no longer necessary since the GprsMs objects have been introduced which keep track of the active TBFs. This commit removes the TBF members m_new_tbf and m_old_tbf and the related methods and code paths. Note that a new TBF can replace an older TBF entry of the same direction within an MS object when it is associated with an MS (e.g. by TLLI or because it is assigned via another, already associated TBF). In that case, the old TBF is no longer associated with an MS object. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-28tbf: Remove IMSI handling from trigger_dl_assJacob Erlbeck1-8/+3
Currently the BTS::trigger_dl_ass() method assigns the IMSI to the MS object. This should be (and is already) done earlier where the MS object is retrieved/created. This commit removes the corresponding code along with the 'imsi' parameter from trigger_dl_ass. Sponsored-by: On-Waves ehf
2015-05-27tbf: Remove the TLLI from the TBFsJacob Erlbeck1-35/+5
Currently the TLLI is stored in each TBF. Since each MS is now represented by a GprsMs object which takes care of TLLI updating, and each TBF that has been associated with an TLLI also contains a reference to a GprsMs object, per TBF TLLI handling is no longer needed. Keeping all TBF m_tlli members up to date is complex and doesn't currently work correctly in all circumstances. This commit removes m_tlli and related members from the TBF class and the tbf_by_tlli functions from the BTS class. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-21tbf: Explicitly pass the direction to update_ms()Jacob Erlbeck1-2/+2
The type of the TBF update_ms() is being called on does not always reflect whether the TLLI has been signaled by the MS or the SGSN. This commit adds an additional parameter to tell the method, in which direction the TLLI has been passed. Sponsored-by: On-Waves ehf
2015-05-20ms: Integrate the MS storageJacob Erlbeck1-4/+12
Use the MS storage to find a MS object for a given TLLI instead of searching the TBF lists. The TBFs are then taken from the MS object, if one has been found. If all TBF might be temporarily detached from the MS object, a GprsMs::Guard is added to prevent the deletion of the object, in case another TBF gets attached later on in the scope. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-20tbf: Add MS object management to TBF codeJacob Erlbeck1-0/+6
This commit adds MS object creation and cleanup to the TBF related code. MS objects are created when a TBF that has been "anonymous" so far gets associated with a TLLI. When a TBF is replaced by another, the old TBF is detached and the new one is attached to the MS. When all TBFs have been detached, the MS object gets deleted. The TBF related code should not call attach_tbf/detach_tbf directly but use set_ms instead to make sure, that the references are updated properly. GprsMs::detach_tbf also calls set_ms(NULL) on the detached TBF object. The MS object is not really used yet, the focus is still on object creation, TBF association, and cleanup. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-04pcu: Fix non-critical warningsJacob Erlbeck1-1/+1
These fixes do not affect the semantics of the code. They either help gcc by providing default values that won't be used ("may be uninitialised"), remove unused variables, or change signed to unsigned variables to avoid comparison warnings. Addresses: bts.cpp:494:32: warning: 'tbf' may be used uninitialized in this function emu/test_replay_gprs_attach.cpp:81:27: warning: comparison between signed and unsigned integer expressions emu/test_pdp_activation.cpp:95:23: warning: unused variable ‘budh’ emu/test_pdp_activation.cpp:97:6: warning: variable ‘rc’ set but not used emu/pcu_emu.cpp:109:26: warning: unused variable ‘bts’ alloc/AllocTest.cpp:74:27: warning: unused variable ‘tbf’ osmocom/core/utils.h:13:50: warning: comparison between signed and unsigned integer expressions types/TypesTest.cpp:319:7: warning: unused variable ‘count’ types/TypesTest.cpp:320:11: warning: unused variable ‘rbb’ alloc/AllocTest.cpp:74:27: warning: unused variable ‘tbf’ alloc/AllocTest.cpp:132:11: warning: unused variable ‘ts_no’
2015-02-26tbf: Don't use 'old' DL TBFs after reuse_tbfJacob Erlbeck1-1/+1
Currently two DL TBF objects with the same TLLI exist after reuse_tbf which make the result of tbf_by_tlli undefined. This leads to several DL TBFs belonging to the same TLLI. This commit extends tbf_by_tlli to check the m_tlli_valid flag for DL, too. That flag is set to 0 in reuse_tbf to mark the 'old' DL TBF as invalid after its LLC data has been copied to the new one. Sponsored-by: On-Waves ehf
2014-09-10tbf,bts: Keep track of new TBF for dl/ul assignment in m_new_tbfDaniel Willmann1-22/+32
There are a couple of possibilities where one TBF is used to assign a new one: 1. Assign a DL TBF from a UL TBF 2. Assign a UL TBF from a DL TBF 3. Assign a DL TBF from a DL TBF which is in wait-release state (T3193 is running) In these cases the assignment is sent on the existing TBF and triggers the assignement of the new TBF (with different TFI/direction). The current code detects these situations by looking at dl/ul_ass_state and then chosing the TBF with the opposite direction (DL/UL) that has the same TLLI. This does not work in the case 3 above where a new DL TBF is triggered for a DL TBF. The current code reuses the old TBF (and TFI), but this violates the spec. This patch introduces a m_new_tbf member which is set to the new TBF to be assigned. When receiving a control ack the code looks up the n_new_tbf member of the tbf that requested the control ack and completes the ul/dl assignment. If the old TBF was in the wait release state (T3193 is running) it is released. From 3GPP TS 04.60 9.3.2.6: """ If the network has received the PACKET DOWNLINK ACK/NACK message with the Final Ack Indicator bit set to '1' and has new data to transmit for the mobile station, the network may establish a new downlink TBF for the mobile station by sending the PACKET DOWNLINK ASSIGNMENT or PACKET TIMESLOT RECONFIGURE message with the Control Ack bit set to '1' on PACCH. In case the network establishes a new downlink TBF for the mobile station, the network shall stop timer T3193. """ reuse_tbf() is modified to allocate a new TBF with a new TFI and trigger a dl assignment for that TBF on the old TBF. All pending data is moved to the new TBF. Ticket: SYS#382 Sponsored-by: On-Waves ehf
2014-08-08tbf, bts: Use tbf set_state method instead of tbf_new_state functionDaniel Willmann1-5/+5
All the function did was add debug output and call the set_state method. Move the debugging into the method and remove the function. Ticket: SYS#389 Sponsored by: On-Waves ehf
2014-08-07tbf, ...: Make the fields in the dl/ul struct member variablesDaniel Willmann1-3/+3
There is no need for the union/struct anymore. Make the variable members of the UL/DL class. As a result gprs_rlc_dl_window gets a reset() method because memset(&dir.dl, 0, sizeof(dir.dl)) doesn't work anymore in reuse_tbf(). Ticket: SYS#389 Sponsored by: On-Waves ehf
2014-08-07bts: Change parameter in BTS::trigger_dl_ass() to DL TBFDaniel Willmann1-14/+14
This method is always called with a DL TBF as argument so make it clear. Ticket: SYS#389 Sponsored by: On-Waves ehf
2014-08-07bts: Make use of DL TBF explicit in rcv_imm_ass_cnf()Daniel Willmann1-5/+5
Ticket: SYS#389 Sponsored by: On-Waves ehf
2014-08-07bts, tbf: Make rcvd_dl_ack a method of the DL TBFDaniel Willmann1-1/+1
This method is only userul for DL TBFs so move it. As a result gprs_rlcmac_pdch::rcv_control_ack needs to work with dl_tbfs. Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-08-07bts: Remove the OSMO_ASSERTs for TBF directionDaniel Willmann1-6/+0
llist_add is called on the TBF lists in tbf_alloc_ul/dl_tbf or in rotate_in_list. All three places check the direction/add the new TBF to the correct list so an ASSERT on entry is not needed. Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-07-30tbf: Use plain old data structure (PODS) for llist managementDaniel Willmann1-6/+11
The PODS struct has a back pointer to access the actual object. llist_pods_for_each_entry traverses the list of struct llist_pods and makes the entry available (through the back pointer). Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-07-22bts, tbf: Split alloc_tbf function into separate UL and DL versionsDaniel Willmann1-1/+1
UL and DL tbfs are used in very separate parts and are not the same thing so split the alloc function and use the UL/DL version throughout the code. Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-07-22bts, tbf: Change the TBF return type of functions to the ul/dl versionDaniel Willmann1-19/+26
Many functions only ever deal with or return a UL or a DL TBF. Explicitly change the type to reflect which TBF is used where. Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-07-16bts: Return the special type for {ul,dl}_tbf_by_* functionsDaniel Willmann1-18/+18
Start returning the special type instead of the base gprs_rlcmac_tbf when retrieving a TBF. Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-07-16bts: Ensure tbf direction with OSMO_ASSERT()Daniel Willmann1-6/+16
In the lookup functions make sure that we are actually returning tbfs with the expected direction. Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-07-03bts: Split tbf_by_poll_fn into separate dl and ul functionsDaniel Willmann1-5/+16
rcv_control_dl_ack_nack is only meaningful for dl tbf while rcv_control_ack can be sent in response to a dl or ul tbf. So rcv_control_ack still needs to check for ul and dl tbfs. Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-07-03bts: Separate functions for dl/ul tbf_by_tfi lookupDaniel Willmann1-3/+15
Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-07-03bts, tbf: Separate functions for dl/ul tbf_by_tlli lookupDaniel Willmann1-7/+17
In the future we want to separate ul and dl tbf into different classes that inherit from a common base. Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-06-04bts: Remove outdated commentDaniel Willmann1-1/+0
There is no parameter in the function and the bts has a memeber trx which has a member pdch. Sponsored-by: On-Waves ehf
2014-06-04gprs_rlcmac_pdch: Get rid of ul/dl_tbfDaniel Willmann1-8/+18
The current code keeps a reference to all tbfs in the bts and another reference in the pdch. This allows for the possibility of both lists to go out of sync. This patch removes the pdch-specific list of ul and dl tbfs and uses the lists in the bts to lookup tbfs everywhere. Performance for going through the global list is not an issue yet. We can optimize this later and in a better way. Sponsored-by: On-Waves ehf
2014-06-04gprs_rlcmac_pdch: Don't access private membersDaniel Willmann1-0/+14
This patch introduces methods to get ul and dl tbf by tfi and uses them in gprs_rlcmac_sched. Sponsored by: On-Waves ehf
2014-05-30tbf/bts, encoding: Keep track of WAIT_RELEASE state for DL assignmentDaniel Willmann1-0/+2
The current code does not properly distinguish between DL assignments to reuse a tbf (after it was put in state WAIT_RELEASE) and DL assignments for an active tbf to change the allocation of the PDCH timeslots. This patch introduces a new variable was_releasing which remembers if trigger_dl_ass() was called with a tbf in state WAIT_RELEASE. In that case we have to set the CONTROL_ACK field in the download assignment. This should allow us to send DL assignments to change PDCH TS allocation of a tbf before we enter FLOW state.
2014-05-30tbf/bts: Rename tbf->snd_dl_ack to tbf->rcvd_dl_ackDaniel Willmann1-1/+1
This function is called to act upon a received DL ACK packet so this name makes more sense.
2014-01-16tbf: Make finding use-after-free more easy and set to NULL or returnHolger Hans Peter Freyther1-0/+1
Make finding use-after-free more easy by setting things to NULL or simply return after tbf_free(this) has been called.
2014-01-15bts: Rename ts and trx to ts_no and trx_no as we operate on numberHolger Hans Peter Freyther1-6/+6
2014-01-15tbf: Kill the tsc member as it duplicates dataHolger Hans Peter Freyther1-2/+2
We can just use first_ts and the trx/pdch to extract this information. Avoid duplication of data.
2013-11-26debug_diagram: Remove the special debug_diagram compilation modeHolger Hans Peter Freyther1-6/+0
This approach is somehow flawed. We need/want to debug problems on systems with real traffic and re-compiling it with debug_diagram is not an option. All internal logging needs to be expressive enough so we can understand what is going on (e.g. create a script to post-process the output).
2013-11-24tbf: Count how often we re-start a BSN in the send routineHolger Hans Peter Freyther1-0/+1
There appears to be a scheduling issue. Even without any NACKs we are re-transmitting a lot of frames. It might be because of this.
2013-11-23rlc: Count nacked frames in the statistics tooHolger Hans Peter Freyther1-0/+1