aboutsummaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2015-06-22l1: Pass all L1 measurements upwardsJacob Erlbeck1-3/+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-22build: Add -lrt to AM_LDFLAGSJacob Erlbeck1-0/+1
This is needed to link programs using clock_gettime and related functions when compiling with older glibc versions. This should fix the Jenkins build. Nevertheless fixing this in configure.ac were probably nicer. Sponsored-by: On-Waves ehf
2015-06-08tbf: Move the current CS field to GprsMsJacob Erlbeck2-6/+8
Currently the current CS value is stored in the cs field of gprs_rlcmac_tbf and initialised when it is used the first time. This commit adds separate fields for UL and DL CS values to the GprsMs class and provides corresponding getter methods for GprsMs and gprs_rlcmac_tbf. Ticket: #1739 Sponsored-by: On-Waves ehf
2015-06-08ms: Add back pointer to BTSJacob Erlbeck1-6/+6
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 Erlbeck2-0/+40
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-28ms: Add timerJacob Erlbeck3-0/+81
Currently the MS object is immediately idle when all TBFs are detached and if no guard is being used. Since the plan is to use the MS objects to pass information from one TBF to the next one even across the gap of some seconds of inactivity, a mechanism is needed to keep the MS objects around for some time. This commit extends the GprsMs class by a timer that keeps the MS objects in non-idle state for some time after all TBFs have been detached. The set_timeout method must be used with a non-zero value to activate this feature. Sponsored-by: On-Waves ehf
2015-05-28tbf: Store the timing advance (TA) value in the GprsMs objectJacob Erlbeck2-44/+26
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 Erlbeck3-0/+242
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 Erlbeck2-11/+10
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/test: Attach TLLI and MS objects to TBFsJacob Erlbeck2-74/+97
Currently the DL TBF's TLLI are not set. This will have to change in the future, when the m_new_tbf chaining is replaced by the usage of MS object to group TBFs. This commit just calls update_ms() on newly created TBFs. This changes many of the lines written to stderr due to the TLLI change, but doesn't change other aspects or messages beside creating and destroying MS objects. Sponsored-by: On-Waves ehf
2015-05-28ms: Use the IMSI to retrieve the MS objectJacob Erlbeck4-7/+31
This commit extends get_ms() to really compare the IMSI if it has been given. Matching by TLLI has a higher precedence than matching by IMSI. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-28tbf: Move IMSI to MS objectJacob Erlbeck3-0/+131
Currently the IMSI is stored in the TBFs. Since it directly refers to an MS, it should rather be stored in an MS object. This patch move the m_imsi field from gprs_rlcmac_tbf to GprsMs, changes gprs_rlcmac_tbf::imsi() to get the IMSI from the associated MS object, and adds getter and setter to GprsMs. Before changing the IMSI of the associated MS object, assign_imsi() checks if there is already another MS object with the same IMSI and eventually resets the IMSI of that one. So using update_ms() and assign_imsi() ensures that there are not two MS object entries is the storage with the same TLLI or the same IMSI. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-27tbf/test: Fix IMSI creationJacob Erlbeck2-65/+65
Currently the generated IMSI contains blanks due to a missing '0' flag in the corresponding snprintf statement. In addition, the buffer is effectively limited to 15 bytes which is shorter than the generated character sequence, such that the last character of the IMSI is removed. This patch fixes both issues. Since snprintf itself will add a terminating \0 character, the whole buffer can be passed to snprintf. Sponsored-by: On-Waves ehf
2015-05-27tbf: Always call set_tlli/confirm_tlli in update_msJacob Erlbeck4-44/+83
Currently the m_tlli member in GprsMs is set by the constructor, circumventing the TLLI confirmation mechanism. This commit replaces the get_or_create_ms() method by a create_ms() method which takes the TLLI and the direction (UL or DL) as parameters to select either set_tlli() or confirm_tlli(). The MS object is instantiated with TLLI = 0, and therefore GprsMs::tlli() is extended to return the DL TLLI if both of the other TLLI are not set. Note that create_ms() will not check whether an MS object with a matching TLLI is already stored in the list, so it should only be called after a corresponding get_ms() in general. Sponsored-by: On-Waves ehf
2015-05-27tbf: Remove the TLLI from the TBFsJacob Erlbeck3-18/+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-22llist: Reduce the external dependencies of this testHolger Hans Peter Freyther1-3/+0
Debian is using the classic bfd linker and when passing libosmogb as link dependency it always wants/needs to resolve the bssgp_prim_cb symbol (which is to be provided by the application). Only keep the libosmocore dependency. Fixes: lib/libosmogb.so: undefined reference to `bssgp_prim_cb' collect2: error: ld returned 1 exit status Makefile:511: recipe for target 'llist/LListTest' failed
2015-05-21tbf: Just pass the MS object in reuse_tbfJacob Erlbeck1-8/+0
Currently the MS will be searched based on the TLLI in resue_tbf(). Since the MS object is already known in the TBF when the TLLI is set, it can just be passed to the new TBF. This commit removes the call to update_ms() and just adds new_tbf->set_ms(ms()) which will also work as expected if ms() == NULL. Sponsored-by: On-Waves ehf
2015-05-21tbf: Explicitly pass the direction to update_ms()Jacob Erlbeck2-5/+5
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-21ms: Support new and old TLLIsJacob Erlbeck5-10/+141
According to the specification (GSM 04.08/24.008, 4.7.1.5) after a new P-TMSI has been assigned, the old P-TMSI must be kept basically until it has been used by both sides. Since the TLLI will be derived from the P-TMSI, the old TLLI must also be kept until the new TLLI has been used by both MS and SGSN. This commit modifies the TLLI handling of GprsMs accordingly. set_tlli() is only used with TLLIs derived from MS messages, confirm_tlli() is used with TLLIs derived from messages received from the SGSN. tlli() returns the value set by the MS. check_tlli() matches each of the TLLI used by either MS or SGSN as well as the old TLLI until it has been confirmed. Sponsored-by: On-Waves ehf
2015-05-20ms: Integrate the MS storageJacob Erlbeck1-0/+4
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-20ms: Add MS storage classJacob Erlbeck3-0/+64
Currently the MS objects are contained in the TBF objects only. To allow for an extended life time after the TBF objects have been freed and to find them based on TLLI, a container for the MS objects is needed. This commit adds the container class and also adds the corresponding m_list member to GprsMs. Further integration into the PCU code is not yet done. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-20llist: Add a C++ wrapper for linux_listJacob Erlbeck6-3/+115
This commit adds the LListHead class which is a wrapper around the linuxlist. It adds an additional member to refer to the container, since the container_of macro doesn't work properly with C++ classes. All functions and macros from linuxlist.h are support except for the entry macros (e.g. llist_entry, llist_for_each_entry, ...). To access the container (entry), an entry() method is provided instead: llist_for_each(pos, &elems) { pos->entry()->do_something(); } Sponsored-by: On-Waves ehf
2015-05-20tbf/test: Optionally show talloc reportJacob Erlbeck1-0/+3
To show the talloc report more easily, this commit adds a call to talloc_report_full if the TALLOC_REPORT_FULL environment variable is set (the value is ignored). Since the stderr output is checked by the test suite, this feature is not enabled by default. Sponsored-by: On-Waves ehf
2015-05-20tbf: Add MS object management to TBF codeJacob Erlbeck1-0/+72
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-20ms: Add GprsMs class to hold per-MS informationJacob Erlbeck5-2/+333
Currently only TBF objects are used to handle the data flow between the MS and the SGSN. MS specific data (e.g. pending LLC frames, TLLI) is copied between successive TBFs. If all TBFs (uplink and downlink) are idle for some time, all information about the MS is discarded in the PCU. This makes the implementation of some features more difficult, e.g. proper TLLI and timing advance handling, connection based CS selection, and proper management of multiple TBF. This commit adds the GprsMs class that is intended to hold information directly related to the MS and to keep references to the active TBFs. The class is not yet integrated with the other PCU code. A GprsMs object container and MS specific fields (TA, CS) will be added in later commits. Note that calling detach_tbf() can possibly delete the MS object depending on the callback implementation. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-04tbf/test: Fix old_tbf argument to tbf_alloc_ul_tbfJacob Erlbeck1-1/+1
Currently the ul_tbf is used in its own declaration as an argument to tbf_alloc_ul_tbf, where dl_tbf can be used instead and makes more sense. This commit uses dl_tbf instead of ul_tbf as old_tbf. Addresses: tbf/TbfTest.cpp:71:14: warning: ‘ul_tbf’ may be used uninitialized in this function Sponsored-by: On-Waves ehf
2015-05-04pcu_emu/test: Initialise current_testJacob Erlbeck1-1/+3
Currently the global current_test is not initialised, which leads to memory access failures. In addition, the variable is signed but used in comparisons with unsigned values. This commit changes the type to size_t and initialises the variable to 0. Sponsored-by: On-Waves ehf
2015-05-04pcu: Fix non-critical warningsJacob Erlbeck5-17/+9
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-04-09tbf: Send BSSGP LLC discarded on TBI exhaustionJacob Erlbeck1-0/+1
Currently the PCU silently discard LLC frames from the SGSN if a DL TBF cannot be allocated. This commit changes tbf_new_dl_assignment and reuse_tbf to send an LLC discarded message to the SGSN in this case. Ticket: #607 Sponsored-by: On-Waves ehf
2015-04-09tbf/test: Add test for DL TBF exhaustionJacob Erlbeck3-0/+601
This test calls gprs_rlcmac_dl_tbf::handle() with varying TLLI and IMSI until the function fails. Sponsored-by: On-Waves ehf
2015-03-25tbf: Poll MS on idle DL TBFsJacob Erlbeck1-27/+27
If an MS wants to open a new UL TBF, it can either use (P)RACH or request one in a Ack/Nack message for a DL TBF (PACCH). When a TBF becomes idle (LCC queue is empty but the TBF is kept open), there aren't any Ack/Nack requests that can be used by the MS to ask for an UL TBF, therefore it has to use the RACH. This leads to many RACH requests even for a single HTTP transaction, so it takes some time to retrieve even a simple web page. This commit modifies the scheduler to regularly send Ack/Nack requests on idle DL TBFs. It does so by extending the priority based scheduling algorithm to have 5 priority levels (highest priority first): - Control block is pending - High age (100%) threshold reached (-> request Ack/Nack) - Data is waiting or there are pending Nacks - Low age (200ms) threshold reached (-> request Ack/Nack) - Pending Nacks that have been resent already - None of the above (-> send DL dummy control block) The 'age' refers to the time since since the last control block has been sent on the TBF. This high age threshold is set to dl-tbf-idle-time or to 50% of T3190 (whichever is smaller), aiming for at least a poll (and TBF shutdown) after the TBF has expired and to safely prevent expiry of T3190. So if dl-tbf-idle-time > 200ms, there will be a poll every 200ms and a final poll after dl-tbf-idle-time. On high load, the interval between polls can get higher, but the 'high age' poll should be in place. This commit implements the scheduling with respect to GSM 44.060, 9.3.1a ("Delayed release of downlink TBF"). Ticket: #556 Sponsored-by: On-Waves ehf
2015-03-25tbf/test: Add test for delayed releaseJacob Erlbeck3-0/+293
This tests checks the implementation of the delayed release of an downlink TBF. Ticket: #556 Sponsored-by: On-Waves ehf
2015-03-25tbf: Use put_frame in append_data if the TBF has no dataJacob Erlbeck1-18/+12
Currently if append_data() is used when there is no LLC data in the DL TBF, it will either call reuse_tbf() which in turn will call put_frame(), or it will append the LLC message to the queue, even if the queue and the frame buffer are empty. This only happens with the test case so far, but this would change when idle DL TBFs are kept open for some time. It results in empty LLC message being sent to the MS (see log below). This commit changes append_data to check for this case and to eventually use put_frame() instead of appending the LLC data to the queue. Addresses: TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==0) - Sending new block at BSN 0 -- Chunk with length 0 is less than remaining space (20): add length header to to delimit LLC frame Complete DL frame for TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW)len=0 - Dequeue next LLC for TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=FLOW) (len=200) Sponsored-by: On-Waves ehf
2015-03-25tbf/test: Fix fn/block_nr in test_tbf_final_ackJacob Erlbeck2-8/+25
Currently fn and block_nr are not incremented correctly. In addition, the comments around the sending of blocks are not accurate either. This commit introduces the send_rlc_block helper function which takes care of the increments, updates the comments to reflect what is really happening, and adds assertion to verify at least some aspects of what is now stated in the comments. Sponsored-by: On-Waves ehf
2015-03-25tbf/test: Put BTS setup and DL TBF creation into helper functionsJacob Erlbeck1-23/+45
Put the generic parts of test_tbf_final_ack into helper functions to reduce the size of the test and to avoid too much code duplication when creating new tests. Sponsored-by: On-Waves ehf
2015-03-06tbf: Reduce m_new_tbf logging messagesJacob Erlbeck1-2/+0
Currently tbf->m_new_tbf may point to itself if no new TBF is assigned. But this leads to additional logging messages, since the code in set_new_tbf and tbf_free assumes, that a real new TBF is assigned and generates log messages accordingly. This commit adds checks to avoid those messages in the above case. Sponsored-by: On-Waves ehf
2015-03-06tbf: Add name() method and put the buf into the tbfJacob Erlbeck1-4/+4
Currently tbf_name() must not be used twice in a printf statement with different TBFs, since the same baffer will be used for each. This commit puts the text buffer into struct gprs_rlcmac_tbf to avoid this problem. Sponsored-by: On-Waves ehf
2015-02-23tbf: Fix dangling m_new_tbf pointerJacob Erlbeck2-6/+19
Currently if a 'new' TBF is freed before the 'old' one (where old_tbf->m_new_tbf == new_tbf), the old_tbf->m_new_tbf is not cleared and can be accessed later on. This can lead to inconsistencies or segmentation faults. This commit adds m_old_tbf which points back from new_tbf to old_pdf. m_new_tbf and m_old_tbf are either both set to NULL or one is the reverse pointer of the other (tbf->m_new_tbf->m_old_tbf == tbf and tbf->m_old_tbf->m_new_tbf == tbf). It extends set_new_tbf and tbf_free to update the pointee accordingly. The TBF test is extended to check this invariant at several places. Sponsored-by: On-Waves ehf
2015-02-23tbf/test: Modify test to create a dangling TBF pointerJacob Erlbeck2-4/+86
When new_tbf is freed before dl_tbf in test_tbf_final_ack, dl_tbf still contains a pointer to it in m_new_tbf. This patch changes the test to accept a test mode parameter and runs it twice which a different order of tbf_free in each run. Consistency checks are added, to check for a danglilng m_new_tbf pointer in both cases. Sponsored-by: On-Waves ehf
2015-02-23tests: Fix library link orderJacob Erlbeck1-4/+4
Currently libgprs.la is listed after libosmocore.so which leads to link errors when compiling under Ubuntu with the system build tools (no cross compiling). This patch moves libgprs.la in front of the external libs. Sponsored-by: On-Waves ehf
2014-09-19tests/tbf: Commit TbfTest.err *with* whitespace "errors"Daniel Willmann1-4/+4
Otherwise the diff and hence the test will fail...
2014-09-19tests/tbf: Use correct function to enqueue llc dataDaniel Willmann2-14/+11
The test called the llc enqueue() function directly which didn't take care of prepending the tv values for the timeout to the data. Now the test uses dl_tbf.append() which takes care of prepending the tv values. With this patch make distcheck on jenkins should no longer fail with "Discarding LLC PDU because lifetime limit reached." messages.
2014-09-10tests/tbf: Test for final ack issueDaniel Willmann2-0/+142
Ticket: SYS#382 Sponsored-by: On-Waves ehf
2014-08-15tbf: Include TBF state in tbf_name outputDaniel Willmann1-3/+3
Sponsored-by: On-Waves ehf
2014-08-15TbfTest: Make logging more verboseDaniel Willmann2-1/+40
Sponsored-by: On-Waves ehf
2014-08-07tbf, ...: Make the fields in the dl/ul struct member variablesDaniel Willmann1-2/+2
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-07tests/alloc: Use the specific UL/DL TBF classes instead of the baseDaniel Willmann1-2/+4
Ticket: SYS#389 Sponsored by: On-Waves ehf
2014-07-22bts, tbf: Split alloc_tbf function into separate UL and DL versionsDaniel Willmann2-14/+25
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-03bts, tbf: Separate functions for dl/ul tbf_by_tlli lookupDaniel Willmann1-6/+6
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-01-15rlc: Use an enum for the state array instead of charsDaniel Willmann1-3/+3
gprs_rlc_bsn_state is now used to hold the ACK state of sent/received rlc packets.