Commit bad07664 authored by Xiao Yang's avatar Xiao Yang Committed by Jason Gunthorpe

RDMA/rxe: Add check for supported QP types

Current rdma_rxe only supports five QP types, attempting to create any
others should return an error - the type check was missed.

Link: https://lore.kernel.org/r/20201216071755.149449-2-yangx.jy@cn.fujitsu.comSigned-off-by: default avatarXiao Yang <yangx.jy@cn.fujitsu.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 661f3859
...@@ -62,6 +62,17 @@ int rxe_qp_chk_init(struct rxe_dev *rxe, struct ib_qp_init_attr *init) ...@@ -62,6 +62,17 @@ int rxe_qp_chk_init(struct rxe_dev *rxe, struct ib_qp_init_attr *init)
struct rxe_port *port; struct rxe_port *port;
int port_num = init->port_num; int port_num = init->port_num;
switch(init->qp_type) {
case IB_QPT_SMI:
case IB_QPT_GSI:
case IB_QPT_RC:
case IB_QPT_UC:
case IB_QPT_UD:
break;
default:
return -EOPNOTSUPP;
}
if (!init->recv_cq || !init->send_cq) { if (!init->recv_cq || !init->send_cq) {
pr_warn("missing cq\n"); pr_warn("missing cq\n");
goto err1; goto err1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment