verbs: Do not block QP attr_masks used by older kernels
PATCH 1/1 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.
--- libibverbs/cmd.c | 12 ++++++------ libibverbs/verbs.h | 9 +++++++++ 2 files changed, 15 insertions(+), 6 deletions(-)
libibverbs/cmd.c +6 -6
@@ -1182,10 +1182,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 IB_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);
@@ -1352,10 +1352,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 IB_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 );
libibverbs/verbs.h +9 -0
@@ -909,6 +909,15 @@ enum ibv_qp_attr_mask {IBV_QP_PATH_MIG_STATE =1 <<18 ,IBV_QP_CAP =1 <<19 ,IBV_QP_DEST_QPN =1 <<20 , +#if 0 +/* These bits were supported on older kernels, but never exposed to +* user space: +*/ + _IBV_QP_COMPAT1 =1 <<21 , + _IBV_QP_COMPAT2 =1 <<22 , + _IBV_QP_COMPAT3 =1 <<23 , + _IBV_QP_COMPAT3 =1 <<24 , +#endif IBV_QP_RATE_LIMIT = 1 << 25, };
Signature · 5 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20171102215031.GY18874-uk2M96/[email protected]
Quoted 51 lines · Jason Gunthorpe
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")Signed-off-by Jason Gunthorpe <jgunthorpe-uk2M96/[email protected]>--- libibverbs/cmd.c | 12 ++++++------ libibverbs/verbs.h | 9 +++++++++ 2 files changed, 15 insertions(+), 6 deletions(-)libibverbs/cmd.c +6
-6@@ -1182,10 +1182,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 IB_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);@@ -1352,10 +1352,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 IB_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 );libibverbs/verbs.h +0
-0@@ -909,6 +909,15 @@ enum ibv_qp_attr_mask {IBV_QP_PATH_MIG_STATE =1 <<18 , IBV_QP_CAP = 1 << 19,
libibverbs/verbs.h enum ibv_qp_attr_mask { · line 920
Quoted 10 lines
libibverbs/verbs.h +9
-0IBV_QP_DEST_QPN = 1 << 20, +#if 0 +/* These bits were supported on older kernels, but never exposed to +* user space: +*/ + _IBV_QP_COMPAT1 =1 <<21 , + _IBV_QP_COMPAT2 =1 <<22 , + _IBV_QP_COMPAT3 =1 <<23 , + _IBV_QP_COMPAT3 = 1 << 24, +#endif
Why do we need "if 0" in production code (global header file)?
Thanks
Quoted 9 lines
libibverbs/verbs.h +0
-1IBV_QP_RATE_LIMIT = 1 << 25, }; --2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20171105071029.GC31774-U/[email protected]
Quoted 7 lines · Leon Romanovsky
Quoted 7 lines
libibverbs/verbs.h +3
-0@@ -909,6 +909,15 @@ enum ibv_qp_attr_mask {IBV_QP_PATH_MIG_STATE =1 <<18 ,IBV_QP_CAP =1 <<19 ,IBV_QP_DEST_QPN =1 <<20 , +#if 0 +/* These bits were supported on older kernels, but never exposed to +* user space:
Quoted 8 lines
libibverbs/verbs.h enum ibv_qp_attr_mask { · line 920
Quoted 6 lines
libibverbs/verbs.h +6
-0+*/ + _IBV_QP_COMPAT1 =1 <<21 , + _IBV_QP_COMPAT2 =1 <<22 , + _IBV_QP_COMPAT3 =1 <<23 , + _IBV_QP_COMPAT3 = 1 << 24, +#endifWhy do we need "if 0" in production code (global header file)?
It is really a comment. I don't want to introduce new global symbols just for this, or loose the obvious formatting structure of the enum.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20171106022818.GE26011-uk2M96/[email protected]
Quoted 17 lines · Jason Gunthorpe
Quoted 7 lines · Leon Romanovsky
Quoted 7 lines
libibverbs/verbs.h +3
-0@@ -909,6 +909,15 @@ enum ibv_qp_attr_mask {IBV_QP_PATH_MIG_STATE =1 <<18 ,IBV_QP_CAP =1 <<19 ,IBV_QP_DEST_QPN =1 <<20 , +#if 0 +/* These bits were supported on older kernels, but never exposed to +* user space: Quoted 8 lines
libibverbs/verbs.h enum ibv_qp_attr_mask { · line 920
Quoted 6 lines
libibverbs/verbs.h +6
-0+*/ + _IBV_QP_COMPAT1 =1 <<21 , + _IBV_QP_COMPAT2 =1 <<22 , + _IBV_QP_COMPAT3 =1 <<23 , + _IBV_QP_COMPAT3 = 1 << 24, +#endifWhy do we need "if 0" in production code (global header file)?
Quoted 2 lines
It is really a comment. I don't want to introduce new global symbols just for this, or loose the obvious formatting structure of the enum.
Comment will be good enough, no need to add extra:
/*
* .....
* _IBV_QP_COMPAT1 = 1 << 21,
* ......
*/
Thanks
Quoted 2 lines
Jason
Quoted 8 lines
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")Signed-off-by Jason Gunthorpe <jgunthorpe-uk2M96/[email protected]>---
Thank you, Jason.
Ram
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): BN3PR07MB2578908EF39AF93B472208ADF8510-EldUQEzkDQfpW3VS/[email protected]
Quoted 4 lines · Ram
Quoted 4 lines
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.
Quoted 9 lines
Quoted 4 lines
Fixes 3ca7a1031486 ("ibverbs: Add support for packet pacing")Signed-off-by Jason Gunthorpe <jgunthorpe-uk2M96/[email protected]>---
Thank you, Jason.
Ram
Thanks, merged.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html