[PATCH] osmo-pcu[master]: tbf_dl: factor out EGPRS DL window size calculation

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/gerrit-log@lists.osmocom.org/.

arvind.sirsikar gerrit-no-reply at lists.osmocom.org
Wed Sep 14 12:15:33 UTC 2016


Hello Neels Hofmeyr, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/832

to look at the new patch set (#6).

tbf_dl: factor out EGPRS DL window size calculation

A subsequent patch needs to call this from gprs_rlcmac_tbf::update(),
so to avoid code dup, put the calculation in a separate function.

Related: OS#1808

Change-Id: I7c7777d43f843bbd3421503fc2a8600f148ca035
---
M src/tbf.cpp
M src/tbf.h
M src/tbf_dl.cpp
3 files changed, 24 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/32/832/6

diff --git a/src/tbf.cpp b/src/tbf.cpp
index 7a15547..cbc0710 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -781,20 +781,8 @@
 		return NULL;
 	}
 
-	if (tbf->is_egprs_enabled()) {
-		unsigned int num_pdch = pcu_bitcount(tbf->dl_slots());
-		unsigned int ws = bts->ws_base + num_pdch * bts->ws_pdch;
-		ws = (ws / 32) * 32;
-		ws = OSMO_MAX(64, ws);
-		if (num_pdch == 1)
-			ws = OSMO_MIN(192, ws);
-		else
-			ws = OSMO_MIN(128 * num_pdch, ws);
-
-		LOGP(DRLCMAC, LOGL_INFO, "%s: Setting EGPRS window size to %d\n",
-			tbf->name(), ws);
-		tbf->m_window.set_ws(ws);
-	}
+	if (tbf->is_egprs_enabled())
+		tbf->egprs_calc_window_size();
 
 	llist_add(&tbf->list(), &bts->bts->dl_tbfs());
 	tbf->bts->tbf_dl_created();
diff --git a/src/tbf.h b/src/tbf.h
index 2a1bfe8..3a6f42d 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -372,6 +372,8 @@
 	int release();
 	int abort();
 
+	void egprs_calc_window_size();
+
 	/* TODO: add the gettimeofday as parameter */
 	struct msgb *llc_dequeue(bssgp_bvc_ctx *bctx);
 
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 489020b..457f2c9 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -1322,3 +1322,23 @@
 	/* Non SPB cases 0 is reurned */
 	return EGPRS_RLCMAC_DL_NO_RETX;
 }
+
+void gprs_rlcmac_dl_tbf::egprs_calc_window_size()
+{
+	struct gprs_rlcmac_bts *bts_data = bts->bts_data();
+	unsigned int num_pdch = pcu_bitcount(dl_slots());
+	unsigned int ws = bts_data->ws_base + num_pdch * bts_data->ws_pdch;
+
+	ws = (ws / 32) * 32;
+	ws = OSMO_MAX(64, ws);
+
+	if (num_pdch == 1)
+		ws = OSMO_MIN(192, ws);
+	else
+		ws = OSMO_MIN(128 * num_pdch, ws);
+
+	LOGP(DRLCMAC, LOGL_INFO, "%s: Setting EGPRS window size to %d\n",
+		name(), ws);
+
+	m_window.set_ws(ws);
+}

-- 
To view, visit https://gerrit.osmocom.org/832
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I7c7777d43f843bbd3421503fc2a8600f148ca035
Gerrit-PatchSet: 6
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: arvind.sirsikar <arvind.sirsikar at radisys.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: arvind.sirsikar <arvind.sirsikar at radisys.com>



More information about the gerrit-log mailing list