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
This commit is contained in:
Pau Espin 2021-09-07 14:43:46 +02:00
parent 5557c0af80
commit 6c81adda45
3 changed files with 13 additions and 7 deletions

View File

@ -158,13 +158,8 @@ static int handle_ran_info_response_nacc(const struct bssgp_ran_inf_app_cont_nac
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;
}

View File

@ -887,3 +887,11 @@ bool nacc_fsm_is_waiting_addr_resolution(const struct nacc_fsm_ctx *ctx,
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);
}

View File

@ -72,3 +72,6 @@ struct nacc_fsm_ctx *nacc_fsm_alloc(struct GprsMs* ms);
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);