<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-pcu/+/25010">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">tbf: Drop impossible paths in create_dl_ass()<br><br>create_dl_ass() is only called in gprs_rlcmac_sched.cpp on<br>tbf_cand->dl_ass pointer, which is always assigned under the guard<br>"!tbf->is_control_ts(pdch->ts_no)", since we only send CTRL messages for<br>a TBF on its control TS.<br>Hence, condition "!is_control_ts(ts)" in create_dl_ass will always be<br>false, and as a result poll_ass_dl will always be 1.<br>So we can drop different code paths.<br><br>Change-Id: Ibea4100a5dc8bd49303cb6a3d02417038c3d3887<br>---<br>M src/tbf.cpp<br>1 file changed, 13 insertions(+), 27 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/10/25010/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/tbf.cpp b/src/tbf.cpp</span><br><span>index e83f472..fcad879 100644</span><br><span>--- a/src/tbf.cpp</span><br><span>+++ b/src/tbf.cpp</span><br><span>@@ -852,29 +852,24 @@</span><br><span>        struct msgb *msg;</span><br><span>    struct gprs_rlcmac_dl_tbf *new_dl_tbf = NULL;</span><br><span>        RlcMacDownlink_t *mac_control_block = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-     int poll_ass_dl = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+  const int poll_ass_dl = 1;</span><br><span>   unsigned int rrbp = 0;</span><br><span>       uint32_t new_poll_fn = 0;</span><br><span>    int rc;</span><br><span>      bool old_tfi_is_valid = is_tfi_assigned();</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  if (direction == GPRS_RLCMAC_DL_TBF && !is_control_ts(ts)) {</span><br><span style="color: hsl(0, 100%, 40%);">-            LOGPTBF(this, LOGL_NOTICE,</span><br><span style="color: hsl(0, 100%, 40%);">-                      "Cannot poll for downlink assignment, because MS cannot reply. (TS=%d, first common TS=%d)\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                        ts, first_common_ts);</span><br><span style="color: hsl(0, 100%, 40%);">-           poll_ass_dl = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+      /* We only use this function in control TS (PACCH) so that MS can always answer the poll */</span><br><span style="color: hsl(120, 100%, 40%);">+   OSMO_ASSERT(is_control_ts(ts));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     if (ul_ass_state == GPRS_RLCMAC_UL_ASS_WAIT_ACK)</span><br><span style="color: hsl(120, 100%, 40%);">+      {</span><br><span style="color: hsl(120, 100%, 40%);">+             LOGPTBF(this, LOGL_DEBUG,</span><br><span style="color: hsl(120, 100%, 40%);">+                       "Polling is already scheduled, so we must wait for the uplink assignment...\n");</span><br><span style="color: hsl(120, 100%, 40%);">+          return NULL;</span><br><span>         }</span><br><span style="color: hsl(0, 100%, 40%);">-       if (poll_ass_dl) {</span><br><span style="color: hsl(0, 100%, 40%);">-              if (ul_ass_state == GPRS_RLCMAC_UL_ASS_WAIT_ACK)</span><br><span style="color: hsl(0, 100%, 40%);">-                {</span><br><span style="color: hsl(0, 100%, 40%);">-                       LOGPTBF(this, LOGL_DEBUG,</span><br><span style="color: hsl(0, 100%, 40%);">-                                 "Polling is already scheduled, so we must wait for the uplink assignment...\n");</span><br><span style="color: hsl(0, 100%, 40%);">-                    return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-            }</span><br><span style="color: hsl(0, 100%, 40%);">-               rc = check_polling(fn, ts, &new_poll_fn, &rrbp);</span><br><span style="color: hsl(0, 100%, 40%);">-                if (rc < 0)</span><br><span style="color: hsl(0, 100%, 40%);">-                  return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-    }</span><br><span style="color: hsl(120, 100%, 40%);">+     rc = check_polling(fn, ts, &new_poll_fn, &rrbp);</span><br><span style="color: hsl(120, 100%, 40%);">+      if (rc < 0)</span><br><span style="color: hsl(120, 100%, 40%);">+                return NULL;</span><br><span> </span><br><span>     /* on uplink TBF we get the downlink TBF to be assigned. */</span><br><span>  if (direction == GPRS_RLCMAC_UL_TBF) {</span><br><span>@@ -938,16 +933,7 @@</span><br><span>        LOGP(DTBF, LOGL_DEBUG, "------------------------- TX : Packet Downlink Assignment -------------------------\n");</span><br><span>   bts_do_rate_ctr_inc(bts, CTR_PKT_DL_ASSIGNMENT);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-    if (poll_ass_dl) {</span><br><span style="color: hsl(0, 100%, 40%);">-              set_polling(new_poll_fn, ts, PDCH_ULC_POLL_DL_ASS);</span><br><span style="color: hsl(0, 100%, 40%);">-     } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                dl_ass_state = GPRS_RLCMAC_DL_ASS_NONE;</span><br><span style="color: hsl(0, 100%, 40%);">-         TBF_SET_STATE(new_dl_tbf, TBF_ST_FLOW);</span><br><span style="color: hsl(0, 100%, 40%);">-         tbf_assign_control_ts(new_dl_tbf);</span><br><span style="color: hsl(0, 100%, 40%);">-              /* stop pending assignment timer */</span><br><span style="color: hsl(0, 100%, 40%);">-             new_dl_tbf->t_stop(T0, "assignment (DL-TBF)");</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-     }</span><br><span style="color: hsl(120, 100%, 40%);">+     set_polling(new_poll_fn, ts, PDCH_ULC_POLL_DL_ASS);</span><br><span> </span><br><span>      talloc_free(mac_control_block);</span><br><span>      return msg;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-pcu/+/25010">change 25010</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-pcu/+/25010"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-pcu </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ibea4100a5dc8bd49303cb6a3d02417038c3d3887 </div>
<div style="display:none"> Gerrit-Change-Number: 25010 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>