]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
rdma_cm: add rdma_is_consumer_reject() helper function
authorSteve Wise <swise@opengridcomputing.com>
Wed, 26 Oct 2016 19:36:47 +0000 (12:36 -0700)
committerDoug Ledford <dledford@redhat.com>
Wed, 14 Dec 2016 16:38:28 +0000 (11:38 -0500)
Return true if the peer consumer application rejected the
connection attempt.

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/cma.c
include/rdma/rdma_cm.h

index 877e4dc9e382bd4d3a1b6f9bbdd5829d599a232b..bd1d4fe47740157f6979bc46641ec01176eb4bd1 100644 (file)
@@ -115,6 +115,19 @@ const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id,
 }
 EXPORT_SYMBOL(rdma_reject_msg);
 
+bool rdma_is_consumer_reject(struct rdma_cm_id *id, int reason)
+{
+       if (rdma_ib_or_roce(id->device, id->port_num))
+               return reason == IB_CM_REJ_CONSUMER_DEFINED;
+
+       if (rdma_protocol_iwarp(id->device, id->port_num))
+               return reason == -ECONNREFUSED;
+
+       WARN_ON_ONCE(1);
+       return false;
+}
+EXPORT_SYMBOL(rdma_is_consumer_reject);
+
 static void cma_add_one(struct ib_device *device);
 static void cma_remove_one(struct ib_device *device, void *client_data);
 
index f11a768be06ba97cb5545096b144db75e11197fe..62039c2fd9519277b7e33273b31c1b87cc95272e 100644 (file)
@@ -395,5 +395,12 @@ __be64 rdma_get_service_id(struct rdma_cm_id *id, struct sockaddr *addr);
  */
 const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id,
                                                int reason);
+/**
+ * rdma_is_consumer_reject - return true if the consumer rejected the connect
+ *                           request.
+ * @id: Communication identifier that received the REJECT event.
+ * @reason: Value returned in the REJECT event status field.
+ */
+bool rdma_is_consumer_reject(struct rdma_cm_id *id, int reason);
 
 #endif /* RDMA_CM_H */