From 8a148613b4c93f5a25dd2a2d9929de75882adbc5 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 23 Aug 2016 15:19:57 +0200 Subject: Fix ip.access style dyn PDCH, broken in 37af36e85eca546595081246aec010fa7f6fd0be Commit "sysmo,lc15: ts_connect_as(): log error also for pchan_as == TCH/F_PDCH" introduced a check for TCH/F_PDCH intended only for TCH/F_TCH/H_PDCH. It looked correct, but TCH/F_PDCH startup was designed differently: For TCH/F_PDCH, the idea was to look it up in pchan_to_logChComb[] and obtain the TCH/F channel combination, so that TCH/F_PDCH first initialize as TCH/F. So pchan was in fact intended to be passed as TCH/F_PDCH. For Osmocom TCH/F_TCH/H_PDCH, we've in the meantime added a ts_opstart() function that makes this decision explicitly. So, instead of reverting the erratic commit, add TCH/F_PDCH to ts_opstart(), for both sysmo and lc15. In ts_opstart(), move to a switch statement to resolve the actual pchan to use for ts_connect_as(). Drop TCH/F_PDCH and TCH/F_TCH/H_PDCH from pchan_to_logChComb[] and comment. Change-Id: I376b92a06f4cbe943c1c913dea7487fac53a7d08 --- src/osmo-bts-litecell15/oml.c | 27 +++++++++++++++++++-------- src/osmo-bts-sysmo/oml.c | 27 +++++++++++++++++++-------- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/src/osmo-bts-litecell15/oml.c b/src/osmo-bts-litecell15/oml.c index 5ce510ad..a175af4b 100644 --- a/src/osmo-bts-litecell15/oml.c +++ b/src/osmo-bts-litecell15/oml.c @@ -89,11 +89,12 @@ static const enum GsmL1_LogChComb_t pchan_to_logChComb[_GSM_PCHAN_MAX] = { [GSM_PCHAN_SDCCH8_SACCH8C] = GsmL1_LogChComb_VII, [GSM_PCHAN_SDCCH8_SACCH8C_CBCH] = GsmL1_LogChComb_VII, [GSM_PCHAN_PDCH] = GsmL1_LogChComb_XIII, - [GSM_PCHAN_TCH_F_PDCH] = GsmL1_LogChComb_I, /*< first init - like TCH/F, until PDCH ACT */ - [GSM_PCHAN_TCH_F_TCH_H_PDCH] = GsmL1_LogChComb_0, /*< first unused, - until first RSL CHAN ACT */ [GSM_PCHAN_UNKNOWN] = GsmL1_LogChComb_0, + /* + * GSM_PCHAN_TCH_F_PDCH and GSM_PCHAN_TCH_F_TCH_H_PDCH should not be + * part of this, only "real" pchan values will be looked up here. + * See the callers of ts_connect_as(). + */ }; static int trx_rf_lock(struct gsm_bts_trx *trx, int locked, l1if_compl_cb *cb); @@ -507,12 +508,22 @@ static int ts_connect_as(struct gsm_bts_trx_ts *ts, static int ts_opstart(struct gsm_bts_trx_ts *ts) { - if (ts->pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH) { - /* First connect as NONE, until first RSL CHAN ACT. */ + enum gsm_phys_chan_config pchan = ts->pchan; + switch (pchan) { + case GSM_PCHAN_TCH_F_TCH_H_PDCH: ts->dyn.pchan_is = ts->dyn.pchan_want = GSM_PCHAN_NONE; - return ts_connect_as(ts, GSM_PCHAN_NONE, opstart_compl_cb, NULL); + /* First connect as NONE, until first RSL CHAN ACT. */ + pchan = GSM_PCHAN_NONE; + break; + case GSM_PCHAN_TCH_F_PDCH: + /* First connect as TCH/F, expecting PDCH ACT. */ + pchan = GSM_PCHAN_TCH_F; + break; + default: + /* simply use ts->pchan */ + break; } - return ts_connect_as(ts, ts->pchan, opstart_compl_cb, NULL); + return ts_connect_as(ts, pchan, opstart_compl_cb, NULL); } GsmL1_Sapi_t lchan_to_GsmL1_Sapi_t(const struct gsm_lchan *lchan) diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c index 6f0629d4..dea1c5e2 100644 --- a/src/osmo-bts-sysmo/oml.c +++ b/src/osmo-bts-sysmo/oml.c @@ -86,11 +86,12 @@ static const enum GsmL1_LogChComb_t pchan_to_logChComb[_GSM_PCHAN_MAX] = { [GSM_PCHAN_SDCCH8_SACCH8C] = GsmL1_LogChComb_VII, [GSM_PCHAN_SDCCH8_SACCH8C_CBCH] = GsmL1_LogChComb_VII, [GSM_PCHAN_PDCH] = GsmL1_LogChComb_XIII, - [GSM_PCHAN_TCH_F_PDCH] = GsmL1_LogChComb_I, /*< first init - like TCH/F, until PDCH ACT */ - [GSM_PCHAN_TCH_F_TCH_H_PDCH] = GsmL1_LogChComb_0, /*< first unused, - until first RSL CHAN ACT */ [GSM_PCHAN_UNKNOWN] = GsmL1_LogChComb_0, + /* + * GSM_PCHAN_TCH_F_PDCH and GSM_PCHAN_TCH_F_TCH_H_PDCH should not be + * part of this, only "real" pchan values will be looked up here. + * See the callers of ts_connect_as(). + */ }; static int trx_rf_lock(struct gsm_bts_trx *trx, int locked, l1if_compl_cb *cb); @@ -515,12 +516,22 @@ static int ts_connect_as(struct gsm_bts_trx_ts *ts, static int ts_opstart(struct gsm_bts_trx_ts *ts) { - if (ts->pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH) { - /* First connect as NONE, until first RSL CHAN ACT. */ + enum gsm_phys_chan_config pchan = ts->pchan; + switch (pchan) { + case GSM_PCHAN_TCH_F_TCH_H_PDCH: ts->dyn.pchan_is = ts->dyn.pchan_want = GSM_PCHAN_NONE; - return ts_connect_as(ts, GSM_PCHAN_NONE, opstart_compl_cb, NULL); + /* First connect as NONE, until first RSL CHAN ACT. */ + pchan = GSM_PCHAN_NONE; + break; + case GSM_PCHAN_TCH_F_PDCH: + /* First connect as TCH/F, expecting PDCH ACT. */ + pchan = GSM_PCHAN_TCH_F; + break; + default: + /* simply use ts->pchan */ + break; } - return ts_connect_as(ts, ts->pchan, opstart_compl_cb, NULL); + return ts_connect_as(ts, pchan, opstart_compl_cb, NULL); } GsmL1_Sapi_t lchan_to_GsmL1_Sapi_t(const struct gsm_lchan *lchan) -- cgit v1.2.3