Change in ...osmo-bts[master]: bts-trx: Introduce VTY command osmotrx trxd-max-version

laforge gerrit-no-reply at lists.osmocom.org
Wed Jul 24 19:22:38 UTC 2019


laforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-bts/+/14896 )

Change subject: bts-trx: Introduce VTY command osmotrx trxd-max-version
......................................................................

bts-trx: Introduce VTY command osmotrx trxd-max-version

This command allows setting a maximum TRXD format version to negotiate
with TRX. osmo-bts-trx will hence end up using that version if supported
by TRX, or a lower one otherwise (or fail if TRX doesn't support any of
them).
Since now the maximum version can be 0, avoid going through SETFORMAT
negotiation in that case, since 0 is the default version. This way we
keep backward compatibility with TRX implementations that exit upon
receival of unknown commands (such as SC5 current one).

The VTY command is located in the "phy" node instead of the "phy
instance" node because instances of same phy are expected to use same
host with same implementation, so TRXD version to use should be the same
for both.

Related: OS#4006
Change-Id: I5eb1fdc002f9d7f4acf475356d8fc998dc8f6326
---
M include/osmo-bts/phy_link.h
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/main.c
M src/osmo-bts-trx/trx_vty.c
4 files changed, 36 insertions(+), 4 deletions(-)

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



diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h
index 273103c..3bf5159 100644
--- a/include/osmo-bts/phy_link.h
+++ b/include/osmo-bts/phy_link.h
@@ -50,6 +50,7 @@
 			uint32_t clock_advance;
 			uint32_t rts_advance;
 			bool use_legacy_setbsic;
+			uint8_t	 trxd_hdr_ver_max; /* Maximum TRXD header version to negotiate */
 		} osmotrx;
 		struct {
 			char *mcast_dev;		/* Network device for multicast */
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 9c1dc18..22ef2d7 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -185,6 +185,7 @@
 int l1if_provision_transceiver_trx(struct trx_l1h *l1h)
 {
 	uint8_t tn;
+	struct phy_link *plink = l1h->phy_inst->phy_link;
 
 	if (!transceiver_available)
 		return -EIO;
@@ -208,10 +209,11 @@
 			l1h->config.bsic_sent = 1;
 		}
 
-		/* Ask transceiver to use the newest TRXD header version */
-		if (!l1h->config.setformat_sent) {
-			trx_if_cmd_setformat(l1h, TRX_DATA_FORMAT_VER);
-			l1h->config.trxd_hdr_ver_req = TRX_DATA_FORMAT_VER;
+		/* Ask transceiver to use the newest TRXD header version if not using it yet */
+		if (!l1h->config.setformat_sent &&
+		    l1h->config.trxd_hdr_ver_use != plink->u.osmotrx.trxd_hdr_ver_max) {
+			trx_if_cmd_setformat(l1h, plink->u.osmotrx.trxd_hdr_ver_max);
+			l1h->config.trxd_hdr_ver_req = plink->u.osmotrx.trxd_hdr_ver_max;
 			l1h->config.setformat_sent = 1;
 		}
 
diff --git a/src/osmo-bts-trx/main.c b/src/osmo-bts-trx/main.c
index 9529190..b1fa207 100644
--- a/src/osmo-bts-trx/main.c
+++ b/src/osmo-bts-trx/main.c
@@ -134,6 +134,8 @@
 	plink->u.osmotrx.trx_ta_loop = true;
 	plink->u.osmotrx.trx_ms_power_loop = false;
 	plink->u.osmotrx.trx_target_rssi = -10;
+	/* attempt use newest TRXD version by default: */
+	plink->u.osmotrx.trxd_hdr_ver_max = TRX_DATA_FORMAT_VER;
 }
 
 void bts_model_phy_instance_set_defaults(struct phy_instance *pinst)
diff --git a/src/osmo-bts-trx/trx_vty.c b/src/osmo-bts-trx/trx_vty.c
index b9af445..c52908e 100644
--- a/src/osmo-bts-trx/trx_vty.c
+++ b/src/osmo-bts-trx/trx_vty.c
@@ -496,6 +496,29 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_phy_trxd_max_version, cfg_phy_trxd_max_version_cmd,
+	"osmotrx trxd-max-version (latest|<0-15>)", OSMOTRX_STR
+	"Set maximum TRXD format version to negotiate with TRX\n"
+	"Use latest supported TRXD format version (default)\n"
+	"Maximum TRXD format version number\n")
+{
+	struct phy_link *plink = vty->index;
+
+	int max_ver;
+	if (strcmp(argv[0], "latest") == 0)
+		max_ver = TRX_DATA_FORMAT_VER;
+	else
+		max_ver = atoi(argv[0]);
+	if (max_ver > TRX_DATA_FORMAT_VER) {
+		vty_out(vty, "%% Format version %d is not supported, maximum supported is %d%s",
+			max_ver, TRX_DATA_FORMAT_VER, VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+	plink->u.osmotrx.trxd_hdr_ver_max = max_ver;
+
+	return CMD_SUCCESS;
+}
+
 void bts_model_config_write_phy(struct vty *vty, struct phy_link *plink)
 {
 	if (plink->u.osmotrx.local_ip)
@@ -525,6 +548,9 @@
 
 	if (plink->u.osmotrx.use_legacy_setbsic)
 		vty_out(vty, " osmotrx legacy-setbsic%s", VTY_NEWLINE);
+
+	if (plink->u.osmotrx.trxd_hdr_ver_max != TRX_DATA_FORMAT_VER)
+		vty_out(vty, " osmotrx trxd-max-version %d%s", plink->u.osmotrx.trxd_hdr_ver_max, VTY_NEWLINE);
 }
 
 void bts_model_config_write_phy_inst(struct vty *vty, struct phy_instance *pinst)
@@ -584,6 +610,7 @@
 	install_element(PHY_NODE, &cfg_phy_osmotrx_ip_cmd);
 	install_element(PHY_NODE, &cfg_phy_setbsic_cmd);
 	install_element(PHY_NODE, &cfg_phy_no_setbsic_cmd);
+	install_element(PHY_NODE, &cfg_phy_trxd_max_version_cmd);
 
 	install_element(PHY_INST_NODE, &cfg_phyinst_rxgain_cmd);
 	install_element(PHY_INST_NODE, &cfg_phyinst_tx_atten_cmd);

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I5eb1fdc002f9d7f4acf475356d8fc998dc8f6326
Gerrit-Change-Number: 14896
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at gnumonks.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/20190724/531063a8/attachment.html>


More information about the gerrit-log mailing list