Received: by 10.223.176.5 with SMTP id f5csp825482wra; Sat, 3 Feb 2018 11:08:56 -0800 (PST) X-Google-Smtp-Source: AH8x226B4uQ5sCnDSRkyv3vG35Xuq3N8p8rzHMLe9vqgMmElbpEoxrDg6uWDe+2x47E7qbjCdF0d X-Received: by 2002:a17:902:5481:: with SMTP id e1-v6mr8749893pli.410.1517684936402; Sat, 03 Feb 2018 11:08:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517684936; cv=none; d=google.com; s=arc-20160816; b=xi3rnD2EkRv+XbQpxnfDKnAyrRq7vLtfxMz1tgYYACH23t/O5JkFmWiPBt7+iio0OK OkCtiBT1yklE+qniZmBifisJ1zsjvRKffmFgmBNVZLWA8Yz/NceUkzE6/f+NhschMubC +V40KDpmW/F2XeDbnSN88lJE5+uJWsEvwFmhBEG1oXaC4IgP7Qo2gsosaBTwmKaiiJeA KZGZN7YL0feRj82l3knpM8n0J/ozlmy3ZipZVnfzpKliiVsrw+zq68ie1uK1AD3dzbyM LjVGNPS9AVlnVw06x0xvIWtY8XNu7I/qweLtKSDZw0LzG1nAbynvUEPttTzWHXARyOvp dISw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=wZXSYlv2aUux4h/k0mSfo3qWCw47mv3NAHWdsMCh4vU=; b=lkGyzPeK6l8dWjSMemYi4RLqiaeLeO9wIhUpHJfG5v5Y3agsEwYhgFlBEdJA5sPN/y x4EOuBuqq3EIZ4YZDdN3+kiSxuP1vNlBrjxhJQ3g2VnJYbc6JL3zkPSRFjP9j9sKpAnU +xNsE7A3RALJuBN5oFKTQ2n4LCsROyZKUva3/ckklha80mzJwnRhQB4oDaIbW8hQhYH/ eTj1xWhiw1RPdujBwLhdzgXIS5o35g4GMyE79wmB1CzYMid/54w2zlbhKd1knNIpS/+n ythCqYYjtYTrOg/uuUYPtHBwlCSI1NQ1X6OV7XtTCsSqrWMVNb7F3DFTbTOxoRmQL7bS +MCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=cmgV50Lx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z23-v6si2305400pll.4.2018.02.03.11.08.41; Sat, 03 Feb 2018 11:08:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=cmgV50Lx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753194AbeBCSDA (ORCPT + 99 others); Sat, 3 Feb 2018 13:03:00 -0500 Received: from mail-bn3nam01on0138.outbound.protection.outlook.com ([104.47.33.138]:24890 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752748AbeBCSAn (ORCPT ); Sat, 3 Feb 2018 13:00:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wZXSYlv2aUux4h/k0mSfo3qWCw47mv3NAHWdsMCh4vU=; b=cmgV50Lx6pgtO69tIG3CU5tNbYeuN8c0S6NGTGxGDDoLmFiDXRbC6MMc0hOLK8WhSlOzWQK0O0nvn9IUZxRZecCzuPw4EQwqGMESdHocH4XRSIusft7TaLBpvOBG07Iu9IQu0CpywHBdD+7vfoYEyU1QjczjkUm0Ca8yIjE4BUc= Received: from BL0PR2101MB1027.namprd21.prod.outlook.com (52.132.20.161) by BL0PR2101MB1043.namprd21.prod.outlook.com (52.132.24.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.506.3; Sat, 3 Feb 2018 18:00:33 +0000 Received: from BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9]) by BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9%3]) with mapi id 15.20.0485.006; Sat, 3 Feb 2018 18:00:33 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Igor Russkikh , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 010/110] net: aquantia: Fix actual speed capabilities reporting Thread-Topic: [PATCH AUTOSEL for 4.14 010/110] net: aquantia: Fix actual speed capabilities reporting Thread-Index: AQHTnRjhdKrS9A63rEKaz2tao+3Z5w== Date: Sat, 3 Feb 2018 18:00:31 +0000 Message-ID: <20180203180015.29073-10-alexander.levin@microsoft.com> References: <20180203180015.29073-1-alexander.levin@microsoft.com> In-Reply-To: <20180203180015.29073-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BL0PR2101MB1043;7:E5TYKhw9Axs2L940c+M0AuPXYvNKVlKeoE2q0pwQhOA8xx+VJuBMzbDElUgaNcI1Lhw002/QWmzpl9IIguOmQ3bBsseJ/uBj0G1BGjWGmerng3dflzXjmqy/ceZj3lGLCBE7v2ZG/aEs2FlpbXQxDXUAjdPOagOYG0UYZu7Xyc/EK0FiBjQGdnaET0mNG4qVqzSGKRpFnFxxeOhgYfrrpuenV9KDcGdy9Hvt4+fkQeyeHQv68X92FMfVnkWvZGlD x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: d85caebb-bdcb-4756-028b-08d56b300553 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:BL0PR2101MB1043; x-ms-traffictypediagnostic: BL0PR2101MB1043: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(211171220733660); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(5005006)(8121501046)(3231101)(2400082)(944501161)(93006095)(93001095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011);SRVR:BL0PR2101MB1043;BCL:0;PCL:0;RULEID:;SRVR:BL0PR2101MB1043; x-forefront-prvs: 05724A8921 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(979002)(39380400002)(376002)(39860400002)(366004)(346002)(396003)(189003)(199004)(10290500003)(186003)(6486002)(14454004)(1076002)(102836004)(6506007)(76176011)(26005)(6346003)(66066001)(10090500001)(8666007)(5250100002)(36756003)(6512007)(2501003)(110136005)(99286004)(54906003)(478600001)(53936002)(72206003)(6436002)(316002)(305945005)(7736002)(2950100002)(2906002)(5660300001)(4326008)(106356001)(575784001)(86362001)(97736004)(25786009)(22452003)(2900100001)(3846002)(107886003)(8676002)(8936002)(6116002)(3280700002)(105586002)(81156014)(81166006)(3660700001)(86612001)(68736007)(22906009)(217873001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:BL0PR2101MB1043;H:BL0PR2101MB1027.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: gVS5iRIZo1zK3U7Zy2R5FPbVSZrNJNETasDfX3Tr9aQP1OjsiBpoM06exnCPfZwEQjRQLTWGOy/DGWdoCpepWw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: d85caebb-bdcb-4756-028b-08d56b300553 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2018 18:00:31.0971 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB1043 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Igor Russkikh [ Upstream commit e4d02ca04c6d48ab2226342a1c4ed54f1dbb72bd ] Different hardware device Ids correspond to different maximum speed available. Extra checks were added for devices D108 and D109 to remove unsupported speeds from these device capabilities list. Signed-off-by: Igor Russkikh Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 4 +++- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 7 ++++--- drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 2 +- drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c | 5 +++-- drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 13 +++++++++++= +- drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 13 +++++++++++= +- 6 files changed, 35 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h b/drivers/net/e= thernet/aquantia/atlantic/aq_hw.h index 0207927dc8a6..4ebd53b3c7da 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h +++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h @@ -85,7 +85,9 @@ struct aq_hw_ops { void (*destroy)(struct aq_hw_s *self); =20 int (*get_hw_caps)(struct aq_hw_s *self, - struct aq_hw_caps_s *aq_hw_caps); + struct aq_hw_caps_s *aq_hw_caps, + unsigned short device, + unsigned short subsystem_device); =20 int (*hw_ring_tx_xmit)(struct aq_hw_s *self, struct aq_ring_s *aq_ring, unsigned int frags); diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/= ethernet/aquantia/atlantic/aq_nic.c index 483e97691eea..c93e5613d4cc 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c @@ -222,7 +222,7 @@ static struct net_device *aq_nic_ndev_alloc(void) =20 struct aq_nic_s *aq_nic_alloc_cold(const struct net_device_ops *ndev_ops, const struct ethtool_ops *et_ops, - struct device *dev, + struct pci_dev *pdev, struct aq_pci_func_s *aq_pci_func, unsigned int port, const struct aq_hw_ops *aq_hw_ops) @@ -242,7 +242,7 @@ struct aq_nic_s *aq_nic_alloc_cold(const struct net_dev= ice_ops *ndev_ops, ndev->netdev_ops =3D ndev_ops; ndev->ethtool_ops =3D et_ops; =20 - SET_NETDEV_DEV(ndev, dev); + SET_NETDEV_DEV(ndev, &pdev->dev); =20 ndev->if_port =3D port; self->ndev =3D ndev; @@ -254,7 +254,8 @@ struct aq_nic_s *aq_nic_alloc_cold(const struct net_dev= ice_ops *ndev_ops, =20 self->aq_hw =3D self->aq_hw_ops.create(aq_pci_func, self->port, &self->aq_hw_ops); - err =3D self->aq_hw_ops.get_hw_caps(self->aq_hw, &self->aq_hw_caps); + err =3D self->aq_hw_ops.get_hw_caps(self->aq_hw, &self->aq_hw_caps, + pdev->device, pdev->subsystem_device); if (err < 0) goto err_exit; =20 diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h b/drivers/net/= ethernet/aquantia/atlantic/aq_nic.h index 4309983acdd6..3c9f8db03d5f 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h @@ -71,7 +71,7 @@ struct aq_nic_cfg_s { =20 struct aq_nic_s *aq_nic_alloc_cold(const struct net_device_ops *ndev_ops, const struct ethtool_ops *et_ops, - struct device *dev, + struct pci_dev *pdev, struct aq_pci_func_s *aq_pci_func, unsigned int port, const struct aq_hw_ops *aq_hw_ops); diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers= /net/ethernet/aquantia/atlantic/aq_pci_func.c index cadaa646c89f..58c29d04b186 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c @@ -51,7 +51,8 @@ struct aq_pci_func_s *aq_pci_func_alloc(struct aq_hw_ops = *aq_hw_ops, pci_set_drvdata(pdev, self); self->pdev =3D pdev; =20 - err =3D aq_hw_ops->get_hw_caps(NULL, &self->aq_hw_caps); + err =3D aq_hw_ops->get_hw_caps(NULL, &self->aq_hw_caps, pdev->device, + pdev->subsystem_device); if (err < 0) goto err_exit; =20 @@ -59,7 +60,7 @@ struct aq_pci_func_s *aq_pci_func_alloc(struct aq_hw_ops = *aq_hw_ops, =20 for (port =3D 0; port < self->ports; ++port) { struct aq_nic_s *aq_nic =3D aq_nic_alloc_cold(ndev_ops, eth_ops, - &pdev->dev, self, + pdev, self, port, aq_hw_ops); =20 if (!aq_nic) { diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/dr= ivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c index 07b3c49a16a4..b0abd187cead 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c @@ -18,9 +18,20 @@ #include "hw_atl_a0_internal.h" =20 static int hw_atl_a0_get_hw_caps(struct aq_hw_s *self, - struct aq_hw_caps_s *aq_hw_caps) + struct aq_hw_caps_s *aq_hw_caps, + unsigned short device, + unsigned short subsystem_device) { memcpy(aq_hw_caps, &hw_atl_a0_hw_caps_, sizeof(*aq_hw_caps)); + + if (device =3D=3D HW_ATL_DEVICE_ID_D108 && subsystem_device =3D=3D 0x0001= ) + aq_hw_caps->link_speed_msk &=3D ~HW_ATL_A0_RATE_10G; + + if (device =3D=3D HW_ATL_DEVICE_ID_D109 && subsystem_device =3D=3D 0x0001= ) { + aq_hw_caps->link_speed_msk &=3D ~HW_ATL_A0_RATE_10G; + aq_hw_caps->link_speed_msk &=3D ~HW_ATL_A0_RATE_5G; + } + return 0; } =20 diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/dr= ivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c index ec68c20efcbd..e4e3b8e2d67e 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c @@ -18,9 +18,20 @@ #include "hw_atl_b0_internal.h" =20 static int hw_atl_b0_get_hw_caps(struct aq_hw_s *self, - struct aq_hw_caps_s *aq_hw_caps) + struct aq_hw_caps_s *aq_hw_caps, + unsigned short device, + unsigned short subsystem_device) { memcpy(aq_hw_caps, &hw_atl_b0_hw_caps_, sizeof(*aq_hw_caps)); + + if (device =3D=3D HW_ATL_DEVICE_ID_D108 && subsystem_device =3D=3D 0x0001= ) + aq_hw_caps->link_speed_msk &=3D ~HW_ATL_B0_RATE_10G; + + if (device =3D=3D HW_ATL_DEVICE_ID_D109 && subsystem_device =3D=3D 0x0001= ) { + aq_hw_caps->link_speed_msk &=3D ~HW_ATL_B0_RATE_10G; + aq_hw_caps->link_speed_msk &=3D ~HW_ATL_B0_RATE_5G; + } + return 0; } =20 --=20 2.11.0