<p>Max <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/12961">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Rewrite Packet Uplink IA Rest Octets for MBA<br><br>Use bitvec_set_*() directly without external write pointer tracking to<br>simplify the code. This is part of IA Rest Octets (3GPP TS 44.018<br>ยง10.5.2.16) which is the last part of the message so it should not<br>interfere with the rest of encoding functions.<br><br>That's partially based on reverted commit 93d947f5e8a30acc9250c124bf9d5bb6a8863526.<br><br>Change-Id: Ibe294b26ac374b9264a734db9663cacc105a4474<br>Related: OS#3014<br>---<br>M src/encoding.cpp<br>1 file changed, 21 insertions(+), 20 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/encoding.cpp b/src/encoding.cpp</span><br><span>index b0d0467..769e049 100644</span><br><span>--- a/src/encoding.cpp</span><br><span>+++ b/src/encoding.cpp</span><br><span>@@ -257,30 +257,30 @@</span><br><span> }</span><br><span> </span><br><span> static int write_ia_rest_uplink_mba(const gprs_rlcmac_ul_tbf *tbf, bitvec *dest, uint8_t usf,</span><br><span style="color: hsl(0, 100%, 40%);">-                             uint8_t alpha, uint8_t gamma, unsigned& wp)</span><br><span style="color: hsl(120, 100%, 40%);">+                               uint8_t alpha, uint8_t gamma)</span><br><span> {</span><br><span>       int rc = 0;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- bitvec_write_field(dest, &wp, 1, 1);    // Block Allocation: Not Single Block Allocation</span><br><span style="color: hsl(0, 100%, 40%);">-    bitvec_write_field(dest, &wp, tbf->tfi(), 5);  // TFI_ASSIGNMENT Temporary Flow Identity</span><br><span style="color: hsl(0, 100%, 40%);">- bitvec_write_field(dest, &wp, 0, 1);    // POLLING</span><br><span style="color: hsl(0, 100%, 40%);">-  bitvec_write_field(dest, &wp, 0, 1);    // ALLOCATION_TYPE: dynamic</span><br><span style="color: hsl(0, 100%, 40%);">- bitvec_write_field(dest, &wp, usf, 3);    // USF</span><br><span style="color: hsl(0, 100%, 40%);">-    bitvec_write_field(dest, &wp, 0, 1);    // USF_GRANULARITY</span><br><span style="color: hsl(0, 100%, 40%);">-  bitvec_write_field(dest, &wp, 0, 1);   // "0" power control: Not Present</span><br><span style="color: hsl(0, 100%, 40%);">-  bitvec_write_field(dest, &wp, mcs_chan_code(tbf->current_cs()), 2);    // CHANNEL_CODING_COMMAND</span><br><span style="color: hsl(0, 100%, 40%);">- bitvec_write_field(dest, &wp, 1, 1);    // TLLI_BLOCK_CHANNEL_CODING</span><br><span style="color: hsl(0, 100%, 40%);">-        if (alpha) {</span><br><span style="color: hsl(0, 100%, 40%);">-            bitvec_write_field(dest, &wp, 0x1, 1);   // ALPHA = present</span><br><span style="color: hsl(0, 100%, 40%);">-         bitvec_write_field(dest, &wp, alpha, 4);   // ALPHA</span><br><span style="color: hsl(0, 100%, 40%);">- } else</span><br><span style="color: hsl(0, 100%, 40%);">-          bitvec_write_field(dest, &wp, 0x0, 1);   // ALPHA = not present</span><br><span style="color: hsl(120, 100%, 40%);">+   SET_1(dest); /* Multi Block Allocation */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   bitvec_write_field(dest, &wp, gamma, 5);   // GAMMA power control parameter</span><br><span style="color: hsl(120, 100%, 40%);">+       rc = write_tfi_usf(dest, tbf, usf);</span><br><span style="color: hsl(120, 100%, 40%);">+   CHECK(rc);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  /* note: there is no choise for TAI and no starting time */</span><br><span style="color: hsl(0, 100%, 40%);">-     bitvec_write_field(dest, &wp, 0, 1);   // switch TIMING_ADVANCE_INDEX = off</span><br><span style="color: hsl(0, 100%, 40%);">- bitvec_write_field(dest, &wp, 0, 1);    // TBF_STARTING_TIME_FLAG</span><br><span style="color: hsl(120, 100%, 40%);">+ /* 3GPP TS 44.060 Table 11.2.28.2 Channel Coding Indicator */</span><br><span style="color: hsl(120, 100%, 40%);">+ rc = bitvec_set_u64(dest, mcs_chan_code(tbf->current_cs()), 2, false); /* CHANNEL_CODING_COMMAND */</span><br><span style="color: hsl(120, 100%, 40%);">+        CHECK(rc);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  /* TLLI_BLOCK_CHANNEL_CODING */</span><br><span style="color: hsl(120, 100%, 40%);">+       SET_1(dest); /* use coding scheme as specified by the corresponding CHANNEL CODING COMMAND */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       rc = write_alpha_gamma(dest, alpha, gamma);</span><br><span style="color: hsl(120, 100%, 40%);">+   CHECK(rc);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  /* No TIMING_ADVANCE_INDEX */</span><br><span style="color: hsl(120, 100%, 40%);">+ SET_0(dest);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        /* No TBF_STARTING_TIME */</span><br><span style="color: hsl(120, 100%, 40%);">+    SET_0(dest);</span><br><span> </span><br><span>     return rc;</span><br><span> }</span><br><span>@@ -520,7 +520,8 @@</span><br><span>                bitvec_write_field(dest, &wp, 0, 2);    // "0" Packet Uplink Assignment</span><br><span> </span><br><span>            if (as_ul_tbf(tbf) != NULL) {</span><br><span style="color: hsl(0, 100%, 40%);">-                   rc = write_ia_rest_uplink_mba(as_ul_tbf(tbf), dest, usf, alpha, gamma, wp);</span><br><span style="color: hsl(120, 100%, 40%);">+                   dest->cur_bit = wp;</span><br><span style="color: hsl(120, 100%, 40%);">+                        rc = write_ia_rest_uplink_mba(as_ul_tbf(tbf), dest, usf, alpha, gamma);</span><br><span>              } else {</span><br><span>                     rc = write_ia_rest_uplink_sba(dest, fn, alpha, gamma, ta_idx, wp);</span><br><span>           }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/12961">change 12961</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/12961"/><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-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ibe294b26ac374b9264a734db9663cacc105a4474 </div>
<div style="display:none"> Gerrit-Change-Number: 12961 </div>
<div style="display:none"> Gerrit-PatchSet: 11 </div>
<div style="display:none"> Gerrit-Owner: Max <msuraev@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Max <msuraev@sysmocom.de> </div>