Change in osmocom-bb[master]: trxcon: Suppress POWERON to TRX if we're already powered on.

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu May 30 13:42:16 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/14275


Change subject: trxcon: Suppress POWERON to TRX if we're already powered on.
......................................................................

trxcon: Suppress POWERON to TRX if we're already powered on.

The existing logic unconditionally wants to send a POWERUP command
whenever L1CTL_DM_EST_REQ is received.  That's odd, as it's perfectly
legal to establish, then release (DM_REL_REQ) and finally establish
another connection.

The existing fsm state could unfortunately not been used, as it's a
mixture between the TRX connection state and the command/response state.

I'm explicitly not rejecting POWEROFF despite trxcon thinking it's
powered up: This can happen if fake_trx is restarted while trxcon
is running.

Change-Id: I834e8897b95a2490811319697fc7cab6076db480
---
M src/host/trxcon/trx_if.c
M src/host/trxcon/trx_if.h
2 files changed, 11 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/75/14275/1

diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index 35ad3c0..894aed2 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -254,6 +254,10 @@
 
 int trx_if_cmd_poweron(struct trx_instance *trx)
 {
+	if (trx->powered_up) {
+		LOGP(DTRX, LOGL_INFO, "Suppressing POWERON as we're already powered up\n");
+		return 0;
+	}
 	return trx_ctrl_cmd(trx, 1, "POWERON", "");
 }
 
@@ -495,10 +499,14 @@
 	}
 
 	/* Trigger state machine */
-	if (!strncmp(tcm->cmd + 4, "POWERON", 7))
+	if (!strncmp(tcm->cmd + 4, "POWERON", 7)) {
+		trx->powered_up = true;
 		osmo_fsm_inst_state_chg(trx->fsm, TRX_STATE_ACTIVE, 0, 0);
-	else if (!strncmp(tcm->cmd + 4, "POWEROFF", 8))
+	}
+	else if (!strncmp(tcm->cmd + 4, "POWEROFF", 8)) {
+		trx->powered_up = false;
 		osmo_fsm_inst_state_chg(trx->fsm, TRX_STATE_IDLE, 0, 0);
+	}
 	else if (!strncmp(tcm->cmd + 4, "MEASURE", 7))
 		trx_if_measure_rsp_cb(trx, buf + 14);
 	else if (!strncmp(tcm->cmd + 4, "ECHO", 4))
diff --git a/src/host/trxcon/trx_if.h b/src/host/trxcon/trx_if.h
index 0b3f36f..8655c15 100644
--- a/src/host/trxcon/trx_if.h
+++ b/src/host/trxcon/trx_if.h
@@ -26,6 +26,7 @@
 	struct llist_head trx_ctrl_list;
 	struct osmo_fsm_inst *fsm;
 	uint32_t prev_state;
+	bool powered_up;
 
 	/* GSM L1 specific */
 	uint16_t pm_band_arfcn_start;

-- 
To view, visit https://gerrit.osmocom.org/14275
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I834e8897b95a2490811319697fc7cab6076db480
Gerrit-Change-Number: 14275
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190530/a0f19490/attachment.htm>


More information about the gerrit-log mailing list