[PATCH] openbsc[master]: dyn PDCH: Fix free slot search for chan_alloc_reverse == true

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Jun 2 11:51:00 UTC 2016


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

dyn PDCH: Fix free slot search for chan_alloc_reverse == true

For chan_alloc_reverse, _lc_find_trx() should return the last free slot instead
of the first.

Original patch by jolly, but split in two by nhofmeyr.

Change-Id: Ie919bfcaabab5286cbbbb1dbda0c140c62289503
---
M openbsc/src/libbsc/chan_alloc.c
1 file changed, 14 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/79/179/1

diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c
index de9da81..8600846 100644
--- a/openbsc/src/libbsc/chan_alloc.c
+++ b/openbsc/src/libbsc/chan_alloc.c
@@ -75,12 +75,24 @@
 _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;

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

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



More information about the OpenBSC mailing list