From ed97b7f9aeb971f470024ffc2d6c52593a410110 Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Tue, 30 Mar 2010 16:22:33 -0800 Subject: [PATCH] rdma/ucm: add support for RDMA_PS_IB when creating an ID In order to support RDMA_PS_IB, we need to know the qp type to associated with the rdma cm id. Receive the qp type from user space using currently reserved fields. Previous kernels do not support RDMA_PS_IB, so we only read out the qp type data if PS_IB has been selected. This avoids issues reading uninitialized data from existing applications. Signed-off-by: Sean Hefty --- drivers/infiniband/core/ucma.c | 3 +++ include/rdma/rdma_user_cm.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index 9feb18b97d1..7a59039db77 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -359,6 +359,9 @@ static int ucma_get_qp_type(struct rdma_ucm_create_id *cmd, enum ib_qp_type *qp_ case RDMA_PS_IPOIB: *qp_type = IB_QPT_UD; return 0; + case RDMA_PS_IB: + *qp_type = cmd->qp_type; + return 0; default: return -EINVAL; } diff --git a/include/rdma/rdma_user_cm.h b/include/rdma/rdma_user_cm.h index 1d165022c02..d88c23c7c8b 100644 --- a/include/rdma/rdma_user_cm.h +++ b/include/rdma/rdma_user_cm.h @@ -77,7 +77,8 @@ struct rdma_ucm_create_id { __u64 uid; __u64 response; __u16 ps; - __u8 reserved[6]; + __u8 qp_type; + __u8 reserved[5]; }; struct rdma_ucm_create_id_resp { -- 2.46.0