[PATCH] openbsc[master]: Fix TCH/F_PDCH: no need to check ts subslots for PDCH

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Dec 5 16:10:20 UTC 2016


Review at  https://gerrit.osmocom.org/1366

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. TCH/F_TCH/H_PDCH has a special check that
directly returns the lchan when in PDCH mode. All other pchan types are handled
by determining the amout of logical subslots on the ts and checking that all
are free. 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.)

Change-Id: I5d555d018a5bcb8d948e54059d32ec4c9b3070d0
Fixes: OS#1868
---
M openbsc/include/openbsc/gsm_data_shared.h
M openbsc/src/libbsc/chan_alloc.c
M openbsc/src/libcommon/gsm_data_shared.c
3 files changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/66/1366/1

diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h
index 4ec4f69..9407b82 100644
--- a/openbsc/include/openbsc/gsm_data_shared.h
+++ b/openbsc/include/openbsc/gsm_data_shared.h
@@ -891,6 +891,7 @@
 struct gsm_lchan *rsl_lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr,
 				   int *rc);
 
+enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts);
 uint8_t ts_subslots(struct gsm_bts_trx_ts *ts);
 bool ts_is_tch(struct gsm_bts_trx_ts *ts);
 
diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c
index 799fbef..932d960 100644
--- a/openbsc/src/libbsc/chan_alloc.c
+++ b/openbsc/src/libbsc/chan_alloc.c
@@ -151,6 +151,13 @@
 				/* Otherwise this slot is not applicable. */
 				continue;
 
+		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);
diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c
index df204fe..387af70 100644
--- a/openbsc/src/libcommon/gsm_data_shared.c
+++ b/openbsc/src/libcommon/gsm_data_shared.c
@@ -729,7 +729,7 @@
 };
 
 /*! Return the actual pchan type, also heeding dynamic TS. */
-static enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts)
+enum gsm_phys_chan_config ts_pchan(struct gsm_bts_trx_ts *ts)
 {
 	switch (ts->pchan) {
 	case GSM_PCHAN_TCH_F_TCH_H_PDCH:

-- 
To view, visit https://gerrit.osmocom.org/1366
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5d555d018a5bcb8d948e54059d32ec4c9b3070d0
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list