diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-06-08 16:23:57 +0200 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-06-18 18:56:57 +0200 |
commit | d4efc3f9c5ea8b67ee9c34095dc8e593acfff3e0 (patch) | |
tree | 734f45e02efaa7bee70c2923ab019072c56aa03f /src/common/rsl.c | |
parent | 64e1c1222e1331536fe45f1505229126e0b25fc9 (diff) |
Report interference levels in RSL RF RESource INDication
This change implements general interference averaging logic for
the higher layers. In l1sap_info_time_ind(), where we receive
TDMA time updates from BTS model, call rsl_tx_rf_res() for each
transceiver according to the interval defined by the Intave
parameter received from the BSC. In rsl_tx_rf_res() perform
the actual averaging for each inactive logical channel, and
then send everything to the BSC over the A-bis/RSL.
The BTS model specific code needs to report the measurements
for each logical channel every 104 TDMA frames (SACCH period)
by calling gsm_lchan_interf_meas_push().
Change-Id: Id80fdbef087de625149755165c025c0a9563dc85
Related: SYS#5313, OS#1569
Diffstat (limited to 'src/common/rsl.c')
-rw-r--r-- | src/common/rsl.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/src/common/rsl.c b/src/common/rsl.c index a4b1b7d8..502e6194 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -427,6 +427,7 @@ static int rsl_tx_error_report(struct gsm_bts_trx *trx, uint8_t cause, const uin /* 8.6.1 sending RF RESOURCE INDICATION */ int rsl_tx_rf_res(struct gsm_bts_trx *trx) { + unsigned int tn, ln; struct msgb *nmsg; LOGP(DRSL, LOGL_INFO, "Tx RSL RF RESource INDication\n"); @@ -434,8 +435,40 @@ int rsl_tx_rf_res(struct gsm_bts_trx *trx) nmsg = rsl_msgb_alloc(sizeof(struct abis_rsl_common_hdr)); if (!nmsg) return -ENOMEM; - // FIXME: add interference levels of TRX - msgb_tlv_put(nmsg, RSL_IE_RESOURCE_INFO, 0, NULL); + + /* Add interference levels for each logical channel */ + uint8_t *len = msgb_tl_put(nmsg, RSL_IE_RESOURCE_INFO); + + for (tn = 0; tn < ARRAY_SIZE(trx->ts); tn++) { + struct gsm_bts_trx_ts *ts = &trx->ts[tn]; + + for (ln = 0; ln < ARRAY_SIZE(ts->lchan); ln++) { + struct gsm_lchan *lchan = &ts->lchan[ln]; + + /* We're not interested in active lchans */ + if (lchan->state == LCHAN_S_ACTIVE) { + /* Avoid potential buffer overflow */ + lchan->meas.interf_meas_num = 0; + continue; + } + + /* Only for GSM_LCHAN_{SDCCH,TCH_F,TCH_H} */ + if (!lchan_is_dcch(lchan)) + continue; + + /* Average all collected samples */ + int band = gsm_lchan_interf_meas_calc_band(lchan); + if (band < 0) + continue; + + msgb_v_put(nmsg, gsm_lchan2chan_nr(lchan)); + msgb_v_put(nmsg, (band & 0x07) << 5); + } + } + + /* Calculate length of the V part */ + *len = msgb_l3len(nmsg) - 2; + rsl_trx_push_hdr(nmsg, RSL_MT_RF_RES_IND); nmsg->trx = trx; |