[osmo-pcu,3/3] tbf: Re-send dl assignment if we can upgrade to multislot
diff mbox

Message ID d98e5d26dd24a009c91157cc0dc370ac7936ff1a.1401463598.git.daniel@totalueberwachung.de
State Accepted
Headers show

Commit Message

Daniel Willmann May 30, 2014, 3:58 p.m. UTC
The current code would only ever assign one PDCH for the initial
assignment (from CCCH). Only if reuse_tbf is called the algorithm would
actually use multiple DL PDCHs if possible.

This patch introduced a tbf attribute upgrade_to_multislot that is set
if we have multiple PDCH configured, and support multislot assignment,
but can only assign a single PDCH (alloc_algorithm_b, parameter single
is set). In this case after the assignment completes (and the MS is
listening on a PDCH) we resend a DL assignment though the PACCH and this
time we can assign multiple timeslots.
---
 src/gprs_rlcmac_ts_alloc.cpp |  9 +++++++++
 src/tbf.cpp                  | 22 ++++++++++++++++++++--
 src/tbf.h                    |  3 +++
 3 files changed, 32 insertions(+), 2 deletions(-)

Patch
diff mbox

diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index 366732c..a97cc65 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -175,6 +175,8 @@  int alloc_algorithm_a(struct gprs_rlcmac_bts *bts,
 	/* the only one TS is the common TS */
 	tbf->first_ts = tbf->first_common_ts = ts;
 
+	tbf->upgrade_to_multislot = 0;
+
 	return 0;
 }
 
@@ -665,10 +667,17 @@  int alloc_algorithm_b(struct gprs_rlcmac_bts *bts,
 		}
 	}
 	if (single && slotcount) {
+		uint8_t ts_count = 0;
+		for (ts = 0; ts < 8; ts++)
+			if ((tx_window & (1 << ts)))
+				ts_count++;
+
+		tbf->upgrade_to_multislot = (ts_count > 1);
 		LOGP(DRLCMAC, LOGL_INFO, "Using single slot at TS %d for %s\n",
 			tbf->first_ts,
 			(tbf->direction == GPRS_RLCMAC_DL_TBF) ? "DL" : "UL");
 	} else {
+		tbf->upgrade_to_multislot = 0;
 		LOGP(DRLCMAC, LOGL_INFO, "Using %d slots for %s\n", slotcount,
 			(tbf->direction == GPRS_RLCMAC_DL_TBF) ? "DL" : "UL");
 	}
diff --git a/src/tbf.cpp b/src/tbf.cpp
index dd1f0fb..3a2ad73 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -574,11 +574,29 @@  void gprs_rlcmac_tbf::handle_timeout()
 					"in assign state\n", tbf_name(this));
 		}
 		if ((state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH))) {
-			/* change state to FLOW, so scheduler will start transmission */
 			dir.dl.wait_confirm = 0;
 			if (state_is(GPRS_RLCMAC_ASSIGN)) {
-				tbf_new_state(this, GPRS_RLCMAC_FLOW);
 				tbf_assign_control_ts(this);
+
+				if (!upgrade_to_multislot) {
+					/* change state to FLOW, so scheduler
+					 * will start transmission */
+					tbf_new_state(this, GPRS_RLCMAC_FLOW);
+					break;
+				}
+
+				/* This tbf can be upgraded to use multiple DL
+				 * timeslots and now that there is already one
+				 * slot assigned send another DL assignment via
+				 * PDCH. */
+
+				/* keep to flags */
+				state_flags &= GPRS_RLCMAC_FLAG_TO_MASK;
+				state_flags &= ~(1 << GPRS_RLCMAC_FLAG_CCCH);
+
+				update();
+
+				bts->trigger_dl_ass(this, this, NULL);
 			} else
 				LOGP(DRLCMAC, LOGL_NOTICE, "%s Continue flow after "
 					"IMM.ASS confirm\n", tbf_name(this));
diff --git a/src/tbf.h b/src/tbf.h
index 0ee9718..80e2068 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -221,6 +221,9 @@  struct gprs_rlcmac_tbf {
 	 * schedule a new dl assignment */
 	uint8_t was_releasing;
 
+	/* Can/should we upgrade this tbf to use multiple slots? */
+	uint8_t upgrade_to_multislot;
+
 	/* store the BTS this TBF belongs to */
 	BTS *bts;