aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gprs_rlcmac.cpp9
-rw-r--r--src/gprs_rlcmac.h13
-rw-r--r--src/gprs_rlcmac_data.cpp22
3 files changed, 28 insertions, 16 deletions
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp
index 64bbe75f..e434c4be 100644
--- a/src/gprs_rlcmac.cpp
+++ b/src/gprs_rlcmac.cpp
@@ -71,6 +71,15 @@ struct gprs_ms_multislot_class gprs_ms_multislot_class[32] = {
/* N/A */ { MS_NA,MS_NA, MS_NA, MS_NA, MS_NA, MS_NA, MS_NA, MS_NA },
};
+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 */
+};
+
LLIST_HEAD(gprs_rlcmac_ul_tbfs);
LLIST_HEAD(gprs_rlcmac_dl_tbfs);
llist_head *gprs_rlcmac_tbfs_lists[] = {
diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h
index 27cf825d..64797542 100644
--- a/src/gprs_rlcmac.h
+++ b/src/gprs_rlcmac.h
@@ -223,6 +223,8 @@ struct gprs_rlcmac_tbf {
struct timeval bw_tv; /* timestamp for bandwidth calculation */
uint32_t bw_octets; /* number of octets transmitted since bw_tv */
+
+ uint8_t cs; /* current coding scheme */
};
extern struct llist_head gprs_rlcmac_ul_tbfs; /* list of uplink TBFs */
@@ -249,6 +251,17 @@ struct gprs_rlcmac_sba {
uint8_t ta;
};
+/*
+ * coding scheme info
+ */
+struct gprs_rlcmac_cs {
+ uint8_t block_length;
+ uint8_t block_data;
+ uint8_t block_payload;
+};
+
+extern struct gprs_rlcmac_cs gprs_rlcmac_cs[];
+
int sba_alloc(uint8_t *_trx, uint8_t *_ts, uint32_t *_fn, uint8_t ta);
struct gprs_rlcmac_sba *sba_find(uint8_t trx, uint8_t ts, uint32_t fn);
diff --git a/src/gprs_rlcmac_data.cpp b/src/gprs_rlcmac_data.cpp
index 147054e0..2d03ac59 100644
--- a/src/gprs_rlcmac_data.cpp
+++ b/src/gprs_rlcmac_data.cpp
@@ -1289,23 +1289,13 @@ do_resend:
/* now we still have untransmitted LLC data, so we fill mac block */
index = tbf->dir.dl.v_s & mod_sns_half;
data = tbf->rlc_block[index];
- switch (bts->initial_cs) {
- case 2: /* CS-2 */
- block_length = 34;
- block_data = 33;
- break;
- case 3: /* CS-3 */
- block_length = 40;
- block_data = 39;
- break;
- case 4: /* CS-4 */
- block_length = 54;
- block_data = 53;
- break;
- default: /* CS-1 */
- block_length = 23;
- block_data = 23;
+ if (tbf->cs == 0) {
+ tbf->cs = bts->initial_cs;
+ if (tbf->cs < 1 || tbf->cs > 4)
+ tbf->cs = 1;
}
+ block_length = gprs_rlcmac_cs[tbf->cs].block_length;
+ block_data = gprs_rlcmac_cs[tbf->cs].block_data;
memset(data, 0x2b, block_data); /* spare bits will be left 0 */
rh = (struct rlc_dl_header *)data;
rh->pt = 0; /* Data Block */