summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-10-11 12:55:35 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2013-10-11 12:55:35 +0200
commitdb6e636da50947264234abbfa31dddd538e14037 (patch)
treee6f20eac79946156b753d65abf41ca9a57e4b7a6
parenta1196c9aea109201859eb9d6f5f732df2c268a29 (diff)
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.
-rw-r--r--openbsc/include/openbsc/abis_rsl.h2
-rw-r--r--openbsc/src/libbsc/abis_rsl.c14
-rw-r--r--openbsc/src/libbsc/bsc_api.c3
-rw-r--r--openbsc/src/libbsc/handover_logic.c7
-rw-r--r--openbsc/src/libmsc/vty_interface_layer3.c2
5 files changed, 14 insertions, 14 deletions
diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h
index 06f0a721c..0f188ee48 100644
--- a/openbsc/include/openbsc/abis_rsl.h
+++ b/openbsc/include/openbsc/abis_rsl.h
@@ -43,7 +43,7 @@ int rsl_chan_activate(struct gsm_bts_trx *trx, uint8_t chan_nr,
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 0040c1759..1aa1e5552 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -469,12 +469,13 @@ int rsl_chan_activate(struct gsm_bts_trx *trx, uint8_t chan_nr,
#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;
@@ -484,6 +485,12 @@ int rsl_chan_activate_lchan(struct gsm_lchan *lchan, uint8_t act_type,
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);
@@ -1466,10 +1473,7 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
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 271eb4a7b..7eca78a40 100644
--- a/openbsc/src/libbsc/bsc_api.c
+++ b/openbsc/src/libbsc/bsc_api.c
@@ -228,6 +228,7 @@ static int handle_new_assignment(struct gsm_subscriber_connection *conn, int cha
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;
@@ -238,7 +239,7 @@ static int handle_new_assignment(struct gsm_subscriber_connection *conn, int cha
if (chan_mode == GSM48_CMODE_SPEECH_AMR)
handle_mr_config(conn, new_lchan, full_rate);
- 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 2a7733f6e..2f1697cbb 100644
--- a/openbsc/src/libbsc/handover_logic.c
+++ b/openbsc/src/libbsc/handover_logic.c
@@ -157,7 +157,6 @@ int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *new_bts,
int chan_type;
struct bsc_handover *ho;
static uint8_t ho_ref;
- uint8_t rqd_ta;
int rc;
int do_assignment = 0;
@@ -223,12 +222,8 @@ int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *new_bts,
new_lchan->conn = old_lchan->conn;
new_lchan->conn->ho_lchan = new_lchan;
- rqd_ta = new_lchan->rqd_ta;
- if (new_bts->type == GSM_BTS_TYPE_BS11)
- rqd_ta <<= 2;
rc = rsl_chan_activate_lchan(new_lchan,
- (ho->ho_async) ? RSL_ACT_INTER_ASYNC : 0x00, rqd_ta,
- ho->ho_ref);
+ (ho->ho_async) ? RSL_ACT_INTER_ASYNC : 0x00, ho->ho_ref);
if (rc < 0) {
LOGP(DHO, LOGL_ERROR, "could not activate channel\n");
new_lchan->conn->ho_lchan = NULL;
diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c
index 16048a381..a166712d9 100644
--- a/openbsc/src/libmsc/vty_interface_layer3.c
+++ b/openbsc/src/libmsc/vty_interface_layer3.c
@@ -942,7 +942,7 @@ DEFUN(allocate_all_channels, allocate_all_channels_cmd,
if (!lchan)
break;
- rc = rsl_chan_activate_lchan(lchan, 0, 0, 0);
+ rc = rsl_chan_activate_lchan(lchan, 0, 0);
if (rc < 0) {
lchan_free(lchan);
break;