Change in osmo-pcu[master]: encoding: Encode TA as unsigned and check validty against GSM48_TA_IN...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Jul 14 09:43:41 UTC 2020


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/19176 )

Change subject: encoding: Encode TA as unsigned and check validty against GSM48_TA_INVALID
......................................................................

encoding: Encode TA as unsigned and check validty against GSM48_TA_INVALID

According to 3GPP TS 44.018 sec 10.5.2.40, Timing Advance value is 8 bit
and range is 0-63 (0-219 on GSM400). Unsigned value (uint8_t) is used
everywhere else, so avoid using a signed one here, and simply check for
GSM48_TA_INVALID here, which we use everywhere else to initialize when the
value is not known. Ideally we should check for value based on band, but
it makes more sense to check that when receiving the data and storing in
in set_ta().

Change-Id: I82b13561d0fe5ebafb5c3a8b9a501045c29809bc
---
M src/encoding.cpp
1 file changed, 3 insertions(+), 3 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  daniel: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/encoding.cpp b/src/encoding.cpp
index 89cc5f2..32358c3 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -142,9 +142,9 @@
 }
 
 /* { 0 | 1 < TIMING_ADVANCE_VALUE : bit (6) > } */
-static inline void write_ta(bitvec *dest, unsigned& wp, int8_t ta)
+static inline void write_ta(bitvec *dest, unsigned& wp, uint8_t ta)
 {
-	if (ta < 0) /* No TIMING_ADVANCE_VALUE: */
+	if (ta >= GSM48_TA_INVALID) /* No TIMING_ADVANCE_VALUE: */
 		bitvec_write_field(dest, &wp, 0, 1);
 	else { /* TIMING_ADVANCE_VALUE: */
 		bitvec_write_field(dest, &wp, 1, 1);
@@ -174,7 +174,7 @@
            < TIMING_ADVANCE_TIMESLOT_NUMBER : bit (3) > }
  */
 static inline void write_ta_ie(bitvec *dest, unsigned& wp,
-			       int8_t ta, int8_t tai, uint8_t ts)
+			       uint8_t ta, int8_t tai, uint8_t ts)
 {
 	write_ta(dest, wp, ta);
 	if (write_tai(dest, wp, tai)) /* TIMING_ADVANCE_TIMESLOT_NUMBER: */

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/19176
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I82b13561d0fe5ebafb5c3a8b9a501045c29809bc
Gerrit-Change-Number: 19176
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-CC: laforge <laforge at osmocom.org>
Gerrit-CC: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200714/9177d940/attachment.htm>


More information about the gerrit-log mailing list