edge: Provide and use CS -> CPS conversion

The MS' RLC receiver needs a valid CPS field to decode the block.

Add the function gprs_rlc_mcs_cps to generate the CPS value based on
coding scheme, puncturing, and padding.

Sponsored-by: On-Waves ehf
This commit is contained in:
Jacob Erlbeck 2016-01-13 13:09:09 +01:00
parent a88d065606
commit 70955c765c
3 changed files with 17 additions and 0 deletions

View File

@ -311,3 +311,18 @@ void gprs_rlc_data_block_info_init(struct gprs_rlc_data_block_info *rdbi,
rdbi->pi = 0;
rdbi->spb = 0;
}
unsigned int gprs_rlc_mcs_cps(GprsCodingScheme cs, int punct, int with_padding)
{
switch (GprsCodingScheme::Scheme(cs)) {
case GprsCodingScheme::MCS1: return 0b1011 + punct % 2;
case GprsCodingScheme::MCS2: return 0b1001 + punct % 2;
case GprsCodingScheme::MCS3: return (with_padding ? 0b0110 : 0b0011) +
punct % 3;
case GprsCodingScheme::MCS4: return 0b0000 + punct % 3;
/* TODO: Add missing MCS */
default: ;
}
return -1;
}

View File

@ -105,6 +105,7 @@ void gprs_rlc_data_info_init_ul(struct gprs_rlc_data_info *rlc,
GprsCodingScheme cs);
void gprs_rlc_data_block_info_init(struct gprs_rlc_data_block_info *rdbi,
GprsCodingScheme cs);
unsigned int gprs_rlc_mcs_cps(GprsCodingScheme cs, int punct, int with_padding);
/*
* I hold the currently transferred blocks and will provide

View File

@ -539,6 +539,7 @@ struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(
rlc.usf = 7; /* will be set at scheduler */
rlc.pr = 0; /* FIXME: power reduction */
rlc.tfi = m_tfi; /* TFI */
rlc.cps = gprs_rlc_mcs_cps(cs, 0, 0);
rlc.block_info[data_block_idx] = m_rlc.block(index)->block_info;
rdbi = &rlc.block_info[data_block_idx];