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

Submitted by gerrit-no-reply@lists.osmocom.org on June 2, 2016, 12:30 p.m.

Details

Message ID gerrit.1464870633644.Id38386c1e6e201d7e9b1dfeae732641486d28a77@gerrit.osmocom.org
State New
Headers show

Commit Message

gerrit-no-reply@lists.osmocom.org June 2, 2016, 12:30 p.m.
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

Comments

gerrit-no-reply@lists.osmocom.org June 2, 2016, 12:32 p.m.
Holger Freyther has abandoned this change.

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


Abandoned

Patch hide | download patch | download mbox

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++) {