Move T_defs_pcu from BTS to PCU object

Change-Id: I0cac5c12dff2e90b52d00383a00b4b94a9603a0a
changes/79/22179/3
Pau Espin 2 years ago committed by pespin
parent ac3fd12026
commit 924aaad4bc
  1. 15
      src/bts.cpp
  2. 1
      src/bts.h
  3. 6
      src/gprs_bssgp_pcu.cpp
  4. 15
      src/gprs_pcu.c
  5. 2
      src/gprs_pcu.h
  6. 4
      src/gprs_rlcmac_sched.cpp
  7. 26
      src/pcu_vty.c
  8. 2
      src/tbf.cpp
  9. 2
      src/tbf_dl.cpp
  10. 21
      tests/tbf/TbfTest.cpp

@ -76,17 +76,6 @@ static struct osmo_tdef T_defs_bts[] = {
{ .T=3195, .default_val=5, .unit=OSMO_TDEF_S, .desc="Reuse of TFI(s) upon no response from the MS (radio failure or cell change) for TBF/MBMS radio bearer (s)", .val=0 },
{ .T=0, .default_val=0, .unit=OSMO_TDEF_S, .desc=NULL, .val=0 } /* empty item at the end */
};
static struct osmo_tdef T_defs_pcu[] = {
{ .T=1, .default_val=30, .unit=OSMO_TDEF_S, .desc="BSSGP (un)blocking procedures timer (s)", .val=0 },
{ .T=2, .default_val=30, .unit=OSMO_TDEF_S, .desc="BSSGP reset procedure timer (s)", .val=0 },
{ .T=3190, .default_val=5, .unit=OSMO_TDEF_S, .desc="Return to packet idle mode after Packet DL Assignment on CCCH (s)", .val=0},
{ .T=-2000, .default_val=2, .unit=OSMO_TDEF_MS, .desc="Tbf reject for PRR timer (ms)", .val=0 },
{ .T=-2001, .default_val=2, .unit=OSMO_TDEF_S, .desc="PACCH assignment timer (s)", .val=0 },
{ .T=-2002, .default_val=200, .unit=OSMO_TDEF_MS, .desc="Waiting after IMM.ASS confirm timer (ms)", .val=0 },
{ .T=-2030, .default_val=60, .unit=OSMO_TDEF_S, .desc="Time to keep an idle MS object alive (s)", .val=0 }, /* slightly above T3314 (default 44s, 24.008, 11.2.2) */
{ .T=-2031, .default_val=2000, .unit=OSMO_TDEF_MS, .desc="Time to keep an idle DL TBF alive (ms)", .val=0 },
{ .T=0, .default_val=0, .unit=OSMO_TDEF_S, .desc=NULL, .val=0 } /* empty item at the end */
};
/**
* For gcc-4.4 compat do not use extended initializer list but keep the
@ -267,9 +256,7 @@ static void bts_init(struct gprs_rlcmac_bts *bts, BTS* bts_obj)
bts->bts = bts_obj;
bts->dl_tbf_preemptive_retransmission = true;
bts->T_defs_bts = T_defs_bts;
bts->T_defs_pcu = T_defs_pcu;
osmo_tdefs_reset(bts->T_defs_bts);
osmo_tdefs_reset(bts->T_defs_pcu);
/* initialize back pointers */
for (size_t trx_no = 0; trx_no < ARRAY_SIZE(bts->trx); ++trx_no) {
@ -1135,7 +1122,7 @@ GprsMs *BTS::ms_alloc(uint8_t ms_class, uint8_t egprs_ms_class)
GprsMs *ms;
ms = ms_store().create_ms();
ms_set_timeout(ms, osmo_tdef_get(m_bts.T_defs_pcu, -2030, OSMO_TDEF_S, -1));
ms_set_timeout(ms, osmo_tdef_get(pcu->T_defs, -2030, OSMO_TDEF_S, -1));
ms_set_ms_class(ms, ms_class);
ms_set_egprs_ms_class(ms, egprs_ms_class);

@ -101,7 +101,6 @@ struct gprs_rlcmac_bts {
uint32_t llc_codel_interval_msec; /* 0=disabled, -1=use default interval */
/* Timer defintions */
struct osmo_tdef *T_defs_bts; /* timers controlled by BTS, received through PCUIF */
struct osmo_tdef *T_defs_pcu; /* timers controlled by PCU */
uint8_t n3101;
uint8_t n3103;
uint8_t n3105;

@ -914,7 +914,7 @@ static void bvc_timeout(void *_priv)
if (!the_pcu->bssgp.bvc_sig_reset) {
LOGP(DBSSGP, LOGL_INFO, "Sending reset on BVCI 0\n");
bssgp_tx_bvc_reset(the_pcu->bssgp.bctx, 0, BSSGP_CAUSE_OML_INTERV);
secs = osmo_tdef_get(the_pcu->bssgp.bts->T_defs_pcu, 2, OSMO_TDEF_S, -1);
secs = osmo_tdef_get(the_pcu->T_defs, 2, OSMO_TDEF_S, -1);
osmo_timer_schedule(&the_pcu->bssgp.bvc_timer, secs, 0);
return;
}
@ -923,7 +923,7 @@ static void bvc_timeout(void *_priv)
LOGP(DBSSGP, LOGL_INFO, "Sending reset on BVCI %d\n",
the_pcu->bssgp.bctx->bvci);
bssgp_tx_bvc_reset(the_pcu->bssgp.bctx, the_pcu->bssgp.bctx->bvci, BSSGP_CAUSE_OML_INTERV);
secs = osmo_tdef_get(the_pcu->bssgp.bts->T_defs_pcu, 2, OSMO_TDEF_S, -1);
secs = osmo_tdef_get(the_pcu->T_defs, 2, OSMO_TDEF_S, -1);
osmo_timer_schedule(&the_pcu->bssgp.bvc_timer, secs, 0);
return;
}
@ -932,7 +932,7 @@ static void bvc_timeout(void *_priv)
LOGP(DBSSGP, LOGL_INFO, "Sending unblock on BVCI %d\n",
the_pcu->bssgp.bctx->bvci);
bssgp_tx_bvc_unblock(the_pcu->bssgp.bctx);
secs = osmo_tdef_get(the_pcu->bssgp.bts->T_defs_pcu, 1, OSMO_TDEF_S, -1);
secs = osmo_tdef_get(the_pcu->T_defs, 1, OSMO_TDEF_S, -1);
osmo_timer_schedule(&the_pcu->bssgp.bvc_timer, secs, 0);
return;
}

