aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-06-23 17:53:27 -0400
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-01-06 18:52:05 +0100
commitfaf1f64a2d0a54d37616a8bec8691346ab792cde (patch)
treecf9f5052348eae7207bceeb9803967686ca3e692 /openbsc/include
parent26d0fe3c89042ed4008903dbe12c5110d8f9fc48 (diff)
gprs: Honor GSM 04.64 8.4.2 Receipt of unacknowledged information
GSM 04.64 8.4.2 asks to ignore UI frames if the DLCI is not known, or if the "(V(UR)- 32) <= N(U) < V(UR)". E.g. if we want to have V(UR) == 511 and this frame is dropped, we would ignore N(U)'s 0 to 510. Calculate the delta. The code is based on Jonathan Santos's "LLC UI window" fix but the issue was discovered independly.
Diffstat (limited to 'openbsc/include')
-rw-r--r--openbsc/include/openbsc/gprs_llc.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/gprs_llc.h b/openbsc/include/openbsc/gprs_llc.h
index f905473a1..e3fc82ef9 100644
--- a/openbsc/include/openbsc/gprs_llc.h
+++ b/openbsc/include/openbsc/gprs_llc.h
@@ -179,4 +179,20 @@ int gprs_llgmm_assign(struct gprs_llc_llme *llme,
int gprs_llc_init(const char *cipher_plugin_path);
int gprs_llc_vty_init(void);
+/**
+ * \short Check if N(U) should be considered a retransmit
+ *
+ * Implements the range check as of GSM 04.64 8.4.2
+ * Receipt of unacknowledged information.
+ *
+ * @returns Returns 1 if (V(UR)-32) <= N(U) < V(UR)
+ * @param nu N(U) unconfirmed sequence number of the UI frame
+ * @param vur V(UR) unconfirmend received state variable
+ */
+static inline int gprs_llc_is_retransmit(uint16_t nu, uint16_t vur)
+{
+ int delta = (vur - nu) & 0x1ff;
+ return 0 < delta && delta < 32;
+}
+
#endif