<p>dexter has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bts/+/21024">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">sched_lchan_tchh: redirect FACCH measurements via BFI TCH indication<br><br>A FACCH block is spread over 6 frames. This means that two TCH blocks<br>are skipped in favor of the FACCH. In speach mode the missing TCH blocks<br>will emit a TCH indication anyway. Those indications carry no<br>measurement results. Unfortunately the anpredictable behaviour of the<br>FACCH and the asymetric block sizes create an uneaven stream of<br>measurement results which makes processing of the measurement results<br>rather difficult. However, the processing of the measurement results can<br>be simplified when we even out the measurement results by redirecting<br>the FACCH measurements via BFI TCH indications.<br><br>Change-Id: Ib1f0dfe4cb03a356254503abf51e9f27d0dd2179<br>Related: OS#4799<br>---<br>M include/osmo-bts/scheduler.h<br>M src/osmo-bts-trx/sched_lchan_tchh.c<br>2 files changed, 37 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/24/21024/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h</span><br><span>index 6bb0b9b..2536609 100644</span><br><span>--- a/include/osmo-bts/scheduler.h</span><br><span>+++ b/include/osmo-bts/scheduler.h</span><br><span>@@ -114,6 +114,7 @@</span><br><span>        /* TCH/H */</span><br><span>  uint8_t                 dl_ongoing_facch; /* FACCH/H on downlink */</span><br><span>  uint8_t                 ul_ongoing_facch; /* FACCH/H on uplink */</span><br><span style="color: hsl(120, 100%, 40%);">+     struct l1sched_meas_set meas_avg_facch;   /* Last FACCH/H measurement sample */</span><br><span> </span><br><span>  /* encryption */</span><br><span>     int                     ul_encr_algo;   /* A5/x encry algo downlink */</span><br><span>diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c</span><br><span>index c7dac70..85c8a25 100644</span><br><span>--- a/src/osmo-bts-trx/sched_lchan_tchh.c</span><br><span>+++ b/src/osmo-bts-trx/sched_lchan_tchh.c</span><br><span>@@ -71,6 +71,7 @@</span><br><span>  uint16_t ber10k;</span><br><span>     uint8_t is_sub = 0;</span><br><span>  uint8_t ft;</span><br><span style="color: hsl(120, 100%, 40%);">+   bool redirect_facch_meas = false;</span><br><span> </span><br><span>        /* If handover RACH detection is turned on, treat this burst as an Access Burst.</span><br><span>      * Handle NOPE.ind as usually to ensure proper Uplink measurement reporting. */</span><br><span>@@ -128,6 +129,11 @@</span><br><span>                * was decoded (see below), now send the second one. */</span><br><span>              ber10k = 0;</span><br><span>          memset(&meas_avg, 0, sizeof(meas_avg));</span><br><span style="color: hsl(120, 100%, 40%);">+           /* Redirect FACCH measurement values via BFI TCH indications.</span><br><span style="color: hsl(120, 100%, 40%);">+          * this is only valid for SPEECH mode, since in SIGNALLING no</span><br><span style="color: hsl(120, 100%, 40%);">+          * BFI TCH indications are generated. */</span><br><span style="color: hsl(120, 100%, 40%);">+              if (rsl_cmode == RSL_CMOD_SPD_SPEECH)</span><br><span style="color: hsl(120, 100%, 40%);">+                 redirect_facch_meas = 1;</span><br><span>             goto bfi;</span><br><span>    }</span><br><span> </span><br><span>@@ -262,6 +268,17 @@</span><br><span>                         fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_FACCH_H0);</span><br><span>           else</span><br><span>                         fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_FACCH_H1);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+          /* (see also note above). We backup the measurement values we received</span><br><span style="color: hsl(120, 100%, 40%);">+                 * with the FACCH/H, then we invalidate the measurement value, so that</span><br><span style="color: hsl(120, 100%, 40%);">+                 * the higher layers will not count the measurement value we hand over</span><br><span style="color: hsl(120, 100%, 40%);">+                 * with the FACCH DATA indication. */</span><br><span style="color: hsl(120, 100%, 40%);">+         if (rsl_cmode == RSL_CMOD_SPD_SPEECH) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       memcpy(&chan_state->meas_avg_facch, &meas_avg, sizeof(chan_state->meas_avg_facch));</span><br><span style="color: hsl(120, 100%, 40%);">+                     meas_avg.rssi = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+                    redirect_facch_meas = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+              }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>          _sched_compose_ph_data_ind(l1t, bi->tn, fn_begin, chan,</span><br><span>                   tch_data + amr, GSM_MACBLOCK_LEN,</span><br><span>                    meas_avg.rssi, meas_avg.toa256,</span><br><span>@@ -326,10 +343,25 @@</span><br><span>              fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_TCH_H0);</span><br><span>     else</span><br><span>                 fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_TCH_H1);</span><br><span style="color: hsl(0, 100%, 40%);">-        return _sched_compose_tch_ind(l1t, bi->tn, fn_begin, chan, tch_data, rc,</span><br><span style="color: hsl(0, 100%, 40%);">-                                   /* FIXME: what should we use for BFI here? */</span><br><span style="color: hsl(0, 100%, 40%);">-                                   bfi_flag ? bi->toa256 : meas_avg.toa256, ber10k,</span><br><span style="color: hsl(0, 100%, 40%);">-                                     bfi_flag ? bi->rssi : meas_avg.rssi, is_sub);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      /* Use measurement values from the last FACCH transmission instead of</span><br><span style="color: hsl(120, 100%, 40%);">+  * the current one. This is only done when a previous FACCH transmission</span><br><span style="color: hsl(120, 100%, 40%);">+       * took out two TCH voice blocks. To maintain a constant stream of</span><br><span style="color: hsl(120, 100%, 40%);">+     * measurement values we redirect the measurement values we have</span><br><span style="color: hsl(120, 100%, 40%);">+       * received with the FACCH to the two replacement BFI TCH indications. */</span><br><span style="color: hsl(120, 100%, 40%);">+     if(redirect_facch_meas)</span><br><span style="color: hsl(120, 100%, 40%);">+               memcpy(&meas_avg, &chan_state->meas_avg_facch, sizeof(chan_state->meas_avg_facch));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   rc = _sched_compose_tch_ind(l1t, bi->tn, fn_begin, chan, tch_data, rc,</span><br><span style="color: hsl(120, 100%, 40%);">+                                 /* FIXME: what should we use for BFI here? */</span><br><span style="color: hsl(120, 100%, 40%);">+                                 bfi_flag ? bi->toa256 : meas_avg.toa256, ber10k,</span><br><span style="color: hsl(120, 100%, 40%);">+                                   bfi_flag ? bi->rssi : meas_avg.rssi, is_sub);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        /* Invalidate the cached measurement value from the last FACCH. */</span><br><span style="color: hsl(120, 100%, 40%);">+    if (redirect_facch_meas && chan_state->ul_ongoing_facch == 0)</span><br><span style="color: hsl(120, 100%, 40%);">+              chan_state->meas_avg_facch.rssi = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     return rc;</span><br><span> }</span><br><span> </span><br><span> /* common section for generation of TCH bursts (TCH/H and TCH/F).</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bts/+/21024">change 21024</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bts/+/21024"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bts </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ib1f0dfe4cb03a356254503abf51e9f27d0dd2179 </div>
<div style="display:none"> Gerrit-Change-Number: 21024 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>