[PATCH] openbsc[master]: dyn PDCH: Fix TCH/F+PDCH allocation and direction of chan_al...

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/OpenBSC@lists.osmocom.org/.

Holger Freyther gerrit-no-reply at lists.osmocom.org
Thu Jun 2 12:30:34 UTC 2016


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

dyn PDCH: Fix TCH/F+PDCH allocation and direction of chan_alloc()

Always allow TCH/F+PDCH allocation, even if the current PDCH mode is not TCH/F.
(This is required to allocate a TCH/F channel with active PDCH, that needs to
be deactivated later.)

Fix the reverse search of a free slot ("channel allocator ascending").

Change-Id: Id38386c1e6e201d7e9b1dfeae732641486d28a77
---
M openbsc/src/libbsc/chan_alloc.c
1 file changed, 18 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/85/185/1

diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c
index de9da81..abbe500 100644
--- a/openbsc/src/libbsc/chan_alloc.c
+++ b/openbsc/src/libbsc/chan_alloc.c
@@ -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++) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id38386c1e6e201d7e9b1dfeae732641486d28a77
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther <holger at freyther.de>



More information about the OpenBSC mailing list