osmo-pcu[master]: Make osmo-pcu wait for BTS to become available at start-up t...
Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/6453/1/src/osmobts_sock.cpp File src/osmobts_sock.cpp: Line 288: osmo_timer_schedule(&state->timer, 5, 0); > Do we actually need to wait 5 seconds now that we can reeschedule it in cas Sure, we can change the timeout period. Which other value would you suggest we use? 1 second? 500ms? -- To view, visit https://gerrit.osmocom.org/6453 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic42a5601a43b81d260721fef5d9fa52447f9d309 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Stefan Sperling Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: Stefan Sperling Gerrit-HasComments: Yes
osmo-pcu[master]: Make osmo-pcu wait for BTS to become available at start-up t...
Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/6453/1/src/osmobts_sock.cpp File src/osmobts_sock.cpp: Line 288: osmo_timer_schedule(&state->timer, 5, 0); Do we actually need to wait 5 seconds now that we can reeschedule it in case it fails? we could this way speedup. -- To view, visit https://gerrit.osmocom.org/6453 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic42a5601a43b81d260721fef5d9fa52447f9d309 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Stefan Sperling Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pau Espin Pedrol Gerrit-HasComments: Yes
[MERGED] osmo-pcu[master]: Make osmo-pcu wait for BTS to become available at start-up t...
Harald Welte has submitted this change and it was merged. Change subject: Make osmo-pcu wait for BTS to become available at start-up time. .. Make osmo-pcu wait for BTS to become available at start-up time. After the PCU socket becomes available, the BTS might send an INFO_IND message with the 'ACTIVE' flag cleared. If this happens, do not exit immediately, but keep retrying until an INFO_IND message with the 'ACTIVE' flag arrives. Note that this change only affects behaviour at process start-up time. If the BTS switches from active to inactive state then osmo-pcu will still exit. If this behaviour should be changed as well it could be done in a follow-up patch. Tested against osom-bsc + osmo-bts-virtual. Change-Id: Ic42a5601a43b81d260721fef5d9fa52447f9d309 Related: OS#2689 --- M src/bts.h M src/osmobts_sock.cpp M src/pcu_l1_if.cpp 3 files changed, 27 insertions(+), 7 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/bts.h b/src/bts.h index 5679b98..f9f385b 100644 --- a/src/bts.h +++ b/src/bts.h @@ -173,6 +173,7 @@ * we can start to compile pcu_vty.c with c++ and remove the split. */ struct gprs_rlcmac_bts { + bool active; uint8_t bsic; uint8_t fc_interval; uint16_t fc_bucket_time; diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp index 577d41e..9e4000a 100644 --- a/src/osmobts_sock.cpp +++ b/src/osmobts_sock.cpp @@ -55,7 +55,23 @@ struct llist_head upqueue; /* queue for sending messages */ } *pcu_sock_state = NULL; -static void pcu_sock_timeout(void *_priv); +static void pcu_sock_timeout(void *_priv) +{ + pcu_l1if_open(); +} + +static void pcu_tx_txt_retry(void *_priv) +{ + struct gprs_rlcmac_bts *bts = bts_main_data(); + struct pcu_sock_state *state = pcu_sock_state; + + if (bts->active) + return; + + LOGP(DL1IF, LOGL_INFO, "Sending version %s to BTS.\n", PACKAGE_VERSION); + pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION); + osmo_timer_schedule(&state->timer, 5, 0); +} int pcu_sock_send(struct msgb *msg) { @@ -268,7 +284,7 @@ pcu_sock_state = state; close(bfd->fd); bfd->fd = -1; - state->timer.cb = pcu_sock_timeout; + osmo_timer_setup(&state->timer, pcu_sock_timeout, NULL); osmo_timer_schedule(&state->timer, 5, 0); return 0; } @@ -293,6 +309,10 @@ LOGP(DL1IF, LOGL_INFO, "Sending version %s to BTS.\n", PACKAGE_VERSION); pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION); + /* Schedule a timer so we keep trying until the BTS becomes active. */ + osmo_timer_setup(&state->timer, pcu_tx_txt_retry, NULL); + osmo_timer_schedule(&state->timer, 5, 0); + return 0; } @@ -311,9 +331,4 @@ pcu_sock_close(state, 0); talloc_free(state); pcu_sock_state = NULL; -} - -static void pcu_sock_timeout(void *_priv) -{ - pcu_l1if_open(); } diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index 7112b04..0a9803b 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -414,7 +414,10 @@ if (!(info_ind->flags & PCU_IF_FLAG_ACTIVE)) { LOGP(DL1IF, LOGL_NOTICE, "BTS not available\n"); + if (!bts->active) + return -EAGAIN; bssgp_failed: + bts->active = false; /* free all TBF */ for (trx = 0; trx < ARRAY_SIZE(bts->trx); trx++) { bts->trx[trx].arfcn = info_ind->trx[trx].arfcn; @@ -562,6 +565,7 @@ } } + bts->active = true; return rc; } -- To view, visit https://gerrit.osmocom.org/6453 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic42a5601a43b81d260721fef5d9fa52447f9d309 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Stefan Sperling Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder
osmo-pcu[master]: Make osmo-pcu wait for BTS to become available at start-up t...
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/6453 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic42a5601a43b81d260721fef5d9fa52447f9d309 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Stefan Sperling Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[PATCH] osmo-pcu[master]: Make osmo-pcu wait for BTS to become available at start-up t...
Review at https://gerrit.osmocom.org/6453 Make osmo-pcu wait for BTS to become available at start-up time. After the PCU socket becomes available, the BTS might send an INFO_IND message with the 'ACTIVE' flag cleared. If this happens, do not exit immediately, but keep retrying until an INFO_IND message with the 'ACTIVE' flag arrives. Note that this change only affects behaviour at process start-up time. If the BTS switches from active to inactive state then osmo-pcu will still exit. If this behaviour should be changed as well it could be done in a follow-up patch. Tested against osom-bsc + osmo-bts-virtual. Change-Id: Ic42a5601a43b81d260721fef5d9fa52447f9d309 Related: OS#2689 --- M src/bts.h M src/osmobts_sock.cpp M src/pcu_l1_if.cpp 3 files changed, 27 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/53/6453/1 diff --git a/src/bts.h b/src/bts.h index 5679b98..f9f385b 100644 --- a/src/bts.h +++ b/src/bts.h @@ -173,6 +173,7 @@ * we can start to compile pcu_vty.c with c++ and remove the split. */ struct gprs_rlcmac_bts { + bool active; uint8_t bsic; uint8_t fc_interval; uint16_t fc_bucket_time; diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp index 577d41e..9e4000a 100644 --- a/src/osmobts_sock.cpp +++ b/src/osmobts_sock.cpp @@ -55,7 +55,23 @@ struct llist_head upqueue; /* queue for sending messages */ } *pcu_sock_state = NULL; -static void pcu_sock_timeout(void *_priv); +static void pcu_sock_timeout(void *_priv) +{ + pcu_l1if_open(); +} + +static void pcu_tx_txt_retry(void *_priv) +{ + struct gprs_rlcmac_bts *bts = bts_main_data(); + struct pcu_sock_state *state = pcu_sock_state; + + if (bts->active) + return; + + LOGP(DL1IF, LOGL_INFO, "Sending version %s to BTS.\n", PACKAGE_VERSION); + pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION); + osmo_timer_schedule(&state->timer, 5, 0); +} int pcu_sock_send(struct msgb *msg) { @@ -268,7 +284,7 @@ pcu_sock_state = state; close(bfd->fd); bfd->fd = -1; - state->timer.cb = pcu_sock_timeout; + osmo_timer_setup(&state->timer, pcu_sock_timeout, NULL); osmo_timer_schedule(&state->timer, 5, 0); return 0; } @@ -293,6 +309,10 @@ LOGP(DL1IF, LOGL_INFO, "Sending version %s to BTS.\n", PACKAGE_VERSION); pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION); + /* Schedule a timer so we keep trying until the BTS becomes active. */ + osmo_timer_setup(&state->timer, pcu_tx_txt_retry, NULL); + osmo_timer_schedule(&state->timer, 5, 0); + return 0; } @@ -311,9 +331,4 @@ pcu_sock_close(state, 0); talloc_free(state); pcu_sock_state = NULL; -} - -static void pcu_sock_timeout(void *_priv) -{ - pcu_l1if_open(); } diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index 7112b04..0a9803b 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -414,7 +414,10 @@ if (!(info_ind->flags & PCU_IF_FLAG_ACTIVE)) { LOGP(DL1IF, LOGL_NOTICE, "BTS not available\n"); + if (!bts->active) + return -EAGAIN; bssgp_failed: + bts->active = false; /* free all TBF */ for (trx = 0; trx < ARRAY_SIZE(bts->trx); trx++) { bts->trx[trx].arfcn = info_ind->trx[trx].arfcn; @@ -562,6 +565,7 @@ } } + bts->active = true; return rc; } -- To view, visit https://gerrit.osmocom.org/6453 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic42a5601a43b81d260721fef5d9fa52447f9d309 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Stefan Sperling