Change in osmocom-bb[master]: trxcon/scheduler: refactor Downlink measurement processing

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

laforge gerrit-no-reply at lists.osmocom.org
Sun Mar 8 22:50:55 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/17350 )

Change subject: trxcon/scheduler: refactor Downlink measurement processing
......................................................................

trxcon/scheduler: refactor Downlink measurement processing

So far we used to store the sums of ToA and RSSI measurements in the
logical channel state, and after decoding of a block, we did calculate
the average. This approach works fine for xCCH and PDTCH, but when it
comes to block-diagonal interleaving (which is used on TCH/F and TCH/H
channels), the results are incorrect. The problem is that a burst on
TCH may carry 57 bits of one encoded frame and 57 bits of another.

Instead of calculating the sum of measurements on the fly, let's push
them into a circular buffer (the measurement history), and keep them
there even after decoding of a block. This would allow us to calculate
the average of N last measurements depending on the interleaving type.

A single circular buffer can hold up to 8 unique measurements, so the
recent measurements would basically override the oldest ones.

Change-Id: I211ee3314f0a284112a4deddc0e93028f4a27cef
---
M src/host/trxcon/sched_lchan_common.c
M src/host/trxcon/sched_lchan_desc.c
M src/host/trxcon/sched_lchan_pdtch.c
M src/host/trxcon/sched_lchan_sch.c
M src/host/trxcon/sched_lchan_tchf.c
M src/host/trxcon/sched_lchan_tchh.c
M src/host/trxcon/sched_lchan_xcch.c
M src/host/trxcon/sched_trx.c
M src/host/trxcon/sched_trx.h
M src/host/trxcon/trx_if.c
10 files changed, 140 insertions(+), 74 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c
index 813f315..55ec7e9 100644
--- a/src/host/trxcon/sched_lchan_common.c
+++ b/src/host/trxcon/sched_lchan_common.c
@@ -126,9 +126,9 @@
 	struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len,
 	int bit_error_count, bool dec_failed, bool traffic)
 {
+	const struct trx_meas_set *meas = &lchan->meas_avg;
 	const struct trx_lchan_desc *lchan_desc;
 	struct l1ctl_info_dl dl_hdr;
-	int dbm_avg = 0;
 
 	/* Set up pointers */
 	lchan_desc = &trx_lchan_desc[lchan->type];
@@ -140,15 +140,8 @@
 	dl_hdr.frame_nr = htonl(lchan->rx_first_fn);
 	dl_hdr.num_biterr = bit_error_count;
 
-	/* Convert average RSSI to RX level */
-	if (lchan->meas.num) {
-		/* RX level: 0 .. 63 in typical GSM notation (dBm + 110) */
-		dbm_avg = lchan->meas.rssi_sum / lchan->meas.num;
-		dl_hdr.rx_level = dbm2rxlev(dbm_avg);
-	} else {
-		/* No measurements, assuming the worst */
-		dl_hdr.rx_level = 0;
-	}
+	/* RX level: 0 .. 63 in typical GSM notation (dBm + 110) */
+	dl_hdr.rx_level = dbm2rxlev(meas->rssi);
 
 	/* FIXME: set proper values */
 	dl_hdr.snr = 0;
@@ -162,7 +155,7 @@
 	/* Optional GSMTAP logging */
 	if (l2_len > 0 && (!traffic || lchan_desc->chan_nr == RSL_CHAN_OSMO_PDCH)) {
 		sched_gsmtap_send(lchan->type, lchan->rx_first_fn, ts->index,
-				  trx->band_arfcn, dbm_avg, 0, l2, l2_len);
+				  trx->band_arfcn, meas->rssi, 0, l2, l2_len);
 	}
 
 	return 0;
diff --git a/src/host/trxcon/sched_lchan_desc.c b/src/host/trxcon/sched_lchan_desc.c
index b22a18b..1184e5b 100644
--- a/src/host/trxcon/sched_lchan_desc.c
+++ b/src/host/trxcon/sched_lchan_desc.c
@@ -31,35 +31,35 @@
 /* Forward declaration of handlers */
 int rx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid,
