From aea6ac1b6a96d03fc6ccca49ab535b4e93e86a00 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 6 Feb 2011 14:54:09 -0800 Subject: usrp2: fix for icmp echo reply checksum (data was not included in checksum) --- firmware/zpu/lib/net_common.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/firmware/zpu/lib/net_common.c b/firmware/zpu/lib/net_common.c index ec9198090..d1b06976d 100644 --- a/firmware/zpu/lib/net_common.c +++ b/firmware/zpu/lib/net_common.c @@ -298,20 +298,28 @@ handle_icmp_packet(struct ip_addr src, struct ip_addr dst, break; case ICMP_ECHO:{ + const void *icmp_data_buff = ((uint8_t*)icmp) + sizeof(struct icmp_echo_hdr); + size_t icmp_data_len = len - sizeof(struct icmp_echo_hdr); + struct icmp_echo_hdr echo_reply; echo_reply.type = 0; echo_reply.code = 0; echo_reply.chksum = 0; echo_reply.id = icmp->id; echo_reply.seqno = icmp->seqno; - echo_reply.chksum = ~chksum_buffer( - (unsigned short *)&echo_reply, - sizeof(echo_reply)/sizeof(short), - 0); + echo_reply.chksum = ~chksum_buffer( //data checksum + (unsigned short *)icmp_data_buff, + icmp_data_len/sizeof(short), + chksum_buffer( //header checksum + (unsigned short *)&echo_reply, + sizeof(echo_reply)/sizeof(short), + 0) + ); + send_ip_pkt( - src, IP_PROTO_ICMP, &echo_reply, sizeof(echo_reply), - ((uint8_t*)icmp) + sizeof(struct icmp_echo_hdr), - len - sizeof(struct icmp_echo_hdr) + src, IP_PROTO_ICMP, + &echo_reply, sizeof(echo_reply), + icmp_data_buff, icmp_data_len ); break; } -- cgit v1.2.3 From 7d277bc30f0b506d5773250bf7ee59ccaa59d832 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 8 Feb 2011 12:28:51 -0800 Subject: usrp2: fix for lingering packet problem --- host/lib/usrp/usrp2/mboard_impl.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 784f662d9..397fae636 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -157,6 +157,14 @@ usrp2_mboard_impl::usrp2_mboard_impl( //set default subdev specs (*this)[MBOARD_PROP_RX_SUBDEV_SPEC] = subdev_spec_t(); (*this)[MBOARD_PROP_TX_SUBDEV_SPEC] = subdev_spec_t(); + + //This is a hack/fix for the lingering packet problem. + stream_cmd_t stream_cmd(stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE); + stream_cmd.num_samps = 1; + this->issue_ddc_stream_cmd(stream_cmd); + data_transport->get_recv_buff().get(); //recv with timeout for lingering + data_transport->get_recv_buff().get(); //recv with timeout for expected + _iface->poke32(_iface->regs.rx_ctrl_clear_overrun, 1); //resets sequence } usrp2_mboard_impl::~usrp2_mboard_impl(void){ -- cgit v1.2.3 From fa35192bcb89c6f026d76d7f5190e22341840a47 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 1 Feb 2011 20:38:14 -0800 Subject: uhd: potential fix for macos asio recv issue (just disable it) --- host/lib/transport/udp_zero_copy_asio.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/host/lib/transport/udp_zero_copy_asio.cpp b/host/lib/transport/udp_zero_copy_asio.cpp index 697e172cd..a80de7b87 100644 --- a/host/lib/transport/udp_zero_copy_asio.cpp +++ b/host/lib/transport/udp_zero_copy_asio.cpp @@ -40,6 +40,12 @@ namespace asio = boost::asio; //Otherwise, the commit callback uses a blocking send. //#define USE_ASIO_ASYNC_SEND +//The asio async receive implementation is broken for some macos. +//Just disable for all macos since we don't know the problem. +#if defined(UHD_PLATFORM_MACOS) && defined(USE_ASIO_ASYNC_RECV) + #undef USE_ASIO_ASYNC_RECV +#endif + //The number of service threads to spawn for async ASIO: //A single concurrent thread for io_service seems to be the fastest. //Threads are disabled when no async implementations are enabled. -- cgit v1.2.3