aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-11-22 19:32:13 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-11-22 19:32:13 +0100
commit2413efa47be122e1e7183f3531c4a6cd636af43f (patch)
tree6f4cf98fb2b6bd94258bc580c2bcf265d5d859d0 /openbsc
parente6fd64d0005fd1853464dc8984886fba1fa7d78b (diff)
mid-call: Make the mid-call behavior the default for switching things off
When switching the RF off we will always go through the grace period, add a direct off mode to switch it off directly. Make the query return a 'g' if we are in the process of switching things over.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/osmo_bsc_rf.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/openbsc/src/osmo_bsc_rf.c b/openbsc/src/osmo_bsc_rf.c
index 0bf0315bd..81797ccf3 100644
--- a/openbsc/src/osmo_bsc_rf.c
+++ b/openbsc/src/osmo_bsc_rf.c
@@ -38,7 +38,8 @@
#define RF_CMD_QUERY '?'
#define RF_CMD_OFF '0'
#define RF_CMD_ON '1'
-#define RF_CMD_GRACE 'g'
+#define RF_CMD_D_OFF 'd'
+#define RF_CMD_ON_G 'g'
static int lock_each_trx(struct gsm_network *net, int lock)
{
@@ -54,25 +55,9 @@ static int lock_each_trx(struct gsm_network *net, int lock)
return 0;
}
-/*
- * Send a '1' when one TRX is online, otherwise send 0
- */
-static void handle_query(struct osmo_bsc_rf_conn *conn)
+static void send_resp(struct osmo_bsc_rf_conn *conn, char send)
{
struct msgb *msg;
- struct gsm_bts *bts;
- char send = RF_CMD_OFF;
-
- llist_for_each_entry(bts, &conn->rf->gsm_network->bts_list, list) {
- struct gsm_bts_trx *trx;
- llist_for_each_entry(trx, &bts->trx_list, list) {
- if (trx->nm_state.availability == NM_AVSTATE_OK &&
- trx->nm_state.operational != NM_STATE_LOCKED) {
- send = RF_CMD_ON;
- break;
- }
- }
- }
msg = msgb_alloc(10, "RF Query");
if (!msg) {
@@ -92,6 +77,35 @@ static void handle_query(struct osmo_bsc_rf_conn *conn)
return;
}
+
+/*
+ * Send a
+ * 'g' when we are in grace mode
+ * '1' when one TRX is online,
+ * '0' otherwise
+ */
+static void handle_query(struct osmo_bsc_rf_conn *conn)
+{
+ struct gsm_bts *bts;
+ char send = RF_CMD_OFF;
+
+ if (conn->rf->policy == S_RF_GRACE)
+ return send_resp(conn, RF_CMD_ON_G);
+
+ llist_for_each_entry(bts, &conn->rf->gsm_network->bts_list, list) {
+ struct gsm_bts_trx *trx;
+ llist_for_each_entry(trx, &bts->trx_list, list) {
+ if (trx->nm_state.availability == NM_AVSTATE_OK &&
+ trx->nm_state.operational != NM_STATE_LOCKED) {
+ send = RF_CMD_ON;
+ break;
+ }
+ }
+ }
+
+ send_resp(conn, send);
+}
+
static void send_signal(struct osmo_bsc_rf *rf, int val)
{
struct rf_signal_data sig;
@@ -151,7 +165,7 @@ static int rf_read_cmd(struct bsc_fd *fd)
case RF_CMD_QUERY:
handle_query(conn);
break;
- case RF_CMD_OFF:
+ case RF_CMD_D_OFF:
bsc_del_timer(&conn->rf->grace_timeout);
switch_rf_off(conn->rf);
break;
@@ -160,7 +174,7 @@ static int rf_read_cmd(struct bsc_fd *fd)
lock_each_trx(conn->rf->gsm_network, 0);
send_signal(conn->rf, S_RF_ON);
break;
- case RF_CMD_GRACE:
+ case RF_CMD_OFF:
enter_grace(conn);
break;
default: