diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-05-19 17:14:35 +0200 |
---|---|---|
committer | fixeria <vyanitskiy@sysmocom.de> | 2021-06-10 11:53:24 +0000 |
commit | 85c2d641d5bd9294378a9d3bb73aac7cf868aa77 (patch) | |
tree | 8b85d02e4e39c31336cb1c34bb50229d36ce4c25 | |
parent | bd49fd24925e07e08c02c8be6dee26f4f751220f (diff) |
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
-rw-r--r-- | src/common/phy_link.c | 2 | ||||
-rw-r--r-- | src/common/vty.c | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/common/phy_link.c b/src/common/phy_link.c index 7743c222..5ad72ac7 100644 --- a/src/common/phy_link.c +++ b/src/common/phy_link.c @@ -118,6 +118,8 @@ struct phy_instance *phy_instance_create(struct phy_link *plink, int num) 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 8a1bafc4..e9a168f1 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -987,8 +987,13 @@ DEFUN(cfg_trx_phy, cfg_trx_phy_cmd, 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; } |