Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Steve Wise and committed by
Doug Ledford
5042a73d 77a5db13

+20
+13
drivers/infiniband/core/cma.c
··· 115 115 } 116 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 131 static void cma_add_one(struct ib_device *device); 119 132 static void cma_remove_one(struct ib_device *device, void *client_data); 120 133
+7
include/rdma/rdma_cm.h
··· 395 395 */ 396 396 const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id, 397 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 406 #endif /* RDMA_CM_H */