aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2019-10-15 00:33:07 +0300
committerpespin <pespin@sysmocom.de>2019-10-21 08:41:07 +0000
commit9a87d90c1ec20eecb48caea2d01687f0e9ad3fcd (patch)
tree9dcb63a17230f091ef82202922a7f8153d094964
parent066fd04f471ad55639b5cc6dd13b8aa9ca7c1f40 (diff)
vty: Simplify filler burst settings and improve help and readability.
In the command line options time, filler table/filer burts settings were a bit difficult to undertand because the number of one-letter settings was limited. Now, with VTY configuration, there is no reason to keep it so difficult. Also, after the previous commit it was no longer posible to enable random 8-PSK filler bursts. With this patch you can configure all supported filler bursts in a simple and logical way. Change-Id: I752eb2c1162d084e8769181f2fcd6c0877663448
-rw-r--r--CommonLibs/trx_vty.c147
-rw-r--r--CommonLibs/trx_vty.h3
-rw-r--r--Transceiver52M/osmo-trx.cpp6
3 files changed, 81 insertions, 75 deletions
diff --git a/CommonLibs/trx_vty.c b/CommonLibs/trx_vty.c
index 2c7ecc2..02d6572 100644
--- a/CommonLibs/trx_vty.c
+++ b/CommonLibs/trx_vty.c
@@ -48,15 +48,25 @@ static const struct value_string clock_ref_names[] = {
{ 0, NULL }
};
-static const struct value_string filler_names[] = {
- { FILLER_DUMMY, "Dummy bursts" },
- { FILLER_ZERO, "Disabled" },
- { FILLER_NORM_RAND, "Normal bursts with random payload" },
- { FILLER_EDGE_RAND, "EDGE bursts with random payload" },
- { FILLER_ACCESS_RAND, "Access bursts with random payload" },
+const struct value_string filler_names[] = {
+ { FILLER_DUMMY, "Dummy bursts (C0 only)" },
+ { FILLER_ZERO, "Empty bursts" },
+ { FILLER_NORM_RAND, "GMSK Normal Bursts with random payload" },
+ { FILLER_EDGE_RAND, "8-PSK Normal Bursts with random payload" },
+ { FILLER_ACCESS_RAND, "Access Bursts with random payload" },
{ 0, NULL }
};
+static const struct value_string filler_types[] = {
+ { FILLER_DUMMY, "dummy" },
+ { FILLER_ZERO, "zero" },
+ { FILLER_NORM_RAND, "random-nb-gmsk" },
+ { FILLER_EDGE_RAND, "random-nb-8psk" },
+ { FILLER_ACCESS_RAND, "random-ab" },
+ { 0, NULL }
+};
+
+
struct trx_ctx *trx_from_vty(struct vty *v)
{
/* It can't hurt to force callers to continue to pass the vty instance
@@ -172,53 +182,6 @@ DEFUN(cfg_rx_sps, cfg_rx_sps_cmd,
return CMD_SUCCESS;
}
-DEFUN(cfg_test_rtsc, cfg_test_rtsc_cmd,
- "test rtsc <0-7>",
- "Set the Random Normal Burst test mode with TSC\n"
- "TSC\n")
-{
- struct trx_ctx *trx = trx_from_vty(vty);
-
- if (trx->cfg.rach_delay_set) {
- vty_out(vty, "rach-delay and rtsc options are mutual-exclusive%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- trx->cfg.rtsc_set = true;
- trx->cfg.rtsc = atoi(argv[0]);
- if (!trx->cfg.egprs) /* Don't override egprs which sets different filler */
- trx->cfg.filler = FILLER_NORM_RAND;
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_test_rach_delay, cfg_test_rach_delay_cmd,
- "test rach-delay <0-68>",
- "Set the Random Access Burst test mode with delay\n"
- "RACH delay\n")
-{
- struct trx_ctx *trx = trx_from_vty(vty);
-
- if (trx->cfg.rtsc_set) {
- vty_out(vty, "rach-delay and rtsc options are mutual-exclusive%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- if (trx->cfg.egprs) {
- vty_out(vty, "rach-delay and egprs options are mutual-exclusive%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- trx->cfg.rach_delay_set = true;
- trx->cfg.rach_delay = atoi(argv[0]);
- trx->cfg.filler = FILLER_ACCESS_RAND;
-
- return CMD_SUCCESS;
-}
-
DEFUN(cfg_clock_ref, cfg_clock_ref_cmd,
"clock-ref (internal|external|gpsdo)",
"Set the Reference Clock\n"
@@ -351,14 +314,57 @@ DEFUN(cfg_stack_size, cfg_stack_size_cmd,
return CMD_SUCCESS;
}
-DEFUN(cfg_filler, cfg_filler_cmd,
- "filler dummy",
- "Enable C0 filler table\n"
- "Dummy method\n")
+DEFUN(cfg_filler, cfg_filler_type_cmd,
+ "filler type (zero|dummy|random-nb-gmsk|random-nb-8psk|random-ab)",
+ "Filler burst settings\n"
+ "Filler burst type (default=zero)\n"
+ "Send an empty burst when there is nothing to send (default)\n"
+ "Send a dummy burst when there is nothing to send on C0 (TRX0) and empty burst on other channels."
+ " Use for OpenBTS compatibility only, don't use with OsmoBTS as it breaks encryption.\n"
+ "Send a GMSK modulated Normal Burst with random bits when there is nothing to send."
+ " Use for spectrum mask testing. Configure 'filler tsc' to set training sequence.\n"
+ "Send an 8-PSK modulated Normal Burst with random bits when there is nothing to send."
+ " Use for spectrum mask testing. Configure 'filler tsc' to set training sequence.\n"
+ "Send an Access Burst with random bits when there is nothing to send. Use for Rx/Tx alignment."
+ " Configure 'filler access-burst-delay' to introduce artificial delay.\n"
+)
+{
+ struct trx_ctx *trx = trx_from_vty(vty);
+ // trx->cfg.filler is unsigned, so we need an interim int var to detect errors
+ int type = get_string_value(filler_types, argv[0]);
+
+ if (type < 0) {
+ trx->cfg.filler = FILLER_ZERO;
+ return CMD_WARNING;
+ }
+ trx->cfg.filler = type;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_test_rtsc, cfg_filler_tsc_cmd,
+ "filler tsc <0-7>",
+ "Filler burst settings\n"
+ "Set the TSC for GMSK/8-PSK Normal Burst random fillers. Used only with 'random-nb-gmsk' and"
+ " 'random-nb-8psk' filler types. (default=0)\n"
+ "TSC\n")
+{
+ struct trx_ctx *trx = trx_from_vty(vty);
+
+ trx->cfg.rtsc = atoi(argv[0]);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_test_rach_delay, cfg_filler_rach_delay_cmd,
+ "filler access-burst-delay <0-68>",
+ "Filler burst settings\n"
+ "Set the delay for Access Burst random fillers. Used only with 'random-ab' filler type. (default=0)\n"
+ "RACH delay in symbols\n")
{
struct trx_ctx *trx = trx_from_vty(vty);
- trx->cfg.filler = FILLER_DUMMY;
+ trx->cfg.rach_delay = atoi(argv[0]);
return CMD_SUCCESS;
}
@@ -546,10 +552,6 @@ static int config_write_trx(struct vty *vty)
vty_out(vty, " tx-sps %u%s", trx->cfg.tx_sps, VTY_NEWLINE);
if (trx->cfg.rx_sps != DEFAULT_RX_SPS)
vty_out(vty, " rx-sps %u%s", trx->cfg.rx_sps, VTY_NEWLINE);
- if (trx->cfg.rtsc_set)
- vty_out(vty, " test rtsc %u%s", trx->cfg.rtsc, VTY_NEWLINE);
- if (trx->cfg.rach_delay_set)
- vty_out(vty, " test rach-delay %u%s", trx->cfg.rach_delay, VTY_NEWLINE);
if (trx->cfg.clock_ref != REF_INTERNAL)
vty_out(vty, " clock-ref %s%s", get_value_string(clock_ref_names, trx->cfg.clock_ref), VTY_NEWLINE);
vty_out(vty, " multi-arfcn %s%s", trx->cfg.multi_arfcn ? "enable" : "disable", VTY_NEWLINE);
@@ -562,6 +564,12 @@ static int config_write_trx(struct vty *vty)
vty_out(vty, " ext-rach %s%s", trx->cfg.ext_rach ? "enable" : "disable", VTY_NEWLINE);
if (trx->cfg.sched_rr != 0)
vty_out(vty, " rt-prio %u%s", trx->cfg.sched_rr, VTY_NEWLINE);
+ if (trx->cfg.filler != FILLER_ZERO)
+ vty_out(vty, " filler type %s%s", get_value_string(filler_types, trx->cfg.filler), VTY_NEWLINE);
+ if (trx->cfg.rtsc > 0)
+ vty_out(vty, " filler tsc %u%s", trx->cfg.rtsc, VTY_NEWLINE);
+ if (trx->cfg.rach_delay > 0)
+ vty_out(vty, " filler access-burst-delay %u%s", trx->cfg.rach_delay, VTY_NEWLINE);
if (trx->cfg.stack_size != 0)
vty_out(vty, " stack-size %u%s", trx->cfg.stack_size, VTY_NEWLINE);
trx_rate_ctr_threshold_write_config(vty, " ");
@@ -589,11 +597,9 @@ static void trx_dump_vty(struct vty *vty, struct trx_ctx *trx)
vty_out(vty, " Device args: %s%s", trx->cfg.dev_args, VTY_NEWLINE);
vty_out(vty, " Tx Samples-per-Symbol: %u%s", trx->cfg.tx_sps, VTY_NEWLINE);
vty_out(vty, " Rx Samples-per-Symbol: %u%s", trx->cfg.rx_sps, VTY_NEWLINE);
- vty_out(vty, " Test Mode: TSC: %u (%s)%s", trx->cfg.rtsc,
- trx->cfg.rtsc_set ? "Enabled" : "Disabled", VTY_NEWLINE);
- vty_out(vty, " Test Mode: RACH Delay: %u (%s)%s", trx->cfg.rach_delay,
- trx->cfg.rach_delay_set ? "Enabled" : "Disabled", VTY_NEWLINE);
- vty_out(vty, " C0 Filler Table: %s%s", get_value_string(filler_names, trx->cfg.filler), VTY_NEWLINE);
+ vty_out(vty, " Filler Burst Type: %s%s", get_value_string(filler_names, trx->cfg.filler), VTY_NEWLINE);
+ vty_out(vty, " Filler Burst TSC: %u%s", trx->cfg.rtsc, VTY_NEWLINE);
+ vty_out(vty, " Filler Burst RACH Delay: %u%s", trx->cfg.rach_delay, VTY_NEWLINE);
vty_out(vty, " Clock Reference: %s%s", get_value_string(clock_ref_names, trx->cfg.clock_ref), VTY_NEWLINE);
vty_out(vty, " Multi-Carrier: %s%s", trx->cfg.multi_arfcn ? "Enabled" : "Disabled", VTY_NEWLINE);
vty_out(vty, " Tuning offset: %f%s", trx->cfg.offset, VTY_NEWLINE);
@@ -662,6 +668,7 @@ static int trx_vty_go_parent(struct vty *vty)
static const char trx_copyright[] =
"Copyright (C) 2007-2014 Free Software Foundation, Inc.\r\n"
"Copyright (C) 2013 Thomas Tsou <tom@tsou.cc>\r\n"
+ "Copyright (C) 2013-2019 Fairwaves, Inc.\r\n"
"Copyright (C) 2015 Ettus Research LLC\r\n"
"Copyright (C) 2017-2018 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>\r\n"
"License AGPLv3+: GNU AGPL version 3 or later <http://gnu.org/licenses/agpl-3.0.html>\r\n"
@@ -704,8 +711,6 @@ int trx_vty_init(struct trx_ctx* trx)
install_element(TRX_NODE, &cfg_dev_args_cmd);
install_element(TRX_NODE, &cfg_tx_sps_cmd);
install_element(TRX_NODE, &cfg_rx_sps_cmd);
- install_element(TRX_NODE, &cfg_test_rtsc_cmd);
- install_element(TRX_NODE, &cfg_test_rach_delay_cmd);
install_element(TRX_NODE, &cfg_clock_ref_cmd);
install_element(TRX_NODE, &cfg_multi_arfcn_cmd);
install_element(TRX_NODE, &cfg_offset_cmd);
@@ -714,7 +719,9 @@ int trx_vty_init(struct trx_ctx* trx)
install_element(TRX_NODE, &cfg_egprs_cmd);
install_element(TRX_NODE, &cfg_ext_rach_cmd);
install_element(TRX_NODE, &cfg_rt_prio_cmd);
- install_element(TRX_NODE, &cfg_filler_cmd);
+ install_element(TRX_NODE, &cfg_filler_type_cmd);
+ install_element(TRX_NODE, &cfg_filler_tsc_cmd);
+ install_element(TRX_NODE, &cfg_filler_rach_delay_cmd);
install_element(TRX_NODE, &cfg_ctr_error_threshold_cmd);
install_element(TRX_NODE, &cfg_no_ctr_error_threshold_cmd);
install_element(TRX_NODE, &cfg_stack_size_cmd);
diff --git a/CommonLibs/trx_vty.h b/CommonLibs/trx_vty.h
index d939051..d20dd96 100644
--- a/CommonLibs/trx_vty.h
+++ b/CommonLibs/trx_vty.h
@@ -5,6 +5,7 @@
#include "config_defs.h"
extern struct vty_app_info g_vty_info;
+extern const struct value_string filler_names[];
/* Maximum number of physical RF channels */
#define TRX_CHAN_MAX 8
@@ -51,9 +52,7 @@ struct trx_ctx {
unsigned int tx_sps;
unsigned int rx_sps;
unsigned int rtsc;
- bool rtsc_set;
unsigned int rach_delay;
- bool rach_delay_set;
enum ReferenceType clock_ref;
enum FillerType filler;
bool multi_arfcn;
diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp
index 6b83988..2346488 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -334,14 +334,12 @@ static void handle_options(int argc, char **argv, struct trx_ctx* trx)
break;
case 'r':
print_deprecated(option);
- trx->cfg.rtsc_set = true;
trx->cfg.rtsc = atoi(optarg);
if (!trx->cfg.egprs) /* Don't override egprs which sets different filler */
trx->cfg.filler = FILLER_NORM_RAND;
break;
case 'A':
print_deprecated(option);
- trx->cfg.rach_delay_set = true;
trx->cfg.rach_delay = atoi(optarg);
trx->cfg.filler = FILLER_ACCESS_RAND;
break;
@@ -459,7 +457,9 @@ static void print_config(struct trx_ctx *trx)
ost << " EDGE support............ " << trx->cfg.egprs << std::endl;
ost << " Extended RACH support... " << trx->cfg.ext_rach << std::endl;
ost << " Reference............... " << trx->cfg.clock_ref << std::endl;
- ost << " C0 Filler Table......... " << trx->cfg.filler << std::endl;
+ ost << " Filler Burst Type....... " << get_value_string(filler_names, trx->cfg.filler) << std::endl;
+ ost << " Filler Burst TSC........ " << trx->cfg.rtsc << std::endl;
+ ost << " Filler Burst RACH Delay. " << trx->cfg.rach_delay << std::endl;
ost << " Multi-Carrier........... " << trx->cfg.multi_arfcn << std::endl;
ost << " Tuning offset........... " << trx->cfg.offset << std::endl;
ost << " RSSI to dBm offset...... " << trx->cfg.rssi_offset << std::endl;