Max has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13245 )

Change subject: Update IA Rest Octets encoding
......................................................................

Update IA Rest Octets encoding

Write initial bits of 3GPP TS 44.018 §10.5.2.16 IA Rest Octets the same
way as  write_ia_rest_*() routines do.

This should also fix the issue addressed in
I75dd5bebc74eea85edf9582607c774d0bba0d2a6 initially by properly encoding
L/H bits.

Change-Id: I7ed5270bf95c3f6e9e026ff447eef8539f6f0314
---
M src/encoding.cpp
1 file changed, 13 insertions(+), 17 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/encoding.cpp b/src/encoding.cpp
index b460d41..1b325b4 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -497,41 +497,37 @@
        plen = wp / 8;

        /* 3GPP TS 44.018 §10.5.2.16 IA Rest Octets */
+       dest->cur_bit = wp;
        if (downlink) {
                if (!as_dl_tbf(tbf)) {
                        LOGP(DRLCMACDL, LOGL_ERROR, "Cannot encode DL IMMEDIATE 
ASSIGNMENT without TBF\n");
                        return -EINVAL;
                }

-               dest->cur_bit = wp;
                rc = write_ia_rest_downlink(as_dl_tbf(tbf), dest, polling, 
gsm48_ta_is_valid(ta), fn, alpha, gamma,
                                            ta_idx);
        } else if (((burst_type == GSM_L1_BURST_TYPE_ACCESS_1) || (burst_type 
== GSM_L1_BURST_TYPE_ACCESS_2))) {
-               bitvec_write_field(dest, &wp, 1, 2);    /* LH */
-               bitvec_write_field(dest, &wp, 0, 2);    /* 0 EGPRS Uplink 
Assignment */
-               bitvec_write_field(dest, &wp, ra & 0x1F, 5);    /* Extended RA 
*/
-               bitvec_write_field(dest, &wp, 0, 1);    /* Access technology 
Request */
+               SET_L(dest); SET_H(dest); // "LH"
+               SET_0(dest); SET_0(dest); // "00" < EGPRS Packet Uplink 
Assignment >
+               rc = bitvec_set_u64(dest, ra & 0x1F, 5, false); // < Extended 
RA >
+               CHECK(rc);

-               if (as_ul_tbf(tbf) != NULL) {
-                       dest->cur_bit = wp;
+               SET_0(dest); // No < Access Technologies Request struct >
+
+               if (as_ul_tbf(tbf) != NULL)
                        rc = write_ia_rest_egprs_uplink_sba(as_ul_tbf(tbf), 
dest, usf, alpha, gamma, ta_idx);
-               } else {
-                       dest->cur_bit = wp;
+               else
                        rc = write_ia_rest_egprs_uplink_mba(dest, fn, alpha, 
gamma);
-               }
        } else {
                OSMO_ASSERT(!tbf || !tbf->is_egprs_enabled());

-               bitvec_write_field(dest, &wp, 3, 2);    // "HH"
-               bitvec_write_field(dest, &wp, 0, 2);    // "0" Packet Uplink 
Assignment
+               SET_H(dest); SET_H(dest); // "HH"
+               SET_0(dest); SET_0(dest); // "00" < Packet Uplink Assignment >

-               if (as_ul_tbf(tbf) != NULL) {
-                       dest->cur_bit = wp;
+               if (as_ul_tbf(tbf) != NULL)
                        rc = write_ia_rest_uplink_mba(as_ul_tbf(tbf), dest, 
usf, alpha, gamma, ta_idx);
-               } else {
-                       dest->cur_bit = wp;
+               else
                        rc = write_ia_rest_uplink_sba(dest, fn, alpha, gamma);
-               }
        }

        if (rc < 0) {

--
To view, visit https://gerrit.osmocom.org/13245
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I7ed5270bf95c3f6e9e026ff447eef8539f6f0314
Gerrit-Change-Number: 13245
Gerrit-PatchSet: 5
Gerrit-Owner: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msur...@sysmocom.de>

Reply via email to