falconia has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/33470 )


Change subject: ECU in UL path: move state alloc/free to l1sap
......................................................................

ECU in UL path: move state alloc/free to l1sap

In preparation for moving the now-optional application of ECU in UL
path from osmo-bts-trx model-specific code to the common layer,
move ECU state allocation and freeing from trx model to l1sap.

Related: OS#6040
Change-Id: Ic98a2eb26b5a99bc4a89ad07ae87c9a86b921418
---
M src/common/l1sap.c
M src/osmo-bts-trx/l1_if.c
2 files changed, 40 insertions(+), 20 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/70/33470/1

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 528a735..981d3bc 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -2208,6 +2208,13 @@
        if (rc)
                return -RSL_ERR_EQUIPMENT_FAIL;

+       /* Is it TCH?  If it is, attempt to allocate an Error Concealment Unit
+        * instance, if available, unless it is disabled by vty config. */
+       if (lchan_is_tch(lchan) && trx->bts->use_ul_ecu)
+               lchan->ecu_state = osmo_ecu_init(trx, lchan2ecu_codec(lchan));
+       else
+               lchan->ecu_state = NULL;
+
        /* Init DTX DL FSM if necessary */
        if (trx->bts->dtxd && lchan_is_tch(lchan)) {
                lchan->tch.dtx.dl_amr_fsm = osmo_fsm_inst_alloc(&dtx_dl_amr_fsm,
@@ -2248,6 +2255,12 @@
                lchan->tch.dtx.dl_amr_fsm = NULL;
        }

+       /* clear ECU state (if any) */
+       if (lchan->ecu_state) {
+               osmo_ecu_destroy(lchan->ecu_state);
+               lchan->ecu_state = NULL;
+       }
+
        return l1sap_chan_act_dact_modify(trx, chan_nr, PRIM_INFO_DEACTIVATE,
                0);
 }
@@ -2270,5 +2283,18 @@
        LOGPLCHAN(lchan, DL1C, LOGL_INFO, "Modifying channel %s\n",
                rsl_chan_nr_str(chan_nr));

+       /* Is it TCH?  If it is and we are applying internal uplink ECUs,
+        * the new channel mode calls for a different ECU.  Any changes
+        * in vty config (enabling or disabling this ECU application)
+        * will also take effect upon channel modification. */
+       if (lchan_is_tch(lchan)) {
+               if (lchan->ecu_state)
+                       osmo_ecu_destroy(lchan->ecu_state);
+               if (trx->bts->use_ul_ecu)
+                       lchan->ecu_state = osmo_ecu_init(trx, 
lchan2ecu_codec(lchan));
+               else
+                       lchan->ecu_state = NULL;
+       }
+
        return l1sap_chan_act_dact_modify(trx, chan_nr, PRIM_INFO_MODIFY, 0);
 }
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 69ee117..60f9232 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -439,14 +439,6 @@
                                break;
                        }

-                       /* Attempt to allocate an Error Concealment Unit
-                        * instance, if available, unless it is disabled
-                        * by the vty config. */
-                       if (trx->bts->use_ul_ecu)
-                               lchan->ecu_state = osmo_ecu_init(trx, 
lchan2ecu_codec(lchan));
-                       else
-                               lchan->ecu_state = NULL;
-
                        /* activate dedicated channel */
                        trx_sched_set_lchan(lchan, chan_nr, LID_DEDIC, true);
                        /* activate associated channel */
@@ -475,13 +467,6 @@
                        mph_info_chan_confirm(trx, chan_nr, PRIM_INFO_ACTIVATE, 
0);
                        break;
                case PRIM_INFO_MODIFY:
-                       /* ECU for possibly new codec */
-                       if (lchan->ecu_state)
-                               osmo_ecu_destroy(lchan->ecu_state);
-                       if (trx->bts->use_ul_ecu)
-                               lchan->ecu_state = osmo_ecu_init(trx, 
lchan2ecu_codec(lchan));
-                       else
-                               lchan->ecu_state = NULL;
                        /* change mode */
                        trx_sched_set_mode(lchan->ts, chan_nr,
                                           lchan->rsl_cmode, lchan->tch_mode,
@@ -507,11 +492,6 @@
                                rc = -EPERM;
                                break;
                        }
-                       /* clear ECU state (if any) */
-                       if (lchan->ecu_state) {
-                               osmo_ecu_destroy(lchan->ecu_state);
-                               lchan->ecu_state = NULL;
-                       }
                        /* deactivate associated channel */
                        bts_model_lchan_deactivate_sacch(lchan);
                        if (!l1sap->u.info.u.act_req.sacch_only) {

--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/33470
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ic98a2eb26b5a99bc4a89ad07ae87c9a86b921418
Gerrit-Change-Number: 33470
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <fal...@freecalypso.org>
Gerrit-MessageType: newchange

Reply via email to