layer23/lapdm: Properly handle S frame with F=1 when in timer recovery
authorSylvain Munaut <tnt@246tNt.com>
Sat, 23 Oct 2010 18:47:26 +0000 (20:47 +0200)
committerroot <root@laptop.jolly.ten>
Sun, 24 Oct 2010 12:14:47 +0000 (12:14 +0000)
This is the signal to exit recovery mode !
See GSM 04.06 Section 5.5.7

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
src/host/layer23/src/common/lapdm.c

index b1c0d40..f3eed52 100644 (file)
@@ -1078,11 +1078,17 @@ static int lapdm_rx_s(struct msgb *msg, struct lapdm_msg_ctx *mctx)
                rsl_rll_error(RLL_CAUSE_SFRM_INC_PARAM, mctx);
                return -EIO;
        }
-       /* 5.4.2.2: Inidcate error on supervisory reponse F=1 */
+
        if (LAPDm_ADDR_CR(mctx->addr) == CR_BS2MS_RESP
         && LAPDm_CTRL_PF_BIT(mctx->ctrl)) {
-               LOGP(DLAPDM, LOGL_NOTICE, "S frame response with F=1 error\n");
-               rsl_rll_error(RLL_CAUSE_UNSOL_SPRV_RESP, mctx);
+               if (dl->state != LAPDm_STATE_TIMER_RECOV) {
+                       /* 5.4.2.2: Inidcate error on supervisory reponse F=1 */
+                       LOGP(DLAPDM, LOGL_NOTICE, "S frame response with F=1 error\n");
+                       rsl_rll_error(RLL_CAUSE_UNSOL_SPRV_RESP, mctx);
+               } else {
+                       /* 5.5.7: Exit Timer Recovery */
+                       lapdm_dl_newstate(dl, LAPDm_STATE_MF_EST);
+               }
        }
 
        switch (dl->state) {