@ -27,6 +27,18 @@
struct gprs_pcu *the_pcu;
static struct osmo_tdef T_defs_pcu[] = {
{ .T=1, .default_val=30, .unit=OSMO_TDEF_S, .desc="BSSGP (un)blocking procedures timer (s)", .val=0 },
{ .T=2, .default_val=30, .unit=OSMO_TDEF_S, .desc="BSSGP reset procedure timer (s)", .val=0 },
{ .T=3190, .default_val=5, .unit=OSMO_TDEF_S, .desc="Return to packet idle mode after Packet DL Assignment on CCCH (s)", .val=0},
{ .T=-2000, .default_val=2, .unit=OSMO_TDEF_MS, .desc="Tbf reject for PRR timer (ms)", .val=0 },
{ .T=-2001, .default_val=2, .unit=OSMO_TDEF_S, .desc="PACCH assignment timer (s)", .val=0 },
{ .T=-2002, .default_val=200, .unit=OSMO_TDEF_MS, .desc="Waiting after IMM.ASS confirm timer (ms)", .val=0 },
{ .T=-2030, .default_val=60, .unit=OSMO_TDEF_S, .desc="Time to keep an idle MS object alive (s)", .val=0 }, /* slightly above T3314 (default 44s, 24.008, 11.2.2) */
{ .T=-2031, .default_val=2000, .unit=OSMO_TDEF_MS, .desc="Time to keep an idle DL TBF alive (ms)", .val=0 },
{ .T=0, .default_val=0, .unit=OSMO_TDEF_S, .desc=NULL, .val=0 } /* empty item at the end */
};
struct gprs_pcu *gprs_pcu_alloc(void *ctx)
{
struct gprs_pcu *pcu;
@ -39,6 +51,9 @@ struct gprs_pcu *gprs_pcu_alloc(void *ctx)
pcu->vty.max_mcs_ul = MAX_EDGE_MCS;
pcu->vty.max_mcs_dl = MAX_EDGE_MCS;
pcu->T_defs = T_defs_pcu;
osmo_tdefs_reset(pcu->T_defs);
return pcu;
}

