commit a5d774e8d247ebcdabe3e450abadfb659d2ae47a Author: Jason Gunthorpe Date: Tue Nov 7 10:30:08 2017 -0700 verbs: Do not block QP attr_masks used by older kernels At least the RDMA CM in 4.3 will give user space structs with these bits set. Those kernels require user space to pass those set bits back to the kernel. Blocking them causes RDMA CM to be unusable on older kernels. Fixes: 3ca7a1031486 ("ibverbs: Add support for packet pacing") Reported-by: Ram Amrani Signed-off-by: Jason Gunthorpe diff --git libibverbs/cmd.c libibverbs/cmd.c index 9d2140fb..77aba334 100644 --- libibverbs/cmd.c +++ libibverbs/cmd.c @@ -1154,10 +1154,10 @@ int ibv_cmd_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, struct ibv_query_qp_resp resp; /* - * Masks over IBV_QP_DEST_QPN are not supported by - * that not extended command. + * Starting with IBV_QP_RATE_LIMIT the attribute must go through the + * _ex path. */ - if (attr_mask & ~((IBV_QP_DEST_QPN << 1) - 1)) + if (attr_mask & ~(IBV_QP_RATE_LIMIT - 1)) return EOPNOTSUPP; IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_QP, &resp, sizeof resp); @@ -1324,10 +1324,10 @@ int ibv_cmd_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, struct ibv_modify_qp *cmd, size_t cmd_size) { /* - * Masks over IBV_QP_DEST_QPN are only supported by - * ibv_cmd_modify_qp_ex. + * Starting with IBV_QP_RATE_LIMIT the attribute must go through the + * _ex path. */ - if (attr_mask & ~((IBV_QP_DEST_QPN << 1) - 1)) + if (attr_mask & ~(IBV_QP_RATE_LIMIT - 1)) return EOPNOTSUPP; IBV_INIT_CMD(cmd, cmd_size, MODIFY_QP); diff --git libibverbs/verbs.h libibverbs/verbs.h index 8cdf8ab5..a6a9441d 100644 --- libibverbs/verbs.h +++ libibverbs/verbs.h @@ -861,6 +861,13 @@ enum ibv_qp_attr_mask { IBV_QP_PATH_MIG_STATE = 1 << 18, IBV_QP_CAP = 1 << 19, IBV_QP_DEST_QPN = 1 << 20, + /* These bits were supported on older kernels, but never exposed from + libibverbs: + _IBV_QP_SMAC = 1 << 21, + _IBV_QP_ALT_SMAC = 1 << 22, + _IBV_QP_VID = 1 << 23, + _IBV_QP_ALT_VID = 1 << 24, + */ IBV_QP_RATE_LIMIT = 1 << 25, };