aboutsummaryrefslogtreecommitdiffstats
path: root/src/bts.h
AgeCommit message (Collapse)AuthorFilesLines
2015-07-21llc: Use CoDel to drop packages from the LLC queueJacob Erlbeck1-0/+4
Currently packets are only dropped if they have reached their maximum life time. This leads to LLC queues being constantly filled under load, increasing the latency up to the maximum life time. This kind of bufferbloat hinders TCP's congestion avoidance algorithms. To keep the queues short, the CoDel active queue management algorithm can be used. This commit changes to llc_dequeue method to apply the CoDel algorithm to selectively drop LLC frames before they passed to the TBF layer to be encoded in BSNs. This feature is currently disabled by default. The CoDel state is managed per MS since the LLC queues are also kept in the MS objects. Note that there is still some buffering in the TBF objects, in the worst case (CS4) 3.5kByte + LLC-MTU octets are stored there. The resulting additional packet delay is not (yet) taken into account for CoDel. Also note that configuration changes are applied to new MS objects only. The following VTY commands are added to the 'pcu' node: - queue codel activates CoDel, the interval is selected by the implementation - queue codel interval <1-1000> activates CoDel with a fixed interval given in centiseconds (10ms-10s) - no queue codel deactivates CoDel Which interval value to use is still an open issue. For high speed links (e.g. Ethernet), CoDel suggests 100ms. For slower links, the expected RTT is recommended. The current implementation uses a default value of 2000ms. Measurements: Note that the following measurements depend on several other factors, most notably the interaction with the SGSN's flow control. They are just examples to give an idea how CoDel might influence some parameters. The measurements have been done with a single E71, first with a running ping only (Idle), then with an additional TCP download of a 360k file (Busy). The CoDel interval was set to 1s. - Idle : ping ~400ms, avg queue delay 0ms, dropped 0 - Busy, No CoDel: ping ~6s, avg queue delay 4-6s, dropped 0, scheduled 948, duration 54s - Busy, CoDel: ping 500-1500ms, avg queue delay ~600ms, dropped 77, scheduled 1040, duration 60s More measurements with two MS downloading in parallel (two independant measurements per case). - Busy, No CoDel: dropped 0, scheduled 1883, duration 121s dropped 19, scheduled 2003, duration 133s - Busy, CoDel: dropped 22, scheduled 1926, duration 116s dropped 22, scheduled 1955, duration 108s Sponsored-by: On-Waves ehf
2015-07-16alloc: Make alloc_algorithm_dynamic statefulJacob Erlbeck1-0/+2
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: Add counters for successful algo A/B allocationsJacob Erlbeck1-0/+6
This adds counters for algorithm A and B with count successful allocation combined for UL and DL. Ticket: #1934 Sponsored-by: On-Waves ehf
2015-07-16tbf: Put the TFI->TBF mapping into the PDCH objectsJacob Erlbeck1-5/+5
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-16tbf: Move TFI selection into alloc_algorithmJacob Erlbeck1-1/+2
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 Erlbeck1-4/+5
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-07tbf: Keep a set of used TFI and USF per PDCHJacob Erlbeck1-0/+15
Currently is is rather expensive to get TFI and USF usage per PDCH, because the TBFs need to be scanned to get that information. This commit adds corresponding bit sets which get updated by the attach_tbf/detach_tbf methods of the gprs_rlcmac_pdch class. Sponsored-by: On-Waves ehf
2015-07-07tbf: Add Poll Timeout countersJacob Erlbeck1-0/+9
This commits adds three poll timeout counters - RLC Assign Timeout - RLC Ack Timeout - RLC Release Timeout to help diagnosing to cause for these events. There seems to be an increased rate of these when a PDCH is shared by multiple TBFs. Sponsored-by: On-Waves ehf
2015-07-03ms: Add support for slot reservationJacob Erlbeck1-0/+16
In contrast to the slots currently used by existing TBFs, the reserved slots refer to the time slots that can be used for newly allocated TBFs without causing conflicts (given that the first common TS does not change). They correspond to the potential use of the PDCHs and can be used to achieve a more uniform slot allocation. This commit adds bit set based methods to GprsMs and gprs_rlcmac_trx and a counter to gprs_rlcmac_pdch. The current TRX will also be stored in the MS object. Sponsored-by: On-Waves ehf
2015-07-03tbf: Maintain the number of TBF per PDCHJacob Erlbeck1-0/+12
Currently the PDCH object do not know anything about the TBFs using them. To make the slot allocation load dependant, at least some numbers are required. This commit adds TBF counters (one per direction) and the related methods attach_tbf, detach_tbf, and num_tbfs to gprs_rlcmac_pdch. Sponsored-by: On-Waves ehf
2015-06-29tbf: Add BTS::ms_alloc methodJacob Erlbeck1-0/+1
Currently the code that creates the MS objects with tbf.cpp is duplicated. This commit moves the corresponding code into a new method. Since there is no TLLI available there, the GprsMsStorage::create_ms method has been refactored into two variants: one with TLLI/direction and one without. Sponsored-by: On-Waves ehf
2015-06-29tbf: Pass the MS object around instead of old_tbfJacob Erlbeck1-1/+2
Currently the old TBF (either uplink or downlink) is passed around at TBF allocation mainly to get information about the MS. To implement more complex allocation algorithms, the MS object itself will be needed anyway. This commit replaces the old_tbf arguments by MS object arguments. Sponsored-by: On-Waves ehf
2015-06-22ms: Reduce DL CS level if only a few LLC bytes are leftJacob Erlbeck1-0/+1
If just a few bytes are left to send to the MS, it makes sense to reduce the coding scheme level to increase the throughput. This has been shown by Chen and Goodman in their paper "Theoretical Analysis of GPRS Throughput and Delay". See their throughput over C/I measurement graphs (figures 4 and 5 in the paper) for details. This commit implements a simplified CS downgrade feature for the downlink. The coding scheme will be downgraded if there are only a few octets are left to be send over the TBF (see the downgrade-threshold command below) and the NACK rate is not low (the CS will not get degraded on a high quality RF link). As an exception, CS-3 will be degraded to CS-1, since CS-2 does not improve the throughput in general when a few small packets are sent and the signal fades slowly (see Chen/Goodman). The following VTY command is added to the config-pcu node: - cs downgrade-threshold <1-10000> - cs no downgrade-threshold to set the threshold of the number of remaining bytes to be RLC/MAC encoded. The CS will only be reduced, if the number is below the threshold. The 'no' command disables this feature completely. The default value is 200 octets. Sponsored-by: On-Waves ehf
2015-06-22ms: Add UL CS selection based on L1 link qualityJacob Erlbeck1-0/+1
Currently the UL CS values are set to the corresponding DL CS value, eventually limited by a maximum value. This approach does not reflect the general situation of the RF link between ME and BTS, which is rather asymmetric e.g. due to a lower degree of TX efficiency of the built-in antenna. This means, that UL and DL CS control should be decoupled for better results. This commit adds automatic UL CS selection based on the link quality measurement parameter. Each coding scheme is mapped to a link quality range. If the link quality value leaves that range, the current UL CS value is increased/decreased accordingly. This value will be copied when the next PACKET_UPLINK_ACK_NACK or PACKET_UPLINK_ASSIGMENT is sent to the MS. The following VTY command will be added to the config-pcu node: - cs link-quality-ranges cs1 <0-35> cs2 <0-35> <0-35> cs3 <0-35> <0-35> cs4 <0-35> which sets the ranges for the four coding schemes. For instance the example below reflects the current default values: cs link-quality-ranges cs1 6 cs2 5 8 cs3 7 13 cs4 12 set the following ranges, where the overlapping is used to configure a hysteresis: CS1: -inf .. 6 CS2: 5 .. 8 CS3: 7 .. 13 CS4: 12 .. inf Sponsored-by: On-Waves ehf
2015-06-22l1: Pass all L1 measurements upwardsJacob Erlbeck1-2/+4
Currently only the RSSI value is passed to the upper layers. Other values like TA and BER which are needed for TA update respectively CS selection are not propagated. This commit introduces and passes a struct that contains a set of measurement values. Sponsored-by: On-Waves ehf
2015-06-08ms: Add support for maximum CS valuesJacob Erlbeck1-0/+1
Currently the CS values can be increased to CS4 even when the "cs" configuration command has been used with a lower value. The "cs" command just sets the initial coding scheme, so other means are needed to limit the selection. One approach is to use the CS flags passed in SI, but these are currently ignored. To make it possible to limit the CS selection by configuring the PCU, this commit adds the following VTY commands to config-pcu: - cs max <1-4> Limit DL and UL CS to the given value - cs max <1-4> <1-4> Limit DL and UL CS separately (DL first) - no cs max Don't limit Ticket: #1674 Sponsored-by: On-Waves ehf
2015-06-08tbf: Add adaptive DL CS adjustmentJacob Erlbeck1-0/+3
To cope with transmission failures due to bad radio conditions, a different coding scheme with more redundance can be used. This commit adds an implemenation that is based on the Ack/Nack ratio per PACKET DOWNLINK ACK/NACK message received from the MS. Basically the CS level is decreased, if the block error rate goes above cs_adj_upper_limit (default 33%), and it is increased, if the rate drops below cs_adj_lower_limit (default 10%). Only blocks that have been encoded with the current CS are taken into account. Note that this approach doesn't measure the MS->BTS conditions and that the measurement values reported by the MS are not taken into account. Ticket: #1739 Sponsored-by: On-Waves ehf
2015-05-28tbf: Set MS timeoutJacob Erlbeck1-0/+1
This commit sets the MS timeout when the MS object is created. The value is taken from the ms_idle_sec field in gprs_rlcmac_bts which can be changed by the VTY commands shown below. The following VTY commands are added to the config-pcu node: - ms-idle-time <1-7200> Set the timeout in seconds - no ms-idle-time Disable the timeout Another timer that is related is T3314 (Ready Timer, default 44s, GSM 24.008, 11.2.2) which requires the SGSN to use paging after its expiry. Longer timeouts can help if adaptive coding scheme selection is used (not yet implemented). On the other hand, measurement values (TA, signal quality) can get invalid after some time, especially with a moving MS. So a value slightly above T3314 is probably a good value to start with. Sponsored-by: On-Waves ehf
2015-05-28tbf: Remove TimingAdvance storageJacob Erlbeck1-8/+0
Currently the TA storage stores up to 30 TLLI->TA mappings, if more entries are created the oldest one is dropped. In theory this can lead to missing TA information if many MS are present. This commit removes the TimingAdvance class completely, since the TA value is now stored in the GprsMs objects. Note that the GprsMs objects are currently not kept after the TBFs have detached from them, so the TA values are now kept for a shorter time than before. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-28tbf: Remove IMSI handling from trigger_dl_assJacob Erlbeck1-1/+1
Currently the BTS::trigger_dl_ass() method assigns the IMSI to the MS object. This should be (and is already) done earlier where the MS object is retrieved/created. This commit removes the corresponding code along with the 'imsi' parameter from trigger_dl_ass. Sponsored-by: On-Waves ehf
2015-05-27tbf: Remove the TLLI from the TBFsJacob Erlbeck1-3/+0
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-20ms: Integrate the MS storageJacob Erlbeck1-0/+16
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-06bssgp: Add VTY command to Limit the bucket size by timeJacob Erlbeck1-0/+1
Currently the bucket size is by default being computed based on the leak rate and the expected life time of LLC frames. The latter is either taken from 'queue lifetime' (if given) or a fixed value is used. Using 'queue lifetime' has the drawback that it sets a 'hard' limit, since frames will be dropped if they stay in the queue for a longer time. This commit adds a VTY command to specifically set the time used for the computation of the bucket size advertised to the SGSN. It does not affect the PCUs queue handling in any way. If the bucket time is not set (or if the 'no' command has been used), the old behaviour (see above) is applied. The following VTY commands are added (config-pcu node): - flow-control bucket-time <1-65534> Sets the time in centisecs - no flow-control bucket-time Don't use this time Ticket: OW#1432 Sponsored-by: On-Waves ehf
2015-05-06bssgp: Make BVC bucket size / leak rate configurableJacob Erlbeck1-0/+4
Currently the FLOW-CONTROL_BVC message contains fixed values: The tag is 1, the BVC bucket size is 6MB, the BVC bucket leak rate is 820kbit/s, the MS bucket size is 50kB, and the MS leak rate is 50kbit/s. This commit makes the BVC parameters configurable and adds the following VTY commands: - flow-control force-bvc-bucket-size <1-6553500> - no flow-control force-bvc-bucket-size - flow-control force-bvc-leak-rate <1-6553500> - no flow-control force-bvc-leak-rate - flow-control force-ms-bucket-size <1-6553500> - no flow-control force-ms-bucket-size - flow-control force-ms-leak-rate <1-6553500> - no flow-control force-ms-leak-rate The 'no' variants restore the default behaviour. Sponsored-by: On-Waves ehf
2015-04-02tbf: Force ACK after the last DL LCC frame has been receivedJacob Erlbeck1-0/+1
If the protocol layers above LLC (e.g. TCP) need an acknowledgement to continue, it can take up to 400ms (single TS) until the MS is polled for Ack/Nack which it can use to request an uplink TBF quickly. The 400ms result from requesting an DL Ack/Nack every 20 RLC blocks until all pending LLC frames have been sent. Especially TCP's slow start mechanism can lead to a high delay at the start of the connection, since the sender will eventually stop after having sent the first packets (up to 4 (RFC2581) or 10 (RFC6928)). This commit modifies append_data() to (re-)start a timer every time it handles an LLC packet and to request an Ack/Nack every time it expires. So if the server ceases to send IP packets, the MS is polled in the assumption, that the server is waiting for an ACK. The following VTY commands are added (pcu node): - queue idle-ack-delay <1-65535> timeout in centiseconds - no queue idle-ack-delay disable this feature (default) A sensible value is 10 (100ms) that at gave promising results when testing locally. Sponsored-by: On-Waves ehf
2015-04-02tbf: Use a hysteresis when discarding DL LLC framesJacob Erlbeck1-0/+1
Currently single LLC blocks are discarded when the PDU lifetime expires. If an IP packet has been fragmented either on the IP or on the LLC layer and is therefore distributed over several LLC frames, the kept fragments are transmitted and then discarded by the MS because of the missing PDU. This can cause massive IP packet loss when there are many fragmented packets (e.g. when trying 'ping -s1800' or if the GGSN chops downlink IP packets into several SNDCP packets). On the other hand, discarding too many packets might disturb the congestion handling of TCP. Dropping plain TCP ACKs might also hinder flow control and congestion avoidance. This commit adds a hysteresis algorithm to the LLC discard loop. If an LLC message's age reaches the high water mark, further message's with an age above the low water mark are discarded, too. This is aborted, if a GMM, a non-UI, or a small message is detected. In these cases, that message is kept. The following VTY commands are added (pcu config node): - queue hysteresis <1-65535> set the difference between high (lifetime) and low watermark in centiseconds - no queue hysteresis disable this feature (default) Since the SGSN will most probably send all fragments of a single N-PDU without much delay between them, a value slightly above the average transmission delay jitter between SGSN and PCU is probably a sensible value to discard all fragments of a single IP packet. This is an experimental feature that might be replaced by more advanced means of active queue management in the future. Sponsored-by: On-Waves ehf
2015-03-25tbf: Poll MS on idle DL TBFsJacob Erlbeck1-0/+4
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: Implement delayed release of a downlink TBFJacob Erlbeck1-0/+1
Currently a DL TBF is immediately closed, when the LLC queue is drained. This will lead to a new DL assignment if data is received afterwards. In addition, it is not possible to keep the PACCH open to poll the MS for UL establishment requests there. GSM 44.060, 9.3.1a suggests to delay the release of an inactive TBF for some time (max 5s). This commit mainly changes create_new_bsn() to send LLC dummy commands as filler if no LLC data is available until keep_open() returns false. The keep_open() functions returns true unless a configurable time has passed after the LLC data store drained. By default, that time is not set which causes keep_open() to always return false, so that delayed release is effectively disabled. The following VTY commands are added: - dl-tbf-idle-time <1-5000> to set the delay in ms - no dl-tbf-idle-time to disable delayed release Ticket: #556 Sponsored-by: On-Waves ehf
2014-08-07bts: Change parameter in BTS::trigger_dl_ass() to DL TBFDaniel Willmann1-1/+1
This method is always called with a DL TBF as argument so make it clear. Ticket: SYS#389 Sponsored by: On-Waves ehf
2014-07-16bts: Return the special type for {ul,dl}_tbf_by_* functionsDaniel Willmann1-8/+8
Start returning the special type instead of the base gprs_rlcmac_tbf when retrieving a TBF. Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-07-16bts: Ensure tbf direction with OSMO_ASSERT()Daniel Willmann1-1/+2
In the lookup functions make sure that we are actually returning tbfs with the expected direction. Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-07-03bts: Split tbf_by_poll_fn into separate dl and ul functionsDaniel Willmann1-1/+2
rcv_control_dl_ack_nack is only meaningful for dl tbf while rcv_control_ack can be sent in response to a dl or ul tbf. So rcv_control_ack still needs to check for ul and dl tbfs. Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-07-03bts: Separate functions for dl/ul tbf_by_tfi lookupDaniel Willmann1-1/+3
Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-07-03bts, tbf: Separate functions for dl/ul tbf_by_tlli lookupDaniel Willmann1-1/+3
In the future we want to separate ul and dl tbf into different classes that inherit from a common base. Ticket: SYS#389 Sponsored-by: On-Waves ehf
2014-06-04gprs_rlcmac_pdch: Get rid of ul/dl_tbfDaniel Willmann1-2/+1
The current code keeps a reference to all tbfs in the bts and another reference in the pdch. This allows for the possibility of both lists to go out of sync. This patch removes the pdch-specific list of ul and dl tbfs and uses the lists in the bts to lookup tbfs everywhere. Performance for going through the global list is not an issue yet. We can optimize this later and in a better way. Sponsored-by: On-Waves ehf
2014-06-04gprs_rlcmac_pdch: Don't access private membersDaniel Willmann1-0/+3
This patch introduces methods to get ul and dl tbf by tfi and uses them in gprs_rlcmac_sched. Sponsored by: On-Waves ehf
2013-12-25sched: Attempt to improve the fairness and schedule UL/AL ACK/ASSHolger Hans Peter Freyther1-0/+1
It is possible that certain UL ACK messages are not sent when there are many many uplink and downlink assignments. Try to be more fair and schedule them round-robin. This way no starvation should occur.
2013-11-24tbf: Count how often we re-start a BSN in the send routineHolger Hans Peter Freyther1-0/+3
There appears to be a scheduling issue. Even without any NACKs we are re-transmitting a lot of frames. It might be because of this.
2013-11-23rlc: Count nacked frames in the statistics tooHolger Hans Peter Freyther1-0/+3
2013-11-19rlc: Count the window stalls on the RLC levelHolger Hans Peter Freyther1-0/+3
2013-11-13rlc: Count the sent and resent RLC blocksHolger Hans Peter Freyther1-0/+6
2013-11-13bts: Count the number of llc frames that were "scheduled" to be sentHolger Hans Peter Freyther1-4/+7
This does not mean that they have been successfully transferred to the SGSN/MS but at least that they have reached a certain point in the message flow.
2013-11-13tbf: Count how often we re-use a TBF that was already being deactivatedHolger Hans Peter Freyther1-0/+3
2013-10-30bts: Pass the Packet_Control_Acknowledgement_t into the recv methodHolger Hans Peter Freyther1-1/+1
2013-10-30bts: Use Packet_Downlink_Ack_Nack_t as parameterHolger Hans Peter Freyther1-1/+1
2013-10-30bts: Simplify the code and use Packet_Resource_Request_t*Holger Hans Peter Freyther1-1/+1
2013-10-30bts: Work with the Packet_Measurement_Report_tHolger Hans Peter Freyther1-1/+1
2013-10-30bts: Move the MT_PACKET_MEASUREMENT_REPORT handling to a new methodHolger Hans Peter Freyther1-0/+1
2013-10-30bts: Move handling of MT_PACKET_RESOURCE_REQUEST to a methodHolger Hans Peter Freyther1-0/+1
Move the code to a new method
2013-10-30bts: Move handling of MT_PACKET_DOWNLINK_ACK_NACK to separate functionHolger Hans Peter Freyther1-0/+1
Kill the tlli assignment as it is never used.