Change in osmocom-bb[master]: trxcon/scheduler: fix RSSI -> RX level conversion

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
Fri Jan 4 16:33:12 UTC 2019


Vadim Yanitskiy has submitted this change and it was merged. ( https://gerrit.osmocom.org/11157 )

Change subject: trxcon/scheduler: fix RSSI -> RX level conversion
......................................................................

trxcon/scheduler: fix RSSI -> RX level conversion

Due to a mistake, average RSSI value of received bursts was not
converted to GSM RX level (range 0..63), so trxcon has been
sending incorrect values to the higher layers.

Let's fix this, and also prevent possible division by zero.

Change-Id: Id4659de899411ec1ba1718fdcb40aec562dbfd65
---
M src/host/trxcon/sched_lchan_common.c
1 file changed, 11 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Max: Looks good to me, but someone else must approve
  Vadim Yanitskiy: Looks good to me, approved



diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c
index 95e496b..540a57f 100644
--- a/src/host/trxcon/sched_lchan_common.c
+++ b/src/host/trxcon/sched_lchan_common.c
@@ -87,6 +87,7 @@
 {
 	const struct trx_lchan_desc *lchan_desc;
 	struct l1ctl_info_dl dl_hdr;
+	int dbm_avg;
 
 	/* Set up pointers */
 	lchan_desc = &trx_lchan_desc[lchan->type];
@@ -96,9 +97,18 @@
 	dl_hdr.link_id = lchan_desc->link_id;
 	dl_hdr.band_arfcn = htons(trx->band_arfcn);
 	dl_hdr.frame_nr = htonl(lchan->rx_first_fn);
-	dl_hdr.rx_level = -(lchan->meas.rssi_sum / lchan->meas.rssi_num);
 	dl_hdr.num_biterr = bit_error_count;
 
+	/* Convert average RSSI to RX level */
+	if (lchan->meas.rssi_num) {
+		/* RX level: 0 .. 63 in typical GSM notation (dBm + 110) */
+		dbm_avg = lchan->meas.rssi_sum / lchan->meas.rssi_num;
+		dl_hdr.rx_level = dbm2rxlev(dbm_avg);
+	} else {
+		/* No measurements, assuming the worst */
+		dl_hdr.rx_level = 0;
+	}
+
 	/* FIXME: set proper values */
 	dl_hdr.snr = 0;
 

-- 
To view, visit https://gerrit.osmocom.org/11157
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: Id4659de899411ec1ba1718fdcb40aec562dbfd65
Gerrit-Change-Number: 11157
Gerrit-PatchSet: 3
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190104/5af52894/attachment.htm>


More information about the gerrit-log mailing list