diff options
-rw-r--r-- | openbsc/include/openbsc/pcu_if.h | 3 | ||||
-rw-r--r-- | openbsc/src/libbsc/abis_rsl.c | 6 | ||||
-rw-r--r-- | openbsc/src/libbsc/pcu_sock.c | 30 |
3 files changed, 19 insertions, 20 deletions
diff --git a/openbsc/include/openbsc/pcu_if.h b/openbsc/include/openbsc/pcu_if.h index 604d00636..717e077f7 100644 --- a/openbsc/include/openbsc/pcu_if.h +++ b/openbsc/include/openbsc/pcu_if.h @@ -44,7 +44,4 @@ int pcu_sock_init(const char *path, struct gsm_bts *bts); /* Close connection to PCU */ void pcu_sock_exit(struct gsm_bts *bts); -/* Check if BTS has a PCU connection */ -bool pcu_connected(struct gsm_bts *bts); - #endif /* _PCU_IF_H */ diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index ee8745d35..a7372a114 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -1740,12 +1740,6 @@ static int rsl_rx_pchan_rqd(struct msgb *msg, struct gsm_bts *bts) uint8_t rqd_ta; uint8_t is_11bit; - /* Bail if no PCU is connected */ - if (!pcu_connected(bts)) { - LOGP(DRSL, LOGL_ERROR, "BTS %d PCU not availabe!\n",bts->nr); - return -EINVAL; - } - /* Process rach request and forward contained information to PCU */ if (ra == 0x7F) { is_11bit = 1; diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c index ccc0e9a01..8703d9e9e 100644 --- a/openbsc/src/libbsc/pcu_sock.c +++ b/openbsc/src/libbsc/pcu_sock.c @@ -68,6 +68,18 @@ static struct gsm_bts_trx *trx_by_nr(struct gsm_bts *bts, uint8_t trx_nr) return NULL; } +/* Check if BTS has a PCU connection */ +static bool pcu_connected(struct gsm_bts *bts) +{ + struct pcu_sock_state *state = bts->pcu_state; + + if (!state) + return false; + if (state->conn_bfd.fd <= 0) + return false; + return true; +} + /* * PCU messages */ @@ -318,6 +330,13 @@ int pcu_tx_rach_ind(struct gsm_bts *bts, int16_t qta, uint16_t ra, uint32_t fn, struct gsm_pcu_if *pcu_prim; struct gsm_pcu_if_rach_ind *rach_ind; + /* Bail if no PCU is connected */ + if (!pcu_connected(bts)) { + LOGP(DRSL, LOGL_ERROR, "BTS %d CHAN RQD(GPRS) but PCU not " + "connected!\n", bts->nr); + return -ENODEV; + } + LOGP(DPCU, LOGL_INFO, "Sending RACH indication: qta=%d, ra=%d, " "fn=%d\n", qta, ra, fn); @@ -829,14 +848,3 @@ void pcu_sock_exit(struct gsm_bts *bts) bts->pcu_state = NULL; } -/* Check if BTS has a PCU connection */ -bool pcu_connected(struct gsm_bts *bts) -{ - struct pcu_sock_state *state = bts->pcu_state; - - if (!state) - return false; - if (state->conn_bfd.fd <= 0) - return false; - return true; -} |