summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-10-11 13:05:16 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2013-10-11 13:05:16 +0200
commit3c38175f4f0546feeec455f5129be2be7073e495 (patch)
tree96e64df80f20d92619ecb65800ace131b0b8b919
parent98c0d3515d6dadd667047aeb4c3f33233042c4df (diff)
dyn PDCH: Fix TCH/F+PDCH allocation and direction of chan_alloc()
The TCH/F+PDCH allocation is always allowed, even if the current PDCH mode is not TCH/F. (This is required to allocate a TCH/F channel with actived PDCH, that needs to be deactivate afterwards.) The reverse search of free slot ("channel allocator ascending") is now performed correctly.
-rw-r--r--openbsc/src/libbsc/chan_alloc.c40
-rw-r--r--openbsc/src/libbsc/handover_decision_2.c5
2 files changed, 22 insertions, 23 deletions
diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c
index cd727fd86..12e179ef6 100644
--- a/openbsc/src/libbsc/chan_alloc.c
+++ b/openbsc/src/libbsc/chan_alloc.c
@@ -159,23 +159,31 @@ static struct gsm_lchan *
_lc_find_trx(struct gsm_bts_trx *trx, enum gsm_phys_chan_config pchan)
{
struct gsm_bts_trx_ts *ts;
- int j, ss;
+ int j, start, stop, dir, ss;
if (!trx_is_usable(trx))
return NULL;
- for (j = 0; j < 8; j++) {
+ if (trx->bts->chan_alloc_reverse) {
+ /* check TS 7..0 */
+ start = 7;
+ stop = -1;
+ dir = -1;
+ } else {
+ /* check TS 0..7 */
+ start = 0;
+ stop = 8;
+ dir = 1;
+ }
+
+ for (j = start; j != stop; j += dir) {
ts = &trx->ts[j];
if (!ts_is_usable(ts))
continue;
- /* ip.access dynamic TCH/F + PDCH combination */
- if (ts->pchan == GSM_PCHAN_TCH_F_PDCH &&
- pchan == GSM_PCHAN_TCH_F) {
- /* we can only consider such a dynamic channel
- * if the PDCH is currently inactive */
- if (ts->flags & TS_F_PDCH_MODE)
- continue;
- } else if (ts->pchan != pchan)
+ /* pchan must match. */
+ if (ts->pchan != pchan
+ && (ts->pchan != GSM_PCHAN_TCH_F_PDCH
+ || pchan != GSM_PCHAN_TCH_F))
continue;
/* check if all sub-slots are allocated yet */
for (ss = 0; ss < subslots_per_pchan[pchan]; ss++) {
@@ -238,14 +246,10 @@ _lc_count_trx(struct gsm_bts_trx *trx, enum gsm_phys_chan_config pchan)
ts = &trx->ts[j];
if (!ts_is_usable(ts))
continue;
- /* ip.access dynamic TCH/F + PDCH combination */
- if (ts->pchan == GSM_PCHAN_TCH_F_PDCH &&
- pchan == GSM_PCHAN_TCH_F) {
- /* we can only consider such a dynamic channel
- * if the PDCH is currently inactive */
- if (ts->flags & TS_F_PDCH_MODE)
- continue;
- } else if (ts->pchan != pchan)
+ /* pchan must match. */
+ if (ts->pchan != pchan
+ && (ts->pchan != GSM_PCHAN_TCH_F_PDCH
+ || pchan != GSM_PCHAN_TCH_F))
continue;
/* check if all sub-slots are allocated yet */
for (ss = 0; ss < subslots_per_pchan[pchan]; ss++) {
diff --git a/openbsc/src/libbsc/handover_decision_2.c b/openbsc/src/libbsc/handover_decision_2.c
index 56ebd500c..e6fc852f1 100644
--- a/openbsc/src/libbsc/handover_decision_2.c
+++ b/openbsc/src/libbsc/handover_decision_2.c
@@ -1191,11 +1191,6 @@ static int congestion_check_bts(struct gsm_bts *bts, int tchf_congestion,
continue;
switch (ts->pchan) {
case GSM_PCHAN_TCH_F_PDCH:
- /* we can only consider such a dynamic channel
- * if the PDCH is currently inactive */
- if (ts->flags & TS_F_PDCH_MODE)
- break;
- // fall through
case GSM_PCHAN_TCH_F:
lc = &ts->lchan[0];
/* omit if channel not active */