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>2012-05-02 19:24:30 +0200
commit06264b97edfa698335c567224b83300cd3209832 (patch)
tree270b30c148cd8d60d244211348ff3f0ff082155c
parent126258ddd0b0a755097f417d3cdd53d979cc1be4 (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 d3e2caba4..c0ab6b251 100644
--- a/openbsc/include/openbsc/osmo_bsc_rf.h
+++ b/openbsc/include/openbsc/osmo_bsc_rf.h
@@ -56,5 +56,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 123e538e0..b456be0e2 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
@@ -390,19 +390,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 e637271af..98b25313a 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
@@ -298,9 +298,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";
@@ -444,3 +442,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);
+}