[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 98/148: usrp2 impl finds out max frame size
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 98/148: usrp2 impl finds out max frame size from the transport |
Date: |
Mon, 15 Aug 2016 00:47:28 +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 c33d6a0bad71d6343789ba6363784e99961acb3d
Author: Josh Blum <address@hidden>
Date: Fri Dec 18 15:47:57 2009 -0800
usrp2 impl finds out max frame size from the transport
---
usrp2/firmware/include/usrp2_eth_packet.h | 11 -----------
usrp2/host/lib/eth_data_transport.h | 3 +++
usrp2/host/lib/transport.h | 4 ++++
usrp2/host/lib/usrp2_impl.cc | 18 ++++++++++--------
4 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/usrp2/firmware/include/usrp2_eth_packet.h
b/usrp2/firmware/include/usrp2_eth_packet.h
index 6c8ef12..2a16916 100644
--- a/usrp2/firmware/include/usrp2_eth_packet.h
+++ b/usrp2/firmware/include/usrp2_eth_packet.h
@@ -94,17 +94,6 @@ typedef struct {
} u2_eth_packet_t;
/*
- * full load of samples:
- * ethernet header + transport header + fixed header + maximum number of
samples.
- * sizeof(u2_eth_samples_t) == 1512
- * (payload is 1498 bytes, two bytes shorter than 1500 byte MTU)
- * (sample numbers are made even to force pairwise alignment in the
interleaved case)
- */
-
-#define U2_MAX_SAMPLES 350
-#define U2_MIN_SAMPLES 10
-
-/*
* Opcodes for control channel
*
* Reply opcodes are the same as the request opcode with the OP_REPLY_BIT set
(0x80).
diff --git a/usrp2/host/lib/eth_data_transport.h
b/usrp2/host/lib/eth_data_transport.h
index 860bb1f..2f0ee87 100644
--- a/usrp2/host/lib/eth_data_transport.h
+++ b/usrp2/host/lib/eth_data_transport.h
@@ -48,6 +48,9 @@ namespace usrp2{
bool sendv(const iovec *iov, size_t iovlen);
void recv(data_handler *handler);
void flush(void);
+ size_t max_bytes(void){
+ return eth_buffer::MAX_PKTLEN - sizeof(u2_eth_packet_t);
+ }
};
diff --git a/usrp2/host/lib/transport.h b/usrp2/host/lib/transport.h
index 902fe50..aed1645 100644
--- a/usrp2/host/lib/transport.h
+++ b/usrp2/host/lib/transport.h
@@ -64,6 +64,10 @@ namespace usrp2 {
* \brief flush any samples in the rx buffers
*/
virtual void flush(void){};
+ /*!
+ * \brief get the maximum number of bytes that can be passed into sendv
+ */
+ virtual size_t max_bytes(void){return 0;}
};
} // namespace usrp2
diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc
index 20f5096..9666f8d 100644
--- a/usrp2/host/lib/usrp2_impl.cc
+++ b/usrp2/host/lib/usrp2_impl.cc
@@ -414,8 +414,10 @@ namespace usrp2 {
//flush any old samples in the data transport
d_data_transport->flush();
- if (items_per_frame == 0)
- items_per_frame = U2_MAX_SAMPLES; // minimize overhead
+ if (items_per_frame == 0){
+ items_per_frame = d_data_transport->max_bytes()/sizeof(uint32_t) -
+ (vrt::HEADER_MAX_N32_BIT_WORDS + vrt::TRAILER_MAX_N32_BIT_WORDS);
+ }
op_start_rx_streaming_cmd cmd;
op_generic_t reply;
@@ -673,12 +675,12 @@ namespace usrp2 {
if (nitems == 0)
return true;
- // FIXME need to check the transport's max size before fragmenting
-
- // fragment as necessary then fire away
-
- size_t nframes = (nitems + U2_MAX_SAMPLES - 1) / U2_MAX_SAMPLES;
+ // fragment as necessary based on the transport's max size
+ size_t max_frames = d_data_transport->max_bytes()/sizeof(uint32_t) -
+ (vrt::HEADER_MAX_N32_BIT_WORDS + vrt::TRAILER_MAX_N32_BIT_WORDS);
+ size_t nframes = (nitems + max_frames - 1) / max_frames;
+ // memory and lengths to be filled in by the expanded header
uint32_t header[vrt::HEADER_MAX_N32_BIT_WORDS];
size_t n32_bit_words_header;
uint32_t trailer[vrt::TRAILER_MAX_N32_BIT_WORDS];
@@ -690,7 +692,7 @@ namespace usrp2 {
for (size_t fn = 0; fn < nframes; fn++){
//calculate the payload length
- size_t n32_bit_words_payload = std::min((size_t) U2_MAX_SAMPLES, nitems
- items_sent);
+ size_t n32_bit_words_payload = std::min<size_t>(max_frames, nitems -
items_sent);
//clear the burst flags and count
hdr_frag.header &= ~(VRTH_START_OF_BURST | VRTH_END_OF_BURST |
VRTH_PKT_CNT_MASK);
- [Commit-gnuradio] [gnuradio] 64/148: put new setting reg into the address space in the right place, (continued)
- [Commit-gnuradio] [gnuradio] 64/148: put new setting reg into the address space in the right place, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 74/148: Merge branch 'wip/usrp2' of address@hidden:jblum into wip/usrp2, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 78/148: Merge branch 'vita_rx' of gnuradio.org:matt into vita_rx, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 83/148: added timeout to ring wait calls, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 60/148: fixed typo in u2_core.v resulting in unconnected net. added debug pins, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 99/148: removed unused copy handler, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 95/148: added documentation for handling of the expanded headers in the transmit calls, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 92/148: Added unparse capability to the vrt expanded header. Unparse can fill in a vrt header and trailer from an expanded header., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 89/148: Replaced tx metadata with vrt expanded header., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 75/148: dsp_core_tx now has setting reg base settable from u2_core. underrun bug in vrt fixed, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 98/148: usrp2 impl finds out max frame size from the transport,
git <=
- [Commit-gnuradio] [gnuradio] 96/148: Merge branch 'vrt' of address@hidden:jblum into wip/usrp2, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 128/148: yet more debug lines, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 118/148: more typo fixes., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 112/148: Merge branch 'wip/usrp2' of http://vps.gnuradio.org/git/jblum into wip/usrp2, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 115/148: place udp core in the memory space, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 120/148: make it match the 36 bit wide version, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 108/148: renamed tics to ticks to be more pc, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 122/148: debug state, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 124/148: try proper reset, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 81/148: Removed stream-at changes to make this mergable into wip/usrp2. Stream-at will be re-implemented with the new vita capabilities., git, 2016/08/14