Change in osmo-bts[master]: trx_provision_fsm: Support OPEN_POWEROFF->CLOSED transition

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/.

pespin gerrit-no-reply at lists.osmocom.org
Wed Sep 29 17:32:49 UTC 2021


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


Change subject: trx_provision_fsm: Support OPEN_POWEROFF->CLOSED transition
......................................................................

trx_provision_fsm: Support OPEN_POWEROFF->CLOSED transition

This may happen if bts_shutdown starts a poweroff procedure while
POWERON was still not sent to the TRX. In this case, we want to go back
to initial closed state to fullfill expected state when BTS is shutdown.

Change-Id: Id660fa1018ef175ab237733b37629c56313c061d
---
M src/osmo-bts-trx/trx_provision_fsm.c
1 file changed, 28 insertions(+), 10 deletions(-)



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

diff --git a/src/osmo-bts-trx/trx_provision_fsm.c b/src/osmo-bts-trx/trx_provision_fsm.c
index cdca852..39fb608 100644
--- a/src/osmo-bts-trx/trx_provision_fsm.c
+++ b/src/osmo-bts-trx/trx_provision_fsm.c
@@ -296,6 +296,24 @@
 	return true;
 }
 
+/* Closes a phy_link and all its associated TRX */
+static void trx_prov_fsm_apply_close(struct phy_link *plink, int rc)
+{
+	struct trx_l1h *l1h;
+	struct phy_instance *pinst;
+
+	if (plink->state == PHY_LINK_SHUTDOWN)
+		return;
+
+	bts_model_phy_link_close(plink);
+	/* Notify TRX close on all TRX associated with this phy */
+	llist_for_each_entry(pinst, &plink->instances, list) {
+		l1h = pinst->u.osmotrx.hdl;
+		trx_prov_fsm_state_chg(l1h->provision_fi, TRX_PROV_ST_CLOSED);
+		bts_model_trx_close_cb(pinst->trx, rc);
+	}
+}
+
 //////////////////////////
 // FSM STATE ACTIONS
 //////////////////////////
@@ -345,6 +363,13 @@
 	bool others_ready;
 
 	switch (event) {
+	case TRX_PROV_EV_CLOSE:
+		/* In this state, we didn't for sure send a POWERON yet, hence we
+		   are save directly applying the close as if we received a
+		   POWEROFF RSP: */
+		if (pinst->num == 0)
+			trx_prov_fsm_apply_close(pinst->phy_link, 0);
+		return;
 	case TRX_PROV_EV_CFG_ENABLE:
 		l1h->config.enabled =(bool)data;
 		break;
@@ -584,16 +609,7 @@
 	switch (event) {
 	case TRX_PROV_EV_POWEROFF_CNF:
 		rc = (uint16_t)(intptr_t)data;
-		if (plink->state != PHY_LINK_SHUTDOWN) {
-			bts_model_phy_link_close(plink);
-
-			/* Notify TRX close on all TRX associated with this phy */
-			llist_for_each_entry(pinst, &plink->instances, list) {
-				l1h = pinst->u.osmotrx.hdl;
-				trx_prov_fsm_state_chg(l1h->provision_fi, TRX_PROV_ST_CLOSED);
-				bts_model_trx_close_cb(pinst->trx, rc);
-			}
-		}
+		trx_prov_fsm_apply_close(plink, rc);
 		break;
 	default:
 		OSMO_ASSERT(0);
@@ -611,6 +627,7 @@
 	},
 	[TRX_PROV_ST_OPEN_POWEROFF] = {
 		.in_event_mask =
+			X(TRX_PROV_EV_CLOSE) |
 			X(TRX_PROV_EV_OTHER_TRX_READY) |
 			X(TRX_PROV_EV_CFG_ENABLE) |
 			X(TRX_PROV_EV_CFG_BSIC) |
@@ -623,6 +640,7 @@
 			X(TRX_PROV_EV_SETTSC_CNF) |
 			X(TRX_PROV_EV_SETFORMAT_CNF),
 		.out_state_mask =
+			X(TRX_PROV_ST_CLOSED) |
 			X(TRX_PROV_ST_OPEN_WAIT_POWERON_CNF) |
 			X(TRX_PROV_ST_OPEN_POWERON),
 		.name = "OPEN_POWEROFF",

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id660fa1018ef175ab237733b37629c56313c061d
Gerrit-Change-Number: 25644
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210929/f82331cf/attachment.htm>


More information about the gerrit-log mailing list