Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/10101


Change subject: cosmetic: FSMs: allow ignorable events
......................................................................

cosmetic: FSMs: allow ignorable events

In various FSMs, some events may appear later or earlier without need of
action. Do not indicate these as 'ERROR' (event not permitted), but allow and
ignore them.

Debug-log about some of those.

>From the old code, we've taken over the habit to change into
WAIT_BEFORE_RF_RELEASE even before SAPI[0] is released. Hence we may still
receive a SAPI[0] REL_IND in WAIT_BEFORE_RF_RELEASE. Don't show this as error
message, just silently accept it.

Change-Id: Ie320c7c6a1436184aaf2ec5a1843e04f4b3414ab
---
M src/osmo-bsc/assignment_fsm.c
M src/osmo-bsc/handover_fsm.c
M src/osmo-bsc/lchan_fsm.c
3 files changed, 60 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/01/10101/1

diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index 61757ba..618a83d 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -433,8 +433,9 @@
                return;

        case ASSIGNMENT_EV_LCHAN_ESTABLISHED:
-               /* The lchan is already done with all of its RTP setup. We will 
notice the lchan state to
-                * be established in 
assignment_fsm_wait_lchan_established_onenter(). */
+               LOG_ASSIGNMENT(conn, LOGL_DEBUG, "lchan established, still 
waiting for RR Assignment Complete\n");
+               /* The lchan is already done with all of its RTP setup. We will 
notice the lchan state
+                * being LCHAN_ST_ESTABLISHED in 
assignment_fsm_wait_lchan_established_onenter(). */
                return;

        case ASSIGNMENT_EV_RR_ASSIGNMENT_FAIL:
@@ -453,8 +454,10 @@
 {
        struct gsm_subscriber_connection *conn = assignment_fi_conn(fi);
        /* Do we still need to wait for the RTP stream at all? */
-       if (lchan_state_is(conn->assignment.new_lchan, LCHAN_ST_ESTABLISHED))
+       if (lchan_state_is(conn->assignment.new_lchan, LCHAN_ST_ESTABLISHED)) {
+               LOG_ASSIGNMENT(conn, LOGL_DEBUG, "lchan fully established, no 
need to wait");
                assignment_fsm_post_lchan_established(fi);
+       }
 }

 static void assignment_fsm_wait_lchan_established(struct osmo_fsm_inst *fi, 
uint32_t event, void *data)
@@ -558,6 +561,7 @@
                .in_event_mask = 0
                        | S(ASSIGNMENT_EV_RR_ASSIGNMENT_COMPLETE)
                        | S(ASSIGNMENT_EV_RR_ASSIGNMENT_FAIL)
+                       | S(ASSIGNMENT_EV_LCHAN_ESTABLISHED)
                        ,
                .out_state_mask = 0
                        | S(ASSIGNMENT_ST_WAIT_LCHAN_ESTABLISHED)
diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c
index 1be4214..e3f64cd 100644
--- a/src/osmo-bsc/handover_fsm.c
+++ b/src/osmo-bsc/handover_fsm.c
@@ -872,6 +872,16 @@

        switch (event) {

+       case HO_EV_RR_HO_DETECT:
+               /* Numerous HO Detect RACH bursts may follow after the initial 
one, ignore. */
+               return;
+
+       case HO_EV_LCHAN_ESTABLISHED:
+               LOG_HO(conn, LOGL_DEBUG, "lchan established, still waiting for 
RR Handover Complete\n");
+               /* The lchan is already done with all of its RTP setup. We will 
notice the lchan state
+                * being LCHAN_ST_ESTABLISHED in 
ho_fsm_wait_lchan_established_onenter(). */
+               return;
+
        case HO_EV_RR_HO_COMPLETE:
                ho_fsm_state_chg(HO_ST_WAIT_LCHAN_ESTABLISHED);
                return;
@@ -891,8 +901,10 @@
 {
        struct gsm_subscriber_connection *conn = ho_fi_conn(fi);

-       if (conn->ho.fi && lchan_state_is(conn->ho.new_lchan, 
LCHAN_ST_ESTABLISHED))
+       if (conn->ho.fi && lchan_state_is(conn->ho.new_lchan, 
LCHAN_ST_ESTABLISHED)) {
+               LOG_HO(conn, LOGL_DEBUG, "lchan already established earlier\n");
                ho_fsm_post_lchan_established(fi);
+       }
 }

 static void ho_fsm_wait_lchan_established(struct osmo_fsm_inst *fi, uint32_t 
event, void *data)
@@ -1068,6 +1080,8 @@
                .name = "WAIT_RR_HO_COMPLETE",
                .action = ho_fsm_wait_rr_ho_complete,
                .in_event_mask = 0
+                       | S(HO_EV_RR_HO_DETECT) /* ignore extra HO RACH */
+                       | S(HO_EV_LCHAN_ESTABLISHED)
                        | S(HO_EV_RR_HO_COMPLETE)
                        | S(HO_EV_RR_HO_FAIL)
                        ,
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 3c616dd..f25e7b9 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -755,7 +755,11 @@
        case LCHAN_EV_MGW_ENDPOINT_AVAILABLE:
                lchan->activate.mgw_endpoint_available = true;
                lchan_fsm_tch_post_endpoint_available(fi);
-               break;
+               return;
+
+       case LCHAN_EV_RLL_ESTABLISH_IND:
+               /* abis_rsl.c has noticed that a SAPI was established, no need 
to take action here. */
+               return;

        default:
                OSMO_ASSERT(false);
@@ -828,6 +832,10 @@
                lchan_fail("Received NACK on IPACC CRCX");
                return;

+       case LCHAN_EV_RLL_ESTABLISH_IND:
+               /* abis_rsl.c has noticed that a SAPI was established, no need 
to take action here. */
+               return;
+
        default:
                OSMO_ASSERT(false);
        }
@@ -879,6 +887,10 @@
                lchan_fail("Received NACK on IPACC MDCX");
                return;

+       case LCHAN_EV_RLL_ESTABLISH_IND:
+               /* abis_rsl.c has noticed that a SAPI was established, no need 
to take action here. */
+               return;
+
        default:
                OSMO_ASSERT(false);
        }
@@ -946,6 +958,10 @@
                lchan_fail("Error while redirecting the MGW to the BTS' RTP 
port");
                return;

+       case LCHAN_EV_RLL_ESTABLISH_IND:
+               /* abis_rsl.c has noticed that a SAPI was established, no need 
to take action here. */
+               return;
+
        default:
                OSMO_ASSERT(false);
        }
@@ -1033,7 +1049,19 @@

 static void lchan_fsm_established(struct osmo_fsm_inst *fi, uint32_t event, 
void *data)
 {
-       handle_rll_rel_ind_or_conf(fi, event, data, true);
+       switch (event) {
+       case LCHAN_EV_RLL_ESTABLISH_IND:
+               /* abis_rsl.c has noticed that a SAPI was established, no need 
to take action here. */
+               return;
+
+       case LCHAN_EV_RLL_REL_IND:
+       case LCHAN_EV_RLL_REL_CONF:
+               handle_rll_rel_ind_or_conf(fi, event, data, true);
+               return;
+
+       default:
+               OSMO_ASSERT(false);
+       }
 }

 static bool should_sacch_deact(struct gsm_lchan *lchan)
@@ -1236,6 +1264,7 @@
                .action = lchan_fsm_wait_mgw_endpoint_available,
                .in_event_mask = 0
                        | S(LCHAN_EV_MGW_ENDPOINT_AVAILABLE)
+                       | S(LCHAN_EV_RLL_ESTABLISH_IND) /* ignored */
                        ,
                .out_state_mask = 0
                        | S(LCHAN_ST_UNUSED)
@@ -1252,6 +1281,7 @@
                .in_event_mask = 0
                        | S(LCHAN_EV_IPACC_CRCX_ACK)
                        | S(LCHAN_EV_IPACC_CRCX_NACK)
+                       | S(LCHAN_EV_RLL_ESTABLISH_IND) /* ignored */
                        ,
                .out_state_mask = 0
                        | S(LCHAN_ST_UNUSED)
@@ -1267,6 +1297,7 @@
                .in_event_mask = 0
                        | S(LCHAN_EV_IPACC_MDCX_ACK)
                        | S(LCHAN_EV_IPACC_MDCX_NACK)
+                       | S(LCHAN_EV_RLL_ESTABLISH_IND) /* ignored */
                        ,
                .out_state_mask = 0
                        | S(LCHAN_ST_UNUSED)
@@ -1281,6 +1312,7 @@
                .action = lchan_fsm_wait_mgw_endpoint_configured,
                .in_event_mask = 0
                        | S(LCHAN_EV_MGW_ENDPOINT_CONFIGURED)
+                       | S(LCHAN_EV_RLL_ESTABLISH_IND) /* ignored */
                        ,
                .out_state_mask = 0
                        | S(LCHAN_ST_UNUSED)
@@ -1296,6 +1328,7 @@
                .in_event_mask = 0
                        | S(LCHAN_EV_RLL_REL_IND)
                        | S(LCHAN_EV_RLL_REL_CONF)
+                       | S(LCHAN_EV_RLL_ESTABLISH_IND) /* ignored */
                        ,
                .out_state_mask = 0
                        | S(LCHAN_ST_UNUSED)
@@ -1320,6 +1353,9 @@
        },
        [LCHAN_ST_WAIT_BEFORE_RF_RELEASE] = {
                .name = "WAIT_BEFORE_RF_RELEASE",
+               .in_event_mask = 0
+                       | S(LCHAN_EV_RLL_REL_IND) /* allow late REL_IND of 
SAPI[0] */
+                       ,
                .out_state_mask = 0
                        | S(LCHAN_ST_UNUSED)
                        | S(LCHAN_ST_WAIT_RF_RELEASE_ACK)

--
To view, visit https://gerrit.osmocom.org/10101
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie320c7c6a1436184aaf2ec5a1843e04f4b3414ab
Gerrit-Change-Number: 10101
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <[email protected]>

Reply via email to