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 a947ee6d9d
commit 7ca29e3a9b
3 changed files with 23 additions and 23 deletions

View File

@ -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);
/*! @} */

View File

@ -810,7 +810,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;
@ -957,7 +957,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;
@ -1039,7 +1039,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;
@ -1078,7 +1078,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;
@ -1156,7 +1156,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;
@ -1249,7 +1249,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;
@ -1265,22 +1265,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");
@ -1291,7 +1291,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;
@ -1502,7 +1502,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;
@ -1692,19 +1692,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);

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