[PATCH] osmocom-bb[fixeria/trx]: trxcon/scheduler: fix Measurement Reporting on SACCH

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/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Thu Mar 22 20:32:23 UTC 2018


Review at  https://gerrit.osmocom.org/7470

trxcon/scheduler: fix Measurement Reporting on SACCH

According to GSM TS 04.08, section 3.4.1.1 "SACCH procedures", the
SACCH shall be used at least for measurement results transmission
from the mobile station. In other words, Measurement Report
messages are sent at each possible occasion when
nothing else has to be sent.

Instead of that, a LAPDm fill frame (0x01, 0x03, 0x01, 0x2b, ...)
was used, what is wrong. This was causing the following error
messages on the BTS side:

  lapd_core.c:1239 Unnumbered frame not allowed. (dl=0x7f60218a7898)
  lapd_core.c:393 sending MDL-ERROR-IND cause 12
                  from state LAPD_STATE_IDLE (dl=0x7f60218a7898)
  lapdm.c:399 sending MDL-ERROR-IND 12

Please note that the static measurement results are sent for now,
due to lack of proper measurement implementation according to the
3GPP TS 05.08, section 8.4 "Measurement reporting".

Related: OS#2988
Change-Id: If1b8dc74ced746d6270676fdde75fcda32f91a3d
---
M src/host/trxcon/sched_prim.c
M src/host/trxcon/sched_trx.c
M src/host/trxcon/sched_trx.h
3 files changed, 80 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/70/7470/1

diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c
index e1c87bb..2d6d1de 100644
--- a/src/host/trxcon/sched_prim.c
+++ b/src/host/trxcon/sched_prim.c
@@ -228,6 +228,73 @@
 	lchan->prim = NULL;
 }
 
+
+/**
+ * Assigns a Measurement Report composed by L1 itself.
+ *
+ * @param  trx   a trx instance the ts belongs to
+ * @param  ts    a ts instance the lchan belongs to
+ * @param  lchan lchan to assign a primitive
+ * @return       zero in case of success, otherwise a error code
+ */
+int sched_prim_sacch(struct trx_instance *trx,
+	struct trx_ts *ts, struct trx_lchan_state *lchan)
+{
+	enum trx_lchan_type chan = lchan->type;
+	struct trx_ts_prim *prim;
+
+	/* Measurement Report template */
+	static const uint8_t meas_rep_tpl[] = {
+		/* L1 SACCH pseudo-header */
+		0x0f, 0x00,
+
+		/* LAPDm header */
+		0x01, 0x03, 0x49,
+
+		/* Measurement report */
+		0x06, 0x15, 0x36, 0x36, 0x01, 0xC0,
+
+		/* TODO: Padding? Randomize if so */
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	};
+
+	/* Make sure that there is no existing primitive */
+	OSMO_ASSERT(lchan->prim == NULL);
+	/* Make sure that channel is SACCH */
+	OSMO_ASSERT(CHAN_IS_SACCH(chan));
+
+	/* Allocate a new primitive */
+	prim = talloc_size(lchan, sizeof(*prim) + GSM_MACBLOCK_LEN);
+	if (prim == NULL)
+		return -ENOMEM;
+
+	/* Init primitive */
+	prim->payload_len = GSM_MACBLOCK_LEN;
+	prim->chan = chan;
+
+	/* Copy Measurement Report template */
+	memcpy(prim->payload, meas_rep_tpl, GSM_MACBLOCK_LEN);
+
+	/* Update L1 SACCH pseudo-header */
+	prim->payload[0] = trx->tx_power;
+	prim->payload[1] = trx->ta;
+
+	/**
+	 * Update Measurement Results
+	 * FIXME: proper measurement isn't implemented
+	 * See: 3GPP TS 05.08, section 8.4 "Measurement reporting"
+	 */
+
+	/* Assign the current prim */
+	lchan->prim = prim;
+
+	LOGP(DSCHD, LOGL_DEBUG, "Transmitting a Measurement Report "
+		"composed by L1 on lchan=%s\n", trx_lchan_desc[chan].name);
+
+	return 0;
+}
+
 /**
  * Assigns a dummy primitive to a lchan depending on its type.
  * Could be used when there is nothing to transmit, but
diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c
index 168c4ef..f50fef9 100644
--- a/src/host/trxcon/sched_trx.c
+++ b/src/host/trxcon/sched_trx.c
@@ -99,6 +99,17 @@
 
 		/* TODO: report TX buffers health to the higher layers */
 
+		/**
+		 * GSM TS 04.08, section 3.4.1.1 "SACCH procedures"
+		 * The SACCH shall be used at least for measurement
+		 * results transmission from the mobile station.
+		 * In other words, Measurement Report messages
+		 * are sent at each possible occasion when
+		 * nothing else has to be sent.
+		 */
+		if (lchan->prim == NULL && CHAN_IS_SACCH(chan))
+			sched_prim_sacch(trx, ts, lchan);
+
 		/* If CBTX (Continuous Burst Transmission) is assumed */
 		if (trx_lchan_desc[chan].flags & TRX_CH_FLAG_CBTX) {
 			/**
diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h
index ce1c7f4..8aec96a 100644
--- a/src/host/trxcon/sched_trx.h
+++ b/src/host/trxcon/sched_trx.h
@@ -303,6 +303,8 @@
 
 struct trx_ts_prim *sched_prim_dequeue(struct llist_head *queue,
 	enum trx_lchan_type lchan_type);
+int sched_prim_sacch(struct trx_instance *trx,
+	struct trx_ts *ts, struct trx_lchan_state *lchan);
 int sched_prim_dummy(struct trx_lchan_state *lchan);
 void sched_prim_drop(struct trx_lchan_state *lchan);
 void sched_prim_flush_queue(struct llist_head *list);

-- 
To view, visit https://gerrit.osmocom.org/7470
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If1b8dc74ced746d6270676fdde75fcda32f91a3d
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>



More information about the gerrit-log mailing list