diff --git a/include/osmo-bts/gsm_data_shared.h b/include/osmo-bts/gsm_data_shared.h index 2d6ead12b..2c21865e8 100644 --- a/include/osmo-bts/gsm_data_shared.h +++ b/include/osmo-bts/gsm_data_shared.h @@ -818,6 +818,7 @@ struct gsm_bts { int bcch_change_mark; struct rate_ctr_group *ctrs; + bool supp_meas_toa256; void *role; }; diff --git a/src/common/rsl.c b/src/common/rsl.c index 5c266ba77..98e8913ba 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -2400,6 +2400,7 @@ static int rsl_tx_meas_res(struct gsm_lchan *lchan, uint8_t *l3, int l3_len, con uint8_t meas_res[16]; uint8_t chan_nr = gsm_lchan2chan_nr(lchan); int res_valid = lchan->meas.flags & LC_UL_M_F_RES_VALID; + struct gsm_bts *bts = lchan->ts->trx->bts; LOGP(DRSL, LOGL_DEBUG, "%s chan_num:%u Tx MEAS RES valid(%d), flags(%02x)\n", @@ -2429,6 +2430,17 @@ static int rsl_tx_meas_res(struct gsm_lchan *lchan, uint8_t *l3, int l3_len, con meas_res); lchan->tch.dtx.dl_active = false; if (ie_len >= 3) { + if (bts->supp_meas_toa256) { + /* append signed 16bit value containing MS timing offset in 1/256th symbols + * in the vendor-specific "Supplementary Measurement Information" part of + * the uplink measurements IE. This is the current offset *relative* to the + * TA which the MS has already applied. So if you want to know the total + * propagation time between MS and BTS, you need to add the actual TA value + * used (from L1_INFO below, in full symbols) plus the ms_toa256 value + * in 1/256 symbol periods. */ + meas_res[ie_len++] = lchan->meas.ms_toa256 >> 8; + meas_res[ie_len++] = lchan->meas.ms_toa256 & 0xff; + } msgb_tlv_put(msg, RSL_IE_UPLINK_MEAS, ie_len, meas_res); lchan->meas.flags &= ~LC_UL_M_F_RES_VALID; } diff --git a/src/common/vty.c b/src/common/vty.c index 3938de5b1..b57e01920 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -295,6 +295,8 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) VTY_NEWLINE); if (strcmp(btsb->pcu.sock_path, PCU_SOCK_DEFAULT)) vty_out(vty, " pcu-socket %s%s", btsb->pcu.sock_path, VTY_NEWLINE); + if (bts->supp_meas_toa256) + vty_out(vty, " supp-meas-info toa256%s", VTY_NEWLINE); bts_model_config_write_bts(vty, bts); @@ -624,6 +626,30 @@ DEFUN(cfg_bts_pcu_sock, cfg_bts_pcu_sock_cmd, return CMD_SUCCESS; } +DEFUN(cfg_bts_supp_meas_toa256, cfg_bts_supp_meas_toa256_cmd, + "supp-meas-info toa256", + "Configure the RSL Supplementary Measurement Info\n" + "Report the TOA in 1/256th symbol periods\n") +{ + struct gsm_bts *bts = vty->index; + struct gsm_bts_role_bts *btsb = bts_role_bts(bts); + + bts->supp_meas_toa256 = true; + return CMD_SUCCESS; +} + +DEFUN(cfg_bts_no_supp_meas_toa256, cfg_bts_no_supp_meas_toa256_cmd, + "no supp-meas-info toa256", + NO_STR "Configure the RSL Supplementary Measurement Info\n" + "Report the TOA in 1/256th symbol periods\n") +{ + struct gsm_bts *bts = vty->index; + struct gsm_bts_role_bts *btsb = bts_role_bts(bts); + + bts->supp_meas_toa256 = false; + return CMD_SUCCESS; +} + #define DB_DBM_STR \ "Unit is dB (decibels)\n" \ @@ -1559,6 +1585,8 @@ int bts_vty_init(struct gsm_bts *bts, const struct log_info *cat) install_element(BTS_NODE, &cfg_bts_min_qual_norm_cmd); install_element(BTS_NODE, &cfg_bts_max_ber_rach_cmd); install_element(BTS_NODE, &cfg_bts_pcu_sock_cmd); + install_element(BTS_NODE, &cfg_bts_supp_meas_toa256_cmd); + install_element(BTS_NODE, &cfg_bts_no_supp_meas_toa256_cmd); install_element(BTS_NODE, &cfg_trx_gsmtap_sapi_cmd); install_element(BTS_NODE, &cfg_trx_no_gsmtap_sapi_cmd);