rdma_cm: add rdma_consumer_reject_data 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)
rdma_consumer_reject_data() will return the private data pointer
and length if any is available.

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

index bd1d4fe47740157f6979bc46641ec01176eb4bd1..8c30e3dedebef93f61f3aa934631f9b667264021 100644 (file)
@@ -128,6 +128,22 @@ bool rdma_is_consumer_reject(struct rdma_cm_id *id, int reason)
 }
 EXPORT_SYMBOL(rdma_is_consumer_reject);
 
+const void *rdma_consumer_reject_data(struct rdma_cm_id *id,
+                                     struct rdma_cm_event *ev, u8 *data_len)
+{
+       const void *p;
+
+       if (rdma_is_consumer_reject(id, ev->status)) {
+               *data_len = ev->param.conn.private_data_len;
+               p = ev->param.conn.private_data;
+       } else {
+               *data_len = 0;
+               p = NULL;
+       }
+       return p;
+}
+EXPORT_SYMBOL(rdma_consumer_reject_data);
+
 static void cma_add_one(struct ib_device *device);
 static void cma_remove_one(struct ib_device *device, void *client_data);
 
index 62039c2fd9519277b7e33273b31c1b87cc95272e..d3968b561f868db47c9c98ed72ca96d44303bb16 100644 (file)
@@ -403,4 +403,14 @@ const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id,
  */
 bool rdma_is_consumer_reject(struct rdma_cm_id *id, int reason);
 
+/**
+ * rdma_consumer_reject_data - return the consumer reject private data and
+ *                            length, if any.
+ * @id: Communication identifier that received the REJECT event.
+ * @ev: RDMA CM reject event.
+ * @data_len: Pointer to the resulting length of the consumer data.
+ */
+const void *rdma_consumer_reject_data(struct rdma_cm_id *id,
+                                     struct rdma_cm_event *ev, u8 *data_len);
+
 #endif /* RDMA_CM_H */