aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2019-03-12 18:31:54 +0100
committerMax <msuraev@sysmocom.de>2019-03-27 12:32:04 +0000
commit0367ddd62b3c8a24358534bf8e500f7cac3300a6 (patch)
treee9b29abea2efca55188f866fbca61b9b8f102c2c
parent6e96dd4665bf5f287283fbf1087f3d218222ea71 (diff)
Rewrite Packet Uplink IA Rest Octets for MBA
Use bitvec_set_*() directly without external write pointer tracking to simplify the code. This is part of IA Rest Octets (3GPP TS 44.018 ยง10.5.2.16) which is the last part of the message so it should not interfere with the rest of encoding functions. That's partially based on reverted commit 93d947f5e8a30acc9250c124bf9d5bb6a8863526. Change-Id: Ibe294b26ac374b9264a734db9663cacc105a4474 Related: OS#3014
-rw-r--r--src/encoding.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/encoding.cpp b/src/encoding.cpp
index b0d04679..769e049b 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -257,30 +257,30 @@ static int write_ia_rest_uplink_sba(bitvec *dest, uint32_t fn, uint8_t alpha, ui
}
static int write_ia_rest_uplink_mba(const gprs_rlcmac_ul_tbf *tbf, bitvec *dest, uint8_t usf,
- uint8_t alpha, uint8_t gamma, unsigned& wp)
+ uint8_t alpha, uint8_t gamma)
{
int rc = 0;
- bitvec_write_field(dest, &wp, 1, 1); // Block Allocation: Not Single Block Allocation
- bitvec_write_field(dest, &wp, tbf->tfi(), 5); // TFI_ASSIGNMENT Temporary Flow Identity
- bitvec_write_field(dest, &wp, 0, 1); // POLLING
- bitvec_write_field(dest, &wp, 0, 1); // ALLOCATION_TYPE: dynamic
- bitvec_write_field(dest, &wp, usf, 3); // USF
- bitvec_write_field(dest, &wp, 0, 1); // USF_GRANULARITY
- bitvec_write_field(dest, &wp, 0, 1); // "0" power control: Not Present
- bitvec_write_field(dest, &wp, mcs_chan_code(tbf->current_cs()), 2); // CHANNEL_CODING_COMMAND
- bitvec_write_field(dest, &wp, 1, 1); // TLLI_BLOCK_CHANNEL_CODING
- if (alpha) {
- bitvec_write_field(dest, &wp, 0x1, 1); // ALPHA = present
- bitvec_write_field(dest, &wp, alpha, 4); // ALPHA
- } else
- bitvec_write_field(dest, &wp, 0x0, 1); // ALPHA = not present
+ SET_1(dest); /* Multi Block Allocation */
+
+ rc = write_tfi_usf(dest, tbf, usf);
+ CHECK(rc);
- bitvec_write_field(dest, &wp, gamma, 5); // GAMMA power control parameter
+ /* 3GPP TS 44.060 Table 11.2.28.2 Channel Coding Indicator */
+ rc = bitvec_set_u64(dest, mcs_chan_code(tbf->current_cs()), 2, false); /* CHANNEL_CODING_COMMAND */
+ CHECK(rc);
- /* note: there is no choise for TAI and no starting time */
- bitvec_write_field(dest, &wp, 0, 1); // switch TIMING_ADVANCE_INDEX = off
- bitvec_write_field(dest, &wp, 0, 1); // TBF_STARTING_TIME_FLAG
+ /* TLLI_BLOCK_CHANNEL_CODING */
+ SET_1(dest); /* use coding scheme as specified by the corresponding CHANNEL CODING COMMAND */
+
+ rc = write_alpha_gamma(dest, alpha, gamma);
+ CHECK(rc);
+
+ /* No TIMING_ADVANCE_INDEX */
+ SET_0(dest);
+
+ /* No TBF_STARTING_TIME */
+ SET_0(dest);
return rc;
}
@@ -520,7 +520,8 @@ int Encoding::write_immediate_assignment(
bitvec_write_field(dest, &wp, 0, 2); // "0" Packet Uplink Assignment
if (as_ul_tbf(tbf) != NULL) {
- rc = write_ia_rest_uplink_mba(as_ul_tbf(tbf), dest, usf, alpha, gamma, wp);
+ dest->cur_bit = wp;
+ rc = write_ia_rest_uplink_mba(as_ul_tbf(tbf), dest, usf, alpha, gamma);
} else {
rc = write_ia_rest_uplink_sba(dest, fn, alpha, gamma, ta_idx, wp);
}