aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-03 18:28:04 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-08 00:45:39 +0100
commitb55f31373554394092bb923acca723cc7808cd49 (patch)
tree6e0b890bdddfb50034d4cc5d0975b4b129c8e669 /src
parent215e18c9d45cdaa43705ae7c8f8cb43c0db28225 (diff)
rlc: Add with_padding argument to gprs_rlc_data_info_init_dl/ul
The offsets of the data areas change when padding is used (see TS 44.060, 9.3.2.1 and Annex J for details). Extend the parameter lists to pass the with_padding flag and use that information to compute the correct offsets. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src')
-rw-r--r--src/rlc.cpp27
-rw-r--r--src/rlc.h7
-rw-r--r--src/tbf_dl.cpp2
3 files changed, 23 insertions, 13 deletions
diff --git a/src/rlc.cpp b/src/rlc.cpp
index efe4261..ca12e91 100644
--- a/src/rlc.cpp
+++ b/src/rlc.cpp
@@ -282,43 +282,52 @@ bool gprs_rlc_ul_window::invalidate_bsn(const uint16_t bsn)
}
static void gprs_rlc_data_header_init(struct gprs_rlc_data_info *rlc,
- GprsCodingScheme cs, unsigned int header_bits)
+ GprsCodingScheme cs, bool with_padding, unsigned int header_bits)
{
unsigned int i;
+ unsigned int padding_bits = with_padding ? cs.optionalPaddingBits() : 0;
memset(rlc, 0, sizeof(*rlc));
rlc->cs = cs;
+ rlc->with_padding = with_padding;
rlc->num_data_blocks = cs.numDataBlocks();
OSMO_ASSERT(rlc->num_data_blocks <= ARRAY_SIZE(rlc->block_info));
for (i = 0; i < rlc->num_data_blocks; i++) {
- gprs_rlc_data_block_info_init(&rlc->block_info[i], cs);
+ gprs_rlc_data_block_info_init(&rlc->block_info[i], cs,
+ with_padding);
rlc->data_offs_bits[i] =
- header_bits +
+ header_bits + padding_bits +
(i+1) * cs.numDataBlockHeaderBits() +
i * 8 * rlc->block_info[0].data_len;
}
}
void gprs_rlc_data_info_init_dl(struct gprs_rlc_data_info *rlc,
- GprsCodingScheme cs)
+ GprsCodingScheme cs, bool with_padding)
{
- return gprs_rlc_data_header_init(rlc, cs, cs.numDataHeaderBitsDL());
+ return gprs_rlc_data_header_init(rlc, cs, with_padding,
+ cs.numDataHeaderBitsDL());
}
void gprs_rlc_data_info_init_ul(struct gprs_rlc_data_info *rlc,
- GprsCodingScheme cs)
+ GprsCodingScheme cs, bool with_padding)
{
- return gprs_rlc_data_header_init(rlc, cs, cs.numDataHeaderBitsUL());
+ return gprs_rlc_data_header_init(rlc, cs, with_padding,
+ cs.numDataHeaderBitsUL());
}
void gprs_rlc_data_block_info_init(struct gprs_rlc_data_block_info *rdbi,
- GprsCodingScheme cs)
+ GprsCodingScheme cs, bool with_padding)
{
- rdbi->data_len = cs.maxDataBlockBytes();
+ unsigned int data_len = cs.maxDataBlockBytes();
+ if (with_padding)
+ data_len -= cs.optionalPaddingBits() / 8;
+
+ rdbi->data_len = data_len;
rdbi->bsn = 0;
rdbi->ti = 0;
rdbi->e = 1;
diff --git a/src/rlc.h b/src/rlc.h
index 8c3a412..f6415b7 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -83,6 +83,7 @@ struct gprs_rlc_data_info {
unsigned int rrbp;
unsigned int pr;
unsigned int num_data_blocks;
+ unsigned int with_padding;
unsigned int data_offs_bits[2];
struct gprs_rlc_data_block_info block_info[2];
};
@@ -101,11 +102,11 @@ struct gprs_rlc_data {
};
void gprs_rlc_data_info_init_dl(struct gprs_rlc_data_info *rlc,
- GprsCodingScheme cs);
+ GprsCodingScheme cs, bool with_padding);
void gprs_rlc_data_info_init_ul(struct gprs_rlc_data_info *rlc,
- GprsCodingScheme cs);
+ GprsCodingScheme cs, bool with_padding);
void gprs_rlc_data_block_info_init(struct gprs_rlc_data_block_info *rdbi,
- GprsCodingScheme cs);
+ GprsCodingScheme cs, bool with_padding);
unsigned int gprs_rlc_mcs_cps(GprsCodingScheme cs, int punct, int punct2,
int with_padding);
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index e567f57..6208b60 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -540,7 +540,7 @@ struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(
cs = m_rlc.block(index)->cs;
- gprs_rlc_data_info_init_dl(&rlc, cs);
+ gprs_rlc_data_info_init_dl(&rlc, cs, false);
rlc.usf = 7; /* will be set at scheduler */
rlc.pr = 0; /* FIXME: power reduction */