From a2e59940dcdeb7ba120339a823c34f8d31cf322e Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 6 Dec 2016 12:34:22 -0800 Subject: x300: Make PCIe muxing and connection multi-usrp capable --- host/lib/usrp/x300/x300_impl.cpp | 12 ++++++------ host/lib/usrp/x300/x300_impl.hpp | 22 +++++++++++++--------- 2 files changed, 19 insertions(+), 15 deletions(-) (limited to 'host/lib/usrp/x300') diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 959245135..494598bf3 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -1025,14 +1025,14 @@ x300_impl::~x300_impl(void) } } -uint32_t x300_impl::allocate_pcie_dma_chan(const uhd::sid_t &tx_sid, const xport_type_t xport_type) +uint32_t x300_impl::mboard_members_t::allocate_pcie_dma_chan(const uhd::sid_t &tx_sid, const xport_type_t xport_type) { static const uint32_t CTRL_CHANNEL = 0; static const uint32_t FIRST_DATA_CHANNEL = 1; if (xport_type == CTRL) { return CTRL_CHANNEL; } else { - // sid_t has no comparison defined + // sid_t has no comparison defined, so we need to convert it uint32_t uint32_t raw_sid = tx_sid.get(); if (_dma_chan_pool.count(raw_sid) == 0) { @@ -1067,10 +1067,10 @@ uhd::both_xports_t x300_impl::make_transport( xports.send_sid = this->allocate_sid(mb, address, X300_SRC_ADDR0, X300_XB_DST_PCI); xports.recv_sid = xports.send_sid.reversed(); - uint32_t dma_channel_num = allocate_pcie_dma_chan(xports.send_sid, xport_type); + uint32_t dma_channel_num = mb.allocate_pcie_dma_chan(xports.send_sid, xport_type); if (xport_type == CTRL) { //Transport for control stream - if (_ctrl_dma_xport.get() == NULL) { + if (not mb.ctrl_dma_xport) { //One underlying DMA channel will handle //all control traffic zero_copy_xport_params ctrl_buff_args; @@ -1082,10 +1082,10 @@ uhd::both_xports_t x300_impl::make_transport( zero_copy_if::sptr base_xport = nirio_zero_copy::make( mb.rio_fpga_interface, dma_channel_num, ctrl_buff_args, uhd::device_addr_t()); - _ctrl_dma_xport = muxed_zero_copy_if::make(base_xport, extract_sid_from_pkt, X300_PCIE_MAX_MUXED_XPORTS); + mb.ctrl_dma_xport = muxed_zero_copy_if::make(base_xport, extract_sid_from_pkt, X300_PCIE_MAX_MUXED_XPORTS); } //Create a virtual control transport - xports.recv = _ctrl_dma_xport->make_stream(xports.recv_sid.get_dst()); + xports.recv = mb.ctrl_dma_xport->make_stream(xports.recv_sid.get_dst()); } else { //Transport for data stream default_buff_args.send_frame_size = diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp index ff18b1a22..db5396008 100644 --- a/host/lib/usrp/x300/x300_impl.hpp +++ b/host/lib/usrp/x300/x300_impl.hpp @@ -191,6 +191,19 @@ private: std::string current_refclk_src; std::vector radios; + + // PCIe specific components: + + //! Maps SID -> DMA channel + std::map _dma_chan_pool; + //! Control transport for one PCIe connection + uhd::transport::muxed_zero_copy_if::sptr ctrl_dma_xport; + + /*! Allocate or return a previously allocated PCIe channel pair + * + * Note the SID is always the transmit SID (i.e. from host to device). + */ + uint32_t allocate_pcie_dma_chan(const uhd::sid_t &tx_sid, const xport_type_t xport_type); }; std::vector _mb; @@ -224,15 +237,6 @@ private: */ frame_size_t determine_max_frame_size(const std::string &addr, const frame_size_t &user_mtu); - std::map _dma_chan_pool; - uhd::transport::muxed_zero_copy_if::sptr _ctrl_dma_xport; - - /*! Allocate or return a previously allocated PCIe channel pair - * - * Note the SID is always the transmit SID (i.e. from host to device). - */ - uint32_t allocate_pcie_dma_chan(const uhd::sid_t &tx_sid, const xport_type_t xport_type); - //////////////////////////////////////////////////////////////////// // //Caching for transport interface re-use -- like sharing a DMA. -- cgit v1.2.3 From 5efe1c0f124d1068bbc9bd882db5530ca2ca0377 Mon Sep 17 00:00:00 2001 From: Andrej Rode Date: Thu, 17 Nov 2016 16:12:47 -0800 Subject: X300: dont stop x300_find if receiving wrong flags Just skip current receive buffer and do not stop processing udp packets completely. --- host/lib/usrp/x300/x300_impl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'host/lib/usrp/x300') diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 494598bf3..fffd6ecac 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -105,8 +105,8 @@ static device_addrs_t x300_find_with_addr(const device_addr_t &hint) const size_t nbytes = comm->recv(asio::buffer(buff), 0.050); if (nbytes == 0) break; const x300_fw_comms_t *reply = (const x300_fw_comms_t *)buff; - if (request.flags != reply->flags) break; - if (request.sequence != reply->sequence) break; + if (request.flags != reply->flags) continue; + if (request.sequence != reply->sequence) continue; device_addr_t new_addr; new_addr["type"] = "x300"; new_addr["addr"] = comm->get_recv_addr(); -- cgit v1.2.3 From 582553984cfd70ae11f5c12da568e4a0a74888d2 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 13 Dec 2016 10:43:45 -0800 Subject: x300: Made MTU throttling more explicit in x300 header files --- host/lib/usrp/x300/x300_impl.cpp | 2 +- host/lib/usrp/x300/x300_impl.hpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'host/lib/usrp/x300') diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index fffd6ecac..50a7f3ded 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -652,7 +652,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) } _tree->create(mb_path / "mtu/recv").set(_max_frame_sizes.recv_frame_size); - _tree->create(mb_path / "mtu/send").set(std::min(_max_frame_sizes.send_frame_size, X300_1GE_DATA_FRAME_MAX_SIZE)); + _tree->create(mb_path / "mtu/send").set(std::min(_max_frame_sizes.send_frame_size, X300_ETH_DATA_FRAME_MAX_TX_SIZE)); _tree->create(mb_path / "link_max_rate").set(X300_MAX_RATE_10GIGE); } diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp index db5396008..e292e2d68 100644 --- a/host/lib/usrp/x300/x300_impl.hpp +++ b/host/lib/usrp/x300/x300_impl.hpp @@ -67,6 +67,8 @@ static const size_t X300_PCIE_MAX_MUXED_XPORTS = 32; static const size_t X300_10GE_DATA_FRAME_MAX_SIZE = 8000; // CHDR packet size in bytes static const size_t X300_1GE_DATA_FRAME_MAX_SIZE = 1472; // CHDR packet size in bytes static const size_t X300_ETH_MSG_FRAME_SIZE = uhd::transport::udp_simple::mtu; //bytes +// MTU throttling for ethernet/TX (see above): +static const size_t X300_ETH_DATA_FRAME_MAX_TX_SIZE = 2000; static const double X300_THREAD_BUFFER_TIMEOUT = 0.1; // Time in seconds -- cgit v1.2.3