path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2016-02-08edge: Make window size configurableJacob Erlbeck3-0/+133
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, 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: Disable GPRS/EGPRS mixed modeJacob Erlbeck3-0/+38
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-08edge: Call update_window even if FINAL_ACK_INDICATION is setJacob Erlbeck1-0/+31
The bitvec RBB is always valid, even when FINAL_ACK_INDICATION is set. This is done by the ack/nack decoder function which fake a bitmap starting with V(A) up to V(S)-1 in that case (see Decoding::handle_final_ack). Call gprs_rlcmac_dl_tbf::update_window unconditionally and only use is_final for logging and TBF state changes in gprs_rlcmac_dl_tbf::rcvd_dl_ack. Sponsored-by: On-Waves ehf
2016-02-08tbf: Use bitvec based window methods for GPRSJacob Erlbeck3-3/+57
Currently the old fixed 64 bit RBB based implementation is used for GPRS. Use the new bitvec based methods instead. Sponsored-by: On-Waves ehf
2016-02-05edge: Support MCS data block encodingJacob Erlbeck1-0/+243
Currently only GPRS data block encoding is supported. This commit adds rlc_data_to_dl_append_egprs which does the EGPRS specific extension and chunk handling. It extends Encoding::rlc_data_to_dl_append to use that function for MCS coding schemes. Sponsored-by: On-Waves ehf
2016-02-05edge: Select implementation by mode in rlc_data_to_dl_appendJacob Erlbeck1-13/+13
Currently the GPRS data block encoding is applied to every coding scheme, even if an MCS is selected. This commit renames the actual encoding function to rlc_data_to_dl_append_gprs (not exported) and puts selection code into Encoding::rlc_data_to_dl_append. This requires an additional cs argument. Sponsored-by: On-Waves ehf
2016-02-05edge: Use rlc_data_to_dl_append in create_new_bsnJacob Erlbeck1-14/+14
Currently TBF related tasks (status changes, counter updates, LLC dummy command insertion) as well as RLC data block generation are done within create_new_bsn. The data block creation part has already been copied to the stateless Encoding::rlc_data_to_dl_append function. This commit changes create_new_bsn to use the encoder function and just care about the TBF related stuff. Since the rlc_data_to_dl_append function has been validated against the test cases being described in annex B of TS 44.060, this commit fixes an encoder bug which leads to broken LLC frames in a special case (see example B.2, the main header's E bit was erroneously set to 1 in that case). When this happens, the LLC frame will get discarded after reassembly, so that TCP will have to retransmit the lost packet. Sponsored-by: On-Waves ehf
2016-02-05edge: Add Encoding::rlc_data_to_dl_appendJacob Erlbeck2-0/+253
This function appends a single chunk to an RLC downlink data block. The implementation is basically taken from the gprs_rlcmac_dl_tbf::create_new_bsn method without the TBF related functionality and any side effects. Note that it still only supports GRPS. Sponsored-by: On-Waves ehf
2016-02-05edge: Use RLC data block encoding functionsJacob Erlbeck1-71/+142
This commit removes the use of struct rlc_dl_header from gprs_rlcmac_dl_tbf::create_dl_acked_block and gprs_rlcmac_dl_tbf::create_new_bsn. Instead of patching the data area directly, the RLC block encoding functions are used. Note that the data unit encoding is still hard-coded to GPRS in create_new_bsn, so using MCS 1-4 (albeit being supported by the encoder) will not work yet. Sponsored-by: On-Waves ehf
2016-02-05tbf/test: Add missing function name printfsJacob Erlbeck2-0/+14
Some test function don't have the "=== start/end ===" printfs. Sponsored-by: On-Waves ehf
2016-02-05edge: Add encoder for downlink RLC data blocksJacob Erlbeck1-0/+70
Currently the (GPRS) RLC block encoding is done by setting the header fields directly in gprs_rlcmac_dl_tbf::create_new_bsn. This is much more complex with EGPRS, since the data fields are not byte aligned, the header formats depend on the header type, and the mapping of bits to bytes is LSB first. This commit adds Encoding::rlc_write_dl_data_header which writes the header according to the given gprs_rlc_data_header structure. Encoding::rlc_copy_from_aligned_buffer is also added to copy byte sequences into the message. Note that the actual encoding of data units is not yet present. Sponsored-by: On-Waves ehf
2016-02-05edge: Add init functions for gprs_rlc_data_infoJacob Erlbeck2-0/+20
Add the functions gprs_rlc_data_info_init_dl/ul which initialise a gprs_rlc_data_info structure depending on the coding scheme. The fields num_data_blocks, data_offs_bits, cs, and the data_blocks are valid after this call. The other fields are set to 0. The data blocks are initialised to the correct data_len, e == 1 (no extension header field), cv == 15 (not a final block). The other data block fields are set to 0. The gprs_rlc_data_block_info can also be initialised separately by using the gprs_rlc_data_block_info_init function. Sponsored-by: On-Waves ehf
2016-02-05edge: Fix RLC message sizeJacob Erlbeck1-4/+4
Currently the RLC message length that is obtained from the DSP is reduced by 1 if the last byte of the buffer includes spare bits. While this worked well with GPRS, these bits are being used to encode RLC blocks in EGPRS mode. Thus this last byte must not be chopped off. The functionality of the code is not affected by this, since the modified length value is not used. This commit adds GprsCodingScheme::usedSizeDL/UL to return the number of bytes needed to encode the message block. If there are single bits at the end that are to be used (EGPRS), the functions return the number of full bytes plus 1 (which is the buffer size reported by the DSP and returned by sizeUL/sizeDL). The commit also removes the len parameter from rcv_data_block_acknowledged. Sponsored-by: On-Waves ehf
2016-02-05edge: Rename gprs_rlc_ul_header_egprs and gprs_rlc_ul_data_block_infoJacob Erlbeck1-1/+1
These struct names are more specific than necessary. They are used for GPRS (uplink) already. In downlink direction, only a few fields will be added to the header struct. Add addition, gprs_rlc_ul_header_egprs does not map directly to an encoded header, like many other 'header' structs do. Change the names to fit both modes and both directions: gprs_rlc_ul_header_egprs -> gprs_rlc_data_info gprs_rlc_ul_data_block_info -> gprs_rlc_data_block_info Sponsored-by: On-Waves ehf
2016-02-05edge: Enable EGPRS in downlink TBFsJacob Erlbeck1-51/+51
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: Replace integer cs by GprsCodingSchemeJacob Erlbeck2-72/+72
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-01edge: Add methods and operators to GprsCodingSchemeJacob Erlbeck1-3/+4
Add a few new operators and methods to support the use of GprsCodingScheme instead of the plain integer currently used. Sponsored-by: On-Waves ehf
2016-02-01tbf: Use LListHead instead of llist_podsJacob Erlbeck1-6/+6
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-01edge/test: Rename test_rlc_decoder to test_rlc_unit_decoderJacob Erlbeck2-4/+4
This test only covers RLC data units and not whole RLC messages. Sponsored-by: On-Waves ehf
2016-02-01rlc: Add constructor to window classesJacob Erlbeck1-3/+3
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
2016-02-01rlc: Dump RLC data for debuggingJacob Erlbeck1-0/+18
Log incoming RLC data messages and RLC data units to LOGL_DEBUG. Sponsored-by: On-Waves ehf
2015-12-16edge: Use a single PDCH rcv_data_block method for GPRS and EGPRSJacob Erlbeck1-37/+44
Currently GPRS is handled by the old code path while EGPRS already uses the unified functions. The rcv_block_egprs is basically not specific to EGPRS and just needs minor modifications to handle GPRS. This commit turns gprs_rlcmac_pdch::rcv_block_egprs into a unified rcv_data_block method and uses it for GPRS, too. Note that the logging messages of the new parser are different. Sponsored-by: On-Waves ehf
2015-12-16tbf: Refactor parts of extract_tlli into set_tlli_from_ulJacob Erlbeck1-2/+2
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-16rlc: Do not raise_v_q in receive_bsnJacob Erlbeck1-8/+17
Currently gprs_rlc_ul_window::receive_bsn calls raise_v_q and returns the number of RLC data blocks that can be taken from the queue. This does not fit the EGPRS feature to put 2 independant data blocks in a single RLC block. This commit removes raise_v_q from receive_bsn, hence it must be called explicitely to get the number of processable data blocks. Sponsored-by: On-Waves ehf
2015-12-16edge: Add test cases for rlc_data_from_ul_dataJacob Erlbeck2-0/+314
This checks the example test cases given in appendix B of TS 44.060. Sponsored-by: On-Waves ehf
2015-12-15edge: Add information about data blocks to GprsCodingSchemeJacob Erlbeck1-0/+4
This commit adds the methods maxDataBlockBytes and numDataBlocks which provide information about the data areas within RLC messages. In these areas, the extension bytes, TLLI, and the LLC data are stored. Sponsored-by: On-Waves ehf
2015-12-15edge: Add header type property to GprsCodingSchemeJacob Erlbeck1-0/+6
The header type depends on the coding scheme, for GPRS there is a single data header type per direction, for EGPRS there are 3 per direction. In addition, control block header types are used with CS-1 only, so there is one of the per direction altogether for GRPS and EGPRS. This commit adds the header type enum and two methods headerTypeData and headerTypeControl. Sponsored-by: On-Waves ehf
2015-12-15edge: Use GprsCodingScheme to adjust the UL RLC block sizeJacob Erlbeck1-0/+27
Currently the block size is mapped by a switch statement to strip extra bits that are not used for RLC blocks. That information is already available via the GprsCodingScheme class. This commit moves the CS/MCS detection to the rcv_block message and passes the cs object via rcv_block_gprs, where the length gets adjusted, to gprs_rlcmac_pdch::rcv_data_block_acknowledged. There the switch statement is removed. Note that the TbfTest.err changes due to an additional log message. Sponsored-by: On-Waves ehf
2015-12-15edge: Add test for GprsCodingSchemeJacob Erlbeck4-2/+240
This test checks constructors, predicates, and operators of the GprsCodingScheme class. Sponsored-by: On-Waves ehf
2015-12-15edge: Extend gprs_rlcmac_dl_tbf::handle by egprs_ms_classJacob Erlbeck1-5/+5
The multislot (MS) class and the EGPRS MS class can also be passed via BSSGP in an MS Radio Access Capability element which can optionally be contained in a DL-UNITDATA PDU. While this case is fully supported for GPRS, the EGPRS MS class in BSSGP messages is ignored. This commit extends gprs_rlcmac_dl_tbf::handle to pass the EGPRS MS class, too. Note, that the EGPRS class is not yet taken from the CSN.1 RA capability and is always set to 0. Note also, that append_data still uses ms_class only. Sponsored-by: On-Waves ehf
2015-12-15edge: Support EGPRS multislot class handling in tbf_allocJacob Erlbeck3-30/+32
Add an egprs_ms_class argument to the allocation functions and set/pass it where necessary. Sponsored-by: On-Waves ehf
2015-09-11bssgp: Use measured leak rate for flow controlJacob Erlbeck1-0/+2
The leak rate sent to the SGSN does not reflect the current CS level, lost frames, and control message overhead. So the SGSN cannot do proper queue control under non-optimal conditions. This commit computes the leak rate for the last flow control interval by computing the maximum theoretical leak rate and basically substracting control blocks, nacked blocks, and reduced block sizes due to CS downgrade. By using this approach, the value will by more stable on low load, where the value will tend to be near the value derived from the configuration. On full load the transmitted value is completely derived from the measurements. Note that the MS default values are no adapted to the adapted BVC leak rate, since a single MS which has a lower link quality would otherwise be reducing the rate of another MS with good radio conditions, which would not make much sense if they did not share any PDCH. Sponsored-by: On-Waves ehf
2015-09-01bts: Start a DL TBF if needed after establishment of an UL TBFJacob Erlbeck2-3/+21
Currently an existing DL TBF can get lost in the process of establishing an UL TBF via RACH. This can lead to stalled connections until the network sends more LLC frames. This commit adds a check for a non-empty LLC queue after the UL TBF has been established to rcv_control_ack (GPRS_RLCMAC_UL_ASS_WAIT_ACK path) to eventually establish a new DL TBF on the UL TBF's PACCH. Sponsored-by: On-Waves ehf
2015-09-01bts: Release DL TBF instead of killing in rcv_resource_requestJacob Erlbeck1-6/+3
Currently an existing DL TBF is freed immediately, when a resource request is received. This makes sense since the MS might have dropped it when switching to the PDCH signaled via the AGCH for the SBA. But if the TBF still is assumed to exist on the MS side, there might be TFI collisions if the old TBF object is not kept to block its TFI for some time. This commit changes rcv_resource_request to call release() instead of tbf_free() on the DL TBF object (if it exists). Sponsored-by: On-Waves ehf
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