-	sbit_t *bits, int8_t rssi, int16_t toa256);
+	sbit_t *bits, const struct trx_meas_set *meas);
 
 int tx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid);
 
 int rx_sch_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid,
-	sbit_t *bits, int8_t rssi, int16_t toa256);
+	sbit_t *bits, const struct trx_meas_set *meas);
 
 int tx_rach_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid);
 
 int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid,
-	sbit_t *bits, int8_t rssi, int16_t toa256);
+	sbit_t *bits, const struct trx_meas_set *meas);
 
 int tx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid);
 
 int rx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid,
-	sbit_t *bits, int8_t rssi, int16_t toa256);
+	sbit_t *bits, const struct trx_meas_set *meas);
 
 int tx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid);
 
 int rx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid,
-	sbit_t *bits, int8_t rssi, int16_t toa256);
+	sbit_t *bits, const struct trx_meas_set *meas);
 
 int tx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid);
diff --git a/src/host/trxcon/sched_lchan_pdtch.c b/src/host/trxcon/sched_lchan_pdtch.c
index 83a6f53..4fd7d35 100644
--- a/src/host/trxcon/sched_lchan_pdtch.c
+++ b/src/host/trxcon/sched_lchan_pdtch.c
@@ -2,7 +2,7 @@
  * OsmocomBB <-> SDR connection bridge
  * TDMA scheduler: handlers for DL / UL bursts on logical channels
  *
- * (C) 2018 by Vadim Yanitskiy <axilirator at gmail.com>
+ * (C) 2018-2020 by Vadim Yanitskiy <axilirator at gmail.com>
  *
  * All Rights Reserved
  *
@@ -42,7 +42,7 @@
 
 int rx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid,
