Change in osmo-bts[master]: common/scheduler.c: track TDMA frame loss per logical channels

2018-10-25 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/10309 )

Change subject: common/scheduler.c: track TDMA frame loss per logical channels
..

common/scheduler.c: track TDMA frame loss per logical channels

This change modifies the logic of TDMA frame loss tracking. To
be more precise, the tracking logic was moved from per timeslot
level to per logical channel level, what makes OsmoBTS more
accurate in its measurements.

But before getting into details, it's important to clarify some
things about the Uplink burst processing in transceiver (OsmoTRX).
If an Uplink burst is detected, OsmoTRX demodulates it and sends
to OsmoBTS. If nothing is detected on a particular timeslot,
OsmoTRX will do nothing. In other words, it will not
notify OsmoBTS about this.

Meanwhile, there are usually a few logical channels mapped to a
single TDMA timeslot. Let's use SDCCH8 channel configuration as
an example (simplified layout):

  /* SDCCH/8 (ss=0), subscriber A (active) */
  { TRXC_SDCCH8_0,bid=0 },
  { TRXC_SDCCH8_0,bid=1 },
  { TRXC_SDCCH8_0,bid=2 },
  { TRXC_SDCCH8_0,bid=3 }, // <-- last_fn=X

  /* SDCCH/8 (ss=1), subscriber B (inactive) */
  { TRXC_SDCCH8_1,bid=0 },
  { TRXC_SDCCH8_1,bid=1 },
  { TRXC_SDCCH8_1,bid=2 },
  { TRXC_SDCCH8_1,bid=3 },

  /* SDCCH/8 (ss=2), subscriber C (active) */
  { TRXC_SDCCH8_2,bid=0 }, // <-- current_fn=X+5
  { TRXC_SDCCH8_2,bid=1 },
  { TRXC_SDCCH8_2,bid=2 },
  { TRXC_SDCCH8_2,bid=3 },

SDCCH8 has 8 sub-slots, so up to 8 subscribers can use a single
timeslot. Let's imagine there are three subscribers: A, B, and C.
Both A and C are active subscribers, i.e. they are continuously
transmitting UL bursts, while B is not using ss=1 anymore.

The original way of TDMA frame loss tracking was the following:

  - when an UL burst is received, store it's frame number in
the timeslot state structure (last_fn);

  - when the next UL burst is received on same timeslot, compute
how many frames elapsed since the last_fn;

  - if elapsed = (current_fn - last_fn) is lower than 10, then
iterate from (last_fn + 1) until the current_fn and send
dummy zero-filled bursts to the higher layers;

  - otherwise (elapsed > 10), process the current burst,
and do nothing :/

According to our example, subscriber A is sending 4 bursts, then
nobody is sending anything, and then subscriber C is sending
4 bursts. So, there is a 4 frames long gap between the both
transmissions, which is being substituted by dummy bursts. But,
as the logical channel on ss=1 is not active, they are dropped.

This is not that scary, but the current algorithm produces lots
of false-positives, and moreover is not able to track real frame
drops in longer periods (i.e. >10). So, tracking the frame loss
per individual logical channels makes much more sense.

Let's finally drop this hackish 'while (42) { ... }', and track
the amount of lost / received TDMA frames (bursts) individually
per logical channels. Let's also use the multiframe period as
the loss detection period, instead of hardcoded 10. And finally,
let's print more informative debug messages.

Also, it makes sense to use the amount of lost / received bursts
during the calculation of the measurement reports, instead of
sending dummy bursts, but let's do this separately.

Change-Id: I70d05b67a35ddcbdd1b6394dbd7198404a440e76
Related: OS#3428
---
M include/osmo-bts/scheduler.h
M src/common/scheduler.c
2 files changed, 142 insertions(+), 65 deletions(-)

Approvals:
  Harald Welte: Looks good to me, but someone else must approve
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 32d6e91..f9d9962 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -80,6 +80,9 @@

