[PATCH] osmo-pcu[master]: Use qbit-TA to update Timing Advance

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

Max gerrit-no-reply at lists.osmocom.org
Mon Jul 18 15:31:03 UTC 2016


Hello Harald Welte, Jenkins Builder, Holger Freyther,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/544

to look at the new patch set (#4).

Use qbit-TA to update Timing Advance

Separate qbit-TA to TA conversion into separate function and use it for
computing and updating Timing Advance.

Note: the code was tested with TA=0 only to make sure it does not
introduce regressions.

Change-Id: I96fdbb20b09fb85fdd9fb6dcf3c25f6bee7f80e4
Fixes: OS#1531
---
M src/bts.cpp
M src/osmo-bts-litecell15/lc15_l1_if.c
M src/osmo-bts-sysmo/sysmo_l1_if.c
M src/pcu_l1_if.cpp
M src/pcu_l1_if.h
5 files changed, 45 insertions(+), 49 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/44/544/4

diff --git a/src/bts.cpp b/src/bts.cpp
index c53c92c..bc81b45 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -477,7 +477,7 @@
 	int plen;
 	uint8_t usf = 7;
 	uint8_t tsc;
-	uint16_t ta;
+	uint8_t ta = qta2ta(qta);
 
 	rach_frame();
 
@@ -492,12 +492,6 @@
 			"but we force two phase access\n");
 		sb = 1;
 	}
-	if (qta < 0)
-		qta = 0;
-	if (qta > 252)
-		qta = 252;
-
-	ta = qta >> 2;
 
 	if (sb) {
 		rc = sba()->alloc(&trx_no, &ts_no, &sb_fn, ta);
diff --git a/src/osmo-bts-litecell15/lc15_l1_if.c b/src/osmo-bts-litecell15/lc15_l1_if.c
index 2cda5b8..1652bf1 100644
--- a/src/osmo-bts-litecell15/lc15_l1_if.c
+++ b/src/osmo-bts-litecell15/lc15_l1_if.c
@@ -221,6 +221,8 @@
 			data_ind->msgUnitParam.u8Size-1);
 
 	get_meas(&meas, &data_ind->measParam);
+	set_tbf_ta("PH-DATA", data_ind->u32Fn, fl1h->trx_no, data_ind->u8Tn,
+		   qta2ta(meas.bto));
 
 	switch (data_ind->sapi) {
 	case GsmL1_Sapi_Pdtch:
@@ -252,31 +254,12 @@
 
 static int handle_ph_ra_ind(struct lc15l1_hdl *fl1h, GsmL1_PhRaInd_t *ra_ind)
 {
-	uint8_t acc_delay;
-
 	if (ra_ind->measParam.fLinkQuality < MIN_QUAL_RACH)
 		return 0;
 
 	DEBUGP(DL1IF, "Rx PH-RA.ind");
-
-	/* check for under/overflow / sign */
-	if (ra_ind->measParam.i16BurstTiming < 0)
-		acc_delay = 0;
-	else
-		acc_delay = ra_ind->measParam.i16BurstTiming >> 2;
-
-	LOGP(DL1IF, LOGL_NOTICE, "got (P)RACH request, TA = %u (ignored)\n",
-		acc_delay);
-
-#warning "The (P)RACH request is just dropped here"
-
-#if 0
-	if (acc_delay > bts->max_ta) {
-		LOGP(DL1C, LOGL_INFO, "ignoring RACH request %u > max_ta(%u)\n",
-		     acc_delay, btsb->max_ta);
-		return 0;
-	}
-#endif
+	set_tbf_ta("PH-RA", ra_ind->u32Fn, fl1h->trx_no, ra_ind->u8Tn,
+		   qta2ta(ra_ind->measParam.i16BurstTiming));
 
 	return 0;
 }
diff --git a/src/osmo-bts-sysmo/sysmo_l1_if.c b/src/osmo-bts-sysmo/sysmo_l1_if.c
index c072c1a..60c2d27 100644
--- a/src/osmo-bts-sysmo/sysmo_l1_if.c
+++ b/src/osmo-bts-sysmo/sysmo_l1_if.c
@@ -206,6 +206,8 @@
 			data_ind->msgUnitParam.u8Size-1);
 
 	get_meas(&meas, &data_ind->measParam);
