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/.
Minh-Quang Nguyen gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/4678 LC15: Fix TA adjustment Change-Id: I65212f8203f1a35278890f51db038d689b2493d5 --- M src/bts.cpp M src/bts.h M src/osmo-bts-litecell15/lc15_l1_if.c M src/pcu_l1_if.h 4 files changed, 57 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/78/4678/1 diff --git a/src/bts.cpp b/src/bts.cpp index e41b1fa..7ffb132 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -1619,20 +1619,48 @@ return rc; } -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) { + int ta_final; + bool need_update = false; + struct gprs_rlcmac_ul_tbf *tbf = bts_main_data()->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); + 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 (!strcmp(p, "PH-DATA")) { + if (ta) { + /* adjust TA based on TA provided by PH-DATA-IND */ + ta_final = tbf->ta() + ta; + need_update = true; + } + } else if ((!strcmp(p, "PH-RA"))) { + if (tbf->ta() != ta) { + /* adjust TA based on TA provided by PH-RA-IND */ + ta_final = ta; + need_update = true; + } + } + + if (need_update) { + /* limit TA range is between 0 and 63 bits */ + if (ta_final < 0) + ta_final = 0; + else if (ta_final > 63) + ta_final = 63; + + LOGP(DL1IF, LOGL_INFO, "[%s] Updating TLLI=0x%08x: TA %u -> %u on " + "TRX = %d, TS = %d, FN = %d\n", + p, tbf->tlli(), tbf->ta(), ta_final, trx_no, ts, fn); + tbf->set_ta((uint8_t)ta_final); + } } } diff --git a/src/bts.h b/src/bts.h index d65cd2f..139aeae 100644 --- a/src/bts.h +++ b/src/bts.h @@ -162,8 +162,7 @@ #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); #ifdef __cplusplus } #endif diff --git a/src/osmo-bts-litecell15/lc15_l1_if.c b/src/osmo-bts-litecell15/lc15_l1_if.c index 37b7f78..628bd3d 100644 --- a/src/osmo-bts-litecell15/lc15_l1_if.c +++ b/src/osmo-bts-litecell15/lc15_l1_if.c @@ -203,7 +203,7 @@ 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)); switch (data_ind->sapi) { case GsmL1_Sapi_Pdtch: @@ -248,7 +248,7 @@ 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)); + sign_qta2ta(ra_ind->measParam.i16BurstTiming)); return 0; } diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h index 1618260..af51693 100644 --- a/src/pcu_l1_if.h +++ b/src/pcu_l1_if.h @@ -43,6 +43,25 @@ 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 higher outside +/- 2 qbits */ + if (qta > 2) + ta_adj = 1; + if (qta < -2) + ta_adj = -1; + + return (qta >> 2) + ta_adj; +} + /* * L1 Measurement values */ -- To view, visit https://gerrit.osmocom.org/4678 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I65212f8203f1a35278890f51db038d689b2493d5 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Minh-Quang Nguyen <minh-quang.nguyen at nutaq.com>