Introduce per-BTS timers, RLC timer commands

- Add per-BTS timer groups ('rlc' only for now, others to follow)
 - Add vty commands & tests for those timers

Related: OS#5335
Change-Id: I2c24110d8c977d6cc74c3c8e77bcc709ad9d2675
This commit is contained in:
arehbein 2023-03-05 22:37:38 +01:00
parent 6766608231
commit 85b7f53642
12 changed files with 460 additions and 50 deletions

View File

@ -7,6 +7,7 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/core/tdef.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/gsm/bts_features.h>
@ -319,6 +320,14 @@ struct gsm_bts_model {
bool features_get_reported;
};
/* RLC */
#define GSM_BTS_TDEF_ID_COUNTDOWN_VALUE (-1)
#define GSM_BTS_TDEF_ID_UL_TBF_EXT (-2)
#define GSM_BTS_TDEF_ID_DL_TBF_DELAYED (-3)
/* 3GPP TS 04.60 V8.27.0 (2005-09) */
#define GSM_RLCMACN3101_STRICT_LOWER_BOUND 8UL
struct gsm_gprs_cell {
struct gsm_abis_mo mo;
uint16_t bvci;
@ -326,6 +335,15 @@ struct gsm_gprs_cell {
struct gprs_rlc_cfg rlc_cfg;
};
/* Used for indexing tdef group arrays */
enum gsm_gprs_bts_tdef_groups {
OSMO_BSC_BTS_TDEF_GROUPS_RLC = 0,
/* TODO: Add additional groups here (BSSGP, NS) */
_NUM_OSMO_BSC_BTS_TDEF_GROUPS
};
extern const size_t bts_gprs_rlc_timer_templates_bytes;
extern struct osmo_tdef_group bts_gprs_timer_template_groups[_NUM_OSMO_BSC_BTS_TDEF_GROUPS + 1];
/* One BTS */
struct gsm_bts {
/* list header in net->bts_list */
@ -494,6 +512,10 @@ struct gsm_bts {
} pwr_ctrl; /* TS 44.060 Table 12.9.1 */
} gprs;
/* TODO: Migrate other per-bts timers (stored elsewhere in this struct before this struct member
* was introduced) over to this 'struct osmo_tdef' */
struct osmo_tdef_group timer_groups[_NUM_OSMO_BSC_BTS_TDEF_GROUPS + 1];
/* CCCH Load Threshold: threshold (in percent) when BTS shall send CCCH LOAD IND */
uint8_t ccch_load_ind_thresh;
/* CCCH Load Indication Period: how often (secs) to send CCCH LOAD IND when over CCCH Load Threshold. */

View File

@ -750,7 +750,6 @@ enum gprs_cs {
};
struct gprs_rlc_cfg {
uint16_t parameter[_NUM_RLC_PAR];
struct {
uint16_t repeat_time; /* ms */
uint8_t repeat_count;

View File

@ -50,6 +50,8 @@ void bsc_subscr_dump_vty(struct vty *vty, struct bsc_subscr *bsub);
struct gsm_network *gsmnet_from_vty(struct vty *vty);
int bts_vty_init(void);
unsigned int bts_write_group_timers(struct vty *vty, const char *indent, int bts_nr,
unsigned gsm_bts_tdef_group, const char *T_arg, bool print_defaults);
void bts_dump_vty(struct vty *vty, struct gsm_bts *bts);
void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx, bool print_rsl, bool show_connected);
void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts);
@ -88,6 +90,21 @@ enum bsc_vty_cmd_attr {
#define BTS_NR_TRX_TS_SS_STR2 \
BTS_NR_TRX_TS_STR2 \
"Sub-slot for manual command\n" SS_NR_STR
/* Defines for vty tdef commands adapted to BTS (general) */
#define BTS_SHOW_TIMER_STR_NONEWLINE "Show List of timers for this group"
#define BTS_SHOW_TIMER_STR BTS_SHOW_TIMER_STR_NONEWLINE "\n"
#define BTS_TDEF_VTY_DOC_T(BTS_TIMER_GROUPNAME) \
"T- or X-timer-number (for " BTS_TIMER_GROUPNAME " timer configurable on this BTS) -- 3GPP compliant timer number of" \
" the format '1234' or 'T1234' or 't1234';" \
" Osmocom-specific timer number of the format: 'X1234' or 'x1234'.\n"
/* Defines for per-BTS string commands */
#define BTS_VTY_RLC_STR "rlc"
#define BTS_VTY_RLC_DESC_STR "RLC (Radio Link Control)"
/* Add additional group strings for vty command generation here */
#define BTS_VTY_SHOW_TIMER_STR BTS_SHOW_TIMER_STR_NONEWLINE " & for this BTS\n"
/*! Defines for per-BTS string commands */
#define TSC_ARGS_OPT "[tsc] [<1-4>] [<0-7>]"
#define TSC_ARGS_DOC \

View File

@ -43,10 +43,13 @@
#include <osmocom/bsc/smscb.h>
#include <osmocom/gsm/protocol/gsm_48_049.h>
#include <talloc.h>
#include <time.h>
#include <limits.h>
#include <stdbool.h>
extern void bts_gprs_timer_groups_init(struct gsm_bts *bts);
struct gsm_network *bsc_gsmnet;
int bsc_shutdown_net(struct gsm_network *net)
@ -234,6 +237,7 @@ struct gsm_bts *bsc_bts_alloc_register(struct gsm_network *net, enum gsm_bts_typ
OSMO_ASSERT(bts != NULL);
bts->ho = ho_cfg_init(bts, net->ho);
bts_gprs_timer_groups_init(bts);
return bts;
}

View File

@ -232,9 +232,12 @@ DEFUN(bsc_show_net, bsc_show_net_cmd, "show network",
return CMD_SUCCESS;
}
#define BTS_STR "Display information about a BTS\n"
#define BTS_NUM_STR "BTS number\n"
DEFUN(show_bts, show_bts_cmd, "show bts [<0-255>]",
SHOW_STR "Display information about a BTS\n"
"BTS number\n")
SHOW_STR BTS_STR BTS_NUM_STR)
{
struct gsm_network *net = gsmnet_from_vty(vty);
int bts_nr;
@ -258,8 +261,7 @@ DEFUN(show_bts, show_bts_cmd, "show bts [<0-255>]",
}
DEFUN(show_bts_fail_rep, show_bts_fail_rep_cmd, "show bts <0-255> fail-rep [reset]",
SHOW_STR "Display information about a BTS\n"
"BTS number\n" "OML failure reports\n"
SHOW_STR BTS_STR BTS_NUM_STR "OML failure reports\n"
"Clear the list of failure reports after showing them\n")
{
struct gsm_network *net = gsmnet_from_vty(vty);
@ -318,6 +320,44 @@ 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) */
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_STR
BTS_STR
BTS_NUM_STR
"GPRS Packet Network\n"
BTS_SHOW_TIMER_STR
BTS_VTY_RLC_DESC_STR "\n"
OSMO_TDEF_VTY_DOC_T)
{
struct gsm_network *net = gsmnet_from_vty(vty);
int rc = CMD_WARNING, bts_nr = atoi(argv[0]);
enum gsm_gprs_bts_tdef_groups group = -1;
const char *tdef_group = argc >= 2 ? argv[1] : NULL;
const char *T_arg = argc >= 3 ? argv[2] : NULL;
struct osmo_tdef_group *g;
struct gsm_bts *bts = gsm_bts_num(net, bts_nr);
if (!bts) {
vty_out(vty, "%% can't find BTS '%d'%s", bts_nr, VTY_NEWLINE);
return CMD_WARNING;
}
if (bts->gprs.mode == BTS_GPRS_NONE) {
vty_out(vty, "%% GPRS is not enabled on BTS %u%s", bts->nr, VTY_NEWLINE);
return CMD_WARNING;
}
osmo_tdef_groups_for_each(g, bts->timer_groups) {
++group;
if (tdef_group && strcmp(tdef_group, g->name))
continue;
if (bts_write_group_timers(vty, "", bts_nr, group, T_arg, false) == CMD_WARNING)
rc = CMD_SUCCESS;
}
return rc;
}
DEFUN(show_rejected_bts, show_rejected_bts_cmd, "show rejected-bts",
SHOW_STR "Display recently rejected BTS devices\n")
{
@ -3628,6 +3668,7 @@ int bsc_vty_init(struct gsm_network *network)
install_element_ve(&bsc_show_net_cmd);
install_element_ve(&show_bts_cmd);
install_element_ve(&show_bts_rlc_timer_cmd);
install_element_ve(&show_bts_fail_rep_cmd);
install_element_ve(&show_rejected_bts_cmd);
install_element_ve(&show_trx_cmd);

View File

@ -132,19 +132,6 @@ static const uint8_t bts_cell_timer_default[11] = {
};
static const struct gprs_rlc_cfg rlc_cfg_default = {
.parameter = {
[RLC_T3142] = 20,
[RLC_T3169] = 5,
[RLC_T3191] = 5,
[RLC_T3193] = 160, /* 10ms */
[RLC_T3195] = 5,
[RLC_N3101] = 10,
[RLC_N3103] = 4,
[RLC_N3105] = 8,
[CV_COUNTDOWN] = 15,
[T_DL_TBF_EXT] = 250 * 10, /* ms */
[T_UL_TBF_EXT] = 250 * 10, /* ms */
},
.paging = {
.repeat_time = 5 * 50, /* ms */
.repeat_count = 3,

View File

@ -17,9 +17,16 @@
*
*/
#include <osmocom/bsc/bss.h>
#include <osmocom/bsc/bts.h>
#include <osmocom/bsc/vty.h>
#include <osmocom/core/utils.h>
void bts_grprs_tdef_groups_init(void);
int bts_init(void)
{
bts_grprs_tdef_groups_init();
bts_model_bs11_init();
bts_model_rbs2k_init();
bts_model_nanobts_init();
@ -28,3 +35,69 @@ int bts_init(void)
/* Your new BTS here. */
return 0;
}
/* The following tdef arrays are copied to each BTS instance and used for per-BTS tdef groups after being
* initialized via bts_tdef_vty_groups_init() (see: bsc_bts_alloc_register()) */
static struct osmo_tdef bts_gprs_rlc_timer_templates[] = {
{ .T = 3142, .default_val = 20,
.desc = "Used during packet access on CCCH/while in dedicated mode. Started after the receipt of "
"IMMEDIATE ASSIGNMENT REJECT or DTM REJECT or EC IMMEDIATE ASSIGNMENT REJECT",
.max_val = UINT8_MAX },
{ .T = 3169, .default_val = 5,
.desc = "Release radio resource (TFI, USF) timer (linked to N3103, N3103)", .max_val = UINT8_MAX },
{ .T = 3191, .default_val = 5,
.desc = "Downlink TBF (Temporary Block Flow) Release downlink RLC data block retransmission timer", .max_val = UINT8_MAX },
{ .T = 3193, .default_val = 1600, .desc = "Downlink TBF Release timer", .unit = OSMO_TDEF_MS,
.max_val = UINT8_MAX * 10 },
{ .T = 3195, .default_val = 5,
.desc = "Timer for TFI release on N3105 overflow (unresponsive MS)", .max_val = UINT8_MAX },
{ .T = GSM_BTS_TDEF_ID_COUNTDOWN_VALUE, .default_val = 15,
.desc = "CV: Countdown value/remaining blocks to transmit", .unit = OSMO_TDEF_CUSTOM, .max_val = UINT8_MAX },
{ .T = GSM_BTS_TDEF_ID_UL_TBF_EXT, .default_val = 2500,
.desc = "\"In the extended uplink TBF mode, the uplink TBF may be maintained during temporary inactive periods, "
"where the mobile station has no RLC information to send.\" (3GPP TS 44.060 Version 6.14.0)",
.unit = OSMO_TDEF_MS, .max_val = 500 * 10 },
{ .T = GSM_BTS_TDEF_ID_DL_TBF_DELAYED, .default_val = 2500,
.desc = "A delayed release of the downlink TBF is when the release of the downlink TBF is delayed following the transmission of a final data block, "
"rather than instantly releasing the TBF",
.unit = OSMO_TDEF_MS, .max_val = 500 * 10 },
{ .T = 3101, .default_val = 10,
.desc = "N3101: Maximum USFs without response from the MS", .unit = OSMO_TDEF_CUSTOM,
.min_val = GSM_RLCMACN3101_STRICT_LOWER_BOUND + 1, .max_val = UINT8_MAX },
{ .T = 3103, .default_val = 4,
.desc = "N3103: Maximum PACKET UPLINK ACK/NACK messages within a TBF unacknowledged by MS",
.unit = OSMO_TDEF_CUSTOM, .max_val = UINT8_MAX },
{ .T = 3105, .default_val = 8,
.desc = "N3105: Maximum allocated data blocks without RLC/MAC control reply from MS",
.unit = OSMO_TDEF_CUSTOM, .max_val = UINT8_MAX },
{}
};
/* 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 = BTS_VTY_RLC_DESC_STR },
/* Additional per-BTS timer groups here, set as above using 'enum gprs_bts_tdef_groups' */
{}
};
/* Init per-BTS timer groups with group templates */
void bts_gprs_timer_groups_init(struct gsm_bts *bts)
{
enum gsm_gprs_bts_tdef_groups gbtg;
for (gbtg = 0; gbtg < ARRAY_SIZE(bts_gprs_timer_template_groups); gbtg++)
bts->timer_groups[gbtg] = bts_gprs_timer_template_groups[gbtg];
/* 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 default values for all per-BTS timer templates */
void bts_grprs_tdef_groups_init(void)
{
struct osmo_tdef_group *g;
/* Set values in per-BTS timer templates to defaults */
osmo_tdef_groups_for_each(g, bts_gprs_timer_template_groups)
osmo_tdefs_reset(g->tdefs);
}

View File

@ -229,6 +229,7 @@ struct msgb *nanobts_gen_set_cell_attr(struct gsm_bts *bts)
{
const struct gsm_gprs_cell *cell = &bts->gprs.cell;
const struct gprs_rlc_cfg *rlcc = &cell->rlc_cfg;
const struct osmo_tdef_group *rlctg = &bts->timer_groups[OSMO_BSC_BTS_TDEF_GROUPS_RLC];
struct msgb *msgb;
uint8_t buf[2];
@ -249,17 +250,16 @@ struct msgb *nanobts_gen_set_cell_attr(struct gsm_bts *bts)
buf[1] = cell->bvci & 0xff;
msgb_tl16v_put(msgb, NM_ATT_IPACC_BVCI, 2, buf);
/* all timers in seconds, unless otherwise stated */
const struct abis_nm_ipacc_att_rlc_cfg rlc_cfg = {
.t3142 = rlcc->parameter[RLC_T3142],
.t3169 = rlcc->parameter[RLC_T3169],
.t3191 = rlcc->parameter[RLC_T3191],
.t3193_10ms = rlcc->parameter[RLC_T3193],
.t3195 = rlcc->parameter[RLC_T3195],
.n3101 = rlcc->parameter[RLC_N3101],
.n3103 = rlcc->parameter[RLC_N3103],
.n3105 = rlcc->parameter[RLC_N3105],
.rlc_cv_countdown = rlcc->parameter[CV_COUNTDOWN],
const struct abis_nm_ipacc_att_rlc_cfg rlc_cfg = (struct abis_nm_ipacc_att_rlc_cfg){
.t3142 = osmo_tdef_get(rlctg->tdefs, 3142, OSMO_TDEF_S, -1),
.t3169 = osmo_tdef_get(rlctg->tdefs, 3169, OSMO_TDEF_S, -1),
.t3191 = osmo_tdef_get(rlctg->tdefs, 3191, OSMO_TDEF_S, -1),
.t3193_10ms = osmo_tdef_get(rlctg->tdefs, 3193, OSMO_TDEF_MS, -1)/10,
.t3195 = osmo_tdef_get(rlctg->tdefs, 3195, OSMO_TDEF_S, -1),
.n3101 = osmo_tdef_get(rlctg->tdefs, 3101, OSMO_TDEF_CUSTOM, -1),
.n3103 = osmo_tdef_get(rlctg->tdefs, 3103, OSMO_TDEF_CUSTOM, -1),
.n3105 = osmo_tdef_get(rlctg->tdefs, 3105, OSMO_TDEF_CUSTOM, -1),
.rlc_cv_countdown = osmo_tdef_get(rlctg->tdefs, GSM_BTS_TDEF_ID_COUNTDOWN_VALUE, OSMO_TDEF_CUSTOM, -1)
};
msgb_tl16v_put(msgb, NM_ATT_IPACC_RLC_CFG, sizeof(rlc_cfg), (const uint8_t *)&rlc_cfg);
@ -293,8 +293,10 @@ struct msgb *nanobts_gen_set_cell_attr(struct gsm_bts *bts)
case GSM_BTS_TYPE_OSMOBTS:
{
const struct abis_nm_ipacc_att_rlc_cfg_2 rlc_cfg_2 = {
.t_dl_tbf_ext_10ms = htons(rlcc->parameter[T_DL_TBF_EXT] / 10),
.t_ul_tbf_ext_10ms = htons(rlcc->parameter[T_UL_TBF_EXT] / 10),
.t_dl_tbf_ext_10ms = htons(osmo_tdef_get(rlctg->tdefs, GSM_BTS_TDEF_ID_DL_TBF_DELAYED,
OSMO_TDEF_MS, -1)/10),
.t_ul_tbf_ext_10ms = htons(osmo_tdef_get(rlctg->tdefs, GSM_BTS_TDEF_ID_UL_TBF_EXT,
OSMO_TDEF_MS, -1)/10),
.initial_cs = rlcc->initial_cs,
};
msgb_tl16v_put(msgb, NM_ATT_IPACC_RLC_CFG_2,

View File

@ -52,6 +52,7 @@
#include <osmocom/bsc/bsc_stats.h>
#include <inttypes.h>
#include <limits.h>
#include "../../bscconfig.h"
@ -1699,6 +1700,8 @@ DEFUN_USRATTR(cfg_bts_gprs_cell_timer,
{
struct gsm_bts *bts = vty->index;
int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
/* TODO (BSSGP timer patch): If argument is one of BSSGP Timers strings, then translate to
* tdef index. Otherwise get tdef entry */
int val = atoi(argv[1]);
GPRS_CHECK_ENABLED(bts);
@ -1886,6 +1889,114 @@ DEFUN_USRATTR(cfg_bts_gprs_egprs_pkt_chan_req,
return CMD_SUCCESS;
}
/* 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] */
{
const char *group_arg = argc >= 1 ? argv[0] : NULL;
const char *T_arg = argc >= 2 ? argv[1] : NULL;
struct osmo_tdef_group *g;
struct gsm_bts *bts = vty->index;
GPRS_CHECK_ENABLED(bts);
/* The argument should be either "tea" or "software", but the VTY also allows partial arguments
* like "softw" or "t" (which can also be ambiguous). */
osmo_tdef_groups_for_each(g, bts->timer_groups) {
if (!group_arg || osmo_str_startswith(g->name, group_arg))
osmo_tdef_vty_show_cmd(vty, g->tdefs, T_arg, "%s: ", g->name);
}
return CMD_SUCCESS;
}
/* 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)] */
{
const char **timer_args;
struct osmo_tdef_group *g = NULL;
struct gsm_bts *bts = vty->index;
const char *group_arg = argv[0];
if (argc < 3)
return show_gprs_timer(self, vty, argc, argv);
GPRS_CHECK_ENABLED(bts);
timer_args = &argv[1];
OSMO_ASSERT(bts->timer_groups);
osmo_tdef_groups_for_each(g, bts->timer_groups) {
if (group_arg && !strcmp(g->name, group_arg))
return osmo_tdef_vty_set_cmd(vty, g->tdefs, timer_args);
}
return CMD_WARNING;
}
/* Adapted from libosmocore.git:src/vty/tdef_vty.c */
static char *add_group_args(void *talloc_ctx, char *dest, struct osmo_tdef_group *bts_g)
{
struct osmo_tdef_group *g;
osmo_talloc_asprintf(talloc_ctx, dest, "[(");
osmo_tdef_groups_for_each(g, bts_g) {
osmo_talloc_asprintf(talloc_ctx, dest, "%s%s",
(g == bts_g) ? "" : "|",
g->name);
}
osmo_talloc_asprintf(talloc_ctx, dest, ")]");
return dest;
}
/* Adapted from libosmocore.git:src/vty/tdef_vty.c */
static char *add_group_docs(void *talloc_ctx, char *dest, struct osmo_tdef_group *bts_g)
{
struct osmo_tdef_group *g;
osmo_tdef_groups_for_each(g, bts_g)
osmo_talloc_asprintf(talloc_ctx, dest, "%s\n", g->desc);
return dest;
}
/* Taken from libosmocore.git:src/vty/tdef_vty.c */
static char *timer_command_string(const char *prefix, const char *suffix, struct osmo_tdef_group *bts_g)
{
char *dest = NULL;
osmo_talloc_asprintf(tall_bsc_ctx, dest, "%s ", prefix);
dest = add_group_args(tall_bsc_ctx, dest, bts_g);
osmo_talloc_asprintf(tall_bsc_ctx, dest, " %s", suffix);
return dest;
}
/* Taken from libosmocore.git:src/vty/tdef_vty.c */
static char *timer_doc_string(const char *prefix, const char *suffix, struct osmo_tdef_group *bts_g)
{
char *dest = NULL;
osmo_talloc_asprintf(tall_bsc_ctx, dest, "%s ", prefix);
dest = add_group_docs(tall_bsc_ctx, dest, bts_g);
osmo_talloc_asprintf(tall_bsc_ctx, dest, " %s", suffix);
return dest;
}
/* Use per-BTS timer templates to set command strings */
static void set_show_cmd_strs(struct osmo_tdef_group *template)
{
show_gprs_timer_cmd.string = timer_command_string("show gprs timer", OSMO_TDEF_VTY_ARG_T_OPTIONAL, template);
show_gprs_timer_cmd.doc = timer_doc_string(SHOW_STR GPRS_TEXT BTS_VTY_SHOW_TIMER_STR, OSMO_TDEF_VTY_DOC_T, template);
}
static void set_cfg_cmd_strs(struct osmo_tdef_group *g)
{
cfg_gprs_timer_cmd.string = timer_command_string("gprs timer", OSMO_TDEF_VTY_ARG_SET_OPTIONAL, g);
cfg_gprs_timer_cmd.doc = timer_doc_string(GPRS_TEXT "Configure or show timers for this BTS\n",
OSMO_TDEF_VTY_DOC_SET, g);
}
static void bts_vty_tdef_cmds_init(unsigned int parent_cfg_node)
{
set_show_cmd_strs(bts_gprs_timer_template_groups);
set_cfg_cmd_strs(bts_gprs_timer_template_groups);
install_element(parent_cfg_node, &show_gprs_timer_cmd);
install_element(parent_cfg_node, &cfg_gprs_timer_cmd);
}
DEFUN_USRATTR(cfg_bts_no_gprs_egprs_pkt_chan_req,
cfg_bts_no_gprs_egprs_pkt_chan_req_cmd,
X(BSC_VTY_ATTR_RESTART_ABIS_RSL_LINK),
@ -4167,6 +4278,40 @@ void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
bts_dump_vty_features(vty, bts);
}
/* Used by show_bts_rlc_timers() and config_write_bts_gprs(). Note: Does not check validity of argument 'bts_nr' */
unsigned int bts_write_group_timers(struct vty *vty, const char *prefix, int bts_nr,
unsigned gsm_bts_tdef_group, const char *T_arg, bool print_to_file)
{
OSMO_ASSERT(gsm_bts_tdef_group < _NUM_OSMO_BSC_BTS_TDEF_GROUPS);
struct osmo_tdef_group *g;
struct gsm_network *net = gsmnet_from_vty(vty);
struct osmo_tdef *t;
struct osmo_tdef *T_arg_parsed = NULL;
if (bts_nr >= net->num_bts) {
if (!print_to_file)
vty_out(vty, "%% can't find BTS '%d'%s", bts_nr, VTY_NEWLINE);
return CMD_WARNING;
}
g = &gsm_bts_num(net, bts_nr)->timer_groups[gsm_bts_tdef_group];
if (T_arg && !(T_arg_parsed = osmo_tdef_vty_parse_T_arg(vty, g->tdefs, T_arg)))
return CMD_WARNING;
osmo_tdef_for_each(t, g->tdefs) {
/* Skip all but timer specified by T_arg (if provided), skip defaults when printing to file */
if ((T_arg_parsed && T_arg_parsed->T && t->T != T_arg_parsed->T) ||
(print_to_file && t->val == t->default_val))
continue;
/* output for "gprs rlc" as group name will be "gprs rlc timer [TX]<timer ID>"(without indent),
* so the output will be formatted similar to what is there already */
if (print_to_file) {
vty_out(vty, "%stimer %s ", prefix ? : "", g->name);
vty_out(vty, OSMO_T_FMT " %lu%s", OSMO_T_FMT_ARGS(t->T), t->val, VTY_NEWLINE);
} else {
osmo_tdef_vty_out_one(vty, t, "bts-%d-%s: ", bts_nr, g->name);
}
}
return CMD_SUCCESS;
}
static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
{
unsigned int i;
@ -4219,6 +4364,8 @@ static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
vty_out(vty, " gprs nsvc %u remote udp port %u%s",
i, remote.port, VTY_NEWLINE);
}
for (i = 0; i < _NUM_OSMO_BSC_BTS_TDEF_GROUPS; i++)
bts_write_group_timers(vty, " gprs ", bts->nr, i, NULL, true);
/* EGPRS specific parameters */
if (bts->gprs.mode == BTS_GPRS_EGPRS) {
@ -4982,6 +5129,8 @@ int bts_vty_init(void)
install_element(BTS_NODE, &cfg_bts_ncc_permitted_all_cmd);
install_element(BTS_NODE, &cfg_bts_ncc_permitted_cmd);
bts_vty_tdef_cmds_init(BTS_NODE);
neighbor_ident_vty_init();
/* See also handover commands added on bts level from handover_vty.c */
@ -5008,6 +5157,5 @@ int bts_vty_init(void)
install_element(POWER_CTRL_NODE, &cfg_power_ctrl_ci_avg_algo_cmd);
install_element(POWER_CTRL_NODE, &cfg_power_ctrl_ci_avg_osmo_ewma_cmd);
return bts_trx_vty_init();
}

View File

@ -179,6 +179,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];
struct gsm_bts_sm *bts_sm;
struct gsm_gprs_nsvc *nsvc;
struct gsm_bts_trx *trx;
@ -218,15 +219,19 @@ static int pcu_tx_info_ind(struct gsm_bts *bts)
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 = rlcc->parameter[RLC_T3142];
info_ind->t3169 = rlcc->parameter[RLC_T3169];
info_ind->t3191 = rlcc->parameter[RLC_T3191];
info_ind->t3193_10ms = rlcc->parameter[RLC_T3193];
info_ind->t3195 = rlcc->parameter[RLC_T3195];
info_ind->n3101 = rlcc->parameter[RLC_N3101];
info_ind->n3103 = rlcc->parameter[RLC_N3103];
info_ind->n3105 = rlcc->parameter[RLC_N3105];
info_ind->cv_countdown = rlcc->parameter[CV_COUNTDOWN];
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);
if (rlcc->cs_mask & (1 << GPRS_CS1))
info_ind->flags |= PCU_IF_FLAG_CS1;
if (rlcc->cs_mask & (1 << GPRS_CS2))
@ -256,9 +261,11 @@ static int pcu_tx_info_ind(struct gsm_bts *bts)
info_ind->flags |= PCU_IF_FLAG_MCS9;
}
/* TODO: isn't dl_tbf_ext wrong?: * 10 and no ntohs */
info_ind->dl_tbf_ext = rlcc->parameter[T_DL_TBF_EXT];
info_ind->dl_tbf_ext =
osmo_tdef_get(rlctg->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 = rlcc->parameter[T_UL_TBF_EXT];
info_ind->ul_tbf_ext =
osmo_tdef_get(rlctg->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;

View File

@ -56,3 +56,108 @@ OsmoBSC(config-net)# exit
OsmoBSC(config)# exit
OsmoBSC# show running-config
... !ncc-permitted
OsmoBSC# # check per-BTS timers
OsmoBSC# configure terminal
OsmoBSC(config)# network
OsmoBSC(config-net)# bts 0
OsmoBSC(config-net-bts)# gprs mode none
OsmoBSC(config-net-bts)# show gprs timer
% GPRS is not enabled on BTS 0
OsmoBSC(config-net-bts)# gprs mode gprs
OsmoBSC(config-net-bts)# show gprs timer
rlc: T3142 = 20 s Used during packet access on CCCH/while in dedicated mode. Started after the receipt of IMMEDIATE ASSIGNMENT REJECT or DTM REJECT or EC IMMEDIATE ASSIGNMENT REJECT (default: 20 s, range: [0 .. 255])
rlc: T3169 = 5 s Release radio resource (TFI, USF) timer (linked to N3103, N3103) (default: 5 s, range: [0 .. 255])
rlc: T3191 = 5 s Downlink TBF (Temporary Block Flow) Release downlink RLC data block retransmission timer (default: 5 s, range: [0 .. 255])
rlc: T3193 = 1600 ms Downlink TBF Release timer (default: 1600 ms, range: [0 .. 2550])
rlc: T3195 = 5 s Timer for TFI release on N3105 overflow (unresponsive MS) (default: 5 s, range: [0 .. 255])
rlc: X1 = 15 CV: Countdown value/remaining blocks to transmit (default: 15, range: [0 .. 255])
rlc: X2 = 2500 ms "In the extended uplink TBF mode, the uplink TBF may be maintained during temporary inactive periods, where the mobile station has no RLC information to send." (3GPP TS 44.060 Version 6.14.0) (default: 2500 ms, range: [0 .. 5000])
rlc: X3 = 2500 ms A delayed release of the downlink TBF is when the release of the downlink TBF is delayed following the transmission of a final data block, rather than instantly releasing the TBF (default: 2500 ms, range: [0 .. 5000])
rlc: T3101 = 10 N3101: Maximum USFs without response from the MS (default: 10, range: [9 .. 255])
rlc: T3103 = 4 N3103: Maximum PACKET UPLINK ACK/NACK messages within a TBF unacknowledged by MS (default: 4, range: [0 .. 255])
rlc: T3105 = 8 N3105: Maximum allocated data blocks without RLC/MAC control reply from MS (default: 8, range: [0 .. 255])
OsmoBSC(config-net-bts)# show gprs timer rlc T3101
rlc: T3101 = 10 N3101: Maximum USFs without response from the MS (default: 10, range: [9 .. 255])
OsmoBSC(config-net-bts)# show gprs timer rlc T3105
rlc: T3105 = 8 N3105: Maximum allocated data blocks without RLC/MAC control reply from MS (default: 8, range: [0 .. 255])
OsmoBSC(config-net-bts)# gprs timer
rlc: T3142 = 20 s Used during packet access on CCCH/while in dedicated mode. Started after the receipt of IMMEDIATE ASSIGNMENT REJECT or DTM REJECT or EC IMMEDIATE ASSIGNMENT REJECT (default: 20 s, range: [0 .. 255])
rlc: T3169 = 5 s Release radio resource (TFI, USF) timer (linked to N3103, N3103) (default: 5 s, range: [0 .. 255])
rlc: T3191 = 5 s Downlink TBF (Temporary Block Flow) Release downlink RLC data block retransmission timer (default: 5 s, range: [0 .. 255])
rlc: T3193 = 1600 ms Downlink TBF Release timer (default: 1600 ms, range: [0 .. 2550])
rlc: T3195 = 5 s Timer for TFI release on N3105 overflow (unresponsive MS) (default: 5 s, range: [0 .. 255])
rlc: X1 = 15 CV: Countdown value/remaining blocks to transmit (default: 15, range: [0 .. 255])
rlc: X2 = 2500 ms "In the extended uplink TBF mode, the uplink TBF may be maintained during temporary inactive periods, where the mobile station has no RLC information to send." (3GPP TS 44.060 Version 6.14.0) (default: 2500 ms, range: [0 .. 5000])
rlc: X3 = 2500 ms A delayed release of the downlink TBF is when the release of the downlink TBF is delayed following the transmission of a final data block, rather than instantly releasing the TBF (default: 2500 ms, range: [0 .. 5000])
rlc: T3101 = 10 N3101: Maximum USFs without response from the MS (default: 10, range: [9 .. 255])
rlc: T3103 = 4 N3103: Maximum PACKET UPLINK ACK/NACK messages within a TBF unacknowledged by MS (default: 4, range: [0 .. 255])
rlc: T3105 = 8 N3105: Maximum allocated data blocks without RLC/MAC control reply from MS (default: 8, range: [0 .. 255])
OsmoBSC(config-net-bts)# #### Show/set timer for this BTS
OsmoBSC(config-net-bts)# gprs timer rlc T3142
rlc: T3142 = 20 s Used during packet access on CCCH/while in dedicated mode. Started after the receipt of IMMEDIATE ASSIGNMENT REJECT or DTM REJECT or EC IMMEDIATE ASSIGNMENT REJECT (default: 20 s, range: [0 .. 255])
OsmoBSC(config-net-bts)# gprs timer rlc T3142 10
OsmoBSC(config-net-bts)# gprs timer rlc T3142
rlc: T3142 = 10 s Used during packet access on CCCH/while in dedicated mode. Started after the receipt of IMMEDIATE ASSIGNMENT REJECT or DTM REJECT or EC IMMEDIATE ASSIGNMENT REJECT (default: 20 s, range: [0 .. 255])
OsmoBSC(config-net-bts)# exit
OsmoBSC(config-net)# #### Set up bts 2 for testing per-BTS timers
OsmoBSC(config-net)# bts 2
OsmoBSC(config-net-bts)# gprs mode gprs
OsmoBSC(config-net-bts)# gprs timer rlc T3142
rlc: T3142 = 20 s Used during packet access on CCCH/while in dedicated mode. Started after the receipt of IMMEDIATE ASSIGNMENT REJECT or DTM REJECT or EC IMMEDIATE ASSIGNMENT REJECT (default: 20 s, range: [0 .. 255])
OsmoBSC(config-net-bts)# gprs timer rlc T3142 5
OsmoBSC(config-net-bts)# gprs timer rlc T3142
rlc: T3142 = 5 s Used during packet access on CCCH/while in dedicated mode. Started after the receipt of IMMEDIATE ASSIGNMENT REJECT or DTM REJECT or EC IMMEDIATE ASSIGNMENT REJECT (default: 20 s, range: [0 .. 255])
OsmoBSC(config-net-bts)# exit
OsmoBSC(config-net)# exit
OsmoBSC(config)# exit
OsmoBSC# ## Test global command for showing per-BTS timers
OsmoBSC# show bts 0 gprs timer
bts-0-rlc: T3142 = 10 s Used during packet access on CCCH/while in dedicated mode. Started after the receipt of IMMEDIATE ASSIGNMENT REJECT or DTM REJECT or EC IMMEDIATE ASSIGNMENT REJECT (default: 20 s, range: [0 .. 255])
bts-0-rlc: T3169 = 5 s Release radio resource (TFI, USF) timer (linked to N3103, N3103) (default: 5 s, range: [0 .. 255])
bts-0-rlc: T3191 = 5 s Downlink TBF (Temporary Block Flow) Release downlink RLC data block retransmission timer (default: 5 s, range: [0 .. 255])
bts-0-rlc: T3193 = 1600 ms Downlink TBF Release timer (default: 1600 ms, range: [0 .. 2550])
bts-0-rlc: T3195 = 5 s Timer for TFI release on N3105 overflow (unresponsive MS) (default: 5 s, range: [0 .. 255])
bts-0-rlc: X1 = 15 CV: Countdown value/remaining blocks to transmit (default: 15, range: [0 .. 255])
bts-0-rlc: X2 = 2500 ms "In the extended uplink TBF mode, the uplink TBF may be maintained during temporary inactive periods, where the mobile station has no RLC information to send." (3GPP TS 44.060 Version 6.14.0) (default: 2500 ms, range: [0 .. 5000])
bts-0-rlc: X3 = 2500 ms A delayed release of the downlink TBF is when the release of the downlink TBF is delayed following the transmission of a final data block, rather than instantly releasing the TBF (default: 2500 ms, range: [0 .. 5000])
bts-0-rlc: T3101 = 10 N3101: Maximum USFs without response from the MS (default: 10, range: [9 .. 255])
bts-0-rlc: T3103 = 4 N3103: Maximum PACKET UPLINK ACK/NACK messages within a TBF unacknowledged by MS (default: 4, range: [0 .. 255])
bts-0-rlc: T3105 = 8 N3105: Maximum allocated data blocks without RLC/MAC control reply from MS (default: 8, range: [0 .. 255])
OsmoBSC# show bts 2 gprs timer rlc T3142
bts-2-rlc: T3142 = 5 s Used during packet access on CCCH/while in dedicated mode. Started after the receipt of IMMEDIATE ASSIGNMENT REJECT or DTM REJECT or EC IMMEDIATE ASSIGNMENT REJECT (default: 20 s, range: [0 .. 255])
OsmoBSC# ## Test gprs mode check
OsmoBSC# configure terminal
OsmoBSC(config)# network
OsmoBSC(config-net)# bts 2
OsmoBSC(config-net-bts)# gprs mode none
OsmoBSC(config-net-bts)# exit
OsmoBSC(config-net)# exit
OsmoBSC(config)# exit
OsmoBSC# disable
OsmoBSC> show bts 2 gprs timer rlc T3142
% GPRS is not enabled on BTS 2
OsmoBSC> enable
OsmoBSC# configure terminal
OsmoBSC(config)# network
OsmoBSC(config-net)# bts 2
OsmoBSC(config-net-bts)# gprs mode gprs
OsmoBSC(config-net-bts)# exit
OsmoBSC(config-net)# exit
OsmoBSC(config)# exit
OsmoBSC# disable
OsmoBSC> show bts 2 gprs timer rlc T3142
bts-2-rlc: T3142 = 5 s Used during packet access on CCCH/while in dedicated mode. Started after the receipt of IMMEDIATE ASSIGNMENT REJECT or DTM REJECT or EC IMMEDIATE ASSIGNMENT REJECT (default: 20 s, range: [0 .. 255])

View File

@ -34,6 +34,8 @@
#include <string.h>
extern struct gsm_bts_model bts_model_nanobts;
extern void bts_gprs_timer_groups_init(struct gsm_bts *bts);
extern void bts_grprs_tdef_groups_init(void);
static void test_nanobts_gen_set_bts_attr(struct gsm_bts *bts, uint8_t *expected)
{
@ -152,9 +154,11 @@ int main(int argc, char **argv)
/* Allocate environmental structs (bts, net, trx) */
net = talloc_zero(ctx, struct gsm_network);
INIT_LLIST_HEAD(&net->bts_list);
net->T_defs = gsm_network_T_defs;
osmo_tdefs_reset(net->T_defs = gsm_network_T_defs);
bts_grprs_tdef_groups_init();
gsm_bts_model_register(&bts_model_nanobts);
bts = gsm_bts_alloc_register(net, GSM_BTS_TYPE_NANOBTS, 63);
bts_gprs_timer_groups_init(bts);
OSMO_ASSERT(bts);
bts->network = net;
trx = talloc_zero(ctx, struct gsm_bts_trx);
@ -208,12 +212,13 @@ int main(int argc, char **argv)
bts->gprs.rac = 0x00;
bts->gprs.cell.bvci = 2;
bts->gprs.mode = BTS_GPRS_GPRS;
uint8_t attr_cell_expected[] =
{ 0x9a, 0x00, 0x01, 0x00, 0x9c, 0x00, 0x02, 0x05, 0x03, 0x9e, 0x00,
0x02, 0x00, 0x02, 0xa3, 0x00, 0x09, 0x14, 0x05, 0x05, 0xa0,
0x05, 0x0a, 0x04, 0x08,
0x0f, 0xa8, 0x00, 0x02, 0x0f, 0x00, 0xa9, 0x00, 0x05, 0x00,
0xfa, 0x00, 0xfa, 0x02, 0xac, 0x00, 0x01, 0x06,
uint8_t attr_cell_expected[] = {
0x9a, 0x00, 0x01, 0x00, 0x9c, 0x00, 0x02, 0x05, 0x03, 0x9e, 0x00,
0x02, 0x00, 0x02, 0xa3, 0x00, 0x09,
/* T3142, T3169, T3191, T3193/10, T3195, N3101, N3103, N3105, CV */
0x14, 0x05, 0x05, 0xa0, 0x05, 0x0a, 0x04, 0x08, 0x0f,
0xa8, 0x00, 0x02, 0x0f, 0x00, 0xa9, 0x00, 0x05, 0x00,
0xfa, 0x00, 0xfa, 0x02, 0xac, 0x00, 0x01, 0x06,
};
/* Parameters needed to test nanobts_gen_set_nsvc_attr() */