mirror of https://gerrit.osmocom.org/libosmocore
LAPD: propagate FN from L1
Related: OS#4074 Change-Id: I62fc6c9bae4520bfd3a1090005f9ffdbc29bc769
This commit is contained in:
parent
793d8a16f1
commit
a0d76de0bf
|
@ -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);
|
||||
|
||||
/*! @} */
|
||||
|
|
|
@ -811,7 +811,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;
|
||||
|
@ -958,7 +958,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;
|
||||
|
@ -1040,7 +1040,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;
|
||||
|
@ -1079,7 +1079,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;
|
||||
|
@ -1157,7 +1157,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;
|
||||
|
@ -1250,7 +1250,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;
|
||||
|
||||
|
@ -1266,22 +1266,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");
|
||||
|
@ -1292,7 +1292,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;
|
||||
|
@ -1503,7 +1503,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;
|
||||
|
@ -1693,19 +1693,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 %u\n", lctx->format);
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue