diff --git a/include/osmocom/gsm/gsm_utils.h b/include/osmocom/gsm/gsm_utils.h index fef2fdd1e..56abfd5c0 100644 --- a/include/osmocom/gsm/gsm_utils.h +++ b/include/osmocom/gsm/gsm_utils.h @@ -33,6 +33,7 @@ } while (0) #define GSM_MAX_FN (26*51*2048) +#define OSMO_FN_UNSET 0xFFFFFFFF /* Max length of random identifier which can be requested via osmo_get_rand_id() */ #define OSMO_MAX_RAND_ID_LEN 16 diff --git a/include/osmocom/gsm/lapd_core.h b/include/osmocom/gsm/lapd_core.h index 3f31881d3..85e53563b 100644 --- a/include/osmocom/gsm/lapd_core.h +++ b/include/osmocom/gsm/lapd_core.h @@ -148,6 +148,7 @@ struct lapd_datalink { int seq_err_cond; /*!< condition of sequence error */ uint8_t own_busy; /*!< receiver busy on our side */ uint8_t peer_busy; /*!< receiver busy on remote side */ + uint32_t t200_fn; /*!< Frame Number for computing T200 timer */ int t200_sec, t200_usec; /*!< retry timer (default 1 sec) */ int t203_sec, t203_usec; /*!< retry timer (default 10 secs) */ struct osmo_timer_list t200; /*!< T200 timer */ diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c index 9a4f56b96..7e0dfaecb 100644 --- a/src/gsm/lapd_core.c +++ b/src/gsm/lapd_core.c @@ -80,6 +80,7 @@ #include #include #include +#include #include /* TS 04.06 Table 4 / Section 3.8.1 */ @@ -201,8 +202,8 @@ static void lapd_start_t200(struct lapd_datalink *dl) { if (osmo_timer_pending(&dl->t200)) return; - LOGDL(dl, LOGL_INFO, "start T200 (timeout=%d.%06ds)\n", - dl->t200_sec, dl->t200_usec); + LOGDL(dl, LOGL_INFO, "[FN=%u] start T200 (timeout=%d.%06ds)\n", + dl->t200_fn, dl->t200_sec, dl->t200_usec); osmo_timer_schedule(&dl->t200, dl->t200_sec, dl->t200_usec); } @@ -218,7 +219,7 @@ static void lapd_stop_t200(struct lapd_datalink *dl) { if (!osmo_timer_pending(&dl->t200)) return; - LOGDL(dl, LOGL_INFO, "stop T200\n"); + LOGDL(dl, LOGL_INFO, "[FN=%u] stop T200\n", dl->t200_fn); osmo_timer_del(&dl->t200); } diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c index e7d46e631..f68254b96 100644 --- a/src/gsm/lapdm.c +++ b/src/gsm/lapdm.c @@ -698,7 +698,7 @@ static int lapdm_rx_not_permitted(const struct lapdm_entity *le, } /* input into layer2 (from layer 1) */ -static int l2_ph_data_ind(struct msgb *msg, struct lapdm_entity *le, +static int l2_ph_data_ind(struct msgb *msg, struct lapdm_entity *le, uint32_t fn, uint8_t chan_nr, uint8_t link_id) { uint8_t cbits = chan_nr >> 3; @@ -762,6 +762,7 @@ static int l2_ph_data_ind(struct msgb *msg, struct lapdm_entity *le, case LAPDm_FMT_B: case LAPDm_FMT_B4: lctx.dl = &mctx.dl->dl; + lctx.dl->t200_fn = fn; /* obtain SAPI from address field */ mctx.link_id |= LAPDm_ADDR_SAPI(msg->l2h[0]); /* G.2.3 EA bit set to "0" is not allowed in GSM */ @@ -907,7 +908,7 @@ int lapdm_phsap_up(struct osmo_prim_hdr *oph, struct lapdm_entity *le) rc = -ENODEV; goto free; } - rc = l2_ph_data_ind(oph->msg, le, pp->u.data.chan_nr, + rc = l2_ph_data_ind(oph->msg, le, pp->u.data.fn, pp->u.data.chan_nr, pp->u.data.link_id); break; case PRIM_PH_RTS: