Author: astitcher
Date: Fri Nov 7 08:20:24 2008
New Revision: 712182
URL: http://svn.apache.org/viewvc?rev=712182&view=rev
Log:
QPID-1438: Before registering the rdma daemon transport plugin check
whether there are any rdma devices - if not don't register
Modified:
incubator/qpid/trunk/qpid/cpp/src/qpid/sys/RdmaIOPlugin.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_factories.h
incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/RdmaIOPlugin.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/sys/RdmaIOPlugin.cpp?rev=712182&r1=712181&r2=712182&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/sys/RdmaIOPlugin.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/sys/RdmaIOPlugin.cpp Fri Nov 7
08:20:24 2008
@@ -214,12 +214,18 @@
}
void initialize(Target& target) {
+ // Check whether we actually have any rdma devices
+ if ( Rdma::deviceCount() == 0 ) {
+ QPID_LOG(info, "Rdma: Disabled: no rdma devices found");
+ return;
+ }
+
broker::Broker* broker = dynamic_cast<broker::Broker*>(&target);
// Only provide to a Broker
if (broker) {
const broker::Broker::Options& opts = broker->getOptions();
ProtocolFactory::shared_ptr protocol(new
RdmaIOProtocolFactory(opts.port, opts.connectionBacklog));
- QPID_LOG(info, "Listening on RDMA port " << protocol->getPort());
+ QPID_LOG(info, "Rdma: Listening on RDMA port " <<
protocol->getPort());
broker->registerProtocolFactory("rdma", protocol);
}
}
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp?rev=712182&r1=712181&r2=712182&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp Fri Nov 7
08:20:24 2008
@@ -42,13 +42,12 @@
struct StaticInit {
StaticInit() {
-
/**
* Make *process* not generate SIGPIPE when writing to closed
* pipe/socket (necessary as default action is to terminate process)
*/
::signal(SIGPIPE, SIG_IGN);
- };
+ };
} init;
/*
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_factories.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_factories.h?rev=712182&r1=712181&r2=712182&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_factories.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_factories.h Fri Nov 7
08:20:24 2008
@@ -38,8 +38,8 @@
void destroyQp(::ibv_qp* qp) throw ();
inline boost::shared_ptr< ::rdma_event_channel > mkEChannel() {
- return
- boost::shared_ptr< ::rdma_event_channel
>(::rdma_create_event_channel(), destroyEChannel);
+ ::rdma_event_channel* c = CHECK_NULL(::rdma_create_event_channel());
+ return boost::shared_ptr< ::rdma_event_channel >(c, destroyEChannel);
}
inline boost::shared_ptr< ::rdma_cm_id >
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp?rev=712182&r1=712181&r2=712182&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.cpp Fri Nov 7
08:20:24 2008
@@ -10,6 +10,13 @@
5, // .retry_count
7 // .rnr_retry_count
};
+
+ // This is moderately inefficient so don't use in a critical path
+ int deviceCount() {
+ int count;
+ ::ibv_free_device_list(::ibv_get_device_list(&count));
+ return count;
+ }
::rdma_conn_param ConnectionEvent::getConnectionParam() const {
// It's badly documented, but it seems from the librdma source code
that all the following
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h?rev=712182&r1=712181&r2=712182&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/rdma_wrap.h Fri Nov 7
08:20:24 2008
@@ -47,6 +47,8 @@
const int DEFAULT_WR_ENTRIES = 64;
extern const ::rdma_conn_param DEFAULT_CONNECT_PARAM;
+ int deviceCount();
+
struct Buffer {
friend class QueuePair;