aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-octphy
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-01-16 13:11:35 +0100
committerHarald Welte <laforge@gnumonks.org>2016-01-16 17:26:26 +0100
commit866f9b979d0c8a36e76db8272693d59bfba9c0f5 (patch)
treeca11767eb127dae793d3d2a19ecbc270426cacea /src/osmo-bts-octphy
parent3e98f942e51ca5f39a09adcb3d0d68d93b1588b0 (diff)
OCTPHY: Obtain information from PHY and expose it in VTY
This adds 'show trx 0 system-information' command to the VTY indicating various version information obtained from the DSP/PHY.
Diffstat (limited to 'src/osmo-bts-octphy')
-rw-r--r--src/osmo-bts-octphy/l1_if.c5
-rw-r--r--src/osmo-bts-octphy/l1_if.h12
-rw-r--r--src/osmo-bts-octphy/l1_oml.c93
-rw-r--r--src/osmo-bts-octphy/octphy_vty.c30
4 files changed, 136 insertions, 4 deletions
diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index 2c029177..6d8932e4 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -1357,8 +1357,9 @@ static int rx_octvc1_ctrl_msg(struct msgb *msg)
/* DO NOT YET SWAP HEADER HERE, as downstream functions want to
* swap it */
- /* OCTSDKAN5001 Chapter 3.1 */
- if (length < 24 || length > 1024) {
+ /* FIXME: OCTSDKAN5001 Chapter 3.1 states max size is 1024, but we see
+ * larger messages in practise */
+ if (length < 24 || length > 2048) {
LOGP(DL1C, LOGL_ERROR, "Rx CTRL length %u invalid\n", length);
msgb_free(msg);
return -1;
diff --git a/src/osmo-bts-octphy/l1_if.h b/src/osmo-bts-octphy/l1_if.h
index be2338b3..42778659 100644
--- a/src/osmo-bts-octphy/l1_if.h
+++ b/src/osmo-bts-octphy/l1_if.h
@@ -38,6 +38,18 @@ struct octphy_hdl {
uint32_t tx_atten_db;
} config;
+ struct {
+ struct {
+ char *name;
+ char *description;
+ char *version;
+ } app;
+ struct {
+ char *platform;
+ char *version;
+ } system;
+ } info;
+
/* This is a list of outstanding commands sent to the PHY, for which we
* currently still wait for a response. Represented by 'struct
* wait_l1_conf' in l1_if.c - Octasic calls this the 'Unacknowledged
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index d682b841..0a2b9ef7 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -1,7 +1,7 @@
/* Layer 1 (PHY) interface of osmo-bts OCTPHY integration */
/* Copyright (c) 2014 Octasic Inc. All rights reserved.
- * Copyright (c) 2015 Harald Welte <laforge@gnumonks.org>
+ * Copyright (c) 2015-2016 Harald Welte <laforge@gnumonks.org>
*
* based on a copy of osmo-bts-sysmo/l1_oml.c, which is
* Copyright (C) 2011 by Harald Welte <laforge@gnumonks.org>
@@ -1105,6 +1105,94 @@ int l1if_enable_events(struct gsm_bts_trx *trx)
return l1if_req_compl(fl1h, msg, enable_events_compl_cb, 0);
}
+#define talloc_replace(dst, ctx, src) \
+ do { \
+ if (dst) \
+ talloc_free(dst); \
+ dst = talloc_strdup(ctx, (const char *) src); \
+ } while (0)
+
+static int app_info_sys_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp, void *data)
+{
+ struct octphy_hdl *fl1h = resp->dst;
+ tOCTVC1_MAIN_MSG_APPLICATION_INFO_SYSTEM_RSP *aisr =
+ (tOCTVC1_MAIN_MSG_APPLICATION_INFO_SYSTEM_RSP *) resp->l2h;
+
+ /* in a completion call-back, we take msgb ownership and must
+ * release it before returning */
+
+ mOCTVC1_MAIN_MSG_APPLICATION_INFO_SYSTEM_RSP_SWAP(aisr);
+
+ LOGP(DL1C, LOGL_INFO, "Rx APP-INFO-SYSTEM.resp (platform='%s', version='%s')\n",
+ aisr->szPlatform, aisr->szVersion);
+
+ talloc_replace(fl1h->info.system.platform, fl1h, aisr->szPlatform);
+ talloc_replace(fl1h->info.system.version, fl1h, aisr->szVersion);
+
+ msgb_free(resp);
+
+ return 0;
+}
+
+int l1if_check_app_sys_version(struct gsm_bts_trx *trx)
+{
+ struct octphy_hdl *fl1h = trx_octphy_hdl(trx);
+ struct msgb *msg = l1p_msgb_alloc();
+ tOCTVC1_MAIN_MSG_APPLICATION_INFO_SYSTEM_CMD *ais;
+
+ ais = (tOCTVC1_MAIN_MSG_APPLICATION_INFO_SYSTEM_CMD *)
+ msgb_put(msg, sizeof(*ais));
+ l1if_fill_msg_hdr(&ais->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND,
+ cOCTVC1_MAIN_MSG_APPLICATION_INFO_SYSTEM_CID);
+
+ mOCTVC1_MAIN_MSG_APPLICATION_INFO_SYSTEM_CMD_SWAP(ais);
+
+ LOGP(DL1C, LOGL_INFO, "Tx APP-INFO-SYSTEM.req\n");
+
+ return l1if_req_compl(fl1h, msg, app_info_sys_compl_cb, 0);
+}
+
+static int app_info_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp, void *data)
+{
+ struct octphy_hdl *fl1h = resp->dst;
+ tOCTVC1_MAIN_MSG_APPLICATION_INFO_RSP *air =
+ (tOCTVC1_MAIN_MSG_APPLICATION_INFO_RSP *) resp->l2h;
+
+ /* in a completion call-back, we take msgb ownership and must
+ * release it before returning */
+
+ mOCTVC1_MAIN_MSG_APPLICATION_INFO_RSP_SWAP(air);
+
+ LOGP(DL1C, LOGL_INFO, "Rx APP-INFO.resp (name='%s', desc='%s', ver='%s')\n",
+ air->szName, air->szDescription, air->szVersion);
+
+ talloc_replace(fl1h->info.app.name, fl1h, air->szName);
+ talloc_replace(fl1h->info.app.description, fl1h, air->szDescription);
+ talloc_replace(fl1h->info.app.version, fl1h, air->szVersion);
+
+ msgb_free(resp);
+
+ return 0;
+}
+
+
+int l1if_check_app_version(struct gsm_bts_trx *trx)
+{
+ struct octphy_hdl *fl1h = trx_octphy_hdl(trx);
+ struct msgb *msg = l1p_msgb_alloc();
+ tOCTVC1_MAIN_MSG_APPLICATION_INFO_CMD *ai;
+
+ ai = (tOCTVC1_MAIN_MSG_APPLICATION_INFO_CMD *) msgb_put(msg, sizeof(*ai));
+ l1if_fill_msg_hdr(&ai->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND,
+ cOCTVC1_MAIN_MSG_APPLICATION_INFO_CID);
+
+ mOCTVC1_MAIN_MSG_APPLICATION_INFO_CMD_SWAP(ai);
+
+ LOGP(DL1C, LOGL_INFO, "Tx APP-INFO.req\n");
+
+ return l1if_req_compl(fl1h, msg, app_info_compl_cb, 0);
+}
+
/* call-back once the TRX_OPEN_CID response arrives */
static int trx_open_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp, void *data)
{
@@ -1227,6 +1315,9 @@ static int trx_init(struct gsm_bts_trx *trx)
l1if_trx_close_all(trx->bts);
+ l1if_check_app_version(trx);
+ l1if_check_app_sys_version(trx);
+
return l1if_trx_open(trx);
}
diff --git a/src/osmo-bts-octphy/octphy_vty.c b/src/osmo-bts-octphy/octphy_vty.c
index 1b3a3652..55c9099c 100644
--- a/src/osmo-bts-octphy/octphy_vty.c
+++ b/src/osmo-bts-octphy/octphy_vty.c
@@ -1,6 +1,6 @@
/* VTY interface for osmo-bts OCTPHY integration */
-/* (C) 2015 by Harald Welte <laforge@gnumonks.org>
+/* (C) 2015-2016 by Harald Welte <laforge@gnumonks.org>
*
* All Rights Reserved
*
@@ -179,6 +179,33 @@ void bts_model_config_write_trx(struct vty *vty, struct gsm_bts_trx *trx)
VTY_NEWLINE);
}
+DEFUN(show_sys_info, show_sys_info_cmd,
+ "show trx <0-255> system-information",
+ SHOW_TRX_STR "Display information about system\n")
+{
+ int trx_nr = atoi(argv[0]);
+ struct gsm_bts_trx *trx = gsm_bts_trx_num(vty_bts, trx_nr);
+ struct octphy_hdl *fl1h;
+ int i;
+
+ if (!trx) {
+ vty_out(vty, "Cannot find TRX number %u%s",
+ trx_nr, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ fl1h = trx_octphy_hdl(trx);
+
+ vty_out(vty, "System Platform: '%s', Version: '%s'%s",
+ fl1h->info.system.platform, fl1h->info.system.version,
+ VTY_NEWLINE);
+ vty_out(vty, "Application Name: '%s', Description: '%s', Version: '%s'%s",
+ fl1h->info.app.name, fl1h->info.app.description,
+ fl1h->info.app.version, VTY_NEWLINE);
+
+ return CMD_SUCCESS;
+}
+
+
int bts_model_vty_init(struct gsm_bts *bts)
{
vty_bts = bts;
@@ -192,6 +219,7 @@ int bts_model_vty_init(struct gsm_bts *bts)
install_element_ve(&get_rf_port_stats_cmd);
install_element_ve(&get_clk_sync_stats_cmd);
+ install_element_ve(&show_sys_info_cmd);
return 0;
}