Change in ...osmo-bts[master]: osmo-bts-trx/trx_if.c: request the newest TRXD header version

fixeria gerrit-no-reply at lists.osmocom.org
Wed Jun 26 19:38:37 UTC 2019


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/14611


Change subject: osmo-bts-trx/trx_if.c: request the newest TRXD header version
......................................................................

osmo-bts-trx/trx_if.c: request the newest TRXD header version

This change introduces the new command for TRXD header version
negotiation - SETFORMAT. Old transceivers would reject it as
an unknown command. FakeTRX confirms all unknown commands with
status 0. The modern transceivers should respond with status
code equal to or less than the requested header version.

Change-Id: I8afe950bd1ec2afaf3347ff848ee46e69c4f5011
---
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/l1_if.h
M src/osmo-bts-trx/trx_if.c
M src/osmo-bts-trx/trx_if.h
4 files changed, 44 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/11/14611/1

diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index e6e384a..816d745 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -208,6 +208,9 @@
 			l1h->config.bsic_sent = 1;
 		}
 
+		/* Ask transceiver to use the newest TRXD header version */
+		trx_if_cmd_setformat(l1h, TRX_DATA_FORMAT_VER);
+
 		if (!l1h->config.poweron_sent) {
 			trx_if_cmd_poweron(l1h);
 			l1h->config.poweron_sent = 1;
diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h
index 9c95c53..90c2758 100644
--- a/src/osmo-bts-trx/l1_if.h
+++ b/src/osmo-bts-trx/l1_if.h
@@ -8,6 +8,7 @@
 struct trx_config {
 	uint8_t			poweron;	/* poweron(1) or poweroff(0) */
 	int			poweron_sent;
+	uint8_t			trxd_hdr_ver;
 
 	int			arfcn_valid;
 	uint16_t		arfcn;
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index 3fc06b8..2bf2a8d 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -272,6 +272,14 @@
 		return 0;
 }
 
+/*! Send "SETFORMAT" command to TRX: change TRXD header format version */
+int trx_if_cmd_setformat(struct trx_l1h *l1h, uint8_t ver)
+{
+	LOGPPHI(l1h->phy_inst, DTRX, LOGL_INFO,
+		"Requesting TRXD header format version %u\n", ver);
+	return trx_ctrl_cmd(l1h, 0, "SETFORMAT", "%u", ver);
+}
+
 /*! Send "SETTSC" command to TRX */
 int trx_if_cmd_settsc(struct trx_l1h *l1h, uint8_t tsc)
 {
@@ -463,6 +471,30 @@
 	return rsp->status == 0 ? 0 : -EINVAL;
 }
 
+/* Old transceivers would reject SETFORMAT as an unknown command. FakeTRX confirms
+ * all unknown commands with status 0. The modern transceivers should respond
+ * with status code equal to or less than the requested version. */
+static int trx_ctrl_rx_rsp_setformat(struct trx_l1h *l1h, struct trx_ctrl_rsp *rsp)
+{
+	if (rsp->status < 0 || rsp->status > TRX_DATA_FORMAT_VER) {
+		LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
+			"TRX indicated an unsupported header "
+			"format version %d\n", rsp->status);
+		return -EINVAL;
+	} else if (rsp->status == -1 || rsp->status == 0) {
+		l1h->config.trxd_hdr_ver = 0;
+		LOGPPHI(l1h->phy_inst, DTRX, LOGL_NOTICE,
+			"Using legacy TRXD header format version\n");
+	} else {
+		l1h->config.trxd_hdr_ver = rsp->status;
+		LOGPPHI(l1h->phy_inst, DTRX, LOGL_INFO,
+			"Using TRXD header format version %u\n",
+			l1h->config.trxd_hdr_ver);
+	}
+
+	return 0;
+}
+
 /* -EINVAL: unrecoverable error, exit BTS
  * N > 0: try sending originating command again after N seconds
  * 0: Done with response, get originating command out from send queue
@@ -487,6 +519,8 @@
 		}
 	} else if (strcmp(rsp->cmd, "SETSLOT") == 0) {
 		return trx_ctrl_rx_rsp_setslot(l1h, rsp);
+	} else if (strcmp(rsp->cmd, "SETFORMAT") == 0) {
+		return trx_ctrl_rx_rsp_setformat(l1h, rsp);
 	}
 
 	if (rsp->status) {
diff --git a/src/osmo-bts-trx/trx_if.h b/src/osmo-bts-trx/trx_if.h
index cdfbd41..a76065c 100644
--- a/src/osmo-bts-trx/trx_if.h
+++ b/src/osmo-bts-trx/trx_if.h
@@ -35,4 +35,10 @@
 	const ubit_t *bits, uint16_t nbits);
 int trx_if_powered(struct trx_l1h *l1h);
 
+/* The latest supported TRXD header format version */
+#define TRX_DATA_FORMAT_VER    0
+
+/* Format negotiation command */
+int trx_if_cmd_setformat(struct trx_l1h *l1h, uint8_t ver);
+
 #endif /* TRX_IF_H */

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I8afe950bd1ec2afaf3347ff848ee46e69c4f5011
Gerrit-Change-Number: 14611
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190626/284caded/attachment.html>


More information about the gerrit-log mailing list