aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-06-12 18:56:24 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2023-06-13 13:31:10 +0200
commit6d7167658eeaaabae63d176fb68a152ea9698c1e (patch)
tree61253e3028f7d881c9522f3a7b4f2670d33c06c9 /src
parentbb34ffaaf705e40f1792004eb0aa563273155ad3 (diff)
Move GPRS_RLCMAC_FLAG_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: I12c28c1a52f363f2d17a8bc24bbdf379543fc7a6
Diffstat (limited to 'src')
-rw-r--r--src/tbf.cpp2
-rw-r--r--src/tbf.h1
-rw-r--r--src/tbf_dl.cpp8
-rw-r--r--src/tbf_dl.h3
-rw-r--r--src/tbf_dl_fsm.c4
5 files changed, 13 insertions, 5 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 8981615f..279efcdf 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -885,7 +885,7 @@ const char* tbf_rlcmac_diag(const struct gprs_rlcmac_tbf *tbf)
OSMO_STRBUF_PRINTF(sb, "Assignment was on CCCH|");
if (dl_tbf->state_fsm.state_flags & (1 << GPRS_RLCMAC_FLAG_PACCH))
OSMO_STRBUF_PRINTF(sb, "Assignment was on PACCH|");
- if (dl_tbf->state_fsm.state_flags & (1 << GPRS_RLCMAC_FLAG_DL_ACK))
+ if (dl_tbf->m_first_dl_ack_rcvd)
OSMO_STRBUF_PRINTF(sb, "Downlink ACK was received|");
else
OSMO_STRBUF_PRINTF(sb, "No downlink ACK received yet|");
diff --git a/src/tbf.h b/src/tbf.h
index 941e350a..124a2e6d 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -109,7 +109,6 @@ enum tbf_counters { /* TBF counters from 3GPP TS 44.060 ยง13.4 */
#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 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 170ed251..17d29348 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -164,6 +164,7 @@ gprs_rlcmac_dl_tbf::gprs_rlcmac_dl_tbf(struct gprs_rlcmac_bts *bts_, GprsMs *ms)
m_last_dl_poll_fn(-1),
m_last_dl_poll_ack_lost(false),
m_last_dl_drained_fn(-1),
+ m_first_dl_ack_rcvd(false),
m_dl_gprs_ctrs(NULL),
m_dl_egprs_ctrs(NULL)
{
@@ -1080,7 +1081,7 @@ int gprs_rlcmac_dl_tbf::rcvd_dl_ack(bool final_ack, unsigned first_bsn,
int rc;
LOGPTBFDL(this, LOGL_DEBUG, "downlink acknowledge\n");
- state_fsm.state_flags |= (1 << GPRS_RLCMAC_FLAG_DL_ACK);
+ m_first_dl_ack_rcvd = true;
m_last_dl_poll_ack_lost = false;
/* reset N3105 */
@@ -1114,6 +1115,11 @@ void dl_tbf_request_dl_ack(struct gprs_rlcmac_dl_tbf *dl_tbf) {
dl_tbf->request_dl_ack();
}
+bool dl_tbf_first_dl_ack_rcvd(const struct gprs_rlcmac_dl_tbf *tbf)
+{
+ return tbf->m_first_dl_ack_rcvd;
+}
+
/* Does this DL TBF require to poll the MS for DL ACK/NACK? */
bool gprs_rlcmac_dl_tbf::need_poll_for_dl_ack_nack() const
{
diff --git a/src/tbf_dl.h b/src/tbf_dl.h
index ec75e327..dabe9a90 100644
--- a/src/tbf_dl.h
+++ b/src/tbf_dl.h
@@ -75,6 +75,8 @@ struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf {
* 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;
+ /* Whether we receive at least one PKT DL ACK/NACK from MS since this DL TBF was assigned: */
+ bool m_first_dl_ack_rcvd;
struct BandWidth {
struct timespec dl_bw_tv; /* timestamp for dl bw calculation */
@@ -156,6 +158,7 @@ void dl_tbf_apply_allocated_resources(struct gprs_rlcmac_dl_tbf *dl_tbf, const s
void dl_tbf_trigger_ass_on_pacch(struct gprs_rlcmac_dl_tbf *tbf, struct gprs_rlcmac_tbf *old_tbf);
void dl_tbf_trigger_ass_on_pch(struct gprs_rlcmac_dl_tbf *tbf);
void dl_tbf_request_dl_ack(struct gprs_rlcmac_dl_tbf *tbf);
+bool dl_tbf_first_dl_ack_rcvd(const struct gprs_rlcmac_dl_tbf *tbf);
int dl_tbf_upgrade_to_multislot(struct gprs_rlcmac_dl_tbf *tbf);
static inline struct gprs_rlcmac_tbf *dl_tbf_as_tbf(struct gprs_rlcmac_dl_tbf *dl_tbf)
diff --git a/src/tbf_dl_fsm.c b/src/tbf_dl_fsm.c
index 6c3f4f16..ce9bee3c 100644
--- a/src/tbf_dl_fsm.c
+++ b/src/tbf_dl_fsm.c
@@ -208,8 +208,8 @@ static void st_flow(struct osmo_fsm_inst *fi, uint32_t event, void *data)
* don't even know if the MS successfully received the Imm Ass on
* CCCH and hence is listening on PDCH. Let's better refrain
* from continuing and start assignment on CCCH again */
- if ((ctx->state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH))
- && !(ctx->state_flags & (1 << GPRS_RLCMAC_FLAG_DL_ACK))) {
+ if ((ctx->state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)) &&
+ !dl_tbf_first_dl_ack_rcvd(ctx->dl_tbf)) {
struct GprsMs *ms = tbf_ms(ctx->tbf);
LOGPTBFDL(ctx->dl_tbf, LOGL_DEBUG,
"Re-send downlink assignment on PCH (IMSI=%s)\n",