@ -86,6 +86,8 @@ struct gprs_pcu {
alloc_algorithm_func_t alloc_algorithm;
struct gprs_bssgp_pcu bssgp;
struct osmo_tdef *T_defs; /* timers controlled by PCU */
};

@ -252,8 +252,8 @@ static inline enum tbf_dl_prio tbf_compute_priority(const struct gprs_rlcmac_bts
uint8_t ts, uint32_t fn, int age)
{
const gprs_rlc_dl_window *w = static_cast<gprs_rlc_dl_window *>(tbf->window());
unsigned long msecs_t3190 = osmo_tdef_get(bts->T_defs_pcu, 3190, OSMO_TDEF_MS, -1);
unsigned long dl_tbf_idle_msec = osmo_tdef_get(bts->T_defs_pcu, -2031, OSMO_TDEF_MS, -1);
unsigned long msecs_t3190 = osmo_tdef_get(the_pcu->T_defs, 3190, OSMO_TDEF_MS, -1);
unsigned long dl_tbf_idle_msec = osmo_tdef_get(the_pcu->T_defs, -2031, OSMO_TDEF_MS, -1);
int age_thresh1 = msecs_to_frames(200);
int age_thresh2 = msecs_to_frames(OSMO_MIN(msecs_t3190/2, dl_tbf_idle_msec));

@ -249,7 +249,7 @@ static int config_write_pcu(struct vty *vty)
else
vty_out(vty, " gb-dialect classic%s", VTY_NEWLINE);
osmo_tdef_vty_write(vty, bts->T_defs_pcu, " timer ");
osmo_tdef_vty_write(vty, the_pcu->T_defs, " timer ");
return CMD_SUCCESS;
}
@ -856,9 +856,7 @@ DEFUN_DEPRECATED(cfg_pcu_dl_tbf_idle_time,
{
vty_out(vty, "%% 'dl-tbf-idle-time' is now deprecated: use 'timer X2031 <val>' instead%s", VTY_NEWLINE);
struct gprs_rlcmac_bts *bts = bts_main_data();
if (osmo_tdef_set(bts->T_defs_pcu, -2031, atoi(argv[0]), OSMO_TDEF_MS) < 0)
if (osmo_tdef_set(the_pcu->T_defs, -2031, atoi(argv[0]), OSMO_TDEF_MS) < 0)
return CMD_WARNING;
return CMD_SUCCESS;
}
@ -870,9 +868,7 @@ DEFUN_DEPRECATED(cfg_pcu_no_dl_tbf_idle_time,
{
vty_out(vty, "%% 'no dl-tbf-idle-time' is now deprecated: use 'timer X2031 0' instead%s", VTY_NEWLINE);
struct gprs_rlcmac_bts *bts = bts_main_data();
if (osmo_tdef_set(bts->T_defs_pcu, -2031, 0, OSMO_TDEF_MS) < 0)
if (osmo_tdef_set(the_pcu->T_defs, -2031, 0, OSMO_TDEF_MS) < 0)
return CMD_WARNING;
return CMD_SUCCESS;
}
@ -912,10 +908,7 @@ DEFUN_DEPRECATED(cfg_pcu_ms_idle_time,
MS_IDLE_TIME_STR "idle time in sec")
{
vty_out(vty, "%% 'ms-idle-time' is now deprecated: use 'timer X2030 <val>' instead%s", VTY_NEWLINE);
struct gprs_rlcmac_bts *bts = bts_main_data();
if (osmo_tdef_set(bts->T_defs_pcu, -2030, atoi(argv[0]), OSMO_TDEF_S) < 0)
if (osmo_tdef_set(the_pcu->T_defs, -2030, atoi(argv[0]), OSMO_TDEF_S) < 0)
return CMD_WARNING;
return CMD_SUCCESS;
}
@ -926,10 +919,7 @@ DEFUN_DEPRECATED(cfg_pcu_no_ms_idle_time,
NO_STR MS_IDLE_TIME_STR)
{
vty_out(vty, "%% 'no ms-idle-time' is now deprecated: use 'timer X2030 0' instead%s", VTY_NEWLINE);
struct gprs_rlcmac_bts *bts = bts_main_data();
if (osmo_tdef_set(bts->T_defs_pcu, -2030, 0, OSMO_TDEF_S) < 0)
if (osmo_tdef_set(the_pcu->T_defs, -2030, 0, OSMO_TDEF_S) < 0)
return CMD_WARNING;
return CMD_SUCCESS;
}
@ -1138,9 +1128,8 @@ DEFUN(show_timer, show_timer_cmd,
SHOW_STR "Show PCU timers\n"
OSMO_TDEF_VTY_DOC_T)
{
struct gprs_rlcmac_bts *bts = bts_main_data();
const char *T_arg = argc > 0 ? argv[0] : NULL;
return osmo_tdef_vty_show_cmd(vty, bts->T_defs_pcu, T_arg, NULL);
return osmo_tdef_vty_show_cmd(vty, the_pcu->T_defs, T_arg, NULL);
}
DEFUN_ATTR(cfg_pcu_timer, cfg_pcu_timer_cmd,
@ -1149,11 +1138,10 @@ DEFUN_ATTR(cfg_pcu_timer, cfg_pcu_timer_cmd,
OSMO_TDEF_VTY_DOC_SET,
CMD_ATTR_IMMEDIATE)
{
struct gprs_rlcmac_bts *bts = bts_main_data();
/* If any arguments are missing, redirect to 'show' */
if (argc < 2)
return show_timer(self, vty, argc, argv);
return osmo_tdef_vty_set_cmd(vty, bts->T_defs_pcu, argv);
return osmo_tdef_vty_set_cmd(vty, the_pcu->T_defs, argv);
}
DEFUN(show_tbf,

@ -493,7 +493,7 @@ void gprs_rlcmac_tbf::t_start(enum tbf_timers t, int T, const char *reason, bool
struct osmo_tdef *tdef;
if (!(tdef = osmo_tdef_get_entry(bts->bts_data()->T_defs_bts, T)))
tdef = osmo_tdef_get_entry(bts->bts_data()->T_defs_pcu, T);
tdef = osmo_tdef_get_entry(bts->pcu->T_defs, T);
if (t >= T_MAX || !tdef) {
LOGPSRC(DTBF, LOGL_ERROR, file, line, "%s attempting to start unknown timer %s [%s], cur_fn=%d\n",

@ -1365,7 +1365,7 @@ bool gprs_rlcmac_dl_tbf::keep_open(unsigned fn) const
int keep_time_frames;
unsigned long dl_tbf_idle_msec;
dl_tbf_idle_msec = osmo_tdef_get(bts_data()->T_defs_pcu, -2031, OSMO_TDEF_MS, -1);
dl_tbf_idle_msec = osmo_tdef_get(the_pcu->T_defs, -2031, OSMO_TDEF_MS, -1);
if (dl_tbf_idle_msec == 0)
return false;

@ -176,8 +176,8 @@ static void setup_bts(BTS *the_bts, uint8_t ts_no, uint8_t cs = 1)
the_pcu->alloc_algorithm = alloc_algorithm_a;
bts->initial_cs_dl = cs;
bts->initial_cs_ul = cs;
osmo_tdef_set(bts->T_defs_pcu, -2030, 0, OSMO_TDEF_S);
osmo_tdef_set(bts->T_defs_pcu, -2031, 0, OSMO_TDEF_S);
osmo_tdef_set(the_pcu->T_defs, -2030, 0, OSMO_TDEF_S);
osmo_tdef_set(the_pcu->T_defs, -2031, 0, OSMO_TDEF_S);
trx = &bts->trx[0];
trx->pdch[ts_no].enable();
@ -340,7 +340,6 @@ static void test_tbf_delayed_release()
{
the_pcu->bts = bts_alloc(the_pcu);
BTS *the_bts = the_pcu->bts;
gprs_rlcmac_bts *bts;
uint8_t ts_no = 4;
unsigned i;
uint8_t ms_class = 45;
@ -355,10 +354,8 @@ static void test_tbf_delayed_release()
fprintf(stderr, "=== start %s ===\n", __func__);
bts = the_bts->bts_data();
setup_bts(the_bts, ts_no);
OSMO_ASSERT(osmo_tdef_set(bts->T_defs_pcu, -2031, 200, OSMO_TDEF_MS) == 0);
OSMO_ASSERT(osmo_tdef_set(the_pcu->T_defs, -2031, 200, OSMO_TDEF_MS) == 0);
dl_tbf = create_dl_tbf(the_bts, ms_class, 0, &trx_no);
dl_tbf->update_ms(tlli, GPRS_RLCMAC_DL_TBF);
@ -392,7 +389,7 @@ static void test_tbf_delayed_release()
RCV_ACK(false, dl_tbf, rbb); /* Receive an ACK */
/* Timeout (make sure fn % 52 remains valid) */
dl_tbf_idle_msec = osmo_tdef_get(bts->T_defs_pcu, -2031, OSMO_TDEF_MS, -1);
dl_tbf_idle_msec = osmo_tdef_get(the_pcu->T_defs, -2031, OSMO_TDEF_MS, -1);
fn += 52 * ((msecs_to_frames(dl_tbf_idle_msec + 100) + 51)/ 52);
request_dl_rlc_block(dl_tbf, &fn);
@ -541,7 +538,7 @@ static void test_tbf_dl_llc_loss()
setup_bts(the_bts, ts_no);
/* keep the MS object 10 seconds */
OSMO_ASSERT(osmo_tdef_set(bts->T_defs_pcu, -2030, 10, OSMO_TDEF_S) == 0);
OSMO_ASSERT(osmo_tdef_set(the_pcu->T_defs, -2030, 10, OSMO_TDEF_S) == 0);
gprs_bssgp_init(bts, 2234, 2234, 1, 1, false, 0, 0, 0);
@ -2552,7 +2549,7 @@ static void test_tbf_epdan_out_of_rx_window(void)
bts = the_bts->bts_data();
setup_bts(the_bts, ts_no);
OSMO_ASSERT(osmo_tdef_set(bts->T_defs_pcu, -2031, 200, OSMO_TDEF_MS) == 0);
OSMO_ASSERT(osmo_tdef_set(the_pcu->T_defs, -2031, 200, OSMO_TDEF_MS) == 0);
/* ARQ II */
bts->dl_arq_type = EGPRS_ARQ2;
@ -3084,7 +3081,7 @@ static void test_tbf_egprs_retx_dl(void)
bts = the_bts->bts_data();
bts->cs_downgrade_threshold = 0;
setup_bts(the_bts, ts_no);
OSMO_ASSERT(osmo_tdef_set(bts->T_defs_pcu, -2031, 200, OSMO_TDEF_MS) == 0);
OSMO_ASSERT(osmo_tdef_set(the_pcu->T_defs, -2031, 200, OSMO_TDEF_MS) == 0);
/* ARQ II */
bts->dl_arq_type = EGPRS_ARQ2;
@ -3114,7 +3111,7 @@ static void test_tbf_egprs_spb_dl(void)
bts = the_bts->bts_data();
bts->cs_downgrade_threshold = 0;
setup_bts(the_bts, ts_no);
OSMO_ASSERT(osmo_tdef_set(bts->T_defs_pcu, -2031, 200, OSMO_TDEF_MS) == 0);
OSMO_ASSERT(osmo_tdef_set(the_pcu->T_defs, -2031, 200, OSMO_TDEF_MS) == 0);
/* ARQ I resegmentation support */
bts->dl_arq_type = EGPRS_ARQ1;
@ -3147,7 +3144,7 @@ static void test_tbf_egprs_dl()
bts = the_bts->bts_data();
setup_bts(the_bts, ts_no);
OSMO_ASSERT(osmo_tdef_set(bts->T_defs_pcu, -2031, 200, OSMO_TDEF_MS) == 0);
OSMO_ASSERT(osmo_tdef_set(the_pcu->T_defs, -2031, 200, OSMO_TDEF_MS) == 0);
/* ARQ II */
bts->dl_arq_type = EGPRS_ARQ2;

Loading…
Cancel
Save