From 0c1c8778dfdda80222d30b903d62156adb6927c4 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Fri, 20 Mar 2015 12:02:42 +0100 Subject: 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 --- src/llc.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/llc.cpp') diff --git a/src/llc.cpp b/src/llc.cpp index b1609617..9c5581fb 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; +} -- cgit v1.2.3