From patchwork Thu Jun 2 12:30:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gerrit-no-reply@lists.osmocom.org X-Patchwork-Id: 629223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 3rL65K0C20z9t3V for ; Thu, 2 Jun 2016 22:30:44 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 77B4E220AA; Thu, 2 Jun 2016 12:30:38 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from 127.0.1.12 (unknown [127.0.1.12]) by lists.osmocom.org (Postfix) with ESMTPA id 4CA9D22005; Thu, 2 Jun 2016 12:30:34 +0000 (UTC) Date: Thu, 2 Jun 2016 12:30:34 +0000 From: Holger Freyther Message-ID: X-Gerrit-MessageType: newchange Subject: [PATCH] openbsc[master]: dyn PDCH: Fix TCH/F+PDCH allocation and direction of chan_al... X-Gerrit-Change-Id: Id38386c1e6e201d7e9b1dfeae732641486d28a77 X-Gerrit-ChangeURL: X-Gerrit-Commit: 42d43c1b52db7b4a75a2a78034dea3bf1c6ca4f3 MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/2.12.2-31-gb331dbd-dirty X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: holger@freyther.de Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" 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++) {