aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/chan_alloc.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-06-21 16:17:15 +0200
committerHarald Welte <laforge@gnumonks.org>2009-06-21 16:17:15 +0200
commite441d9c36174037f50245a0dc47c4ec41b3b5421 (patch)
treef9b959c66f18c33fc472ed08a129d3471c216755 /openbsc/src/chan_alloc.c
parent2cf161be08795be4a074ba2b50fdd81ad1f4c35e (diff)
switch to dynamically allocated BTS and TRX data structures
This makes it much easier to do run-time configuration using the vty interface.
Diffstat (limited to 'openbsc/src/chan_alloc.c')
-rw-r--r--openbsc/src/chan_alloc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/openbsc/src/chan_alloc.c b/openbsc/src/chan_alloc.c
index 96632bcb9..241d5895b 100644
--- a/openbsc/src/chan_alloc.c
+++ b/openbsc/src/chan_alloc.c
@@ -38,7 +38,7 @@ static void auto_release_channel(void *_lchan);
struct gsm_bts_trx_ts *ts_c0_alloc(struct gsm_bts *bts,
enum gsm_phys_chan_config pchan)
{
- struct gsm_bts_trx *trx = &bts->trx[0];
+ struct gsm_bts_trx *trx = bts->c0;
struct gsm_bts_trx_ts *ts = &trx->ts[0];
if (pchan != GSM_PCHAN_CCCH &&
@@ -68,7 +68,7 @@ struct gsm_bts_trx_ts *ts_alloc(struct gsm_bts *bts,
{
int i, j;
for (i = 0; i < bts->num_trx; i++) {
- struct gsm_bts_trx *trx = &bts->trx[i];
+ struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, i);
int from, to;
/* the following constraints are pure policy,
@@ -124,7 +124,7 @@ _lc_find(struct gsm_bts *bts, enum gsm_phys_chan_config pchan)
struct gsm_bts_trx_ts *ts;
int i, j, ss;
for (i = 0; i < bts->num_trx; i++) {
- trx = &bts->trx[i];
+ trx = gsm_bts_trx_num(bts, i);
for (j = 0; j < 8; j++) {
ts = &trx->ts[j];
if (ts->pchan != pchan)
@@ -239,13 +239,14 @@ static void auto_release_channel(void *_lchan)
}
struct gsm_lchan* lchan_find(struct gsm_bts *bts, struct gsm_subscriber *subscr) {
- int trx, ts_no, lchan_no;
+ struct gsm_bts_trx *trx;
+ int ts_no, lchan_no;
- for (trx = 0; trx < bts->num_trx; ++trx) {
+ llist_for_each_entry(trx, &bts->trx_list, list) {
for (ts_no = 0; ts_no < 8; ++ts_no) {
for (lchan_no = 0; lchan_no < TS_MAX_LCHAN; ++lchan_no) {
struct gsm_lchan *lchan =
- &bts->trx[trx].ts[ts_no].lchan[lchan_no];
+ &trx->ts[ts_no].lchan[lchan_no];
if (subscr == lchan->subscr)
return lchan;
}