Change in osmocom-bb[master]: layer23/l1ctl.c: keep L1 header, drop L1CTL header

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Oct 5 11:49:21 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/11215 )

Change subject: layer23/l1ctl.c: keep L1 header, drop L1CTL header
......................................................................

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
---
M src/host/layer23/src/common/l1ctl.c
1 file changed, 5 insertions(+), 16 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/host/layer23/src/common/l1ctl.c b/src/host/layer23/src/common/l1ctl.c
index eedfb93..39b7f3c 100644
--- a/src/host/layer23/src/common/l1ctl.c
+++ b/src/host/layer23/src/common/l1ctl.c
@@ -244,10 +244,6 @@
 	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 @@
 /* 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 @@
 	}
 
 	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 @@
 	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 @@
 		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 */

-- 
To view, visit https://gerrit.osmocom.org/11215
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id64249f1b7a1c2be578263ba62aa195c452ab7e8
Gerrit-Change-Number: 11215
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181005/a985a947/attachment.htm>


More information about the gerrit-log mailing list