summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-08-16 14:29:53 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-08-25 23:19:39 +0200
commit1979e7227f45db9e734a31225fc31e361d2ba16b (patch)
tree16476c7a328470da3ecdeb945265c132bfa36be1
parentff4ded5903fc13ad306dcda26dd9b41f922b3b84 (diff)
bsc: Use the BSC RF CTRL to change the RF state of the TRXs
Use the delayed scheduling feature of the osmo_bsc_rf class to avoid crashing the site controller of the nanoBTS.
-rw-r--r--openbsc/include/openbsc/osmo_bsc_rf.h1
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_ctrl.c12
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_rf.c14
3 files changed, 16 insertions, 11 deletions
diff --git a/openbsc/include/openbsc/osmo_bsc_rf.h b/openbsc/include/openbsc/osmo_bsc_rf.h
index e393596..6aa5ad4 100644
--- a/openbsc/include/openbsc/osmo_bsc_rf.h
+++ b/openbsc/include/openbsc/osmo_bsc_rf.h
@@ -53,5 +53,6 @@ enum osmo_bsc_rf_opstate osmo_bsc_rf_get_opstate_by_bts(struct gsm_bts *bts);
enum osmo_bsc_rf_adminstate osmo_bsc_rf_get_adminstate_by_bts(struct gsm_bts *bts);
enum osmo_bsc_rf_policy osmo_bsc_rf_get_policy_by_bts(struct gsm_bts *bts);
struct osmo_bsc_rf *osmo_bsc_rf_create(const char *path, struct gsm_network *net);
+void osmo_bsc_rf_schedule_lock(struct osmo_bsc_rf *rf, char cmd);
#endif
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
index 6b14e47..30ec782 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
@@ -283,19 +283,19 @@ static int set_net_rf_lock(struct ctrl_cmd *cmd, void *data)
{
int locked = atoi(cmd->value);
struct gsm_network *net = cmd->node;
- struct gsm_bts *bts;
if (!net) {
cmd->reply = "net not found.";
return CTRL_CMD_ERROR;
}
- llist_for_each_entry(bts, &net->bts_list, list) {
- struct gsm_bts_trx *trx;
- llist_for_each_entry(trx, &bts->trx_list, list) {
- gsm_trx_lock_rf(trx, locked);
- }
+ if (!net->bsc_data->rf_ctrl) {
+ cmd->reply = "RF Ctrl not enabled";
+ return CTRL_CMD_ERROR;
}
+ osmo_bsc_rf_schedule_lock(net->bsc_data->rf_ctrl,
+ locked == 1 ? '0' : '1');
+
cmd->reply = talloc_asprintf(cmd, "%u", locked);
if (!cmd->reply) {
cmd->reply = "OOM.";
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_rf.c b/openbsc/src/osmo-bsc/osmo_bsc_rf.c
index 523c7c8..052409a 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_rf.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_rf.c
@@ -1,8 +1,8 @@
/* RF Ctl handling socket */
/* (C) 2010 by Harald Welte <laforge@gnumonks.org>
- * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
- * (C) 2010 by On-Waves
+ * (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2010-2011 by On-Waves
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -262,9 +262,7 @@ static int rf_read_cmd(struct osmo_fd *fd)
case RF_CMD_D_OFF:
case RF_CMD_ON:
case RF_CMD_OFF:
- conn->rf->last_request = buf[0];
- if (!osmo_timer_pending(&conn->rf->delay_cmd))
- osmo_timer_schedule(&conn->rf->delay_cmd, 1, 0);
+ osmo_bsc_rf_schedule_lock(conn->rf, buf[0]);
break;
default:
conn->rf->last_state_command = "Unknown command";
@@ -408,3 +406,9 @@ struct osmo_bsc_rf *osmo_bsc_rf_create(const char *path, struct gsm_network *net
return rf;
}
+void osmo_bsc_rf_schedule_lock(struct osmo_bsc_rf *rf, char cmd)
+{
+ rf->last_request = cmd;
+ if (!osmo_timer_pending(&rf->delay_cmd))
+ osmo_timer_schedule(&rf->delay_cmd, 1, 0);
+}