aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2016-05-30 19:30:21 +0200
committerHolger Freyther <holger@freyther.de>2016-06-07 10:48:35 +0000
commit6f0dc96929d1d4b979ba26d09434e84365290802 (patch)
tree66a360d38c735b19734b7491b9e4935466dd0854
parent1a5066112f39066eac78061de1301cc861aaac45 (diff)
encoding/rlc_copy_from_aligned_buffer: export written payload bytes via an argument
Require to count statistics for rlc_dl_payload_bytes. Change-Id: I0e622acb1f13f7489946baf049de4ba1cde6a1fc Reviewed-on: https://gerrit.osmocom.org/142 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
-rw-r--r--src/encoding.cpp33
-rw-r--r--src/encoding.h3
-rw-r--r--src/tbf_dl.cpp2
-rw-r--r--tests/edge/EdgeTest.cpp107
4 files changed, 109 insertions, 36 deletions
diff --git a/src/encoding.cpp b/src/encoding.cpp
index 9dba4f6..2102a1e 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -899,13 +899,13 @@ unsigned int Encoding::rlc_copy_from_aligned_buffer(
* \param num_chunks count the chunks (llc pdu data) within rlc/mac
* \param data_block buffer holds rlc/mac data
* \param is_final if this is the last rlc/mac within a TBF
+ * \param count_payload if not NULL save the written size of payload in bytes into it
* \return the state of the rlc/mac like if there is more space for another chunk
*/
static Encoding::AppendResult rlc_data_to_dl_append_gprs(
struct gprs_rlc_data_block_info *rdbi,
gprs_llc *llc, int *offset, int *num_chunks,
- uint8_t *data_block,
- bool is_final)
+ uint8_t *data_block, bool is_final, int *count_payload)
{
int chunk;
int space;
@@ -930,6 +930,8 @@ static Encoding::AppendResult rlc_data_to_dl_append_gprs(
*e_pointer |= 0x01;
/* fill only space */
llc->consume(data, space);
+ if (count_payload)
+ *count_payload = space;
/* return data block as message */
*offset = rdbi->data_len;
(*num_chunks)++;
@@ -947,6 +949,8 @@ static Encoding::AppendResult rlc_data_to_dl_append_gprs(
*e_pointer |= 0x01;
/* fill space */
llc->consume(data, space);
+ if (count_payload)
+ *count_payload = space;
*offset = rdbi->data_len;
(*num_chunks)++;
rdbi->cv = 0;
@@ -974,6 +978,8 @@ static Encoding::AppendResult rlc_data_to_dl_append_gprs(
// no need to set e_pointer nor increase delimiter
/* fill only space, which is 1 octet less than chunk */
llc->consume(data, space);
+ if (count_payload)
+ *count_payload = space;
/* return data block as message */
*offset = rdbi->data_len;
(*num_chunks)++;
@@ -999,6 +1005,8 @@ static Encoding::AppendResult rlc_data_to_dl_append_gprs(
(*num_chunks)++;
/* copy (rest of) LLC frame to space and reset later */
llc->consume(data, chunk);
+ if (count_payload)
+ *count_payload = chunk;
data += chunk;
space -= chunk;
(*offset) += chunk;
@@ -1030,13 +1038,14 @@ static Encoding::AppendResult rlc_data_to_dl_append_gprs(
* \param num_chunks count the chunks (llc pdu data) within rlc/mac
* \param data_block buffer holds rlc/mac data
* \param is_final if this is the last rlc/mac within a TBF
+ * \param count_payload if not NULL save the written size of payload in bytes into it
* \return the state of the rlc/mac like if there is more space for another chunk
*/
static Encoding::AppendResult rlc_data_to_dl_append_egprs(
struct gprs_rlc_data_block_info *rdbi,
gprs_llc *llc, int *offset, int *num_chunks,
uint8_t *data_block,
- bool is_final)
+ bool is_final, int *count_payload)
{
int chunk;
int space;
@@ -1060,6 +1069,8 @@ static Encoding::AppendResult rlc_data_to_dl_append_egprs(
chunk, space);
/* fill only space */
llc->consume(data, space);
+ if (count_payload)
+ *count_payload = space;
/* return data block as message */
*offset = rdbi->data_len;
(*num_chunks)++;
@@ -1074,6 +1085,8 @@ static Encoding::AppendResult rlc_data_to_dl_append_egprs(
"header, and we are done\n", chunk, space);
/* fill space */
llc->consume(data, space);
+ if (count_payload)
+ *count_payload = space;
*offset = rdbi->data_len;
(*num_chunks)++;
rdbi->cv = 0;
@@ -1088,6 +1101,8 @@ static Encoding::AppendResult rlc_data_to_dl_append_egprs(
chunk, space);
/* fill space */
llc->consume(data, space);
+ if (count_payload)
+ *count_payload = space;
*offset = rdbi->data_len;
(*num_chunks)++;
return Encoding::AR_NEED_MORE_BLOCKS;
@@ -1118,6 +1133,8 @@ static Encoding::AppendResult rlc_data_to_dl_append_egprs(
(*num_chunks)++;
/* copy (rest of) LLC frame to space and reset later */
llc->consume(data, chunk);
+ if (count_payload)
+ *count_payload = chunk;
data += chunk;
space -= chunk;
(*offset) += chunk;
@@ -1183,21 +1200,23 @@ static Encoding::AppendResult rlc_data_to_dl_append_egprs(
* \param num_chunks count the chunks (llc pdu data) within rlc/mac
* \param data_block buffer holds rlc/mac data
* \param is_final if this is the last rlc/mac within a TBF
+ * \param count_payload if not NULL save the written size of payload in bytes into it
* \return the state of the rlc/mac like if there is more space for another chunk
*/
Encoding::AppendResult Encoding::rlc_data_to_dl_append(
struct gprs_rlc_data_block_info *rdbi, GprsCodingScheme cs,
gprs_llc *llc, int *offset, int *num_chunks,
- uint8_t *data_block,
- bool is_final)
+ uint8_t *data_block, bool is_final, int *count_payload)
{
if (cs.isGprs())
return rlc_data_to_dl_append_gprs(rdbi,
- llc, offset, num_chunks, data_block, is_final);
+ llc, offset, num_chunks, data_block, is_final,
+ count_payload);
if (cs.isEgprs())
return rlc_data_to_dl_append_egprs(rdbi,
- llc, offset, num_chunks, data_block, is_final);
+ llc, offset, num_chunks, data_block, is_final,
+ count_payload);
LOGP(DRLCMACDL, LOGL_ERROR, "%s data block encoding not implemented\n",
cs.name());
diff --git a/src/encoding.h b/src/encoding.h
index 94e9a02..710de78 100644
--- a/src/encoding.h
+++ b/src/encoding.h
@@ -91,6 +91,5 @@ public:
static AppendResult rlc_data_to_dl_append(
struct gprs_rlc_data_block_info *rdbi, GprsCodingScheme cs,
gprs_llc *llc, int *offset, int *num_chunks,
- uint8_t *data,
- bool is_final);
+ uint8_t *data, bool is_final, int *count_payload);
};
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 0cd6b76..66f747b 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -540,7 +540,7 @@ int gprs_rlcmac_dl_tbf::create_new_bsn(const uint32_t fn, GprsCodingScheme cs)
is_final = llc_queue()->size() == 0 && !keep_open(fn);
ar = Encoding::rlc_data_to_dl_append(rdbi, cs,
- &m_llc, &write_offset, &num_chunks, data, is_final);
+ &m_llc, &write_offset, &num_chunks, data, is_final, NULL);
if (ar == Encoding::AR_NEED_MORE_BLOCKS)
break;
diff --git a/tests/edge/EdgeTest.cpp b/tests/edge/EdgeTest.cpp
index 96ea0c1..68a0d0b 100644
--- a/tests/edge/EdgeTest.cpp
+++ b/tests/edge/EdgeTest.cpp
@@ -506,6 +506,7 @@ static void test_rlc_unit_encoder()
uint8_t llc_data[1500] = {0,};
int num_chunks = 0;
int write_offset;
+ int count_payload;
struct gprs_llc llc;
Encoding::AppendResult ar;
@@ -522,36 +523,42 @@ static void test_rlc_unit_encoder()
llc.reset();
llc.put_frame(llc_data, 11);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_SPACE_LEFT);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(write_offset == 1 + 11);
+ OSMO_ASSERT(count_payload == 11);
OSMO_ASSERT(num_chunks == 1);
llc.reset();
llc.put_frame(llc_data, 26);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_SPACE_LEFT);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(write_offset == 2 + 11 + 26);
+ OSMO_ASSERT(count_payload == 26);
OSMO_ASSERT(num_chunks == 2);
llc.reset();
llc.put_frame(llc_data, 99);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_NEED_MORE_BLOCKS);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(rdbi.cv != 0);
OSMO_ASSERT(write_offset == (int)rdbi.data_len);
+ OSMO_ASSERT(count_payload == 11);
OSMO_ASSERT(num_chunks == 3);
OSMO_ASSERT(data[0] == ((11 << 2) | (1 << 1) | (0 << 0)));
@@ -569,13 +576,15 @@ static void test_rlc_unit_encoder()
llc.reset();
llc.put_frame(llc_data, 20);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_NEED_MORE_BLOCKS);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(write_offset == 1 + 19);
+ OSMO_ASSERT(count_payload == 19);
OSMO_ASSERT(num_chunks == 1);
OSMO_ASSERT(data[0] == ((0 << 2) | (0 << 1) | (1 << 0)));
@@ -589,23 +598,28 @@ static void test_rlc_unit_encoder()
OSMO_ASSERT(llc.chunk_size() == 1);
+ count_payload = -1;
+
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_SPACE_LEFT);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(write_offset == 1 + 1);
+ OSMO_ASSERT(count_payload == 1);
OSMO_ASSERT(num_chunks == 1);
llc.reset();
llc.put_frame(llc_data, 99);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_NEED_MORE_BLOCKS);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(write_offset == 1 + 1 + 18);
+ OSMO_ASSERT(count_payload == 18);
OSMO_ASSERT(num_chunks == 2);
OSMO_ASSERT(data[0] == ((1 << 2) | (1 << 1) | (1 << 0)));
@@ -622,24 +636,28 @@ static void test_rlc_unit_encoder()
llc.reset();
llc.put_frame(llc_data, 7);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_SPACE_LEFT);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(write_offset == 1 + 7);
+ OSMO_ASSERT(count_payload == 7);
OSMO_ASSERT(num_chunks == 1);
llc.reset();
llc.put_frame(llc_data, 11);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_BLOCK_FILLED);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(write_offset == 2 + 7 + 11);
+ OSMO_ASSERT(count_payload == 11);
OSMO_ASSERT(num_chunks == 2);
OSMO_ASSERT(data[0] == ((7 << 2) | (1 << 1) | (0 << 0)));
@@ -657,13 +675,15 @@ static void test_rlc_unit_encoder()
llc.reset();
llc.put_frame(llc_data, 99);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_NEED_MORE_BLOCKS);
OSMO_ASSERT(rdbi.e == 1);
OSMO_ASSERT(write_offset == 20);
+ OSMO_ASSERT(count_payload == 20);
OSMO_ASSERT(num_chunks == 1);
OSMO_ASSERT(rdbi.cv != 0);
@@ -680,13 +700,15 @@ static void test_rlc_unit_encoder()
llc.reset();
llc.put_frame(llc_data, 20);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, true);
+ &llc, &write_offset, &num_chunks, data, true, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_BLOCK_FILLED);
OSMO_ASSERT(rdbi.e == 1);
OSMO_ASSERT(write_offset == 20);
+ OSMO_ASSERT(count_payload == 20);
OSMO_ASSERT(num_chunks == 1);
OSMO_ASSERT(rdbi.cv == 0);
@@ -703,13 +725,15 @@ static void test_rlc_unit_encoder()
llc.reset();
llc.put_frame(llc_data, 30);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_NEED_MORE_BLOCKS);
OSMO_ASSERT(rdbi.e == 1);
OSMO_ASSERT(write_offset == 20);
+ OSMO_ASSERT(count_payload == 20);
OSMO_ASSERT(num_chunks == 1);
OSMO_ASSERT(data[0] == 0);
@@ -721,24 +745,28 @@ static void test_rlc_unit_encoder()
memset(data, 0, sizeof(data));
OSMO_ASSERT(llc.chunk_size() == 10);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_SPACE_LEFT);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(write_offset == 1 + 10);
+ OSMO_ASSERT(count_payload == 10);
OSMO_ASSERT(num_chunks == 1);
llc.reset();
llc.put_frame(llc_data, 99);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_NEED_MORE_BLOCKS);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(write_offset == 1 + 10 + 9);
+ OSMO_ASSERT(count_payload == 9);
OSMO_ASSERT(num_chunks == 2);
OSMO_ASSERT(data[0] == ((10 << 2) | (1 << 1) | (1 << 0)));
@@ -755,36 +783,42 @@ static void test_rlc_unit_encoder()
llc.reset();
llc.put_frame(llc_data, 11);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_SPACE_LEFT);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(write_offset == 1 + 11);
+ OSMO_ASSERT(count_payload == 11);
OSMO_ASSERT(num_chunks == 1);
llc.reset();
llc.put_frame(llc_data, 26);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_SPACE_LEFT);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(write_offset == 2 + 11 + 26);
+ OSMO_ASSERT(count_payload == 26);
OSMO_ASSERT(num_chunks == 2);
llc.reset();
llc.put_frame(llc_data, 99);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_NEED_MORE_BLOCKS);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(rdbi.cv != 0);
OSMO_ASSERT(write_offset == (int)rdbi.data_len);
+ OSMO_ASSERT(count_payload == 5);
OSMO_ASSERT(num_chunks == 3);
OSMO_ASSERT(data[0] == ((11 << 1) | (0 << 0)));
@@ -807,25 +841,30 @@ static void test_rlc_unit_encoder()
llc.reset();
llc.put_frame(llc_data, 15);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_SPACE_LEFT);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(write_offset == 1 + 15);
+ OSMO_ASSERT(count_payload == 15);
OSMO_ASSERT(num_chunks == 1);
llc.reset();
llc.put_frame(llc_data, 12);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
+ /* no LI here, becaues there are exact 12 bytes left. Put LI into next frame */
OSMO_ASSERT(ar == Encoding::AR_NEED_MORE_BLOCKS);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(rdbi.cv != 0);
OSMO_ASSERT(write_offset == (int)rdbi.data_len);
+ OSMO_ASSERT(count_payload == 12);
OSMO_ASSERT(num_chunks == 2);
OSMO_ASSERT(data[0] == ((15 << 1) | (1 << 0)));
@@ -838,37 +877,43 @@ static void test_rlc_unit_encoder()
memset(data, 0, sizeof(data));
OSMO_ASSERT(llc.chunk_size() == 0);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_SPACE_LEFT);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(write_offset == 1 + 0);
+ OSMO_ASSERT(count_payload == 0);
OSMO_ASSERT(num_chunks == 1);
llc.reset();
llc.put_frame(llc_data, 7);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_SPACE_LEFT);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(rdbi.cv != 0);
OSMO_ASSERT(write_offset == 2 + 0 + 7);
+ OSMO_ASSERT(count_payload == 7);
OSMO_ASSERT(num_chunks == 2);
llc.reset();
llc.put_frame(llc_data, 18);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_BLOCK_FILLED);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(rdbi.cv != 0);
OSMO_ASSERT(write_offset == (int)rdbi.data_len);
+ OSMO_ASSERT(count_payload == 18);
OSMO_ASSERT(num_chunks == 3);
OSMO_ASSERT(data[0] == ((0 << 1) | (0 << 0)));
@@ -884,25 +929,29 @@ static void test_rlc_unit_encoder()
llc.reset();
llc.put_frame(llc_data, 6);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, false);
+ &llc, &write_offset, &num_chunks, data, false, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_SPACE_LEFT);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(write_offset == 1 + 6);
+ OSMO_ASSERT(count_payload == 6);
OSMO_ASSERT(num_chunks == 1);
llc.reset();
llc.put_frame(llc_data, 12);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, true);
+ &llc, &write_offset, &num_chunks, data, true, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_BLOCK_FILLED);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(rdbi.cv == 0);
OSMO_ASSERT(write_offset == (int)rdbi.data_len);
+ OSMO_ASSERT(count_payload == 12);
OSMO_ASSERT(num_chunks == 3);
OSMO_ASSERT(data[0] == ((6 << 1) | (0 << 0)));
@@ -924,14 +973,16 @@ static void test_rlc_unit_encoder()
llc.reset();
llc.put_frame(llc_data, rdbi.data_len);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, true);
+ &llc, &write_offset, &num_chunks, data, true, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_BLOCK_FILLED);
OSMO_ASSERT(rdbi.e == 1);
OSMO_ASSERT(rdbi.cv == 0);
OSMO_ASSERT(write_offset == (int)rdbi.data_len);
+ OSMO_ASSERT(count_payload == rdbi.data_len);
OSMO_ASSERT(num_chunks == 1);
OSMO_ASSERT(data[0] == 0);
@@ -948,14 +999,16 @@ static void test_rlc_unit_encoder()
llc.reset();
llc.put_frame(llc_data, rdbi.data_len - 1);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, true);
+ &llc, &write_offset, &num_chunks, data, true, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_BLOCK_FILLED);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(rdbi.cv == 0);
OSMO_ASSERT(write_offset == (int)rdbi.data_len);
+ OSMO_ASSERT(count_payload == rdbi.data_len - 1);
OSMO_ASSERT(num_chunks == 1);
OSMO_ASSERT(data[0] == (((rdbi.data_len-1) << 1) | (1 << 0)));
@@ -973,14 +1026,16 @@ static void test_rlc_unit_encoder()
llc.reset();
llc.put_frame(llc_data, rdbi.data_len - 2);
+ count_payload = -1;
ar = Encoding::rlc_data_to_dl_append(&rdbi, cs,
- &llc, &write_offset, &num_chunks, data, true);
+ &llc, &write_offset, &num_chunks, data, true, &count_payload);
OSMO_ASSERT(ar == Encoding::AR_COMPLETED_BLOCK_FILLED);
OSMO_ASSERT(rdbi.e == 0);
OSMO_ASSERT(rdbi.cv == 0);
OSMO_ASSERT(write_offset == (int)rdbi.data_len);
+ OSMO_ASSERT(count_payload == rdbi.data_len - 2);
OSMO_ASSERT(num_chunks == 2);
OSMO_ASSERT(data[0] == (((rdbi.data_len-2) << 1) | (0 << 0)));