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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/18126 ) Change subject: om2k: Wait for OM TRX links to stabilize before trying to bring up TRX ...................................................................... om2k: Wait for OM TRX links to stabilize before trying to bring up TRX The OM2K link "per-trx" only comes up after MCTR is setup. So that means we need to wait for it before trying to boot the TRX itself. He we simply apply a "dumb" 5 sec timeout as this is the most reliable way I found to get this working reliably. Tracking the link state proved difficult and unreliable: - Multiple TRX can be present with their link coming up in random order. - They can already be up at the start (BTS already initialized from a previous boot) and so the link may actually come up, down, and up again. - All of theses transitions might happens before/after we get to the OM2K_BTS_S_WAIT_TRX state depending on how the LAPD timeout expire, if the BTS config was actually changed or not and how much time it takes to apply the new config. So all in all, what we must do is wait for the link to stabilize ... hence just waiting 5 second. Signed-off-by: Sylvain Munaut <tnt at 246tNt.com> Change-Id: I55a06e08b9c52ff6e97e8c72f2d55770809eba51 --- M src/osmo-bsc/abis_om2000.c 1 file changed, 31 insertions(+), 10 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/src/osmo-bsc/abis_om2000.c b/src/osmo-bsc/abis_om2000.c index ae36ff2..c696557 100644 --- a/src/osmo-bsc/abis_om2000.c +++ b/src/osmo-bsc/abis_om2000.c @@ -76,6 +76,7 @@ #define OM_HEADROOM_SIZE 128 #define OM2K_TIMEOUT 10 +#define TRX_LAPD_TIMEOUT 5 #define TRX_FSM_TIMEOUT 60 #define BTS_FSM_TIMEOUT 60 @@ -2297,6 +2298,7 @@ OM2K_BTS_EVT_CON_DONE, OM2K_BTS_EVT_TF_DONE, OM2K_BTS_EVT_MCTR_DONE, + OM2K_BTS_EVT_TRX_LAPD_UP, OM2K_BTS_EVT_TRX_DONE, OM2K_BTS_EVT_STOP, }; @@ -2308,6 +2310,7 @@ { OM2K_BTS_EVT_CON_DONE, "CON-DONE" }, { OM2K_BTS_EVT_TF_DONE, "TF-DONE" }, { OM2K_BTS_EVT_MCTR_DONE, "MCTR-DONE" }, + { OM2K_BTS_EVT_TRX_LAPD_UP, "TRX-LAPD-UP" }, { OM2K_BTS_EVT_TRX_DONE, "TRX-DONE" }, { OM2K_BTS_EVT_STOP, "STOP" }, { 0, NULL } @@ -2320,6 +2323,7 @@ OM2K_BTS_S_WAIT_CON, OM2K_BTS_S_WAIT_TF, OM2K_BTS_S_WAIT_MCTR, + OM2K_BTS_S_WAIT_TRX_LAPD, OM2K_BTS_S_WAIT_TRX, OM2K_BTS_S_DONE, OM2K_BTS_S_ERROR, @@ -2394,21 +2398,25 @@ om2k_mo_fsm_start(fi, OM2K_BTS_EVT_MCTR_DONE, bts->c0, &bts->rbs2000.mctr.om2k_mo); } else { - struct gsm_bts_trx *trx; - osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_TRX, - BTS_FSM_TIMEOUT, 0); - obfp->next_trx_nr = 0; - trx = gsm_bts_trx_num(obfp->bts, obfp->next_trx_nr++); - om2k_trx_fsm_start(fi, trx, OM2K_BTS_EVT_TRX_DONE); + osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_TRX_LAPD, + TRX_LAPD_TIMEOUT, 0); } } static void om2k_bts_s_wait_mctr(struct osmo_fsm_inst *fi, uint32_t event, void *data) { + OSMO_ASSERT(event == OM2K_BTS_EVT_MCTR_DONE); + + osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_TRX_LAPD, + TRX_LAPD_TIMEOUT, 0); +} + +static void om2k_bts_s_wait_trx_lapd(struct osmo_fsm_inst *fi, uint32_t event, void *data) +{ struct om2k_bts_fsm_priv *obfp = fi->priv; struct gsm_bts_trx *trx; - OSMO_ASSERT(event == OM2K_BTS_EVT_MCTR_DONE); + OSMO_ASSERT(event == OM2K_BTS_EVT_TRX_LAPD_UP); osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_WAIT_TRX, BTS_FSM_TIMEOUT, 0); @@ -2469,17 +2477,23 @@ .in_event_mask = S(OM2K_BTS_EVT_IS_DONE), .out_state_mask = S(OM2K_BTS_S_ERROR) | S(OM2K_BTS_S_WAIT_MCTR) | - S(OM2K_BTS_S_WAIT_TRX), + S(OM2K_BTS_S_WAIT_TRX_LAPD), .name = "WAIT-IS", .action = om2k_bts_s_wait_is, }, [OM2K_BTS_S_WAIT_MCTR] = { .in_event_mask = S(OM2K_BTS_EVT_MCTR_DONE), .out_state_mask = S(OM2K_BTS_S_ERROR) | - S(OM2K_BTS_S_WAIT_TRX), + S(OM2K_BTS_S_WAIT_TRX_LAPD), .name = "WAIT-MCTR", .action = om2k_bts_s_wait_mctr, }, + [OM2K_BTS_S_WAIT_TRX_LAPD] = { + .in_event_mask = S(OM2K_BTS_EVT_TRX_LAPD_UP), + .out_state_mask = S(OM2K_BTS_S_WAIT_TRX), + .name = "WAIT-TRX-LAPD", + .action = om2k_bts_s_wait_trx_lapd, + }, [OM2K_BTS_S_WAIT_TRX] = { .in_event_mask = S(OM2K_BTS_EVT_TRX_DONE), .out_state_mask = S(OM2K_BTS_S_ERROR) | @@ -2498,7 +2512,14 @@ static int om2k_bts_timer_cb(struct osmo_fsm_inst *fi) { - osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_ERROR, 0, 0); + switch (fi->state) { + case OM2K_BTS_S_WAIT_TRX_LAPD: + osmo_fsm_inst_dispatch(fi, OM2K_BTS_EVT_TRX_LAPD_UP, NULL); + break; + default: + osmo_fsm_inst_state_chg(fi, OM2K_BTS_S_ERROR, 0, 0); + break; + } return 0; } -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/18126 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I55a06e08b9c52ff6e97e8c72f2d55770809eba51 Gerrit-Change-Number: 18126 Gerrit-PatchSet: 5 Gerrit-Owner: tnt <tnt at 246tNt.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: tnt <tnt at 246tNt.com> Gerrit-CC: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200508/9b742172/attachment.htm>