summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreb2009-03-26 18:52:38 +0000
committereb2009-03-26 18:52:38 +0000
commitcfdc2e80d867777a405b3f1ba8ae6278b4f29f97 (patch)
treeda55f32d7aa4235819d56f03d23e627ddb13eaf9
parentd0dc3ffdc43630abd1cf800cb6f3b9195770fd4d (diff)
downloadgnuradio-cfdc2e80d867777a405b3f1ba8ae6278b4f29f97.tar.gz
gnuradio-cfdc2e80d867777a405b3f1ba8ae6278b4f29f97.tar.bz2
gnuradio-cfdc2e80d867777a405b3f1ba8ae6278b4f29f97.zip
Partial fix for ticket:378. Merged eb/t378 -r10682:10688 to trunk.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10689 221aa14e-8319-0410-a670-987f0aec2ac5
-rw-r--r--usrp2/firmware/include/usrp2_eth_packet.h1
-rw-r--r--usrp2/host/lib/usrp2_impl.cc13
2 files changed, 9 insertions, 5 deletions
diff --git a/usrp2/firmware/include/usrp2_eth_packet.h b/usrp2/firmware/include/usrp2_eth_packet.h
index 98e2123ed..a118c1b55 100644
--- a/usrp2/firmware/include/usrp2_eth_packet.h
+++ b/usrp2/firmware/include/usrp2_eth_packet.h
@@ -150,6 +150,7 @@ typedef struct {
*/
#define U2_MAX_SAMPLES 371
+#define U2_MIN_SAMPLES 9
typedef struct {
u2_eth_packet_t hdrs;
diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc
index 98c3eb7cf..9c30bce92 100644
--- a/usrp2/host/lib/usrp2_impl.cc
+++ b/usrp2/host/lib/usrp2_impl.cc
@@ -932,10 +932,8 @@ namespace usrp2 {
if (nitems == 0)
return true;
- // FIXME there's the possibility that we send fewer than 9 items in a frame.
- // That would end up glitching the transmitter, since the ethernet will pad to
- // 64-bytes total (9 items). We really need some part of the stack to
- // carry the real length (thdr?).
+ // FIXME can't deal with nitems < U2_MIN_SAMPLES (will be fixed in VRT)
+ // FIXME need to check the MTU instead of assuming 1500 bytes
// fragment as necessary then fire away
@@ -965,7 +963,12 @@ namespace usrp2 {
init_etf_hdrs(&hdrs, d_addr, flags, channel, timestamp);
- size_t i = std::min((size_t) U2_MAX_SAMPLES, nitems - n);
+ // Avoid short packet by splitting last two packets if reqd
+ size_t i;
+ if ((nitems - n) > U2_MAX_SAMPLES && (nitems - n) < (U2_MAX_SAMPLES + U2_MIN_SAMPLES))
+ i = (nitems - n) / 2;
+ else
+ i = std::min((size_t) U2_MAX_SAMPLES, nitems - n);
eth_iovec iov[2];
iov[0].iov_base = &hdrs;