Change in osmo-bts[master]: trx_provision_fsm: poweronoff_sent flag: track POWERON and POWEROFF s...

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
Mon Oct 4 14:33:12 UTC 2021


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

Change subject: trx_provision_fsm: poweronoff_sent flag: track POWERON and POWEROFF separately
......................................................................

trx_provision_fsm: poweronoff_sent flag: track POWERON and POWEROFF separately

It helps better understanding the code, and will allow handling
situations where for instance a POWERON in in transit while the BTS is
instructed to shutdown, hence a POWEROFF needs to be sent.

Change-Id: Iaf62217ceab7420afa4140cba61e1c2f983c61b4
---
M include/osmo-bts/phy_link.h
M src/osmo-bts-trx/trx_provision_fsm.c
2 files changed, 11 insertions(+), 8 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h
index ac38c28..862ed48 100644
--- a/include/osmo-bts/phy_link.h
+++ b/include/osmo-bts/phy_link.h
@@ -50,7 +50,8 @@
 			bool use_legacy_setbsic;
 			uint8_t trxd_pdu_ver_max; /* Maximum TRXD PDU version to negotiate */
 			bool powered; /* last POWERON (true) or POWEROFF (false) confirmed */
-			bool poweronoff_sent; /* is there a POWERON/POWEROFF in transit? (one or the other based on ->powered) */
+			bool poweron_sent; /* is there a POWERON in transit? */
+			bool poweroff_sent; /* is there a POWEROFF in transit? */
 		} osmotrx;
 		struct {
 			char *mcast_dev;		/* Network device for multicast */
diff --git a/src/osmo-bts-trx/trx_provision_fsm.c b/src/osmo-bts-trx/trx_provision_fsm.c
index 4ea6758..3d7eebf 100644
--- a/src/osmo-bts-trx/trx_provision_fsm.c
+++ b/src/osmo-bts-trx/trx_provision_fsm.c
@@ -50,12 +50,14 @@
 	struct phy_link *plink = pinst->phy_link;
 
 	plink->u.osmotrx.powered = poweronoff;
-	plink->u.osmotrx.poweronoff_sent = false;
 
-	if (poweronoff)
+	if (poweronoff) {
+		plink->u.osmotrx.poweron_sent = false;
 		osmo_fsm_inst_dispatch(l1h->provision_fi, TRX_PROV_EV_POWERON_CNF, (void*)(intptr_t)rc);
-	else
+	} else {
+		plink->u.osmotrx.poweroff_sent = false;
 		osmo_fsm_inst_dispatch(l1h->provision_fi, TRX_PROV_EV_POWEROFF_CNF, (void*)(intptr_t)rc);
+	}
 }
 
 
@@ -520,7 +522,7 @@
 	struct phy_instance *pinst = l1h->phy_inst;
 
 	trx_if_cmd_poweron(l1h, l1if_poweronoff_cb);
-	pinst->phy_link->u.osmotrx.poweronoff_sent = true;
+	pinst->phy_link->u.osmotrx.poweron_sent = true;
 }
 
 static void st_open_wait_power_cnf(struct osmo_fsm_inst *fi, uint32_t event, void *data)
@@ -588,9 +590,9 @@
 	switch (event) {
 	case TRX_PROV_EV_CLOSE:
 		/* power off transceiver, if not already */
-		if (pinst->num == 0 && plink->u.osmotrx.powered && !plink->u.osmotrx.poweronoff_sent) {
-				trx_if_cmd_poweroff(l1h, l1if_poweronoff_cb);
-				plink->u.osmotrx.poweronoff_sent = true;
+		if (pinst->num == 0 && plink->u.osmotrx.powered && !plink->u.osmotrx.poweroff_sent) {
+			trx_if_cmd_poweroff(l1h, l1if_poweronoff_cb);
+			plink->u.osmotrx.poweroff_sent = true;
 		}
 		trx_prov_fsm_state_chg(fi, TRX_PROV_ST_OPEN_WAIT_POWEROFF_CNF);
 		break;

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Iaf62217ceab7420afa4140cba61e1c2f983c61b4
Gerrit-Change-Number: 25679
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211004/db080d50/attachment.htm>


More information about the gerrit-log mailing list