@@ -75,23 +75,31 @@
_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++) {