summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-04-01 15:34:35 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-04-01 15:34:35 +0200
commit878da382e08444c36299f1c4236c233c6acc11b3 (patch)
treea41681dbaa4f11816c8d2392bc057a44886bca4a
parent5047390eefae72d50cfc4cf821a70eba9d55d255 (diff)
WIP bts: Enable GPRS using OML if it wasn't enabledzecke/hacks/gprs-state
-rw-r--r--openbsc/include/openbsc/gsm_data.h6
-rw-r--r--openbsc/src/libbsc/bsc_ctrl_commands.c18
-rw-r--r--openbsc/src/libbsc/bts_ipaccess_nanobts.c79
3 files changed, 74 insertions, 29 deletions
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index bf1ac7c3a..2114f64b0 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -445,4 +445,10 @@ void bts_depend_clear(struct gsm_bts *bts, int dep);
int bts_depend_check(struct gsm_bts *bts);
int bts_depend_is_depedency(struct gsm_bts *base, struct gsm_bts *other);
+/* nanobts ... */
+void bts_model_nanobts_start_nsvc(struct gsm_bts *bts);
+void bts_model_nanobts_start_nsvc(struct gsm_bts *bts);
+void bts_model_nanobts_start_cell(struct gsm_bts *bts);
+void bts_model_nanobts_start_nse(struct gsm_bts *bts);
+
#endif /* _GSM_DATA_H */
diff --git a/openbsc/src/libbsc/bsc_ctrl_commands.c b/openbsc/src/libbsc/bsc_ctrl_commands.c
index 368d0e7c6..e487fe8bf 100644
--- a/openbsc/src/libbsc/bsc_ctrl_commands.c
+++ b/openbsc/src/libbsc/bsc_ctrl_commands.c
@@ -327,11 +327,29 @@ static int get_bts_gprs_mode(struct ctrl_cmd *cmd, void *data)
return CTRL_CMD_REPLY;
}
+static void oml_activate(struct gsm_bts *bts)
+{
+ if (!is_ipaccess_bts(bts)) {
+ LOGP(DCTRL, LOGL_ERROR, "GPRS activation only possible with IP.\n");
+ return;
+ }
+
+ if (bts->gprs.nse.mo.nm_state.operational != NM_OPSTATE_ENABLED) {
+ bts_model_nanobts_start_nse(bts);
+ bts_model_nanobts_start_cell(bts);
+ bts_model_nanobts_start_nsvc(bts);
+ }
+}
+
static int set_bts_gprs_mode(struct ctrl_cmd *cmd, void *data)
{
struct gsm_bts *bts = cmd->node;
+ enum bts_gprs_mode old_mode = bts->gprs.mode;
bts->gprs.mode = bts_gprs_mode_parse(cmd->value, NULL);
+ if (old_mode == BTS_GPRS_NONE && bts->gprs.mode != old_mode)
+ oml_activate(bts);
+
return get_bts_gprs_mode(cmd, data);
}
diff --git a/openbsc/src/libbsc/bts_ipaccess_nanobts.c b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
index 9e1b3c2cb..76b346d9b 100644
--- a/openbsc/src/libbsc/bts_ipaccess_nanobts.c
+++ b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
@@ -377,29 +377,15 @@ static int nm_statechg_event(int evt, struct nm_statechg_signal_data *nsd)
bts = container_of(obj, struct gsm_bts, gprs.nse);
if (bts->gprs.mode == BTS_GPRS_NONE)
break;
- if (new_state->availability == NM_AVSTATE_DEPENDENCY) {
- data = nanobts_attr_nse_get(bts, &data_len);
- abis_nm_ipaccess_set_attr(bts, obj_class, bts->bts_nr,
- 0xff, 0xff, data, data_len);
- abis_nm_opstart(bts, obj_class, bts->bts_nr,
- 0xff, 0xff);
- }
+ if (new_state->availability == NM_AVSTATE_DEPENDENCY)
+ bts_model_nanobts_start_nse(bts);
break;
case NM_OC_GPRS_CELL:
bts = container_of(obj, struct gsm_bts, gprs.cell);
if (bts->gprs.mode == BTS_GPRS_NONE)
break;
- if (new_state->availability == NM_AVSTATE_DEPENDENCY) {
- data = nanobts_attr_cell_get(bts, &data_len);
- abis_nm_ipaccess_set_attr(bts, obj_class, bts->bts_nr,
- 0, 0xff, data, data_len);
- abis_nm_opstart(bts, obj_class, bts->bts_nr,
- 0, 0xff);
- abis_nm_chg_adm_state(bts, obj_class, bts->bts_nr,
- 0, 0xff, NM_STATE_UNLOCKED);
- abis_nm_chg_adm_state(bts, NM_OC_GPRS_NSE, bts->bts_nr,
- 0xff, 0xff, NM_STATE_UNLOCKED);
- }
+ if (new_state->availability == NM_AVSTATE_DEPENDENCY)
+ bts_model_nanobts_start_cell(bts);
break;
case NM_OC_GPRS_NSVC:
nsvc = obj;
@@ -410,17 +396,8 @@ static int nm_statechg_event(int evt, struct nm_statechg_signal_data *nsd)
if (nsvc->id == 1)
break;
if ((new_state->availability == NM_AVSTATE_OFF_LINE) ||
- (new_state->availability == NM_AVSTATE_DEPENDENCY)) {
- data = nanobts_attr_nscv_get(bts, &data_len);
- abis_nm_ipaccess_set_attr(bts, obj_class, bts->bts_nr,
- nsvc->id, 0xff,
- data, data_len);
- abis_nm_opstart(bts, obj_class, bts->bts_nr,
- nsvc->id, 0xff);
- abis_nm_chg_adm_state(bts, obj_class, bts->bts_nr,
- nsvc->id, 0xff,
- NM_STATE_UNLOCKED);
- }
+ (new_state->availability == NM_AVSTATE_DEPENDENCY))
+ bts_model_nanobts_start_nsvc(bts);
default:
break;
}
@@ -713,3 +690,47 @@ static void bts_model_nanobts_e1line_bind_ops(struct e1inp_line *line)
{
e1inp_line_bind_ops(line, &ipaccess_e1inp_line_ops);
}
+
+void bts_model_nanobts_start_nse(struct gsm_bts *bts)
+{
+ uint8_t *data;
+ size_t data_len;
+
+ data = nanobts_attr_nse_get(bts, &data_len);
+ abis_nm_ipaccess_set_attr(bts, NM_OC_GPRS_NSE, bts->bts_nr,
+ 0xff, 0xff, data, data_len);
+ abis_nm_opstart(bts, NM_OC_GPRS_NSE, bts->bts_nr,
+ 0xff, 0xff);
+}
+
+void bts_model_nanobts_start_cell(struct gsm_bts *bts)
+{
+ uint8_t *data;
+ size_t data_len;
+
+ data = nanobts_attr_cell_get(bts, &data_len);
+ abis_nm_ipaccess_set_attr(bts, NM_OC_GPRS_CELL, bts->bts_nr,
+ 0, 0xff, data, data_len);
+ abis_nm_opstart(bts, NM_OC_GPRS_CELL, bts->bts_nr,
+ 0, 0xff);
+ abis_nm_chg_adm_state(bts, NM_OC_GPRS_CELL, bts->bts_nr,
+ 0, 0xff, NM_STATE_UNLOCKED);
+ abis_nm_chg_adm_state(bts, NM_OC_GPRS_NSE, bts->bts_nr,
+ 0xff, 0xff, NM_STATE_UNLOCKED);
+}
+
+void bts_model_nanobts_start_nsvc(struct gsm_bts *bts)
+{
+ uint8_t *data;
+ size_t data_len;
+
+ data = nanobts_attr_nscv_get(bts, &data_len);
+ abis_nm_ipaccess_set_attr(bts, NM_OC_GPRS_NSVC, bts->bts_nr,
+ 0, 0xff,
+ data, data_len);
+ abis_nm_opstart(bts, NM_OC_GPRS_NSVC, bts->bts_nr,
+ 0, 0xff);
+ abis_nm_chg_adm_state(bts, NM_OC_GPRS_NSVC, bts->bts_nr,
+ 0, 0xff,
+ NM_STATE_UNLOCKED);
+}