diff options
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/device.cpp | 11 | ||||
-rw-r--r-- | host/lib/transport/udp_zero_copy_asio.cpp | 10 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 14 |
3 files changed, 17 insertions, 18 deletions
diff --git a/host/lib/device.cpp b/host/lib/device.cpp index 706f64951..88bd2cff4 100644 --- a/host/lib/device.cpp +++ b/host/lib/device.cpp @@ -97,11 +97,6 @@ device::sptr device::make(const device_addr_t &hint, size_t which){ BOOST_FOREACH(const dev_fcn_reg_t &fcn, get_dev_fcn_regs()){ BOOST_FOREACH(device_addr_t dev_addr, fcn.get<0>()(hint)){ - //copy keys that were in hint but not in dev_addr - //this way, we can pass additional transport arguments - BOOST_FOREACH(const std::string &key, hint.keys()){ - if (not dev_addr.has_key(key)) dev_addr[key] = hint[key]; - } //append the discovered address and its factory function dev_addr_makers.push_back(dev_addr_make_t(dev_addr, fcn.get<1>())); } @@ -127,6 +122,12 @@ device::sptr device::make(const device_addr_t &hint, size_t which){ size_t dev_hash = hash_device_addr(dev_addr); //std::cout << boost::format("Hash: %u") % dev_hash << std::endl; + //copy keys that were in hint but not in dev_addr + //this way, we can pass additional transport arguments + BOOST_FOREACH(const std::string &key, hint.keys()){ + if (not dev_addr.has_key(key)) dev_addr[key] = hint[key]; + } + //map device address hash to created devices static uhd::dict<size_t, boost::weak_ptr<device> > hash_to_device; diff --git a/host/lib/transport/udp_zero_copy_asio.cpp b/host/lib/transport/udp_zero_copy_asio.cpp index 315ae49d2..09386a60c 100644 --- a/host/lib/transport/udp_zero_copy_asio.cpp +++ b/host/lib/transport/udp_zero_copy_asio.cpp @@ -103,8 +103,8 @@ public: managed_send_buffer::sptr get_send_buff(void); //resize - size_t set_recv_buff_size(size_t num_bytes); - size_t set_send_buff_size(size_t num_bytes); + size_t resize_recv_buff_size(size_t num_bytes); + size_t resize_send_buff_size(size_t num_bytes); private: boost::asio::ip::udp::socket *_socket; @@ -157,16 +157,14 @@ managed_send_buffer::sptr udp_zero_copy_impl::get_send_buff(void){ ); } -//sysctl -w net.core.rmem_max=VALUE -size_t udp_zero_copy_impl::set_recv_buff_size(size_t num_bytes){ +size_t udp_zero_copy_impl::resize_recv_buff_size(size_t num_bytes){ boost::asio::socket_base::receive_buffer_size option(num_bytes); _socket->set_option(option); _socket->get_option(option); return option.value(); } -//sysctl -w net.core.wmem_max=VALUE -size_t udp_zero_copy_impl::set_send_buff_size(size_t num_bytes){ +size_t udp_zero_copy_impl::resize_send_buff_size(size_t num_bytes){ boost::asio::socket_base::send_buffer_size option(num_bytes); _socket->set_option(option); _socket->get_option(option); diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index ffcdbb43d..2b974fb9b 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -51,7 +51,7 @@ uhd::device_addrs_t usrp2::find(const device_addr_t &hint){ if (if_addrs.inet == asio::ip::address_v4::loopback().to_string()) continue; //create a new hint with this broadcast address - device_addr_t new_hint = hint; + device_addr_t new_hint; new_hint["addr"] = if_addrs.bcast; //call discover with the new hint and append results @@ -121,9 +121,9 @@ device::sptr usrp2::make(const device_addr_t &device_addr){ //resize the recv data transport buffers if (device_addr.has_key("recv_buff_size")){ size_t num_byes = size_t(boost::lexical_cast<double>(device_addr["recv_buff_size"])); - size_t actual_bytes = data_transport->set_recv_buff_size(num_byes); - std::cout << boost::format( - "Target recv buffer size: %d" + size_t actual_bytes = data_transport->resize_recv_buff_size(num_byes); + if (num_byes != actual_bytes) std::cout << boost::format( + "Target recv buffer size: %d\n" "Actual recv byffer size: %d" ) % num_byes % actual_bytes << std::endl; } @@ -131,9 +131,9 @@ device::sptr usrp2::make(const device_addr_t &device_addr){ //resize the send data transport buffers if (device_addr.has_key("send_buff_size")){ size_t num_byes = size_t(boost::lexical_cast<double>(device_addr["send_buff_size"])); - size_t actual_bytes = data_transport->set_send_buff_size(num_byes); - std::cout << boost::format( - "Target send buffer size: %d" + size_t actual_bytes = data_transport->resize_send_buff_size(num_byes); + if (num_byes != actual_bytes) std::cout << boost::format( + "Target send buffer size: %d\n" "Actual send byffer size: %d" ) % num_byes % actual_bytes << std::endl; } |