All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-core] verbs: Do not block QP attr_masks used by older kernels
@ 2017-11-02 21:50 Jason Gunthorpe
       [not found] ` <20171102215031.GY18874-uk2M96/98Pc@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2017-11-02 21:50 UTC (permalink / raw)
  To: Amrani, Ram
  Cc: Yishai Hadas, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Elior, Ariel,
	Kalderon, Michal, Matan Barak, Bodong Wang, Yishai Hadas

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 <Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
Signed-off-by: Jason Gunthorpe <jgunthorpe-uk2M96/98Pc@public.gmane.org>
---
 libibverbs/cmd.c   | 12 ++++++------
 libibverbs/verbs.h |  9 +++++++++
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c
index 713a13c0f272b3..fbe822324c9dd5 100644
--- a/libibverbs/cmd.c
+++ b/libibverbs/cmd.c
@@ -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);
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index 1ab747bb757cf3..2a2264d300e1ca 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -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,
 };
 
-- 
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH rdma-core] verbs: Do not block QP attr_masks used by older kernels
       [not found] ` <20171102215031.GY18874-uk2M96/98Pc@public.gmane.org>
@ 2017-11-05  7:10   ` Leon Romanovsky
       [not found]     ` <20171105071029.GC31774-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
  2017-11-07  6:21   ` Amrani, Ram
  1 sibling, 1 reply; 6+ messages in thread
From: Leon Romanovsky @ 2017-11-05  7:10 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Amrani, Ram, Yishai Hadas, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Elior, Ariel, Kalderon, Michal, Matan Barak, Bodong Wang,
	Yishai Hadas

[-- Attachment #1: Type: text/plain, Size: 2720 bytes --]

On Thu, Nov 02, 2017 at 03:50:31PM -0600, Jason Gunthorpe wrote:
> 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 <Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Jason Gunthorpe <jgunthorpe-uk2M96/98Pc@public.gmane.org>
> ---
>  libibverbs/cmd.c   | 12 ++++++------
>  libibverbs/verbs.h |  9 +++++++++
>  2 files changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c
> index 713a13c0f272b3..fbe822324c9dd5 100644
> --- a/libibverbs/cmd.c
> +++ b/libibverbs/cmd.c
> @@ -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);
> diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
> index 1ab747bb757cf3..2a2264d300e1ca 100644
> --- a/libibverbs/verbs.h
> +++ b/libibverbs/verbs.h
> @@ -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

Why do we need "if 0" in production code (global header file)?

Thanks

>  	IBV_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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH rdma-core] verbs: Do not block QP attr_masks used by older kernels
       [not found]     ` <20171105071029.GC31774-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-11-06  2:28       ` Jason Gunthorpe
       [not found]         ` <20171106022818.GE26011-uk2M96/98Pc@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2017-11-06  2:28 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Amrani, Ram, Yishai Hadas, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Elior, Ariel, Kalderon, Michal, Matan Barak, Bodong Wang,
	Yishai Hadas

On Sun, Nov 05, 2017 at 09:10:29AM +0200, Leon Romanovsky wrote:
> > @@ -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
> 
> Why 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH rdma-core] verbs: Do not block QP attr_masks used by older kernels
       [not found]         ` <20171106022818.GE26011-uk2M96/98Pc@public.gmane.org>
@ 2017-11-06  5:20           ` Leon Romanovsky
  0 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2017-11-06  5:20 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Amrani, Ram, Yishai Hadas, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Elior, Ariel, Kalderon, Michal, Matan Barak, Bodong Wang,
	Yishai Hadas

[-- Attachment #1: Type: text/plain, Size: 940 bytes --]

On Sun, Nov 05, 2017 at 07:28:18PM -0700, Jason Gunthorpe wrote:
> On Sun, Nov 05, 2017 at 09:10:29AM +0200, Leon Romanovsky wrote:
> > > @@ -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
> >
> > Why 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.

Comment will be good enough, no need to add extra:

/*
 * .....
 * _IBV_QP_COMPAT1                 = 1 << 21,
 * ......
 */

Thanks

>
> Jason

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH rdma-core] verbs: Do not block QP attr_masks used by older kernels
       [not found] ` <20171102215031.GY18874-uk2M96/98Pc@public.gmane.org>
  2017-11-05  7:10   ` Leon Romanovsky
@ 2017-11-07  6:21   ` Amrani, Ram
       [not found]     ` <BN3PR07MB2578908EF39AF93B472208ADF8510-EldUQEzkDQfpW3VS/XPqkOFPX92sqiQdvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Amrani, Ram @ 2017-11-07  6:21 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Yishai Hadas, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Elior, Ariel,
	Kalderon, Michal, Matan Barak, Bodong Wang, Yishai Hadas

> 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 <Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Jason Gunthorpe <jgunthorpe-uk2M96/98Pc@public.gmane.org>
> ---

Thank you, Jason.

Ram

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH rdma-core] verbs: Do not block QP attr_masks used by older kernels
       [not found]     ` <BN3PR07MB2578908EF39AF93B472208ADF8510-EldUQEzkDQfpW3VS/XPqkOFPX92sqiQdvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2017-11-09 13:24       ` Yishai Hadas
  0 siblings, 0 replies; 6+ messages in thread
From: Yishai Hadas @ 2017-11-09 13:24 UTC (permalink / raw)
  To: Amrani, Ram, Jason Gunthorpe
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Elior, Ariel, Kalderon,
	Michal, Matan Barak, Bodong Wang, Yishai Hadas

On 11/7/2017 8:21 AM, Amrani, Ram wrote:
>> 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 <Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
>> Signed-off-by: Jason Gunthorpe <jgunthorpe-uk2M96/98Pc@public.gmane.org>
>> ---
> 
> Thank you, Jason.
> 
> Ram
> 

Thanks, merged.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-11-09 13:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-02 21:50 [PATCH rdma-core] verbs: Do not block QP attr_masks used by older kernels Jason Gunthorpe
     [not found] ` <20171102215031.GY18874-uk2M96/98Pc@public.gmane.org>
2017-11-05  7:10   ` Leon Romanovsky
     [not found]     ` <20171105071029.GC31774-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-11-06  2:28       ` Jason Gunthorpe
     [not found]         ` <20171106022818.GE26011-uk2M96/98Pc@public.gmane.org>
2017-11-06  5:20           ` Leon Romanovsky
2017-11-07  6:21   ` Amrani, Ram
     [not found]     ` <BN3PR07MB2578908EF39AF93B472208ADF8510-EldUQEzkDQfpW3VS/XPqkOFPX92sqiQdvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-11-09 13:24       ` Yishai Hadas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.