aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-23 11:03:35 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-23 11:03:35 +0100
commit76ba99c3fe89a1491f5cf4e8bc3b521dffdd2dfb (patch)
treed07f360f60d3ed95e30652bda667069d2b39446d
parentdc8b1207a166156ecaf447538727daa4702fab49 (diff)
WIP..
-rw-r--r--include/osmo-bts/bts_model.h1
-rw-r--r--src/common/handover.c11
-rw-r--r--src/osmo-bts-sysmo/oml.c43
-rw-r--r--tests/stubs.c2
4 files changed, 54 insertions, 3 deletions
diff --git a/include/osmo-bts/bts_model.h b/include/osmo-bts/bts_model.h
index 2f6ae98d..cb5433b4 100644
--- a/include/osmo-bts/bts_model.h
+++ b/include/osmo-bts/bts_model.h
@@ -29,6 +29,7 @@ int bts_model_chg_adm_state(struct gsm_bts *bts, struct gsm_abis_mo *mo,
int bts_model_rsl_chan_act(struct gsm_lchan *lchan, struct tlv_parsed *tp);
int bts_model_rsl_chan_rel(struct gsm_lchan *lchan);
+int bts_model_rsl_chan_mod(struct gsm_lchan *lchan);
int bts_model_rsl_deact_sacch(struct gsm_lchan *lchan);
int bts_model_rsl_mode_modify(struct gsm_lchan *lchan);
diff --git a/src/common/handover.c b/src/common/handover.c
index cd86428d..04aadb03 100644
--- a/src/common/handover.c
+++ b/src/common/handover.c
@@ -2,6 +2,7 @@
/* (C) 2012-2013 by Harald Welte <laforge@gnumonks.org>
* Andreas Eversberg <jolly@eversberg.eu>
+ * (C) 2014 by Holger Hans Peter Freyther
*
* All Rights Reserved
*
@@ -28,6 +29,7 @@
#include <osmocom/gsm/rsl.h>
#include <osmo-bts/bts.h>
+#include <osmo-bts/bts_model.h>
#include <osmo-bts/rsl.h>
#include <osmo-bts/logging.h>
#include <osmo-bts/handover.h>
@@ -56,6 +58,7 @@ static int ho_tx_phys_info(struct gsm_lchan *lchan, uint8_t ta)
0x00, 0);
lapdm_rslms_recvmsg(msg, &lchan->lapdm_ch);
+ return 0;
}
/* timer call-back for T3105 (handover PHYS INFO re-transmit) */
@@ -112,7 +115,13 @@ void handover_rach(struct gsm_bts_trx *trx, uint8_t chan_nr,
/* Stop handover detection, wait for valid frame */
lchan->ho.active = HANDOVER_WAIT_FRAME;
- l1sap_chan_modify(trx, chan_nr);
+ if (bts_model_rsl_chan_mod(lchan) != 0) {
+ LOGP(DHO, LOGL_ERROR,
+ "%s failed to modify channel after handover\n",
+ gsm_lchan_name(lchan));
+ rsl_tx_conn_fail(lchan, RSL_ERR_HANDOVER_ACC_FAIL);
+ return;
+ }
/* Send HANDover DETect to BSC */
rsl_tx_hando_det(lchan, &acc_delay);
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index d85b2ed7..7cd8358a 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -1,5 +1,5 @@
/* (C) 2011 by Harald Welte <laforge@gnumonks.org>
- * (C) 2013 by Holger Hans Peter Freyther
+ * (C) 2013-2014 by Holger Hans Peter Freyther
*
* All Rights Reserved
*
@@ -35,6 +35,7 @@
#include <osmo-bts/amr.h>
#include <osmo-bts/bts.h>
#include <osmo-bts/bts_model.h>
+#include <osmo-bts/handover.h>
#include "l1_if.h"
#include "femtobts.h"
@@ -951,7 +952,7 @@ int lchan_activate(struct gsm_lchan *lchan)
/* override the regular SAPIs if this is the first hand-over
* related activation of the LCHAN */
- if (lchan->ho.active == 1)
+ if (lchan->ho.active == HANDOVER_ENABLED)
s4l = &sapis_for_ho;
for (i = 0; i < s4l->num_sapis; i++) {
@@ -1385,6 +1386,16 @@ static int check_sapi_release(struct gsm_lchan *lchan, int sapi, int dir)
return enqueue_sapi_deact_cmd(lchan, sapi, dir);
}
+static int release_sapis_for_ho(struct gsm_lchan *lchan)
+{
+ int res = 0;
+ unsigned int i;
+
+ for (i = sapis_for_ho.num_sapis - 1; i >= 0; --i)
+ res |= check_sapi_release(lchan,
+ sapis_for_ho.sapis[i].sapi, sapis_for_ho.sapis[i].dir);
+ return res;
+}
static int lchan_deactivate_sapis(struct gsm_lchan *lchan)
{
@@ -1404,6 +1415,9 @@ static int lchan_deactivate_sapis(struct gsm_lchan *lchan)
res |= check_sapi_release(lchan, s4l->sapis[i].sapi, s4l->sapis[i].dir);
}
+ /* always attempt to disable the RACH burst */
+ res |= release_sapis_for_ho(lchan);
+
/* nothing was queued */
if (res == 0) {
LOGP(DL1C, LOGL_ERROR, "%s all SAPIs already released?\n",
@@ -1559,6 +1573,31 @@ int bts_model_rsl_chan_act(struct gsm_lchan *lchan, struct tlv_parsed *tp)
return 0;
}
+/**
+ * Modify the given lchan in the handover scenario. This is a lot like
+ * second channel activation but with some additional activation.
+ */
+int bts_model_rsl_chan_mod(struct gsm_lchan *lchan)
+{
+ const struct lchan_sapis *s4l = &sapis_for_lchan[lchan->type];
+ unsigned int i;
+
+ if (lchan->ho.active == HANDOVER_NONE)
+ return -1;
+
+ /* Give up listening to RACH bursts */
+ release_sapis_for_ho(lchan);
+
+ /* Activate the normal SAPIs */
+ for (i = 0; i < s4l->num_sapis; i++) {
+ int sapi = s4l->sapis[i].sapi;
+ int dir = s4l->sapis[i].dir;
+ enqueue_sapi_act_cmd(lchan, sapi, dir);
+ }
+
+ return 0;
+}
+
int bts_model_rsl_chan_rel(struct gsm_lchan *lchan)
{
/* A duplicate RF Release Request, ignore it */
diff --git a/tests/stubs.c b/tests/stubs.c
index c0955f3a..53aa434e 100644
--- a/tests/stubs.c
+++ b/tests/stubs.c
@@ -37,6 +37,8 @@ int bts_model_rsl_chan_act(struct gsm_lchan *lchan, struct tlv_parsed *tp)
{ return 0; }
int bts_model_rsl_mode_modify(struct gsm_lchan *lchan)
{ return 0; }
+int bts_model_rsl_chan_mod(struct gsm_lchan *lchan)
+{ return 0; }
void bts_model_rtp_rx_cb(struct osmo_rtp_socket *rs, const uint8_t *rtp_pl,
unsigned int rtp_pl_len) {}