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

rdma_cm: add rdma_consumer_reject_data helper function

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>

authored by

Steve Wise and committed by
Doug Ledford
5f244104 5042a73d

+26
+16
drivers/infiniband/core/cma.c
··· 128 128 } 129 129 EXPORT_SYMBOL(rdma_is_consumer_reject); 130 130 131 + const void *rdma_consumer_reject_data(struct rdma_cm_id *id, 132 + struct rdma_cm_event *ev, u8 *data_len) 133 + { 134 + const void *p; 135 + 136 + if (rdma_is_consumer_reject(id, ev->status)) { 137 + *data_len = ev->param.conn.private_data_len; 138 + p = ev->param.conn.private_data; 139 + } else { 140 + *data_len = 0; 141 + p = NULL; 142 + } 143 + return p; 144 + } 145 + EXPORT_SYMBOL(rdma_consumer_reject_data); 146 + 131 147 static void cma_add_one(struct ib_device *device); 132 148 static void cma_remove_one(struct ib_device *device, void *client_data); 133 149
+10
include/rdma/rdma_cm.h
··· 403 403 */ 404 404 bool rdma_is_consumer_reject(struct rdma_cm_id *id, int reason); 405 405 406 + /** 407 + * rdma_consumer_reject_data - return the consumer reject private data and 408 + * length, if any. 409 + * @id: Communication identifier that received the REJECT event. 410 + * @ev: RDMA CM reject event. 411 + * @data_len: Pointer to the resulting length of the consumer data. 412 + */ 413 + const void *rdma_consumer_reject_data(struct rdma_cm_id *id, 414 + struct rdma_cm_event *ev, u8 *data_len); 415 + 406 416 #endif /* RDMA_CM_H */