Commit Graph

17 Commits

Author SHA1 Message Date
Jacob Erlbeck 0c1c8778df tbf: Use a hysteresis when discarding DL LLC frames
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-04-02 12:34:48 +02:00
Jacob Erlbeck 612e93e360 llc: Add put_dummy_frame to create an LLC dummy command
The LLC dummy command is needed for RLC block stuffing, e.g. when a
TBF should be kept open if no LLC data is available. The RLC block
headers do not support stuffing, only the last block of a TBF can be
used partially. LLC dummy commands are discarded by the receiver
immediately, because the have an invalid FCS checksum.

This commit adds the function put_dummy_frame, which puts a LLC dummy
command into the frame buffer. The requested length is given as an
argument, but the real length might be adjusted according to the
specification (see GSM 44.064, 6.4.2.2).

Sponsored-by: On-Waves ehf
2015-03-20 14:12:28 +01:00
Daniel Willmann 9c623892f5 llc: Calculate the average queuing delay of the LLC queues
Use a formula like it is used with TCP. This can help to make
decisions about if frames should be dropped or not at the time
we enqueue them.

This code will store two timeval structs in fron the of the
actual data and compute the average at the time of the dequeue.
2013-12-25 14:55:04 +01:00
Holger Hans Peter Freyther a42b2ad5ed llc: Initialize the LLC frame with garbage to detect wrong usage 2013-12-25 14:27:07 +01:00
Holger Hans Peter Freyther 550bb88a9e llc: Count the number of frames queued inside the LLC queue 2013-12-18 12:11:27 +01:00
Holger Hans Peter Freyther 5a7f636ce4 llc: FIx a typo in the message 2013-11-21 21:59:32 +01:00
Holger Hans Peter Freyther 6058220d2a types: Add a simple testcase for basic types and fix the LLC code
* Make append_data, remaining_space and fits_in_current.. work
  on m_length and not the index. This ways things can't overflow.
* The current API consumer was moving the m_index so it should have
  worked okay.
2013-11-21 21:30:23 +01:00
Holger Hans Peter Freyther b1302b083e llc: Move the decision if a frame has expired into the LLC
This way the generation of the expiry information and the check
is at the same place. This should make reading the code more easy.
2013-11-13 17:16:28 +01:00
Holger Hans Peter Freyther 32f9a59ab4 llc: Make the index 'private' by appending a m_ to it.
At some point in the future we can start using the private/protected
keywords in this struct.
2013-11-13 17:14:42 +01:00
Holger Hans Peter Freyther e23102602c llc: Move some more secrets from the TBF into the LLC
Introduce a method to append data to a TBF and then reset the
read pointer when the frame has been sent.
2013-11-13 17:08:07 +01:00
Holger Hans Peter Freyther b3d5ee2934 bts: Count the number of llc frames that were "scheduled" to be sent
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-13 16:43:26 +01:00
Holger Hans Peter Freyther 51e093bd1c llc: Use timeradd and timercmp and fix for < 1s PDU llc timeouts 2013-11-13 15:35:45 +01:00
Holger Hans Peter Freyther 985fd114f2 llc: Change the flow. Exit early for the special case and initialize the tv 2013-11-13 15:19:39 +01:00
Holger Hans Peter Freyther fce431cf3a llc: Move the timeout calculation into the TBF 2013-11-13 15:17:12 +01:00
Holger Hans Peter Freyther 857281f7ff llc: Remove one of the two variants to put data into the frame 2013-11-13 14:58:19 +01:00
Holger Hans Peter Freyther acb5427bda llc: Move all direct accesses to the frame into the llc structure
Add some todo items where we could add assertions now that I see
the constraints and invariants of this code.
2013-11-07 08:15:58 +01:00
Holger Hans Peter Freyther 096f6f9f39 llc: Move the llc code out of the tbf.cpp into a new dedicated one 2013-11-07 07:21:06 +01:00