aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-06-23 05:44:48 +0700
committerlaforge <laforge@osmocom.org>2020-09-22 19:34:02 +0000
commit4ded469b0fa222aca4e1742f2b6f2b0edda668aa (patch)
tree8b438018642d798fee142701b89555cb9dac022d /include
parent27c5fd93699d84c9d851556d45e2df15249de9df (diff)
osmo-bts-trx/scheduler: refactor UL burst measurement processing
Currently the UL measurements (RSSI, ToA256, C/I) of the burst that concludes a block are passed up to the higher layers. This means that the measurement values of the other bursts are skipped. Let's keep record of all UL measurements and average the values before we pass them up to the higher layers. Use a simple ring buffer to store the measurement history (up to 8 unique entries for now). Remove *_num/*_sum variables from l1sched_chan_state. Change-Id: I2b02b51fea5664f161382a4ddc63dbf14ffc9ac5 Related: OS#3032, OS#2978
Diffstat (limited to 'include')
-rw-r--r--include/osmo-bts/scheduler.h38
1 files changed, 28 insertions, 10 deletions
diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 0d863474..b488b6c4 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -70,6 +70,13 @@ enum trx_burst_type {
TRX_BURST_8PSK,
};
+/* A set of measurements belonging to one Uplink burst */
+struct l1sched_meas_set {
+ int16_t toa256; /* Timing of Arrival (1/256 of a symbol) */
+ int16_t ci_cb; /* Carrier-to-Interference (cB) */
+ float rssi; /* RSSI (dBm) */
+};
+
/* States each channel on a multiframe */
struct l1sched_chan_state {
/* Pointer to the associated logical channel state from gsm_data_shared.
@@ -85,14 +92,6 @@ struct l1sched_chan_state {
uint32_t ul_first_fn; /* fn of first burst */
uint8_t ul_mask; /* mask of received bursts */
- /* measurements */
- uint8_t rssi_num; /* number of RSSI values */
- float rssi_sum; /* sum of RSSI values */
- uint8_t toa_num; /* number of TOA values */
- int32_t toa256_sum; /* sum of TOA values (1/256 symbol) */
- uint8_t ci_cb_num; /* number of C/I values */
- int32_t ci_cb_sum; /* sum of C/I values (in centiBels) */
-
/* loss detection */
uint8_t lost_frames; /* how many L2 frames were lost */
uint32_t last_tdma_fn; /* last processed TDMA frame number */
@@ -126,8 +125,11 @@ struct l1sched_chan_state {
uint8_t ul_encr_key[MAX_A5_KEY_LEN];
uint8_t dl_encr_key[MAX_A5_KEY_LEN];
- /* measurements */
- /* TODO: measurement history (ring buffer) will be added here */
+ /* Simple ring buffer (up to 8 unique measurements) */
+ struct {
+ struct l1sched_meas_set buf[8];
+ unsigned int current; /* current position */
+ } meas;
/* handover */
bool ho_rach_detect; /* if rach detection is on */
@@ -266,4 +268,20 @@ struct trx_dl_burst_req {
int trx_sched_route_burst_ind(struct trx_ul_burst_ind *bi, struct l1sched_trx *l1t);
int trx_sched_ul_burst(struct l1sched_trx *l1t, struct trx_ul_burst_ind *bi);
+/* Averaging mode for trx_sched_meas_avg() */
+enum sched_meas_avg_mode {
+ /* last 4 bursts (default for xCCH, TCH/H, PTCCH and PDTCH) */
+ SCHED_MEAS_AVG_M_QUAD,
+ /* last 8 bursts (default for TCH/F and FACCH/F) */
+ SCHED_MEAS_AVG_M_OCTO,
+ /* last 6 bursts (default for FACCH/H) */
+ SCHED_MEAS_AVG_M_SIX,
+};
+
+void trx_sched_meas_push(struct l1sched_chan_state *chan_state,
+ const struct trx_ul_burst_ind *bi);
+void trx_sched_meas_avg(const struct l1sched_chan_state *chan_state,
+ struct l1sched_meas_set *avg,
+ enum sched_meas_avg_mode mode);
+
#endif /* TRX_SCHEDULER_H */