diff options
author | Steve Wise <swise@opengridcomputing.com> | 2016-10-26 15:36:47 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-12-14 11:38:28 -0500 |
commit | 5042a73d3e9de7bcc2a31adea08ee95bbce998dc (patch) | |
tree | 756a334da6be36b8154ac165344735b0aba57ed5 | |
parent | 77a5db13153906a7e00740b10b2730e53385c5a8 (diff) |
rdma_cm: add rdma_is_consumer_reject() helper function
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>
-rw-r--r-- | drivers/infiniband/core/cma.c | 13 | ||||
-rw-r--r-- | include/rdma/rdma_cm.h | 7 |
2 files changed, 20 insertions, 0 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 877e4dc9e382..bd1d4fe47740 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -115,6 +115,19 @@ const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id, | |||
115 | } | 115 | } |
116 | EXPORT_SYMBOL(rdma_reject_msg); | 116 | EXPORT_SYMBOL(rdma_reject_msg); |
117 | 117 | ||
118 | bool rdma_is_consumer_reject(struct rdma_cm_id *id, int reason) | ||
119 | { | ||
120 | if (rdma_ib_or_roce(id->device, id->port_num)) | ||
121 | return reason == IB_CM_REJ_CONSUMER_DEFINED; | ||
122 | |||
123 | if (rdma_protocol_iwarp(id->device, id->port_num)) | ||
124 | return reason == -ECONNREFUSED; | ||
125 | |||
126 | WARN_ON_ONCE(1); | ||
127 | return false; | ||
128 | } | ||
129 | EXPORT_SYMBOL(rdma_is_consumer_reject); | ||
130 | |||
118 | static void cma_add_one(struct ib_device *device); | 131 | static void cma_add_one(struct ib_device *device); |
119 | static void cma_remove_one(struct ib_device *device, void *client_data); | 132 | static void cma_remove_one(struct ib_device *device, void *client_data); |
120 | 133 | ||
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h index f11a768be06b..62039c2fd951 100644 --- a/include/rdma/rdma_cm.h +++ b/include/rdma/rdma_cm.h | |||
@@ -395,5 +395,12 @@ __be64 rdma_get_service_id(struct rdma_cm_id *id, struct sockaddr *addr); | |||
395 | */ | 395 | */ |
396 | const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id, | 396 | const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id, |
397 | int reason); | 397 | int reason); |
398 | /** | ||
399 | * rdma_is_consumer_reject - return true if the consumer rejected the connect | ||
400 | * request. | ||
401 | * @id: Communication identifier that received the REJECT event. | ||
402 | * @reason: Value returned in the REJECT event status field. | ||
403 | */ | ||
404 | bool rdma_is_consumer_reject(struct rdma_cm_id *id, int reason); | ||
398 | 405 | ||
399 | #endif /* RDMA_CM_H */ | 406 | #endif /* RDMA_CM_H */ |