From 3938de0cfedb4c4ca8b5fdb1ed7137ee32208648 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 21 Mar 2011 11:52:38 -0700 Subject: usrp2: use the discovered mtu to clip the user specified mtu --- host/lib/usrp/usrp2/usrp2_impl.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'host/lib/usrp') 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(mtu.recv_mtu); - if (not device_addr.has_key("send_frame_size")) - device_addr["send_frame_size"] = boost::lexical_cast(mtu.send_mtu); + //use the discovered mtu or clip the users requested mtu + mtu.recv_mtu = std::min(size_t(device_addr.cast("recv_frame_size", 9000)), mtu.recv_mtu); + mtu.send_mtu = std::min(size_t(device_addr.cast("send_frame_size", 9000)), mtu.send_mtu); + + device_addr["recv_frame_size"] = boost::lexical_cast(mtu.recv_mtu); + device_addr["send_frame_size"] = boost::lexical_cast(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; -- cgit v1.2.3