Change in osmo-pcu[master]: TBF: update MCS counters

Max gerrit-no-reply at lists.osmocom.org
Wed Mar 13 17:47:55 UTC 2019


Max has uploaded this change for review. ( https://gerrit.osmocom.org/13243


Change subject: TBF: update MCS counters
......................................................................

TBF: update MCS counters

* use enum CodingScheme directly instead of converting it to class and
  back
* drop useless mode check
* log errorneous update attempt

Change-Id: I763136c2f356d63aa3d28d09c57fd5faf5336258
---
M src/tbf.h
M src/tbf_dl.cpp
M src/tbf_ul.cpp
3 files changed, 116 insertions(+), 126 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/43/13243/1

diff --git a/src/tbf.h b/src/tbf.h
index dc0b050..0a58862 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -648,7 +648,7 @@
 	int abort();
 	uint16_t window_size() const;
 	void set_window_size();
-	void update_coding_scheme_counter_dl(const GprsCodingScheme cs);
+	void update_coding_scheme_counter_dl(enum CodingScheme cs);
 
 	/* TODO: add the gettimeofday as parameter */
 	struct msgb *llc_dequeue(bssgp_bvc_ctx *bctx);
@@ -751,7 +751,7 @@
 
 	uint16_t window_size() const;
 	void set_window_size();
-	void update_coding_scheme_counter_ul(const GprsCodingScheme cs);
+	void update_coding_scheme_counter_ul(enum CodingScheme cs);
 
 	/* Please note that all variables here will be reset when changing
 	 * from WAIT RELEASE back to FLOW state (re-use of TBF).
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 13ef143..04c6499 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -1364,68 +1364,63 @@
 	m_window.set_ws(ws);
 }
 
-void gprs_rlcmac_dl_tbf::update_coding_scheme_counter_dl(const GprsCodingScheme cs)
+void gprs_rlcmac_dl_tbf::update_coding_scheme_counter_dl(enum CodingScheme cs)
 {
-	uint8_t coding_scheme = 0;
-
-	coding_scheme = CodingScheme(cs);
-	if (mcs_is_gprs(cs)) {
-		switch (coding_scheme) {
-		case CS1 :
-			bts->gprs_dl_cs1();
-			rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS1]);
-			break;
-		case CS2 :
-			bts->gprs_dl_cs2();
-			rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS2]);
-			break;
-		case CS3 :
-			bts->gprs_dl_cs3();
-			rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS3]);
-			break;
-		case CS4 :
-			bts->gprs_dl_cs4();
-			rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS4]);
-			break;
-		}
-	} else {
-		switch (coding_scheme) {
-		case MCS1 :
-			bts->egprs_dl_mcs1();
-			rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS1]);
-			break;
-		case MCS2 :
-			bts->egprs_dl_mcs2();
-			rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS2]);
-			break;
-		case MCS3 :
-			bts->egprs_dl_mcs3();
-			rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS3]);
-			break;
-		case MCS4 :
-			bts->egprs_dl_mcs4();
-			rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS4]);
-			break;
-		case MCS5 :
-			bts->egprs_dl_mcs5();
-			rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS5]);
-			break;
-		case MCS6 :
-			bts->egprs_dl_mcs6();
-			rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS6]);
-			break;
-		case MCS7 :
-			bts->egprs_dl_mcs7();
-			rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS7]);
-			break;
-		case MCS8 :
-			bts->egprs_dl_mcs8();
-			rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS8]);
-			break;
-		case MCS9 :
-			bts->egprs_dl_mcs9();
-			rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS9]);
-			break;
-		}
+	switch (cs) {
+	case CS1:
+		bts->gprs_dl_cs1();
+		rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS1]);
+		break;
+	case CS2:
+		bts->gprs_dl_cs2();
+		rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS2]);
+		break;
+	case CS3:
+		bts->gprs_dl_cs3();
+		rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS3]);
+		break;
+	case CS4:
+		bts->gprs_dl_cs4();
+		rate_ctr_inc(&m_dl_gprs_ctrs->ctr[TBF_CTR_GPRS_DL_CS4]);
+		break;
+	case MCS1:
+		bts->egprs_dl_mcs1();
+		rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS1]);
+		break;
+	case MCS2:
+		bts->egprs_dl_mcs2();
+		rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS2]);
+		break;
+	case MCS3:
+		bts->egprs_dl_mcs3();
+		rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS3]);
+		break;
+	case MCS4:
+		bts->egprs_dl_mcs4();
+		rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS4]);
+		break;
+	case MCS5:
+		bts->egprs_dl_mcs5();
+		rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS5]);
+		break;
+	case MCS6:
+		bts->egprs_dl_mcs6();
+		rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS6]);
+		break;
+	case MCS7:
+		bts->egprs_dl_mcs7();
+		rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS7]);
+		break;
+	case MCS8:
+		bts->egprs_dl_mcs8();
+		rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS8]);
+		break;
+	case MCS9:
+		bts->egprs_dl_mcs9();
+		rate_ctr_inc(&m_dl_egprs_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS9]);
+		break;
+	default:
+		LOGPTBFDL(this, LOGL_ERROR, "attempting to update rate counters for unsupported (M)CS %s\n",
+			  mcs_name(cs));
 	}
 }
diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp
index f40ec3d..fd7d73b 100644
--- a/src/tbf_ul.cpp
+++ b/src/tbf_ul.cpp
@@ -525,69 +525,64 @@
 	return assemble_status;
 }
 
-void gprs_rlcmac_ul_tbf::update_coding_scheme_counter_ul(const GprsCodingScheme cs)
+void gprs_rlcmac_ul_tbf::update_coding_scheme_counter_ul(enum CodingScheme cs)
 {
-	uint8_t coding_scheme = 0;
-
-	coding_scheme = CodingScheme(cs);
-	if (mcs_is_gprs(cs)) {
-		switch (coding_scheme) {
-		case CS1 :
-			bts->gprs_ul_cs1();
-			rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS1]);
-			break;
-		case CS2 :
-			bts->gprs_ul_cs2();
-			rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS2]);
-			break;
-		case CS3 :
-			bts->gprs_ul_cs3();
-			rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS3]);
-			break;
-		case CS4 :
-			bts->gprs_ul_cs4();
-			rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS4]);
-			break;
-		}
-	} else {
-		switch (coding_scheme) {
-		case MCS1 :
-			bts->egprs_ul_mcs1();
-			rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS1]);
-			break;
-		case MCS2 :
-			bts->egprs_ul_mcs2();
-			rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS2]);
-			break;
-		case MCS3 :
-			bts->egprs_ul_mcs3();
-			rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS3]);
-			break;
-		case MCS4 :
-			bts->egprs_ul_mcs4();
-			rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS4]);
-			break;
-		case MCS5 :
-			bts->egprs_ul_mcs5();
-			rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS5]);
-			break;
-		case MCS6 :
-			bts->egprs_ul_mcs6();
-			rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS6]);
-			break;
-		case MCS7 :
-			bts->egprs_ul_mcs7();
-			rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS7]);
-			break;
-		case MCS8 :
-			bts->egprs_ul_mcs8();
-			rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS8]);
-			break;
-		case MCS9 :
-			bts->egprs_ul_mcs9();
-			rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS9]);
-			break;
-		}
+	switch (cs) {
+	case CS1:
+		bts->gprs_ul_cs1();
+		rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS1]);
+		break;
+	case CS2:
+		bts->gprs_ul_cs2();
+		rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS2]);
+		break;
+	case CS3:
+		bts->gprs_ul_cs3();
+		rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS3]);
+		break;
+	case CS4:
+		bts->gprs_ul_cs4();
+		rate_ctr_inc(&m_ul_gprs_ctrs->ctr[TBF_CTR_GPRS_UL_CS4]);
+		break;
+	case MCS1:
+		bts->egprs_ul_mcs1();
+		rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS1]);
+		break;
+	case MCS2:
+		bts->egprs_ul_mcs2();
+		rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS2]);
+		break;
+	case MCS3:
+		bts->egprs_ul_mcs3();
+		rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS3]);
+		break;
+	case MCS4:
+		bts->egprs_ul_mcs4();
+		rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS4]);
+		break;
+	case MCS5:
+		bts->egprs_ul_mcs5();
+		rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS5]);
+		break;
+	case MCS6:
+		bts->egprs_ul_mcs6();
+		rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS6]);
+		break;
+	case MCS7:
+		bts->egprs_ul_mcs7();
+		rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS7]);
+		break;
+	case MCS8:
+		bts->egprs_ul_mcs8();
+		rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS8]);
+		break;
+	case MCS9:
+		bts->egprs_ul_mcs9();
+		rate_ctr_inc(&m_ul_egprs_ctrs->ctr[TBF_CTR_EGPRS_UL_MCS9]);
+		break;
+	default:
+		LOGPTBFUL(this, LOGL_ERROR, "attempting to update rate counters for unsupported (M)CS %s\n",
+			  mcs_name(cs));
 	}
 }
 

-- 
To view, visit https://gerrit.osmocom.org/13243
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I763136c2f356d63aa3d28d09c57fd5faf5336258
Gerrit-Change-Number: 13243
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190313/c4050cf3/attachment-0001.html>


More information about the gerrit-log mailing list