[PATCH] osmo-pcu[master]: Handle qbit-TA for PRACH

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
Sat Jul 16 13:12:39 UTC 2016


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

Handle qbit-TA for PRACH

Separate qbit-TA to TA conversion into separate function and use it for
computing Timing Advance based on PRACH requests.

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


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

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-sysmo/sysmo_l1_if.c b/src/osmo-bts-sysmo/sysmo_l1_if.c
index c072c1a..8e32b47 100644
--- a/src/osmo-bts-sysmo/sysmo_l1_if.c
+++ b/src/osmo-bts-sysmo/sysmo_l1_if.c
@@ -1,4 +1,4 @@
-
+#include <stdbool.h>
 #include <string.h>
 #include <errno.h>
 
@@ -13,6 +13,8 @@
 #include <sysmo_l1_if.h>
 #include <gprs_debug.h>
 #include <pcu_l1_if.h>
+#include <pcu_vty_functions.h>
+#include <bts.h>
 
 extern void *tall_pcu_ctx;
 
@@ -237,7 +239,7 @@
 
 static int handle_ph_ra_ind(struct femtol1_hdl *fl1h, GsmL1_PhRaInd_t *ra_ind)
 {
-	uint8_t acc_delay;
+	uint8_t acc_delay = qta2ta(ra_ind->measParam.i16BurstTiming);
 
 	pcu_rx_ra_time(ra_ind->u16Arfcn, ra_ind->u32Fn, ra_ind->u8Tn);
 
@@ -245,17 +247,15 @@
 		return 0;
 
 	DEBUGP(DL1IF, "Rx PH-RA.ind");
+	bool t = set_tbf_ta(bts_main_data(), ra_ind->u32Fn, fl1h->trx_no,
+			    ra_ind->u8Tn, acc_delay);
 
-	/* check for under/overflow / sign */
-	if (ra_ind->measParam.i16BurstTiming < 0)
-		acc_delay = 0;
+	if(t)
+		LOGP(DL1IF, LOGL_NOTICE, "got (P)RACH request, TA = %u updated\n",
+		     acc_delay);
 	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"
+		LOGP(DL1IF, LOGL_NOTICE, "got (P)RACH request, TA = %u (ignored"
+		     " because of unknown UL TBF)\n", acc_delay);
 
 #if 0
 	if (acc_delay > bts->max_ta) {
diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h
index 865c833..208d89d 100644
--- a/src/pcu_l1_if.h
+++ b/src/pcu_l1_if.h
@@ -33,6 +33,15 @@
 }
 #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
  */
diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp
index 8009535..f65bc19 100644
--- a/src/pcu_vty_functions.cpp
+++ b/src/pcu_vty_functions.cpp
@@ -191,6 +191,18 @@
 	return CMD_SUCCESS;
 }
 
+bool set_tbf_ta(struct gprs_rlcmac_bts *bts_data, uint32_t fn,
+		       uint8_t trx_no, uint8_t ts, uint8_t ta)
+{
+	BTS *bts = bts_data->bts;
+	struct gprs_rlcmac_ul_tbf *tbf = bts->ul_tbf_by_poll_fn(fn, trx_no, ts);
+	if(!tbf)
+		return false;
+
+	tbf->set_ta(ta);
+	return true;
+}
+
 int pcu_vty_show_ms_by_tlli(struct vty *vty, struct gprs_rlcmac_bts *bts_data,
 	uint32_t tlli)
 {
diff --git a/src/pcu_vty_functions.h b/src/pcu_vty_functions.h
index 35acf64..b67b45b 100644
--- a/src/pcu_vty_functions.h
+++ b/src/pcu_vty_functions.h
@@ -20,6 +20,8 @@
 
 #pragma once
 
+#include <stdbool.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -34,6 +36,8 @@
 	uint32_t tlli);
 int pcu_vty_show_ms_by_imsi(struct vty *vty, struct gprs_rlcmac_bts *bts_data,
 	const char *imsi);
+bool set_tbf_ta(struct gprs_rlcmac_bts *bts_data, uint32_t fn, uint8_t trx_no,
+		uint8_t ts, uint8_t ta);
 
 #ifdef __cplusplus
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I96fdbb20b09fb85fdd9fb6dcf3c25f6bee7f80e4
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list