aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMinh-Quang Nguyen <minh-quang.nguyen@nutaq.com>2017-11-01 14:41:37 -0400
committerMinh-Quang Nguyen <minh-quang.nguyen@nutaq.com>2017-11-16 10:06:41 -0500
commit1bcfa9aacfef875f21aeb3d6b5bd393b069e4183 (patch)
tree67df2d9c8deefbdd38198935ec4ee1c40db5a6c8 /src
parentbfc54b551b614815705d0711db5bdbd2fa240aec (diff)
PCU: Fix TA adjustment
Promblem: TA provided from L1 PH-DATA-IND is a relative amount of TA adjustment to actual TA being used for given TBF. The current TA update algorithm in PCU simply applies the relative amount of TA to given TBF but does not take into account of current TA. As a result, the PCU will request wrong TA jump for given TBF if the MS is moving away from BTS more than 2 km. Related issue: http://osmocom.org/issues/2611 Fixes: - The PCU needs increase or decrease current TA of given TBF on receiving of relative amount of TA adjustment provided by PH-DATA-IND from L1 - The PCU needs to set absolute TA of given TBF on receiving absolute TA provided by PH-RA-IND from L1. Change-Id: I65212f8203f1a35278890f51db038d689b2493d5
Diffstat (limited to 'src')
-rw-r--r--src/bts.cpp56
-rw-r--r--src/bts.h5
-rw-r--r--src/osmo-bts-litecell15/lc15_l1_if.c4
-rw-r--r--src/osmo-bts-sysmo/sysmo_l1_if.c4
-rw-r--r--src/pcu_l1_if.h28
5 files changed, 84 insertions, 13 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index e41b1fa9..6bdbb859 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -1619,8 +1619,45 @@ int gprs_rlcmac_pdch::rcv_block_gprs(uint8_t *data, uint8_t data_len, uint32_t f
return rc;
}
-void bts_update_tbf_ta(const char *p, uint32_t fn, uint8_t trx_no, uint8_t ts,
- uint8_t ta)
+/* update TA based on TA provided by PH-DATA-IND */
+void update_tbf_ta(struct gprs_rlcmac_ul_tbf *tbf, int8_t ta_delta)
+{
+ int16_t ta_adj;
+ uint8_t ta_target;
+
+ if (ta_delta) {
+ /* adjust TA based on TA provided by PH-DATA-IND */
+ ta_adj = tbf->ta() + ta_delta;
+
+ /* limit target TA in range 0..63 bits */
+ ta_target = ta_limit(ta_adj);
+
+ LOGP(DL1IF, LOGL_INFO, "PH-DATA-IND is updating TLLI=0x%08x: TA %u -> %u on "
+ "TRX = %d, TS = %d, FN = %d\n",
+ tbf->tlli(), tbf->ta(), ta_target,
+ tbf->trx->trx_no , tbf->poll_ts, tbf->poll_fn);
+ tbf->set_ta(ta_target);
+ }
+}
+
+/* set TA based on TA provided by PH-RA-IND */
+void set_tbf_ta(struct gprs_rlcmac_ul_tbf *tbf, uint8_t ta)
+{
+ uint8_t ta_target;
+
+ if (tbf->ta() != ta) {
+ /* limit target TA in range 0..63 bits */
+ ta_target = ta_limit(ta);
+
+ LOGP(DL1IF, LOGL_INFO, "PH-RA-IND is updating TLLI=0x%08x: TA %u -> %u on "
+ "TRX = %d, TS = %d, FN = %d\n",
+ tbf->tlli(), tbf->ta(), ta_target,
+ tbf->trx->trx_no , tbf->poll_ts, tbf->poll_fn);
+ tbf->set_ta(ta_target);
+ }
+}
+
+void bts_update_tbf_ta(const char *p, uint32_t fn, uint8_t trx_no, uint8_t ts, int8_t ta, bool is_rach)
{
struct gprs_rlcmac_ul_tbf *tbf =
bts_main_data()->bts->ul_tbf_by_poll_fn(fn, trx_no, ts);
@@ -1628,11 +1665,16 @@ void bts_update_tbf_ta(const char *p, uint32_t fn, uint8_t trx_no, uint8_t ts,
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);
+ else {
+ /* we need to distinguish TA information provided by L1
+ * from PH-DATA-IND and PHY-RA-IND so that we can properly
+ * update TA for given TBF
+ */
+ if (is_rach)
+ set_tbf_ta(tbf, (uint8_t)ta);
+ else
+ update_tbf_ta(tbf, ta);
+
}
}
diff --git a/src/bts.h b/src/bts.h
index d65cd2f6..aaf81cfa 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -162,8 +162,9 @@ struct gprs_rlcmac_trx {
#ifdef __cplusplus
extern "C" {
#endif
-void bts_update_tbf_ta(const char *p, uint32_t fn, uint8_t trx_no, uint8_t ts,
- uint8_t ta);
+void bts_update_tbf_ta(const char *p, uint32_t fn, uint8_t trx_no, uint8_t ts, int8_t ta, bool is_rach);
+void update_tbf_ta(struct gprs_rlcmac_ul_tbf *tbf, int8_t ta_delta);
+void set_tbf_ta(struct gprs_rlcmac_ul_tbf *tbf, uint8_t ta);
#ifdef __cplusplus
}
#endif
diff --git a/src/osmo-bts-litecell15/lc15_l1_if.c b/src/osmo-bts-litecell15/lc15_l1_if.c
index 37b7f789..8290a934 100644
--- a/src/osmo-bts-litecell15/lc15_l1_if.c
+++ b/src/osmo-bts-litecell15/lc15_l1_if.c
@@ -203,7 +203,7 @@ static int handle_ph_data_ind(struct lc15l1_hdl *fl1h,
get_meas(&meas, &data_ind->measParam);
bts_update_tbf_ta("PH-DATA", data_ind->u32Fn, fl1h->trx_no,
- data_ind->u8Tn, qta2ta(meas.bto));
+ data_ind->u8Tn, sign_qta2ta(meas.bto), false);
switch (data_ind->sapi) {
case GsmL1_Sapi_Pdtch:
@@ -248,7 +248,7 @@ static int handle_ph_ra_ind(struct lc15l1_hdl *fl1h, GsmL1_PhRaInd_t *ra_ind)
DEBUGP(DL1IF, "Rx PH-RA.ind");
bts_update_tbf_ta("PH-RA", ra_ind->u32Fn, fl1h->trx_no, ra_ind->u8Tn,
- qta2ta(ra_ind->measParam.i16BurstTiming));
+ qta2ta(ra_ind->measParam.i16BurstTiming), true);
return 0;
}
diff --git a/src/osmo-bts-sysmo/sysmo_l1_if.c b/src/osmo-bts-sysmo/sysmo_l1_if.c
index 1c5ecc93..dfef2398 100644
--- a/src/osmo-bts-sysmo/sysmo_l1_if.c
+++ b/src/osmo-bts-sysmo/sysmo_l1_if.c
@@ -188,7 +188,7 @@ static int handle_ph_data_ind(struct femtol1_hdl *fl1h,
get_meas(&meas, &data_ind->measParam);
bts_update_tbf_ta("PH-DATA", data_ind->u32Fn, fl1h->trx_no,
- data_ind->u8Tn, qta2ta(meas.bto));
+ data_ind->u8Tn, sign_qta2ta(meas.bto), false);
switch (data_ind->sapi) {
case GsmL1_Sapi_Pdtch:
@@ -237,7 +237,7 @@ static int handle_ph_ra_ind(struct femtol1_hdl *fl1h, GsmL1_PhRaInd_t *ra_ind)
DEBUGP(DL1IF, "Rx PH-RA.ind");
bts_update_tbf_ta("PH-RA", ra_ind->u32Fn, fl1h->trx_no, ra_ind->u8Tn,
- qta2ta(ra_ind->measParam.i16BurstTiming));
+ qta2ta(ra_ind->measParam.i16BurstTiming), true);
return 0;
}
diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h
index 1618260c..cb2a6dff 100644
--- a/src/pcu_l1_if.h
+++ b/src/pcu_l1_if.h
@@ -43,6 +43,34 @@ static inline uint8_t qta2ta(int16_t qta)
return qta >> 2;
}
+static inline int8_t sign_qta2ta(int16_t qta)
+{
+ int8_t ta_adj = 0;
+
+ if (qta < -252)
+ qta = -252;
+
+ if (qta > 252)
+ qta = 252;
+
+ /* 1-bit TA adjustment if TA error reported by L1 is outside +/- 2 qbits */
+ if (qta > 2)
+ ta_adj = 1;
+ if (qta < -2)
+ ta_adj = -1;
+
+ return (qta >> 2) + ta_adj;
+}
+
+static inline uint8_t ta_limit(int16_t ta)
+{
+ if (ta < 0)
+ ta = 0;
+ if (ta > 63)
+ ta = 63;
+ return ta;
+}
+
/*
* L1 Measurement values
*/