path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2015-09-01tbf: Refactor reuse_tbf into releasing and DL TBF establishmentJacob Erlbeck1-5/+8
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-2/+2
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 Erlbeck2-10/+12
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-28l1: Use the FN of all data_ind/ra_ind DSP messagesJacob Erlbeck1-0/+2
Currently all of these messages are discarded if they are assumend to be caused by noise. But even in these cases, the FN and TN values which are added by the DSP are valid. So these can be used to update the current_frame value. The osmo-bts sets the fBFILevel of a physical channel to -200dB if it is used for PDTCH or PACCH which is the case for all PDCH. This way a data_ind or ra_ind message is already send at least once per block period (4 frames) per PDCH. These messages are passed to either handle_ph_data_ind or handle_ph_ra_ind even if they contain garbage data. The ra_ind messages are sometimes sent a few frames earlier than data_ind messages using the same frame. This commit adds calls to update the current_frame value based on all of these messages before they are discarded. The FN taken from ra_ind are passed with an increased max_delay (5) to compensate for early ra_ind messages. Sponsored-by: On-Waves ehf
2015-08-28poll: Use the data_ind FN as time source for current frameJacob Erlbeck1-0/+4
The FN of the data_ind taken from the DSP are monotonic, so latency does not affect the detection of poll timeouts if these FN are used. If the FN is larger than a poll_fn value, it can safely be assumed that the poll response will not arrive later on. Currently a max_delay of 60 frames is used, which has the drawback that additional ~250ms will pass until a lost ACK is detected. Using the data_ind's FN alone breaks the poll timeout detection if there are no other MS sending data blocks. This commit adds BTS::set_current_block_frame_number that is called with the FN taken from data_ind messages. The max_delay is set to 0 which removes the additional delay, when this FN is used to detect poll timeouts. So the average additional delay decreases with the number of data_ind per time. The current_frame is updated unless it seems to have been updated already (assumed if 0 < cur_fn - block_fn < 500). Thus the time_ind has still priority to update the current_frame value. Sponsored-by: On-Waves ehf
2015-08-28tbf: Add logging for pollingJacob Erlbeck1-0/+16
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-11/+11
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 Erlbeck4-24/+227
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-24llist: Add missing const qualifier in llist cast methodJacob Erlbeck1-0/+4
The missing const qualifier prevents the llist_empty() C++ wrapper function from being compiled successfully when it is used. Sponsored-by: On-Waves ehf
2015-08-24tbf: Use C++/talloc magic to support TBF constructors/destructorsJacob Erlbeck1-11/+11
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-24tbf/test: Add test_tbf_dl_reuseJacob Erlbeck3-0/+790
This tests the usage of an existing TBF that is no longer in FLOW state to request a new DL TBF via the old TBF's PACCH. The test triggers a bug that breaks the association between both TBF objects, resulting in packet loss and transmission stalling. Sponsored-by: On-Waves ehf
2015-08-24tbf/test: Do RLC based ack instead of just fakingJacob Erlbeck2-49/+78
Currently the assignment is completed by manipulating the state of the TBF objects directly by setting the state fields to fixed values. This way, the PCU's code that is responsible to update the state accordingly is not tested. This commit changes this to simulate RLC Control Acknowledgement messages instead. Sponsored-by: On-Waves ehf
2015-08-24tbf/test: Rename send_rlc_block to request_dl_rlc_blockJacob Erlbeck1-9/+9
This function basically request the generation of the next downlink RLC block. Since this will no really send somthing to the PCU, the current name can be misleading. This commit just renames the function. Sponsored-by: On-Waves ehf
2015-08-24tbf/test: Simplify RLC block number handlingJacob Erlbeck2-26/+26
The block number can always be deduced from the frame number. The current test code handles the block number explicitely, which makes the code more complex and has also led to block number errors cause by not wrapping the numbers (valid block numbers range from 0 to 11). This commit changes send_rlc_block to always compute the block number based on the frame number. It also turns the block_nr into an optionaly output-only parameter. Sponsored-by: On-Waves ehf
2015-08-24tbf/test: Add send_rlc_block function with a TBF as parameterJacob Erlbeck1-10/+14
The current implementation takes a lot of parameters (bts, trx_no, ...) that can also be taken from a TBF object. This commit adds an alternative variant with just takes a TBF, the fn (in/out), and the block number (in/out). Sponsored-by: On-Waves ehf
2015-08-21tbf/test: Move UL MAC block encoding into a separate functionJacob Erlbeck1-12/+24
This commits adds send_ul_mac_block() to encode and send a RlcMacUplink_t to the PCU. Sponsored-by: On-Waves ehf
2015-08-21tbf: Move pending LLC frames when merging MS objectsJacob Erlbeck2-2/+2
Currently the pending LLC packets are lost in some cases when MS objects are merged, for instance after a RACH when there were 2 MS object for the same MS (they get merged, when the TLLI is known for both objects). This patch modifies GprsMs::merge_old_ms to move all pending LLC packets (if there are any) to the current MS object. Sponsored-by: On-Waves ehf
2015-08-21llc: Add move_and_merge method to llc_queueJacob Erlbeck3-0/+58
This methods takes all LLC frames from the old LLC queue and moves them into the current. If both queues are ordered chronologically (recv_time), the resulting queue is also ordered. Sponsored-by: On-Waves ehf
2015-08-21tbf: Do not kill DL TBF on Packet Resource RequestJacob Erlbeck2-11/+9
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/test: Add tests for RACH while DL TBFs are activeJacob Erlbeck3-0/+639
This adds tests for - RA update with RACH for the RAUpdateComplete message - RACH for UL while DL is active (LLC queue not empty) Sponsored-by: On-Waves ehf
2015-08-21tbf/test: Fix existing testsJacob Erlbeck2-11/+114
This commit fixes several issues: - Set MS class in request - Set IMSI in establish_ul_tbf_two_phase - Fake assigment acknowledgement in establish_ul_tbf_two_phase - Fix TFI bit offset to 1 (was 2) Sponsored-by: On-Waves ehf
2015-08-21tbf/test: Move UL TBF establishment into separate functionsJacob Erlbeck2-56/+95
Currently the functions test_tbf_single_phase and test_tbf_two_phase do the test logging, BTS intialisation, and the complete message sequencing on their own. Therefore they cannot be used to test more complex sequences like TBF reestablishment. This commit moves the code that does the actual messaging into own functions. The frame number handling is generalised which also fixes a block number wrapping error on the way. Sponsored-by: On-Waves ehf
2015-08-18ms: Move MS information merging to GprsMSJacob Erlbeck1-3/+2
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-17ns: Add logging supportJacob Erlbeck1-0/+1
Currently there is not support for Network Service (NS) logging. This commit adds the missing definitions and sets the default level to INFO. Further configuration can now be done with the 'logging level ns' VTY command. Sponsored-by: On-Waves ehf
2015-08-17tbf: Clean old MS objects if they have the same TLLIJacob Erlbeck2-15/+21
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-08-13tbf: Always start T3193 when changing state to GPRS_RLCMAC_WAIT_RELEASEJacob Erlbeck2-1/+8
Currently when receiving a PACKET DL ACK/NACK message with the Final Ack Indicator bit set, the TBF's state is set to GPRS_RLCMAC_WAIT_RELEASE but T3193 is only started when the LLC queue is empty. Otherwise the reuse_tbf() method is called to establish a new DL TBF. In that case, the timer is not started. This will leave the current TBF without a timer so it is potentially not released later on. This is recognisable by sticky entries in the output of the 'show tbf all' command and possibly allocation failures if there are too many of them. This commit changes the code to always start T3193 to make sure, that a timer is always active when the the state is set to GPRS_RLCMAC_WAIT_RELEASE. Note that TS 44.060, requests to release the 'old' TBF immediately in some cases, which is not implemented by this change. This will lead to a longer reservation period of the TFI only, which is safer than reassigning it too early. Sponsored-by: On-Waves ehf
2015-07-21llc: Add CoDel AQM implementationJacob Erlbeck4-2/+191
This commit adds an implementation of the CoDel algorithm based on the reference pseudocode presented in http://queue.acm.org/appendices/codel.html. Instead of abstracting the queue itself, the implementation provides a time stamp based automaton which is invoked after a package has been dequeued. Note that the modifications of the algorithm shown in https://tools.ietf.org/html/draft-ietf-aqm-codel-01 are not yet applied. Sponsored-by: On-Waves ehf
2015-07-16alloc: Make alloc_algorithm_dynamic statefulJacob Erlbeck3-893/+423
Currently there is no persistent state being used in alloc_algorithm_dynamic. So algorithm B is even used in persistent high usage scenarios. If there are many active TBFs, multislot assigments are not fair, because MS of a "higher" multislot class get higher troughputs. On the other hand, as long as all PDCH are busy no bandwidth will be wasted even if all MS use algorithm A. This commit modifies alloc_algorithm_dynamic to disable algorithm B when that call fails. It then keeps it disabled until there is a single PDCH which is idle (it is considered idle, if there is at most one active DL TBF assigned to it). Sponsored-by: On-Waves ehf
2015-07-16alloc/test: Fix trx_no assertionJacob Erlbeck1-1/+2
Currently the value of trx_no2 is used in the assertion, even if the call to tfi_find_free has failed. This commit fixes the asserted expression to only compare the trx_no values if the function call has succeeded. Sponsored-by: On-Waves ehf
2015-07-16alloc/test: Free the TBF if the recursion has failedJacob Erlbeck1-0/+4
Currently if both an uplink and a downlink TBF are to be allocated by alloc_tbfs() and the second allocation fails, the first TBF is not freed. This commit changes the recursive function to free the TBF if the ms variable has been changed to NULL. Sponsored-by: On-Waves ehf
2015-07-16alloc/test: Use lower case for slots with TFI shortageJacob Erlbeck1-16/+39
Indicate those slots with lower case letters that do not have a spare TFI for the other direction if such a TBF has not been attached to the MS object yet. Sponsored-by: On-Waves ehf
2015-07-16alloc: Use a separate usage computation for algo AJacob Erlbeck1-56/+56
Currently algorithm A can select an TBF even when there is no free TBF in the reverse direction. While this does not necessarily lead to an allocation failure, the probabily is higher. In addition, the current slot reservations are not taken into account. This commit changes the selection algorithm to prefer slots where TFI are available in both directions and which are less reserved. Sponsored-by: On-Waves ehf
2015-07-16alloc/test: Show expectation before failureJacob Erlbeck1-1/+10
To simplify debugging, show the actuals value before the assertion fails in some cases. Sponsored-by: On-Waves ehf
2015-07-16alloc: Add 'dynamic' allocation algorithmJacob Erlbeck3-0/+1703
The idea behind this meta algorithm is to automatically select one of the other algorithms based on the system state. Basically algorithm B will be selected if the PDCH usage is low to improve throughput and latency. Algorithm A will be selected to support more concurrent MS. This commit adds a first simple state-less version of this algorithm that always tries B first and only if that fails A is tried afterwards. The following VTY command is added to the 'pcu' node: - alloc-algorithm dynamic Ticket: #1934 Sponsored-by: On-Waves ehf
2015-07-16alloc: Refactor alloc algorithms to only apply changes on successJacob Erlbeck1-7/+7
Currently these algorithms modify other objects (MS, TBF, PDCH) even if the allocation will fail later on. To implement an algorithm that dynamically tries another algorithm on failure (e.g. A after B), the first (failing) algorithm should not change or damage anything. This commit refactors algorithm A and B to delay the actual allocation until it is known that the allocation will not fail. Ticket: #1934 Sponsored-by: On-Waves ehf
2015-07-16alloc/test: Add test for interleaved TBF chainsJacob Erlbeck3-0/+1104
MS iniated TCP connections generally result in a sequence of short time UL and longer lasting DL TBFs, being interleaved between several MS. This scenario is not covered by the existing tests. This commit adds a test, that allocates as man as possible TBFs several times with different test modes without clearing the BTS (and thus the TBF list) in between. The number of allocated DL TBFs in each round is expected to be constant. Sponsored-by: On-Waves ehf
2015-07-16alloc/test: Put TBF allocation loop into alloc_many_tbfsJacob Erlbeck1-22/+43
Currently all TBFs are deleted after the allocation loop finishes. This make it difficult to interleave the TBF allocation like it happens with real MS. This commit refactors the allocation loop into alloc_many_tbfs and adds support for TLLIs, which are derived from the counter value and used to retrieve an old MS object if alloc_many_tbfs is called a second time. Note that this does not make a difference for the existing tests. Sponsored-by: On-Waves ehf
2015-07-16tbf: Put the TFI->TBF mapping into the PDCH objectsJacob Erlbeck3-19/+13
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-16alloc: Allocate TFI per slot (algorithm A)Jacob Erlbeck4-281/+454
Currently the TFI are managed per TRX, thus only a maximum of 32 TBF per direction and per TRX are possible simultaneously. This commit modifies algorithm_a() to allow the sharing of TFI between different PDCH. Since algorithm A only assigns a single slot to each TBF, the TFI of each PDCH can be assigned independently. This increases the maximum to 32 TBF per direction and per PDCH concerning the TFI allocation. Ticket: #1793 Sponsored-by: On-Waves ehf
2015-07-16tbf: Move TFI selection into alloc_algorithmJacob Erlbeck4-177/+248
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-16pdch: Manage TFIs per directionJacob Erlbeck2-10/+2
Currently a single bit set is used to maintain a set of used TFI without distinguishing between uplink and downlink. Since the namespaces of UL and DL TFI are separate, this implementation is not correct. This commit changes gprs_rlcmac_pdch to use a separate bit set for each direction. It also replace the corresponding conditional fprintf statement in check_tfi_usage (AllocTest.cpp) by an equivalent OSMO_ASSERT. Sponsored-by: On-Waves ehf
2015-07-16alloc/test: Check for TFI conflictsJacob Erlbeck2-1/+110
This commit adds the check_tfi_usage function that checks the TFI usage. It iterates through all TBFs, records on which PDCH it uses which TFI and check for conflicts. It also checks the bits returned by pdch->assigned_tfi(). The latter suffers from an bug in that method (no separation of uplink and downlink), so a conditional fprintf is used instead of an assertion. The method tfi_find_free is checked for conflicts after allocations. Sponsored-by: On-Waves ehf
2015-07-16alloc: Fix MS_B/MS_C interpretationJacob Erlbeck1-209/+209
Currently the handling of MS_B and MS_C is not compliant with TS 45.002, annex B.1. These values may only interpreted as 0, if frequency hopping is not enabled and if there is no change from Rx to Tx or vice-versa. This commit sets Ttb/Trb to 1 if the table entry is MS_B/MS_C, since only combined down/up access modes are supported. Sponsored-by: On-Waves ehf
2015-07-16alloc: Do not use masking for multislot class type 2 MSJacob Erlbeck1-35/+35
Currently the masks are computed equally for each class type. This does not make much sense for class type 2 MS, since those are capable to work in full duplex mode. This commit sets the masks to 0xff for class type 2 MS. Sponsored-by: On-Waves ehf
2015-07-16alloc: Select applicable Tta/TraJacob Erlbeck1-4/+4
According to TS 45.002, the choice whether Tta or Tra has to be applied, depends on the medium access mode (currently always dynamic) and the number of UL/DL slots. Currently either value can be used which might result in combinations not covered by the spec. This commit changes find_multi_slots() to skip non-compliant combinations. Note that this code will have to be extended, if other medium access modes are implemented. Sponsored-by: On-Waves ehf
2015-07-07alloc: Use least reserved PDCH for algo AJacob Erlbeck3-33/+58
Currently the slot selection of algorithm A is based on the current slot usage by active TBF. Especially in the Dl after UL case which reflects the commen use case "MS initiates TCP connection", the resulting distribution is not optimal with respect to PDCH usage. This commit changes the implementation to use the slot reservation information instead. Sponsored-by: On-Waves ehf
2015-07-07alloc/test: Delete first TBF after the second is allocatedJacob Erlbeck3-100/+77
Currently when using the test modes TEST_MODE_DL_AFTER_UL or TEST_MODE_UL_AFTER_DL, the first TBF is deleted before the second is allocated. The far more interesting case were to keep the first TBF a little bit longer until the second TBF has been created and delete then. This comes closer the the situation observed with real MS, where the first TBF takes some time (timeout or waiting for Ack) before it gets deleted and thus detached from the MS object. This commit delays the call to tbf_free accordingly. The effect can be observed in the results of the algo A tests, where the uniform distribution of the allocated PDCH is lost. Sponsored-by: On-Waves ehf
2015-07-07tbf: Keep a set of used TFI and USF per PDCHJacob Erlbeck1-53/+53
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-07alloc: Skip common TS without free USF when ratingJacob Erlbeck3-33/+63
Currently the search of the "best" slot combination is done separately from the UL slot selection, which can lead to an allocation failure due to USF exhaustion even if another combination had been possible. This commit reduces the probability for this event by skipping UL slots without free USF while calculation the capacity. Note that the implementation is rather inefficient which will be fixed by the following commits. Sponsored-by: On-Waves ehf
2015-07-07alloc: Only reserve 1 UL slot with algorithm BJacob Erlbeck3-73/+61
Since currently the algorithm B will only allocate a single UL slot and will have to stick to it (first common TS), the other possible UL slots will not be allocated while the reservation is kept. This commit adds code to update the reserved set of UL slots to only reserve the single common TS when the UL TBF is allocated. Interestingly this leads to fewer allocated TBF in some cases due to USF exhaustion. This will be improved by the following commit "alloc: Skip common TS without free USF". Sponsored-by: On-Waves ehf