From f1ca344c8126bd3bd079897a4e4c3f23affa5203 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Wed, 8 Sep 2010 16:48:36 +0000 Subject: Move the RDMA buffer tracking/destruction into the QueuePair class from the RdmaIO class. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@995126 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/rdma/RdmaIO.cpp | 4 ---- cpp/src/qpid/sys/rdma/RdmaIO.h | 4 ---- cpp/src/qpid/sys/rdma/rdma_wrap.cpp | 6 +++++- cpp/src/qpid/sys/rdma/rdma_wrap.h | 2 ++ 4 files changed, 7 insertions(+), 9 deletions(-) (limited to 'cpp/src/qpid/sys') diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/cpp/src/qpid/sys/rdma/RdmaIO.cpp index 845e84eec3..aa0dfbd5a4 100644 --- a/cpp/src/qpid/sys/rdma/RdmaIO.cpp +++ b/cpp/src/qpid/sys/rdma/RdmaIO.cpp @@ -64,14 +64,12 @@ namespace Rdma { for (int i = 0; icreateBuffer(bufferSize); - buffers.push_front(b); qp->postRecv(b); } for (int i = 0; icreateBuffer(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) diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.h b/cpp/src/qpid/sys/rdma/RdmaIO.h index 4cd0e08592..aabb330c42 100644 --- a/cpp/src/qpid/sys/rdma/RdmaIO.h +++ b/cpp/src/qpid/sys/rdma/RdmaIO.h @@ -32,7 +32,6 @@ #include #include -#include #include namespace Rdma { @@ -59,9 +58,6 @@ namespace Rdma { //qpid::sys::Mutex stateLock; std::deque bufferQueue; qpid::sys::Mutex bufferQueueLock; - boost::ptr_deque 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; diff --git a/cpp/src/qpid/sys/rdma/rdma_wrap.cpp b/cpp/src/qpid/sys/rdma/rdma_wrap.cpp index 2581aaedcb..b046b012db 100644 --- a/cpp/src/qpid/sys/rdma/rdma_wrap.cpp +++ b/cpp/src/qpid/sys/rdma/rdma_wrap.cpp @@ -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 diff --git a/cpp/src/qpid/sys/rdma/rdma_wrap.h b/cpp/src/qpid/sys/rdma/rdma_wrap.h index 54066d1d41..488cf8c646 100644 --- a/cpp/src/qpid/sys/rdma/rdma_wrap.h +++ b/cpp/src/qpid/sys/rdma/rdma_wrap.h @@ -28,6 +28,7 @@ #include #include +#include namespace qpid { namespace sys { @@ -121,6 +122,7 @@ namespace Rdma { boost::shared_ptr< ::ibv_qp > qp; int outstandingSendEvents; int outstandingRecvEvents; + boost::ptr_deque buffers; QueuePair(boost::shared_ptr< ::rdma_cm_id > id); ~QueuePair(); -- cgit v1.2.1