From e5b7ad8119837f68b3bc1e53beb8f03deff21938 Mon Sep 17 00:00:00 2001 From: Jonathan Santos Date: Wed, 22 Jun 2011 12:13:59 -0400 Subject: gprs: Reset LLC state when Timer 3350 expires This works around a problem that occurs if a mobile loses packet data connectivity, e.g. moves out of coverage or switches over to a circuit-switched call, while a data transfer is occurring. The mobile would reset its LLC state, causing it to be unsynchronized with the SGSN. Therefore the SGSN would drop incoming frames until the sequence numbers matched. This workaround resets the LLC state in the SGSN if T3350 expires, indicating that Routing Area Updating Request, Attach Request, or P-TMSI Realloc Command has failed. --- include/openbsc/gprs_llc.h | 1 + src/gprs/gprs_gmm.c | 1 + src/gprs/gprs_llc.c | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/include/openbsc/gprs_llc.h b/include/openbsc/gprs_llc.h index 5949ac3b8..aa3b9ccbf 100644 --- a/include/openbsc/gprs_llc.h +++ b/include/openbsc/gprs_llc.h @@ -160,6 +160,7 @@ int gprs_llgmm_assign(struct gprs_llc_llme *llme, int gprs_llgmm_suspend(struct gprs_llc_llme *llme); int gprs_llgmm_resume(struct gprs_llc_llme *llme); +void gprs_llgmm_reset_state(struct gprs_llc_llme *llme); int gprs_llc_init(const char *cipher_plugin_path); int gprs_llc_vty_init(void); diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c index d6cd4125c..f98dcf0d4 100644 --- a/src/gprs/gprs_gmm.c +++ b/src/gprs/gprs_gmm.c @@ -1075,6 +1075,7 @@ static void mmctx_timer_cb(void *_mm) if (mm->num_T_exp >= 5) { LOGP(DMM, LOGL_NOTICE, "T3350 expired >= 5 times\n"); gprs_llgmm_resume(mm->llme); + gprs_llgmm_reset_state(mm->llme); break; } /* re-transmit the respective msg and re-start timer */ diff --git a/src/gprs/gprs_llc.c b/src/gprs/gprs_llc.c index 07294aadc..c5ff72944 100644 --- a/src/gprs/gprs_llc.c +++ b/src/gprs/gprs_llc.c @@ -868,6 +868,30 @@ int gprs_llgmm_resume(struct gprs_llc_llme* llme) return 0; } +void gprs_llgmm_reset_state(struct gprs_llc_llme *llme) +{ + unsigned int i; + + if (llme == 0) + { + LOGP(DLLC, LOGL_ERROR, "LLC TX: trying to reset LLC states " + "but passed null llme by gmm\n"); + return; + } + + LOGP(DLLC, LOGL_NOTICE, "LLC RX: reset state variable for TLLI 0x%08x", + llme->tlli); + /* 8.5.3.1 For all LLE's */ + for (i = 0; i < ARRAY_SIZE(llme->lle); i++) { + struct gprs_llc_lle *l = &llme->lle[i]; + l->vu_recv = 0; /* lets not mess with send state variable now */ + /* l->vu_send = l->vu_recv = 0; */ + l->retrans_ctr = 0; + l->state = GPRS_LLES_ASSIGNED_ADM; + /* FIXME Set parameters according to table 9 */ + } +} + int gprs_llc_init(const char *cipher_plugin_path) { return gprs_cipher_load(cipher_plugin_path); -- cgit v1.2.3