Change in osmo-bts[master]: osmo-bts-trx/scheduler: refactor the first frame number calculation

2019-10-21 Thread fixeria
fixeria has abandoned this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/15812 )

Change subject: osmo-bts-trx/scheduler: refactor the first frame number 
calculation
..


Abandoned
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15812
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Iae9a0135595b0c56752723669a4ed2fc91f25785
Gerrit-Change-Number: 15812
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: ipse 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: abandon


Change in osmo-bts[master]: osmo-bts-trx/scheduler: refactor the first frame number calculation

2019-10-21 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/15812 )

Change subject: osmo-bts-trx/scheduler: refactor the first frame number 
calculation
..


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/c/osmo-bts/+/15812/2/src/osmo-bts-trx/scheduler_trx.c
File src/osmo-bts-trx/scheduler_trx.c:

https://gerrit.osmocom.org/c/osmo-bts/+/15812/2/src/osmo-bts-trx/scheduler_trx.c@992
PS2, Line 992:  return set->fn; /* return frame number of the last burst */
Could it be set is NULL here? (hist is empty).



--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15812
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Iae9a0135595b0c56752723669a4ed2fc91f25785
Gerrit-Change-Number: 15812
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: ipse 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 21 Oct 2019 08:46:57 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in osmo-bts[master]: osmo-bts-trx/scheduler: refactor the first frame number calculation

2019-10-19 Thread fixeria
Hello dexter, pespin, ipse, laforge, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-bts/+/15812

to look at the new patch set (#2).

Change subject: osmo-bts-trx/scheduler: refactor the first frame number 
calculation
..

osmo-bts-trx/scheduler: refactor the first frame number calculation

In I6bc511223069f66b49109d3267bee7bd89585713 we have introduced
the storage for Uplink measurements (so called "history"), where
we can also store TDMA frame numbers of the related bursts.

This approach allows to look up frame number of the first Uplink
burst of a decoded block from the history. Thus neither we need
to store frame number of bid=0 in the logical channel state,
nor use complicated and buggy formulas.

This is not a silver bullet, because in some cases the measurement
history may be incomplete (until we start handling NOPE.ind from
the transceiver, see OS#3428). In such cases we would still need
to look up the first frame number using the block mapping tables
defined in 3GPP TS 45.002.

Change-Id: Iae9a0135595b0c56752723669a4ed2fc91f25785
Related: OS#3803
---
M include/osmo-bts/scheduler.h
M src/osmo-bts-trx/scheduler_trx.c
2 files changed, 58 insertions(+), 35 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/12/15812/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15812
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Iae9a0135595b0c56752723669a4ed2fc91f25785
Gerrit-Change-Number: 15812
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: ipse 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in osmo-bts[master]: osmo-bts-trx/scheduler: refactor the first frame number calculation

2019-10-19 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/15812 )


Change subject: osmo-bts-trx/scheduler: refactor the first frame number 
calculation
..

osmo-bts-trx/scheduler: refactor the first frame number calculation

In I6bc511223069f66b49109d3267bee7bd89585713 we have introduced
the storage for Uplink measurements (so called "history"), where
we can also store TDMA frame numbers of the related bursts.

This approach allows to look up frame number of the first Uplink
burst of a decoded block from the history. Thus neither we need
to store frame number of bid=0 in the logical channel state,
nor use complicated and buggy formulas.

This is not a silver bullet, because in some cases the measurement
history may be incomplete (until we start handling NOPE.ind from
the transceiver, see OS#3428). In such cases we would still need
to look up the first frame number using the block mapping tables
defined in 3GPP TS 45.002.

Change-Id: Iae9a0135595b0c56752723669a4ed2fc91f25785
Related: OS#3803
---
M include/osmo-bts/scheduler.h
M src/osmo-bts-trx/scheduler_trx.c
2 files changed, 54 insertions(+), 35 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/12/15812/1

diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index e6ec37d..f096374 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -72,6 +72,7 @@
 /* A set of measurements attached to a burst */
 struct l1sched_meas_set {
struct llist_head   list;   /* Link to the measurement 
history */
+   uint32_tfn; /* TDMA frame-number */

int16_t toa256; /* Timing of Arrival (1/256 of 
a symbol) */
int16_t ci_cb;  /* Carrier-to-Interference (cB) 
*/
@@ -85,7 +86,6 @@
ubit_t  *dl_bursts; /* burst buffer for TX */
enum trx_burst_type dl_burst_type;  /* GMSK or 8PSK burst type */
sbit_t  *ul_bursts; /* burst buffer for RX */
-   uint32_tul_first_fn;/* fn of first burst */
uint8_t ul_mask;/* mask of received bursts */

/* loss detection */
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index ae23ddd..39f118d 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -898,6 +898,9 @@
set = talloc(tall_bts_ctx, struct l1sched_meas_set);
OSMO_ASSERT(set != NULL);

+   /* Attach TDMA frame number */
+   set->fn = bi->fn;
+
set->toa256 = bi->toa256;
set->rssi = bi->rssi;

@@ -962,6 +965,30 @@
}
 }

+/* Get TDMA frame number of N-th measurement from the history. */
+static uint32_t l1sched_meas_get_fn(const struct l1sched_chan_state 
*chan_state,
+   unsigned int num)
+{
+   const struct llist_head *hist = _state->meas.hist;
+   struct l1sched_meas_set *set;
+
+   /* There shall be at least one set */
+   OSMO_ASSERT(chan_state->meas.num > 0);
+
+   /* Try to find N-th measurement in the history */
+   llist_for_each_entry(set, hist, list) {
+   if (num == 0)
+   return set->fn;
+   num -= 1;
+   }
+
+   /* Not enough measurements in the history? */
+   LOGP(DL1P, LOGL_NOTICE, "Failed to find TDMA frame number in the 
history, "
+   "using frame number of the last burst\n");
+   set = llist_first_entry(hist, struct l1sched_meas_set, list);
+   return set->fn; /* return frame number of the last burst */
+}
+
 /*! \brief a single (SDCCH/SACCH) burst was received by the PHY, process it */
 int rx_data_fn(struct l1sched_trx *l1t, enum trx_chan_type chan,
   uint8_t bid, const struct trx_ul_burst_ind *bi)
@@ -969,11 +996,11 @@
struct l1sched_ts *l1ts = l1sched_trx_get_ts(l1t, bi->tn);
struct l1sched_chan_state *chan_state = >chan_state[chan];
sbit_t *burst, **bursts_p = _state->ul_bursts;
-   uint32_t *first_fn = _state->ul_first_fn;
uint8_t *mask = _state->ul_mask;
uint8_t l2[GSM_MACBLOCK_LEN], l2_len;
struct l1sched_meas_set meas_set;
int n_errors, n_bits_total;
+   uint32_t first_fn;
uint16_t ber10k;
int rc;

@@ -997,7 +1024,6 @@
if (bid == 0) {
memset(*bursts_p, 0, 464);
*mask = 0x0;
-   *first_fn = bi->fn;
}

/* store the measurements */
@@ -1045,18 +1071,21 @@
} else
l2_len = GSM_MACBLOCK_LEN;

+   /* Get frame number of the first burst (1/4) */
+   first_fn = l1sched_meas_get_fn(chan_state, 4);
+
/* Average measurements of the last 4 bursts */
l1sched_meas_average(chan_state, _set, 4);
/*