diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c index e73f90281..a2b17463f 100644 --- a/src/osmo-bsc/assignment_fsm.c +++ b/src/osmo-bsc/assignment_fsm.c @@ -432,8 +432,9 @@ static void assignment_fsm_wait_rr_ass_complete(struct osmo_fsm_inst *fi, uint32 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: @@ -452,8 +453,10 @@ static void assignment_fsm_wait_lchan_established_onenter(struct osmo_fsm_inst * { 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) @@ -557,6 +560,7 @@ static const struct osmo_fsm_state assignment_fsm_states[] = { .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 0430a7f6d..0a6ee2471 100644 --- a/src/osmo-bsc/handover_fsm.c +++ b/src/osmo-bsc/handover_fsm.c @@ -870,6 +870,16 @@ static void ho_fsm_wait_rr_ho_complete(struct osmo_fsm_inst *fi, uint32_t event, 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; @@ -889,8 +899,10 @@ static void ho_fsm_wait_lchan_established_onenter(struct osmo_fsm_inst *fi, uint { 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) @@ -1066,6 +1078,8 @@ static const struct osmo_fsm_state ho_fsm_states[] = { .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 7a9f57fb2..9f053ac4a 100644 --- a/src/osmo-bsc/lchan_fsm.c +++ b/src/osmo-bsc/lchan_fsm.c @@ -755,7 +755,11 @@ static void lchan_fsm_wait_mgw_endpoint_available(struct osmo_fsm_inst *fi, uint 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 @@ static void lchan_fsm_wait_ipacc_crcx_ack(struct osmo_fsm_inst *fi, uint32_t eve 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 @@ static void lchan_fsm_wait_ipacc_mdcx_ack(struct osmo_fsm_inst *fi, uint32_t eve 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 @@ static void lchan_fsm_wait_mgw_endpoint_configured(struct osmo_fsm_inst *fi, uin 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 handle_rll_rel_ind_or_conf(struct osmo_fsm_inst *fi, uint32_t event, 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 @@ static const struct osmo_fsm_state lchan_fsm_states[] = { .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 @@ static const struct osmo_fsm_state lchan_fsm_states[] = { .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 @@ static const struct osmo_fsm_state lchan_fsm_states[] = { .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 @@ static const struct osmo_fsm_state lchan_fsm_states[] = { .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 @@ static const struct osmo_fsm_state lchan_fsm_states[] = { .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 @@ static const struct osmo_fsm_state lchan_fsm_states[] = { }, [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)