aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_coding_scheme.cpp
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2016-01-11 09:58:11 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-05 13:26:33 +0100
commitfc1b3e6c9076ddc38e07715b2cc30319bac19b9c (patch)
treeb7d6086f12afc017750e358ed68977c7519fc8d7 /src/gprs_coding_scheme.cpp
parentf2ba4cbf51ba5ec4183a9153ba2ce51df9050881 (diff)
edge: Fix RLC message size
Currently the RLC message length that is obtained from the DSP is reduced by 1 if the last byte of the buffer includes spare bits. While this worked well with GPRS, these bits are being used to encode RLC blocks in EGPRS mode. Thus this last byte must not be chopped off. The functionality of the code is not affected by this, since the modified length value is not used. This commit adds GprsCodingScheme::usedSizeDL/UL to return the number of bytes needed to encode the message block. If there are single bits at the end that are to be used (EGPRS), the functions return the number of full bytes plus 1 (which is the buffer size reported by the DSP and returned by sizeUL/sizeDL). The commit also removes the len parameter from rcv_data_block_acknowledged. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/gprs_coding_scheme.cpp')
-rw-r--r--src/gprs_coding_scheme.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/gprs_coding_scheme.cpp b/src/gprs_coding_scheme.cpp
index 4ba55c30..629ba4a0 100644
--- a/src/gprs_coding_scheme.cpp
+++ b/src/gprs_coding_scheme.cpp
@@ -73,7 +73,15 @@ GprsCodingScheme GprsCodingScheme::getBySizeUL(unsigned size)
unsigned int GprsCodingScheme::sizeUL() const
{
- return maxBytesUL() + (spareBitsUL() ? 1 : 0);
+ return mcs_info[m_scheme].uplink.bytes + (spareBitsUL() ? 1 : 0);
+}
+
+unsigned int GprsCodingScheme::usedSizeUL() const
+{
+ if (mcs_info[m_scheme].data_hdr == HEADER_GPRS_DATA)
+ return mcs_info[m_scheme].uplink.bytes;
+ else
+ return sizeUL();
}
unsigned int GprsCodingScheme::maxBytesUL() const
@@ -88,7 +96,15 @@ unsigned int GprsCodingScheme::spareBitsUL() const
unsigned int GprsCodingScheme::sizeDL() const
{
- return maxBytesDL() + (spareBitsDL() ? 1 : 0);
+ return mcs_info[m_scheme].downlink.bytes + (spareBitsDL() ? 1 : 0);
+}
+
+unsigned int GprsCodingScheme::usedSizeDL() const
+{
+ if (mcs_info[m_scheme].data_hdr == HEADER_GPRS_DATA)
+ return mcs_info[m_scheme].downlink.bytes;
+ else
+ return sizeDL();
}
unsigned int GprsCodingScheme::maxBytesDL() const