Change in osmo-bts[master]: common/vty: facilitate finding duplicate PHY/TRX associations

fixeria gerrit-no-reply at lists.osmocom.org
Thu Jun 10 11:53:25 UTC 2021


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

Change subject: common/vty: facilitate finding duplicate PHY/TRX associations
......................................................................

common/vty: facilitate finding duplicate PHY/TRX associations

In cfg_trx_phy_cmd(), use phy_instance_link_to_trx() and ensure
that a PHY instance can be bound to a transceiver only once.

Change-Id: I132e08fc496abef278b94254cebfac7a4285a7c2
---
M src/common/phy_link.c
M src/common/vty.c
2 files changed, 9 insertions(+), 2 deletions(-)

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



diff --git a/src/common/phy_link.c b/src/common/phy_link.c
index 7743c22..5ad72ac 100644
--- a/src/common/phy_link.c
+++ b/src/common/phy_link.c
@@ -118,6 +118,8 @@
 
 void phy_instance_link_to_trx(struct phy_instance *pinst, struct gsm_bts_trx *trx)
 {
+	/* There might already be an associated TRX */
+	OSMO_ASSERT(pinst->trx == NULL)
 	trx->pinst = pinst;
 	pinst->trx = trx;
 }
diff --git a/src/common/vty.c b/src/common/vty.c
index 8a1bafc..e9a168f 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -987,8 +987,13 @@
 		return CMD_WARNING;
 	}
 
-	trx->pinst = pinst;
-	pinst->trx = trx;
+	if (pinst->trx != NULL) {
+		vty_out(vty, "phy%s instance %s is already bound to %s%s",
+			argv[0], argv[1], gsm_trx_name(pinst->trx), VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	phy_instance_link_to_trx(pinst, trx);
 
 	return CMD_SUCCESS;
 }

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I132e08fc496abef278b94254cebfac7a4285a7c2
Gerrit-Change-Number: 24289
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
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/20210610/c9fba3c7/attachment.htm>


More information about the gerrit-log mailing list