aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-07-14 15:41:17 +0200
committerHarald Welte <laforge@gnumonks.org>2016-07-28 06:20:41 +0000
commitd572054ca77c62fcddbde93a7d354a1fdf8f0ff6 (patch)
treee9a3cf88845da8d82665b2a9d038693ee98cd684 /src
parent878bd1f296379ffba949d6fcae2938c13406df5b (diff)
Properly set TA_VALID bit
Check Timing Advance validity and set corresponding bit for Immediate Assignment message. Previously !polling was errorneously used (polling bit has nothing to do with TA validity according to 3GPP TS 44.018 Table 10.5.2.16.1) which lead to TA being always valid as polling is always 0 in other parts of the code. Change-Id: I5d7ecc7f71402b945cae99332be2ebc0b17b9d44 Related: OS#1526
Diffstat (limited to 'src')
-rw-r--r--src/encoding.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/encoding.cpp b/src/encoding.cpp
index 9f3b31d..a778ef0 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -29,13 +29,16 @@ extern "C" {
#include <osmocom/gprs/protocol/gsm_04_60.h>
}
+#include <osmocom/gsm/protocol/gsm_04_08.h>
+
+#include <stdbool.h>
#include <errno.h>
#include <string.h>
static int write_ia_rest_downlink(
gprs_rlcmac_dl_tbf *tbf,
bitvec * dest, unsigned& wp,
- uint8_t polling, uint32_t fn,
+ uint8_t polling, bool ta_valid, uint32_t fn,
uint8_t alpha, uint8_t gamma, int8_t ta_idx)
{
if (!tbf) {
@@ -58,7 +61,7 @@ static int write_ia_rest_downlink(
}
bitvec_write_field(dest, wp,gamma,5); // GAMMA power control parameter
bitvec_write_field(dest, wp,polling,1); // Polling Bit
- bitvec_write_field(dest, wp,!polling,1); // TA_VALID ???
+ bitvec_write_field(dest, wp, ta_valid, 1); // N. B: NOT related to TAI!
if (ta_idx < 0) {
bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off
} else {
@@ -208,7 +211,7 @@ int Encoding::write_immediate_assignment(
if (downlink)
rc = write_ia_rest_downlink(as_dl_tbf(tbf), dest, wp,
- polling, fn,
+ polling, gsm48_ta_is_valid(ta), fn,
alpha, gamma, ta_idx);
else if (as_ul_tbf(tbf) && as_ul_tbf(tbf)->is_egprs_enabled())
rc = write_ia_rest_egprs_uplink(as_ul_tbf(tbf), dest, wp,