aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-09-28 12:53:35 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-09-28 12:53:37 +0200
commitc276e4996d24bde6f617e8fced693d7d1fe49318 (patch)
tree86d26b132a7cd282725c9fb61a3fdae921e22eb6
parent864a41496c134dbc8fa73fc0c79dd83c99271726 (diff)
nacc: Introduce helper function nacc_fsm_exp_ctrl_ack()
Move FSM internal state checks to its own file. Re-use the helper function in the 2 places where same stuff is checked. Change-Id: I9ded6e1c80e6cd7bcf6883bc2e853b6dafb33f7c
-rw-r--r--src/nacc_fsm.c7
-rw-r--r--src/nacc_fsm.h2
-rw-r--r--src/pdch.cpp3
-rw-r--r--src/tbf.cpp4
4 files changed, 12 insertions, 4 deletions
diff --git a/src/nacc_fsm.c b/src/nacc_fsm.c
index df389271..ba7bbb78 100644
--- a/src/nacc_fsm.c
+++ b/src/nacc_fsm.c
@@ -895,3 +895,10 @@ bool nacc_fsm_is_waiting_si_resolution(const struct nacc_fsm_ctx *ctx,
return false;
return !osmo_cgi_ps_cmp(&ctx->cgi_ps, cgi_ps);
}
+
+bool nacc_fsm_exp_ctrl_ack(const struct nacc_fsm_ctx *ctx, uint32_t fn, uint8_t ts)
+{
+ return ctx->fi->state == NACC_ST_WAIT_CELL_CHG_CONTINUE_ACK &&
+ ctx->continue_poll_fn == fn &&
+ ctx->continue_poll_ts == ts;
+}
diff --git a/src/nacc_fsm.h b/src/nacc_fsm.h
index 68ebd52c..beea0f75 100644
--- a/src/nacc_fsm.h
+++ b/src/nacc_fsm.h
@@ -75,3 +75,5 @@ bool nacc_fsm_is_waiting_addr_resolution(const struct nacc_fsm_ctx *ctx,
bool nacc_fsm_is_waiting_si_resolution(const struct nacc_fsm_ctx *ctx,
const struct osmo_cell_global_id_ps *cgi_ps);
+
+bool nacc_fsm_exp_ctrl_ack(const struct nacc_fsm_ctx *ctx, uint32_t fn, uint8_t ts);
diff --git a/src/pdch.cpp b/src/pdch.cpp
index 19d57a23..76acbcae 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -401,8 +401,7 @@ void gprs_rlcmac_pdch::rcv_control_ack(Packet_Control_Acknowledgement_t *packet,
return;
}
- if (ms->nacc && ms->nacc->fi->state == NACC_ST_WAIT_CELL_CHG_CONTINUE_ACK &&
- ms->nacc->continue_poll_fn == fn && ms->nacc->continue_poll_ts == ts_no) {
+ if (ms->nacc && nacc_fsm_exp_ctrl_ack(ms->nacc, fn, ts_no)) {
osmo_fsm_inst_dispatch(ms->nacc->fi, NACC_EV_RX_CELL_CHG_CONTINUE_ACK, NULL);
/* Don't assume MS is no longer reachable (hence don't free) after this: TS 44.060
* "When the mobile station receives the PACKET CELL CHANGE ORDER
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 61ab90e2..0ea013bf 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -570,8 +570,8 @@ void gprs_rlcmac_tbf::poll_timeout(struct gprs_rlcmac_pdch *pdch, uint32_t poll_
}
/* Signal timeout to FSM to reschedule DL assignment */
osmo_fsm_inst_dispatch(this->dl_ass_fsm.fi, TBF_DL_ASS_EV_ASS_POLL_TIMEOUT, NULL);
- } else if (reason == PDCH_ULC_POLL_CELL_CHG_CONTINUE && m_ms->nacc && m_ms->nacc->fi->state == NACC_ST_WAIT_CELL_CHG_CONTINUE_ACK &&
- m_ms->nacc->continue_poll_fn == poll_fn && m_ms->nacc->continue_poll_ts == pdch->ts_no) {
+ } else if (reason == PDCH_ULC_POLL_CELL_CHG_CONTINUE &&
+ m_ms->nacc && nacc_fsm_exp_ctrl_ack(m_ms->nacc, poll_fn, pdch->ts_no)) {
/* Timeout waiting for CTRL ACK acking Pkt Cell Change Continue */
osmo_fsm_inst_dispatch(m_ms->nacc->fi, NACC_EV_TIMEOUT_CELL_CHG_CONTINUE, NULL);
return;