[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 48/148: Added interrupt call from transport
From: |
git |
Subject: |
[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). |
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 3628a061c6040238af29a1217cfcbbd7e693dae0
Author: Josh Blum <address@hidden>
Date: Fri Nov 20 16:07:58 2009 -0800
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).
Also, setup padding in the eth data/control transport so its only allocated
and zeroed at init.
---
usrp2/host/lib/eth_ctrl_transport.cc | 6 +++---
usrp2/host/lib/eth_ctrl_transport.h | 1 +
usrp2/host/lib/eth_data_transport.cc | 11 ++++++++---
usrp2/host/lib/eth_data_transport.h | 1 +
usrp2/host/lib/transport.cc | 3 ++-
5 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/usrp2/host/lib/eth_ctrl_transport.cc
b/usrp2/host/lib/eth_ctrl_transport.cc
index 8f7c418..58fa58d 100644
--- a/usrp2/host/lib/eth_ctrl_transport.cc
+++ b/usrp2/host/lib/eth_ctrl_transport.cc
@@ -31,6 +31,8 @@ usrp2::eth_ctrl_transport::eth_ctrl_transport(const
std::string &ifc, u2_mac_add
else d_pf_ctrl =
pktfilter::make_ethertype_inbound(U2_CTRL_ETHERTYPE, d_eth_ctrl->mac());
if (!d_pf_ctrl || !d_eth_ctrl->attach_pktfilter(d_pf_ctrl))
throw std::runtime_error("Unable to attach packet filter for control
packets.");
+
+ memset(d_padding, 0, sizeof(d_padding));
}
usrp2::eth_ctrl_transport::~eth_ctrl_transport(){
@@ -65,9 +67,7 @@ bool usrp2::eth_ctrl_transport::sendv(const iovec *iov,
size_t iovlen){
num_bytes += all_iov[i].iov_len;
}
//handle padding, must be at least minimum length
- 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_base = d_padding;
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_ctrl_transport.h
b/usrp2/host/lib/eth_ctrl_transport.h
index 346fbc2..3814cae 100644
--- a/usrp2/host/lib/eth_ctrl_transport.h
+++ b/usrp2/host/lib/eth_ctrl_transport.h
@@ -33,6 +33,7 @@ namespace usrp2{
u2_mac_addr_t d_mac;
uint8_t *d_buff;
double_t d_timeout;
+ uint8_t d_padding[ethernet::MIN_PKTLEN];
public:
/*!
diff --git a/usrp2/host/lib/eth_data_transport.cc
b/usrp2/host/lib/eth_data_transport.cc
index 88e7b4f..7f556e6 100644
--- a/usrp2/host/lib/eth_data_transport.cc
+++ b/usrp2/host/lib/eth_data_transport.cc
@@ -35,6 +35,8 @@ usrp2::eth_data_transport::eth_data_transport(const
std::string &ifc, u2_mac_add
d_pf_data = pktfilter::make_ethertype_inbound_target(U2_DATA_ETHERTYPE,
(const unsigned char*)&(d_mac.addr));
if (!d_pf_data || !d_eth_data->attach_pktfilter(d_pf_data))
throw std::runtime_error("Unable to attach packet filter for data
packets.");
+
+ memset(d_padding, 0, sizeof(d_padding));
}
usrp2::eth_data_transport::~eth_data_transport(){
@@ -73,9 +75,7 @@ bool usrp2::eth_data_transport::sendv(const iovec *iov,
size_t iovlen){
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_base = d_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;
}
@@ -91,6 +91,11 @@ usrp2::transport::sbuff_vec_t
usrp2::eth_data_transport::recv(){
void *base = iovs[i].iov_base;
size_t len = iovs[i].iov_len;
+ if (len <= sizeof(u2_eth_packet_t)){
+ DEBUG_LOG("D");
+ continue; //drop truncated packet
+ }
+
u2_eth_packet_t *hdr = (u2_eth_packet_t *)base;
d_num_rx_frames++;
d_num_rx_bytes += len;
diff --git a/usrp2/host/lib/eth_data_transport.h
b/usrp2/host/lib/eth_data_transport.h
index 936c717..4955327 100644
--- a/usrp2/host/lib/eth_data_transport.h
+++ b/usrp2/host/lib/eth_data_transport.h
@@ -39,6 +39,7 @@ namespace usrp2{
unsigned int d_num_rx_missing;
unsigned int d_num_rx_overruns;
unsigned int d_num_rx_bytes;
+ uint8_t d_padding[eth_buffer::MIN_PKTLEN];
public:
eth_data_transport(const std::string &ifc, u2_mac_addr_t mac, size_t
rx_bufsize);
diff --git a/usrp2/host/lib/transport.cc b/usrp2/host/lib/transport.cc
index 2f94fd6..b410f2a 100644
--- a/usrp2/host/lib/transport.cc
+++ b/usrp2/host/lib/transport.cc
@@ -50,6 +50,7 @@ void usrp2::transport::stop(){
throw std::runtime_error("usrp2::transport for " + d_type_str + "
already stopped\n");
}
d_running = false;
+ d_thread->interrupt();
d_thread->join();
}
@@ -61,7 +62,7 @@ void usrp2::transport::run(){
// pass the buffer into the callback
sbuff_vec_t sbs = recv();
if (d_running and sbs.size()) d_cb(sbs);
- //catch thread interrupts from join, sleep, etc
+ //catch thread interrupts, possibly from stop
//the running condition will be re-checked
}catch(boost::thread_interrupted const &){}
}
- [Commit-gnuradio] [gnuradio] 40/148: Added missing flag to vrt header in txrx.c. Added parsing to vrt expanded header to copy out header entries. Modified usrp2 impl to use the correctly parsed header., (continued)
- [Commit-gnuradio] [gnuradio] 40/148: Added missing flag to vrt header in txrx.c. Added parsing to vrt expanded header to copy out header entries. Modified usrp2 impl to use the correctly parsed header., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 35/148: got vrt rx somewhat working, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 52/148: seems to correctly deframe packets. now need to consume them., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 50/148: make the testbench work in this environment, without the crossclock settings bus, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 26/148: moved regs around for vita49, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 19/148: VITA49 rx (and tx skeleton) copied over from quad radio, git, 2016/08/14
- [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 <=
- [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, 2016/08/14
- [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