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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/25453 ) Change subject: abis.c: Rearrange code to follow logic state order ...................................................................... abis.c: Rearrange code to follow logic state order CONNECTING state comes first in logical order of states (as properly seen in enum of states), however, the FSM struct definition and state action functions are swapped. Let's put them in order. Change-Id: I0cae561926b460dc5882390db969b7c925903e5d --- M src/common/abis.c 1 file changed, 55 insertions(+), 55 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/53/25453/1 diff --git a/src/common/abis.c b/src/common/abis.c index 7503798..db0a648 100644 --- a/src/common/abis.c +++ b/src/common/abis.c @@ -81,53 +81,6 @@ int line_ctr; }; -static void abis_link_connected(struct osmo_fsm_inst *fi, uint32_t event, void *data) -{ - struct abis_link_fsm_priv *priv = fi->priv; - struct gsm_bts *bts = priv->bts; - struct gsm_bts_trx *trx; - bool oml_rsl_was_connected = false; - - OSMO_ASSERT(event == ABIS_LINK_EV_SIGN_LINK_DOWN); - - /* First remove the OML signalling link */ - if (bts->oml_link) { - struct timespec now; - - e1inp_sign_link_destroy(bts->oml_link); - - /* Log a special notice if the OML connection was dropped relatively quickly. */ - if (bts->oml_conn_established_timestamp.tv_sec != 0 && clock_gettime(CLOCK_MONOTONIC, &now) == 0 && - bts->oml_conn_established_timestamp.tv_sec + OSMO_BTS_OML_CONN_EARLY_DISCONNECT >= now.tv_sec) { - LOGP(DABIS, LOGL_FATAL, "OML link was closed early within %" PRIu64 " seconds. " - "If this situation persists, please check your BTS and BSC configuration files for errors. " - "A common error is a mismatch between unit_id configuration parameters of BTS and BSC.\n", - (uint64_t) (now.tv_sec - bts->oml_conn_established_timestamp.tv_sec)); - } - bts->oml_link = NULL; - oml_rsl_was_connected = true; - } - memset(&bts->oml_conn_established_timestamp, 0, sizeof(bts->oml_conn_established_timestamp)); - - /* Then iterate over the RSL signalling links */ - llist_for_each_entry(trx, &bts->trx_list, list) { - if (trx->rsl_link) { - e1inp_sign_link_destroy(trx->rsl_link); - trx->rsl_link = NULL; - oml_rsl_was_connected = true; - } - } - - /* Note: if there was an OML or RSL connection present (the BTS was connected to a BSC). Then we will not try - * to connect to an alternate BSC. Instead we will shut down the BTS process. This will ensure that all states - * in the BTS (hardware and software) are reset properly. It is then up to the process management of the host - * to restart osmo-bts. */ - if (oml_rsl_was_connected) - osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_FAILED, 0, 0); - else - osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_CONNECTING, 0, 0); -} - static void abis_link_connecting_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) { struct e1inp_line *line; @@ -186,6 +139,53 @@ osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_CONNECTED, 0, 0); } +static void abis_link_connected(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ + struct abis_link_fsm_priv *priv = fi->priv; + struct gsm_bts *bts = priv->bts; + struct gsm_bts_trx *trx; + bool oml_rsl_was_connected = false; + + OSMO_ASSERT(event == ABIS_LINK_EV_SIGN_LINK_DOWN); + + /* First remove the OML signalling link */ + if (bts->oml_link) { + struct timespec now; + + e1inp_sign_link_destroy(bts->oml_link); + + /* Log a special notice if the OML connection was dropped relatively quickly. */ + if (bts->oml_conn_established_timestamp.tv_sec != 0 && clock_gettime(CLOCK_MONOTONIC, &now) == 0 && + bts->oml_conn_established_timestamp.tv_sec + OSMO_BTS_OML_CONN_EARLY_DISCONNECT >= now.tv_sec) { + LOGP(DABIS, LOGL_FATAL, "OML link was closed early within %" PRIu64 " seconds. " + "If this situation persists, please check your BTS and BSC configuration files for errors. " + "A common error is a mismatch between unit_id configuration parameters of BTS and BSC.\n", + (uint64_t) (now.tv_sec - bts->oml_conn_established_timestamp.tv_sec)); + } + bts->oml_link = NULL; + oml_rsl_was_connected = true; + } + memset(&bts->oml_conn_established_timestamp, 0, sizeof(bts->oml_conn_established_timestamp)); + + /* Then iterate over the RSL signalling links */ + llist_for_each_entry(trx, &bts->trx_list, list) { + if (trx->rsl_link) { + e1inp_sign_link_destroy(trx->rsl_link); + trx->rsl_link = NULL; + oml_rsl_was_connected = true; + } + } + + /* Note: if there was an OML or RSL connection present (the BTS was connected to a BSC). Then we will not try + * to connect to an alternate BSC. Instead we will shut down the BTS process. This will ensure that all states + * in the BTS (hardware and software) are reset properly. It is then up to the process management of the host + * to restart osmo-bts. */ + if (oml_rsl_was_connected) + osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_FAILED, 0, 0); + else + osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_CONNECTING, 0, 0); +} + static void abis_link_failed_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) { struct abis_link_fsm_priv *priv = fi->priv; @@ -215,6 +215,14 @@ } static struct osmo_fsm_state abis_link_fsm_states[] = { + [ABIS_LINK_ST_CONNECTING] = { + .name = "CONNECTING", + .out_state_mask = + S(ABIS_LINK_ST_CONNECTING) | + S(ABIS_LINK_ST_CONNECTED) | + S(ABIS_LINK_ST_FAILED), + .onenter = abis_link_connecting_onenter, + }, [ABIS_LINK_ST_CONNECTED] = { .name = "CONNECTED", .in_event_mask = @@ -224,14 +232,6 @@ S(ABIS_LINK_ST_FAILED), .action = abis_link_connected, }, - [ABIS_LINK_ST_CONNECTING] = { - .name = "CONNECTING", - .out_state_mask = - S(ABIS_LINK_ST_CONNECTING) | - S(ABIS_LINK_ST_CONNECTED) | - S(ABIS_LINK_ST_FAILED), - .onenter = abis_link_connecting_onenter, - }, [ABIS_LINK_ST_FAILED] = { .name = "FAILED", .onenter = abis_link_failed_onenter, -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/25453 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I0cae561926b460dc5882390db969b7c925903e5d Gerrit-Change-Number: 25453 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210914/727ee584/attachment.htm>