GPRS: change 'gprs enabled <0-1>' to 'gprs mode (none|gprs|egprs)'

This causes some config file breakage but sounds like a much cleaner
approach than to have two separate config variables for this.
This commit is contained in:
Harald Welte 2010-04-18 15:51:20 +02:00
parent da0586a838
commit 4511d891dd
5 changed files with 55 additions and 20 deletions

View File

@ -73,6 +73,12 @@ enum gsm_paging_event {
GSM_PAGING_OOM,
};
enum bts_gprs_mode {
BTS_GPRS_NONE = 0,
BTS_GPRS_GPRS = 1,
BTS_GPRS_EGPRS = 2,
};
struct msgb;
typedef int gsm_cbfn(unsigned int hooknum,
unsigned int event,
@ -476,7 +482,7 @@ struct gsm_bts {
/* Not entirely sure how ip.access specific this is */
struct {
int enabled;
enum bts_gprs_mode mode;
struct {
struct gsm_nm_state nm_state;
u_int16_t nsei;
@ -705,6 +711,9 @@ const char *gsm_auth_policy_name(enum gsm_auth_policy policy);
enum rrlp_mode rrlp_mode_parse(const char *arg);
const char *rrlp_mode_name(enum rrlp_mode mode);
enum bts_gprs_mode bts_gprs_mode_parse(const char *arg);
const char *bts_gprs_mode_name(enum bts_gprs_mode mode);
void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked);
/* A parsed GPRS routing area */

View File

@ -462,7 +462,7 @@ int nm_state_event(enum nm_evt evt, u_int8_t obj_class, void *obj,
break;
case NM_OC_GPRS_NSE:
bts = container_of(obj, struct gsm_bts, gprs.nse);
if (!bts->gprs.enabled)
if (bts->gprs.mode == BTS_GPRS_NONE)
break;
if (new_state->availability == 5) {
abis_nm_ipaccess_set_attr(bts, obj_class, bts->bts_nr,
@ -476,7 +476,7 @@ int nm_state_event(enum nm_evt evt, u_int8_t obj_class, void *obj,
break;
case NM_OC_GPRS_CELL:
bts = container_of(obj, struct gsm_bts, gprs.cell);
if (!bts->gprs.enabled)
if (bts->gprs.mode == BTS_GPRS_NONE)
break;
if (new_state->availability == 5) {
abis_nm_ipaccess_set_attr(bts, obj_class, bts->bts_nr,
@ -491,7 +491,7 @@ int nm_state_event(enum nm_evt evt, u_int8_t obj_class, void *obj,
case NM_OC_GPRS_NSVC:
nsvc = obj;
bts = nsvc->bts;
if (!bts->gprs.enabled)
if (bts->gprs.mode == BTS_GPRS_NONE)
break;
/* We skip NSVC1 since we only use NSVC0 */
if (nsvc->id == 1)
@ -799,7 +799,7 @@ static int set_system_infos(struct gsm_bts_trx *trx)
DEBUGP(DRR, "SI%2u: %s\n", i, hexdump(si_tmp, rc));
rsl_bcch_info(trx, i, si_tmp, sizeof(si_tmp));
}
if (bts->gprs.enabled) {
if (bts->gprs.mode != BTS_GPRS_NONE) {
i = 13;
rc = gsm_generate_si(si_tmp, trx->bts, RSL_SYSTEM_INFO_13);
if (rc < 0)

View File

@ -502,6 +502,23 @@ const char *rrlp_mode_name(enum rrlp_mode mode)
return get_value_string(rrlp_mode_names, mode);
}
static const struct value_string bts_gprs_mode_names[] = {
{ BTS_GPRS_NONE, "none" },
{ BTS_GPRS_GPRS, "gprs" },
{ BTS_GPRS_EGPRS, "egprs" },
{ 0, NULL }
};
enum bts_gprs_mode bts_gprs_mode_parse(const char *arg)
{
return get_string_value(bts_gprs_mode_names, arg);
}
const char *bts_gprs_mode_name(enum bts_gprs_mode mode)
{
return get_value_string(bts_gprs_mode_names, mode);
}
struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan)
{
struct gsm_meas_rep *meas_rep;

View File

@ -458,7 +458,15 @@ static int generate_si13(u_int8_t *output, struct gsm_bts *bts)
int gsm_generate_si(u_int8_t *output, struct gsm_bts *bts, int type)
{
si_info.gprs_ind.present = bts->gprs.enabled;
switch (bts->gprs.mode) {
case BTS_GPRS_EGPRS:
case BTS_GPRS_GPRS:
si_info.gprs_ind.present = 1;
break;
case BTS_GPRS_NONE:
si_info.gprs_ind.present = 0;
break;
}
switch (type) {
case RSL_SYSTEM_INFO_1:

View File

@ -318,8 +318,9 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts)
config_write_e1_link(vty, &bts->oml_e1_link, " oml ");
vty_out(vty, " oml e1 tei %u%s", bts->oml_tei, VTY_NEWLINE);
}
vty_out(vty, " gprs enabled %u%s", bts->gprs.enabled, VTY_NEWLINE);
if (bts->gprs.enabled) {
vty_out(vty, " gprs mode %s%s", bts_gprs_mode_name(bts->gprs.mode),
VTY_NEWLINE);
if (bts->gprs.mode != BTS_GPRS_NONE) {
vty_out(vty, " gprs routing area %u%s", bts->gprs.rac,
VTY_NEWLINE);
vty_out(vty, " gprs cell bvci %u%s", bts->gprs.cell.bvci,
@ -1397,7 +1398,7 @@ DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
{
struct gsm_bts *bts = vty->index;
if (!bts->gprs.enabled) {
if (bts->gprs.mode == BTS_GPRS_NONE) {
vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
return CMD_WARNING;
}
@ -1413,7 +1414,7 @@ DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
{
struct gsm_bts *bts = vty->index;
if (!bts->gprs.enabled) {
if (bts->gprs.mode == BTS_GPRS_NONE) {
vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
return CMD_WARNING;
}
@ -1431,7 +1432,7 @@ DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
struct gsm_bts *bts = vty->index;
int idx = atoi(argv[0]);
if (!bts->gprs.enabled) {
if (bts->gprs.mode == BTS_GPRS_NONE) {
vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
return CMD_WARNING;
}
@ -1448,7 +1449,7 @@ DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
struct gsm_bts *bts = vty->index;
int idx = atoi(argv[0]);
if (!bts->gprs.enabled) {
if (bts->gprs.mode == BTS_GPRS_NONE) {
vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
return CMD_WARNING;
}
@ -1465,7 +1466,7 @@ DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
struct gsm_bts *bts = vty->index;
int idx = atoi(argv[0]);
if (!bts->gprs.enabled) {
if (bts->gprs.mode == BTS_GPRS_NONE) {
vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
return CMD_WARNING;
}
@ -1483,7 +1484,7 @@ DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
int idx = atoi(argv[0]);
struct in_addr ia;
if (!bts->gprs.enabled) {
if (bts->gprs.mode == BTS_GPRS_NONE) {
vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
return CMD_WARNING;
}
@ -1500,7 +1501,7 @@ DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
{
struct gsm_bts *bts = vty->index;
if (!bts->gprs.enabled) {
if (bts->gprs.mode == BTS_GPRS_NONE) {
vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
return CMD_WARNING;
}
@ -1510,13 +1511,13 @@ DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
return CMD_SUCCESS;
}
DEFUN(cfg_bts_gprs_enabled, cfg_bts_gprs_enabled_cmd,
"gprs enabled <0-1>",
"GPRS Enabled on this BTS")
DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
"gprs mode (none|gprs|egprs)",
"GPRS Mode for this BTS")
{
struct gsm_bts *bts = vty->index;
bts->gprs.enabled = atoi(argv[0]);
bts->gprs.mode = bts_gprs_mode_parse(argv[0]);
return CMD_SUCCESS;
}
@ -1775,7 +1776,7 @@ int bsc_vty_init(struct gsm_network *net)
install_element(BTS_NODE, &cfg_bts_per_loc_upd_cmd);
install_element(BTS_NODE, &cfg_bts_cell_resel_hyst_cmd);
install_element(BTS_NODE, &cfg_bts_rxlev_acc_min_cmd);
install_element(BTS_NODE, &cfg_bts_gprs_enabled_cmd);
install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);