[PATCH 2/3] Update CPS calculation with new data structures

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/osmocom-net-gprs@lists.osmocom.org/.

Aravind Sirsikar arvind.sirsikar at radisys.com
Wed Mar 23 12:59:46 UTC 2016


Update existing CPS calculation function to align with new data
structure introduced
---
 src/rlc.cpp    |   33 ++++++++++++++++++++++-----------
 src/rlc.h      |    4 ++--
 src/tbf_dl.cpp |    5 +++--
 3 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/src/rlc.cpp b/src/rlc.cpp
index 0e16ee8..6ea1597 100644
--- a/src/rlc.cpp
+++ b/src/rlc.cpp
@@ -339,21 +339,32 @@ void gprs_rlc_data_block_info_init(struct gprs_rlc_data_block_info *rdbi,
 	rdbi->spb = 0;
 }
 
-unsigned int gprs_rlc_mcs_cps(GprsCodingScheme cs, int punct, int punct2,
-	int with_padding)
+unsigned int gprs_rlc_mcs_cps(GprsCodingScheme cs,
+	enum egprs_puncturing_values punct,
+	enum egprs_puncturing_values punct2, int with_padding)
 {
 	switch (GprsCodingScheme::Scheme(cs)) {
-	case GprsCodingScheme::MCS1: return 0b1011 + punct % 2;
-	case GprsCodingScheme::MCS2: return 0b1001 + punct % 2;
+	case GprsCodingScheme::MCS1: return 0b1011 +
+		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) +
-					    punct % 3;
-	case GprsCodingScheme::MCS4: return 0b0000 + punct % 3;
-	case GprsCodingScheme::MCS5: return  0b100 + punct % 2;
+		punct % EGPRS_MAX_PS_NUM_3;
+	case GprsCodingScheme::MCS4: return 0b0000 +
+		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) +
-					    punct % 2;
-	case GprsCodingScheme::MCS7: return 0b10100 + 3 * (punct % 3) + punct2 % 3;
-	case GprsCodingScheme::MCS8: return 0b01011 + 3 * (punct % 3) + punct2 % 3;
-	case GprsCodingScheme::MCS9: return 0b00000 + 4 * (punct % 3) + punct2 % 3;
+		punct % EGPRS_MAX_PS_NUM_2;
+	case GprsCodingScheme::MCS7: return 0b10100 +
+		3 * (punct % EGPRS_MAX_PS_NUM_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: ;
 	}
 
diff --git a/src/rlc.h b/src/rlc.h
index 19dccbe..6a8fd29 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -132,8 +132,8 @@ void gprs_rlc_data_info_init_ul(struct gprs_rlc_data_info *rlc,
 	GprsCodingScheme cs, bool with_padding);
 void gprs_rlc_data_block_info_init(struct gprs_rlc_data_block_info *rdbi,
 	GprsCodingScheme cs, bool with_padding);
-unsigned int gprs_rlc_mcs_cps(GprsCodingScheme cs, int punct, int punct2,
-	int with_padding);
+unsigned int gprs_rlc_mcs_cps(GprsCodingScheme cs, enum egprs_puncturing_values
+	punct, enum egprs_puncturing_values punct2, int with_padding);
 void gprs_rlc_mcs_cps_decode(unsigned int cps, GprsCodingScheme cs,
 	int *punct, int *punct2, int *with_padding);
 
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 7540d1b..56dedd0 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -589,7 +589,7 @@ struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(
 	GprsCodingScheme cs;
 	int bsns[ARRAY_SIZE(rlc.block_info)];
 	unsigned num_bsns;
-	int punct[ARRAY_SIZE(rlc.block_info)];
+	enum egprs_puncturing_values punct[ARRAY_SIZE(rlc.block_info)];
 	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;
 
 		/* 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];
 		block_info = &m_rlc.block(bsn)->block_info;
-- 
1.7.9.5





More information about the osmocom-net-gprs mailing list