diff --git a/include/osmocom/gsm/lapd_core.h b/include/osmocom/gsm/lapd_core.h index 3f31881d3..6e6bff5b6 100644 --- a/include/osmocom/gsm/lapd_core.h +++ b/include/osmocom/gsm/lapd_core.h @@ -171,7 +171,7 @@ void lapd_dl_set_name(struct lapd_datalink *dl, const char *name); void lapd_dl_exit(struct lapd_datalink *dl); void lapd_dl_reset(struct lapd_datalink *dl); int lapd_set_mode(struct lapd_datalink *dl, enum lapd_mode mode); -int lapd_ph_data_ind(struct msgb *msg, struct lapd_msg_ctx *lctx); +int lapd_ph_data_ind(struct msgb *msg, struct lapd_msg_ctx *lctx, uint32_t fn); int lapd_recv_dlsap(struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx); /*! @} */ diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c index f552dbae7..d5737c8ce 100644 --- a/src/gsm/lapd_core.c +++ b/src/gsm/lapd_core.c @@ -812,7 +812,7 @@ static void lapd_acknowledge(struct lapd_msg_ctx *lctx) /* L1 -> L2 */ /* Receive a LAPD U SABM(E) message from L1 */ -static int lapd_rx_u_sabm(struct msgb *msg, struct lapd_msg_ctx *lctx) +static int lapd_rx_u_sabm(struct msgb *msg, struct lapd_msg_ctx *lctx, uint32_t fn) { struct lapd_datalink *dl = lctx->dl; int length = lctx->length; @@ -959,7 +959,7 @@ static int lapd_rx_u_sabm(struct msgb *msg, struct lapd_msg_ctx *lctx) } /* Receive a LAPD U DM message from L1 */ -static int lapd_rx_u_dm(struct msgb *msg, struct lapd_msg_ctx *lctx) +static int lapd_rx_u_dm(struct msgb *msg, struct lapd_msg_ctx *lctx, uint32_t fn) { struct lapd_datalink *dl = lctx->dl; int rc = 0; @@ -1041,7 +1041,7 @@ static int lapd_rx_u_dm(struct msgb *msg, struct lapd_msg_ctx *lctx) } /* Receive a LAPD U UI message from L1 */ -static int lapd_rx_u_ui(struct msgb *msg, struct lapd_msg_ctx *lctx) +static int lapd_rx_u_ui(struct msgb *msg, struct lapd_msg_ctx *lctx, uint32_t fn) { struct lapd_datalink *dl = lctx->dl; int length = lctx->length; @@ -1080,7 +1080,7 @@ static int lapd_rx_u_ui(struct msgb *msg, struct lapd_msg_ctx *lctx) } /* Receive a LAPD U DISC message from L1 */ -static int lapd_rx_u_disc(struct msgb *msg, struct lapd_msg_ctx *lctx) +static int lapd_rx_u_disc(struct msgb *msg, struct lapd_msg_ctx *lctx, uint32_t fn) { struct lapd_datalink *dl = lctx->dl; int length = lctx->length; @@ -1158,7 +1158,7 @@ static int lapd_rx_u_disc(struct msgb *msg, struct lapd_msg_ctx *lctx) } /* Receive a LAPD U UA message from L1 */ -static int lapd_rx_u_ua(struct msgb *msg, struct lapd_msg_ctx *lctx) +static int lapd_rx_u_ua(struct msgb *msg, struct lapd_msg_ctx *lctx, uint32_t fn) { struct lapd_datalink *dl = lctx->dl; int length = lctx->length; @@ -1251,7 +1251,7 @@ static int lapd_rx_u_ua(struct msgb *msg, struct lapd_msg_ctx *lctx) } /* Receive a LAPD U FRMR message from L1 */ -static int lapd_rx_u_frmr(struct msgb *msg, struct lapd_msg_ctx *lctx) +static int lapd_rx_u_frmr(struct msgb *msg, struct lapd_msg_ctx *lctx, uint32_t fn) { struct lapd_datalink *dl = lctx->dl; @@ -1267,22 +1267,22 @@ static int lapd_rx_u_frmr(struct msgb *msg, struct lapd_msg_ctx *lctx) } /* Receive a LAPD U (Unnumbered) message from L1 */ -static int lapd_rx_u(struct msgb *msg, struct lapd_msg_ctx *lctx) +static int lapd_rx_u(struct msgb *msg, struct lapd_msg_ctx *lctx, uint32_t fn) { switch (lctx->s_u) { case LAPD_U_SABM: case LAPD_U_SABME: - return lapd_rx_u_sabm(msg, lctx); + return lapd_rx_u_sabm(msg, lctx, fn); case LAPD_U_DM: - return lapd_rx_u_dm(msg, lctx); + return lapd_rx_u_dm(msg, lctx, fn); case LAPD_U_UI: - return lapd_rx_u_ui(msg, lctx); + return lapd_rx_u_ui(msg, lctx, fn); case LAPD_U_DISC: - return lapd_rx_u_disc(msg, lctx); + return lapd_rx_u_disc(msg, lctx, fn); case LAPD_U_UA: - return lapd_rx_u_ua(msg, lctx); + return lapd_rx_u_ua(msg, lctx, fn); case LAPD_U_FRMR: - return lapd_rx_u_frmr(msg, lctx); + return lapd_rx_u_frmr(msg, lctx, fn); default: /* G.3.1 */ LOGDL(lctx->dl, LOGL_NOTICE, "Unnumbered frame not allowed\n"); @@ -1293,7 +1293,7 @@ static int lapd_rx_u(struct msgb *msg, struct lapd_msg_ctx *lctx) } /* Receive a LAPD S (Supervisory) message from L1 */ -static int lapd_rx_s(struct msgb *msg, struct lapd_msg_ctx *lctx) +static int lapd_rx_s(struct msgb *msg, struct lapd_msg_ctx *lctx, uint32_t fn) { struct lapd_datalink *dl = lctx->dl; int length = lctx->length; @@ -1504,7 +1504,7 @@ static int lapd_rx_s(struct msgb *msg, struct lapd_msg_ctx *lctx) } /* Receive a LAPD I (Information) message from L1 */ -static int lapd_rx_i(struct msgb *msg, struct lapd_msg_ctx *lctx) +static int lapd_rx_i(struct msgb *msg, struct lapd_msg_ctx *lctx, uint32_t fn) { struct lapd_datalink *dl = lctx->dl; //uint8_t nr = lctx->n_recv; @@ -1694,19 +1694,19 @@ static int lapd_rx_i(struct msgb *msg, struct lapd_msg_ctx *lctx) } /* Receive a LAPD message from L1 */ -int lapd_ph_data_ind(struct msgb *msg, struct lapd_msg_ctx *lctx) +int lapd_ph_data_ind(struct msgb *msg, struct lapd_msg_ctx *lctx, uint32_t fn) { int rc; switch (lctx->format) { case LAPD_FORM_U: - rc = lapd_rx_u(msg, lctx); + rc = lapd_rx_u(msg, lctx, fn); break; case LAPD_FORM_S: - rc = lapd_rx_s(msg, lctx); + rc = lapd_rx_s(msg, lctx, fn); break; case LAPD_FORM_I: - rc = lapd_rx_i(msg, lctx); + rc = lapd_rx_i(msg, lctx, fn); break; default: LOGDL(lctx->dl, LOGL_NOTICE, "unknown LAPD format 0x%02x\n", lctx->format); diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c index e7d46e631..5260aaad8 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; @@ -835,7 +835,7 @@ static int l2_ph_data_ind(struct msgb *msg, struct lapdm_entity *le, return -EINVAL; } /* send to LAPD */ - rc = lapd_ph_data_ind(msg, &lctx); + rc = lapd_ph_data_ind(msg, &lctx, fn); break; case LAPDm_FMT_Bter: /* FIXME */ @@ -907,7 +907,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: