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/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/25712 ) Change subject: rsl_tx_rf_res(): separate interference AVG / band calculation ...................................................................... rsl_tx_rf_res(): separate interference AVG / band calculation It's cleaner from the architectural point of view to have the interference measurements processed in a separate function. Change-Id: I3981608e01a50585359cad673c38c8a305027d30 Related: SYS#5313 --- M include/osmo-bts/lchan.h M src/common/l1sap.c M src/common/lchan.c M src/common/rsl.c 4 files changed, 43 insertions(+), 18 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/12/25712/1 diff --git a/include/osmo-bts/lchan.h b/include/osmo-bts/lchan.h index 4cf957a..9f22ce1 100644 --- a/include/osmo-bts/lchan.h +++ b/include/osmo-bts/lchan.h @@ -226,8 +226,10 @@ uint16_t toa256_std_dev; } ext; /* Interference levels reported by PHY (in dBm) */ + int16_t interf_meas_avg_dbm; /* Average value */ int16_t interf_meas_dbm[31]; /* Intave max is 31 */ uint8_t interf_meas_num; + uint8_t interf_band; } meas; struct { struct amr_multirate_conf amr_mr; @@ -339,7 +341,7 @@ enum gsm_phys_chan_config as_pchan); void gsm_lchan_interf_meas_push(struct gsm_lchan *lchan, int dbm); -int gsm_lchan_interf_meas_calc_band(struct gsm_lchan *lchan); +void gsm_lchan_interf_meas_calc_avg(struct gsm_lchan *lchan); int lchan2ecu_codec(const struct gsm_lchan *lchan); diff --git a/src/common/l1sap.c b/src/common/l1sap.c index a48287c..5c58aff 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -591,6 +591,29 @@ return rach_frames_expired; } +static void l1sap_interf_meas_calc_avg(struct gsm_bts_trx *trx) +{ + unsigned int tn, ln; + + 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]; + + lchan->meas.interf_meas_avg_dbm = 0; + lchan->meas.interf_band = 0; + + /* There must be at least one sample */ + if (lchan->meas.interf_meas_num == 0) + continue; + + /* Average all collected samples */ + gsm_lchan_interf_meas_calc_avg(lchan); + } + } +} + static void l1sap_interf_meas_report(struct gsm_bts *bts) { const uint32_t period = bts->interference.intave * 104; @@ -601,8 +624,12 @@ if (bts->gsm_time.fn % period != 0) return; - llist_for_each_entry(trx, &bts->trx_list, list) + llist_for_each_entry(trx, &bts->trx_list, list) { + /* Calculate the average of all received samples */ + l1sap_interf_meas_calc_avg(trx); + /* Report to the BSC over the A-bis/RSL */ rsl_tx_rf_res(trx); + } } /* time information received from bts model */ diff --git a/src/common/lchan.c b/src/common/lchan.c index 10a375e..f7ee33b 100644 --- a/src/common/lchan.c +++ b/src/common/lchan.c @@ -348,15 +348,14 @@ } /* Called by the higher layers every Intave * 104 TDMA frames */ -int gsm_lchan_interf_meas_calc_band(struct gsm_lchan *lchan) +void gsm_lchan_interf_meas_calc_avg(struct gsm_lchan *lchan) { const uint8_t meas_num = lchan->meas.interf_meas_num; const struct gsm_bts *bts = lchan->ts->trx->bts; int b, meas_avg, meas_sum = 0; /* There must be at least one sample */ - if (meas_num == 0) - return -EAGAIN; + OSMO_ASSERT(meas_num > 0); /* Calculate the sum of all collected samples (in -x dBm) */ while (lchan->meas.interf_meas_num) { @@ -377,7 +376,8 @@ "Interference AVG: %ddBm (band %d, samples %u)\n", meas_avg, b, meas_num); - return b; + lchan->meas.interf_meas_avg_dbm = meas_avg; + lchan->meas.interf_band = b; } /* determine the ECU codec constant for the codec used by given lchan */ diff --git a/src/common/rsl.c b/src/common/rsl.c index f03d510..2e453d3 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -440,29 +440,25 @@ 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]; + const 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]; + const struct gsm_lchan *lchan = &ts->lchan[ln]; + + /* No average interference value => no band */ + if (lchan->meas.interf_meas_avg_dbm == 0) + continue; /* We're not interested in active lchans */ - if (lchan->state == LCHAN_S_ACTIVE) { - /* Avoid potential buffer overflow */ - lchan->meas.interf_meas_num = 0; + if (lchan->state == LCHAN_S_ACTIVE) 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_rsl(lchan)); - msgb_v_put(nmsg, (band & 0x07) << 5); + msgb_v_put(nmsg, (lchan->meas.interf_band & 0x07) << 5); } } -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/25712 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I3981608e01a50585359cad673c38c8a305027d30 Gerrit-Change-Number: 25712 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211007/bf9dae95/attachment.htm>