Change in osmo-pcu[master]: Update IA Rest Octets encoding

Max gerrit-no-reply at lists.osmocom.org
Wed Mar 13 18:12:44 UTC 2019


Max has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/45/13245/1

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: newchange
Gerrit-Change-Id: I7ed5270bf95c3f6e9e026ff447eef8539f6f0314
Gerrit-Change-Number: 13245
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190313/5bd80785/attachment.html>


More information about the gerrit-log mailing list