summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/common/l1ctl.c
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-10-03 06:04:59 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-10-03 19:16:08 +0700
commit574612569633416395eb7761ba31823976ead71a (patch)
tree5b900fa69bbad7fb532e1805b51ec20773da9c96 /src/host/layer23/src/common/l1ctl.c
parentb52a5db584bbeabf6e8b4fbf2a2ad071b9568dbe (diff)
layer23/l1ctl.c: keep L1 header, drop L1CTL header
There is no need to keep the L1CTL header in messages being sent towards the upper layers, but the L1 info header can be used by L2&3 to obtain some information, e.g. TDMA frame number. Change-Id: Id64249f1b7a1c2be578263ba62aa195c452ab7e8
Diffstat (limited to 'src/host/layer23/src/common/l1ctl.c')
-rw-r--r--src/host/layer23/src/common/l1ctl.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/host/layer23/src/common/l1ctl.c b/src/host/layer23/src/common/l1ctl.c
index eedfb938..39b7f3c3 100644
--- a/src/host/layer23/src/common/l1ctl.c
+++ b/src/host/layer23/src/common/l1ctl.c
@@ -244,10 +244,6 @@ static int rx_ph_data_ind(struct osmocom_ms *ms, struct msgb *msg)
else
le = &ms->lapdm_channel.lapdm_dcch;
- /* pull the L1 header from the msgb */
- msgb_pull(msg, msg->l2h - (msg->l1h-sizeof(struct l1ctl_hdr)));
- msg->l1h = NULL;
-
osmo_prim_init(&pp.oph, SAP_GSM_PH, PRIM_PH_DATA,
PRIM_OP_INDICATION, msg);
pp.u.data.chan_nr = dl->chan_nr;
@@ -638,8 +634,8 @@ int l1ctl_tx_sim_req(struct osmocom_ms *ms, uint8_t *data, uint16_t length)
/* just forward the SIM response to the SIM handler */
static int rx_l1_sim_conf(struct osmocom_ms *ms, struct msgb *msg)
{
- uint16_t len = msg->len - sizeof(struct l1ctl_hdr);
- uint8_t *data = msg->data + sizeof(struct l1ctl_hdr);
+ uint16_t len = msgb_l2len(msg);
+ uint8_t *data = msg->data;
if (apdu_len > -1 && apdu_len + len <= sizeof(apdu_data)) {
memcpy(apdu_data + apdu_len, data, len);
@@ -649,10 +645,6 @@ static int rx_l1_sim_conf(struct osmocom_ms *ms, struct msgb *msg)
}
LOGP(DL1C, LOGL_INFO, "SIM %s\n", osmo_hexdump(data, len));
-
- /* pull the L1 header from the msgb */
- msgb_pull(msg, sizeof(struct l1ctl_hdr));
- msg->l1h = NULL;
sim_apdu_resp(ms, msg);
@@ -784,13 +776,8 @@ static int rx_l1_traffic_ind(struct osmocom_ms *ms, struct msgb *msg)
DEBUGP(DL1C, "TRAFFIC IND (%s)\n", osmo_hexdump(ti->data, 33));
/* distribute or drop */
- if (ms->l1_entity.l1_traffic_ind) {
- /* pull the L1 header from the msgb */
- msgb_pull(msg, msg->l2h - (msg->l1h-sizeof(struct l1ctl_hdr)));
- msg->l1h = NULL;
-
+ if (ms->l1_entity.l1_traffic_ind)
return ms->l1_entity.l1_traffic_ind(ms, msg);
- }
msgb_free(msg);
return 0;
@@ -895,7 +882,9 @@ int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg)
return -1;
}
+ /* Pull the L1CTL header from the msgb */
l1h = (struct l1ctl_hdr *) msg->l1h;
+ msgb_pull(msg, sizeof(struct l1ctl_hdr));
/* move the l1 header pointer to point _BEHIND_ l1ctl_hdr,
as the l1ctl header is of no interest to subsequent code */