summaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-03-21 11:52:38 -0700
committerJosh Blum <josh@joshknows.com>2011-03-21 11:52:38 -0700
commit3938de0cfedb4c4ca8b5fdb1ed7137ee32208648 (patch)
treea6c6faf3dfd32ae2499450133a9642fa248e635a /host/lib
parent2183c502ee556013e543fcb1f2cf66386b8d7288 (diff)
downloaduhd-3938de0cfedb4c4ca8b5fdb1ed7137ee32208648.tar.gz
uhd-3938de0cfedb4c4ca8b5fdb1ed7137ee32208648.tar.bz2
uhd-3938de0cfedb4c4ca8b5fdb1ed7137ee32208648.zip
usrp2: use the discovered mtu to clip the user specified mtu
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 96552929a..f42be321b 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -241,14 +241,17 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
mtu.send_mtu = std::min(mtu.send_mtu, mtu_i.send_mtu);
}
- std::cout << "mtu recv bytes " << mtu.recv_mtu << std::endl;
- std::cout << "mtu send bytes " << mtu.send_mtu << std::endl;
-
- //use the discovered mtu if not specified by the user
- if (not device_addr.has_key("recv_frame_size"))
- device_addr["recv_frame_size"] = boost::lexical_cast<std::string>(mtu.recv_mtu);
- if (not device_addr.has_key("send_frame_size"))
- device_addr["send_frame_size"] = boost::lexical_cast<std::string>(mtu.send_mtu);
+ //use the discovered mtu or clip the users requested mtu
+ mtu.recv_mtu = std::min(size_t(device_addr.cast<double>("recv_frame_size", 9000)), mtu.recv_mtu);
+ mtu.send_mtu = std::min(size_t(device_addr.cast<double>("send_frame_size", 9000)), mtu.send_mtu);
+
+ device_addr["recv_frame_size"] = boost::lexical_cast<std::string>(mtu.recv_mtu);
+ device_addr["send_frame_size"] = boost::lexical_cast<std::string>(mtu.send_mtu);
+
+ std::cout << boost::format("Current recv frame size: %d bytes") % mtu.recv_mtu << std::endl;
+ std::cout << boost::format("Current send frame size: %d bytes") % mtu.send_mtu << std::endl;
+
+ device_args = separate_device_addr(device_addr); //update args for new frame sizes
//setup rx otw type
_rx_otw_type.width = 16;