forked from cellular-infrastructure/osmo-pcu
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
This commit is contained in:
parent
bfc54b551b
commit
1bcfa9aacf
56
src/bts.cpp
56
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue