diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-12-14 15:19:12 +0100 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-12-15 15:19:42 +0100 |
commit | 9e862e1e7f94e693615a843cbbbca0f4417e277f (patch) | |
tree | 80f0b7b31503461bb16ef5974b056a3c182477ef /src | |
parent | d0222cfe2dda4f169bf3d37cdc5eb79ef699cfd2 (diff) |
edge: Use GprsCodingScheme to adjust the UL RLC block size
Currently the block size is mapped by a switch statement to strip
extra bits that are not used for RLC blocks. That information is
already available via the GprsCodingScheme class.
This commit moves the CS/MCS detection to the rcv_block message and
passes the cs object via rcv_block_gprs, where the length gets
adjusted, to gprs_rlcmac_pdch::rcv_data_block_acknowledged. There the
switch statement is removed.
Note that the TbfTest.err changes due to an additional log message.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'src')
-rw-r--r-- | src/bts.cpp | 46 | ||||
-rw-r--r-- | src/bts.h | 3 |
2 files changed, 27 insertions, 22 deletions
diff --git a/src/bts.cpp b/src/bts.cpp index 0e3e8f03..988d5f95 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -733,28 +733,6 @@ int gprs_rlcmac_pdch::rcv_data_block_acknowledged(uint8_t *data, uint8_t len, struct gprs_rlcmac_ul_tbf *tbf; struct rlc_ul_header *rh = (struct rlc_ul_header *)data; - switch (len) { - case 54: - /* omitting spare bits */ - len = 53; - break; - case 40: - /* omitting spare bits */ - len = 39; - break; - case 34: - /* omitting spare bits */ - len = 33; - break; - case 23: - break; - default: - bts()->decode_error(); - LOGP(DRLCMACUL, LOGL_ERROR, "Dropping data block with invalid" - "length: %d)\n", len); - return -EINVAL; - } - /* find TBF inst from given TFI */ tbf = ul_tbf_by_tfi(rh->tfi); if (!tbf) { @@ -1166,9 +1144,33 @@ int gprs_rlcmac_pdch::rcv_control_block( int gprs_rlcmac_pdch::rcv_block(uint8_t *data, uint8_t len, uint32_t fn, struct pcu_l1_meas *meas) { + GprsCodingScheme cs = GprsCodingScheme::getBySizeUL(len); + if (!cs) { + bts()->decode_error(); + LOGP(DRLCMACUL, LOGL_ERROR, "Dropping data block with invalid" + "length: %d)\n", len); + return -EINVAL; + } + + LOGP(DRLCMACUL, LOGL_DEBUG, "Got RLC block, coding scheme: %s, " + "length: %d (%d))\n", cs.name(), len, cs.maxBytesUL()); + + if (cs.isGprs()) + return rcv_block_gprs(data, fn, meas, cs); + + bts()->decode_error(); + LOGP(DRLCMACUL, LOGL_ERROR, "Unsupported coding scheme %s\n", + cs.name()); + return -EINVAL; +} + +int gprs_rlcmac_pdch::rcv_block_gprs(uint8_t *data, uint32_t fn, + struct pcu_l1_meas *meas, GprsCodingScheme cs) +{ unsigned payload = data[0] >> 6; bitvec *block; int rc = 0; + unsigned len = cs.maxBytesUL(); switch (payload) { case GPRS_RLCMAC_DATA_BLOCK: @@ -33,6 +33,7 @@ extern "C" { #include "sba.h" #include "tbf.h" #include "gprs_ms_storage.h" +#include "gprs_coding_scheme.h" #endif #include <stdint.h> @@ -63,6 +64,8 @@ struct gprs_rlcmac_pdch { /* dispatching of messages */ int rcv_block(uint8_t *data, uint8_t len, uint32_t fn, struct pcu_l1_meas *meas); + int rcv_block_gprs(uint8_t *data, uint32_t fn, + struct pcu_l1_meas *meas, GprsCodingScheme cs); gprs_rlcmac_bts *bts_data() const; BTS *bts() const; |