+	set_tbf_ta("PH-DATA", data_ind->u32Fn, fl1h->trx_no, data_ind->u8Tn,
+		   qta2ta(meas.bto));
 
 	switch (data_ind->sapi) {
 	case GsmL1_Sapi_Pdtch:
@@ -237,33 +239,14 @@
 
 static int handle_ph_ra_ind(struct femtol1_hdl *fl1h, GsmL1_PhRaInd_t *ra_ind)
 {
-	uint8_t acc_delay;
-
 	pcu_rx_ra_time(ra_ind->u16Arfcn, ra_ind->u32Fn, ra_ind->u8Tn);
 
 	if (ra_ind->measParam.fLinkQuality < MIN_QUAL_RACH)
 		return 0;
 
 	DEBUGP(DL1IF, "Rx PH-RA.ind");
-
-	/* check for under/overflow / sign */
-	if (ra_ind->measParam.i16BurstTiming < 0)
-		acc_delay = 0;
-	else
-		acc_delay = ra_ind->measParam.i16BurstTiming >> 2;
-
-	LOGP(DL1IF, LOGL_NOTICE, "got (P)RACH request, TA = %u (ignored)\n",
-		acc_delay);
-
-#warning "The (P)RACH request is just dropped here"
-
-#if 0
-	if (acc_delay > bts->max_ta) {
-		LOGP(DL1C, LOGL_INFO, "ignoring RACH request %u > max_ta(%u)\n",
-		     acc_delay, btsb->max_ta);
-		return 0;
-	}
-#endif
+	set_tbf_ta("PH-RA", ra_ind->u32Fn, fl1h->trx_no, ra_ind->u8Tn,
+		   qta2ta(ra_ind->measParam.i16BurstTiming));
 
 	return 0;
 }
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 790789c..e9b5901 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -31,6 +31,7 @@
 #include <osmocom/core/select.h>
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/gsmtap_util.h>
+#include <osmocom/gsm/protocol/gsm_04_08.h>
 #include <osmocom/core/gsmtap.h>
 }
 
@@ -302,6 +303,25 @@
 	return rc;
 }
 
+void set_tbf_ta(const char *p, uint32_t fn, uint8_t trx_no, uint8_t ts,
+		uint8_t ta)
+{
+	struct gprs_rlcmac_bts *bts_data = bts_main_data();
+	BTS *bts = bts_data->bts;
+	struct gprs_rlcmac_ul_tbf *tbf = bts->ul_tbf_by_poll_fn(fn, trx_no, ts);
+	if(!tbf)
+		LOGP(DL1IF, LOGL_DEBUG, "[%s] update TA = %u ignored due to "
+		     "unknown UL TBF on TRX = %d, TS = %d, FN = %d\n",
+		     p, ta, trx_no, ts, fn);
+	else
+		if (tbf->ta() != ta) {
+			LOGP(DL1IF, LOGL_INFO, "[%s] Updating TA %u -> %u on "
+			     "TRX = %d, TS = %d, FN = %d\n",
+			     p, tbf->ta(), ta, trx_no, ts, fn);
+			tbf->set_ta(ta);
+		}
+}
+
 static int pcu_rx_rach_ind(struct gsm_pcu_if_rach_ind *rach_ind)
 {
 	int rc = 0;
diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h
index 865c833..c4588af 100644
--- a/src/pcu_l1_if.h
+++ b/src/pcu_l1_if.h
@@ -21,6 +21,7 @@
 #define PCU_L1_IF_H
 
 #include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -29,10 +30,25 @@
 #include <osmocom/core/timer.h>
 #include <osmocom/core/bitvec.h>
 #include <osmocom/gsm/gsm_utils.h>
+
+struct gprs_rlcmac_bts;
+
+void set_tbf_ta(const char *p, uint32_t fn, uint8_t trx_no, uint8_t ts,
+		uint8_t ta);
+
 #ifdef __cplusplus
 }
 #endif
 
+static inline uint8_t qta2ta(int16_t qta)
+{
+	if (qta < 0)
+		return 0;
+	if (qta > 252)
+		qta = 252;
+	return qta >> 2;
+}
+
 /*
  * L1 Measurement values
  */

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I96fdbb20b09fb85fdd9fb6dcf3c25f6bee7f80e4
Gerrit-PatchSet: 4
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list