lapdm: Track fn of primitives in struct lapdm_msg_ctx

This field will be used in follow-up commits to provide FN information
in RSLms primitives towars upper layers. This is needed for instance on
the MS side when a CCCH_DATA.ind is received containing a TBF ImmAss
with a relative FN indicating the Starting Time. Without tracking FN
advance, the uppers layers are not capable of figuring out the absolute
FN of the TBF Starting time.

The struct lapdm_msg_ctx is not really used outside of libosmocore, so
we are safe extending it.

Related: OS#3626
Change-Id: Icf986f4202703eb452bedc1b749bb8ce0c73706f
This commit is contained in:
Pau Espin 2023-08-09 17:41:25 +02:00
parent 6df53dc769
commit 1247aa1fc0
3 changed files with 6 additions and 2 deletions

View File

@ -24,6 +24,7 @@ struct lapdm_msg_ctx {
uint8_t link_id;
uint8_t ta_ind; /* TA indicated by network */
uint8_t tx_power_ind; /* MS power indicated by network */
uint32_t fn;
};
/*! LAPDm datalink like TS 04.06 / Section 3.5.2 */

View File

@ -700,7 +700,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,
uint8_t chan_nr, uint8_t link_id)
uint8_t chan_nr, uint8_t link_id, uint32_t fn)
{
uint8_t cbits = chan_nr >> 3;
uint8_t sapi; /* we cannot take SAPI from link_id, as L1 has no clue */
@ -715,6 +715,7 @@ static int l2_ph_data_ind(struct msgb *msg, struct lapdm_entity *le,
memset(&mctx, 0, sizeof(mctx));
mctx.chan_nr = chan_nr;
mctx.link_id = link_id;
mctx.fn = fn;
/* check for L1 chan_nr/link_id and determine LAPDm hdr format */
if (cbits == 0x10 || cbits == 0x12) {
@ -916,7 +917,7 @@ int lapdm_phsap_up(struct osmo_prim_hdr *oph, struct lapdm_entity *le)
switch (OSMO_PRIM_HDR(oph)) {
case OSMO_PRIM(PRIM_PH_DATA, PRIM_OP_INDICATION):
rc = l2_ph_data_ind(oph->msg, le, pp->u.data.chan_nr,
pp->u.data.link_id);
pp->u.data.link_id, pp->u.data.fn);
break;
case OSMO_PRIM(PRIM_PH_RTS, PRIM_OP_INDICATION):
rc = l2_ph_data_conf(oph->msg, le);

View File

@ -184,6 +184,7 @@ static int send(struct msgb *in_msg, struct lapdm_channel *chan)
/* LAPDm requires those... */
pp.u.data.chan_nr = 0;
pp.u.data.link_id = 0;
pp.u.data.fn = 0;
/* feed into the LAPDm code of libosmogsm */
rc = lapdm_phsap_up(&pp.oph, &chan->lapdm_dcch);
OSMO_ASSERT(rc == 0 || rc == -EBUSY);
@ -206,6 +207,7 @@ static int send_buf(const uint8_t *buf, size_t len, struct lapdm_channel *chan)
/* LAPDm requires those... */
pp.u.data.chan_nr = 0;
pp.u.data.link_id = 0;
pp.u.data.fn = 0;
/* feed into the LAPDm code of libosmogsm */
rc = lapdm_phsap_up(&pp.oph, &chan->lapdm_dcch);
OSMO_ASSERT(rc == 0 || rc == -EBUSY);