-	sbit_t *bits, int8_t rssi, int16_t toa256)
+	sbit_t *bits, const struct trx_meas_set *meas)
 {
 	const struct trx_lchan_desc *lchan_desc;
 	uint8_t l2[GPRS_L2_MAX_LEN], *mask;
@@ -62,9 +62,6 @@
 
 	/* Reset internal state */
 	if (bid == 0) {
-		/* Clean up old measurements */
-		memset(&lchan->meas, 0x00, sizeof(lchan->meas));
-
 		*first_fn = fn;
 		*mask = 0x0;
 	}
@@ -72,10 +69,8 @@
 	/* Update mask */
 	*mask |= (1 << bid);
 
-	/* Update measurements */
-	lchan->meas.toa256_sum += toa256;
-	lchan->meas.rssi_sum += rssi;
-	lchan->meas.num++;
+	/* Store the measurements */
+	sched_trx_meas_push(lchan, meas);
 
 	/* Copy burst to buffer of 4 bursts */
 	offset = buffer + bid * 116;
@@ -86,6 +81,9 @@
 	if (bid != 3)
 		return 0;
 
+	/* Calculate AVG of the measurements */
+	sched_trx_meas_avg(lchan, 4);
+
 	/* Check for complete set of bursts */
 	if ((*mask & 0xf) != 0xf) {
 		LOGP(DSCHD, LOGL_ERROR, "Received incomplete (%s) data frame at "
diff --git a/src/host/trxcon/sched_lchan_sch.c b/src/host/trxcon/sched_lchan_sch.c
index 9eed506..17f68b0 100644
--- a/src/host/trxcon/sched_lchan_sch.c
+++ b/src/host/trxcon/sched_lchan_sch.c
@@ -70,7 +70,7 @@
 
 int rx_sch_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid,
-	sbit_t *bits, int8_t rssi, int16_t toa256)
+	sbit_t *bits, const struct trx_meas_set *meas)
 {
 	sbit_t payload[2 * 39];
 	struct gsm_time time;
@@ -117,7 +117,7 @@
 	data->link_id = trx_lchan_desc[lchan->type].link_id;
 	data->band_arfcn = htons(trx->band_arfcn);
 	data->frame_nr = htonl(fn);
-	data->rx_level = -rssi;
+	data->rx_level = -(meas->rssi);
 
 	/* FIXME: set proper values */
 	data->num_biterr = 0;
diff --git a/src/host/trxcon/sched_lchan_tchf.c b/src/host/trxcon/sched_lchan_tchf.c
index 0109280..d2cf030 100644
--- a/src/host/trxcon/sched_lchan_tchf.c
+++ b/src/host/trxcon/sched_lchan_tchf.c
@@ -2,7 +2,7 @@
  * OsmocomBB <-> SDR connection bridge
  * TDMA scheduler: handlers for DL / UL bursts on logical channels
  *
- * (C) 2017 by Vadim Yanitskiy <axilirator at gmail.com>
+ * (C) 2017-2020 by Vadim Yanitskiy <axilirator at gmail.com>
  *
  * All Rights Reserved
  *
@@ -44,7 +44,7 @@
 
 int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid,
-	sbit_t *bits, int8_t rssi, int16_t toa256)
+	sbit_t *bits, const struct trx_meas_set *meas)
 {
 	const struct trx_lchan_desc *lchan_desc;
 	int n_errors = -1, n_bits_total, rc;
@@ -64,9 +64,6 @@
 
 	/* Reset internal state */
 	if (bid == 0) {
-		/* Clean up old measurements */
-		memset(&lchan->meas, 0x00, sizeof(lchan->meas));
-
 		*first_fn = fn;
 		*mask = 0x00;
 	}
@@ -74,10 +71,8 @@
 	/* Update mask */
 	*mask |= (1 << bid);
 
-	/* Update mask and RSSI */
-	lchan->meas.rssi_sum += rssi;
-	lchan->meas.toa256_sum += toa256;
-	lchan->meas.num++;
+	/* Store the measurements */
+	sched_trx_meas_push(lchan, meas);
 
 	/* Copy burst to end of buffer of 8 bursts */
 	offset = buffer + bid * 116 + 464;
@@ -88,6 +83,9 @@
 	if (bid != 3)
 		return 0;
 
+	/* Calculate AVG of the measurements */
+	sched_trx_meas_avg(lchan, 8);
+
 	/* Check for complete set of bursts */
 	if ((*mask & 0xf) != 0xf) {
 		LOGP(DSCHD, LOGL_ERROR, "Received incomplete (%s) traffic frame at "
@@ -150,9 +148,14 @@
 		n_errors, false, true);
 
 bfi:
-	/* Didn't try to decode */
-	if (n_errors < 0)
+	/* Didn't try to decode, fake measurements */
+	if (n_errors < 0) {
+		lchan->meas_avg = (struct trx_meas_set) {
+			.toa256 = 0,
+			.rssi = -110,
+		};
 		n_errors = 116 * 4;
+	}
 
 	/* BFI is not applicable in signalling mode */
 	if (lchan->tch_mode == GSM48_CMODE_SIGN)
diff --git a/src/host/trxcon/sched_lchan_tchh.c b/src/host/trxcon/sched_lchan_tchh.c
index 8288670..599dd20 100644
--- a/src/host/trxcon/sched_lchan_tchh.c
+++ b/src/host/trxcon/sched_lchan_tchh.c
@@ -2,7 +2,7 @@
  * OsmocomBB <-> SDR connection bridge
  * TDMA scheduler: handlers for DL / UL bursts on logical channels
  *
- * (C) 2018 by Vadim Yanitskiy <axilirator at gmail.com>
+ * (C) 2018-2020 by Vadim Yanitskiy <axilirator at gmail.com>
  * (C) 2018 by Harald Welte <laforge at gnumonks.org>
  *
  * All Rights Reserved
@@ -200,7 +200,7 @@
 
 int rx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid,
-	sbit_t *bits, int8_t rssi, int16_t toa256)
+	sbit_t *bits, const struct trx_meas_set *meas)
 {
 	const struct trx_lchan_desc *lchan_desc;
 	int n_errors = -1, n_bits_total, rc;
@@ -234,16 +234,8 @@
 	/* Update mask */
 	*mask |= (1 << bid);
 
-	/**
-	 * FIXME: properly update measurements
-	 *
-	 * Since TCH/H channel is using block-diagonal interleaving,
-	 * a single burst may carry 57 bits of one encoded frame,
-	 * and 57 bits of another. This should be taken into account.
-	 */
-	lchan->meas.rssi_sum += rssi;
-	lchan->meas.toa256_sum += toa256;
-	lchan->meas.num++;
+	/* Store the measurements */
+	sched_trx_meas_push(lchan, meas);
 
 	/* Copy burst to the end of buffer of 6 bursts */
 	offset = buffer + bid * 116 + 464;
@@ -303,6 +295,9 @@
 			"fn=%u on %s (rc=%d)\n", burst_mask2str(mask, 6),
 			fn, lchan_desc->name, rc);
 
