aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2014-01-23 16:00:11 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-03-10 13:38:07 +0100
commit8ade45e795d1ee531423d529dfa2c441ece1196a (patch)
tree8c31c34dd28ece47104246de80f3ec5c27ef513a
parent3058854535f08e12f6d8dd4f35490ecef40b3040 (diff)
handover: Set basic values for handover, remember the activation reason
Introduce the handover.h/handover.c and initialize handover parameters in OML and remember the activation through RSL.
-rw-r--r--include/osmo-bts/Makefile.am3
-rw-r--r--include/osmo-bts/handover.h10
-rw-r--r--src/common/Makefile.am2
-rw-r--r--src/common/bts.c2
-rw-r--r--src/common/handover.c45
-rw-r--r--src/common/oml.c11
-rw-r--r--src/common/rsl.c10
7 files changed, 79 insertions, 4 deletions
diff --git a/include/osmo-bts/Makefile.am b/include/osmo-bts/Makefile.am
index 456d416..d7f9421 100644
--- a/include/osmo-bts/Makefile.am
+++ b/include/osmo-bts/Makefile.am
@@ -1,2 +1,3 @@
noinst_HEADERS = abis.h bts.h bts_model.h gsm_data.h logging.h measurement.h \
- oml.h paging.h rsl.h signal.h vty.h amr.h pcu_if.h pcuif_proto.h
+ oml.h paging.h rsl.h signal.h vty.h amr.h pcu_if.h pcuif_proto.h \
+ handover.h
diff --git a/include/osmo-bts/handover.h b/include/osmo-bts/handover.h
new file mode 100644
index 0000000..1cf5d69
--- /dev/null
+++ b/include/osmo-bts/handover.h
@@ -0,0 +1,10 @@
+#pragma once
+
+enum {
+ HANDOVER_NONE = 0,
+ HANDOVER_ENABLED,
+ HANDOVER_WAIT_FRAME,
+};
+
+void handover_reset(struct gsm_lchan *lchan);
+
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index b2f6f8e..716fad9 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -5,4 +5,4 @@ LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOTRAU_LIBS)
noinst_LIBRARIES = libbts.a
libbts_a_SOURCES = gsm_data_shared.c sysinfo.c logging.c abis.c oml.c bts.c \
rsl.c vty.c paging.c measurement.c amr.c lchan.c \
- load_indication.c pcu_sock.c
+ load_indication.c pcu_sock.c handover.c \ No newline at end of file
diff --git a/src/common/bts.c b/src/common/bts.c
index 856968e..1d66775 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -105,6 +105,8 @@ int bts_init(struct gsm_bts *bts)
load_timer_start(bts);
btsb->rtp_jitter_buf_ms = 100;
btsb->max_ta = 63;
+ btsb->ny1 = 4;
+ btsb->t3105_ms = 300;
/* default RADIO_LINK_TIMEOUT */
btsb->radio_link_timeout = 32;
diff --git a/src/common/handover.c b/src/common/handover.c
new file mode 100644
index 0000000..c40219d
--- /dev/null
+++ b/src/common/handover.c
@@ -0,0 +1,45 @@
+/* Paging message encoding + queue management */
+
+/* (C) 2012-2013 by Harald Welte <laforge@gnumonks.org>
+ * Andreas Eversberg <jolly@eversberg.eu>
+ * (C) 2014 by Holger Hans Peter Freyther
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <errno.h>
+
+#include <osmocom/gsm/protocol/gsm_04_08.h>
+#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>
+
+/* release handover state */
+void handover_reset(struct gsm_lchan *lchan)
+{
+ /* Stop T3105 */
+ osmo_timer_del(&lchan->ho.t3105);
+
+ /* Handover process is done */
+ lchan->ho.active = HANDOVER_NONE;
+}
diff --git a/src/common/oml.c b/src/common/oml.c
index 143cc0d..5fa2d85 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -509,8 +509,15 @@ static int oml_rx_set_bts_attr(struct gsm_bts *bts, struct msgb *msg)
}
/* 9.4.10 BTS Air Timer */
- if (TLVP_PRESENT(&tp, NM_ATT_BTS_AIR_TIMER))
- btsb->t3105_ms = *TLVP_VAL(&tp, NM_ATT_BTS_AIR_TIMER) * 10;
+ if (TLVP_PRESENT(&tp, NM_ATT_BTS_AIR_TIMER)) {
+ uint8_t t3105 = *TLVP_VAL(&tp, NM_ATT_BTS_AIR_TIMER);
+ if (t3105 == 0) {
+ LOGP(DOML, LOGL_NOTICE,
+ "T3105 must have a value != 0.\n");
+ return oml_fom_ack_nack(msg, NM_NACK_PARAM_RANGE);
+ }
+ btsb->t3105_ms = t3105 * 10;
+ }
/* 9.4.37 NY1 */
if (TLVP_PRESENT(&tp, NM_ATT_NY1))
diff --git a/src/common/rsl.c b/src/common/rsl.c
index c97dd8a..6b683bd 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -45,6 +45,7 @@
#include <osmo-bts/bts_model.h>
#include <osmo-bts/measurement.h>
#include <osmo-bts/pcu_if.h>
+#include <osmo-bts/handover.h>
//#define FAKE_CIPH_MODE_COMPL
@@ -736,6 +737,12 @@ static int rsl_rx_chan_activ(struct msgb *msg)
memset(&lchan->encr, 0, sizeof(lchan->encr));
/* 9.3.9 Handover Reference */
+ if ((type == RSL_ACT_INTER_ASYNC ||
+ type == RSL_ACT_INTER_SYNC) &&
+ TLVP_PRESENT(&tp, RSL_IE_HANDO_REF)) {
+ lchan->ho.active = HANDOVER_ENABLED;
+ lchan->ho.ref = *TLVP_VAL(&tp, RSL_IE_HANDO_REF);
+ }
/* 9.3.4 BS Power */
if (TLVP_PRESENT(&tp, RSL_IE_BS_POWER))
@@ -832,6 +839,9 @@ static int rsl_rx_rf_chan_rel(struct gsm_lchan *lchan)
msgb_queue_flush(&lchan->dl_tch_queue);
}
+ /* release handover state */
+ handover_reset(lchan);
+
lchan->rel_act_kind = LCHAN_REL_ACT_RSL;
rc = bts_model_rsl_chan_rel(lchan);