aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-02-24 14:40:11 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-02-24 14:40:11 +0100
commit00c805f213e594f18f72f70c8f6975f8aeff3612 (patch)
treecf379e5121a7e0b99ab5ee48d33c0d694e005019 /openbsc
parent37ac4202547d41aa23f2bca5bb4ecfc67c806da0 (diff)
rf: Verify that the requested mode is entered and drop OML in error
Verify that the BTS is following our orders, if we think there was an error we will drop the OML connection.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/osmo_bsc_rf.h3
-rw-r--r--openbsc/src/bsc/osmo_bsc_rf.c31
2 files changed, 34 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/osmo_bsc_rf.h b/openbsc/include/openbsc/osmo_bsc_rf.h
index 63115fe9..2211a334 100644
--- a/openbsc/include/openbsc/osmo_bsc_rf.h
+++ b/openbsc/include/openbsc/osmo_bsc_rf.h
@@ -14,6 +14,9 @@ struct osmo_bsc_rf {
const char *last_state_command;
+ /* verify that RF is up as it should be */
+ struct timer_list rf_check;
+
/* some handling for the automatic grace switch */
struct timer_list grace_timeout;
};
diff --git a/openbsc/src/bsc/osmo_bsc_rf.c b/openbsc/src/bsc/osmo_bsc_rf.c
index 6d2a1743..627915af 100644
--- a/openbsc/src/bsc/osmo_bsc_rf.c
+++ b/openbsc/src/bsc/osmo_bsc_rf.c
@@ -106,6 +106,30 @@ static void handle_query(struct osmo_bsc_rf_conn *conn)
send_resp(conn, send);
}
+static void rf_check_cb(void *_data)
+{
+ struct gsm_bts *bts;
+ struct osmo_bsc_rf *rf = _data;
+
+ llist_for_each_entry(bts, &rf->gsm_network->bts_list, list) {
+ struct gsm_bts_trx *trx;
+
+ /* don't bother to check a booting or missing BTS */
+ if (!bts->oml_link || !is_ipaccess_bts(bts))
+ continue;
+
+ llist_for_each_entry(trx, &bts->trx_list, list) {
+ if (trx->nm_state.availability != NM_AVSTATE_OK ||
+ trx->nm_state.operational != NM_OPSTATE_ENABLED ||
+ trx->nm_state.administrative != NM_STATE_UNLOCKED) {
+ LOGP(DNM, LOGL_ERROR, "RF activation failed. Starting again.\n");
+ ipaccess_drop_oml(bts);
+ break;
+ }
+ }
+ }
+}
+
static void send_signal(struct osmo_bsc_rf *rf, int val)
{
struct rf_signal_data sig;
@@ -167,6 +191,7 @@ static int rf_read_cmd(struct bsc_fd *fd)
break;
case RF_CMD_D_OFF:
conn->rf->last_state_command = "RF Direct Off";
+ bsc_del_timer(&conn->rf->rf_check);
bsc_del_timer(&conn->rf->grace_timeout);
switch_rf_off(conn->rf);
break;
@@ -175,9 +200,11 @@ static int rf_read_cmd(struct bsc_fd *fd)
bsc_del_timer(&conn->rf->grace_timeout);
lock_each_trx(conn->rf->gsm_network, 0);
send_signal(conn->rf, S_RF_ON);
+ bsc_schedule_timer(&conn->rf->rf_check, 3, 0);
break;
case RF_CMD_OFF:
conn->rf->last_state_command = "RF Scheduled Off";
+ bsc_del_timer(&conn->rf->rf_check);
enter_grace(conn);
break;
default:
@@ -311,6 +338,10 @@ struct osmo_bsc_rf *osmo_bsc_rf_create(const char *path, struct gsm_network *net
rf->policy = S_RF_ON;
rf->last_state_command = "";
+ /* check the rf state */
+ rf->rf_check.data = rf;
+ rf->rf_check.cb = rf_check_cb;
+
return rf;
}