+		/* Calculate AVG of the measurements (assuming 4 bursts) */
+		sched_trx_meas_avg(lchan, 4);
+
 		/* Send BFI */
 		goto bfi;
 	} else if (rc == GSM_MACBLOCK_LEN) {
@@ -313,6 +308,9 @@
 		lchan->rx_first_fn = sched_tchh_block_dl_first_fn(lchan->type,
 			fn, true); /* FACCH/H */
 
+		/* Calculate AVG of the measurements (FACCH/H takes 6 bursts) */
+		sched_trx_meas_avg(lchan, 6);
+
 		/* FACCH/H received, forward to the higher layers */
 		sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN,
 			n_errors, false, false);
@@ -322,6 +320,9 @@
 	} else {
 		/* A good TCH frame received */
 		l2_len = rc;
+
+		/* Calculate AVG of the measurements (traffic takes 4 bursts) */
+		sched_trx_meas_avg(lchan, 4);
 	}
 
 	/* Calculate TDMA frame number of the first burst */
@@ -341,9 +342,14 @@
 	*mask = *mask << 2;
 
 bfi:
-	/* Didn't try to decode */
-	if (n_errors < 0)
+	/* Didn't try to decode, fake measurements */
+	if (n_errors < 0) {
+		lchan->meas_avg = (struct trx_meas_set) {
+			.toa256 = 0,
+			.rssi = -110,
+		};
 		n_errors = 116 * 2;
+	}
 
 	/* Calculate TDMA frame number of the first burst */
 	lchan->rx_first_fn = sched_tchh_block_dl_first_fn(lchan->type,
diff --git a/src/host/trxcon/sched_lchan_xcch.c b/src/host/trxcon/sched_lchan_xcch.c
index 34fe5ce..aa8d4dd 100644
--- a/src/host/trxcon/sched_lchan_xcch.c
+++ b/src/host/trxcon/sched_lchan_xcch.c
@@ -2,7 +2,7 @@
  * OsmocomBB <-> SDR connection bridge
  * TDMA scheduler: handlers for DL / UL bursts on logical channels
  *
- * (C) 2017 by Vadim Yanitskiy <axilirator at gmail.com>
+ * (C) 2017-2020 by Vadim Yanitskiy <axilirator at gmail.com>
  *
  * All Rights Reserved
  *
@@ -42,7 +42,7 @@
 
 int rx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint32_t fn, uint8_t bid,
-	sbit_t *bits, int8_t rssi, int16_t toa256)
+	sbit_t *bits, const struct trx_meas_set *meas)
 {
 	const struct trx_lchan_desc *lchan_desc;
 	uint8_t l2[GSM_MACBLOCK_LEN], *mask;
@@ -61,9 +61,6 @@
 
 	/* Reset internal state */
 	if (bid == 0) {
-		/* Clean up old measurements */
-		memset(&lchan->meas, 0x00, sizeof(lchan->meas));
-
 		*first_fn = fn;
 		*mask = 0x0;
 	}
@@ -71,10 +68,8 @@
 	/* Update mask */
 	*mask |= (1 << bid);
 
-	/* Update measurements */
-	lchan->meas.rssi_sum += rssi;
-	lchan->meas.toa256_sum += toa256;
-	lchan->meas.num++;
+	/* Store the measurements */
+	sched_trx_meas_push(lchan, meas);
 
 	/* Copy burst to buffer of 4 bursts */
 	offset = buffer + bid * 116;
@@ -85,6 +80,9 @@
 	if (bid != 3)
 		return 0;
 
+	/* Calculate AVG of the measurements */
+	sched_trx_meas_avg(lchan, 4);
+
 	/* Check for complete set of bursts */
 	if ((*mask & 0xf) != 0xf) {
 		LOGP(DSCHD, LOGL_ERROR, "Received incomplete (%s) data frame at "
diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c
index b7914b6..081e3ca 100644
--- a/src/host/trxcon/sched_trx.c
+++ b/src/host/trxcon/sched_trx.c
@@ -613,7 +613,7 @@
 
 int sched_trx_handle_rx_burst(struct trx_instance *trx, uint8_t tn,
 	uint32_t burst_fn, sbit_t *bits, uint16_t nbits,
-	int8_t rssi, int16_t toa256)
+	const struct trx_meas_set *meas)
 {
 	struct trx_lchan_state *lchan;
 	const struct trx_frame *frame;
@@ -674,7 +674,7 @@
 				sched_trx_a5_burst_dec(lchan, fn, bits);
 
 			/* Put burst to handler */
-			handler(trx, ts, lchan, fn, bid, bits, rssi, toa256);
+			handler(trx, ts, lchan, fn, bid, bits, meas);
 		}
 
 next_frame:
@@ -710,3 +710,50 @@
 
 	return 0;
 }
+
+#define MEAS_HIST_FIRST(hist) \
+	(&hist->buf[0])
+#define MEAS_HIST_LAST(hist) \
+	(MEAS_HIST_FIRST(hist) + ARRAY_SIZE(hist->buf) - 1)
+
+/* Add a new set of measurements to the history */
+void sched_trx_meas_push(struct trx_lchan_state *lchan, const struct trx_meas_set *meas)
+{
+	struct trx_lchan_meas_hist *hist = &lchan->meas_hist;
+
+	/* Find a new position where to store the measurements */
+	if (hist->head == MEAS_HIST_LAST(hist) || hist->head == NULL)
+		hist->head = MEAS_HIST_FIRST(hist);
+	else
+		hist->head++;
+
+	*hist->head = *meas;
+}
+
+/* Calculate the AVG of n measurements from the history */
+void sched_trx_meas_avg(struct trx_lchan_state *lchan, unsigned int n)
+{
+	struct trx_lchan_meas_hist *hist = &lchan->meas_hist;
+	struct trx_meas_set *meas = hist->head;
+	int toa256_sum = 0;
+	int rssi_sum = 0;
+	int i;
+
+	OSMO_ASSERT(n > 0 && n <= ARRAY_SIZE(hist->buf));
+	OSMO_ASSERT(meas != NULL);
+
+	/* Traverse backwards up to n entries, calculate the sum */
+	for (i = 0; i < n; i++) {
+		toa256_sum += meas->toa256;
+		rssi_sum += meas->rssi;
+
+		if (meas == MEAS_HIST_FIRST(hist))
+			meas = MEAS_HIST_LAST(hist);
+		else
+			meas--;
+	}
+
+	/* Calculate the AVG */
+	lchan->meas_avg.toa256 = toa256_sum / n;
+	lchan->meas_avg.rssi = rssi_sum / n;
+}
diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h
index 13fc678..a4fc90f 100644
--- a/src/host/trxcon/sched_trx.h
+++ b/src/host/trxcon/sched_trx.h
@@ -40,6 +40,7 @@
 
 /* Forward declaration to avoid mutual include */
 struct trx_lchan_state;
+struct trx_meas_set;
 struct trx_instance;
 struct trx_ts;
 
@@ -99,7 +100,7 @@
 typedef int trx_lchan_rx_func(struct trx_instance *trx,
 	struct trx_ts *ts, struct trx_lchan_state *lchan,
 	uint32_t fn, uint8_t bid, sbit_t *bits,
-	int8_t rssi, int16_t toa256);
+	const struct trx_meas_set *meas);
 
 typedef int trx_lchan_tx_func(struct trx_instance *trx,
 	struct trx_ts *ts, struct trx_lchan_state *lchan,
@@ -157,6 +158,19 @@
 	const struct trx_frame *frames;
 };
 
