From b8afb5fda251be739fdd862054d28b0eedfd85c9 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 2 Jun 2016 01:18:02 +0200 Subject: dyn PDCH: send PDCH ACT for each TCH/F_PDCH on TS Enable Add dyn_pdch_init() in new file bsc_dyn_pdch.c (new file to avoid linking issues; bsc_init.c would create undefined references, and putting in a new file is the easiest solution). Call dyn_pdch_init() from nm_statechg_event() whenever a TS is enabled. Revert the |= TS_F_PDCH_MODE chunk from previous commit, since this flag will now be set after dyn_pdch_init() sent out the PDCH ACT and when subsequently the PDCH ACT ACK messages are received in rsl_rx_pdch_act_ack(). Change-Id: I0cad93dec59d546b3f3b19e332e0833496031575 --- openbsc/src/libbsc/Makefile.am | 3 ++- openbsc/src/libbsc/bsc_dyn_pdch.c | 42 +++++++++++++++++++++++++++++++ openbsc/src/libbsc/bsc_init.c | 4 +-- openbsc/src/libbsc/bts_ipaccess_nanobts.c | 3 +++ 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 openbsc/src/libbsc/bsc_dyn_pdch.c (limited to 'openbsc/src/libbsc') diff --git a/openbsc/src/libbsc/Makefile.am b/openbsc/src/libbsc/Makefile.am index 8fa5c7c1a..48880d965 100644 --- a/openbsc/src/libbsc/Makefile.am +++ b/openbsc/src/libbsc/Makefile.am @@ -23,5 +23,6 @@ libbsc_a_SOURCES = abis_nm.c abis_nm_vty.c \ bsc_init.c bts_init.c bsc_rf_ctrl.c \ arfcn_range_encode.c bsc_ctrl_commands.c \ bsc_ctrl_lookup.c \ - net_init.c + net_init.c \ + bsc_dyn_pdch.c diff --git a/openbsc/src/libbsc/bsc_dyn_pdch.c b/openbsc/src/libbsc/bsc_dyn_pdch.c new file mode 100644 index 000000000..717880b79 --- /dev/null +++ b/openbsc/src/libbsc/bsc_dyn_pdch.c @@ -0,0 +1,42 @@ +/* Dynamic PDCH initialisation implementation shared across NM and RSL */ + +/* (C) 2016 by sysmocom s.f.m.c. GmbH + * 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 Affero 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 + +void dyn_pdch_init(struct gsm_bts_trx_ts *ts) +{ + int rc; + + if (ts->pchan == GSM_PCHAN_TCH_F_PDCH) { + LOGP(DRSL, LOGL_DEBUG, "trying to PDCH ACT on" + " BTS %u TRX %u TS %u\n", + ts->trx->bts->nr, ts->trx->nr, ts->nr); + rc = rsl_ipacc_pdch_activate(ts, 1); + if (rc != 0) { + LOGP(DRSL, LOGL_ERROR, + "Failed to activate PDCH on" + " BTS %u TRX %u TS %u: %d\n", + ts->trx->bts->nr, ts->trx->nr, ts->nr, rc); + } + } +} diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index 04452f745..5c2786278 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -329,10 +329,8 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal, llist_for_each_entry(cur_trx, &trx->bts->trx_list, list) { int i; - for (i = 0; i < ARRAY_SIZE(cur_trx->ts); i++) { + for (i = 0; i < ARRAY_SIZE(cur_trx->ts); i++) generate_ma_for_ts(&cur_trx->ts[i]); - cur_trx->ts[i].flags |= TS_F_PDCH_MODE; - } } } if (isd->link_type == E1INP_SIGN_RSL) diff --git a/openbsc/src/libbsc/bts_ipaccess_nanobts.c b/openbsc/src/libbsc/bts_ipaccess_nanobts.c index dfb5a45bc..89d525636 100644 --- a/openbsc/src/libbsc/bts_ipaccess_nanobts.c +++ b/openbsc/src/libbsc/bts_ipaccess_nanobts.c @@ -369,6 +369,9 @@ static int nm_statechg_event(int evt, struct nm_statechg_signal_data *nsd) abis_nm_opstart(trx->bts, obj_class, trx->bts->bts_nr, trx->nr, ts->nr); } + if (new_state->operational == NM_OPSTATE_ENABLED + && new_state->availability == NM_AVSTATE_OK) + dyn_pdch_init(ts); break; case NM_OC_RADIO_CARRIER: trx = obj; -- cgit v1.2.3