summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2014-03-19 18:26:43 +0100
committerBen Hilburn <ben.hilburn@ettus.com>2014-03-28 10:25:53 -0700
commit69feb0e437c04f0c79ace814c52cce67bb2194e9 (patch)
treeeceae873b16ff677cad1bf45402e18077b5b551a
parentb1073740a95f3ba9d62f83956430386448e1b528 (diff)
downloaduhd-69feb0e437c04f0c79ace814c52cce67bb2194e9.tar.gz
uhd-69feb0e437c04f0c79ace814c52cce67bb2194e9.tar.bz2
uhd-69feb0e437c04f0c79ace814c52cce67bb2194e9.zip
x300: Fix the assumed max header size
-rw-r--r--host/lib/usrp/x300/x300_impl.hpp9
-rw-r--r--host/lib/usrp/x300/x300_io_impl.cpp24
2 files changed, 15 insertions, 18 deletions
diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp
index 259ea253d..692427f31 100644
--- a/host/lib/usrp/x300/x300_impl.hpp
+++ b/host/lib/usrp/x300/x300_impl.hpp
@@ -76,6 +76,15 @@ static const size_t X300_ETH_MSG_NUM_FRAMES = 32;
static const size_t X300_ETH_DATA_NUM_FRAMES = 32;
static const double X300_DEFAULT_SYSREF_RATE = 10e6;
+static const size_t X300_TX_MAX_HDR_LEN = // bytes
+ sizeof(boost::uint32_t) // Header
+ + sizeof(uhd::transport::vrt::if_packet_info_t().sid) // SID
+ + sizeof(uhd::transport::vrt::if_packet_info_t().tsf); // Timestamp
+static const size_t X300_RX_MAX_HDR_LEN = // bytes
+ sizeof(boost::uint32_t) // Header
+ + sizeof(uhd::transport::vrt::if_packet_info_t().sid) // SID
+ + sizeof(uhd::transport::vrt::if_packet_info_t().tsf); // Timestamp
+
#define X300_RADIO_DEST_PREFIX_TX 0
#define X300_RADIO_DEST_PREFIX_CTRL 1
#define X300_RADIO_DEST_PREFIX_RX 2
diff --git a/host/lib/usrp/x300/x300_io_impl.cpp b/host/lib/usrp/x300/x300_io_impl.cpp
index 85de34a54..09ed1d705 100644
--- a/host/lib/usrp/x300/x300_io_impl.cpp
+++ b/host/lib/usrp/x300/x300_io_impl.cpp
@@ -399,15 +399,9 @@ rx_streamer::sptr x300_impl::get_rx_stream(const uhd::stream_args_t &args_)
both_xports_t xport = this->make_transport(mb_index, dest, X300_RADIO_DEST_PREFIX_RX, device_addr, data_sid);
UHD_LOG << boost::format("data_sid = 0x%08x, actual recv_buff_size = %d\n") % data_sid % xport.recv_buff_size << std::endl;
- //calculate packet size
- static const size_t hdr_size = 0
- + vrt::num_vrl_words32*sizeof(boost::uint32_t)
- + vrt::max_if_hdr_words32*sizeof(boost::uint32_t)
- + sizeof(vrt::if_packet_info_t().tlr) //forced to have trailer
- - sizeof(vrt::if_packet_info_t().cid) //no class id ever used
- - sizeof(vrt::if_packet_info_t().tsi) //no int time ever used
- ;
- const size_t bpp = xport.recv->get_recv_frame_size() - hdr_size; // bytes per packet
+ // To calculate the max number of samples per packet, we assume the maximum header length
+ // to avoid fragmentation should the entire header be used.
+ const size_t bpp = xport.recv->get_recv_frame_size() - X300_RX_MAX_HDR_LEN; // bytes per packet
const size_t bpi = convert::get_bytes_per_item(args.otw_format); // bytes per item
const size_t spp = unsigned(args.args.cast<double>("spp", bpp/bpi)); // samples per packet
@@ -568,15 +562,9 @@ tx_streamer::sptr x300_impl::get_tx_stream(const uhd::stream_args_t &args_)
both_xports_t xport = this->make_transport(mb_index, dest, X300_RADIO_DEST_PREFIX_TX, device_addr, data_sid);
UHD_LOG << boost::format("data_sid = 0x%08x\n") % data_sid << std::endl;
- //calculate packet size
- static const size_t hdr_size = 0
- + vrt::num_vrl_words32*sizeof(boost::uint32_t)
- + vrt::max_if_hdr_words32*sizeof(boost::uint32_t)
- //+ sizeof(vrt::if_packet_info_t().tlr) //forced to have trailer
- - sizeof(vrt::if_packet_info_t().cid) //no class id ever used
- - sizeof(vrt::if_packet_info_t().tsi) //no int time ever used
- ;
- const size_t bpp = xport.send->get_send_frame_size() - hdr_size;
+ // To calculate the max number of samples per packet, we assume the maximum header length
+ // to avoid fragmentation should the entire header be used.
+ const size_t bpp = xport.send->get_send_frame_size() - X300_TX_MAX_HDR_LEN;
const size_t bpi = convert::get_bytes_per_item(args.otw_format);
const size_t spp = unsigned(args.args.cast<double>("spp", bpp/bpi));