Replace switch/case construct by a structure, to define coding schemes
A new attribute at TBF instance indicates the current scheme used.
This commit is contained in:
parent
5f14bd9410
commit
3b1332cdb4
|
@ -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[] = {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue