Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965663AbcJFItp (ORCPT ); Thu, 6 Oct 2016 04:49:45 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48627 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965391AbcJFItm (ORCPT ); Thu, 6 Oct 2016 04:49:42 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Chang , Noa Osherovich , Leon Romanovsky , Doug Ledford Subject: [PATCH 4.7 127/141] IB/mlx5: Enable MAD_IFC commands for IB ports only Date: Thu, 6 Oct 2016 10:29:23 +0200 Message-Id: <20161006074454.135211463@linuxfoundation.org> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161006074448.608056610@linuxfoundation.org> References: <20161006074448.608056610@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1124 Lines: 36 4.7-stable review patch. If anyone has any objections, please let me know. ------------------ From: Noa Osherovich commit 7fae6655a0c897875bd34501ec092232b526d3e4 upstream. MAD_IFC command is supported only for physical functions (PF) and when physical port is IB. The proposed fix enforces it. Fixes: d603c809ef91 ("IB/mlx5: Fix decision on using MAD_IFC") Reported-by: David Chang Signed-off-by: Noa Osherovich Signed-off-by: Leon Romanovsky Signed-off-by: Doug Ledford Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/mlx5/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -287,7 +287,9 @@ __be16 mlx5_get_roce_udp_sport(struct ml static int mlx5_use_mad_ifc(struct mlx5_ib_dev *dev) { - return !MLX5_CAP_GEN(dev->mdev, ib_virt); + if (MLX5_CAP_GEN(dev->mdev, port_type) == MLX5_CAP_PORT_TYPE_IB) + return !MLX5_CAP_GEN(dev->mdev, ib_virt); + return 0; } enum {