aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-12-14 12:04:01 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-12-16 19:37:08 +0100
commitce1beb423cddfddebeb2ebacb60eb10506eeff71 (patch)
treebce13c3e2368f31aa46a513678a536395181ab4d
parent784a0bd0001e4e81167eda6e3bb4a2001d24d1f6 (diff)
edge: Store GprsCodingScheme in gprs_rlc_data
Currently the coding scene is stored as number N, where there scheme is CS-N. This commit replaces this by a GprsCodingScheme type cs value. The gprs_rlcmac_cs table is no longer needed and thus removed. Sponsored-by: On-Waves ehf
-rw-r--r--src/rlc.h2
-rw-r--r--src/tbf_dl.cpp30
2 files changed, 13 insertions, 19 deletions
diff --git a/src/rlc.h b/src/rlc.h
index 8168994..bc93c2d 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -86,7 +86,7 @@ struct gprs_rlc_data {
/* block len of history */
uint8_t len;
- uint8_t cs;
+ GprsCodingScheme cs;
};
/*
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 3993df3..70194f7 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -42,16 +42,6 @@ extern "C" {
/* After sending these frames, we poll for ack/nack. */
#define POLL_ACK_AFTER_FRAMES 20
-
-static const struct gprs_rlcmac_cs gprs_rlcmac_cs[] = {
-/* frame length data block max payload */
- { 0, 0, 0 },
- { 23, 23, 20 }, /* CS-1 */
- { 34, 33, 30 }, /* CS-2 */
- { 40, 39, 36 }, /* CS-3 */
- { 54, 53, 50 }, /* CS-4 */
-};
-
extern "C" {
int bssgp_tx_llc_discarded(struct bssgp_bvc_ctx *bctx, uint32_t tlli,
uint8_t num_frames, uint32_t num_octets);
@@ -435,23 +425,26 @@ struct msgb *gprs_rlcmac_dl_tbf::create_new_bsn(const uint32_t fn, const uint8_t
uint16_t space, chunk;
gprs_rlc_data *rlc_data;
const uint16_t bsn = m_window.v_s();
- uint8_t cs = 1;
+ uint8_t cs_n = 1;
if (m_llc.frame_length() == 0)
schedule_next_frame();
- cs = current_cs();
+ cs_n = current_cs();
LOGP(DRLCMACDL, LOGL_DEBUG, "- Sending new block at BSN %d, CS=%d\n",
- m_window.v_s(), cs);
+ m_window.v_s(), cs_n);
+
+ OSMO_ASSERT(cs_n >= 1);
+ OSMO_ASSERT(cs_n <= 4);
- OSMO_ASSERT(cs >= 1);
- OSMO_ASSERT(cs <= 4);
+ /* TODO: Use GprsCodingScheme everywhere and remove cast */
+ GprsCodingScheme cs((GprsCodingScheme::Scheme)cs_n);
/* total length of block, including spare bits */
- const uint8_t block_length = gprs_rlcmac_cs[cs].block_length;
+ const uint8_t block_length = cs.sizeDL();
/* length of usable data of block, w/o spare bits, inc. MAC */
- const uint8_t block_data_len = gprs_rlcmac_cs[cs].block_data;
+ const uint8_t block_data_len = cs.maxBytesDL();
/* now we still have untransmitted LLC data, so we fill mac block */
rlc_data = m_rlc.block(bsn);
@@ -755,7 +748,8 @@ int gprs_rlcmac_dl_tbf::analyse_errors(char *show_rbb, uint8_t ssn,
/* Get statistics for current CS */
- if (rlc_data->cs != current_cs()) {
+ /* TODO: Use GprsCodingScheme everywhere and remove cast */
+ if (rlc_data->cs != (GprsCodingScheme::Scheme)current_cs()) {
/* This block has already been encoded with a different
* CS, so it doesn't help us to decide, whether the
* current CS is ok. Ignore it. */