[PATCH] osmo-bts[master]: octphy: Improving OML ADM state handling

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Thu Oct 13 13:58:35 UTC 2016


Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/906

to look at the new patch set (#10).

octphy: Improving OML ADM state handling

Improving state handling for for lock/unlock of OC_RADIO_CARRIER obj class. in
bts_model_chg_adm_state()

Change-Id: I034114beca95210169429d8ac1eb8648df12fc6c
---
M src/osmo-bts-octphy/l1_oml.c
1 file changed, 71 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/06/906/10

diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index 41f5bc2..888429e 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -52,6 +52,8 @@
 #include <octphy/octvc1/main/octvc1_main_default.h>
 #include <octphy/octvc1/main/octvc1_main_version.h>
 
+int trx_locked = 0;
+
 /* Map OSMOCOM logical channel type to OctPHY Logical channel type */
 static tOCTVC1_GSM_LOGICAL_CHANNEL_COMBINATION_ENUM pchan_to_logChComb[_GSM_PCHAN_MAX] =
 {
@@ -1540,10 +1542,75 @@
 int bts_model_chg_adm_state(struct gsm_bts *bts, struct gsm_abis_mo *mo,
 			    void *obj, uint8_t adm_state)
 {
-	/* TODO: implement this properly */
-	/* blindly accept all state changes */
-	mo->nm_state.administrative = adm_state;
-	return oml_mo_statechg_ack(mo);
+	int rc;
+	int granted = 0;
+
+	struct gsm_bts_trx *trx;
+	struct phy_instance *pinst;
+	struct octphy_hdl *fl1h;
+
+	switch (mo->obj_class) {
+	case NM_OC_RADIO_CARRIER:
+
+		trx = ((struct gsm_bts_trx *)obj);
+		pinst = trx_phy_instance(trx);
+		fl1h = pinst->phy_link->u.octphy.hdl;
+
+		if (mo->procedure_pending) {
+			LOGP(DL1C, LOGL_ERROR, "Discarding adm change command: "
+			     "pending procedure on RC %d\n", trx->nr);
+			return 0;
+		}
+		mo->procedure_pending = 1;
+		switch (adm_state) {
+		case NM_STATE_LOCKED:
+
+			trx_locked = 1;
+
+			/* Stop heartbeat check */
+			osmo_timer_del(&fl1h->alive_timer);
+
+			bts_model_trx_deact_rf(trx);
+
+			/* Close TRX */
+			rc = bts_model_trx_close(trx);
+			if (rc != 0) {
+				LOGP(DL1C, LOGL_ERROR,
+				     "Cannot close TRX, it is already closed!\n");
+			}
+			granted = 1;
+			break;
+
+		case NM_STATE_UNLOCKED:
+
+			if (trx_locked) {
+				trx_locked = 0;
+				l1if_activate_rf(trx, 1);
+			}
+
+			granted = 1;
+			break;
+
+		default:
+			granted = 1;
+			break;
+		}
+
+		mo->procedure_pending = 0;
+		break;
+
+	default:
+		/* blindly accept all state changes */
+		granted = 1;
+		break;
+	}
+
+	if (granted) {
+		mo->nm_state.administrative = adm_state;
+		return oml_mo_statechg_ack(mo);
+	} else
+		return oml_mo_statechg_nack(mo, NM_NACK_REQ_NOT_GRANT);
+
 }
 
 int bts_model_trx_deact_rf(struct gsm_bts_trx *trx)

-- 
To view, visit https://gerrit.osmocom.org/906
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I034114beca95210169429d8ac1eb8648df12fc6c
Gerrit-PatchSet: 10
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list