summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-03-04 18:08:17 -0800
committerJosh Blum <josh@joshknows.com>2011-03-04 18:08:17 -0800
commit982aeee231396688fade022778cfb743cf185e89 (patch)
tree8e11f0795122baaf5a866b67c325581da2403f1f /host/lib/usrp/usrp2
parent31e8e232459a10f86f18045e919854f5f13c29c2 (diff)
downloaduhd-982aeee231396688fade022778cfb743cf185e89.tar.gz
uhd-982aeee231396688fade022778cfb743cf185e89.tar.bz2
uhd-982aeee231396688fade022778cfb743cf185e89.zip
usrp2: tweak the mtu discovery logic
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 164253f96..f7154b0fc 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -171,9 +171,9 @@ static mtu_result_t determine_mtu(const std::string &addr){
size_t min_recv_mtu = sizeof(usrp2_ctrl_data_t), max_recv_mtu = sizeof(buffer);
size_t min_send_mtu = sizeof(usrp2_ctrl_data_t), max_send_mtu = sizeof(buffer);
- while (min_recv_mtu + 4 < max_recv_mtu){
+ while (min_recv_mtu < max_recv_mtu){
- mtu.recv_mtu = (max_recv_mtu + min_recv_mtu)/2 & ~(4-1);
+ mtu.recv_mtu = (max_recv_mtu/2 + min_recv_mtu/2 + 3) & ~3;
//std::cout << "recv_mtu " << mtu.recv_mtu << std::endl;
ctrl_data->id = htonl(USRP2_CTRL_ID_HOLLER_AT_ME_BRO);
@@ -184,13 +184,13 @@ static mtu_result_t determine_mtu(const std::string &addr){
size_t len = udp_sock->recv(boost::asio::buffer(buffer), echo_timeout);
if (len >= mtu.recv_mtu) min_recv_mtu = mtu.recv_mtu;
- else max_recv_mtu = mtu.recv_mtu;
+ else max_recv_mtu = mtu.recv_mtu - 4;
}
- while (min_send_mtu + 4 < max_send_mtu){
+ while (min_send_mtu < max_send_mtu){
- mtu.send_mtu = (max_send_mtu + min_send_mtu)/2 & ~(4-1);
+ mtu.send_mtu = (max_send_mtu/2 + min_send_mtu/2 + 3) & ~3;
//std::cout << "send_mtu " << mtu.send_mtu << std::endl;
ctrl_data->id = htonl(USRP2_CTRL_ID_HOLLER_AT_ME_BRO);
@@ -202,7 +202,7 @@ static mtu_result_t determine_mtu(const std::string &addr){
if (len >= sizeof(usrp2_ctrl_data_t)) len = ntohl(ctrl_data->data.echo_args.len);
if (len >= mtu.send_mtu) min_send_mtu = mtu.send_mtu;
- else max_send_mtu = mtu.send_mtu;
+ else max_send_mtu = mtu.send_mtu - 4;
}
return mtu;