diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-06-27 14:12:00 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-06-29 14:41:50 +0200 |
commit | 28ccf7a284b0cf12f9abd8282efb01cd706bd4a6 (patch) | |
tree | 4765abd40f96625840dda775b8c1dbdae19a9b0a | |
parent | 40a297f3b0c8e1670d46a4974750dd3335bc7885 (diff) |
ms_need_dl_tbf(): Fix state checks and document function
A new state TBF_ST_WAIT_REUSE_TFI was added lately in dl_tbf_fsm, which
allows differentiating the time where the MS is listening on PACCH
after having sent last DL ACK/NACK, and time where it should already be
in idle mode.
In the former, the ms_need_dl_tbf() should return false since the MS is
still ongoing in packet-active mode (and new data incoming from SGSN
will trigger new DL TBF assignment over PACCH as needed), while in the
later we want to start a new PCH assignment.
Fixes: 40a297f3b0c8e1670d46a4974750dd3335bc7885
Change-Id: I96f311480d036859511c6ba825ccd36bdc71190b
-rw-r--r-- | src/gprs_ms.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/gprs_ms.h b/src/gprs_ms.h index ef1cc4e5..276733ca 100644 --- a/src/gprs_ms.h +++ b/src/gprs_ms.h @@ -157,11 +157,30 @@ static inline struct gprs_llc_queue *ms_llc_queue(struct GprsMs *ms) return &ms->llc_queue; } +/* Function used in code where a ul_tbf related event occurs and hence its state + * changes, which in turn may change the entire MS state (eg becoming reachable + * over PCH or PACCH) and the caller may want to know if it is a good time to + * assign a DL TBF (and whether we have DL data to send) */ static inline bool ms_need_dl_tbf(struct GprsMs *ms) { - if (ms_dl_tbf(ms) != NULL && - tbf_state((const struct gprs_rlcmac_tbf *)ms_dl_tbf(ms)) != TBF_ST_WAIT_RELEASE) - return false; + struct gprs_rlcmac_dl_tbf *dl_tbf = ms_dl_tbf(ms); + if (dl_tbf) { + switch (tbf_state(dl_tbf_as_tbf(dl_tbf))) { + case TBF_ST_NEW: + case TBF_ST_ASSIGN: + case TBF_ST_FLOW: + case TBF_ST_FINISHED: + case TBF_ST_WAIT_RELEASE: + return false; /* TBF in use, hence no need for new DL TBF */ + case TBF_ST_WAIT_REUSE_TFI: + case TBF_ST_RELEASING: + /* TBF cannot be used to send further data, a new one + * may be needed, check below */ + break; + default: + OSMO_ASSERT(0); + } + } return llc_queue_size(ms_llc_queue(ms)) > 0; } |