This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
daniel gerrit-no-reply at lists.osmocom.orgdaniel has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/21231 ) Change subject: ns2: Add a function to set the NSVC FSM back to unconfigured ...................................................................... ns2: Add a function to set the NSVC FSM back to unconfigured The function gprs_ns2_vs_force_unconfigured() resets the NSVC state back to the initial value when it was first started. This can be useful for testing. Related: SYS#5002 Change-Id: If96d56b19959372af4eba009661be19e985b4d51 --- M src/gb/gprs_ns2_internal.h M src/gb/gprs_ns2_vc_fsm.c 2 files changed, 40 insertions(+), 17 deletions(-) Approvals: Jenkins Builder: Verified daniel: Looks good to me, approved laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h index dee3ab7..493b391 100644 --- a/src/gb/gprs_ns2_internal.h +++ b/src/gb/gprs_ns2_internal.h @@ -286,6 +286,7 @@ struct osmo_fsm_inst *gprs_ns2_vc_fsm_alloc(struct gprs_ns2_vc *nsvc, const char *id, bool initiate); int gprs_ns2_vc_fsm_start(struct gprs_ns2_vc *nsvc); +int gprs_ns2_vc_force_unconfigured(struct gprs_ns2_vc *nsvc); int gprs_ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp); int gprs_ns2_vc_is_alive(struct gprs_ns2_vc *nsvc); int gprs_ns2_vc_is_unblocked(struct gprs_ns2_vc *nsvc); diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c index 2761210..08b6b2d 100644 --- a/src/gb/gprs_ns2_vc_fsm.c +++ b/src/gb/gprs_ns2_vc_fsm.c @@ -110,20 +110,23 @@ GPRS_NS2_EV_STATUS, GPRS_NS2_EV_UNITDATA, + + GPRS_NS2_EV_FORCE_UNCONFIGURED, }; static const struct value_string gprs_ns2_vc_event_names[] = { - { GPRS_NS2_EV_START, "START" }, - { GPRS_NS2_EV_RESET, "RESET" }, - { GPRS_NS2_EV_RESET_ACK, "RESET_ACK" }, - { GPRS_NS2_EV_UNBLOCK, "UNBLOCK" }, - { GPRS_NS2_EV_UNBLOCK_ACK, "UNBLOCK_ACK" }, - { GPRS_NS2_EV_BLOCK, "BLOCK" }, - { GPRS_NS2_EV_BLOCK_ACK, "BLOCK_ACK" }, - { GPRS_NS2_EV_ALIVE, "ALIVE" }, - { GPRS_NS2_EV_ALIVE_ACK, "ALIVE_ACK" }, - { GPRS_NS2_EV_STATUS, "STATUS" }, - { GPRS_NS2_EV_UNITDATA, "UNITDATA" }, + { GPRS_NS2_EV_START, "START" }, + { GPRS_NS2_EV_RESET, "RESET" }, + { GPRS_NS2_EV_RESET_ACK, "RESET_ACK" }, + { GPRS_NS2_EV_UNBLOCK, "UNBLOCK" }, + { GPRS_NS2_EV_UNBLOCK_ACK, "UNBLOCK_ACK" }, + { GPRS_NS2_EV_BLOCK, "BLOCK" }, + { GPRS_NS2_EV_BLOCK_ACK, "BLOCK_ACK" }, + { GPRS_NS2_EV_ALIVE, "ALIVE" }, + { GPRS_NS2_EV_ALIVE_ACK, "ALIVE_ACK" }, + { GPRS_NS2_EV_STATUS, "STATUS" }, + { GPRS_NS2_EV_UNITDATA, "UNITDATA" }, + {GPRS_NS2_EV_FORCE_UNCONFIGURED, "FORCE_UNCONFIGURED"}, { 0, NULL } }; @@ -379,7 +382,8 @@ [GPRS_NS2_ST_RESET] = { .in_event_mask = S(GPRS_NS2_EV_RESET_ACK) | S(GPRS_NS2_EV_RESET), .out_state_mask = S(GPRS_NS2_ST_RESET) | - S(GPRS_NS2_ST_BLOCKED), + S(GPRS_NS2_ST_BLOCKED) | + S(GPRS_NS2_ST_UNCONFIGURED), .name = "RESET", .action = gprs_ns2_st_reset, .onenter = gprs_ns2_st_reset_onenter, @@ -389,7 +393,8 @@ S(GPRS_NS2_EV_UNBLOCK) | S(GPRS_NS2_EV_UNBLOCK_ACK), .out_state_mask = S(GPRS_NS2_ST_RESET) | S(GPRS_NS2_ST_UNBLOCKED) | - S(GPRS_NS2_ST_BLOCKED), + S(GPRS_NS2_ST_BLOCKED) | + S(GPRS_NS2_ST_UNCONFIGURED), .name = "BLOCKED", .action = gprs_ns2_st_blocked, .onenter = gprs_ns2_st_blocked_onenter, @@ -397,7 +402,8 @@ [GPRS_NS2_ST_UNBLOCKED] = { .in_event_mask = S(GPRS_NS2_EV_BLOCK), .out_state_mask = S(GPRS_NS2_ST_RESET) | S(GPRS_NS2_ST_ALIVE) | - S(GPRS_NS2_ST_BLOCKED), + S(GPRS_NS2_ST_BLOCKED) | + S(GPRS_NS2_ST_UNCONFIGURED), .name = "UNBLOCKED", .action = gprs_ns2_st_unblocked, .onenter = gprs_ns2_st_unblocked_on_enter, @@ -407,7 +413,8 @@ [GPRS_NS2_ST_ALIVE] = { .in_event_mask = S(GPRS_NS2_EV_ALIVE_ACK), .out_state_mask = S(GPRS_NS2_ST_RESET) | - S(GPRS_NS2_ST_UNBLOCKED), + S(GPRS_NS2_ST_UNBLOCKED) | + S(GPRS_NS2_ST_UNCONFIGURED), .name = "ALIVE", .action = gprs_ns2_st_alive, .onenter = gprs_ns2_st_alive_onenter, @@ -558,6 +565,12 @@ msgb_free(msg); break; + case GPRS_NS2_EV_FORCE_UNCONFIGURED: + /* Force the NSVC back to its initial state */ + osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_UNCONFIGURED, 0, 0); + osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_START, NULL); + return; + break; } } @@ -574,9 +587,10 @@ .states = gprs_ns2_vc_states, .num_states = ARRAY_SIZE(gprs_ns2_vc_states), .allstate_event_mask = S(GPRS_NS2_EV_UNITDATA) | - S(GPRS_NS2_EV_RESET) | + S(GPRS_NS2_EV_RESET) | S(GPRS_NS2_EV_ALIVE) | - S(GPRS_NS2_EV_ALIVE_ACK), + S(GPRS_NS2_EV_ALIVE_ACK) | + S(GPRS_NS2_EV_FORCE_UNCONFIGURED), .allstate_action = gprs_ns2_vc_fsm_allstate_action, .cleanup = gprs_ns2_vc_fsm_clean, .timer_cb = gprs_ns2_vc_fsm_timer_cb, @@ -626,6 +640,14 @@ return 0; } +/*! Reset a NS-VC FSM. + * \param nsvc the virtual circuit + * \return 0 on success; negative on error */ +int gprs_ns2_vc_force_unconfigured(struct gprs_ns2_vc *nsvc) +{ + return osmo_fsm_inst_dispatch(nsvc->fi, GPRS_NS2_EV_FORCE_UNCONFIGURED, NULL); +} + /*! entry point for messages from the driver/VL * \param nsvc virtual circuit on which the message was received * \param msg message that was received -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/21231 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: If96d56b19959372af4eba009661be19e985b4d51 Gerrit-Change-Number: 21231 Gerrit-PatchSet: 4 Gerrit-Owner: daniel <dwillmann at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201120/b68d9a09/attachment.htm>