diff options
Diffstat (limited to 'src/osmo-bsc')
-rw-r--r-- | src/osmo-bsc/bsc_vty.c | 8 | ||||
-rw-r--r-- | src/osmo-bsc/bts_init.c | 26 | ||||
-rw-r--r-- | src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c | 16 | ||||
-rw-r--r-- | src/osmo-bsc/bts_sm.c | 7 | ||||
-rw-r--r-- | src/osmo-bsc/bts_vty.c | 42 | ||||
-rw-r--r-- | src/osmo-bsc/pcu_sock.c | 40 |
6 files changed, 91 insertions, 48 deletions
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index 669e94276..024f61c5e 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -320,16 +320,16 @@ DEFUN(show_bts_fail_rep, show_bts_fail_rep_cmd, "show bts <0-255> fail-rep [rese return CMD_SUCCESS; } -/* TODO: Add other options for group argument bssgp, ns '[(rlc|bssgp|ns)]' when adding additional timer groups. - * (Assume that with two args, the first is always the group. The second is always the timer) */ +/* TODO: Add other option for group argument bssgp -> '[(rlc|bssgp|ns)]' when adding additional timer groups. */ DEFUN(show_bts_rlc_timer, show_bts_rlc_timer_cmd, - "show bts <0-255> gprs timer [" BTS_VTY_RLC_STR "] " OSMO_TDEF_VTY_ARG_T_OPTIONAL, + "show bts <0-255> gprs timer [(" BTS_VTY_RLC_STR "|" BTS_VTY_NS_STR ")] " OSMO_TDEF_VTY_ARG_T_OPTIONAL, SHOW_STR BTS_STR BTS_NUM_STR "GPRS Packet Network\n" BTS_SHOW_TIMER_STR - "RLC (Radio Link Control)\n" + BTS_VTY_RLC_DESC_STR "\n" + BTS_VTY_NS_DESC_STR "\n" OSMO_TDEF_VTY_DOC_T) { struct gsm_network *net = gsmnet_from_vty(vty); diff --git a/src/osmo-bsc/bts_init.c b/src/osmo-bsc/bts_init.c index a4a4320e0..c838e1b33 100644 --- a/src/osmo-bsc/bts_init.c +++ b/src/osmo-bsc/bts_init.c @@ -73,10 +73,31 @@ static struct osmo_tdef bts_gprs_rlc_timer_templates[] = { {} }; +static struct osmo_tdef bts_gprs_ns_timer_templates[] = { + { .T = GSM_BTS_TDEF_ID_TNS_BLOCK, .default_val = 3, .min_val = 0, .max_val = UINT8_MAX, + .desc = "Tns-block: Guards the blocking and unblocking procedures" }, + { .T = GSM_BTS_TDEF_ID_TNS_BLOCK_RETRIES, .default_val = 3, .min_val = 0, .max_val = UINT8_MAX, + .desc = "NS-BLOCK-RETRIES: Blocking procedure retries", .unit = OSMO_TDEF_CUSTOM }, + { .T = GSM_BTS_TDEF_ID_TNS_RESET, .default_val = 3, .min_val = 0, .max_val = UINT8_MAX, + .desc = "Tns-reset: Guards the reset procedure" }, + { .T = GSM_BTS_TDEF_ID_TNS_RESET_RETRIES, .default_val = 3, .min_val = 0, .max_val = UINT8_MAX, + .desc = "Reset procedure retries", .unit = OSMO_TDEF_CUSTOM }, + { .T = GSM_BTS_TDEF_ID_TNS_TEST, .default_val = 30, .min_val = 0, .max_val = UINT8_MAX, + .desc = "Tns-test: Periodicity of the NS-VC test procedure" }, + { .T = GSM_BTS_TDEF_ID_TNS_ALIVE, .default_val = 3, .min_val = 0, .max_val = UINT8_MAX, + .desc = "Tns-alive: Guards the NS-VC test procedure" }, + { .T = GSM_BTS_TDEF_ID_TNS_ALIVE_RETRIES, .default_val = 10, .min_val = 0, .max_val = UINT8_MAX, + .desc = "NS-ALIVE-RETRIES: Retries for the the NS-VC test procedure", .unit = OSMO_TDEF_CUSTOM }, + {} +}; + + /* This is only used by bts_vty.c to init the default values for the templates */ struct osmo_tdef_group bts_gprs_timer_template_groups[_NUM_OSMO_BSC_BTS_TDEF_GROUPS + 1] = { [OSMO_BSC_BTS_TDEF_GROUPS_RLC] = { - .name = BTS_VTY_RLC_STR, .tdefs = bts_gprs_rlc_timer_templates, .desc = "RLC (Radio Link Control)" }, + .name = BTS_VTY_RLC_STR, .tdefs = bts_gprs_rlc_timer_templates, .desc = BTS_VTY_RLC_DESC_STR }, + [OSMO_BSC_BTS_TDEF_GROUPS_NS] = { + .name = BTS_VTY_NS_STR, .tdefs = bts_gprs_ns_timer_templates, .desc = BTS_VTY_NS_DESC_STR }, /* Additional per-BTS timer groups here, set as above using 'enum gprs_bts_tdef_groups' */ {} }; @@ -90,6 +111,9 @@ void bts_gprs_timer_groups_init(struct gsm_bts *bts) /* Init per-BTS RLC timers */ bts->timer_groups[OSMO_BSC_BTS_TDEF_GROUPS_RLC].tdefs = talloc_memdup(bts, bts_gprs_rlc_timer_templates, sizeof(bts_gprs_rlc_timer_templates)); OSMO_ASSERT(bts->timer_groups[OSMO_BSC_BTS_TDEF_GROUPS_RLC].tdefs); + /* Init per-BTS NS timers */ + bts->timer_groups[OSMO_BSC_BTS_TDEF_GROUPS_NS].tdefs = talloc_memdup(bts, bts_gprs_ns_timer_templates, sizeof(bts_gprs_ns_timer_templates)); + OSMO_ASSERT(bts->timer_groups[OSMO_BSC_BTS_TDEF_GROUPS_NS].tdefs); } /* Init default values for all per-BTS timer templates */ diff --git a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c index 6fdcfa774..d19220e15 100644 --- a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c +++ b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c @@ -184,6 +184,7 @@ struct msgb *nanobts_gen_set_nse_attr(struct gsm_bts_sm *bts_sm) struct abis_nm_ipacc_att_ns_cfg ns_cfg; struct abis_nm_ipacc_att_bssgp_cfg bssgp_cfg; struct gsm_bts *bts = gsm_bts_sm_get_bts(bts_sm); + const struct osmo_tdef_group *nstg = &bts->timer_groups[OSMO_BSC_BTS_TDEF_GROUPS_NS]; msgb = msgb_alloc(1024, __func__); if (!msgb) @@ -194,15 +195,14 @@ struct msgb *nanobts_gen_set_nse_attr(struct gsm_bts_sm *bts_sm) buf[1] = bts_sm->gprs.nse.nsei & 0xff; msgb_tl16v_put(msgb, NM_ATT_IPACC_NSEI, 2, buf); - osmo_static_assert(ARRAY_SIZE(bts_sm->gprs.nse.timer) == 7, nse_timer_array_wrong_size); ns_cfg = (struct abis_nm_ipacc_att_ns_cfg){ - .un_blocking_timer = bts_sm->gprs.nse.timer[0], - .un_blocking_retries = bts_sm->gprs.nse.timer[1], - .reset_timer = bts_sm->gprs.nse.timer[2], - .reset_retries = bts_sm->gprs.nse.timer[3], - .test_timer = bts_sm->gprs.nse.timer[4], - .alive_timer = bts_sm->gprs.nse.timer[5], - .alive_retries = bts_sm->gprs.nse.timer[6], + .un_blocking_timer = osmo_tdef_get(nstg->tdefs, GSM_BTS_TDEF_ID_TNS_BLOCK, OSMO_TDEF_S, -1), + .un_blocking_retries = osmo_tdef_get(nstg->tdefs, GSM_BTS_TDEF_ID_TNS_BLOCK_RETRIES, OSMO_TDEF_CUSTOM, -1), + .reset_timer = osmo_tdef_get(nstg->tdefs, GSM_BTS_TDEF_ID_TNS_RESET, OSMO_TDEF_S, -1), + .reset_retries = osmo_tdef_get(nstg->tdefs, GSM_BTS_TDEF_ID_TNS_RESET_RETRIES, OSMO_TDEF_CUSTOM, -1), + .test_timer = osmo_tdef_get(nstg->tdefs, GSM_BTS_TDEF_ID_TNS_TEST, OSMO_TDEF_S, -1), + .alive_timer = osmo_tdef_get(nstg->tdefs, GSM_BTS_TDEF_ID_TNS_ALIVE, OSMO_TDEF_S, -1), + .alive_retries = osmo_tdef_get(nstg->tdefs, GSM_BTS_TDEF_ID_TNS_ALIVE_RETRIES, OSMO_TDEF_CUSTOM, -1), }; msgb_tl16v_put(msgb, NM_ATT_IPACC_NS_CFG, sizeof(ns_cfg), (const uint8_t *)&ns_cfg); diff --git a/src/osmo-bsc/bts_sm.c b/src/osmo-bsc/bts_sm.c index ca572f146..8a9634ba3 100644 --- a/src/osmo-bsc/bts_sm.c +++ b/src/osmo-bsc/bts_sm.c @@ -26,8 +26,6 @@ #include <osmocom/bsc/debug.h> #include <osmocom/bsc/nm_common_fsm.h> -static const uint8_t bts_nse_timer_default[] = { 3, 3, 3, 3, 30, 3, 10 }; - static int gsm_bts_sm_talloc_destructor(struct gsm_bts_sm *bts_sm) { int i; @@ -76,8 +74,6 @@ struct gsm_bts_sm *gsm_bts_sm_alloc(struct gsm_network *net, uint8_t bts_num) LOGL_INFO, NULL); osmo_fsm_inst_update_id_f(bts_sm->gprs.nse.mo.fi, "nse%d", bts_num); gsm_mo_init(&bts_sm->gprs.nse.mo, bts, NM_OC_GPRS_NSE, bts->nr, 0xff, 0xff); - memcpy(&bts_sm->gprs.nse.timer, bts_nse_timer_default, - sizeof(bts_sm->gprs.nse.timer)); for (i = 0; i < ARRAY_SIZE(bts_sm->gprs.nsvc); i++) { bts_sm->gprs.nsvc[i].bts = bts; @@ -91,8 +87,7 @@ struct gsm_bts_sm *gsm_bts_sm_alloc(struct gsm_network *net, uint8_t bts_num) gsm_mo_init(&bts_sm->gprs.nsvc[i].mo, bts, NM_OC_GPRS_NSVC, bts->nr, i, 0xff); } - memcpy(&bts_sm->gprs.nse.timer, bts_nse_timer_default, - sizeof(bts_sm->gprs.nse.timer)); + gsm_mo_init(&bts_sm->gprs.nse.mo, bts, NM_OC_GPRS_NSE, bts->nr, 0xff, 0xff); diff --git a/src/osmo-bsc/bts_vty.c b/src/osmo-bsc/bts_vty.c index 1d265ce78..77bab3e15 100644 --- a/src/osmo-bsc/bts_vty.c +++ b/src/osmo-bsc/bts_vty.c @@ -59,6 +59,8 @@ #define X(x) (1 << x) +extern struct osmo_tdef gsm_network_T_defs[]; + /* FIXME: this should go to some common file */ static const struct value_string gprs_ns_timer_strs[] = { { 0, "tns-block" }, @@ -1655,8 +1657,24 @@ DEFUN_ATTR(cfg_bts_pag_free, cfg_bts_pag_free_cmd, return CMD_SUCCESS; } -DEFUN_USRATTR(cfg_bts_gprs_ns_timer, +#define TDEF_DATA_ID_IDX 0 +#define TDEF_DATA_UNIT_IDX 1 +/* Indices here correspond to those in gprs_ns_timer_str. Each row contains information for setting the respective tdef */ +static const int gprs_ns_timer_tdef_data[][2] = { + [0] = { GSM_BTS_TDEF_ID_TNS_BLOCK, OSMO_TDEF_S }, + [1] = { GSM_BTS_TDEF_ID_TNS_BLOCK_RETRIES, OSMO_TDEF_CUSTOM }, + [2] = { GSM_BTS_TDEF_ID_TNS_RESET, OSMO_TDEF_S }, + [3] = { GSM_BTS_TDEF_ID_TNS_RESET_RETRIES, OSMO_TDEF_CUSTOM }, + [4] = { GSM_BTS_TDEF_ID_TNS_TEST, OSMO_TDEF_S}, + [5] = { GSM_BTS_TDEF_ID_TNS_ALIVE, OSMO_TDEF_S}, + [6] = { GSM_BTS_TDEF_ID_TNS_ALIVE_RETRIES, OSMO_TDEF_CUSTOM }, +}; + +static struct cmd_element cfg_gprs_timer_cmd; + +DEFUN_ATTR_USRATTR(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd, + CMD_ATTR_DEPRECATED, X(BSC_VTY_ATTR_RESTART_ABIS_OML_LINK), "gprs ns timer " NS_TIMERS " <0-255>", GPRS_TEXT "Network Service\n" @@ -1664,16 +1682,20 @@ DEFUN_USRATTR(cfg_bts_gprs_ns_timer, NS_TIMERS_HELP "Timer Value\n") { struct gsm_bts *bts = vty->index; - int idx = get_string_value(gprs_ns_timer_strs, argv[0]); - int val = atoi(argv[1]); + int idx = get_string_value(gprs_ns_timer_strs, argv[0]), val = atoi(argv[1]); + const int *tdef_params; + const struct osmo_tdef_group *bts_ns = &bts->timer_groups[OSMO_BSC_BTS_TDEF_GROUPS_NS]; + + vty_out(vty, "This command is deprecated; use '%s' instead%s", cfg_gprs_timer_cmd.string, VTY_NEWLINE); GPRS_CHECK_ENABLED(bts); - if (idx < 0 || idx >= ARRAY_SIZE(bts->site_mgr->gprs.nse.timer)) + if (idx < 0 || idx >= ARRAY_SIZE(gprs_ns_timer_tdef_data)) return CMD_WARNING; - bts->site_mgr->gprs.nse.timer[idx] = val; - + tdef_params = gprs_ns_timer_tdef_data[idx]; + if (osmo_tdef_set(bts_ns->tdefs, tdef_params[TDEF_DATA_ID_IDX], val, tdef_params[TDEF_DATA_UNIT_IDX]) < 0) + return CMD_WARNING; return CMD_SUCCESS; } @@ -1893,7 +1915,7 @@ DEFUN_USRATTR(cfg_bts_gprs_egprs_pkt_chan_req, /* Adapted from libosmocore.git:src/vty/tdef_vty.c. cmdstr/helpstr args set by bts_vty_tdef_cmds_init() * The group argument is optional here (if omitted, all timer groups will be searched) */ DEFUN(show_gprs_timer, show_gprs_timer_cmd, NULL, NULL) - /* show gprs timer [(rlc)] [TNNNN] */ + /* show gprs timer [(rlc|ns)] [TNNNN] */ { const char *group_arg = argc >= 1 ? argv[0] : NULL; const char *T_arg = argc >= 2 ? argv[1] : NULL; @@ -1912,7 +1934,7 @@ DEFUN(show_gprs_timer, show_gprs_timer_cmd, NULL, NULL) /* Adapted from libosmocore.git:src/vty/tdef_vty.c. cmdstr/helpstr args set by bts_vty_tdef_cmds_init(). * The group argument is optional here (if omitted, all timer groups will be searched) */ DEFUN(cfg_gprs_timer, cfg_gprs_timer_cmd, NULL, NULL) - /* gprs timer [rlc] [TNNNN] [(<0-2147483647>|default)] */ + /* gprs timer [(rlc|ns)] [TNNNN] [(<0-2147483647>|default)] */ { const char **timer_args; struct osmo_tdef_group *g = NULL; @@ -4342,10 +4364,6 @@ static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts) bts->gprs.cell.timer[i], VTY_NEWLINE); vty_out(vty, " gprs nsei %u%s", bts_sm->gprs.nse.nsei, VTY_NEWLINE); - for (i = 0; i < ARRAY_SIZE(bts_sm->gprs.nse.timer); i++) - vty_out(vty, " gprs ns timer %s %u%s", - get_value_string(gprs_ns_timer_strs, i), - bts_sm->gprs.nse.timer[i], VTY_NEWLINE); for (i = 0; i < ARRAY_SIZE(bts_sm->gprs.nsvc); i++) { const struct gsm_gprs_nsvc *nsvc = &bts_sm->gprs.nsvc[i]; struct osmo_sockaddr_str remote; diff --git a/src/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c index 8942b78f9..192cef322 100644 --- a/src/osmo-bsc/pcu_sock.c +++ b/src/osmo-bsc/pcu_sock.c @@ -181,7 +181,7 @@ static int pcu_tx_info_ind(struct gsm_bts *bts) struct gsm_pcu_if *pcu_prim; struct gsm_pcu_if_info_ind *info_ind; struct gprs_rlc_cfg *rlcc; - const struct osmo_tdef_group *rlctg = &bts->timer_groups[OSMO_BSC_BTS_TDEF_GROUPS_RLC]; + const struct osmo_tdef_group *g; struct gsm_bts_sm *bts_sm; struct gsm_gprs_nsvc *nsvc; struct gsm_bts_trx *trx; @@ -211,29 +211,35 @@ static int pcu_tx_info_ind(struct gsm_bts *bts) info_ind->rac = bts->gprs.rac; /* NSE */ + g = &bts->timer_groups[OSMO_BSC_BTS_TDEF_GROUPS_NS]; info_ind->nsei = bts_sm->gprs.nse.nsei; - memcpy(info_ind->nse_timer, bts_sm->gprs.nse.timer, 7); + info_ind->nse_timer[0] = osmo_tdef_get(g->tdefs, GSM_BTS_TDEF_ID_TNS_BLOCK, OSMO_TDEF_S, -1); + info_ind->nse_timer[1] = osmo_tdef_get(g->tdefs, GSM_BTS_TDEF_ID_TNS_BLOCK_RETRIES, OSMO_TDEF_CUSTOM, -1); + info_ind->nse_timer[2] = osmo_tdef_get(g->tdefs, GSM_BTS_TDEF_ID_TNS_RESET, OSMO_TDEF_S, -1); + info_ind->nse_timer[3] = osmo_tdef_get(g->tdefs, GSM_BTS_TDEF_ID_TNS_RESET_RETRIES, OSMO_TDEF_CUSTOM, -1); + info_ind->nse_timer[4] = osmo_tdef_get(g->tdefs, GSM_BTS_TDEF_ID_TNS_TEST, OSMO_TDEF_S, -1); + /* Communicating TNS Alive/having it con->tdefs,igurable for backwards compatibility */ + info_ind->nse_timer[5] = osmo_tdef_get(g->tdefs, GSM_BTS_TDEF_ID_TNS_ALIVE, OSMO_TDEF_S, -1); + info_ind->nse_timer[6] = osmo_tdef_get(g->tdefs, GSM_BTS_TDEF_ID_TNS_ALIVE_RETRIES, OSMO_TDEF_CUSTOM, -1); memcpy(info_ind->cell_timer, bts->gprs.cell.timer, 11); /* cell attributes */ + g = &bts->timer_groups[OSMO_BSC_BTS_TDEF_GROUPS_RLC]; info_ind->bsic = bts->bsic; info_ind->cell_id = bts->cell_identity; info_ind->repeat_time = rlcc->paging.repeat_time; info_ind->repeat_count = rlcc->paging.repeat_count; info_ind->bvci = bts->gprs.cell.bvci; - info_ind->t3142 = osmo_tdef_get(rlctg->tdefs, 3142, OSMO_TDEF_S, -1); - info_ind->t3169 = osmo_tdef_get(rlctg->tdefs, 3169, OSMO_TDEF_S, -1); - info_ind->t3191 = osmo_tdef_get(rlctg->tdefs, 3191, OSMO_TDEF_S, -1); - info_ind->t3193_10ms = osmo_tdef_get(rlctg->tdefs, 3193, OSMO_TDEF_MS, -1)/10; - info_ind->t3195 = osmo_tdef_get(rlctg->tdefs, 3195, OSMO_TDEF_S, -1); - info_ind->n3101 = - osmo_tdef_get(rlctg->tdefs, 3101, OSMO_TDEF_CUSTOM, -1); - info_ind->n3103 = - osmo_tdef_get(rlctg->tdefs, 3103, OSMO_TDEF_CUSTOM, -1); - info_ind->n3105 = - osmo_tdef_get(rlctg->tdefs, 3105, OSMO_TDEF_CUSTOM, -1); - info_ind->cv_countdown = - osmo_tdef_get(rlctg->tdefs, GSM_BTS_TDEF_ID_COUNTDOWN_VALUE, OSMO_TDEF_CUSTOM, -1); + info_ind->t3142 = osmo_tdef_get(g->tdefs, 3142, OSMO_TDEF_S, -1); + info_ind->t3169 = osmo_tdef_get(g->tdefs, 3169, OSMO_TDEF_S, -1); + info_ind->t3191 = osmo_tdef_get(g->tdefs, 3191, OSMO_TDEF_S, -1); + info_ind->t3193_10ms = osmo_tdef_get(g->tdefs, 3193, OSMO_TDEF_MS, -1)/10; + info_ind->t3195 = osmo_tdef_get(g->tdefs, 3195, OSMO_TDEF_S, -1); + info_ind->n3101 = osmo_tdef_get(g->tdefs, 3101, OSMO_TDEF_CUSTOM, -1); + info_ind->n3103 = osmo_tdef_get(g->tdefs, 3103, OSMO_TDEF_CUSTOM, -1); + info_ind->n3105 = osmo_tdef_get(g->tdefs, 3105, OSMO_TDEF_CUSTOM, -1); + info_ind->cv_countdown = osmo_tdef_get(g->tdefs, GSM_BTS_TDEF_ID_COUNTDOWN_VALUE, + OSMO_TDEF_CUSTOM, -1); if (rlcc->cs_mask & (1 << GPRS_CS1)) info_ind->flags |= PCU_IF_FLAG_CS1; if (rlcc->cs_mask & (1 << GPRS_CS2)) @@ -264,10 +270,10 @@ static int pcu_tx_info_ind(struct gsm_bts *bts) } /* TODO: isn't dl_tbf_ext wrong?: * 10 and no ntohs */ info_ind->dl_tbf_ext = - osmo_tdef_get(rlctg->tdefs, GSM_BTS_TDEF_ID_DL_TBF_DELAYED, OSMO_TDEF_MS, -1); + osmo_tdef_get(g->tdefs, GSM_BTS_TDEF_ID_DL_TBF_DELAYED, OSMO_TDEF_MS, -1); /* TODO: isn't ul_tbf_ext wrong?: * 10 and no ntohs */ info_ind->ul_tbf_ext = - osmo_tdef_get(rlctg->tdefs, GSM_BTS_TDEF_ID_UL_TBF_EXT, OSMO_TDEF_MS, -1); + osmo_tdef_get(g->tdefs, GSM_BTS_TDEF_ID_UL_TBF_EXT, OSMO_TDEF_MS, -1); info_ind->initial_cs = rlcc->initial_cs; info_ind->initial_mcs = rlcc->initial_mcs; |