[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 47/148: Handled the case of short packets i
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 47/148: Handled the case of short packets in eth data transport by using padding. |
Date: |
Mon, 15 Aug 2016 00:47:23 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
nwest pushed a commit to annotated tag old_usrp_devel_udp
in repository gnuradio.
commit 70591620684d20437505352c3590898bd80c486e
Author: Josh Blum <address@hidden>
Date: Fri Nov 20 14:54:12 2009 -0800
Handled the case of short packets in eth data transport by using padding.
---
usrp2/host/lib/eth_ctrl_transport.cc | 2 +-
usrp2/host/lib/eth_data_transport.cc | 12 +++++++++++-
usrp2/host/lib/usrp2_impl.cc | 14 ++------------
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/usrp2/host/lib/eth_ctrl_transport.cc
b/usrp2/host/lib/eth_ctrl_transport.cc
index 72f13e9..8f7c418 100644
--- a/usrp2/host/lib/eth_ctrl_transport.cc
+++ b/usrp2/host/lib/eth_ctrl_transport.cc
@@ -68,7 +68,7 @@ bool usrp2::eth_ctrl_transport::sendv(const iovec *iov,
size_t iovlen){
uint8_t padding[ethernet::MIN_PKTLEN];
memset(padding, 0, ethernet::MIN_PKTLEN);
all_iov[all_iov_len-1].iov_base = padding;
- all_iov[all_iov_len-1].iov_len = std::max(ethernet::MIN_PKTLEN-num_bytes,
0);
+ all_iov[all_iov_len-1].iov_len =
std::max(int(ethernet::MIN_PKTLEN)-num_bytes, 0);
return d_eth_ctrl->write_packetv(all_iov, all_iov_len) > 0;
}
diff --git a/usrp2/host/lib/eth_data_transport.cc
b/usrp2/host/lib/eth_data_transport.cc
index 0c28dc5..88e7b4f 100644
--- a/usrp2/host/lib/eth_data_transport.cc
+++ b/usrp2/host/lib/eth_data_transport.cc
@@ -51,7 +51,7 @@ void usrp2::eth_data_transport::init(){
bool usrp2::eth_data_transport::sendv(const iovec *iov, size_t iovlen){
//create a new iov array with a space for ethernet header
// and move the current iovs to the center of the new array
- size_t all_iov_len = iovlen + 1;
+ size_t all_iov_len = iovlen + 2;
iovec all_iov[all_iov_len];
for (size_t i = 0; i < iovlen; i++){
all_iov[i+1] = iov[i];
@@ -67,6 +67,16 @@ bool usrp2::eth_data_transport::sendv(const iovec *iov,
size_t iovlen){
//feed the first iov the header
all_iov[0].iov_base = &hdr;
all_iov[0].iov_len = sizeof(hdr);
+ //get number of bytes in current iovs
+ int num_bytes = 0;
+ for (size_t i = 0; i < all_iov_len-1; i++){
+ num_bytes += all_iov[i].iov_len;
+ }
+ //handle padding, must be at least minimum length
+ uint8_t padding[eth_buffer::MIN_PKTLEN];
+ memset(padding, 0, eth_buffer::MIN_PKTLEN);
+ all_iov[all_iov_len-1].iov_base = padding;
+ all_iov[all_iov_len-1].iov_len =
std::max(int(eth_buffer::MIN_PKTLEN)-num_bytes, 0);
return (d_eth_data->tx_framev(all_iov, all_iov_len) == eth_buffer::EB_OK)?
true : false;
}
diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc
index 3e51eb9..23f0841 100644
--- a/usrp2/host/lib/usrp2_impl.cc
+++ b/usrp2/host/lib/usrp2_impl.cc
@@ -779,7 +779,6 @@ namespace usrp2 {
if (nitems == 0)
return true;
- // 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
@@ -812,12 +811,7 @@ namespace usrp2 {
u2p_set_word0(&fixed_hdr, flags, channel);
u2p_set_timestamp(&fixed_hdr, timestamp);
- // 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);
+ size_t i = std::min((size_t) U2_MAX_SAMPLES, nitems - n);
eth_iovec iov[2];
iov[0].iov_base = &fixed_hdr;
@@ -825,12 +819,8 @@ namespace usrp2 {
iov[1].iov_base = const_cast<uint32_t *>(&items[n]);
iov[1].iov_len = i * sizeof(uint32_t);
- size_t total = iov[0].iov_len + iov[1].iov_len;
- if (total < 64)
- fprintf(stderr, "usrp2::tx_raw: FIXME: short packet: %zd items (%zd
bytes)\n", i, total);
-
if (not d_data_transport->sendv(iov, 2)){
- return false;
+ return false;
}
n += i;
- [Commit-gnuradio] [gnuradio] 43/148: minor tweak to transport loop and debug printf for vrt, (continued)
- [Commit-gnuradio] [gnuradio] 43/148: minor tweak to transport loop and debug printf for vrt, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 44/148: Removed temporary u2_eth_packet_only_t. Removed the fixed header portion from the u2_eth_packet_t. Removed places in code where control uses the fixed header (always unused 0 for word, and -1 for timestamp). Flagged the fixed header stuff for removal (once we get vrt tx)., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 25/148: cleanup, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 42/148: Created a ring data structure held by the ring. It holds an sbuff and its parsed vrt data (header, payload, and len). The impl data handler parses the packets and enqueues them., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 48/148: Added interrupt call from transport::stop so the recv or callback will throw at interruption points. This fixes the issue where the app would hang in the stop method when exiting (we were hanging here: d_data_pending_cond.wait(l), but now wait throws() and we exit)., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 54/148: flag packets which arrive way too early so the device doesn't sit there forever., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 38/148: rx working with vrt header, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 45/148: Re-implemented find.cc with gruel and eth_ctrl_transport class. Added constructor args to the eth control transport to set the timeout and target for the packet filter., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 49/148: Added read_packet with timeout method to ethernet. Now the control recv can timeout and immediately recv., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 21/148: put 64 bit timer for vita49 on the settings bus, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 47/148: Handled the case of short packets in eth data transport by using padding.,
git <=
- [Commit-gnuradio] [gnuradio] 70/148: changed debug pins to see incoming data, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 51/148: progress on vita_tx. it compiles now, need to work on vita_tx_control., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 46/148: Created and used a typedef for a vector of sbuffs. Changed the return type for the transport sendv to bool. Not all transports can return the number of bytes sent, and we only care if the transport succeeded or not. This fixes an issue of the usrp2 impl freezing on close after tx, because the return value from sednv was improperly handled., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 66/148: Merge branch 'vita_rx' of http://gnuradio.org/git/matt into wip/usrp2, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 79/148: cleaned up the main ibs state machine, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 71/148: Merge branch 'vita_rx' of gnuradio.org:matt into vita_rx, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 53/148: very basic packet sending works, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 77/148: Merge branch 'master' of gnuradio.org:gnuradio into vita_rx, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 57/148: Removed the ring buffer from the usrp2 impl., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 67/148: reorder the memory map, git, 2016/08/14