+struct trx_meas_set {
+	/*! \brief ToA256 (Timing of Arrival, 1/256 of a symbol) */
+	int16_t toa256;
+	/*! \brief RSSI (Received Signal Strength Indication) */
+	int8_t rssi;
+};
+
+/* Simple ring buffer (up to 8 unique measurements) */
+struct trx_lchan_meas_hist {
+	struct trx_meas_set buf[8];
+	struct trx_meas_set *head;
+};
+
 /* States each channel on a multiframe */
 struct trx_lchan_state {
 	/*! \brief Channel type */
@@ -190,14 +204,10 @@
 	/*! \brief pending FACCH/H blocks on Uplink */
 	uint8_t ul_facch_blocks;
 
-	struct {
-		/*! \brief Number of measurements */
-		unsigned int num;
-		/*! \brief Sum of RSSI values */
-		float rssi_sum;
-		/*! \brief Sum of TOA values */
-		int32_t toa256_sum;
-	} meas;
+	/*! \brief Downlink measurements history */
+	struct trx_lchan_meas_hist meas_hist;
+	/*! \brief AVG measurements of the last received block */
+	struct trx_meas_set meas_avg;
 
 	/*! \brief SACCH state */
 	struct {
@@ -347,7 +357,7 @@
 
 int sched_trx_handle_rx_burst(struct trx_instance *trx, uint8_t tn,
 	uint32_t burst_fn, sbit_t *bits, uint16_t nbits,
-	int8_t rssi, int16_t toa256);
+	const struct trx_meas_set *meas);
 int sched_trx_handle_tx_burst(struct trx_instance *trx,
 	struct trx_ts *ts, struct trx_lchan_state *lchan,
 	uint32_t fn, ubit_t *bits);
@@ -381,3 +391,7 @@
 	sched_tchh_block_map_fn(chan, fn, ul, 1, 1)
 #define sched_tchh_facch_end(chan, fn, ul) \
 	sched_tchh_block_map_fn(chan, fn, ul, 1, 0)
+
+/* Measurement history */
+void sched_trx_meas_push(struct trx_lchan_state *lchan, const struct trx_meas_set *meas);
+void sched_trx_meas_avg(struct trx_lchan_state *lchan, unsigned int n);
diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index 55d7034..343c6ca 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -555,6 +555,7 @@
 static int trx_data_rx_cb(struct osmo_fd *ofd, unsigned int what)
 {
 	struct trx_instance *trx = ofd->data;
+	struct trx_meas_set meas;
 	uint8_t buf[256];
 	sbit_t bits[148];
 	int8_t rssi, tn;
@@ -595,8 +596,14 @@
 	LOGP(DTRXD, LOGL_DEBUG, "RX burst tn=%u fn=%u rssi=%d toa=%d\n",
 		tn, fn, rssi, toa256);
 
+	/* Group the measurements together */
+	meas = (struct trx_meas_set) {
+		.toa256 = toa256,
+		.rssi = rssi,
+	};
+
 	/* Poke scheduler */
-	sched_trx_handle_rx_burst(trx, tn, fn, bits, 148, rssi, toa256);
+	sched_trx_handle_rx_burst(trx, tn, fn, bits, 148, &meas);
 
 	/* Correct local clock counter */
 	if (fn % 51 == 0)

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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I211ee3314f0a284112a4deddc0e93028f4a27cef
Gerrit-Change-Number: 17350
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200308/63006813/attachment.htm>


More information about the gerrit-log mailing list