diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-07-22 17:07:27 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-07-23 17:21:40 +0200 |
commit | e6372cff1bb044faf992976f6e1096a14a8f0295 (patch) | |
tree | 3559cbaf3175362ca25e4cf1758883959962d300 | |
parent | aa54224e563bcde01bcd1dfc21c59552b421a815 (diff) |
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
-rw-r--r-- | include/osmo-bts/phy_link.h | 1 | ||||
-rw-r--r-- | src/osmo-bts-trx/l1_if.c | 10 | ||||
-rw-r--r-- | src/osmo-bts-trx/main.c | 2 | ||||
-rw-r--r-- | src/osmo-bts-trx/trx_vty.c | 27 |
4 files changed, 36 insertions, 4 deletions
diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h index 273103c6..3bf51597 100644 --- a/include/osmo-bts/phy_link.h +++ b/include/osmo-bts/phy_link.h @@ -50,6 +50,7 @@ struct phy_link { 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 9c1dc185..22ef2d73 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -185,6 +185,7 @@ static void l1if_setslot_cb(struct trx_l1h *l1h, uint8_t tn, uint8_t type, int r 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 @@ int l1if_provision_transceiver_trx(struct trx_l1h *l1h) 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 9529190e..b1fa2079 100644 --- a/src/osmo-bts-trx/main.c +++ b/src/osmo-bts-trx/main.c @@ -134,6 +134,8 @@ void bts_model_phy_link_set_defaults(struct phy_link *plink) 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 b9af445b..c52908e0 100644 --- a/src/osmo-bts-trx/trx_vty.c +++ b/src/osmo-bts-trx/trx_vty.c @@ -496,6 +496,29 @@ DEFUN(cfg_phy_no_setbsic, cfg_phy_no_setbsic_cmd, 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 @@ void bts_model_config_write_phy(struct vty *vty, struct phy_link *plink) 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 @@ int bts_model_vty_init(struct gsm_bts *bts) 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); |