2016-06-01 23:18:02 +00:00
|
|
|
/* Dynamic PDCH initialisation implementation shared across NM and RSL */
|
|
|
|
|
|
|
|
/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <osmocom/core/logging.h>
|
|
|
|
#include <openbsc/debug.h>
|
|
|
|
#include <openbsc/gsm_data.h>
|
|
|
|
#include <openbsc/abis_rsl.h>
|
|
|
|
|
2016-07-23 18:08:41 +00:00
|
|
|
void tchf_pdch_ts_init(struct gsm_bts_trx_ts *ts)
|
2016-06-01 23:18:02 +00:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
2016-07-06 12:39:04 +00:00
|
|
|
if (ts->trx->bts->gprs.mode == BTS_GPRS_NONE) {
|
2016-07-23 18:06:27 +00:00
|
|
|
LOGP(DRSL, LOGL_NOTICE, "%s: GPRS mode is 'none':"
|
2016-07-06 12:39:04 +00:00
|
|
|
" not activating PDCH.\n",
|
2016-07-23 18:06:27 +00:00
|
|
|
gsm_ts_and_pchan_name(ts));
|
2016-07-06 12:39:04 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-07-23 18:06:27 +00:00
|
|
|
LOGP(DRSL, LOGL_DEBUG, "%s: trying to PDCH ACT\n",
|
|
|
|
gsm_ts_and_pchan_name(ts));
|
2016-07-06 12:38:20 +00:00
|
|
|
|
|
|
|
rc = rsl_ipacc_pdch_activate(ts, 1);
|
|
|
|
if (rc != 0)
|
|
|
|
LOGP(DRSL, LOGL_ERROR, "%s %s: PDCH ACT failed\n",
|
|
|
|
gsm_ts_name(ts), gsm_pchan_name(ts->pchan));
|
2016-06-01 23:18:02 +00:00
|
|
|
}
|
2016-07-23 18:08:41 +00:00
|
|
|
|
|
|
|
void tchf_tchh_pdch_ts_init(struct gsm_bts_trx_ts *ts)
|
|
|
|
{
|
|
|
|
if (ts->trx->bts->gprs.mode == BTS_GPRS_NONE) {
|
|
|
|
LOGP(DRSL, LOGL_NOTICE, "%s: GPRS mode is 'none':"
|
|
|
|
" not activating PDCH.\n",
|
|
|
|
gsm_ts_and_pchan_name(ts));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
dyn TS: clearly use lchan[0], fixing minor confusion
The dyn_ts_switchover_*() functions made the impression that they act on a
specific lchan of a timeslot. The assumption that we would remember to use e.g.
lchan[1] across a PDCH deactivation is brain damaged to begin with; and
factually we always use lchan[0] anyway (the only case for using lchan[1] would
be when switching to TCH/H, but the channel allocator will always return
lchan[0] for that).
Instead of the brain damaged lchan args, use a ts arg across all
dyn_ts_switchover_*() functions, with one exception: The
dyn_ts_switchover_complete() actually receives an RSL activation ack message on
a specific lchan and needs to evaluate its lchan type. This will always be
lchan[0] as it is now, but we should stick with the lchan the message was sent
for.
For PDCH, a check to use lchan[0] already existed, when composing the ACT
message in rsl_chan_activate_lchan_as_pdch(). Replace with an assertion.
Adjust all callers to pass ts instead of lchan.
In dyn_ts_switchover_start(), there was a dead code check that jumps to
switchover_complete() in case the pchan already matches. This never hits,
because we only call dyn_ts_switchover_start() when pchans mismatch. So avoid
guessing at passing lchan[0] to dyn_ts_switchover_complete() by not calling it
at all but logging an error instead.
In rsl_chan_activate_lchan(), we remember some values before going into
switchover from PDCH. Explicitly store them in lchan[0], because after a PDCH
release we have always and will activate no other than lchan[0].
In dyn_ts_switchover_continue(), move the check for any existing lchan->rqd_ref
further above, and more correctly check all lchans that were so far valid on
the TS, instead of just one.
This partly prepares for a subsequent commit to fix the act_timer use for dyn
TS: with the old lchan arg, we might schedule an activation timer on lchan[1]
but receive an ack on lchan[0] (for PDCH), leading to an act_timer expiry.
Change-Id: I3f5d48a9bdaa49a42a1908d4a03744638c59796a
2016-08-24 14:57:31 +00:00
|
|
|
dyn_ts_switchover_start(ts, GSM_PCHAN_PDCH);
|
2016-07-23 18:08:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void dyn_ts_init(struct gsm_bts_trx_ts *ts)
|
|
|
|
{
|
|
|
|
/* Clear all TCH/F_PDCH flags */
|
|
|
|
ts->flags &= ~(TS_F_PDCH_PENDING_MASK | TS_F_PDCH_ACTIVE);
|
|
|
|
|
|
|
|
/* Clear TCH/F_TCH/H_PDCH state */
|
|
|
|
ts->dyn.pchan_is = ts->dyn.pchan_want = GSM_PCHAN_NONE;
|
|
|
|
ts->dyn.pending_chan_activ = NULL;
|
|
|
|
|
|
|
|
switch (ts->pchan) {
|
|
|
|
case GSM_PCHAN_TCH_F_PDCH:
|
|
|
|
tchf_pdch_ts_init(ts);
|
|
|
|
break;
|
|
|
|
case GSM_PCHAN_TCH_F_TCH_H_PDCH:
|
|
|
|
tchf_tchh_pdch_ts_init(ts);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|