aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMychaela N. Falconia <falcon@freecalypso.org>2023-06-26 20:52:07 +0000
committerfalconia <falcon@freecalypso.org>2023-06-28 16:29:00 +0000
commit676e9e5804b545e2e1ec773d8c31a64804a27775 (patch)
treedbeaf6426f18c0ff884c867b99c23de0a62587d5
parentf0f91fc66c9e3ca531d6cbc9d4c2a946da7a1e50 (diff)
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
-rw-r--r--src/common/l1sap.c26
-rw-r--r--src/osmo-bts-trx/l1_if.c20
2 files changed, 26 insertions, 20 deletions
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 528a7356..981d3bc8 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -2208,6 +2208,13 @@ int l1sap_chan_act(struct gsm_bts_trx *trx, uint8_t chan_nr)
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 @@ int l1sap_chan_rel(struct gsm_bts_trx *trx, uint8_t chan_nr)
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 @@ int l1sap_chan_modify(struct gsm_bts_trx *trx, uint8_t chan_nr)
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 69ee117e..60f92325 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -439,14 +439,6 @@ int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
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 @@ int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
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 @@ int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
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) {