[osmo-pcu 2/3] tbf/bts, encoding: Keep track of WAIT_RELEASE state for DL assignment

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

Daniel Willmann dwillmann at sysmocom.de
Fri May 30 15:58:00 UTC 2014


The current code does not properly distinguish between DL assignments to
reuse a tbf (after it was put in state WAIT_RELEASE) and DL assignments
for an active tbf to change the allocation of the PDCH timeslots.

This patch introduces a new variable was_releasing which remembers if
trigger_dl_ass() was called with a tbf in state WAIT_RELEASE. In that
case we have to set the CONTROL_ACK field in the download assignment.

This should allow us to send DL assignments to change PDCH TS allocation
of a tbf before we enter FLOW state.
---
 src/bts.cpp      | 2 ++
 src/encoding.cpp | 2 +-
 src/tbf.cpp      | 3 ++-
 src/tbf.h        | 4 ++++
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/bts.cpp b/src/bts.cpp
index 6c02408..9003099 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -474,6 +474,7 @@ void BTS::trigger_dl_ass(
 		old_tbf->dl_ass_state = GPRS_RLCMAC_DL_ASS_SEND_ASS;
 		/* use TA from old TBF */
 		tbf->ta = old_tbf->ta;
+		tbf->was_releasing = tbf->state_is(GPRS_RLCMAC_WAIT_RELEASE);
 		/* change state */
 		tbf_new_state(tbf, GPRS_RLCMAC_ASSIGN);
 		tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_PACCH);
@@ -485,6 +486,7 @@ void BTS::trigger_dl_ass(
 			LOGP(DRLCMAC, LOGL_ERROR, "No valid IMSI!\n");
 			return;
 		}
+		tbf->was_releasing = tbf->state_is(GPRS_RLCMAC_WAIT_RELEASE);
 		/* change state */
 		tbf_new_state(tbf, GPRS_RLCMAC_ASSIGN);
 		tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_CCCH);
diff --git a/src/encoding.cpp b/src/encoding.cpp
index 51b0fbe..13848aa 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -267,7 +267,7 @@ void Encoding::write_packet_downlink_assignment(RlcMacDownlink_t * block, uint8_
 
 	block->u.Packet_Downlink_Assignment.MAC_MODE            = 0x0;          // Dynamic Allocation
 	block->u.Packet_Downlink_Assignment.RLC_MODE            = 0x0;          // RLC acknowledged mode
-	block->u.Packet_Downlink_Assignment.CONTROL_ACK         = old_downlink; // NW establishes no new DL TBF for the MS with running timer T3192
+	block->u.Packet_Downlink_Assignment.CONTROL_ACK         = tbf->was_releasing; // NW establishes no new DL TBF for the MS with running timer T3192
 	block->u.Packet_Downlink_Assignment.TIMESLOT_ALLOCATION = 0;   // timeslot(s)
 	for (tn = 0; tn < 8; tn++) {
 		if (tbf->pdch[tn])
diff --git a/src/tbf.cpp b/src/tbf.cpp
index b20d0fc..dd1f0fb 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -1405,6 +1405,8 @@ int gprs_rlcmac_tbf::maybe_start_new_window()
 	/* report all outstanding packets as received */
 	gprs_rlcmac_received_lost(this, received, 0);
 
+	tbf_new_state(this, GPRS_RLCMAC_WAIT_RELEASE);
+
 	/* check for LLC PDU in the LLC Queue */
 	msg = llc_dequeue(gprs_bssgp_pcu_current_bctx());
 	if (!msg) {
@@ -1414,7 +1416,6 @@ int gprs_rlcmac_tbf::maybe_start_new_window()
 		tbf_timer_start(this, 3193,
 			bts_data()->t3193_msec / 1000,
 			(bts_data()->t3193_msec % 1000) * 1000);
-		tbf_new_state(this, GPRS_RLCMAC_WAIT_RELEASE);
 
 		return 0;
 	}
diff --git a/src/tbf.h b/src/tbf.h
index 24b98d2..0ee9718 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -217,6 +217,10 @@ struct gprs_rlcmac_tbf {
 	 * stops to iterate over all tbf in its current form */
 	enum gprs_rlcmac_tbf_state state;
 
+	/* Remember if the tbf was in wait_release state when we want to
+	 * schedule a new dl assignment */
+	uint8_t was_releasing;
+
 	/* store the BTS this TBF belongs to */
 	BTS *bts;
 
-- 
1.8.4.2





More information about the OpenBSC mailing list