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/.
Max gerrit-no-reply at lists.osmocom.orgHello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/552 to look at the new patch set (#2). Handle Timing Advance IE properly Move writing Timing Advance IE and Timing Advance Index into separate functions to simplify adding PTCCH support. This also fixes previous incorrect (and unused) code for writing Global Packet TA IE. Change-Id: I786bf7fc999d401cc3d9e7f1e7a1fba953b5d458 Related: OS#1545 --- M src/encoding.cpp M src/encoding.h M src/tbf.cpp 3 files changed, 41 insertions(+), 35 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/52/552/2 diff --git a/src/encoding.cpp b/src/encoding.cpp index 9f3b31d..22fd538 100644 --- a/src/encoding.cpp +++ b/src/encoding.cpp @@ -32,6 +32,39 @@ #include <errno.h> #include <string.h> +/* { 0 | 1 < TIMING_ADVANCE_INDEX : bit (4) > } */ +static inline bool write_tai(bitvec *dest, unsigned& wp, int8_t tai) +{ + if (tai < 0) { /* No TIMING_ADVANCE_INDEX: */ + bitvec_write_field(dest, wp, 0, 1); + return false; + } + /* TIMING_ADVANCE_INDEX: */ + bitvec_write_field(dest, wp, 1, 1); + bitvec_write_field(dest, wp, tai, 4); + return true; +} + +/* { 0 | 1 < TIMING_ADVANCE_VALUE : bit (6) > } */ +static inline void write_ta(bitvec *dest, unsigned& wp, int8_t ta) +{ + if (ta < 0) /* No TIMING_ADVANCE_VALUE: */ + bitvec_write_field(dest, wp, 0, 1); + else { /* TIMING_ADVANCE_VALUE: */ + bitvec_write_field(dest, wp, 1, 1); + bitvec_write_field(dest, wp, ta, 6); + } +} + +/* 3GPP TS 44.060 § 12.12 */ +static inline void write_ta_ie(bitvec *dest, unsigned& wp, + int8_t ta, int8_t tai, uint8_t ts) +{ + write_ta(dest, wp, ta); + if (write_tai(dest, wp, tai)) /* TIMING_ADVANCE_TIMESLOT_NUMBER: */ + bitvec_write_field(dest, wp, ts, 3); +} + static int write_ia_rest_downlink( gprs_rlcmac_dl_tbf *tbf, bitvec * dest, unsigned& wp, @@ -59,12 +92,7 @@ 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 ??? - if (ta_idx < 0) { - bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off - } else { - bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on - bitvec_write_field(dest, wp,ta_idx,4); // TIMING_ADVANCE_INDEX - } + write_tai(dest, wp, ta_idx); if (polling) { bitvec_write_field(dest, wp,0x1,1); // TBF Starting TIME present bitvec_write_field(dest, wp,(fn / (26 * 51)) % 32,5); // T1' @@ -107,12 +135,7 @@ } else bitvec_write_field(dest, wp,0x0,1); // ALPHA = not present bitvec_write_field(dest, wp,gamma,5); // GAMMA power control parameter - if (ta_idx < 0) { - bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off - } else { - bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on - bitvec_write_field(dest, wp,ta_idx,4); // TIMING_ADVANCE_INDEX - } + write_tai(dest, wp, ta_idx); bitvec_write_field(dest, wp, 1, 1); // TBF_STARTING_TIME_FLAG bitvec_write_field(dest, wp,(fn / (26 * 51)) % 32,5); // T1' bitvec_write_field(dest, wp,fn % 51,6); // T3 @@ -236,7 +259,7 @@ bitvec * dest, uint8_t old_tfi, uint8_t old_downlink, uint32_t tlli, uint8_t use_tlli, struct gprs_rlcmac_ul_tbf *tbf, uint8_t poll, uint8_t rrbp, uint8_t alpha, - uint8_t gamma, int8_t ta_idx, int8_t use_egprs) + uint8_t gamma, int8_t ta_idx, uint8_t ta_ts, int8_t use_egprs) { // TODO We should use our implementation of encode RLC/MAC Control messages. unsigned wp = 0; @@ -263,16 +286,8 @@ if (!use_egprs) { bitvec_write_field(dest, wp,0x0,1); // Message escape bitvec_write_field(dest, wp,tbf->current_cs().to_num()-1, 2); // CHANNEL_CODING_COMMAND - bitvec_write_field(dest, wp,0x1,1); // TLLI_BLOCK_CHANNEL_CODING - bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_VALUE = on - bitvec_write_field(dest, wp,tbf->ta(),6); // TIMING_ADVANCE_VALUE - if (ta_idx < 0) { - bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off - } else { - bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on - bitvec_write_field(dest, wp,ta_idx,4); // TIMING_ADVANCE_INDEX - } - + bitvec_write_field(dest, wp,0x1,1); // TLLI_BLOCK_CHANNEL_CODING + write_ta_ie(dest, wp,tbf->ta(), ta_idx, ta_ts); } else { /* EPGRS */ unsigned int ws_enc = (tbf->m_window.ws() - 64) / 32; bitvec_write_field(dest, wp,0x1,1); // Message escape @@ -286,16 +301,7 @@ bitvec_write_field(dest, wp,0x0,1); // No ARAC RETRANSMISSION REQUEST bitvec_write_field(dest, wp,0x1,1); // TLLI_BLOCK_CHANNEL_CODING bitvec_write_field(dest, wp,0x0,1); // No BEP_PERIOD2 - - bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_VALUE = on - bitvec_write_field(dest, wp,tbf->ta(),6); // TIMING_ADVANCE_VALUE - if (ta_idx < 0) { - bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off - } else { - bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on - bitvec_write_field(dest, wp,ta_idx,4); // TIMING_ADVANCE_INDEX - } - + write_ta_ie(dest, wp,tbf->ta(), ta_idx, ta_ts); bitvec_write_field(dest, wp,0x0,1); // No Packet Extended Timing Advance } diff --git a/src/encoding.h b/src/encoding.h index 710de78..91e011d 100644 --- a/src/encoding.h +++ b/src/encoding.h @@ -51,7 +51,7 @@ bitvec * dest, uint8_t old_tfi, uint8_t old_downlink, uint32_t tlli, uint8_t use_tlli, struct gprs_rlcmac_ul_tbf *tbf, uint8_t poll, uint8_t rrbp, - uint8_t alpha, uint8_t gamma, int8_t ta_idx, + uint8_t alpha, uint8_t gamma, int8_t ta_idx, uint8_t ts, int8_t use_egprs); static void write_packet_downlink_assignment(RlcMacDownlink_t * block, diff --git a/src/tbf.cpp b/src/tbf.cpp index 1fc1aef..3a9b193 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -1064,7 +1064,7 @@ Encoding::write_packet_uplink_assignment(bts_data(), ass_vec, m_tfi, (direction == GPRS_RLCMAC_DL_TBF), tlli(), is_tlli_valid(), new_tbf, 1, rrbp, bts_data()->alpha, - bts_data()->gamma, -1, is_egprs_enabled()); + bts_data()->gamma, -1, 0, is_egprs_enabled()); bitvec_pack(ass_vec, msgb_put(msg, 23)); RlcMacDownlink_t * mac_control_block = (RlcMacDownlink_t *)talloc_zero(tall_pcu_ctx, RlcMacDownlink_t); LOGP(DRLCMAC, LOGL_DEBUG, "+++++++++++++++++++++++++ TX : Packet Uplink Assignment +++++++++++++++++++++++++\n"); -- To view, visit https://gerrit.osmocom.org/552 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I786bf7fc999d401cc3d9e7f1e7a1fba953b5d458 Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Jenkins Builder