commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r11000 - in gnuradio/trunk/usrp2/host: include/usrp2 l


From: jcorgan
Subject: [Commit-gnuradio] r11000 - in gnuradio/trunk/usrp2/host: include/usrp2 lib
Date: Mon, 11 May 2009 09:31:33 -0600 (MDT)

Author: jcorgan
Date: 2009-05-11 09:31:33 -0600 (Mon, 11 May 2009)
New Revision: 11000

Modified:
   gnuradio/trunk/usrp2/host/include/usrp2/usrp2.h
   gnuradio/trunk/usrp2/host/lib/eth_buffer.cc
   gnuradio/trunk/usrp2/host/lib/usrp2.cc
   gnuradio/trunk/usrp2/host/lib/usrp2_impl.cc
   gnuradio/trunk/usrp2/host/lib/usrp2_impl.h
Log:
Apply Juha Vierinen patch to allow variable USRP2 rx buffer size

Modified: gnuradio/trunk/usrp2/host/include/usrp2/usrp2.h
===================================================================
--- gnuradio/trunk/usrp2/host/include/usrp2/usrp2.h     2009-05-11 15:18:01 UTC 
(rev 10999)
+++ gnuradio/trunk/usrp2/host/include/usrp2/usrp2.h     2009-05-11 15:31:33 UTC 
(rev 11000)
@@ -86,7 +86,7 @@
      *              If \p addr is HH:HH, it's treated as if it were 
00:50:c2:85:HH:HH
      *              "" will autoselect a USRP2 if there is only a single one 
on the local ethernet.
      */
-    static sptr make(const std::string &ifc, const std::string &addr="");
+    static sptr make(const std::string &ifc, const std::string &addr="", 
size_t rx_bufsize=0);
 
     /*!
      * Class destructor
@@ -578,10 +578,10 @@
 
   private:
     // Static function to retrieve or create usrp2 instance
-    static sptr find_existing_or_make_new(const std::string &ifc, props *p);
+    static sptr find_existing_or_make_new(const std::string &ifc, props *p, 
size_t rx_bufsize);
 
     // Only class members can instantiate this class
-    usrp2(const std::string &ifc, props *p);
+    usrp2(const std::string &ifc, props *p, size_t rx_bufsize);
   
     // All private state is held in opaque pointer
     std::auto_ptr<impl> d_impl;

Modified: gnuradio/trunk/usrp2/host/lib/eth_buffer.cc
===================================================================
--- gnuradio/trunk/usrp2/host/lib/eth_buffer.cc 2009-05-11 15:18:01 UTC (rev 
10999)
+++ gnuradio/trunk/usrp2/host/lib/eth_buffer.cc 2009-05-11 15:31:33 UTC (rev 
11000)
@@ -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 @@
       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 @@
     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;

Modified: gnuradio/trunk/usrp2/host/lib/usrp2.cc
===================================================================
--- gnuradio/trunk/usrp2/host/lib/usrp2.cc      2009-05-11 15:18:01 UTC (rev 
10999)
+++ gnuradio/trunk/usrp2/host/lib/usrp2.cc      2009-05-11 15:31:33 UTC (rev 
11000)
@@ -49,7 +49,7 @@
   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 @@
     // 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 @@
   }
 
   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 @@
     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
   }

Modified: gnuradio/trunk/usrp2/host/lib/usrp2_impl.cc
===================================================================
--- gnuradio/trunk/usrp2/host/lib/usrp2_impl.cc 2009-05-11 15:18:01 UTC (rev 
10999)
+++ gnuradio/trunk/usrp2/host/lib/usrp2_impl.cc 2009-05-11 15:31:33 UTC (rev 
11000)
@@ -128,8 +128,8 @@
   }
 
 
-  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),

Modified: gnuradio/trunk/usrp2/host/lib/usrp2_impl.h
===================================================================
--- gnuradio/trunk/usrp2/host/lib/usrp2_impl.h  2009-05-11 15:18:01 UTC (rev 
10999)
+++ gnuradio/trunk/usrp2/host/lib/usrp2_impl.h  2009-05-11 15:31:33 UTC (rev 
11000)
@@ -113,7 +113,7 @@
     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();





reply via email to

[Prev in Thread] Current Thread [Next in Thread]