Move GPRS_RLCMAC_FLAG_TO_DL_ACK from state_fsm to dl_tbf
That flag was still in state_fsm for historical reasons (refactoring
steps), but it's not really the best place for it, since it's really
specific to dl_tbf and to transmit of data and DL ACK/NACK not the
overall state of the TBF.
Change-Id: I6b44121bbe185b58f3a77be8c12b4ef1f3180a30
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 885c602..8981615 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -560,11 +560,11 @@
dl_tbf = tbf_as_dl_tbf(this);
/* POLL Timeout expecting DL ACK/NACK: implies direction == GPRS_RLCMAC_DL_TBF */
OSMO_ASSERT(dl_tbf);
- if (!(dl_tbf->state_fsm.state_flags & (1 << GPRS_RLCMAC_FLAG_TO_DL_ACK))) {
+ if (!dl_tbf->m_last_dl_poll_ack_lost) {
LOGPTBF(this, LOGL_NOTICE,
"Timeout for polling PACKET DOWNLINK ACK: %s\n",
tbf_rlcmac_diag(dl_tbf));
- dl_tbf->state_fsm.state_flags |= (1 << GPRS_RLCMAC_FLAG_TO_DL_ACK);
+ dl_tbf->m_last_dl_poll_ack_lost = true;
}
if (dl_tbf->state_is(TBF_ST_RELEASING))
bts_do_rate_ctr_inc(bts, CTR_RLC_REL_TIMEDOUT);
diff --git a/src/tbf.h b/src/tbf.h
index 37756b0..941e350 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -110,8 +110,6 @@
#define GPRS_RLCMAC_FLAG_CCCH 0 /* assignment on CCCH */
#define GPRS_RLCMAC_FLAG_PACCH 1 /* assignment on PACCH */
#define GPRS_RLCMAC_FLAG_DL_ACK 2 /* DL TBF: At least one DL ACK/NACK was recieved since it was assigned */
-#define GPRS_RLCMAC_FLAG_TO_DL_ACK 3 /* DL TBF: Failed to receive last polled DL ACK/NACK */
-
#define TBF_TFI_UNSET 0xff
#define T_START(tbf, t, T, r, f) tbf->t_start(t, T, r, f, __FILE__, __LINE__)
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 3ffafbf..170ed25 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -162,6 +162,7 @@
m_tx_counter(0),
m_dl_ack_requested(false),
m_last_dl_poll_fn(-1),
+ m_last_dl_poll_ack_lost(false),
m_last_dl_drained_fn(-1),
m_dl_gprs_ctrs(NULL),
m_dl_egprs_ctrs(NULL)
@@ -858,7 +859,7 @@
LOGPTBFDL(this, LOGL_DEBUG,
"Scheduling Ack/Nack polling, because it was requested explicitly "
"(e.g. first final block sent).\n");
- } else if (state_fsm.state_flags & (1 << GPRS_RLCMAC_FLAG_TO_DL_ACK)) {
+ } else if (m_last_dl_poll_ack_lost) {
LOGPTBFDL(this, LOGL_DEBUG,
"Scheduling Ack/Nack polling, because polling timed out.\n");
} else {
@@ -879,10 +880,10 @@
if (is_final)
T_START(this, T3191, 3191, "final block (DL-TBF)", true);
- state_fsm.state_flags &= ~(1 << GPRS_RLCMAC_FLAG_TO_DL_ACK); /* clear poll timeout flag */
-
/* Clear request flag */
m_dl_ack_requested = false;
+ /* clear poll timeout flag */
+ m_last_dl_poll_ack_lost = false;
/* set polling in header */
rlc.rrbp = rrbp;
@@ -1080,7 +1081,7 @@
LOGPTBFDL(this, LOGL_DEBUG, "downlink acknowledge\n");
state_fsm.state_flags |= (1 << GPRS_RLCMAC_FLAG_DL_ACK);
- state_fsm.state_flags &= ~(1 << GPRS_RLCMAC_FLAG_TO_DL_ACK);
+ m_last_dl_poll_ack_lost = false;
/* reset N3105 */
n_reset(N3105);
@@ -1118,7 +1119,7 @@
{
/* poll after POLL_ACK_AFTER_FRAMES frames, or when final block is tx or
* when last polled DL ACK/NACK was lost. */
- return state_fsm.state_flags & (1 << GPRS_RLCMAC_FLAG_TO_DL_ACK) ||
+ return m_last_dl_poll_ack_lost ||
m_tx_counter >= POLL_ACK_AFTER_FRAMES ||
m_dl_ack_requested;
}
diff --git a/src/tbf_dl.h b/src/tbf_dl.h
index 6718c13..ec75e32 100644
--- a/src/tbf_dl.h
+++ b/src/tbf_dl.h
@@ -71,6 +71,9 @@
int32_t m_tx_counter; /* count all transmitted blocks */
bool m_dl_ack_requested;
int32_t m_last_dl_poll_fn;
+ /* Whether we failed to receive ("poll timeout") last PKT CTRL ACK from
+ * MS polled during DL ACK/NACK with RRBP set in "m_last_dl_poll_fn": */
+ bool m_last_dl_poll_ack_lost;
int32_t m_last_dl_drained_fn;
struct BandWidth {