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
This commit is contained in:
parent
c907b88ecd
commit
5b22fb7953
|
@ -173,6 +173,7 @@ void bts_update_tbf_ta(const char *p, uint32_t fn, uint8_t trx_no, uint8_t ts, i
|
|||
* 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;
|
||||
|
|
|
@ -55,7 +55,23 @@ struct pcu_sock_state {
|
|||
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 @@ int pcu_l1if_open(void)
|
|||
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 @@ int pcu_l1if_open(void)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -312,8 +332,3 @@ void pcu_l1if_close(void)
|
|||
talloc_free(state);
|
||||
pcu_sock_state = NULL;
|
||||
}
|
||||
|
||||
static void pcu_sock_timeout(void *_priv)
|
||||
{
|
||||
pcu_l1if_open();
|
||||
}
|
||||
|
|
|
@ -414,7 +414,10 @@ static int pcu_rx_info_ind(struct gsm_pcu_if_info_ind *info_ind)
|
|||
|
||||
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 @@ bssgp_failed:
|
|||
}
|
||||
}
|
||||
|
||||
bts->active = true;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue