laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/19827 )

Change subject: bts-trx: Use TRXC RFMUTE instead of resetting the scheduler
......................................................................

bts-trx: Use TRXC RFMUTE instead of resetting the scheduler

Since commit 221ee92551a3d34c4f61e99e5bf4aa718c4d6f88,
bts_model_trx_deact_rf() was being called when RF locking the TRX, which
was implemented by resetting the scheduler. This proved to be a messy
and wrong way to emulate disabling RF, since it modifies tate on lots of
structures from which it is later difficult to recover from, causing
bugs and issues like:
82a35a1dbff849ecf16b7c70de4c1c7786704b2e
be15a12c87983ef07fb133fedea4ef18d2213bc6
eef420d1ca2144682d3de3f4e5cc4a7458276a03
https://osmocom.org/issues/4694
https://osmocom.org/issues/4695
https://osmocom.org/issues/4696
https://osmocom.org/issues/4697

So for all these reasons, it is believed a good solution to avoid
resetting the scheduler and simply ask lower layers (osmo-trx) to take
care of disabling RF TX/RX on a given TRX. For TRX implementations not
supporting the newly added RFMUTE command, ramping down to -10dBm still
provides for a way to emulate RF locking. In any case, none of this was
supported until recently so it's not like we are breaking some feature
here.

Related: SYS#4920
Change-Id: I1423ddb390ef327ec7d4a27de2ac5dca663773a5
---
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/trx_if.c
M src/osmo-bts-trx/trx_if.h
3 files changed, 19 insertions(+), 40 deletions(-)

Approvals:
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 430d97e..bc0df2b 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -215,18 +215,8 @@
 {
        struct phy_instance *pinst = trx_phy_instance(trx);
        struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
-       enum gsm_phys_chan_config pchan = trx->ts[0].pchan;

-       /* close all logical channels and reset timeslots */
-       trx_sched_reset(&l1h->l1s);
-
-       /* deactivate lchan for CCCH */
-       if (pchan == GSM_PCHAN_CCCH || pchan == GSM_PCHAN_CCCH_SDCCH4 ||
-           pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH) {
-               lchan_set_state(&trx->ts[0].lchan[CCCH_LCHAN], 
LCHAN_S_INACTIVE);
-       }
-
-       return 0;
+       return trx_if_cmd_rfmute(l1h, true);
 }

 /* deactivate transceiver */
@@ -651,12 +641,14 @@
 {
        struct gsm_bts_trx *trx;
        struct phy_instance *pinst;
-       int i, rc = 0;
+       struct trx_l1h *l1h;
+       int rc = 0;

        switch (mo->obj_class) {
        case NM_OC_RADIO_CARRIER:
                trx = (struct gsm_bts_trx *) obj;
                pinst = trx_phy_instance(trx);
+               l1h = pinst->u.osmotrx.hdl;

                /* Begin to ramp the power if TRX is already running. Otherwise
                 * skip, power ramping will be started after TRX is running */
@@ -670,20 +662,18 @@
                        if (mo->nm_state.administrative == NM_STATE_LOCKED &&
                            adm_state == NM_STATE_UNLOCKED) {
                                /* Previous change was UNLOCKED->LOCKED, so we
-                                * were ramping down and we didn't deactivate
+                                * were ramping down and we didn't mute RF
                                 * yet, so now simply skip old ramp down compl
-                                * cb, skip TS activation and go for ramp up
+                                * cb, skip RF unmute and go for ramp up
                                 * directly. */
                                goto ramp_up;
                        } else if (mo->nm_state.administrative == 
NM_STATE_UNLOCKED &&
                            adm_state == NM_STATE_LOCKED) {
-                               /* Previous change was LOCKED->UNLOCKED, which
-                                * means TS were also enabled during start of
-                                * ramping up. So we simply need to skip
-                                * ramping up and start ramping down instead,
-                                * disabling TS at the end as usual. Fall
-                                * through usual procedure below.
-                                */
+                               /* Previous change was LOCKED->UNLOCKED, so we
+                                * simply need to skip ramping up and start
+                                * ramping down instead, muting RF at the
+                                * end as usual. Fall through usual procedure
+                                * below. */
                        } else if (mo->nm_state.administrative == adm_state) {
                                OSMO_ASSERT(0);
                        }
@@ -695,25 +685,7 @@
                        break;
                case NM_STATE_UNLOCKED:
                        mo->procedure_pending = 1;
-                       /* Activate timeslots in scheduler and start power ramp 
up */
-                       for (i = 0; i < ARRAY_SIZE(trx->ts); i++) {
-                               struct gsm_bts_trx_ts *ts = &trx->ts[i];
-                               if (ts->pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH) {
-                                       /* dyn.pchan_is is set to 
GSM_PCHAN_NONE when
-                                        * internally deactivated during 
locking. Simply
-                                        * internally restore the old status 
here.
-                                        */
-                                       ts->dyn.pchan_is = ts->dyn.pchan_want;
-                               } else if (ts->pchan == GSM_PCHAN_TCH_F_PDCH && 
ts->flags & TS_F_PDCH_PENDING_MASK) {
-                                       /* TS configuration already in progress,
-                                        * waiting for PCU response, let it be
-                                        * de/activated later by PCU ACT CNF as 
a
-                                        * response to pcu_tx_info_ind()
-                                        */
-                                       continue;
-                               }
-                               trx_set_ts(ts);
-                       }
+                       trx_if_cmd_rfmute(l1h, false);
 ramp_up:
                        rc = l1if_trx_start_power_ramp(trx, 
bts_model_chg_adm_state_ramp_compl_cb);
                        if (rc == 0) {
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index 875487a..05167ca 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -376,6 +376,12 @@
        return trx_ctrl_cmd(l1h, 1, "NOHANDOVER", "%d %d", tn, ss);
 }

+/*! Send "RFMUTE" command to TRX: Mute or Unmute RF transmission */
+int trx_if_cmd_rfmute(struct trx_l1h *l1h, bool mute)
+{
+       return trx_ctrl_cmd(l1h, 0, "RFMUTE", mute ? "1" : "0");
+}
+
 struct trx_ctrl_rsp {
        char cmd[50];
        char params[100];
diff --git a/src/osmo-bts-trx/trx_if.h b/src/osmo-bts-trx/trx_if.h
index 6b417cf..17bc7db 100644
--- a/src/osmo-bts-trx/trx_if.h
+++ b/src/osmo-bts-trx/trx_if.h
@@ -35,6 +35,7 @@
 int trx_if_cmd_txtune(struct trx_l1h *l1h, uint16_t arfcn, 
trx_if_cmd_generic_cb *cb);
 int trx_if_cmd_handover(struct trx_l1h *l1h, uint8_t tn, uint8_t ss);
 int trx_if_cmd_nohandover(struct trx_l1h *l1h, uint8_t tn, uint8_t ss);
+int trx_if_cmd_rfmute(struct trx_l1h *l1h, bool mute);
 int trx_if_send_burst(struct trx_l1h *l1h, const struct trx_dl_burst_req *br);
 int trx_if_powered(struct trx_l1h *l1h);


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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I1423ddb390ef327ec7d4a27de2ac5dca663773a5
Gerrit-Change-Number: 19827
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-CC: Hoernchen <[email protected]>
Gerrit-MessageType: merged

Reply via email to