dyn PDCH: Cleanup of rsl_chan_activate_lchan() and users
Timing advance is stored inside lchan structure, so it is removed from
arguments. This is useful, if other actions are required prior calling
rsl_chan_activate_lchan. (like deactivating PDCH first)
The "shifted TA value" that is required by BS11 is now calculated inside
rsl_chan_activate_lchan and not by each user.
[Rebased by Holger. So some hunks were skipped as the patch
depended on Jolly's HO code]
diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h
index 06f0a72..0f188ee 100644
--- a/openbsc/include/openbsc/abis_rsl.h
+++ b/openbsc/include/openbsc/abis_rsl.h
@@ -43,7 +43,7 @@
uint8_t bs_power, uint8_t ms_power,
uint8_t ta);
int rsl_chan_activate_lchan(struct gsm_lchan *lchan, uint8_t act_type,
- uint8_t ta, uint8_t ho_ref);
+ uint8_t ho_ref);
int rsl_chan_mode_modify_req(struct gsm_lchan *ts);
int rsl_encryption_cmd(struct msgb *msg);
int rsl_paging_cmd(struct gsm_bts *bts, uint8_t paging_group, uint8_t len,
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index d193078..d9fe92c 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -476,12 +476,13 @@
#endif
int rsl_chan_activate_lchan(struct gsm_lchan *lchan, uint8_t act_type,
- uint8_t ta, uint8_t ho_ref)
+ uint8_t ho_ref)
{
struct abis_rsl_dchan_hdr *dh;
struct msgb *msg;
int rc;
uint8_t *len;
+ uint8_t ta;
uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
struct rsl_ie_chan_mode cm;
@@ -491,6 +492,12 @@
if (rc < 0)
return rc;
+ ta = lchan->rqd_ta;
+
+ /* BS11 requires TA shifted by 2 bits */
+ if (lchan->ts->trx->bts->type == GSM_BTS_TYPE_BS11)
+ ta <<= 2;
+
memset(&cd, 0, sizeof(cd));
gsm48_lchan2chan_desc(&cd, lchan);
@@ -1469,10 +1476,7 @@
gsm_lchant_name(lchan->type), gsm_chreq_name(chreq_reason),
rqd_ref->ra, rqd_ta);
- /* BS11 requires TA shifted by 2 bits */
- if (bts->type == GSM_BTS_TYPE_BS11)
- rqd_ta <<= 2;
- rsl_chan_activate_lchan(lchan, 0x00, rqd_ta, 0);
+ rsl_chan_activate_lchan(lchan, 0x00, 0);
return 0;
}
diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c
index e567038..04a4619 100644
--- a/openbsc/src/libbsc/bsc_api.c
+++ b/openbsc/src/libbsc/bsc_api.c
@@ -200,6 +200,7 @@
memcpy(&new_lchan->encr, &conn->lchan->encr, sizeof(new_lchan->encr));
new_lchan->ms_power = conn->lchan->ms_power;
new_lchan->bs_power = conn->lchan->bs_power;
+ new_lchan->rqd_ta = conn->lchan->rqd_ta;
/* copy new data to it */
new_lchan->tch_mode = chan_mode;
@@ -209,7 +210,7 @@
if (chan_mode == GSM48_CMODE_SPEECH_AMR)
handle_mr_config(conn, new_lchan);
- if (rsl_chan_activate_lchan(new_lchan, 0x1, 0, 0) < 0) {
+ if (rsl_chan_activate_lchan(new_lchan, 0x1, 0) < 0) {
LOGP(DHO, LOGL_ERROR, "could not activate channel\n");
lchan_free(new_lchan);
return -1;
diff --git a/openbsc/src/libbsc/handover_logic.c b/openbsc/src/libbsc/handover_logic.c
index 36a758b..22f9883 100644
--- a/openbsc/src/libbsc/handover_logic.c
+++ b/openbsc/src/libbsc/handover_logic.c
@@ -131,8 +131,7 @@
new_lchan->conn->ho_lchan = new_lchan;
/* FIXME: do we have a better idea of the timing advance? */
- rc = rsl_chan_activate_lchan(new_lchan, RSL_ACT_INTER_ASYNC, 0,
- ho->ho_ref);
+ rc = rsl_chan_activate_lchan(new_lchan, RSL_ACT_INTER_ASYNC, ho->ho_ref);
if (rc < 0) {
LOGP(DHO, LOGL_ERROR, "could not activate channel\n");
new_lchan->conn->ho_lchan = NULL;