aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2016-02-01pcu: Fix memory corruption bugs (ASAN)Jacob Erlbeck4-8/+25
ASAN has found improper deletion of objects. These only occur on shutdown but makes it impossible to run the test cases with full ASAN support. This commit fixes some of them and deactivates the freeing of the_pcu.bctx which may cause a corruption in BTS::~BTS() later on. Note that the latter is only a work-aound and should be fixed properly. It will leak bctx objects, but this is currently not critical, since gprs_bssgp_destroy is only called once, immediately before a call to exit(). Ticket: OW#1572 Sponsored-by: On-Waves ehf
2016-01-08edge: Remove leftover comments from encoding.cJacob Erlbeck1-8/+0
Sponsored-by: On-Waves ehf
2016-01-08edge: Fix data block decoder (Coverity)Jacob Erlbeck1-1/+7
Use a signed integer instead of an unsigned one for num_chunks which can set to a negative value on error. Ensure that chunks is not dereferenced if it is NULL. In fact that will not happen currently, since num_chunks is now always <= 0 if chunks == NULL. Fixes: Coverity CID 1347433, 1347434, 1347435 Sponsored-by: On-Waves ehf
2015-12-16sched: Change next_ctrl_prio incrementJacob Erlbeck1-1/+1
Currently the control block scheduler does not seem to be fair in all cases. At least it happend while testing the EGPRS code, that a Uplink Ack/Nack message got never be sent, because a Downlink assignment took over all the times. This commit changes the round robin code to always increment the priority offset by 1 instead of (i + 1). The former definitely ensures that every message type gets the highest priority after some steps. The latter might be more fair in some situations, but that and its correctness are not proven. Sponsored-by: On-Waves ehf
2015-12-16edge: Remove unused GPRS functionsJacob Erlbeck4-329/+0
This commit removes the code that is no longer used due to the commit "Use a single PDCH rcv_data_block method for GPRS and EGPRS". Sponsored-by: On-Waves ehf
2015-12-16edge: Use a single PDCH rcv_data_block method for GPRS and EGPRSJacob Erlbeck2-16/+19
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-16edge: Implement gprs_rlcmac_pdch::rcv_block_egprsJacob Erlbeck1-5/+34
This commit replaces the stub by a method that decodes the block first, and passes it to the TBF object associated with the TFI. Sponsored-by: On-Waves ehf
2015-12-16edge: Add methods for unified GPRS/EGPRS UL data block handlingJacob Erlbeck3-2/+275
The current rcv_data_block_acknowledged_gprs method is tightly coupled to GPRS. This commit adds variants of the involved methods that support EGPRS and GPRS RLC encodings likewise. Sponsored-by: On-Waves ehf
2015-12-16tbf: Refactor parts of extract_tlli into set_tlli_from_ulJacob Erlbeck2-20/+29
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-16edge: Store GprsCodingScheme in gprs_rlc_dataJacob Erlbeck2-19/+13
Currently the coding scene is stored as number N, where there scheme is CS-N. This commit replaces this by a GprsCodingScheme type cs value. The gprs_rlcmac_cs table is no longer needed and thus removed. Sponsored-by: On-Waves ehf
2015-12-16edge: Add is_received and invalidate_bsn to gprs_rlc_ul_windowJacob Erlbeck2-0/+18
These methods will be needed for EGPRS decoding. The is_received method returns true iff a block with the given BSN has already been received in the current window. A call to invalidate_bsn marks the block as not received. Sponsored-by: On-Waves ehf
2015-12-16rlc: Do not raise_v_q in receive_bsnJacob Erlbeck3-4/+4
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 unified decoder methods for GPRS/EGPRSJacob Erlbeck4-0/+492
This commit adds new RLC block decoder functions that support both GPRS and EGPRS. The code path is selected based on the value of the GprsCodingScheme cs object. - rlc_parse_ul_data_header parses the header of an RLC data block including the E and FBI/TI flags (currently supported CS-1 - CS-4, MCS-1 - MCS-4). - rlc_copy_to_aligned_buffer copies an RLC data unit to a byte aligned buffer and returns the unit's length. - rlc_get_data_aligned is a convenience wrapper around rlc_copy_to_aligned_buffer that avoids copying if the data unit is already byte aligned. Sponsored-by: On-Waves ehf
2015-12-15edge: Add information about data blocks to GprsCodingSchemeJacob Erlbeck2-18/+32
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-15rlc: Check endianness for bit field declarationsJacob Erlbeck1-0/+6
Currently the declarations of rlc_ul_header, rlc_dl_header, and rlc_li_field silently assume that a gcc for a little endian platform is being used. This commit adds '#if OSMO_IS_LITTLE_ENDIAN' the ensure the correct byte ordering. Sponsored-by: On-Waves ehf
2015-12-15edge: Add header type property to GprsCodingSchemeJacob Erlbeck2-16/+38
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: Rename rcv_data_block_acknowledgedJacob Erlbeck4-6/+6
This commit renames rcv_data_block_acknowledged to rcv_data_block_acknowledged_gprs to separate it from EGPRS data block decoding. Sponsored-by: On-Waves ehf
2015-12-15edge: Add gprs_rlcmac_pdch::rcv_block_egprs stubJacob Erlbeck2-0/+30
This stub function gets called when an EGPRS data package arrives. Sponsored-by: On-Waves ehf
2015-12-15edge: Use GprsCodingScheme to adjust the UL RLC block sizeJacob Erlbeck2-22/+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 GprsCodingScheme classJacob Erlbeck3-2/+237
Currently the coding scheme is checked and compared at different places which makes in cumbersome to extend it for EGPRS. This class encapsules the coding scheme and provides required meta information like sizes as well as helper methods. Sponsored-by: On-Waves ehf
2015-12-15edge: Extend gprs_rlcmac_dl_tbf::handle by egprs_ms_classJacob Erlbeck3-4/+9
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: Enable EGPRS if configured and egprs_ms_class presentJacob Erlbeck2-2/+11
Enable the TBF to use EGPRS if the bts->egprs_enabled config variable has been set via the VTY "egprs" command and if the MS has signaled a EGPRS multislot class. Tell the MS to use EGPRS if the condition above holds. Note that this will cause the MS to use EGPRS RLC block formats for further messages which are not yet understood by the PCU. Sponsored-by: On-Waves ehf
2015-12-15edge: Support EGPRS multislot class handling in tbf_allocJacob Erlbeck5-23/+28
Add an egprs_ms_class argument to the allocation functions and set/pass it where necessary. Sponsored-by: On-Waves ehf
2015-12-15edge: Add m_egprs_enabled and related methods to TBFJacob Erlbeck2-3/+27
Add the following methods to gprs_rlcmac_tbf: - is_egprs_enabled - enable_egprs - disable_egprs Also show the value of the flag in name() by displaying "EGPRS" if it is set. Sponsored-by: On-Waves ehf
2015-11-30edge: Support EGPRS in packet uplink assignment messageJacob Erlbeck3-13/+39
Currently the Encoding::write_packet_uplink_assignment method only supports the GPRS variant of the message. This commit adds the missing EGPRS variant to the encoder. Sponsored-by: On-Waves ehf
2015-11-30edge: Add egprs config commandJacob Erlbeck2-0/+37
Add a global config flag to enable the use EDGE/EGPRS. The following VTY commands are added to node config-pcu: - egprs Enables EGPRS - no egprs Disable EGPRS Note that enabling EGPRS is experimental and will most likely break packet transmission until a minimal required set of EGPRS functionality is implemented. Sponsored-by: On-Waves ehf
2015-11-30edge: Get EGPRS multislot classJacob Erlbeck6-2/+54
The EGPRS MS class ist contained in the MS_RA_capability information. Its presence indicates, that the MS is able (and willing) to use EGPRS. This commit implements basic support for retrieving, storing, and showing it in the VTY. The information is stored in the MS object. Sponsored-by: On-Waves ehf
2015-11-30pcu: Enable dl-tbf-idle-time and idle-ack-delay by defaultJacob Erlbeck1-0/+2
Currently these are enabled in the default config file. Since CoDel is enabled by default in main() but should not be used without at least dl-tbf-idle-time, the current default config may lead to packet loss and performance problems. This commit enables both features to provide a good (GPRS) performance experience even without a configuration. Sponsored-by: On-Waves ehf
2015-11-30stat: Add global stat groupJacob Erlbeck3-0/+46
Add a global stat_item group for measurement values and a corresponding macro to get and set the values. Add a stat_item STAT_MS_PRESET to monitor the number of MS objects in the storage. Sponsored-by: On-Waves ehf
2015-11-27encoder: Whitespace fixesJacob Erlbeck1-4/+4
Sponsored-by: On-Waves ehf
2015-11-17stats: Enable stats subsystemJacob Erlbeck2-0/+4
Sponsored-by: On-Waves ehf
2015-11-13remove obsolete OpenBTS PCU interface supportHarald Welte2-200/+1
This OpenBTS socket interface was originally added to enable GPRS capabilitie with a forked version of OpenBTS, at a time when the public OpenBTS release didn't yet have any GPRS support. Meanwhile, the later OpenBTS releases included their own version of GPRS, without any external PCU/SGSN/GGSN, so this interface is no longer needed. This also means that the OsmoBTS socket interface is now the default at compilation time. There is no other interface.
2015-11-12osmobts_sock.cpp: Add missing space in log statement.Harald Welte1-1/+1
2015-11-12print/log OpenBTS / OsmoBTS variant in PCU startupHarald Welte2-0/+4
Otherwise it can be very confusing, as Max had to figure out today...
2015-11-12rename sysmo_sock.cpp to osmobts_sock.cppHarald Welte2-8/+8
This also renames the --enable-sysmbts option to --enable-osmobts This socket interface was nevery sysmoBTS specific, but it is a generic socket interface to any OsmoBTS supported layer1/hardware. So it was a mis-nomer so far.
2015-11-07stats: Include the header file for the new class identifierHolger Hans Peter Freyther1-0/+1
2015-11-07stats: Attempt to compile fix the new rate_ctrHolger Hans Peter Freyther1-0/+1
We wanted to support gcc-4.2 and this didn't allow us to use the C99 initializers inside C++ code. Attempt to initialize the class_id correctly.
2015-09-11bssgp: Use measured leak rate for flow controlJacob Erlbeck5-6/+104
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-07poll: Count failed proceduresJacob Erlbeck3-0/+11
When a timeout has occured several times, the procedures handled by poll_timeout are aborted. This happens when the number of repetitions exceed N3105. Currently only the timeouts themselves are counted. This commits adds counters that are incremented if a procedure has really failed. New counter: - rlc.ass.failed: Count failing UL and DL assigments via PACCH - rlc.ack.failed: Count failing DL Ack/Nack requests Sponsored-by: On-Waves ehf
2015-09-01bts: Start a DL TBF if needed after establishment of an UL TBFJacob Erlbeck2-0/+15
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-3/+9
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 Erlbeck3-35/+47
Currently reuse_tbf (partly) resets the old DL TBF and uses its PACCH to establish a new DL TBF. The method can not be used with UL TBFs. This commit replaces the reuse_tbf method into a gprs_rlcmac_dl_tbf:release method which triggers the TBF's timer based deletion (so that the TFI is still reserved for some time) and a gprs_rlcmac_tbf::establish_dl_tbf_on_pacch which can establish DL TBFs on existing PACCHs of either DL or UL TBFs. Sponsored-by: On-Waves ehf
2015-09-01tbf: Keep the old MS object alive in extract_tlliJacob Erlbeck1-1/+3
Currently when a second MS object has been created for an MS, because the TLLI was not known yet, the will be detected in gprs_rlcmac_tbf::extract_tlli and the two objects will be merged by update_ms. But when the dl_tbf is moved from the old to the new (second) MS object, the old MS object can get idle and be removed before the object are merged. This can cause LLC frame loss when the MS object is deleted immediately after getting idle (no timeout configured). This commit adds a guard to keep the MS object until extract_tlli has been executed. Sponsored-by: On-Waves ehf
2015-09-01Revert "tbf: Do not kill DL TBF on Packet Resource Request"Jacob Erlbeck2-8/+9
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 Erlbeck5-9/+25
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: Count unexpected block FN valuesJacob Erlbeck2-1/+7
Currently a log entry is written if FN_data_ind - FN_time_ind <= -13. This commit adds a counter 'rlc.late-block' that is incremented in these cases. Sponsored-by: On-Waves ehf
2015-08-28poll: Use the data_ind FN as time source for current frameJacob Erlbeck2-0/+37
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-28poll: Set the max_delay to 60 framesJacob Erlbeck1-2/+5
Currently the max_delay parameter is set to 13, since that is slightly above maximum number of frames that a time_ind can preceed a block's data_ind of the same frame. This assumes that these messages are not reordered after thay have been obtained from the DSP. In the current implementation, the GPRS data_ind can directly be taken from the DSP by the PCU while the time_ind messages are provided via the BTS. So the messages are queued differently in that case, resulting in a additional delay of the data_ind with respect to the time_ind. The propability for this raises with a increased CPU load of the PCU. If this happens, a poll timeout is detected by mistake and the poll is either retried or cleared. This commit increases the tolerance to 60 frames, since values for FN_data_ind - FN_time_ind of up to 50 frames have been observed under heavy PCU load. Sponsored-by: On-Waves ehf
2015-08-28poll: Add a max_delay parameter to PollController::expireTimedoutJacob Erlbeck3-13/+15
Currently the maximum additional delay is hard coded to 13. This value depends on the source of the frame number value. This commit adds the max_delay parameter to make it caller dependant. Sponsored-by: On-Waves ehf
2015-08-28tbf: Add logging for pollingJacob Erlbeck2-2/+12
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