/* loss detection */
uint8_t lost_frames;/* how many L2 frames were lost 
*/
+   uint32_tlast_tdma_fn;   /* last processed TDMA frame 
number */
+   uint32_tproc_tdma_fs;   /* how many TDMA frames were 
processed */
+   uint32_tlost_tdma_fs;   /* how many TDMA frames were 
lost */

/* mode */
uint8_t rsl_cmode, tch_mode; /* mode for TCH channels */
@@ -124,7 +127,6 @@

 struct l1sched_ts {
uint8_t mf_index;   /* selected multiframe index */
-   uint32_tmf_last_fn; /* last received frame number */
uint8_t mf_period;  /* period of multiframe */
const struct trx_sched_frame *mf_frames; /* pointer to frame layout */

diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index 65ece7f..f705ddf 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -222,7 +222,6 @@
struct l1sched_ts *l1ts = 

Change in osmo-bts[master]: common/scheduler.c: track TDMA frame loss per logical channels

2018-10-25 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/10309 )

Change subject: common/scheduler.c: track TDMA frame loss per logical channels
..


Patch Set 4: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/10309
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: I70d05b67a35ddcbdd1b6394dbd7198404a440e76
Gerrit-Change-Number: 10309
Gerrit-PatchSet: 4
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 25 Oct 2018 09:41:58 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-bts[master]: common/scheduler.c: track TDMA frame loss per logical channels

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

Change subject: common/scheduler.c: track TDMA frame loss per logical channels
..


Patch Set 4: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/10309
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: I70d05b67a35ddcbdd1b6394dbd7198404a440e76
Gerrit-Change-Number: 10309
Gerrit-PatchSet: 4
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Wed, 24 Oct 2018 18:45:27 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-bts[master]: common/scheduler.c: track TDMA frame loss per logical channels

2018-10-24 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/10309 )

Change subject: common/scheduler.c: track TDMA frame loss per logical channels
..


Patch Set 4: Code-Review+1

+1, It has been tested locally by Vadim and I can take over from it and do some 
improvements from here.


--
To view, visit https://gerrit.osmocom.org/10309
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: I70d05b67a35ddcbdd1b6394dbd7198404a440e76
Gerrit-Change-Number: 10309
Gerrit-PatchSet: 4
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Wed, 24 Oct 2018 16:42:31 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-bts[master]: common/scheduler.c: track TDMA frame loss per logical channels

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

Change subject: common/scheduler.c: track TDMA frame loss per logical channels
..


Set Ready For Review


--
To view, visit https://gerrit.osmocom.org/10309
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: I70d05b67a35ddcbdd1b6394dbd7198404a440e76
Gerrit-Change-Number: 10309
Gerrit-PatchSet: 4
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Wed, 24 Oct 2018 16:21:34 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-bts[master]: common/scheduler.c: track TDMA frame loss per logical channels

2018-08-02 Thread Vadim Yanitskiy
Vadim Yanitskiy has uploaded a new patch set (#2). ( 
https://gerrit.osmocom.org/10309 )

Change subject: common/scheduler.c: track TDMA frame loss per logical channels
..

common/scheduler.c: track TDMA frame loss per logical channels

This change modifies the logic of TDMA frame loss tracking. To
be more precise, the tracking logic was moved from per timeslot
level to per logical channel level, what makes OsmoBTS more
accurate in its measurements.

But before getting into details, it's important to clarify some
things about the Uplink burst processing in transceiver (OsmoTRX).
If an Uplink burst is detected, OsmoTRX demodulates it and sends
to OsmoBTS. If nothing is detected on a particular timeslot,
OsmoTRX will do nothing. In other words, it will not
notify OsmoBTS about this.

Meanwhile, there are usually a few logical channels mapped to a
single TDMA timeslot. Let's use SDCCH8 channel configuration as
an example (simplified layout):

  /* SDCCH/8 (ss=0), subscriber A (active) */
  { TRXC_SDCCH8_0,bid=0 },
  { TRXC_SDCCH8_0,bid=1 },
  { TRXC_SDCCH8_0,bid=2 },
  { TRXC_SDCCH8_0,bid=3 }, // <-- last_fn=X

  /* SDCCH/8 (ss=1), subscriber B (inactive) */
  { TRXC_SDCCH8_1,bid=0 },
  { TRXC_SDCCH8_1,bid=1 },
  { TRXC_SDCCH8_1,bid=2 },
  { TRXC_SDCCH8_1,bid=3 },

  /* SDCCH/8 (ss=2), subscriber C (active) */
  { TRXC_SDCCH8_2,bid=0 }, // <-- current_fn=X+5
  { TRXC_SDCCH8_2,bid=1 },
  { TRXC_SDCCH8_2,bid=2 },
  { TRXC_SDCCH8_2,bid=3 },

SDCCH8 has 8 sub-slots, so up to 8 subscribers can use a single
timeslot. Let's imagine there are three subscribers: A, B, and C.
Both A and C are active subscribers, i.e. they are continuously
transmitting UL bursts, while B is not using ss=1 anymore.

The original way of TDMA frame loss tracking was the following:

  - when an UL burst is received, store it's frame number in
the timeslot state structure (last_fn);

  - when the next UL burst is received on same timeslot, compute
how many frames elapsed since the last_fn;

  - if elapsed = (current_fn - last_fn) is lower than 10, then
iterate from (last_fn + 1) until the current_fn and send
dummy zero-filled bursts to the higher layers;

  - otherwise (elapsed > 10), process the current burst,
and do nothing :/

According to our example, subscriber A is sending 4 bursts, then
nobody is sending anything, and then subscriber C is sending
4 bursts. So, there is a 4 frames long gap between the both
transmissions, which is being substituted by dummy bursts. But,
as the logical channel on ss=1 is not active, they are dropped.

This is not that scary, but the current algorithm produces lots
of false-positives, and moreover is not able to track real frame
drops in longer periods (i.e. >10). So, tracking the frame loss
per individual logical channels makes much more sense.

Let's finally drop this hackish 'while (42) { ... }', and track
the amount of lost / received TDMA frames (bursts) individually
per logical channels. Let's also use the multiframe period as
the loss detection period, instead of hardcoded 10. And finally,
let's print more informative debug messages.

Also, it makes sense to use the amount of lost / received bursts
during the calculation of the measurement reports, instead of
sending dummy bursts, but let's do this separately.

Change-Id: I70d05b67a35ddcbdd1b6394dbd7198404a440e76
Related: OS#3428
---
M include/osmo-bts/scheduler.h
M src/common/scheduler.c
2 files changed, 133 insertions(+), 65 deletions(-)


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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I70d05b67a35ddcbdd1b6394dbd7198404a440e76
Gerrit-Change-Number: 10309
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-CC: Jenkins Builder


Change in osmo-bts[master]: common/scheduler.c: track TDMA frame loss per logical channels

2018-08-02 Thread Vadim Yanitskiy
Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/10309


Change subject: common/scheduler.c: track TDMA frame loss per logical channels
..

common/scheduler.c: track TDMA frame loss per logical channels

This change modifies the logic of TDMA frame loss tracking. To
be more precise, the tracking logic was moved from per timeslot
level to per logical channel level, what makes OsmoBTS more
accurate in its measurements.

But before getting into details, it's important to clarify some
things about the Uplink burst processing in transceiver (OsmoTRX).
If an Uplink burst is detected, OsmoTRX demodulates it and sends
to OsmoBTS. If nothing is detected on a particular timeslot,
OsmoTRX will do nothing. In other words, it will not
notify OsmoBTS about this.

Meanwhile, there are usually a few logical channels mapped to a
single TDMA timeslot. Let's use SDCCH8 channel configuration as
an example (simplified layout):

  /* SDCCH/8 (ss=0), subscriber A (active) */
  { TRXC_SDCCH8_0,bid=0 },
  { TRXC_SDCCH8_0,bid=1 },
  { TRXC_SDCCH8_0,bid=2 },
  { TRXC_SDCCH8_0,bid=3 }, // <-- last_fn=X

  /* SDCCH/8 (ss=1), subscriber B (inactive) */
  { TRXC_SDCCH8_1,bid=0 },
  { TRXC_SDCCH8_1,bid=1 },
  { TRXC_SDCCH8_1,bid=2 },
  { TRXC_SDCCH8_1,bid=3 },

  /* SDCCH/8 (ss=2), subscriber C (active) */
  { TRXC_SDCCH8_2,bid=0 }, // <-- current_fn=X+5
  { TRXC_SDCCH8_2,bid=1 },
  { TRXC_SDCCH8_2,bid=2 },
  { TRXC_SDCCH8_2,bid=3 },

SDCCH8 has 8 sub-slots, so up to 8 subscribers can use a single
timeslot. Let's imagine there are three subscribers: A, B, and C.
Both A and C are active subscribers, i.e. they are continuously
transmitting UL bursts, while B is not using ss=1 anymore.

The original way of TDMA frame loss tracking was the following:

  - when an UL burst is received, store it's frame number in
the timeslot state structure (last_fn);

  - when the next UL burst is received on same timeslot, compute
how many frames elapsed since the last_fn;

  - if elapsed = (current_fn - last_fn) is lower than 10, then
iterate from (last_fn + 1) until the current_fn and send
dummy zero-filled bursts to the higher layers;

  - otherwise (elapsed > 10), process the current burst,
and do nothing :/

According to our example, subscriber A is sending 4 bursts, then
nobody is sending anything, and then subscriber C is sending
4 bursts. So, there is a 4 frames long gap between the both
transmissions, which is being substituted by dummy bursts. But,
as the logical channel on ss=1 is not active, they are dropped.

This is not that scary, but the current algorithm produces lots
of false-positives, and moreover is not able to track real frame
drops in longer periods (i.e. >10). So, tracking the frame loss
per individual logical channels makes much more sense.

Let's finally drop this hackish 'while (42) { ... }', and track
the amount of lost / received TDMA frames (bursts) individually
per logical channels.

Also, it makes sense to use the amount of lost / received bursts
during the calculation of the measurement reports, instead of
sending dummy bursts, but let's do this separately.

Change-Id: I70d05b67a35ddcbdd1b6394dbd7198404a440e76
Related: OS#3428
---
M include/osmo-bts/scheduler.h
M src/common/scheduler.c
2 files changed, 133 insertions(+), 65 deletions(-)



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

diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 3fe7978..4cf5440 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -79,6 +79,9 @@

/* loss detection */
uint8_t lost_frames;/* how many L2 frames were lost 
*/
+   uint32_tlast_tdma_fn;   /* last processed TDMA frame 
number */
+   uint32_tproc_tdma_fs;   /* how many TDMA frames were 
processed */
+   uint32_tlost_tdma_fs;   /* how many TDMA frames were 
lost */

/* mode */
uint8_t rsl_cmode, tch_mode; /* mode for TCH channels */
@@ -123,7 +126,6 @@

 struct l1sched_ts {
uint8_t mf_index;   /* selected multiframe index */
-   uint32_tmf_last_fn; /* last received frame number */
uint8_t mf_period;  /* period of multiframe */
const struct trx_sched_frame *mf_frames; /* pointer to frame layout */

diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index 5c250e4..9b36fa2 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -219,7 +219,6 @@
struct l1sched_ts *l1ts = l1sched_trx_get_ts(l1t, tn);

l1ts->mf_index = 0;
-   l1ts->mf_last_fn = 0;
INIT_LLIST_HEAD(>dl_prims);
for (i = 0; i < ARRAY_SIZE(l1ts->chan_state); i++) {