aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-01-03 15:05:48 -0800
committerMartin Braun <martin.braun@ettus.com>2018-01-04 14:17:09 -0800
commit83dd47dc882421f96830fa55bd86405d1d80907f (patch)
treed4dd5f75c027f25351ba0bcb652e6a5a547706f7
parentf25b37900561a50b816d545605b898207d4ca5b5 (diff)
downloaduhd-83dd47dc882421f96830fa55bd86405d1d80907f.tar.gz
uhd-83dd47dc882421f96830fa55bd86405d1d80907f.tar.bz2
uhd-83dd47dc882421f96830fa55bd86405d1d80907f.zip
mpmd: Allow user-overrides for MPM ports
Adds two device args: discovery_port and rpc_port. Both are integers which override the respective constants. Reviewed-by: Ashish Chaudhari <ashish.chaudhari@ettus.com>
-rw-r--r--host/docs/usrp_n3xx.dox4
-rw-r--r--host/lib/usrp/mpmd/mpmd_impl.cpp12
-rw-r--r--host/lib/usrp/mpmd/mpmd_impl.hpp14
-rw-r--r--host/lib/usrp/mpmd/mpmd_mboard_impl.cpp6
-rw-r--r--host/lib/usrp/mpmd/mpmd_xport_ctrl_udp.cpp8
5 files changed, 35 insertions, 9 deletions
diff --git a/host/docs/usrp_n3xx.dox b/host/docs/usrp_n3xx.dox
index e6c93c251..caee2faf9 100644
--- a/host/docs/usrp_n3xx.dox
+++ b/host/docs/usrp_n3xx.dox
@@ -172,7 +172,7 @@ For a list of which arguments can be passed into make(), see Section
---------------------|------------------------------------------------------------------------------|-------------------|---------------------
addr | IPv4 address of primary SFP+ port to connect to. | All N3xx | addr=192.168.30.2
second_addr | IPv4 address of secondary SFP+ port to connect to. | All N3xx | second_addr=192.168.40.2
- mgmt_addr | IPv4 address which to connect the RPC client. Defaults to `addr. | All N3xx | mgmt_addr=10.1.2.3 (can also go to RJ45)
+ mgmt_addr | IPv4 address or hostname which to connect the RPC client. Defaults to `addr'.| All N3xx | mgmt_addr=ni-sulfur-311FE00 (can also go to RJ45)
master_clock_rate | Master Clock Rate in Hz | N310 | master_clock_rate=125e6
identify | Causes front-panel LEDs to blink. The duration is variable. | N310 | identify=5 (will blink for about 5 seconds)
serialize_init | Force serial initialization of daughterboards. | All N3xx | serialize_init=1
@@ -182,6 +182,8 @@ For a list of which arguments can be passed into make(), see Section
ref_clk_freq | Specify the external reference clock frequency, default is 10 MHz. | N310 | ref_clk_freq=20e6
init_cals | Specify the bitmask for initial calibrations of the RFIC. | N310 | init_cals=0x4DFF
init_cals_timeout | Timeout for initial calibrations in milliseconds. | N310 | init_cals_timeout=45000
+ discovery_port | Override default value for MPM discovery port. | All N3xx | discovery_port=49700
+ rpc_port | Override default value for MPM RPC port. | All N3xx | rpc_port=49701
tracking_cals | Specify the bitmask for tracking calibrations of the RFIC. | N310 | tracking_cals=0xC3
rx_lo_source | Initialize the source for the RX LO. | N310 | rx_lo_source=external
tx_lo_source | Initialize the source for the TX LO. | N310 | tx_lo_source=external
diff --git a/host/lib/usrp/mpmd/mpmd_impl.cpp b/host/lib/usrp/mpmd/mpmd_impl.cpp
index 8586aa3a9..ff1e0498d 100644
--- a/host/lib/usrp/mpmd/mpmd_impl.cpp
+++ b/host/lib/usrp/mpmd/mpmd_impl.cpp
@@ -309,6 +309,10 @@ namespace {
/*****************************************************************************
* Static class attributes
****************************************************************************/
+const size_t mpmd_impl::MPM_DISCOVERY_PORT = 49600;
+const std::string mpmd_impl::MPM_DISCOVERY_PORT_KEY = "discovery_port";
+const size_t mpmd_impl::MPM_RPC_PORT = 49601;
+const std::string mpmd_impl::MPM_RPC_PORT_KEY = "rpc_port";
const std::string mpmd_impl::MPM_RPC_GET_LAST_ERROR_CMD = "get_last_error";
const std::string mpmd_impl::MPM_DISCOVERY_CMD = "MPM-DISC";
const std::string mpmd_impl::MPM_ECHO_CMD = "MPM-ECHO";
@@ -532,10 +536,16 @@ size_t mpmd_impl::allocate_xbar_local_addr()
device_addrs_t mpmd_find_with_addr(const std::string& mgmt_addr, const device_addr_t& hint_)
{
UHD_ASSERT_THROW(not mgmt_addr.empty());
+ const std::string mpm_discovery_port = hint_.get(
+ mpmd_impl::MPM_DISCOVERY_PORT_KEY,
+ std::to_string(mpmd_impl::MPM_DISCOVERY_PORT)
+ );
+ UHD_LOG_DEBUG("MPMD",
+ "Discovering MPM devices on port " << mpm_discovery_port);
device_addrs_t addrs;
transport::udp_simple::sptr comm = transport::udp_simple::make_broadcast(
- mgmt_addr, std::to_string(mpmd_impl::MPM_DISCOVERY_PORT));
+ mgmt_addr, mpm_discovery_port);
comm->send(
boost::asio::buffer(
mpmd_impl::MPM_DISCOVERY_CMD.c_str(),
diff --git a/host/lib/usrp/mpmd/mpmd_impl.hpp b/host/lib/usrp/mpmd/mpmd_impl.hpp
index 14051c922..79ab18aa3 100644
--- a/host/lib/usrp/mpmd/mpmd_impl.hpp
+++ b/host/lib/usrp/mpmd/mpmd_impl.hpp
@@ -146,10 +146,16 @@ class mpmd_mboard_impl
class mpmd_impl : public uhd::usrp::device3_impl
{
public:
- //! Port on which the discovery process is listening
- static const size_t MPM_DISCOVERY_PORT = 49600;
- //! Port on which the RPC process is listening
- static const size_t MPM_RPC_PORT = 49601;
+ //! Port on which the discovery process is listening (default value, it is
+ // user-overridable)
+ static const size_t MPM_DISCOVERY_PORT;
+ //! Device arg key to override the discovery port
+ static const std::string MPM_DISCOVERY_PORT_KEY;
+ //! Port on which the RPC process is listening (default value, it is user-
+ // overridable)
+ static const size_t MPM_RPC_PORT;
+ //! Device arg key to override the RPC port
+ static const std::string MPM_RPC_PORT_KEY;
//! This is the command that needs to be sent to the discovery port to
// trigger a response.
static const std::string MPM_DISCOVERY_CMD;
diff --git a/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp b/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp
index 087cb1373..3702c15a1 100644
--- a/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp
+++ b/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp
@@ -96,6 +96,7 @@ namespace {
using namespace uhd;
using namespace uhd::mpmd;
+
/*****************************************************************************
* Structors
****************************************************************************/
@@ -105,7 +106,10 @@ mpmd_mboard_impl::mpmd_mboard_impl(
) : mb_args(mb_args_)
, rpc(uhd::rpc_client::make(
rpc_server_addr,
- mpmd_impl::MPM_RPC_PORT,
+ mb_args_.cast<size_t>(
+ mpmd_impl::MPM_RPC_PORT_KEY,
+ mpmd_impl::MPM_RPC_PORT
+ ),
mpmd_impl::MPM_RPC_GET_LAST_ERROR_CMD))
, _xport_mgr(xport::mpmd_xport_mgr::make(mb_args))
{
diff --git a/host/lib/usrp/mpmd/mpmd_xport_ctrl_udp.cpp b/host/lib/usrp/mpmd/mpmd_xport_ctrl_udp.cpp
index 4d1306f82..3b02073c5 100644
--- a/host/lib/usrp/mpmd/mpmd_xport_ctrl_udp.cpp
+++ b/host/lib/usrp/mpmd/mpmd_xport_ctrl_udp.cpp
@@ -159,10 +159,14 @@ mpmd_xport_ctrl_udp::mpmd_xport_ctrl_udp(
, _available_addrs(get_addrs_from_mb_args(mb_args))
, _mtu(MPMD_10GE_DATA_FRAME_MAX_SIZE)
{
- auto discover_mtu_for_ip = [](const std::string &ip_addr){
+ const std::string mpm_discovery_port = _mb_args.get(
+ mpmd_impl::MPM_DISCOVERY_PORT_KEY,
+ std::to_string(mpmd_impl::MPM_DISCOVERY_PORT)
+ );
+ auto discover_mtu_for_ip = [mpm_discovery_port](const std::string &ip_addr){
return discover_mtu(
ip_addr,
- std::to_string(mpmd_impl::MPM_DISCOVERY_PORT),
+ mpm_discovery_port,
IP_PROTOCOL_MIN_MTU_SIZE-IP_PROTOCOL_UDP_PLUS_IP_HEADER,
MPMD_10GE_DATA_FRAME_MAX_SIZE,
MPMD_MTU_DISCOVERY_TIMEOUT