<p>dexter has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/12779">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">scheduler_trx: use stored block fn instead of calculating it.<br><br>When the block is passed up into the higher layers it it marked with the<br>frame number that points to the beginning of the block. At the moment<br>some strange calculations are used to calculate the beginning of the<br>block fn from the current fn that points at the end of the block:<br><br>PDTCH: fn != (fn + GSM_HYPERFRAME - 3) % GSM_HYPERFRAME<br>FACCH/F: fn != (fn + GSM_HYPERFRAME - 7) % GSM_HYPERFRAME<br>TCH/F: fn != (fn + GSM_HYPERFRAME - 7) % GSM_HYPERFRAME<br><br>Despite the fact that those equations do not look very trustworthy, it<br>is also not necessary to calculate the fn since the code stores the fn<br>of each beginning of a new block in chan_state->ul_first_fn (*first_fn),<br>so we can just use the stored fn when passing the block up. This also<br>makes the code more logical since the measurement indications already<br>use the stored frame number as well.<br><br>Change-Id: Ia27254bbf6e36426f7890ece6154dcd395673f63<br>Related: OS#2977<br>---<br>M src/osmo-bts-trx/scheduler_trx.c<br>1 file changed, 10 insertions(+), 14 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/79/12779/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c</span><br><span>index fa3aed2..30ef674 100644</span><br><span>--- a/src/osmo-bts-trx/scheduler_trx.c</span><br><span>+++ b/src/osmo-bts-trx/scheduler_trx.c</span><br><span>@@ -946,9 +946,9 @@</span><br><span>            return 0;</span><br><span>    }</span><br><span>    ber10k = compute_ber10k(n_bits_total, n_errors);</span><br><span style="color: hsl(0, 100%, 40%);">-        return _sched_compose_ph_data_ind(l1t, tn, (fn + GSM_HYPERFRAME - 3) % GSM_HYPERFRAME, chan,</span><br><span style="color: hsl(0, 100%, 40%);">-            l2, rc, *rssi_sum / *rssi_num, 4 * (*toa256_sum) / *toa_num, 0,</span><br><span style="color: hsl(0, 100%, 40%);">-                                   ber10k, PRES_INFO_BOTH);</span><br><span style="color: hsl(120, 100%, 40%);">+    return _sched_compose_ph_data_ind(l1t, tn, *first_fn, chan, l2, rc,</span><br><span style="color: hsl(120, 100%, 40%);">+           *rssi_sum / *rssi_num, 4 * (*toa256_sum) / *toa_num, 0, ber10k,</span><br><span style="color: hsl(120, 100%, 40%);">+               PRES_INFO_BOTH);</span><br><span> }</span><br><span> </span><br><span> /*! \brief a single TCH/F burst was received by the PHY, process it */</span><br><span>@@ -1070,9 +1070,8 @@</span><br><span>  /* FACCH */</span><br><span>  if (rc == GSM_MACBLOCK_LEN) {</span><br><span>                uint16_t ber10k = compute_ber10k(n_bits_total, n_errors);</span><br><span style="color: hsl(0, 100%, 40%);">-               _sched_compose_ph_data_ind(l1t, tn, (fn + GSM_HYPERFRAME - 7) % GSM_HYPERFRAME, chan,</span><br><span style="color: hsl(0, 100%, 40%);">-                   tch_data + amr, GSM_MACBLOCK_LEN, rssi, 4 * toa256, 0,</span><br><span style="color: hsl(0, 100%, 40%);">-                                     ber10k, PRES_INFO_UNKNOWN);</span><br><span style="color: hsl(120, 100%, 40%);">+                _sched_compose_ph_data_ind(l1t, tn, *first_fn, chan, tch_data + amr,</span><br><span style="color: hsl(120, 100%, 40%);">+                  GSM_MACBLOCK_LEN, rssi, 4 * toa256, 0, ber10k, PRES_INFO_UNKNOWN);</span><br><span> bfi:</span><br><span>           if (rsl_cmode == RSL_CMOD_SPD_SPEECH) {</span><br><span>                      /* indicate bad frame */</span><br><span>@@ -1124,7 +1123,7 @@</span><br><span> </span><br><span>         /* TCH or BFI */</span><br><span> compose_l1sap:</span><br><span style="color: hsl(0, 100%, 40%);">-      return _sched_compose_tch_ind(l1t, tn, (fn + GSM_HYPERFRAME - 7) % GSM_HYPERFRAME, chan,</span><br><span style="color: hsl(120, 100%, 40%);">+      return _sched_compose_tch_ind(l1t, tn, *first_fn, chan,</span><br><span>              tch_data, rc);</span><br><span> }</span><br><span> </span><br><span>@@ -1261,10 +1260,8 @@</span><br><span>     if (rc == GSM_MACBLOCK_LEN) {</span><br><span>                chan_state->ul_ongoing_facch = 1;</span><br><span>                 uint16_t ber10k = compute_ber10k(n_bits_total, n_errors);</span><br><span style="color: hsl(0, 100%, 40%);">-               _sched_compose_ph_data_ind(l1t, tn,</span><br><span style="color: hsl(0, 100%, 40%);">-                     (fn + GSM_HYPERFRAME - 10 - ((fn % 26) >= 19)) % GSM_HYPERFRAME, chan,</span><br><span style="color: hsl(0, 100%, 40%);">-                       tch_data + amr, GSM_MACBLOCK_LEN, rssi, toa256/64, 0,</span><br><span style="color: hsl(0, 100%, 40%);">-                                      ber10k, PRES_INFO_UNKNOWN);</span><br><span style="color: hsl(120, 100%, 40%);">+                _sched_compose_ph_data_ind(l1t, tn, *first_fn, chan, tch_data + amr,</span><br><span style="color: hsl(120, 100%, 40%);">+                  GSM_MACBLOCK_LEN, rssi, toa256/64, 0, ber10k, PRES_INFO_UNKNOWN);</span><br><span> bfi:</span><br><span>            if (rsl_cmode == RSL_CMOD_SPD_SPEECH) {</span><br><span>                      /* indicate bad frame */</span><br><span>@@ -1306,9 +1303,8 @@</span><br><span>      * with the slot 12, so an extra FN must be subtracted to get correct</span><br><span>         * start of frame.</span><br><span>    */</span><br><span style="color: hsl(0, 100%, 40%);">-     return _sched_compose_tch_ind(l1t, tn,</span><br><span style="color: hsl(0, 100%, 40%);">-          (fn + GSM_HYPERFRAME - 10 - ((fn%26)==19) - ((fn%26)==20)) % GSM_HYPERFRAME,</span><br><span style="color: hsl(0, 100%, 40%);">-            chan, tch_data, rc);</span><br><span style="color: hsl(120, 100%, 40%);">+  printf("TCHH\n");</span><br><span style="color: hsl(120, 100%, 40%);">+   return _sched_compose_tch_ind(l1t, tn, *first_fn, chan, tch_data, rc);</span><br><span> }</span><br><span> </span><br><span> /* schedule all frames of all TRX for given FN */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/12779">change 12779</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/12779"/><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-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ia27254bbf6e36426f7890ece6154dcd395673f63 </div>
<div style="display:none"> Gerrit-Change-Number: 12779 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>