From 01653252b4b74e9b3637a384a3bdac4b35f94b88 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 3 Sep 2019 02:06:22 +0200 Subject: msc_a fsm: ignore state chg to same state We sometimes see errors like libmsc/msc_a.c:361 msc_a(...){MSC_A_ST_RELEASING}: transition to state MSC_A_ST_RELEASING not permitted! i.e. changing state to the state msc_a is already in. Ignore re-entering the same state for most state changes. However, there is one state change in msc_a where re-entering the MSC_A_ST_VALIDATE_L3 is necessary to start the timeout. Hence add msc_a_state_chg_always() and use that for re-entering MSC_A_ST_VALIDATE_L3. Change msc_a_state_chg() to skip no-op state changes. This should silence all no-op state change error messages for msc_a. Related: OS#4169 Change-Id: I0c74c10b5fa7bbdd6ae3674926cc0393edf15a35 --- src/libmsc/msc_a.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/libmsc/msc_a.c') diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c index a082cb8f9..b41457458 100644 --- a/src/libmsc/msc_a.c +++ b/src/libmsc/msc_a.c @@ -63,9 +63,15 @@ static const struct osmo_tdef_state_timeout msc_a_fsm_timeouts[32] = { /* Transition to a state, using the T timer defined in msc_a_fsm_timeouts. * The actual timeout value is in turn obtained from network->T_defs. * Assumes local variable fi exists. */ -#define msc_a_state_chg(msc_a, state) \ +#define msc_a_state_chg_always(msc_a, state) \ osmo_tdef_fsm_inst_state_chg((msc_a)->c.fi, state, msc_a_fsm_timeouts, (msc_a)->c.ran->tdefs, 5) +/* Same as msc_a_state_chg_always() but ignore if the msc_a already is in the target state. */ +#define msc_a_state_chg(msc_a, STATE) do { \ + if ((msc_a)->c.fi->state != STATE) \ + msc_a_state_chg_always(msc_a, STATE); \ + } while(0) + struct gsm_network *msc_a_net(const struct msc_a *msc_a) { return msub_net(msc_a->c.msub); @@ -1036,7 +1042,7 @@ struct msc_a *msc_a_alloc(struct msub *msub, struct ran_infra *ran) }; osmo_use_count_make_static_entries(&msc_a->use_count, msc_a->use_count_buf, ARRAY_SIZE(msc_a->use_count_buf)); /* Start timeout for first state */ - msc_a_state_chg(msc_a, MSC_A_ST_VALIDATE_L3); + msc_a_state_chg_always(msc_a, MSC_A_ST_VALIDATE_L3); return msc_a; } -- cgit v1.2.3