From 173dd627cd3e2c0ea3e3a4ac6040115381c05ee5 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 7 Nov 2019 18:21:48 +0100 Subject: xua: ipa_asp_fsm: Allow moving ASP to inactive state If AS is configured with Traffic Mode Override, then if a new ASP becomes active, all previous ASPs are considered to be inactive and new data is sent to the newly activated ASP. Remark: It's still unclear which methodology/implementation will follow when the last activated ASP becomes inactive/shutdown. Then probably another one should be activated at that time, but that logic is not there implemented as far as I know. Change-Id: I4ff246b2f899aaa3cf63bbdb3f3d317dc89b3d15 --- src/xua_asp_fsm.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c index 3f3d69a..0a84f28 100644 --- a/src/xua_asp_fsm.c +++ b/src/xua_asp_fsm.c @@ -749,6 +749,7 @@ struct osmo_fsm_inst *xua_asp_fsm_start(struct osmo_ss7_asp *asp, enum ipa_asp_state { IPA_ASP_S_DOWN = XUA_ASP_S_DOWN, + IPA_ASP_S_INACTIVE = XUA_ASP_S_INACTIVE, IPA_ASP_S_ACTIVE = XUA_ASP_S_ACTIVE, IPA_ASP_S_WAIT_ID_RESP, /* Waiting for ID_RESP from peer */ IPA_ASP_S_WAIT_ID_GET, /* Waiting for ID_GET from peer */ @@ -977,6 +978,16 @@ static void ipa_asp_fsm_active(struct osmo_fsm_inst *fi, uint32_t event, void *d } } +static void ipa_asp_fsm_inactive(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + switch (event) { + case XUA_ASP_E_M_ASP_DOWN_REQ: + ipa_asp_fsm_del_route(fi->priv); + osmo_fsm_inst_state_chg(fi, IPA_ASP_S_DOWN, 0, 0); + break; + } +} + static void ipa_asp_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct ipa_asp_fsm_priv *iafp = fi->priv; @@ -1010,6 +1021,11 @@ static void ipa_asp_fsm_active_onenter(struct osmo_fsm_inst *fi, uint32_t prev_s dispatch_to_all_as(fi, XUA_ASPAS_ASP_ACTIVE_IND); } +static void ipa_asp_fsm_inactive_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + dispatch_to_all_as(fi, XUA_ASPAS_ASP_INACTIVE_IND); +} + static void ipa_pong_timer_cb(void *_fi) { struct osmo_fsm_inst *fi = _fi; @@ -1074,11 +1090,20 @@ static const struct osmo_fsm_state ipa_asp_states[] = { [IPA_ASP_S_ACTIVE] = { .in_event_mask = S(XUA_ASP_E_M_ASP_DOWN_REQ) | S(XUA_ASP_E_M_ASP_INACTIVE_REQ), - .out_state_mask = S(IPA_ASP_S_DOWN), + .out_state_mask = S(IPA_ASP_S_DOWN) | + S(IPA_ASP_S_INACTIVE), .name = "ASP_ACTIVE", .action = ipa_asp_fsm_active, .onenter = ipa_asp_fsm_active_onenter, }, + [IPA_ASP_S_INACTIVE] = { + .in_event_mask = S(XUA_ASP_E_M_ASP_DOWN_REQ), + .out_state_mask = S(IPA_ASP_S_DOWN) | + S(IPA_ASP_S_ACTIVE), + .name = "ASP_INACTIVE", + .action = ipa_asp_fsm_inactive, + .onenter = ipa_asp_fsm_inactive_onenter, + }, }; static void ipa_asp_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause) -- cgit v1.2.3