qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r995126 - in /qpid/trunk/qpid/cpp/src/qpid/sys/rdma: RdmaIO.cpp RdmaIO.h rdma_wrap.cpp rdma_wrap.h
Date Wed, 08 Sep 2010 16:48:36 GMT
Author: astitcher
Date: Wed Sep  8 16:48:36 2010
New Revision: 995126

URL: http://svn.apache.org/viewvc?rev=995126&view=rev
Log:
Move the RDMA buffer tracking/destruction into the QueuePair class from
the RdmaIO class.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
    qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h
    qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
    qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp?rev=995126&r1=995125&r2=995126&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp Wed Sep  8 16:48:36 2010
@@ -64,14 +64,12 @@ namespace Rdma {
         for (int i = 0; i<recvBufferCount; ++i) {
             // Allocate recv buffer
             Buffer* b = qp->createBuffer(bufferSize);
-            buffers.push_front(b);
             qp->postRecv(b);
         }
 
         for (int i = 0; i<xmitBufferCount; ++i) {
             // Allocate xmit buffer
             Buffer* b = qp->createBuffer(bufferSize);
-            buffers.push_front(b);
             bufferQueue.push_front(b);
         }
     }
@@ -86,8 +84,6 @@ namespace Rdma {
             QPID_LOG(error, "RDMA: qp=" << qp << ": Deleting queue whilst not
shutdown");
             dataHandle.stopWatch();
         }
-
-        // The buffers ptr_deque automatically deletes all the buffers we've allocated
         // TODO: It might turn out to be more efficient in high connection loads to reuse
the
         // buffers rather than having to reregister them all the time (this would be straightforward
if all 
         // connections haver the same buffer size and harder otherwise)

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h?rev=995126&r1=995125&r2=995126&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h Wed Sep  8 16:48:36 2010
@@ -32,7 +32,6 @@
 #include <netinet/in.h>
 
 #include <boost/function.hpp>
-#include <boost/ptr_container/ptr_deque.hpp>
 #include <deque>
 
 namespace Rdma {
@@ -59,9 +58,6 @@ namespace Rdma {
         //qpid::sys::Mutex stateLock;
         std::deque<Buffer*> bufferQueue;
         qpid::sys::Mutex bufferQueueLock;
-        boost::ptr_deque<Buffer> buffers;
-        // The QueuePair must be after the buffers so that the connection is destroyed before
the buffers
-        // are deallocated so that the hardware doesn't write into memory that's been given
back.
         QueuePair::intrusive_ptr qp;
         qpid::sys::DispatchHandleRef dataHandle;
 

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp?rev=995126&r1=995125&r2=995126&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp Wed Sep  8 16:48:36 2010
@@ -154,11 +154,15 @@ namespace Rdma {
 
         // Reset back pointer in case someone else has the qp
         qp->qp_context = 0;
+
+        // The buffers ptr_deque automatically deletes all the buffers we've allocated
     }
 
     // Create a buffer to use for writing
     Buffer* QueuePair::createBuffer(int s) {
-        return new Buffer(pd.get(), s);
+        Buffer* b = new Buffer(pd.get(), s);
+        buffers.push_front(b);
+        return b;
     }
 
     // Make channel non-blocking by making

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h?rev=995126&r1=995125&r2=995126&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h Wed Sep  8 16:48:36 2010
@@ -28,6 +28,7 @@
 
 #include <boost/shared_ptr.hpp>
 #include <boost/intrusive_ptr.hpp>
+#include <boost/ptr_container/ptr_deque.hpp>
 
 namespace qpid {
 namespace sys {
@@ -121,6 +122,7 @@ namespace Rdma {
         boost::shared_ptr< ::ibv_qp > qp;
         int outstandingSendEvents;
         int outstandingRecvEvents;
+        boost::ptr_deque<Buffer> buffers;
 
         QueuePair(boost::shared_ptr< ::rdma_cm_id > id);
         ~QueuePair();



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message