X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=src%2Fgsm%2Flapdm.c;h=e496461e3d4e0e66ce41a2016f3b2b65d420fa88;hb=8264e09ca2f3bd93eba5eefa342267f303085629;hp=242544d3ad768d03b867552c9f1bde9e6d31e329;hpb=6420774b3b2e1658fa7f3d788e81d2305d6f10c3;p=osmocom-bb.git diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c index 242544d..e496461 100644 --- a/src/gsm/lapdm.c +++ b/src/gsm/lapdm.c @@ -594,6 +594,7 @@ static void lapdm_t200_cb(void *data) rsl_rll_error(RLL_CAUSE_T200_EXPIRED, &dl->mctx); /* flush tx buffers */ lapdm_dl_flush_tx(dl); + lapdm_dl_flush_send(dl); /* go back to idle state */ lapdm_dl_newstate(dl, LAPDm_STATE_IDLE); /* NOTE: we must not change any other states or buffers @@ -893,6 +894,8 @@ static int lapdm_rx_u(struct msgb *msg, struct lapdm_msg_ctx *mctx) /* reset Timer T200 */ osmo_timer_del(&dl->t200); /* go to idle state */ + lapdm_dl_flush_tx(dl); + lapdm_dl_flush_send(dl); lapdm_dl_newstate(dl, LAPDm_STATE_IDLE); rc = send_rll_simple(RSL_MT_REL_CONF, mctx); msgb_free(msg); @@ -1024,6 +1027,8 @@ static int lapdm_rx_u(struct msgb *msg, struct lapdm_msg_ctx *mctx) /* reset Timer T200 */ osmo_timer_del(&dl->t200); /* enter idle state */ + lapdm_dl_flush_tx(dl); + lapdm_dl_flush_send(dl); lapdm_dl_newstate(dl, LAPDm_STATE_IDLE); /* send notification to L3 */ rc = send_rll_simple(rsl_msg, mctx); @@ -1074,6 +1079,8 @@ static int lapdm_rx_u(struct msgb *msg, struct lapdm_msg_ctx *mctx) /* reset Timer T200 */ osmo_timer_del(&dl->t200); /* go to idle state */ + lapdm_dl_flush_tx(dl); + lapdm_dl_flush_send(dl); lapdm_dl_newstate(dl, LAPDm_STATE_IDLE); rc = send_rll_simple(RSL_MT_REL_CONF, mctx); msgb_free(msg); @@ -1096,6 +1103,8 @@ static int lapdm_rx_u(struct msgb *msg, struct lapdm_msg_ctx *mctx) rc = send_rll_simple(RSL_MT_REL_IND, mctx); msgb_free(msg); /* go to idle state */ + lapdm_dl_flush_tx(dl); + lapdm_dl_flush_send(dl); lapdm_dl_newstate(dl, LAPDm_STATE_IDLE); return 0; } @@ -1108,6 +1117,8 @@ static int lapdm_rx_u(struct msgb *msg, struct lapdm_msg_ctx *mctx) rc = send_rll_simple(RSL_MT_REL_IND, mctx); msgb_free(msg); /* go to idle state */ + lapdm_dl_flush_tx(dl); + lapdm_dl_flush_send(dl); lapdm_dl_newstate(dl, LAPDm_STATE_IDLE); return 0; } @@ -1592,11 +1603,18 @@ static int l2_ph_data_ind(struct msgb *msg, struct lapdm_entity *le, uint8_t cha sapi = 0; } else { if (mctx.link_id & 0x40) { - /* It was received from network on SACCH, thus - * lapdm_fmt must be B4 */ - mctx.lapdm_fmt = LAPDm_FMT_B4; - mctx.n201 = N201_B4; - LOGP(DLLAPDM, LOGL_INFO, "fmt=B4\n"); + /* It was received from network on SACCH */ + + /* If sent by BTS, lapdm_fmt must be B4 */ + if (le->mode == LAPDM_MODE_MS) { + mctx.lapdm_fmt = LAPDm_FMT_B4; + mctx.n201 = N201_B4; + LOGP(DLLAPDM, LOGL_INFO, "fmt=B4\n"); + } else { + mctx.lapdm_fmt = LAPDm_FMT_B; + mctx.n201 = N201_AB_SACCH; + LOGP(DLLAPDM, LOGL_INFO, "fmt=B\n"); + } /* SACCH frames have a two-byte L1 header that * OsmocomBB L1 doesn't strip */ mctx.tx_power_ind = msg->l2h[0] & 0x1f;