Change in osmo-pcu[master]: Move T_defs_pcu from BTS to PCU object

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Thu Jan 14 11:39:56 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/22179 )


Change subject: Move T_defs_pcu from BTS to PCU object
......................................................................

Move T_defs_pcu from BTS to PCU object

Change-Id: I0cac5c12dff2e90b52d00383a00b4b94a9603a0a
---
M src/bts.cpp
M src/bts.h
M src/gprs_bssgp_pcu.cpp
M src/gprs_pcu.c
M src/gprs_pcu.h
M src/gprs_rlcmac_sched.cpp
M src/pcu_vty.c
M src/tbf.cpp
M src/tbf_dl.cpp
M tests/tbf/TbfTest.cpp
10 files changed, 41 insertions(+), 53 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/79/22179/1

diff --git a/src/bts.cpp b/src/bts.cpp
index 3c4e676..ac58f48 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -76,17 +76,6 @@
 	{ .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 @@
 	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 *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);
 
diff --git a/src/bts.h b/src/bts.h
index e4e9e5c..b814b62 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -101,7 +101,6 @@
 	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;
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index 2c9073b..cfaee73 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -914,7 +914,7 @@
 	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 @@
 		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 @@
 		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;
 	}
diff --git a/src/gprs_pcu.c b/src/gprs_pcu.c
index 7fa5a2e..e08094b 100644
--- a/src/gprs_pcu.c
+++ b/src/gprs_pcu.c
@@ -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 @@
 	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;
 }
 
diff --git a/src/gprs_pcu.h b/src/gprs_pcu.h
index bf65fa7..9696e96 100644
--- a/src/gprs_pcu.h
+++ b/src/gprs_pcu.h
@@ -86,6 +86,8 @@
 	alloc_algorithm_func_t alloc_algorithm;
 
 	struct gprs_bssgp_pcu bssgp;
+
+	struct osmo_tdef *T_defs; /* timers controlled by PCU */
 };
 
 
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 924a4de..b5709c9 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -252,8 +252,8 @@
 						    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));
 
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index b5c70c7..a2c58eb 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -249,7 +249,7 @@
 	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 @@
 {
 	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 @@
 {
 	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 @@
       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 @@
       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 @@
       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 @@
 	   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,
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 02f0e3f..c42081b 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -493,7 +493,7 @@
 	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",
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 613f7b8..280e057 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -1365,7 +1365,7 @@
 	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;
 
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index cff47e6..69f07aa 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -176,8 +176,8 @@
 	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 @@
 {
 	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 @@
 
 	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 @@
 	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 @@
 
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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;
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/22179
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I0cac5c12dff2e90b52d00383a00b4b94a9603a0a
Gerrit-Change-Number: 22179
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210114/f881bd19/attachment.htm>


More information about the gerrit-log mailing list