From 8ade45e795d1ee531423d529dfa2c441ece1196a Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Thu, 23 Jan 2014 16:00:11 +0100 Subject: 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. --- include/osmo-bts/Makefile.am | 3 ++- include/osmo-bts/handover.h | 10 ++++++++++ src/common/Makefile.am | 2 +- src/common/bts.c | 2 ++ src/common/handover.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ src/common/oml.c | 11 +++++++++-- src/common/rsl.c | 10 ++++++++++ 7 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 include/osmo-bts/handover.h create mode 100644 src/common/handover.c diff --git a/include/osmo-bts/Makefile.am b/include/osmo-bts/Makefile.am index 456d4165..d7f9421f 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 00000000..1cf5d696 --- /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 b2f6f8e7..716fad94 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 856968ef..1d66775f 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 00000000..c40219db --- /dev/null +++ b/src/common/handover.c @@ -0,0 +1,45 @@ +/* Paging message encoding + queue management */ + +/* (C) 2012-2013 by Harald Welte + * Andreas Eversberg + * (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 . + * + */ + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +/* 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 143cc0d8..5fa2d852 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 c97dd8a3..6b683bd5 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -45,6 +45,7 @@ #include #include #include +#include //#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); -- cgit v1.2.3