summaryrefslogtreecommitdiff
path: root/usrp2/host/lib
diff options
context:
space:
mode:
Diffstat (limited to 'usrp2/host/lib')
-rw-r--r--usrp2/host/lib/eth_buffer.cc11
-rw-r--r--usrp2/host/lib/usrp2.cc12
-rw-r--r--usrp2/host/lib/usrp2_impl.cc4
-rw-r--r--usrp2/host/lib/usrp2_impl.h2
4 files changed, 15 insertions, 14 deletions
diff --git a/usrp2/host/lib/eth_buffer.cc b/usrp2/host/lib/eth_buffer.cc
index 7970ab87a..1042868f3 100644
--- a/usrp2/host/lib/eth_buffer.cc
+++ b/usrp2/host/lib/eth_buffer.cc
@@ -44,8 +44,9 @@
#define DEBUG_LOG(X)
#endif
-#define MAX_MEM_SIZE 25e6 // ~0.25s @ 100 MB/s
-#define MAX_SLAB_SIZE 131702 // 128 KB (FIXME fish out of /proc/slabinfo)
+#define DEFAULT_MEM_SIZE 25e6 // ~0.25s @ 100 MB/s
+#define MAX_MEM_SIZE 1000e6 // ~10.00s @ 100 MB/s.
+#define MAX_SLAB_SIZE 131072 // 128 KB (FIXME fish out of /proc/slabinfo)
#define MAX_PKT_SIZE 1512 // we don't do jumbo frames
namespace usrp2 {
@@ -55,7 +56,7 @@ namespace usrp2 {
d_frame_size(0), d_head(0), d_ring(0), d_ethernet(new ethernet())
{
if (rx_bufsize == 0)
- d_buflen = (size_t)MAX_MEM_SIZE;
+ d_buflen = (size_t)DEFAULT_MEM_SIZE;
else
d_buflen = std::min((size_t)MAX_MEM_SIZE, rx_bufsize);
@@ -92,8 +93,8 @@ namespace usrp2 {
req.tp_block_size = page_size << (int)ceil(log2(npages));
// Calculate number of blocks
- req.tp_block_nr = std::min((int)(MAX_SLAB_SIZE/sizeof(void*)),
- (int)(d_buflen/req.tp_block_size));
+ req.tp_block_nr = (int)(d_buflen/req.tp_block_size);
+
// Recalculate buffer length
d_buflen = req.tp_block_nr*req.tp_block_size;
diff --git a/usrp2/host/lib/usrp2.cc b/usrp2/host/lib/usrp2.cc
index 8160d01fa..f48d467ca 100644
--- a/usrp2/host/lib/usrp2.cc
+++ b/usrp2/host/lib/usrp2.cc
@@ -49,7 +49,7 @@ namespace usrp2 {
static usrp_table s_table;
usrp2::sptr
- usrp2::find_existing_or_make_new(const std::string &ifc, props *pr)
+ usrp2::find_existing_or_make_new(const std::string &ifc, props *pr, size_t rx_bufsize)
{
std::string key = ifc + ":" + pr->addr;
@@ -69,7 +69,7 @@ namespace usrp2 {
// We don't have the USRP2 we're looking for
// create a new one and stick it in the table.
- usrp2::sptr r(new usrp2::usrp2(ifc, pr));
+ usrp2::sptr r(new usrp2::usrp2(ifc, pr, rx_bufsize));
usrp_table_entry t(key, r);
s_table.push_back(t);
@@ -119,7 +119,7 @@ namespace usrp2 {
}
usrp2::sptr
- usrp2::make(const std::string &ifc, const std::string &addr)
+ usrp2::make(const std::string &ifc, const std::string &addr, size_t rx_bufsize)
{
std::string naddr = "";
if (addr != "" && !parse_mac_addr(addr, naddr))
@@ -138,12 +138,12 @@ namespace usrp2 {
if (n > 1)
throw std::runtime_error("Multiple USRPs found on interface; must select by MAC address.");
- return find_existing_or_make_new(ifc, &u2s[0]);
+ return find_existing_or_make_new(ifc, &u2s[0], rx_bufsize);
}
// Private constructor. Sole function is to create an impl.
- usrp2::usrp2(const std::string &ifc, props *p)
- : d_impl(new usrp2::impl(ifc, p))
+ usrp2::usrp2(const std::string &ifc, props *p, size_t rx_bufsize)
+ : d_impl(new usrp2::impl(ifc, p, rx_bufsize))
{
// NOP
}
diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc
index ae8735c13..1ecfd7348 100644
--- a/usrp2/host/lib/usrp2_impl.cc
+++ b/usrp2/host/lib/usrp2_impl.cc
@@ -128,8 +128,8 @@ namespace usrp2 {
}
- usrp2::impl::impl(const std::string &ifc, props *p)
- : d_eth_buf(new eth_buffer()), d_interface_name(ifc), d_pf(0), d_bg_thread(0),
+ usrp2::impl::impl(const std::string &ifc, props *p, size_t rx_bufsize)
+ : d_eth_buf(new eth_buffer(rx_bufsize)), d_interface_name(ifc), d_pf(0), d_bg_thread(0),
d_bg_running(false), d_rx_seqno(-1), d_tx_seqno(0), d_next_rid(0),
d_num_rx_frames(0), d_num_rx_missing(0), d_num_rx_overruns(0), d_num_rx_bytes(0),
d_num_enqueued(0), d_enqueued_mutex(), d_bg_pending_cond(&d_enqueued_mutex),
diff --git a/usrp2/host/lib/usrp2_impl.h b/usrp2/host/lib/usrp2_impl.h
index c96a6fad3..ec96f3a70 100644
--- a/usrp2/host/lib/usrp2_impl.h
+++ b/usrp2/host/lib/usrp2_impl.h
@@ -113,7 +113,7 @@ namespace usrp2 {
bool reset_db();
public:
- impl(const std::string &ifc, props *p);
+ impl(const std::string &ifc, props *p, size_t rx_bufsize);
~impl();
void bg_loop();