Update CPS calculation with new data structures

Update existing CPS calculation function to align with new data
structure introduced
This commit is contained in:
Aravind Sirsikar 2016-03-23 18:29:46 +05:30 committed by Harald Welte
parent 7a05b039c8
commit a859a21800
3 changed files with 27 additions and 15 deletions

View File

@ -339,21 +339,32 @@ void gprs_rlc_data_block_info_init(struct gprs_rlc_data_block_info *rdbi,
rdbi->spb = 0; rdbi->spb = 0;
} }
unsigned int gprs_rlc_mcs_cps(GprsCodingScheme cs, int punct, int punct2, unsigned int gprs_rlc_mcs_cps(GprsCodingScheme cs,
int with_padding) enum egprs_puncturing_values punct,
enum egprs_puncturing_values punct2, int with_padding)
{ {
switch (GprsCodingScheme::Scheme(cs)) { switch (GprsCodingScheme::Scheme(cs)) {
case GprsCodingScheme::MCS1: return 0b1011 + punct % 2; case GprsCodingScheme::MCS1: return 0b1011 +
case GprsCodingScheme::MCS2: return 0b1001 + punct % 2; punct % EGPRS_MAX_PS_NUM_2;
case GprsCodingScheme::MCS2: return 0b1001 +
punct % EGPRS_MAX_PS_NUM_2;
case GprsCodingScheme::MCS3: return (with_padding ? 0b0110 : 0b0011) + case GprsCodingScheme::MCS3: return (with_padding ? 0b0110 : 0b0011) +
punct % 3; punct % EGPRS_MAX_PS_NUM_3;
case GprsCodingScheme::MCS4: return 0b0000 + punct % 3; case GprsCodingScheme::MCS4: return 0b0000 +
case GprsCodingScheme::MCS5: return 0b100 + punct % 2; punct % EGPRS_MAX_PS_NUM_3;
case GprsCodingScheme::MCS5: return 0b100 +
punct % EGPRS_MAX_PS_NUM_2;
case GprsCodingScheme::MCS6: return (with_padding ? 0b010 : 0b000) + case GprsCodingScheme::MCS6: return (with_padding ? 0b010 : 0b000) +
punct % 2; punct % EGPRS_MAX_PS_NUM_2;
case GprsCodingScheme::MCS7: return 0b10100 + 3 * (punct % 3) + punct2 % 3; case GprsCodingScheme::MCS7: return 0b10100 +
case GprsCodingScheme::MCS8: return 0b01011 + 3 * (punct % 3) + punct2 % 3; 3 * (punct % EGPRS_MAX_PS_NUM_3) +
case GprsCodingScheme::MCS9: return 0b00000 + 4 * (punct % 3) + punct2 % 3; punct2 % EGPRS_MAX_PS_NUM_3;
case GprsCodingScheme::MCS8: return 0b01011 +
3 * (punct % EGPRS_MAX_PS_NUM_3) +
punct2 % EGPRS_MAX_PS_NUM_3;
case GprsCodingScheme::MCS9: return 0b00000 +
4 * (punct % EGPRS_MAX_PS_NUM_3) +
punct2 % EGPRS_MAX_PS_NUM_3;
default: ; default: ;
} }

View File

@ -132,8 +132,8 @@ void gprs_rlc_data_info_init_ul(struct gprs_rlc_data_info *rlc,
GprsCodingScheme cs, bool with_padding); GprsCodingScheme cs, bool with_padding);
void gprs_rlc_data_block_info_init(struct gprs_rlc_data_block_info *rdbi, void gprs_rlc_data_block_info_init(struct gprs_rlc_data_block_info *rdbi,
GprsCodingScheme cs, bool with_padding); GprsCodingScheme cs, bool with_padding);
unsigned int gprs_rlc_mcs_cps(GprsCodingScheme cs, int punct, int punct2, unsigned int gprs_rlc_mcs_cps(GprsCodingScheme cs, enum egprs_puncturing_values
int with_padding); punct, enum egprs_puncturing_values punct2, int with_padding);
void gprs_rlc_mcs_cps_decode(unsigned int cps, GprsCodingScheme cs, void gprs_rlc_mcs_cps_decode(unsigned int cps, GprsCodingScheme cs,
int *punct, int *punct2, int *with_padding); int *punct, int *punct2, int *with_padding);

View File

@ -589,7 +589,7 @@ struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(
GprsCodingScheme cs; GprsCodingScheme cs;
int bsns[ARRAY_SIZE(rlc.block_info)]; int bsns[ARRAY_SIZE(rlc.block_info)];
unsigned num_bsns; unsigned num_bsns;
int punct[ARRAY_SIZE(rlc.block_info)]; enum egprs_puncturing_values punct[ARRAY_SIZE(rlc.block_info)];
bool need_padding = false; bool need_padding = false;
/* /*
@ -651,7 +651,8 @@ struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(
block_data = m_rlc.block(bsn)->block; block_data = m_rlc.block(bsn)->block;
/* TODO: Use real puncturing values */ /* TODO: Use real puncturing values */
punct[data_block_idx] = data_block_idx; punct[data_block_idx] =
(enum egprs_puncturing_values) data_block_idx;
rdbi = &rlc.block_info[data_block_idx]; rdbi = &rlc.block_info[data_block_idx];
block_info = &m_rlc.block(bsn)->block_info; block_info = &m_rlc.block(bsn)->block_info;