From patchwork Thu Sep 27 17:47:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland Dreier X-Patchwork-Id: 1515311 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 3F6AB3FE1C for ; Thu, 27 Sep 2012 17:47:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753023Ab2I0RrY (ORCPT ); Thu, 27 Sep 2012 13:47:24 -0400 Received: from na3sys010aog111.obsmtp.com ([74.125.245.90]:55809 "HELO na3sys010aog111.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751676Ab2I0RrX (ORCPT ); Thu, 27 Sep 2012 13:47:23 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]) (using TLSv1) by na3sys010aob111.postini.com ([74.125.244.12]) with SMTP ID DSNKUGSRKqfxP1JdM9HcOisPx3pyyCgre7jv@postini.com; Thu, 27 Sep 2012 10:47:23 PDT Received: by pbbrr4 with SMTP id rr4so3929347pbb.19 for ; Thu, 27 Sep 2012 10:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=MjWHxUEQfDfrsaMU8zqxrrs6/z2ZKh97R+68fuP2epY=; b=jL0i9rgc2KMEt3HDpVq8m1nCSJm+PPb4iI7wkWcEHuV4IazN/ZI59KMfr0LdWnZedn 3osli1aDgocyQoasZ3Xp+f1JffaVPmdjNbzgIV1VSdvHk9EDX4zjnVhVKzEy9bAr+JFG 1ooROU3i0RUnm7NdoXXwKCn7IPoO3J6B7RxTk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=MjWHxUEQfDfrsaMU8zqxrrs6/z2ZKh97R+68fuP2epY=; b=MveWQ5ESdF900HtiUfmWd6QgO8x5L5UhdPY02Ps6lht6Nd7Yt55Yb1HJ0Sr/H882Wk 37E1NfTOH0JcrJHG+DKbsRYiN5mK2JA+xD138uAAAYGOsM1aIHP5Y+Nc2MG0ILfJ/BxB ThSCsxLuxMnqS2+oTNBm8o4xsivI5Vcb3uhpe0HrKOMiyrjJRDV5B53c+16++1TMgD+G HQnSMstyY16SWD+cpHATTkhbn41TZ2e6CdS0ehfgFUFM8gUJ/URFvjzWOVFOaxG1rTD7 scERH4SZ5Bny/61dkQh6wRMAF4qEGc7H7muayw63v/oeSMlcVOB4CcY4GZyGDk6sN2Cs Kl6A== Received: by 10.68.135.234 with SMTP id pv10mr13243874pbb.156.1348768042377; Thu, 27 Sep 2012 10:47:22 -0700 (PDT) Received: from roland-t410s.purestorage.com ([216.200.155.2]) by mx.google.com with ESMTPS id e9sm4034289pay.34.2012.09.27.10.47.21 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 10:47:21 -0700 (PDT) From: Roland Dreier To: linux-rdma@vger.kernel.org Subject: [PATCH 2/3] mlx4_core: Clean up enabling of SENSE_PORT for older (ConnectX-1/-2) HCAs Date: Thu, 27 Sep 2012 10:47:16 -0700 Message-Id: <1348768037-3660-2-git-send-email-roland@kernel.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1348768037-3660-1-git-send-email-roland@kernel.org> References: <1348768037-3660-1-git-send-email-roland@kernel.org> X-Gm-Message-State: ALoCoQn3/xjfNduxOnPef7X6hew24yGgo37imMG1zGWl5ThpAFLA5lJK9f5QKVADm/wYcQnQ7X25 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Roland Dreier Instead of having a hard-coded "PCI device ID != 0x1003" (which obviously breaks as newer devices with ID != 0x1003 become available), instead let's set a flag in our PCI device table for the older devices where we're supposed to force using SENSE_PORT. This also avoids enabling SENSE_PORT for virtual functions by mistake. Signed-off-by: Roland Dreier --- drivers/net/ethernet/mellanox/mlx4/main.c | 28 ++++++++++++++-------------- drivers/net/ethernet/mellanox/mlx4/mlx4.h | 1 + 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index ef1a39d..4d40b21 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c @@ -297,8 +297,8 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) mlx4_dbg(dev, "Steering mode is: %s\n", mlx4_steering_mode_str(dev->caps.steering_mode)); - /* Sense port always allowed on supported devices for ConnectX1 and 2 */ - if (dev->pdev->device != 0x1003) + /* Sense port always allowed on supported devices for ConnectX-1 and -2 */ + if (mlx4_priv(dev)->pci_dev_data & MLX4_PCI_DEV_FORCE_SENSE_PORT) dev->caps.flags |= MLX4_DEV_CAP_FLAG_SENSE_SUPPORT; dev->caps.log_num_macs = log_num_mac; @@ -2312,29 +2312,29 @@ int mlx4_restart_one(struct pci_dev *pdev) static DEFINE_PCI_DEVICE_TABLE(mlx4_pci_table) = { /* MT25408 "Hermon" SDR */ - { PCI_VDEVICE(MELLANOX, 0x6340), 0 }, + { PCI_VDEVICE(MELLANOX, 0x6340), MLX4_PCI_DEV_FORCE_SENSE_PORT }, /* MT25408 "Hermon" DDR */ - { PCI_VDEVICE(MELLANOX, 0x634a), 0 }, + { PCI_VDEVICE(MELLANOX, 0x634a), MLX4_PCI_DEV_FORCE_SENSE_PORT }, /* MT25408 "Hermon" QDR */ - { PCI_VDEVICE(MELLANOX, 0x6354), 0 }, + { PCI_VDEVICE(MELLANOX, 0x6354), MLX4_PCI_DEV_FORCE_SENSE_PORT }, /* MT25408 "Hermon" DDR PCIe gen2 */ - { PCI_VDEVICE(MELLANOX, 0x6732), 0 }, + { PCI_VDEVICE(MELLANOX, 0x6732), MLX4_PCI_DEV_FORCE_SENSE_PORT }, /* MT25408 "Hermon" QDR PCIe gen2 */ - { PCI_VDEVICE(MELLANOX, 0x673c), 0 }, + { PCI_VDEVICE(MELLANOX, 0x673c), MLX4_PCI_DEV_FORCE_SENSE_PORT }, /* MT25408 "Hermon" EN 10GigE */ - { PCI_VDEVICE(MELLANOX, 0x6368), 0 }, + { PCI_VDEVICE(MELLANOX, 0x6368), MLX4_PCI_DEV_FORCE_SENSE_PORT }, /* MT25408 "Hermon" EN 10GigE PCIe gen2 */ - { PCI_VDEVICE(MELLANOX, 0x6750), 0 }, + { PCI_VDEVICE(MELLANOX, 0x6750), MLX4_PCI_DEV_FORCE_SENSE_PORT }, /* MT25458 ConnectX EN 10GBASE-T 10GigE */ - { PCI_VDEVICE(MELLANOX, 0x6372), 0 }, + { PCI_VDEVICE(MELLANOX, 0x6372), MLX4_PCI_DEV_FORCE_SENSE_PORT }, /* MT25458 ConnectX EN 10GBASE-T+Gen2 10GigE */ - { PCI_VDEVICE(MELLANOX, 0x675a), 0 }, + { PCI_VDEVICE(MELLANOX, 0x675a), MLX4_PCI_DEV_FORCE_SENSE_PORT }, /* MT26468 ConnectX EN 10GigE PCIe gen2*/ - { PCI_VDEVICE(MELLANOX, 0x6764), 0 }, + { PCI_VDEVICE(MELLANOX, 0x6764), MLX4_PCI_DEV_FORCE_SENSE_PORT }, /* MT26438 ConnectX EN 40GigE PCIe gen2 5GT/s */ - { PCI_VDEVICE(MELLANOX, 0x6746), 0 }, + { PCI_VDEVICE(MELLANOX, 0x6746), MLX4_PCI_DEV_FORCE_SENSE_PORT }, /* MT26478 ConnectX2 40GigE PCIe gen2 */ - { PCI_VDEVICE(MELLANOX, 0x676e), 0 }, + { PCI_VDEVICE(MELLANOX, 0x676e), MLX4_PCI_DEV_FORCE_SENSE_PORT }, /* MT25400 Family [ConnectX-2 Virtual Function] */ { PCI_VDEVICE(MELLANOX, 0x1002), MLX4_PCI_DEV_IS_VF }, /* MT27500 Family [ConnectX-3] */ diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h index 65f73d6..f7156b7 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h @@ -694,6 +694,7 @@ struct mlx4_steer { enum { MLX4_PCI_DEV_IS_VF = 1 << 0, + MLX4_PCI_DEV_FORCE_SENSE_PORT = 1 << 1, }; struct mlx4_priv {