From f86852ce0bc7d4c854d6f6825f74ab30be64b5c5 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 1 Jan 2015 12:46:26 +0100 Subject: chan_alloc: remove ts_alloc() and ts_free() The idea of ts_alloc()/ts_free() dates back to the very early days of OpenBSC, where we didn't yet have a fixed PCHAN type assigned for every lchan in a BTS. However, ever since, PCHAN types (channel combinations) are configured by OML in a certain way, and we only allocate LCHANs inside PCHANs of a matching type. There should be no PCHANs with type GSM_PCHAN_NONE, unless those that you don't want to use for administraive reasons or the like. --- openbsc/include/openbsc/chan_alloc.h | 11 ---- openbsc/src/libbsc/chan_alloc.c | 107 +---------------------------------- 2 files changed, 1 insertion(+), 117 deletions(-) (limited to 'openbsc') diff --git a/openbsc/include/openbsc/chan_alloc.h b/openbsc/include/openbsc/chan_alloc.h index 4fc0b834d..78242e5b7 100644 --- a/openbsc/include/openbsc/chan_alloc.h +++ b/openbsc/include/openbsc/chan_alloc.h @@ -24,17 +24,6 @@ struct gsm_subscriber_connection; -/* Special allocator for C0 of BTS */ -struct gsm_bts_trx_ts *ts_c0_alloc(struct gsm_bts *bts, - enum gsm_phys_chan_config pchan); - -/* Regular physical channel allocator */ -struct gsm_bts_trx_ts *ts_alloc(struct gsm_bts *bts, - enum gsm_phys_chan_config pchan); - -/* Regular physical channel (TS) */ -void ts_free(struct gsm_bts_trx_ts *ts); - /* Find an allocated channel for a specified subscriber */ struct gsm_subscriber_connection *connection_for_subscr(struct gsm_subscriber *subscr); diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c index 9936ac70c..c86556b48 100644 --- a/openbsc/src/libbsc/chan_alloc.c +++ b/openbsc/src/libbsc/chan_alloc.c @@ -58,97 +58,6 @@ int trx_is_usable(struct gsm_bts_trx *trx) return 1; } -struct gsm_bts_trx_ts *ts_c0_alloc(struct gsm_bts *bts, - enum gsm_phys_chan_config pchan) -{ - struct gsm_bts_trx *trx = bts->c0; - struct gsm_bts_trx_ts *ts = &trx->ts[0]; - - if (pchan != GSM_PCHAN_CCCH && - pchan != GSM_PCHAN_CCCH_SDCCH4 && - pchan != GSM_PCHAN_CCCH_SDCCH4_CBCH) - return NULL; - - if (ts->pchan != GSM_PCHAN_NONE) - return NULL; - - ts->pchan = pchan; - - return ts; -} - -/* Allocate a physical channel (TS) */ -struct gsm_bts_trx_ts *ts_alloc(struct gsm_bts *bts, - enum gsm_phys_chan_config pchan) -{ - int j; - struct gsm_bts_trx *trx; - - llist_for_each_entry(trx, &bts->trx_list, list) { - int from, to; - - if (!trx_is_usable(trx)) - continue; - - /* the following constraints are pure policy, - * no requirement to put this restriction in place */ - if (trx == bts->c0) { - /* On the first TRX we run one CCCH and one SDCCH8 */ - switch (pchan) { - case GSM_PCHAN_CCCH: - case GSM_PCHAN_CCCH_SDCCH4: - case GSM_PCHAN_CCCH_SDCCH4_CBCH: - from = 0; to = 0; - break; - case GSM_PCHAN_TCH_F: - case GSM_PCHAN_TCH_H: - from = 1; to = 7; - break; - case GSM_PCHAN_SDCCH8_SACCH8C: - case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: - default: - return NULL; - } - } else { - /* Every secondary TRX is configured for TCH/F - * and TCH/H only */ - switch (pchan) { - case GSM_PCHAN_SDCCH8_SACCH8C: - case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: - from = 1; to = 1; - break; - case GSM_PCHAN_TCH_F: - case GSM_PCHAN_TCH_H: - from = 1; to = 7; - break; - default: - return NULL; - } - } - - for (j = from; j <= to; j++) { - struct gsm_bts_trx_ts *ts = &trx->ts[j]; - - if (!ts_is_usable(ts)) - continue; - - if (ts->pchan == GSM_PCHAN_NONE) { - ts->pchan = pchan; - /* set channel attribute on OML */ - abis_nm_set_channel_attr(ts, abis_nm_chcomb4pchan(pchan)); - return ts; - } - } - } - return NULL; -} - -/* Free a physical channel (TS) */ -void ts_free(struct gsm_bts_trx_ts *ts) -{ - ts->pchan = GSM_PCHAN_NONE; -} - static const uint8_t subslots_per_pchan[] = { [GSM_PCHAN_NONE] = 0, [GSM_PCHAN_CCCH] = 0, @@ -200,7 +109,6 @@ static struct gsm_lchan * _lc_find_bts(struct gsm_bts *bts, enum gsm_phys_chan_config pchan) { struct gsm_bts_trx *trx; - struct gsm_bts_trx_ts *ts; struct gsm_lchan *lc; if (bts->chan_alloc_reverse) { @@ -217,20 +125,7 @@ _lc_find_bts(struct gsm_bts *bts, enum gsm_phys_chan_config pchan) } } - /* we cannot allocate more of these */ - if (pchan == GSM_PCHAN_CCCH_SDCCH4 || - pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH || - pchan == GSM_PCHAN_SDCCH8_SACCH8C_CBCH) - return NULL; - - /* if we've reached here, we need to allocate a new physical - * channel for the logical channel type requested */ - ts = ts_alloc(bts, pchan); - if (!ts) { - /* no more radio resources */ - return NULL; - } - return &ts->lchan[0]; + return NULL; } /* Allocate a logical channel */ -- cgit v1.2.3