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
This commit is contained in:
Pau Espin 2021-09-28 12:53:35 +02:00
parent 864a41496c
commit c276e4996d
4 changed files with 12 additions and 4 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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

View File

@ -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;