aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/transport
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/transport')
-rwxr-xr-xhost/lib/transport/gen_vrt_if_packet.py6
-rw-r--r--host/lib/transport/udp_zero_copy_asio.cpp3
-rw-r--r--host/lib/transport/vrt_packet_handler.hpp6
3 files changed, 13 insertions, 2 deletions
diff --git a/host/lib/transport/gen_vrt_if_packet.py b/host/lib/transport/gen_vrt_if_packet.py
index 7438f5ff4..dbe026ba3 100755
--- a/host/lib/transport/gen_vrt_if_packet.py
+++ b/host/lib/transport/gen_vrt_if_packet.py
@@ -141,11 +141,17 @@ void vrt::if_hdr_unpack_$(suffix)(
){
//extract vrt header
boost::uint32_t vrt_hdr_word = $(XE_MACRO)(packet_buff[0]);
+ /*
size_t packet_words32 = vrt_hdr_word & 0xffff;
//failure case
if (if_packet_info.num_packet_words32 < packet_words32)
throw std::runtime_error("bad vrt header or packet fragment");
+ */
+ //Fix for short packets sent from the fpga:
+ // Use the num_packet_words32 passed in as input,
+ // and do not use the header bits which could be wrong.
+ size_t packet_words32 = if_packet_info.num_packet_words32;
//extract fields from the header
if_packet_info.packet_type = if_packet_info_t::packet_type_t(vrt_hdr_word >> 29);
diff --git a/host/lib/transport/udp_zero_copy_asio.cpp b/host/lib/transport/udp_zero_copy_asio.cpp
index 98451f188..bfbcf62d8 100644
--- a/host/lib/transport/udp_zero_copy_asio.cpp
+++ b/host/lib/transport/udp_zero_copy_asio.cpp
@@ -161,10 +161,13 @@ template<typename Opt> static void resize_buff_helper(
) % name % MIN_SOCK_BUFF_SIZE << std::endl;
}
+ //only enable on platforms that are happy with the large buffer resize
+ #if defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32)
//otherwise, ensure that the buffer is at least the minimum size
else if (udp_trans->get_buff_size<Opt>() < MIN_SOCK_BUFF_SIZE){
resize_buff_helper<Opt>(udp_trans, MIN_SOCK_BUFF_SIZE, name);
}
+ #endif /*defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_WIN32)*/
}
udp_zero_copy::sptr udp_zero_copy::make(
diff --git a/host/lib/transport/vrt_packet_handler.hpp b/host/lib/transport/vrt_packet_handler.hpp
index 6623957ac..bd76cbb8f 100644
--- a/host/lib/transport/vrt_packet_handler.hpp
+++ b/host/lib/transport/vrt_packet_handler.hpp
@@ -146,6 +146,8 @@ namespace vrt_packet_handler{
const handle_overrun_t &handle_overrun,
size_t vrt_header_offset_words32
){
+ metadata.error_code = uhd::rx_metadata_t::ERROR_CODE_NONE;
+
//perform a receive if no rx data is waiting to be copied
if (state.size_of_copy_buffs == 0){
state.fragment_offset_in_samps = 0;
@@ -171,7 +173,6 @@ namespace vrt_packet_handler{
metadata.has_time_spec = false;
metadata.start_of_burst = false;
metadata.end_of_burst = false;
- metadata.error_code = uhd::rx_metadata_t::ERROR_CODE_NONE;
}
//extract the number of samples available to copy
@@ -323,7 +324,8 @@ namespace vrt_packet_handler{
);
//commit the samples to the zero-copy interface
- if (send_buffs[i]->commit(if_packet_info.num_packet_words32*sizeof(boost::uint32_t)) < ssize_t(num_samps)){
+ size_t num_bytes_total = (vrt_header_offset_words32+if_packet_info.num_packet_words32)*sizeof(boost::uint32_t);
+ if (send_buffs[i]->commit(num_bytes_total) < ssize_t(num_bytes_total)){
std::cerr << "commit to send buffer returned less than commit size" << std::endl;
}
}