Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/10701


Change subject: lchan: pick proper power and ta values
......................................................................

lchan: pick proper power and ta values

When activating an lchan, the power levels should be maximum and TA zero. Only
if a new lchan is assigned within the same cell does it make sense to take over
the previous power and TA levels.

In LCHAN_EV_ACTIVATE:

- Separate the code that copies previous encryption data. This should happen
  regardless of whether we're staying in the same cell or not.

- For the power,TA levels, take over an old lchan's values only when it is
  assigning a new lchan in the same cell.

Change-Id: I360b003398487fa6f934296ff03643c33ec61a35
---
M src/osmo-bsc/lchan_fsm.c
1 file changed, 15 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/01/10701/1

diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 3352da5..7d47380 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -429,6 +429,8 @@
 {
        struct lchan_activate_info *info = data;
        struct gsm_lchan *lchan = lchan_fi_lchan(fi);
+       struct gsm_bts *bts = lchan->ts->trx->bts;
+
        switch (event) {

        case LCHAN_EV_ACTIVATE:
@@ -446,18 +448,25 @@
                lchan->activate.concluded = false;
                lchan->activate.re_use_mgw_endpoint_from_lchan = 
info->old_lchan;

-               if (info->old_lchan) {
+               if (info->old_lchan)
                        lchan->encr = info->old_lchan->encr;
+               else {
+                       lchan->encr = (struct gsm_encr){
+                               .alg_id = RSL_ENC_ALG_A5(0),    /* no 
encryption */
+                       };
+               }
+
+               /* If there is a previous lchan, and the new lchan is on the 
same cell as previous one,
+                * take over power and TA values. Otherwise, use max power and 
zero TA. */
+               if (info->old_lchan && info->old_lchan->ts->trx->bts == bts) {
                        lchan->ms_power = info->old_lchan->ms_power;
                        lchan->bs_power = info->old_lchan->bs_power;
                        lchan->rqd_ta = info->old_lchan->rqd_ta;
                } else {
-                       struct gsm_bts *bts = lchan->ts->trx->bts;
-                       lchan->encr = (struct gsm_encr){
-                               .alg_id = RSL_ENC_ALG_A5(0),    /* no 
encryption */
-                       };
                        lchan->ms_power = ms_pwr_ctl_lvl(bts->band, 
bts->ms_max_power);
-                       lchan->bs_power = 0; /* 0dB reduction, output power = 
Pn */
+                       /* From lchan_reset():
+                        * - bs_power is still zero, 0dB reduction, output 
power = Pn.
+                        * - TA is still zero, to be determined by RACH. */
                }
 
                if (info->chan_mode == GSM48_CMODE_SPEECH_AMR)

--
To view, visit https://gerrit.osmocom.org/10701
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I360b003398487fa6f934296ff03643c33ec61a35
Gerrit-Change-Number: 10701
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <[email protected]>

Reply via email to