aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libbsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-12-05 16:50:47 +0100
committerHarald Welte <laforge@gnumonks.org>2016-12-09 12:13:03 +0000
commit8825c6940957fa2198d1f9995856e4232bc264fb (patch)
tree535a8d0a4f461f122e1bb0dbf99ff3a1dfe68681 /openbsc/src/libbsc
parente14f4b93f2cd5b87c5a0c0141662a2c7be3e0f87 (diff)
Fix TCH/F_PDCH: no need to check ts subslots for PDCH
For TCH/F_PDCH in PDCH mode, directly return the lchan to use, in order to switch it to TCH/F. To check the pchan type in chan_alloc.c, make ts_pchan() public in gsm_data_shared.h. Commit c3f72f63afde926dfc46827d6880055597515fb6 broke TCH/F_PDCH, as a fallout of setting the GSM_PCHAN_PDCH subslots number to 0. This is sane and correct, but the chan_alloc code failed to see a ts as available if it has no subslots. Explanation: _lc_find_trx() checks each timeslot. For normal, static TCH timeslots we determine the number of logical subslots contained and check whether one of them is free. For dynamic TS, we can do the same when in TCH mode, but when in PDCH mode, we already know that it is available for immediate switchover for voice and hence can return it right away. TCH/F_TCH/H_PDCH already has a special check for that. TCH/F_PDCH doesn't, but this worked for TCH/F_PDCH as long as ts_subslots() returned 1 for PDCH: the for-loop at the bottom of _lc_find_trx() checked one subslot, which succeeded on an lchan in PDCH mode, since PDCH lchans are always marked type == NONE and state == NONE. Now we more accurately acknowledge that a PDCH timeslot has zero subslots and that a dynamic timeslot in PDCH mode can always be switched to voice immediately, without checking lchan type or state. So, above mentioned commit set PDCH to zero subslots, and the for-loop to check the (zero) subslots never ran and hence never returned the lchan. This fix adds a special condition for TCH/F_PDCH in PDCH mode, same as TCH/F_TCH/H_PDCH. (Todo: ts_pchan() can probably be used in other places as well to remove some code dup. Leaving that for another patch.) Fixes: OS#1868 Change-Id: I5d555d018a5bcb8d948e54059d32ec4c9b3070d0
Diffstat (limited to 'openbsc/src/libbsc')
-rw-r--r--openbsc/src/libbsc/chan_alloc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c
index a50b4ee..33b79a0 100644
--- a/openbsc/src/libbsc/chan_alloc.c
+++ b/openbsc/src/libbsc/chan_alloc.c
@@ -151,6 +151,13 @@ _lc_find_trx(struct gsm_bts_trx *trx, enum gsm_phys_chan_config pchan,
check_subslots = ts_subslots(ts);
break;
+ case GSM_PCHAN_TCH_F_PDCH:
+ /* Available for voice when in PDCH mode */
+ if (ts_pchan(ts) != GSM_PCHAN_PDCH)
+ continue;
+ /* Subslots of a PDCH ts don't need to be checked. */
+ return ts->lchan;
+
default:
/* Not a dynamic channel, there is only one pchan kind: */
check_subslots = ts_subslots(ts);