LAPD: propagate FN from L1

Related: OS#4074
Change-Id: I62fc6c9bae4520bfd3a1090005f9ffdbc29bc769
This commit is contained in:
Max 2022-10-09 19:49:19 +03:00
parent 8fbaad6903
commit 6f08c02773
4 changed files with 9 additions and 5 deletions

View File

@ -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

View File

@ -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 */

View File

@ -80,6 +80,7 @@
#include <osmocom/core/utils.h>
#include <osmocom/core/talloc.h>
#include <osmocom/gsm/lapd_core.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/rsl.h>
/* 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=%lu] 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=%lu] stop T200\n", dl->t200_fn);
osmo_timer_del(&dl->t200);
}

View File

@ -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: