[MERGED] osmo-bts[master]: L1SAP: Increase resolution of reported burst timing

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Feb 27 19:45:42 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: L1SAP: Increase resolution of reported burst timing
......................................................................


L1SAP: Increase resolution of reported burst timing

Before this patch we had:
* osmo-bts-trx internally using 1/256th bit/symbol period
* osmo-bts-sysmo internally using 1/4 bit/smbol period
* PCU interface using 1/4
* L1SAP interface using 1/4
* measurement processing code on top of L1SAP using 1/256

So for sysmo/lc15/octphy we are not loosing resolution, but for
osmo-bts-trx we're arbitrarily reducing the resolution via L1SAP
only then to compute with higher resolution again.

Let's change L1SAP to use 1/256 bits and hence not loose any resolution.
This requires a corresponding change in libosmocore for l1sap.h, which
is found in Change-Id Ibb58113c2819fe2d6d23ecbcfb8b3fce4055025d

Change-Id: If9b0f617845ba6c4aa47969f521734388197c9a7
---
M include/osmo-bts/scheduler_backend.h
M src/common/l1sap.c
M src/common/scheduler.c
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-virtual/l1_if.c
8 files changed, 19 insertions(+), 19 deletions(-)

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



diff --git a/include/osmo-bts/scheduler_backend.h b/include/osmo-bts/scheduler_backend.h
index 5f11f9b..dbd9319 100644
--- a/include/osmo-bts/scheduler_backend.h
+++ b/include/osmo-bts/scheduler_backend.h
@@ -51,7 +51,7 @@
 int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
 			       enum trx_chan_type chan, uint8_t *l2,
 			       uint8_t l2_len, float rssi,
-			       int16_t ta_offs_qbits, int16_t link_qual_cb,
+			       int16_t ta_offs_256bits, int16_t link_qual_cb,
 			       uint16_t ber10k,
 			       enum osmo_ph_pres_info_type presence_info);
 
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index e095417..330b40a 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -512,8 +512,8 @@
 	}
 
 	DEBUGPFN(DL1P, info_meas_ind->fn,
-		"%s MPH_INFO meas ind, ta_offs_qbits=%d, ber10k=%d, inv_rssi=%u\n",
-		gsm_lchan_name(lchan), info_meas_ind->ta_offs_qbits,
+		"%s MPH_INFO meas ind, ta_offs_256bits=%d, ber10k=%d, inv_rssi=%u\n",
+		gsm_lchan_name(lchan), info_meas_ind->ta_offs_256bits,
 		info_meas_ind->ber10k, info_meas_ind->inv_rssi);
 
 	/* in the GPRS case we are not interested in measurement
@@ -522,13 +522,13 @@
 		return 0;
 
 	memset(&ulm, 0, sizeof(ulm));
-	ulm.ta_offs_256bits = info_meas_ind->ta_offs_qbits*(256/4);
+	ulm.ta_offs_256bits = info_meas_ind->ta_offs_256bits;
 	ulm.ber10k = info_meas_ind->ber10k;
 	ulm.inv_rssi = info_meas_ind->inv_rssi;
 	ulm.is_sub = info_meas_ind->is_sub;
 
 	/* we assume that symbol period is 1 bit: */
-	set_ms_to_data(lchan, info_meas_ind->ta_offs_qbits / 4, true);
+	set_ms_to_data(lchan, info_meas_ind->ta_offs_256bits / 256, true);
 
 	lchan_new_ul_meas(lchan, &ulm, info_meas_ind->fn);
 
@@ -1058,7 +1058,7 @@
 			pcu_tx_data_ind(&trx->ts[tn], PCU_IF_SAPI_PTCCH, fn,
 					0 /* ARFCN */, L1SAP_FN2PTCCHBLOCK(fn),
 					data, len, rssi, data_ind->ber10k,
-					data_ind->ta_offs_qbits,
+					data_ind->ta_offs_256bits/64,
 					data_ind->lqual_cb);
 		} else {
 			/* drop incomplete UL block */
@@ -1067,7 +1067,7 @@
 			/* PDTCH / PACCH frame handling */
 			pcu_tx_data_ind(&trx->ts[tn], PCU_IF_SAPI_PDTCH, fn, 0 /* ARFCN */,
 					L1SAP_FN2MACBLOCK(fn), data, len, rssi, data_ind->ber10k,
-					data_ind->ta_offs_qbits, data_ind->lqual_cb);
+					data_ind->ta_offs_256bits/64, data_ind->lqual_cb);
 		}
 		return 0;
 	}
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index edd99d2..8c9d30d 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -340,7 +340,7 @@
 int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
 			       enum trx_chan_type chan, uint8_t *l2,
 			       uint8_t l2_len, float rssi,
-			       int16_t ta_offs_qbits, int16_t link_qual_cb,
+			       int16_t ta_offs_256bits, int16_t link_qual_cb,
 			       uint16_t ber10k,
 			       enum osmo_ph_pres_info_type presence_info)
 {
@@ -359,7 +359,7 @@
 	l1sap->u.data.fn = fn;
 	l1sap->u.data.rssi = (int8_t) (rssi);
 	l1sap->u.data.ber10k = ber10k;
-	l1sap->u.data.ta_offs_qbits = ta_offs_qbits;
+	l1sap->u.data.ta_offs_256bits = ta_offs_256bits;
 	l1sap->u.data.lqual_cb = link_qual_cb;
 	l1sap->u.data.pdch_presence_info = presence_info;
 	msg->l2h = msgb_put(msg, l2_len);
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index 1b83fbd..9e122cd 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -907,7 +907,7 @@
 		PRIM_OP_INDICATION, NULL);
 	l1sap.u.info.type = PRIM_INFO_MEAS;
 	l1sap.u.info.u.meas_ind.chan_nr = chan_nr;
-	l1sap.u.info.u.meas_ind.ta_offs_qbits = m->i16BurstTiming;
+	l1sap.u.info.u.meas_ind.ta_offs_256bits = m->i16BurstTiming*64;
 	l1sap.u.info.u.meas_ind.ber10k = (unsigned int) (m->fBer * 10000);
 	l1sap.u.info.u.meas_ind.inv_rssi = (uint8_t) (m->fRssi * -1);
 	l1sap.u.info.u.meas_ind.fn = fn;
@@ -983,7 +983,7 @@
 	l1sap->u.data.rssi = rssi;
 	if (!pcu_direct) {
 		l1sap->u.data.ber10k = data_ind->measParam.fBer * 10000;
-		l1sap->u.data.ta_offs_qbits = data_ind->measParam.i16BurstTiming;
+		l1sap->u.data.ta_offs_256bits = data_ind->measParam.i16BurstTiming*64;
 		l1sap->u.data.lqual_cb = data_ind->measParam.fLinkQuality * 10;
 	}
 	return l1sap_up(trx, l1sap);
diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index 535ac8b..e94b642 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -876,7 +876,7 @@
 	/* Update Timing offset for valid radio block */
 	if (data_len != 0) {
 		/* burst timing in 1x */
-		l1sap.u.info.u.meas_ind.ta_offs_qbits = m->sBurstTiming;
+		l1sap.u.info.u.meas_ind.ta_offs_256bits = m->sBurstTiming4x*64;
 	} else {
 		/* FIXME, In current implementation, OCTPHY would send DATA_IND
 		 * for all radio blocks (valid or invalid) But timing offset
@@ -884,7 +884,7 @@
 		 * counter to accumulate Timing offset.. even we add zero for
 		 * invalid block.. timing offset average calucation would not
 		 * correct. */
-		l1sap.u.info.u.meas_ind.ta_offs_qbits = 0;
+		l1sap.u.info.u.meas_ind.ta_offs_256bits = 0;
 	}
 
 	l1sap.u.info.u.meas_ind.ber10k = oct_meas2ber10k(m);
@@ -1145,7 +1145,7 @@
 	l1sap->u.data.ber10k = oct_meas2ber10k(&data_ind->MeasurementInfo);
 
 	/* burst timing  in 1x but PCU is expecting 4X */
-	l1sap->u.data.ta_offs_qbits = data_ind->MeasurementInfo.sBurstTiming4x;
+	l1sap->u.data.ta_offs_256bits = data_ind->MeasurementInfo.sBurstTiming4x*64;
 	snr = data_ind->MeasurementInfo.sSNRDb;
 	/* FIXME: better converion formulae for SnR -> C / I?
 	l1sap->u.data.lqual_cb = (snr ? snr : (snr - 65536)) * 10 / 256;
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 08f584b..46db69c 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -904,7 +904,7 @@
 		PRIM_OP_INDICATION, NULL);
 	l1sap.u.info.type = PRIM_INFO_MEAS;
 	l1sap.u.info.u.meas_ind.chan_nr = chan_nr;
-	l1sap.u.info.u.meas_ind.ta_offs_qbits = m->i16BurstTiming;
+	l1sap.u.info.u.meas_ind.ta_offs_256bits = m->i16BurstTiming * 64;
 	l1sap.u.info.u.meas_ind.ber10k = (unsigned int) (m->fBer * 10000);
 	l1sap.u.info.u.meas_ind.inv_rssi = (uint8_t) (m->fRssi * -1);
 	l1sap.u.info.u.meas_ind.fn = fn;
@@ -965,7 +965,7 @@
 	l1sap->u.data.rssi = (int8_t) (data_ind->measParam.fRssi);
 	if (!pcu_direct) { /* FIXME: if pcu_direct=1, then this is not set, what to do in pcu_tx_data_ind() in this case ?*/
 		l1sap->u.data.ber10k = data_ind->measParam.fBer * 10000;
-		l1sap->u.data.ta_offs_qbits = data_ind->measParam.i16BurstTiming;
+		l1sap->u.data.ta_offs_256bits = data_ind->measParam.i16BurstTiming * 64;
 		l1sap->u.data.lqual_cb = data_ind->measParam.fLinkQuality * 10;
 	}
 	/* copy data from L1 primitive to L1SAP primitive */
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 4d2558c..a8fb401 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -495,7 +495,7 @@
 		PRIM_OP_INDICATION, NULL);
 	l1sap->u.info.type = PRIM_INFO_MEAS;
 	l1sap->u.info.u.meas_ind.chan_nr = chan_nr;
-	l1sap->u.info.u.meas_ind.ta_offs_qbits = toa256/64;
+	l1sap->u.info.u.meas_ind.ta_offs_256bits = toa256;
 	l1sap->u.info.u.meas_ind.ber10k = (unsigned int) (ber * 10000);
 	l1sap->u.info.u.meas_ind.inv_rssi = (uint8_t) (rssi * -1);
 	l1sap->u.info.u.meas_ind.fn = fn;
diff --git a/src/osmo-bts-virtual/l1_if.c b/src/osmo-bts-virtual/l1_if.c
index 6904fe6..d0c368e 100644
--- a/src/osmo-bts-virtual/l1_if.c
+++ b/src/osmo-bts-virtual/l1_if.c
@@ -145,7 +145,7 @@
 		l1sap.u.data.fn = fn;
 		l1sap.u.data.rssi = 0; /* Radio Signal Strength Indicator. Best -> 0 */
 		l1sap.u.data.ber10k = 0; /* Bit Error Rate in 0.01%. Best -> 0 */
-		l1sap.u.data.ta_offs_qbits = 0; /* Burst time of arrival in quarter bits. Probably used for Timing Advance calc. Best -> 0 */
+		l1sap.u.data.ta_offs_256bits = 0; /* Burst time of arrival in quarter bits. Probably used for Timing Advance calc. Best -> 0 */
 		l1sap.u.data.lqual_cb = 10 * signal_dbm; /* Link quality in centiBel = 10 * dB. */
 		l1sap.u.data.pdch_presence_info = PRES_INFO_BOTH;
 		l1if_process_meas_res(pinst->trx, timeslot, fn, chan_nr, 0, 0, 0, 0);
@@ -303,7 +303,7 @@
 		PRIM_OP_INDICATION, NULL);
 	l1sap->u.info.type = PRIM_INFO_MEAS;
 	l1sap->u.info.u.meas_ind.chan_nr = chan_nr;
-	l1sap->u.info.u.meas_ind.ta_offs_qbits = (int16_t)(ta*4);
+	l1sap->u.info.u.meas_ind.ta_offs_256bits = (int16_t)(ta*4);
 	l1sap->u.info.u.meas_ind.ber10k = (unsigned int) (ber * 10000);
 	l1sap->u.info.u.meas_ind.inv_rssi = (uint8_t) (rssi * -1);
 	l1sap->u.info.u.meas_ind.fn = fn;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If9b0f617845ba6c4aa47969f521734388197c9a7
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder


More information about the gerrit-log mailing list