aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2019-10-31 09:36:17 +0100
committerlaforge <laforge@osmocom.org>2020-01-20 14:35:19 +0000
commitd4f67591c77dd011bb4886d92565fb5014437330 (patch)
treeeffe95a8b5b46716fe6aff5448e217e6df9c4894 /src/osmo-bts-trx
parent8969adc5d940e32031ade68e4eb2fdf7ac4e17d0 (diff)
l1sap: merge MEAS IND into PRIM PH DATA / PRIM TCH
The MPH INFO MEAS IND indication, which contains the uplink measurement data is sent in parallel to the PH DATA and TCH indications as a separate indications. This makes the overall uplink measurement data processing unnecessarly complex. So lets put the data that is relevant for measurement into the PH DATA and TCH indications directly. This change only affects osmo-bts-trx at the moment. In order to keep the upper layers (l1sap.c) compatible we add an autodection to switch between separate measurement indications and included measurement data. Related: OS#2977 Depends: libosmocore I2c34b02d329f9df190c5035c396403ca0a4f9c42 Change-Id: I710d0b7cf193afa8515807836ee69b8b7db84a84
Diffstat (limited to 'src/osmo-bts-trx')
-rw-r--r--src/osmo-bts-trx/l1_if.c34
-rw-r--r--src/osmo-bts-trx/l1_if.h2
-rw-r--r--src/osmo-bts-trx/main.c1
-rw-r--r--src/osmo-bts-trx/scheduler_trx.c64
4 files changed, 25 insertions, 76 deletions
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 38b43b9f..b28c8947 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -572,40 +572,6 @@ int l1if_mph_time_ind(struct gsm_bts *bts, uint32_t fn)
return l1sap_up(bts->c0, &l1sap);
}
-
-static void l1if_fill_meas_res(struct osmo_phsap_prim *l1sap, uint8_t chan_nr, int16_t toa256,
- float ber, float rssi, uint32_t fn)
-{
- memset(l1sap, 0, sizeof(*l1sap));
- osmo_prim_init(&l1sap->oph, SAP_GSM_PH, PRIM_MPH_INFO,
- PRIM_OP_INDICATION, NULL);
- l1sap->u.info.type = PRIM_INFO_MEAS;
- l1sap->u.info.u.meas_ind.chan_nr = chan_nr;
- l1sap->u.info.u.meas_ind.ta_offs_256bits = toa256;
- l1sap->u.info.u.meas_ind.ber10k = (unsigned int) (ber * 10000);
- l1sap->u.info.u.meas_ind.inv_rssi = (uint8_t) (rssi * -1);
- l1sap->u.info.u.meas_ind.fn = fn;
-}
-
-int l1if_process_meas_res(struct gsm_bts_trx *trx, uint8_t tn, uint32_t fn, uint8_t chan_nr,
- int n_errors, int n_bits_total, float rssi, int16_t toa256)
-{
- struct gsm_lchan *lchan = &trx->ts[tn].lchan[l1sap_chan2ss(chan_nr)];
- struct osmo_phsap_prim l1sap;
- /* 100% BER is n_bits_total is 0 */
- float ber = n_bits_total==0 ? 1.0 : (float)n_errors / (float)n_bits_total;
-
- LOGPFN(DMEAS, LOGL_DEBUG, fn, "RX UL measurement for %s fn=%u chan_nr=0x%02x MS pwr=%ddBm rssi=%.1f dBFS "
- "ber=%.2f%% (%d/%d bits) L1_ta=%d rqd_ta=%d toa256=%d\n",
- gsm_lchan_name(lchan), fn, chan_nr, ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power_ctrl.current),
- rssi, ber*100, n_errors, n_bits_total, lchan->meas.l1_info[1], lchan->rqd_ta, toa256);
-
- l1if_fill_meas_res(&l1sap, chan_nr, toa256, ber, rssi, fn);
-
- return l1sap_up(trx, &l1sap);
-}
-
-
/* primitive from common part */
int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
{
diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h
index 4ff1f972..73709995 100644
--- a/src/osmo-bts-trx/l1_if.h
+++ b/src/osmo-bts-trx/l1_if.h
@@ -115,8 +115,6 @@ struct trx_l1h *trx_l1h_alloc(void *tall_ctx, struct phy_instance *pinst);
int l1if_provision_transceiver_trx(struct trx_l1h *l1h);
int l1if_provision_transceiver(struct gsm_bts *bts);
int l1if_mph_time_ind(struct gsm_bts *bts, uint32_t fn);
-int l1if_process_meas_res(struct gsm_bts_trx *trx, uint8_t tn, uint32_t fn, uint8_t chan_nr,
- int n_errors, int n_bits_total, float rssi, int16_t toa256);
static inline struct l1sched_trx *trx_l1sched_hdl(struct gsm_bts_trx *trx)
{
diff --git a/src/osmo-bts-trx/main.c b/src/osmo-bts-trx/main.c
index 6671243f..ab0472e7 100644
--- a/src/osmo-bts-trx/main.c
+++ b/src/osmo-bts-trx/main.c
@@ -116,6 +116,7 @@ int bts_model_init(struct gsm_bts *bts)
gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_F_AMR);
gsm_bts_set_feature(bts, BTS_FEAT_SPEECH_H_AMR);
gsm_bts_set_feature(bts, BTS_FEAT_CBCH);
+ gsm_bts_set_feature(bts, BTS_FEAT_MEAS_PAYLOAD_COMB);
bts_model_vty_init(bts);
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 20d502f0..5abb73b0 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -193,12 +193,10 @@ got_msg:
/* TODO: Should we pass old TOA here? Otherwise we risk
* unnecessary decreasing TA */
- /* Send uplink measurement information to L2 */
- l1if_process_meas_res(l1t->trx, tn, fn, trx_chan_desc[chan].chan_nr | tn,
- 456, 456, -110, 0);
- /* FIXME: use actual values for BER etc */
+ /* Note: RSSI is set to 0 to indicate to the higher
+ * layers that this is a faked ph_data_ind */
_sched_compose_ph_data_ind(l1t, tn, 0, chan, NULL, 0,
- -110, 0, 0, 10000,
+ 0, 0, 0, 10000,
PRES_INFO_INVALID);
}
}
@@ -345,6 +343,9 @@ static void tx_tch_common(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
uint8_t rsl_cmode = chan_state->rsl_cmode;
uint8_t tch_mode = chan_state->tch_mode;
struct osmo_phsap_prim *l1sap;
+ int32_t *toa256_sum = &chan_state->toa256_sum;
+ uint8_t *toa_num = &chan_state->toa_num;
+ int16_t toa256;
/* handle loss detection of received TCH frames */
if (rsl_cmode == RSL_CMOD_SPD_SPEECH
@@ -390,8 +391,17 @@ inval_mode1:
LOGL1S(DL1P, LOGL_ERROR, l1t, tn, chan, fn, "TCH mode invalid, please fix!\n");
len = 0;
}
- if (len)
- _sched_compose_tch_ind(l1t, tn, fn, chan, tch_data, len);
+
+ if (len) {
+ if (*toa_num == 0)
+ toa256 = 0;
+ else
+ toa256 = *toa256_sum / *toa_num;
+
+ /* Note: RSSI is set to 0 to indicate to the higher
+ * layers that this is a faked tch_ind */
+ _sched_compose_tch_ind(l1t, tn, fn, chan, tch_data, len, toa256, 10000, 0);
+ }
}
/* get frame and unlink from queue */
@@ -982,12 +992,6 @@ int rx_data_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
} else
l2_len = GSM_MACBLOCK_LEN;
- /* Send uplink measurement information to L2 */
- l1if_process_meas_res(l1t->trx, bi->tn, *first_fn,
- trx_chan_desc[chan].chan_nr | bi->tn,
- n_errors, n_bits_total,
- *rssi_sum / *rssi_num,
- *toa256_sum / *toa_num);
lqual_cb = *ci_cb_num ? (*ci_cb_sum / *ci_cb_num) : 0;
ber10k = compute_ber10k(n_bits_total, n_errors);
return _sched_compose_ph_data_ind(l1t, bi->tn, *first_fn,
@@ -1097,14 +1101,6 @@ int rx_pdtch_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
&n_errors, &n_bits_total);
}
-
- /* Send uplink measurement information to L2 */
- l1if_process_meas_res(l1t->trx, bi->tn, *first_fn,
- trx_chan_desc[chan].chan_nr | bi->tn,
- n_errors, n_bits_total,
- *rssi_sum / *rssi_num,
- *toa256_sum / *toa_num);
-
if (rc <= 0) {
LOGL1S(DL1P, LOGL_DEBUG, l1t, bi->tn, chan, bi->fn,
"Received bad PDTCH (%u/%u)\n",
@@ -1141,6 +1137,7 @@ int rx_tchf_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
struct gsm_lchan *lchan =
get_lchan_by_chan_nr(l1t->trx, trx_chan_desc[chan].chan_nr | bi->tn);
unsigned int fn_begin;
+ uint16_t ber10k;
/* handle rach, if handover rach detection is turned on */
if (chan_state->ho_rach_detect == 1)
@@ -1240,17 +1237,13 @@ int rx_tchf_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
if (rc != GSM_MACBLOCK_LEN && lchan->ecu_state)
osmo_ecu_frame_in(lchan->ecu_state, bfi_flag, tch_data, rc);
+ ber10k = compute_ber10k(n_bits_total, n_errors);
if (bfi_flag)
goto bfi;
/* FACCH */
if (rc == GSM_MACBLOCK_LEN) {
- uint16_t ber10k = compute_ber10k(n_bits_total, n_errors);
fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_FACCH_F);
- l1if_process_meas_res(l1t->trx, bi->tn, fn_begin,
- trx_chan_desc[chan].chan_nr | bi->tn,
- n_errors, n_bits_total,
- bi->rssi, bi->toa256);
_sched_compose_ph_data_ind(l1t, bi->tn, fn_begin, chan,
tch_data + amr, GSM_MACBLOCK_LEN,
/* FIXME: AVG RSSI and ToA256 */
@@ -1311,12 +1304,8 @@ bfi:
/* TCH or BFI */
compose_l1sap:
fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_TCH_F);
- l1if_process_meas_res(l1t->trx, bi->tn, fn_begin,
- trx_chan_desc[chan].chan_nr | bi->tn,
- n_errors, n_bits_total,
- bi->rssi, bi->toa256);
return _sched_compose_tch_ind(l1t, bi->tn, fn_begin, chan,
- tch_data, rc);
+ tch_data, rc, bi->toa256, ber10k, bi->rssi);
}
/*! \brief a single TCH/H burst was received by the PHY, process it */
@@ -1343,6 +1332,7 @@ int rx_tchh_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
*/
int fn_is_odd = (((bi->fn + 26 - 10) % 26) >> 2) & 1;
unsigned int fn_begin;
+ uint16_t ber10k;
/* handle RACH, if handover RACH detection is turned on */
if (chan_state->ho_rach_detect == 1)
@@ -1385,6 +1375,8 @@ int rx_tchh_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
}
*mask = 0x0;
+ ber10k = compute_ber10k(n_bits_total, n_errors);
+
/* skip second of two TCH frames of FACCH was received */
if (chan_state->ul_ongoing_facch) {
chan_state->ul_ongoing_facch = 0;
@@ -1464,10 +1456,6 @@ int rx_tchh_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_FACCH_H0);
else
fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_FACCH_H1);
- l1if_process_meas_res(l1t->trx, bi->tn, fn_begin,
- trx_chan_desc[chan].chan_nr | bi->tn,
- n_errors, n_bits_total, bi->rssi,
- bi->toa256);
_sched_compose_ph_data_ind(l1t, bi->tn, fn_begin, chan,
tch_data + amr, GSM_MACBLOCK_LEN,
/* FIXME: AVG both RSSI and ToA */
@@ -1533,12 +1521,8 @@ compose_l1sap:
fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_TCH_H0);
else
fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_TCH_H1);
- l1if_process_meas_res(l1t->trx, bi->tn, fn_begin,
- trx_chan_desc[chan].chan_nr | bi->tn,
- n_errors, n_bits_total, bi->rssi,
- bi->toa256);
return _sched_compose_tch_ind(l1t, bi->tn, fn_begin, chan,
- tch_data, rc);
+ tch_data, rc, bi->toa256, ber10k, bi->rssi);
}
/* schedule all frames of all TRX for given FN */