path: root/src/llc.cpp
diff options
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-03-20 12:02:42 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-04-02 12:34:48 +0200
commit0c1c8778dfdda80222d30b903d62156adb6927c4 (patch)
tree73f8446ef4e95d8aa0085d3059b03d1139d069eb /src/llc.cpp
parent0a0b5dcb324d3652f55541855426c91f0c9d9536 (diff)
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
Diffstat (limited to 'src/llc.cpp')
1 files changed, 15 insertions, 0 deletions
diff --git a/src/llc.cpp b/src/llc.cpp
index b160961..9c5581f 100644
--- a/src/llc.cpp
+++ b/src/llc.cpp
@@ -160,3 +160,18 @@ bool gprs_llc::is_frame_expired(struct timeval *tv_now, struct timeval *tv)
return timercmp(tv_now, tv, >);
+bool gprs_llc::is_user_data_frame(uint8_t *data, size_t len)
+ if (len < 2)
+ return false;
+ if ((data[0] & 0x0f) == 1 /* GPRS_SAPI_GMM */)
+ return false;
+ if ((data[0] & 0x0e) != 0xc0 /* LLC UI */)
+ /* It is not an LLC UI frame */
+ return false;
+ return true;