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: 629222 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by ozlabs.org (Postfix) with ESMTP id 3rL65C53Lbz9t3V for ; Thu, 2 Jun 2016 22:30:39 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 2DF12220A4; 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 2C6B822003; 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: Add new_lchan argument to bsc_handover_start() X-Gerrit-Change-Id: I2b7151f32f0c04c22f294eb5dd3c7d7dfddf35e7 X-Gerrit-ChangeURL: X-Gerrit-Commit: 0c13326a6ed60ab694e90fe25cfbadd721325650 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/184 dyn PDCH: Add new_lchan argument to bsc_handover_start() This is useful if the caller already allocated a new lchan, which will be used to dynamically re-assign lchans. The old behavior is maintained by passing NULL. Change-Id: I2b7151f32f0c04c22f294eb5dd3c7d7dfddf35e7 --- M openbsc/include/openbsc/handover.h M openbsc/src/libbsc/handover_decision.c M openbsc/src/libbsc/handover_logic.c M openbsc/src/libmsc/vty_interface_layer3.c 4 files changed, 15 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/84/184/1 diff --git a/openbsc/include/openbsc/handover.h b/openbsc/include/openbsc/handover.h index 3fe71a2..a4844c5 100644 --- a/openbsc/include/openbsc/handover.h +++ b/openbsc/include/openbsc/handover.h @@ -3,7 +3,8 @@ struct gsm_subscriber_connection; -int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts); +int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan, + struct gsm_bts *bts); /* clear any operation for this connection */ void bsc_clear_handover(struct gsm_subscriber_connection *conn, int free_lchan); diff --git a/openbsc/src/libbsc/handover_decision.c b/openbsc/src/libbsc/handover_decision.c index 0f07bca..8b92177 100644 --- a/openbsc/src/libbsc/handover_decision.c +++ b/openbsc/src/libbsc/handover_decision.c @@ -48,7 +48,7 @@ } /* and actually try to handover to that cell */ - return bsc_handover_start(lchan, new_bts); + return bsc_handover_start(lchan, NULL, new_bts); } /* did we get a RXLEV for a given cell in the given report? */ diff --git a/openbsc/src/libbsc/handover_logic.c b/openbsc/src/libbsc/handover_logic.c index 641cee4..3e38fda 100644 --- a/openbsc/src/libbsc/handover_logic.c +++ b/openbsc/src/libbsc/handover_logic.c @@ -87,10 +87,13 @@ /* Hand over the specified logical channel to the specified new BTS. This is * the main entry point for the actual handover algorithm, after the decision - * whether to initiate HO to a specific BTS. */ -int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts) + * whether to initiate HO to a specific BTS. + * + * If new_lchan is NULL, allocate a new lchan. If not NULL, new_lchan must be a + * newly allocated lchan passed in by the caller. */ +int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan, + struct gsm_bts *new_bts) { - struct gsm_lchan *new_lchan; struct bsc_handover *ho; static uint8_t ho_ref; int rc; @@ -101,19 +104,20 @@ return -EBUSY; DEBUGP(DHO, "(old_lchan on BTS %u, new BTS %u)\n", - old_lchan->ts->trx->bts->nr, bts->nr); + old_lchan->ts->trx->bts->nr, new_bts->nr); - osmo_counter_inc(bts->network->stats.handover.attempted); + osmo_counter_inc(new_bts->network->stats.handover.attempted); if (!old_lchan->conn) { LOGP(DHO, LOGL_ERROR, "Old lchan lacks connection data.\n"); return -ENOSPC; } - new_lchan = lchan_alloc(bts, old_lchan->type, 0); + if (!new_lchan) + new_lchan = lchan_alloc(new_bts, old_lchan->type, 0); if (!new_lchan) { LOGP(DHO, LOGL_NOTICE, "No free channel\n"); - osmo_counter_inc(bts->network->stats.handover.no_channel); + osmo_counter_inc(new_bts->network->stats.handover.no_channel); return -ENOSPC; } diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c index 5d74e04..2ad7eab 100644 --- a/openbsc/src/libmsc/vty_interface_layer3.c +++ b/openbsc/src/libmsc/vty_interface_layer3.c @@ -641,7 +641,7 @@ } /* now start the handover */ - ret = bsc_handover_start(conn->lchan, bts); + ret = bsc_handover_start(conn->lchan, NULL, bts); if (ret != 0) { vty_out(vty, "%% Handover failed with errno %d.%s", ret, VTY_NEWLINE);