Change in ...osmo-msc[master]: msc_a fsm: ignore state chg to same state

2019-09-03 Thread neels
neels has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/15389 )

Change subject: msc_a fsm: ignore state chg to same state
..

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
---
M src/libmsc/msc_a.c
M tests/msc_vlr/msc_vlr_test_gsm_authen.err
M tests/msc_vlr/msc_vlr_test_hlr_reject.err
M tests/msc_vlr/msc_vlr_test_hlr_timeout.err
M tests/msc_vlr/msc_vlr_test_ms_timeout.err
5 files changed, 8 insertions(+), 13 deletions(-)

Approvals:
  neels: Looks good to me, approved
  fixeria: Looks good to me, but someone else must approve
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c
index a082cb8..b414574 100644
--- a/src/libmsc/msc_a.c
+++ b/src/libmsc/msc_a.c
@@ -63,9 +63,15 @@
 /* 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 @@
};
osmo_use_count_make_static_entries(_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;
 }

diff --git a/tests/msc_vlr/msc_vlr_test_gsm_authen.err 
b/tests/msc_vlr/msc_vlr_test_gsm_authen.err
index c9be4ef..4905881 100644
--- a/tests/msc_vlr/msc_vlr_test_gsm_authen.err
+++ b/tests/msc_vlr/msc_vlr_test_gsm_authen.err
@@ -1926,7 +1926,6 @@
 DMSC msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:LU){MSC_A_ST_RELEASING}: 
RAN encode: CLEAR_COMMAND on GERAN-A
 DMSC dummy_msc_i(IMSI-90170004620:MSISDN-46071:GERAN-A:LU){0}: Received 
Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
 DREF VLR subscr IMSI-90170004620:MSISDN-46071 - 
msc_a_fsm_releasing_onenter: now used by 2 (active-conn,vlr_gsup_rx)
-DMSC msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:LU){MSC_A_ST_RELEASING}: 
transition to state MSC_A_ST_RELEASING not permitted!
 DREF VLR subscr IMSI-90170004620:MSISDN-46071 - vlr_gsup_rx: now used by 1 
(active-conn)
 <-- GSUP rx OSMO_GSUP_MSGT_CHECK_IMEI_RESULT: vlr_gsupc_read_cb() returns 0
 msc_a_is_accepted() == false
@@ -2192,7 +2191,6 @@
 DMSC msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:LU){MSC_A_ST_RELEASING}: 
RAN encode: CLEAR_COMMAND on GERAN-A
 DMSC dummy_msc_i(IMSI-90170004620:MSISDN-46071:GERAN-A:LU){0}: Received 
Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
 DREF VLR subscr IMSI-90170004620:MSISDN-46071 - 
msc_a_fsm_releasing_onenter: now used by 2 (active-conn,vlr_gsup_rx)
-DMSC msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:LU){MSC_A_ST_RELEASING}: 
transition to state MSC_A_ST_RELEASING not permitted!
 DREF VLR subscr IMSI-90170004620:MSISDN-46071 - vlr_gsup_rx: now used by 1 
(active-conn)
 <-- GSUP rx OSMO_GSUP_MSGT_CHECK_IMEI_ERROR: vlr_gsupc_read_cb() returns 0
 msc_a_is_accepted() == false
diff --git a/tests/msc_vlr/msc_vlr_test_hlr_reject.err 
b/tests/msc_vlr/msc_vlr_test_hlr_reject.err
index 9d0737a..e4ea226 100644
--- a/tests/msc_vlr/msc_vlr_test_hlr_reject.err
+++ b/tests/msc_vlr/msc_vlr_test_hlr_reject.err
@@ -65,7 +65,6 @@
 DMSC msc_a(IMSI-90170004620:GERAN-A:LU){MSC_A_ST_RELEASING}: RAN encode: 
CLEAR_COMMAND on GERAN-A
 DMSC dummy_msc_i(IMSI-90170004620:GERAN-A:LU){0}: Received Event 
MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
 DREF VLR subscr IMSI-90170004620 - msc_a_fsm_releasing_onenter: now used 
by 2 (active-conn,vlr_gsup_rx)
-DMSC msc_a(IMSI-90170004620:GERAN-A:LU){MSC_A_ST_RELEASING}: transition to 
state 

Change in ...osmo-msc[master]: msc_a fsm: ignore state chg to same state

2019-09-03 Thread neels
neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/15389 )

Change subject: msc_a fsm: ignore state chg to same state
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/15389
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I0c74c10b5fa7bbdd6ae3674926cc0393edf15a35
Gerrit-Change-Number: 15389
Gerrit-PatchSet: 1
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 03 Sep 2019 13:58:46 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-msc[master]: msc_a fsm: ignore state chg to same state

2019-09-03 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/15389 )

Change subject: msc_a fsm: ignore state chg to same state
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/15389
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I0c74c10b5fa7bbdd6ae3674926cc0393edf15a35
Gerrit-Change-Number: 15389
Gerrit-PatchSet: 1
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 03 Sep 2019 11:36:36 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-msc[master]: msc_a fsm: ignore state chg to same state

2019-09-03 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/15389 )

Change subject: msc_a fsm: ignore state chg to same state
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/15389
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I0c74c10b5fa7bbdd6ae3674926cc0393edf15a35
Gerrit-Change-Number: 15389
Gerrit-PatchSet: 1
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 03 Sep 2019 09:26:17 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-msc[master]: msc_a fsm: ignore state chg to same state

2019-09-02 Thread neels
neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/15389


Change subject: msc_a fsm: ignore state chg to same state
..

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
---
M src/libmsc/msc_a.c
M tests/msc_vlr/msc_vlr_test_gsm_authen.err
M tests/msc_vlr/msc_vlr_test_hlr_reject.err
M tests/msc_vlr/msc_vlr_test_hlr_timeout.err
M tests/msc_vlr/msc_vlr_test_ms_timeout.err
5 files changed, 8 insertions(+), 13 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/89/15389/1

diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c
index a082cb8..b414574 100644
--- a/src/libmsc/msc_a.c
+++ b/src/libmsc/msc_a.c
@@ -63,9 +63,15 @@
 /* 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 @@
};
osmo_use_count_make_static_entries(_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;
 }

diff --git a/tests/msc_vlr/msc_vlr_test_gsm_authen.err 
b/tests/msc_vlr/msc_vlr_test_gsm_authen.err
index c9be4ef..4905881 100644
--- a/tests/msc_vlr/msc_vlr_test_gsm_authen.err
+++ b/tests/msc_vlr/msc_vlr_test_gsm_authen.err
@@ -1926,7 +1926,6 @@
 DMSC msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:LU){MSC_A_ST_RELEASING}: 
RAN encode: CLEAR_COMMAND on GERAN-A
 DMSC dummy_msc_i(IMSI-90170004620:MSISDN-46071:GERAN-A:LU){0}: Received 
Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
 DREF VLR subscr IMSI-90170004620:MSISDN-46071 - 
msc_a_fsm_releasing_onenter: now used by 2 (active-conn,vlr_gsup_rx)
-DMSC msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:LU){MSC_A_ST_RELEASING}: 
transition to state MSC_A_ST_RELEASING not permitted!
 DREF VLR subscr IMSI-90170004620:MSISDN-46071 - vlr_gsup_rx: now used by 1 
(active-conn)
 <-- GSUP rx OSMO_GSUP_MSGT_CHECK_IMEI_RESULT: vlr_gsupc_read_cb() returns 0
 msc_a_is_accepted() == false
@@ -2192,7 +2191,6 @@
 DMSC msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:LU){MSC_A_ST_RELEASING}: 
RAN encode: CLEAR_COMMAND on GERAN-A
 DMSC dummy_msc_i(IMSI-90170004620:MSISDN-46071:GERAN-A:LU){0}: Received 
Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
 DREF VLR subscr IMSI-90170004620:MSISDN-46071 - 
msc_a_fsm_releasing_onenter: now used by 2 (active-conn,vlr_gsup_rx)
-DMSC msc_a(IMSI-90170004620:MSISDN-46071:GERAN-A:LU){MSC_A_ST_RELEASING}: 
transition to state MSC_A_ST_RELEASING not permitted!
 DREF VLR subscr IMSI-90170004620:MSISDN-46071 - vlr_gsup_rx: now used by 1 
(active-conn)
 <-- GSUP rx OSMO_GSUP_MSGT_CHECK_IMEI_ERROR: vlr_gsupc_read_cb() returns 0
 msc_a_is_accepted() == false
diff --git a/tests/msc_vlr/msc_vlr_test_hlr_reject.err 
b/tests/msc_vlr/msc_vlr_test_hlr_reject.err
index 9d0737a..e4ea226 100644
--- a/tests/msc_vlr/msc_vlr_test_hlr_reject.err
+++ b/tests/msc_vlr/msc_vlr_test_hlr_reject.err
@@ -65,7 +65,6 @@
 DMSC msc_a(IMSI-90170004620:GERAN-A:LU){MSC_A_ST_RELEASING}: RAN encode: 
CLEAR_COMMAND on GERAN-A
 DMSC dummy_msc_i(IMSI-90170004620:GERAN-A:LU){0}: Received Event 
MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
 DREF VLR subscr IMSI-90170004620 - msc_a_fsm_releasing_onenter: now used 
by 2 (active-conn,vlr_gsup_rx)
-DMSC msc_a(IMSI-90170004620:GERAN-A:LU){MSC_A_ST_RELEASING}: transition to 
state MSC_A_ST_RELEASING not permitted!
 DVLR 
VLR_Authenticate(IMSI-90170004620:GERAN-A:LU){VLR_SUB_AS_AUTH_FAILED}: 
Deallocated
 DREF