Change in osmo-bts[master]: bts-trx: Try decoding received UL bursts when SACCH frame detected as...

2018-10-24 Thread Pau Espin Pedrol
Pau Espin Pedrol has abandoned this change. ( https://gerrit.osmocom.org/11446 )

Change subject: bts-trx: Try decoding received UL bursts when SACCH frame 
detected as lost
..


Abandoned

Same issue fixed by without need to make code more complex. I agree correct fix 
is to make sure we don't loss frames in TRX. 
https://gerrit.osmocom.org/#/c/docker-playground/+/11453/
--
To view, visit https://gerrit.osmocom.org/11446
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: abandon
Gerrit-Change-Id: I910277df181df5082b234c1c97a75eebdffc2cb5
Gerrit-Change-Number: 11446
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 


Change in osmo-bts[master]: bts-trx: Try decoding received UL bursts when SACCH frame detected as...

2018-10-24 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/11446 )

Change subject: bts-trx: Try decoding received UL bursts when SACCH frame 
detected as lost
..


Patch Set 1: Code-Review-1

It makes sense to investigate the problem carefully. I think, that
this change makes complicated things even more complex. Why?

  - In general, SACCH frame loss detection is implemented in a
hackish way ATM - it's being triggered by DL processing path,
which is not (and should not be) synchronized with the UL
processing path. We have at least ~20 TDMA frame difference
between them. See both 'osmotrx fn-advance' and 'osmotrx rts-advance'
configuration options for OsmoBTS, and '-f --trx-advance' command
line option for trxcon.

  - Instead of complicating the code more, I think we should focus on
implementing (and discussing) the TDMA frame loss detection on the
link between L1 and TRX.


--
To view, visit https://gerrit.osmocom.org/11446
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I910277df181df5082b234c1c97a75eebdffc2cb5
Gerrit-Change-Number: 11446
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Wed, 24 Oct 2018 13:32:58 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-bts[master]: bts-trx: Try decoding received UL bursts when SACCH frame detected as...

2018-10-23 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/11446 )

Change subject: bts-trx: Try decoding received UL bursts when SACCH frame 
detected as lost
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/11446
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I910277df181df5082b234c1c97a75eebdffc2cb5
Gerrit-Change-Number: 11446
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Tue, 23 Oct 2018 18:01:45 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-bts[master]: bts-trx: Try decoding received UL bursts when SACCH frame detected as...

2018-10-23 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/11446


Change subject: bts-trx: Try decoding received UL bursts when SACCH frame 
detected as lost
..

bts-trx: Try decoding received UL bursts when SACCH frame detected as lost

This way if for instance only 1 out of 3 bursts was lost, reported ul
mesuarement is more similar to expected values.

Related: OS#3665
Change-Id: I910277df181df5082b234c1c97a75eebdffc2cb5
---
M src/osmo-bts-trx/scheduler_trx.c
1 file changed, 61 insertions(+), 41 deletions(-)



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

diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index fa3aed2..332a41d 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -65,6 +65,61 @@
return 1 * n_errors / n_bits_total;
 }

+static void reset_ul_bursts(struct l1sched_chan_state *chan_state, uint32_t 
first_fn)
+{
+   if (chan_state->ul_bursts)
+   memset(chan_state->ul_bursts, 0, 464);
+   chan_state->ul_mask = 0x0;
+   chan_state->ul_first_fn = first_fn;
+   chan_state->rssi_sum = 0;
+   chan_state->rssi_num = 0;
+   chan_state->toa256_sum = 0;
+   chan_state->toa_num = 0;
+}
+
+static int _submit_ph_data_ind_with_ul_meas_res(struct l1sched_trx *l1t, 
uint8_t tn,
+   uint32_t fn, enum trx_chan_type chan,
+   struct l1sched_chan_state *chan_state)
+{
+   uint8_t l2[GSM_MACBLOCK_LEN], l2_len;
+   int n_errors, n_bits_total;
+   uint16_t ber10k;
+   float rssi;
+   int16_t toa256;
+   int rc;
+   struct l1sched_ts *l1ts = l1sched_trx_get_ts(l1t, tn);
+
+   /* empty mask -> empty buffer, no need to decode buffer (buffer may not 
even be allocated) */
+   if (chan_state->ul_mask == 0x0) {
+   l1if_process_meas_res(l1t->trx, tn, fn, 
trx_chan_desc[chan].chan_nr | tn,
+ 456, 456, -110, 0);
+   ber10k = compute_ber10k(0, 456);
+   return _sched_compose_ph_data_ind(l1t, tn, 0, chan, NULL, 0,
+  -110, 0, 0, ber10k,
+  PRES_INFO_INVALID);
+   }
+
+   /* Once processed, erase mask so they are not used again, also 
invalidating ul_first_fn */
+   chan_state->ul_mask = 0x0;
+   rssi = chan_state->rssi_sum / chan_state->rssi_num;
+   toa256 = chan_state->toa256_sum / chan_state->toa_num;
+   /* decode */
+   rc = gsm0503_xcch_decode(l2, chan_state->ul_bursts, _errors, 
_bits_total);
+   if (rc) {
+   LOGL1S(DL1P, LOGL_NOTICE, l1t, tn, chan, fn, "Received bad data 
(%u/%u)\n",
+   chan_state->ul_first_fn, chan_state->ul_first_fn % 
l1ts->mf_period);
+   l2_len = 0;
+   } else
+   l2_len = GSM_MACBLOCK_LEN;
+
+   /* Send uplink measurement information to L2 */
+   l1if_process_meas_res(l1t->trx, tn, chan_state->ul_first_fn, 
trx_chan_desc[chan].chan_nr | tn,
+   n_errors, n_bits_total, rssi, toa256);
+   ber10k = compute_ber10k(n_bits_total, n_errors);
+   return _sched_compose_ph_data_ind(l1t, tn, chan_state->ul_first_fn, 
chan, l2, l2_len,
+ rssi,  4 * toa256, 0, ber10k, 
PRES_INFO_UNKNOWN);
+}
+
 /*
  * TX on downlink
  */
@@ -194,16 +249,9 @@
if (L1SAP_IS_LINK_SACCH(trx_chan_desc[chan].link_id)) {
/* count and send BFI */
if (++(l1ts->chan_state[chan].lost_frames) > 1) {
-   /* 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 */
-   _sched_compose_ph_data_ind(l1t, tn, 0, chan, NULL, 0,
-  -110, 0, 0, 1,
-  PRES_INFO_INVALID);
+   _submit_ph_data_ind_with_ul_meas_res(l1t, tn, fn, chan, 
>chan_state[chan]);
+   /* Don't keep re-sending same meas result cached over 
and over */
+   reset_ul_bursts(>chan_state[chan], fn);
}
}

@@ -767,10 +815,6 @@
uint8_t *rssi_num = _state->rssi_num;
int32_t *toa256_sum = _state->toa256_sum;
uint8_t *toa_num = _state->toa_num;
-   uint8_t l2[GSM_MACBLOCK_LEN], l2_len;
-   int n_errors, n_bits_total;
-   uint16_t ber10k;
-   int rc;

/* handle RACH, if handover RACH detection is turned on */
if