Received: by 10.223.164.202 with SMTP id h10csp2682070wrb; Mon, 27 Nov 2017 22:48:40 -0800 (PST) X-Google-Smtp-Source: AGs4zMYtI+ALjhD34rwzJl3GKfXZgd2MPk52o18njjKRzP2pbKNusFfjnfj9jBA68dP9YjJS5A1l X-Received: by 10.99.42.210 with SMTP id q201mr38647126pgq.7.1511851720353; Mon, 27 Nov 2017 22:48:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511851720; cv=none; d=google.com; s=arc-20160816; b=k6H2fTT6tDqW9via3f2GgwTJ9qtqC22mXNf38JDE1GMDezc7+/OJN2ybzRDLeTfdqI 8g+19eJZgQAMQU5mDvDqlex9502CC6Vloh1/gxXrI6iuxs/KHRwuucXXELvmITG1xFWD COmie5L4uS56iq0U2mS9Wein7BiJ4laTacE46KYZArz9HipFZVpbYq0qnH4ho9FS4YVW 3pXp9dx2FfDDRCzRtumRzZu50sPjI2f86dEjEPg/17t2HVf/PDoq85OkUVYUvPo6ZRYp MXAHfnxq68vED0UuZB7iPAA+9+7BJZcZ6IQsNUTjBR42UK3Rd4JXIq1mlNXl/APCj5rp zvsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:message-id:date:subject:cc:to :from:arc-authentication-results; bh=Q2mdNEqhJgP4xcJRq1QRb7CI+lKN1/EMzKpMvvcPGQg=; b=aXu5vNCvrjxwh/ioHFpiTFjVReK/Cc9ih46knhh+cw6cysKutQdpJItqTftxKnIDkV 4DKYSlajko/uXd3gl2QwMrU2SHzTZJinsxCVaIkwVwcRq55XW20pye2eCUJkm9HR0RHw yLM4y6Nt/4jZdD5eNi3uKWWO40vCO9ixys2BAynzxITvmDVzbXSbkLfM87lxzP0WuOuq 9SSuELSDsahHjW8I+uA1wwOvivYO+ojEP3ZgWgKGVaNKXxSU9j02AB4NihE7G/BbNlo5 ZxFoGR/SvXJ4Xrxp+bog56aNFtjgpjMSWzOJhireTZbI6mBpx+G8DTvGyJ5VuunnZZU4 7HAw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4si24372081pgn.593.2017.11.27.22.48.27; Mon, 27 Nov 2017 22:48:40 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751446AbdK1Grr (ORCPT + 77 others); Tue, 28 Nov 2017 01:47:47 -0500 Received: from mail-cys01nam02on0084.outbound.protection.outlook.com ([104.47.37.84]:46912 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750842AbdK1Grp (ORCPT ); Tue, 28 Nov 2017 01:47:45 -0500 Received: from MWHPR03CA0055.namprd03.prod.outlook.com (2603:10b6:301:3b::44) by SN2PR03MB2365.namprd03.prod.outlook.com (2603:10b6:804:e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Tue, 28 Nov 2017 06:47:43 +0000 Received: from BL2FFO11FD036.protection.gbl (2a01:111:f400:7c09::131) by MWHPR03CA0055.outlook.office365.com (2603:10b6:301:3b::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Tue, 28 Nov 2017 06:47:43 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD036.mail.protection.outlook.com (10.173.161.132) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Tue, 28 Nov 2017 06:47:43 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vAS6lepl011521; Mon, 27 Nov 2017 23:47:40 -0700 From: Yangbo Lu To: , , Claudiu Manoil CC: Shaohui Xie , Yangbo Lu Subject: [PATCH] net: gianfar: add ethtool eee support Date: Tue, 28 Nov 2017 14:29:01 +0800 Message-ID: <20171128062901.22210-1-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.14.1 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131563252631770525;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(979002)(6009001)(336005)(7966004)(39380400002)(39860400002)(346002)(376002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(2906002)(81156014)(48376002)(50466002)(81166006)(104016004)(8676002)(305945005)(47776003)(50986999)(6666003)(356003)(6636002)(498600001)(189998001)(77096006)(105606002)(106466001)(53936002)(33646002)(8936002)(8656006)(36756003)(4326008)(16586007)(54906003)(5660300001)(110136005)(316002)(68736007)(1076002)(50226002)(51416003)(97736004)(85426001)(86362001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR03MB2365;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD036;1:WJAO2sQlDiZYR4qUYDWpKMfHLCdBi1EAxcGd+bAkIVi2ITYBh6EkjMoc1iA64pE8UIrTcU1Be0fGwB5NY7+9kjO4HuJDZ9wjk+3JgHWkq7N15myokglDJBRqR4XJ7uJ4 MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6afde4b1-3d58-4350-959d-08d5362bed13 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603258);SRVR:SN2PR03MB2365; X-Microsoft-Exchange-Diagnostics: 1;SN2PR03MB2365;3:+RNCzkAxxQkeLc4HpTeGoMxxhfjQZLhQB6ciXSHowHzcGOS6lgyGNpRxSucWDtQCu1TUgAz1Tgw7G3prPootqrRV6RvELZrhYJD0BS27INA7SMLQBO2DT4QtzRmCsyLwCVlg5kbskz79KT9YSxi2YwPspnzkhTBY+WvmawpgljusLOPJ0anhqjTby8/cL8CHaqXdUQIHHWxenfo1mGVdkOwRww8YOEz77JMhgo2bZFS7lC6TGw3cZYzRWDHpg925c8WTC1UOb3FjS+iarBuk8pqYDZi2yu8HKPMpLxEreQ0u+S2EF3Q4NZekzYF/mbkT0KUTS69WeWk0ugePucKnMCtHu0SnAx/9KJGbRs27vxI=;25:YSCXMW7hC3v2dJ47Zf6ZRcrJGAzZBtaLpncOmF6d98zzvhv5gfAggPd4i1XJWmjU5+BrtTPfZ2bZFPqRrrgFUofFiGELshCpKHx4xZwf9kSAJsXsQPO6O8k4WYUvCkRPZqcJwsI26nZPWNWinnzzCNOwylF0IFT8MEhUqaaDGz1b4ZZxSLvt055QbYvA8L8D3aFbtYSK5RUj6Du1BOtTv7R3V6JZHOuVQnxIu/TLNTQY/Tt0zqbs2MHchXfNjdHaCXrcsBI6mrOGrGnEXdyS6WjEcWUIxbwK1i734f6+JyD0gdOueWX6j67vV4HCyUglvXAiHxm4jRUImSyYmL8LfQ== X-MS-TrafficTypeDiagnostic: SN2PR03MB2365: X-Microsoft-Exchange-Diagnostics: 1;SN2PR03MB2365;31:iU1E+n7zpUN7Vo3S/lCWJjFp7WujXTfeEhpJiqkFznwECEdCeUegU2Tpmg2Z+C9VF8djZYIVFdLMcCHnXq6ue3ZDCdneU493s6Vcd0u4cgo3ZKvrO+KLBJe6z/IvawY7X0fJ1gYVN4l3gb+80/2AszYfDvnwLy9SfP6Ee/Ee08vkK8/wVGa/T6hjcqjzSkWmFZFuxDhaeh8CqRwzUfpOqkkR8nZGa7oF8DcjtS6tefg=;4:7ATHqYRq/chzycEaBGXewq/eH02Yt+xxM8DUKfK3YAH2qBwWE56UzFqmTSKYX3aUHuc0O3EDri3kkF+pjf4w7SI0vJZZ+Ne8JQH/50dxM0kqjupWFQOvmd4RjoRwOV5D0A+SEPZNctpw8RwG8SfucVOxUjGm+mrAxFGVt5uvuqx8/BvftvAk+j0rrTqrioeobgB4V7rhH1vwsQMzYNoXV4+c061+tea/k25o9xD2T3nkzdG+FTRBFyNETpkTnKkiG/TX8v7ap627sX4pxqDMKKBiP4kImZ5qjNLgr+ybZ6lwA593hD4q+lSzko2RhVlrwXGo3jGYJvow3GS0JmVIbPTXWFEGaWB+wHxBihwDQDw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(21532816269658); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6095135)(2401047)(8121501046)(5005006)(3231022)(93006095)(93001095)(10201501046)(3002001)(6055026)(6096035)(20161123563025)(20161123559100)(20161123556025)(20161123565025)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123561025)(201708071742011);SRVR:SN2PR03MB2365;BCL:0;PCL:0;RULEID:(100000803101)(100110400095)(400006);SRVR:SN2PR03MB2365; X-Forefront-PRVS: 0505147DDB X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN2PR03MB2365;23:2C1kHwGqCBLuYzW+07DmPBum6jfmqPwSHYNYBjo/p?= =?us-ascii?Q?gC9czkgGX4plJ8/7pzO46+aVRn6yUkR0OtNF0mFD+UCMmuq4yMrOrZlcmUOQ?= =?us-ascii?Q?YCe+acB1xGVJig+qowZdPrOWaxDKjnQ+IzQCPNoK6G+Hiy6iT1hHrFQuE+FN?= =?us-ascii?Q?WnFa7fUXioDOraaiJhrYLXp65BM64taxOSw4E1DPUy3OajvHxUYaSFxpvcfJ?= =?us-ascii?Q?kxQRX3n6uobD+4/ZJor+yyFVS2uAaYUoUyxeHSJb5HXYy6CS4pQuPXI09fHT?= =?us-ascii?Q?MNv//mOfZKq/rc67uHw39j/YOceDtwxLA2uUld1seV1HEYAlBNaFakgYUUeF?= =?us-ascii?Q?Jgepj2Yx331Kxsd871uY4JzdaYhiPivE+B46+QsF+f/R3qzC82n2RfceyIkf?= =?us-ascii?Q?y4nAKLHg7pZ1gHJMMK18OuQWxtepv8yhPkuNYrp4OaLPrAnMt7abyp1exkOU?= =?us-ascii?Q?f/c+W1Un2oTcNpE4TSI4Y39tR27KxwtiQ421NliS/PNXx+CLMYKCPHetgOLF?= =?us-ascii?Q?yyWmhMs5sa2ByR1ctX39u9dNGHZBZpcm7Bmai8zYWV2gpEt5vAa53xL7yIzB?= =?us-ascii?Q?QLmMUsUv+ucyTp9Mh+25cmhFN6tvhLVKahytVGbPr9qTWd3indiv0DSE5rYF?= =?us-ascii?Q?kcQYniAqENkmdOC/z9um6eJsKtgRLiIkpiB7sZIx/1UGnS4rrLvnYiiRtr6c?= =?us-ascii?Q?lWSJicLkwO+L5k+iM6P1f7L8eTRbRB0sH5zY5oPrjdtgzlC69v3bbDXaqaNB?= =?us-ascii?Q?HOHRShSBR8UNKL8aySzCSA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SJuxrbW5SZ2+vySAsCP26haQ1aWJL57rwpwznMn7AUWnaU/gMX0xephL4t4ilPOJyYEhvZI4XS7qgXdLOXgCWo=;24:vsZDPNacWRxj9b+gtRXVfXcuGjeJ1G10/H4FafSZoR0okY0nSpTydxIV625tLSZ/wkY2qSHR/hF67bsWFcJk6qHJKb8abhUyHuHU0lN+4GQ=;7:+CFwa/Rb9be8GS0Jurp/xJZpOfNs8rUhkmNCr5ZVULGkD4sTXV0B9qiUdR2EMTlHL5C10Z/VsmCUUbqzRFkqg98YQML/vmyUREjswTeZ19Vdsh/KKDWgExKnI05ouHavMzZ13bIgb7aMboOMnm804GhYmBx8g21vBgj+tiIhM2xakPqMzcl5XBNvSerldX0ofNUDqSjnJLCLWSonwIVWLBw/QSOqCcS9gBNboS/TU6Tr0Bm41ctgRW1OJioff1bU SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2017 06:47:43.0054 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6afde4b1-3d58-4350-959d-08d5362bed13 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR03MB2365 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shaohui Xie Gianfar does not support EEE, but it can connect to a PHY which supports EEE and the PHY advertises EEE by default, and its link partner also advertises EEE, so the PHY enters low power mode when traffic rate is low, which causes packet loss if an application's traffic rate is low. This patch provides .get_eee and .set_eee so that to disable the EEE advertisement via ethtool if needed, other EEE features are not supported. Signed-off-by: Shaohui Xie Signed-off-by: Yangbo Lu --- drivers/net/ethernet/freescale/gianfar_ethtool.c | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c index 56588f2e1d91..8953650b36f3 100644 --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c @@ -184,6 +184,32 @@ static void gfar_gdrvinfo(struct net_device *dev, strlcpy(drvinfo->bus_info, "N/A", sizeof(drvinfo->bus_info)); } +static int gfar_get_eee(struct net_device *dev, struct ethtool_eee *et_eee) +{ + struct phy_device *phydev = dev->phydev; + + if (!phydev) + return -ENODEV; + + return phy_ethtool_get_eee(phydev, et_eee); +} + +static int gfar_set_eee(struct net_device *dev, struct ethtool_eee *et_eee) +{ + struct phy_device *phydev = dev->phydev; + + if (!phydev) + return -ENODEV; + + if (et_eee->eee_enabled || + et_eee->tx_lpi_enabled || + et_eee->tx_lpi_timer) { + return -EOPNOTSUPP; + } + + return phy_ethtool_set_eee(phydev, et_eee); +} + /* Return the length of the register structure */ static int gfar_reglen(struct net_device *dev) { @@ -1535,6 +1561,8 @@ static int gfar_get_ts_info(struct net_device *dev, } const struct ethtool_ops gfar_ethtool_ops = { + .get_eee = gfar_get_eee, + .set_eee = gfar_set_eee, .get_drvinfo = gfar_gdrvinfo, .get_regs_len = gfar_reglen, .get_regs = gfar_get_regs, -- 2.14.1 From 1585342741091991563@xxx Tue Nov 28 20:24:14 +0000 2017 X-GM-THRID: 1585316765426922141 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread