aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-02-14 23:27:18 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-02-14 23:27:18 +0100
commit3f9b6a6539d487140f6d7e49e8cf9dc06bf040c6 (patch)
tree4f3c6437814b18b02c9e9b83c8f7ab3fe243acd2
parentb5bb75fbfd3bc41675f82e5d4a6daf2312820111 (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.
-rw-r--r--openbsc/include/openbsc/osmo_bsc_rf.h3
-rw-r--r--openbsc/src/osmo_bsc_rf.c32
2 files changed, 35 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/osmo_bsc_rf.h b/openbsc/include/openbsc/osmo_bsc_rf.h
index e34abaec3..4c8c65e36 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/osmo_bsc_rf.c b/openbsc/src/osmo_bsc_rf.c
index e6b31c71f..b748cc9e7 100644
--- a/openbsc/src/osmo_bsc_rf.c
+++ b/openbsc/src/osmo_bsc_rf.c
@@ -25,6 +25,7 @@
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
#include <openbsc/signal.h>
+#include <openbsc/ipaccess.h>
#include <osmocore/talloc.h>
#include <osmocore/protocol/gsm_12_21.h>
@@ -106,6 +107,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 +192,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 +201,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 +339,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;
}