<p>fixeria has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bts/+/24307">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">osmo-bts-trx: fix hopping pointer bug in bts_sched_fn()<br><br>In change [1] together with the actual implementation I introduced<br>a serious bug to bts_sched_fn(): if a timeslot is configured to use<br>frequency hopping, both 'pinst' and 'l1h' pointers are *overwriten*<br>in the inner loop, so the Downlink burst is re-directed to the<br>approproate PHY instance.  However, if a subsequent timeslot is not<br>hopping, the Downlink burst would be re-directed to the wrong PHY<br>instance because both pointers were overwriten during a previous<br>iteration.<br><br>Let's move the 'struct phy_instance' pointer to the inner loop, so<br>it's properly re-initialized for each timeslot iteration.<br><br>Change-Id: I9afbbef8dc5d885763356470c27d4392dce8e815<br>Fixes: [1] I68f4ae09fd0789ad0d8f1c1e17e17dfc4de8e462<br>Related: SYS#4868, OS#4546<br>---<br>M src/osmo-bts-trx/scheduler_trx.c<br>1 file changed, 6 insertions(+), 5 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/07/24307/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 43fa273..efca870 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>@@ -107,9 +107,9 @@</span><br><span> </span><br><span>         /* process every TRX */</span><br><span>      llist_for_each_entry(trx, &bts->trx_list, list) {</span><br><span style="color: hsl(0, 100%, 40%);">-                struct phy_instance *pinst = trx->role_bts.l1h;</span><br><span style="color: hsl(0, 100%, 40%);">-              struct phy_link *plink = pinst->phy_link;</span><br><span style="color: hsl(0, 100%, 40%);">-            struct trx_l1h *l1h = pinst->u.osmotrx.hdl;</span><br><span style="color: hsl(120, 100%, 40%);">+                const struct phy_instance *_pinst = trx->role_bts.l1h;</span><br><span style="color: hsl(120, 100%, 40%);">+             const struct phy_link *plink = _pinst->phy_link;</span><br><span style="color: hsl(120, 100%, 40%);">+           struct trx_l1h *l1h = _pinst->u.osmotrx.hdl;</span><br><span>              struct l1sched_trx *l1t = &l1h->l1s;</span><br><span> </span><br><span>              /* we don't schedule, if power is off */</span><br><span>@@ -122,6 +122,8 @@</span><br><span> </span><br><span>               /* process every TS of TRX */</span><br><span>                for (tn = 0; tn < ARRAY_SIZE(l1t->ts); tn++) {</span><br><span style="color: hsl(120, 100%, 40%);">+                  const struct phy_instance *pinst = _pinst;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>                         /* ready-to-send */</span><br><span>                  _sched_rts(l1t, tn, GSM_TDMA_FN_SUM(sched_fn, plink->u.osmotrx.rts_advance));</span><br><span> </span><br><span>@@ -143,7 +145,6 @@</span><br><span>                           pinst = dlfh_route_br(&br, &trx->ts[tn]);</span><br><span>                                 if (pinst == NULL)</span><br><span>                                   continue;</span><br><span style="color: hsl(0, 100%, 40%);">-                               l1h = pinst->u.osmotrx.hdl;</span><br><span>                       }</span><br><span> </span><br><span>                        if (pinst->trx == bts->c0) {</span><br><span>@@ -153,7 +154,7 @@</span><br><span>                             br.att = 0;</span><br><span>                  }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-                   trx_if_send_burst(l1h, &br);</span><br><span style="color: hsl(120, 100%, 40%);">+                      trx_if_send_burst(pinst->u.osmotrx.hdl, &br);</span><br><span>                 }</span><br><span>    }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bts/+/24307">change 24307</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/+/24307"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bts </div>
<div style="display:none"> Gerrit-Branch: rel-1.3.2 </div>
<div style="display:none"> Gerrit-Change-Id: I9afbbef8dc5d885763356470c27d4392dce8e815 </div>
<div style="display:none"> Gerrit-Change-Number: 24307 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>