aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/bts.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-11-12 12:50:23 +0100
committerHarald Welte <laforge@gnumonks.org>2018-11-18 20:29:40 +0000
commiteebb6a4216f136132400831ca35ed70e7502e92a (patch)
tree0b987086e93e19d08360cd4d647af4f15d11688f /src/common/bts.c
parente5f4654ee34c5a346a0b85805c706115464e96e1 (diff)
bts: Allocate TRX for BTS dynamically, deprecate -t
No need to pass -t num_trx anymore to specify number of TRX to use. It is calculated based on dynamic allocation from VTY config. Using parameter -t is flagged as deprecated and is transformed into a NOOP por backward compatibility. As a result, TRX now are allocated after the BTS is allocated and initial config (pre-VTY) is applied. A new function bts_trx_init() is added, to set default config on each TRX during allocation and before setting VTY config on it. A new per BTS model function bts_model_trx_init() is added, to allow per model specific default configuration of each TRX. Change-Id: Iab1a754ab12a626759f9f90aa66f87bdce65ac9c
Diffstat (limited to 'src/common/bts.c')
-rw-r--r--src/common/bts.c53
1 files changed, 31 insertions, 22 deletions
diff --git a/src/common/bts.c b/src/common/bts.c
index c251fdda..68cb1672 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -105,11 +105,10 @@ static const struct rate_ctr_group_desc bts_ctrg_desc = {
bts_ctr_desc
};
-/* Initialize the BTS (and TRX) data structures, called before config
+/* Initialize the BTS data structures, called before config
* file reading */
int bts_init(struct gsm_bts *bts)
{
- struct gsm_bts_trx *trx;
int rc, i;
static int initialized = 0;
void *tall_rtp_ctx;
@@ -167,26 +166,6 @@ int bts_init(struct gsm_bts *bts)
oml_mo_state_init(&bts->gprs.nsvc[0].mo, -1, NM_AVSTATE_DEPENDENCY);
oml_mo_state_init(&bts->gprs.nsvc[1].mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE);
- /* initialize bts data structure */
- llist_for_each_entry(trx, &bts->trx_list, list) {
- struct trx_power_params *tpp = &trx->power_params;
- int i;
-
- for (i = 0; i < ARRAY_SIZE(trx->ts); i++) {
- struct gsm_bts_trx_ts *ts = &trx->ts[i];
- int k;
-
- for (k = 0; k < ARRAY_SIZE(ts->lchan); k++) {
- struct gsm_lchan *lchan = &ts->lchan[k];
- INIT_LLIST_HEAD(&lchan->dl_tch_queue);
- }
- }
- /* Default values for the power adjustments */
- tpp->ramp.max_initial_pout_mdBm = to_mdB(0);
- tpp->ramp.step_size_mdB = to_mdB(2);
- tpp->ramp.step_interval_sec = 1;
- }
-
/* allocate a talloc pool for ORTP to ensure it doesn't have to go back
* to the libc malloc all the time */
tall_rtp_ctx = talloc_pool(tall_bts_ctx, 262144);
@@ -215,6 +194,36 @@ int bts_init(struct gsm_bts *bts)
return rc;
}
+/* Initialize the TRX data structures, called before config
+ * file reading */
+int bts_trx_init(struct gsm_bts_trx *trx)
+{
+ /* initialize bts data structure */
+ struct trx_power_params *tpp = &trx->power_params;
+ int rc, i;
+
+ for (i = 0; i < ARRAY_SIZE(trx->ts); i++) {
+ struct gsm_bts_trx_ts *ts = &trx->ts[i];
+ int k;
+
+ for (k = 0; k < ARRAY_SIZE(ts->lchan); k++) {
+ struct gsm_lchan *lchan = &ts->lchan[k];
+ INIT_LLIST_HEAD(&lchan->dl_tch_queue);
+ }
+ }
+ /* Default values for the power adjustments */
+ tpp->ramp.max_initial_pout_mdBm = to_mdB(0);
+ tpp->ramp.step_size_mdB = to_mdB(2);
+ tpp->ramp.step_interval_sec = 1;
+
+ rc = bts_model_trx_init(trx);
+ if (rc < 0) {
+ llist_del(&trx->list);
+ return rc;
+ }
+ return 0;
+}
+
static void shutdown_timer_cb(void *data)
{
fprintf(stderr, "Shutdown timer expired\n");