All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/mlx4: Use flow-counters for process_mad only when appropriate
@ 2015-06-25 14:45 Or Gerlitz
       [not found] ` <1435243538-26937-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Or Gerlitz @ 2015-06-25 14:45 UTC (permalink / raw)
  To: Doug Ledford
  Cc: David S. Miller, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Hadar Har-Zion, Jack Morgenstein, Or Gerlitz

For IB links, reading HCA flow counters through iboe_process_mad() should 
be used when mlx4_ib_process_mad() is invoked only for VFs PMA queries and 
exactly nothing else.

Fixes: 7193a141eb74 ('IB/mlx4: Set VF to read from QP counters')
Reported-by: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Signed-off-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---

Hi Doug, Dave 

Doug, I've rebased the patch on top of Ira's fix [1], also you would need to 
merge the mlx4 (7193a141eb74 etc) changes that went-in through net-next for 
the patch to apply -- simply fetch from the latest upstream tree, they're there.

Dave, to make it clear, the fix will go through the IB subsystem, as it 
depends on other changes on that area.

thanks,

Or.

[1] https://patchwork.kernel.org/patch/6671931/

 drivers/infiniband/hw/mlx4/mad.c | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index 9a810e3..68b3dfa 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -860,22 +860,31 @@ int mlx4_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
 	struct mlx4_ib_dev *dev = to_mdev(ibdev);
 	const struct ib_mad *in_mad = (const struct ib_mad *)in;
 	struct ib_mad *out_mad = (struct ib_mad *)out;
+	enum rdma_link_layer link = rdma_port_get_link_layer(ibdev, port_num);
 
 	if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) ||
 			 *out_mad_size != sizeof(*out_mad)))
 		return IB_MAD_RESULT_FAILURE;
 
-	switch (rdma_port_get_link_layer(ibdev, port_num)) {
-	case IB_LINK_LAYER_INFINIBAND:
-		if (!mlx4_is_slave(dev->dev))
-			return ib_process_mad(ibdev, mad_flags, port_num, in_wc,
-					      in_grh, in_mad, out_mad);
-	case IB_LINK_LAYER_ETHERNET:
-		return iboe_process_mad(ibdev, mad_flags, port_num, in_wc,
-					  in_grh, in_mad, out_mad);
-	default:
-		return -EINVAL;
+	/* iboe_process_mad() which uses the HCA flow-counters to implement IB PMA
+	 * queries, should be called only by VFs and for that specific purpose
+	 */
+	if (link == IB_LINK_LAYER_INFINIBAND) {
+		if (mlx4_is_slave(dev->dev) &&
+		    in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT &&
+		    in_mad->mad_hdr.attr_id == IB_PMA_PORT_COUNTERS)
+			return iboe_process_mad(ibdev, mad_flags, port_num, in_wc,
+						in_grh, in_mad, out_mad);
+
+		return ib_process_mad(ibdev, mad_flags, port_num, in_wc,
+				      in_grh, in_mad, out_mad);
 	}
+
+	if (link == IB_LINK_LAYER_ETHERNET)
+		return iboe_process_mad(ibdev, mad_flags, port_num, in_wc,
+					in_grh, in_mad, out_mad);
+
+	return -EINVAL;
 }
 
 static void send_handler(struct ib_mad_agent *agent,
-- 
2.3.7

--
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] 4+ messages in thread

* Re: [PATCH] IB/mlx4: Use flow-counters for process_mad only when appropriate
       [not found] ` <1435243538-26937-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2015-06-28 10:33   ` Or Gerlitz
       [not found]     ` <CAJ3xEMjtgvK_FfYi0DNz4rhgRv-Aj__ahf3BuA-KmrZVWVUOdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2015-07-09 14:49   ` Doug Ledford
  1 sibling, 1 reply; 4+ messages in thread
From: Or Gerlitz @ 2015-06-28 10:33 UTC (permalink / raw)
  To: Doug Ledford
  Cc: David S. Miller, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Hadar Har-Zion, Jack Morgenstein, Or Gerlitz

On Thu, Jun 25, 2015 at 5:45 PM, Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote:
> For IB links, reading HCA flow counters through iboe_process_mad() should
> be used when mlx4_ib_process_mad() is invoked only for VFs PMA queries and
> exactly nothing else.
>
> Fixes: 7193a141eb74 ('IB/mlx4: Set VF to read from QP counters')
> Reported-by: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> Signed-off-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>
> Hi Doug, Dave
>
> Doug, I've rebased the patch on top of Ira's fix [1], also you would need to
> merge the mlx4 (7193a141eb74 etc) changes that went-in through net-next for
> the patch to apply -- simply fetch from the latest upstream tree, they're there.

Doug, we still have few concerns re the original patch... please wait
few days with this one
till we are sure it's the right fix.

Or.


>
> Dave, to make it clear, the fix will go through the IB subsystem, as it
> depends on other changes on that area.
>
> thanks,
>
> Or.
>
> [1] https://patchwork.kernel.org/patch/6671931/
>
>  drivers/infiniband/hw/mlx4/mad.c | 29 +++++++++++++++++++----------
>  1 file changed, 19 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
> index 9a810e3..68b3dfa 100644
> --- a/drivers/infiniband/hw/mlx4/mad.c
> +++ b/drivers/infiniband/hw/mlx4/mad.c
> @@ -860,22 +860,31 @@ int mlx4_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
>         struct mlx4_ib_dev *dev = to_mdev(ibdev);
>         const struct ib_mad *in_mad = (const struct ib_mad *)in;
>         struct ib_mad *out_mad = (struct ib_mad *)out;
> +       enum rdma_link_layer link = rdma_port_get_link_layer(ibdev, port_num);
>
>         if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) ||
>                          *out_mad_size != sizeof(*out_mad)))
>                 return IB_MAD_RESULT_FAILURE;
>
> -       switch (rdma_port_get_link_layer(ibdev, port_num)) {
> -       case IB_LINK_LAYER_INFINIBAND:
> -               if (!mlx4_is_slave(dev->dev))
> -                       return ib_process_mad(ibdev, mad_flags, port_num, in_wc,
> -                                             in_grh, in_mad, out_mad);
> -       case IB_LINK_LAYER_ETHERNET:
> -               return iboe_process_mad(ibdev, mad_flags, port_num, in_wc,
> -                                         in_grh, in_mad, out_mad);
> -       default:
> -               return -EINVAL;
> +       /* iboe_process_mad() which uses the HCA flow-counters to implement IB PMA
> +        * queries, should be called only by VFs and for that specific purpose
> +        */
> +       if (link == IB_LINK_LAYER_INFINIBAND) {
> +               if (mlx4_is_slave(dev->dev) &&
> +                   in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT &&
> +                   in_mad->mad_hdr.attr_id == IB_PMA_PORT_COUNTERS)
> +                       return iboe_process_mad(ibdev, mad_flags, port_num, in_wc,
> +                                               in_grh, in_mad, out_mad);
> +
> +               return ib_process_mad(ibdev, mad_flags, port_num, in_wc,
> +                                     in_grh, in_mad, out_mad);
>         }
> +
> +       if (link == IB_LINK_LAYER_ETHERNET)
> +               return iboe_process_mad(ibdev, mad_flags, port_num, in_wc,
> +                                       in_grh, in_mad, out_mad);
> +
> +       return -EINVAL;
>  }
>
>  static void send_handler(struct ib_mad_agent *agent,
> --
> 2.3.7
>
> --
> 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
--
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] 4+ messages in thread

* Re: [PATCH] IB/mlx4: Use flow-counters for process_mad only when appropriate
       [not found]     ` <CAJ3xEMjtgvK_FfYi0DNz4rhgRv-Aj__ahf3BuA-KmrZVWVUOdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-06-30  9:28       ` Or Gerlitz
  0 siblings, 0 replies; 4+ messages in thread
From: Or Gerlitz @ 2015-06-30  9:28 UTC (permalink / raw)
  To: Doug Ledford
  Cc: David S. Miller, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Hadar Har-Zion, Jack Morgenstein

On 6/28/2015 1:33 PM, Or Gerlitz wrote:
> On Thu, Jun 25, 2015 at 5:45 PM, Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote:
>> For IB links, reading HCA flow counters through iboe_process_mad() should
>> be used when mlx4_ib_process_mad() is invoked only for VFs PMA queries and
>> exactly nothing else.
>>
>> Fixes: 7193a141eb74 ('IB/mlx4: Set VF to read from QP counters')
>> Reported-by: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
>> Signed-off-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>> ---
>>
>> Hi Doug, Dave
>>
>> Doug, I've rebased the patch on top of Ira's fix [1], also you would need to merge the mlx4 (7193a141eb74 etc) changes that went-in through net-next for the patch to apply -- simply fetch from the latest upstream tree, they're there.
> Doug, we still have few concerns re the original patch... please wait
> few days with this one till we are sure it's the right fix.

OK, we made the extra review and checks, the fix is the correct one, 
please go ahead and pick it up. As the bug was introduced in the 4.2 
merge window, no need for -stable here.

Or.

--
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] 4+ messages in thread

* Re: [PATCH] IB/mlx4: Use flow-counters for process_mad only when appropriate
       [not found] ` <1435243538-26937-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2015-06-28 10:33   ` Or Gerlitz
@ 2015-07-09 14:49   ` Doug Ledford
  1 sibling, 0 replies; 4+ messages in thread
From: Doug Ledford @ 2015-07-09 14:49 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: David S. Miller, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Hadar Har-Zion, Jack Morgenstein

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

On 06/25/2015 10:45 AM, Or Gerlitz wrote:
> For IB links, reading HCA flow counters through iboe_process_mad() should 
> be used when mlx4_ib_process_mad() is invoked only for VFs PMA queries and 
> exactly nothing else.
> 
> Fixes: 7193a141eb74 ('IB/mlx4: Set VF to read from QP counters')
> Reported-by: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> Signed-off-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
> 
> Hi Doug, Dave 
> 
> Doug, I've rebased the patch on top of Ira's fix [1], also you would need to 
> merge the mlx4 (7193a141eb74 etc) changes that went-in through net-next for 
> the patch to apply -- simply fetch from the latest upstream tree, they're there.
> 
> Dave, to make it clear, the fix will go through the IB subsystem, as it 
> depends on other changes on that area.

I fixed up your commit message slightly (subject was too long),
otherwise applied as is.  Thanks.


-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

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

end of thread, other threads:[~2015-07-09 14:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-25 14:45 [PATCH] IB/mlx4: Use flow-counters for process_mad only when appropriate Or Gerlitz
     [not found] ` <1435243538-26937-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-06-28 10:33   ` Or Gerlitz
     [not found]     ` <CAJ3xEMjtgvK_FfYi0DNz4rhgRv-Aj__ahf3BuA-KmrZVWVUOdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-30  9:28       ` Or Gerlitz
2015-07-09 14:49   ` Doug Ledford

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.