nacc_fsm: Move logic checking if SI is being waited for to a func helper
We already have a similar function for Neighbor Address Resolution.
This way we keep as much as possible internal state related logic into
the nacc_fsm.c file.
Change-Id: I7378939825cc3ec3280f76bc51233c0a172d8a27
diff --git a/src/gprs_bssgp_rim.c b/src/gprs_bssgp_rim.c
index c19ed81..f1679a6 100644
--- a/src/gprs_bssgp_rim.c
+++ b/src/gprs_bssgp_rim.c
@@ -158,13 +158,8 @@
llist_for_each(tmp, bts_ms_list(bts)) {
struct GprsMs *ms = llist_entry(tmp, typeof(*ms), list);
- if (!ms->nacc)
- continue;
- if (ms->nacc->fi->state != NACC_ST_WAIT_REQUEST_SI)
- continue;
- if (osmo_cgi_ps_cmp(&nacc->reprt_cell, &ms->nacc->cgi_ps) != 0)
- continue;
- osmo_fsm_inst_dispatch(ms->nacc->fi, NACC_EV_RX_SI, entry);
+ if (ms->nacc && nacc_fsm_is_waiting_si_resolution(ms->nacc, &nacc->reprt_cell))
+ osmo_fsm_inst_dispatch(ms->nacc->fi, NACC_EV_RX_SI, entry);
}
return 0;
}
diff --git a/src/nacc_fsm.c b/src/nacc_fsm.c
index ca226ac..df38927 100644
--- a/src/nacc_fsm.c
+++ b/src/nacc_fsm.c
@@ -887,3 +887,11 @@
return false;
return neigh_cache_entry_key_eq(&ctx->neigh_key, neigh_key);
}
+
+bool nacc_fsm_is_waiting_si_resolution(const struct nacc_fsm_ctx *ctx,
+ const struct osmo_cell_global_id_ps *cgi_ps)
+{
+ if (ctx->fi->state != NACC_ST_WAIT_REQUEST_SI)
+ return false;
+ return !osmo_cgi_ps_cmp(&ctx->cgi_ps, cgi_ps);
+}
diff --git a/src/nacc_fsm.h b/src/nacc_fsm.h
index 04c9ba4..68ebd52 100644
--- a/src/nacc_fsm.h
+++ b/src/nacc_fsm.h
@@ -72,3 +72,6 @@
bool nacc_fsm_is_waiting_addr_resolution(const struct nacc_fsm_ctx *ctx,
const struct neigh_cache_entry_key *neigh_key);
+
+bool nacc_fsm_is_waiting_si_resolution(const struct nacc_fsm_ctx *ctx,
+ const struct osmo_cell_global_id_ps *cgi_ps);