summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2008-11-07 16:20:24 +0000
committerAndrew Stitcher <astitcher@apache.org>2008-11-07 16:20:24 +0000
commit69f969e0f771c0197ad24a00311ecaa78debe4e0 (patch)
tree552f639f58818705e963ea87c5f2110e7ea16b05 /cpp/src
parentfbb5736c3d32ef829977be6bd598450fc8bb63d5 (diff)
downloadqpid-python-69f969e0f771c0197ad24a00311ecaa78debe4e0.tar.gz
QPID-1438: Before registering the rdma daemon transport plugin check
whether there are any rdma devices - if not don't register git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@712182 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/sys/RdmaIOPlugin.cpp8
-rw-r--r--cpp/src/qpid/sys/posix/AsynchIO.cpp3
-rw-r--r--cpp/src/qpid/sys/rdma/rdma_factories.h4
-rw-r--r--cpp/src/qpid/sys/rdma/rdma_wrap.cpp7
-rw-r--r--cpp/src/qpid/sys/rdma/rdma_wrap.h2
5 files changed, 19 insertions, 5 deletions
diff --git a/cpp/src/qpid/sys/RdmaIOPlugin.cpp b/cpp/src/qpid/sys/RdmaIOPlugin.cpp
index 4316d7b582..3c1d57480a 100644
--- a/cpp/src/qpid/sys/RdmaIOPlugin.cpp
+++ b/cpp/src/qpid/sys/RdmaIOPlugin.cpp
@@ -214,12 +214,18 @@ static class RdmaIOPlugin : public Plugin {
}
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);
}
}
diff --git a/cpp/src/qpid/sys/posix/AsynchIO.cpp b/cpp/src/qpid/sys/posix/AsynchIO.cpp
index 569cafcb34..50c971a181 100644
--- a/cpp/src/qpid/sys/posix/AsynchIO.cpp
+++ b/cpp/src/qpid/sys/posix/AsynchIO.cpp
@@ -42,13 +42,12 @@ namespace {
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;
/*
diff --git a/cpp/src/qpid/sys/rdma/rdma_factories.h b/cpp/src/qpid/sys/rdma/rdma_factories.h
index b568cadc7b..8d024f37aa 100644
--- a/cpp/src/qpid/sys/rdma/rdma_factories.h
+++ b/cpp/src/qpid/sys/rdma/rdma_factories.h
@@ -38,8 +38,8 @@ namespace Rdma {
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 >
diff --git a/cpp/src/qpid/sys/rdma/rdma_wrap.cpp b/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
index ac0813ffd6..9e249210d5 100644
--- a/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
+++ b/cpp/src/qpid/sys/rdma/rdma_wrap.cpp
@@ -10,6 +10,13 @@ namespace Rdma {
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
diff --git a/cpp/src/qpid/sys/rdma/rdma_wrap.h b/cpp/src/qpid/sys/rdma/rdma_wrap.h
index 61d8281cee..7812a02532 100644
--- a/cpp/src/qpid/sys/rdma/rdma_wrap.h
+++ b/cpp/src/qpid/sys/rdma/rdma_wrap.h
@@ -47,6 +47,8 @@ namespace Rdma {
const int DEFAULT_WR_ENTRIES = 64;
extern const ::rdma_conn_param DEFAULT_CONNECT_PARAM;
+ int deviceCount();
+
struct Buffer {
friend class QueuePair;