From patchwork Sun Feb 5 23:11:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Reynes X-Patchwork-Id: 724302 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vGmZ44SjYz9s2s for ; Mon, 6 Feb 2017 10:11:24 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uXu1/Ly5"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 10A592F743; Sun, 5 Feb 2017 23:11:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6-QZpl+CMajK; Sun, 5 Feb 2017 23:11:22 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 1C7EF2EEDC; Sun, 5 Feb 2017 23:11:22 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 4C80D1C0378 for ; Sun, 5 Feb 2017 23:11:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 464212EEDC for ; Sun, 5 Feb 2017 23:11:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Il3oBRKpZL0S for ; Sun, 5 Feb 2017 23:11:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by silver.osuosl.org (Postfix) with ESMTPS id 3D1872EEC4 for ; Sun, 5 Feb 2017 23:11:20 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id c85so18590090wmi.1 for ; Sun, 05 Feb 2017 15:11:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=qs+FsVgRZm0O8wWWAkSIGK6hnW7d2i7SeA2L8jieBvI=; b=uXu1/Ly51bz3UCdEHaYPTi0Xp+NE8seTKpnZl55FSd9rct1qc5iTvuTqNfAOZF4i2l I2GJ5IVWsoEEB1GXsJqrYLeY65+6E/fDUxDFyvQ3to6X2SDvuR9LGI/SqIM/GlT3jwmh qPVqoL1/flJcZnMq0i88k8gsYFeLvyo5bfEUiq0p/ILNHoxkKo4czHJqCP1JBXuowrcI 09ehvr9+VmRESG+0lcdb+SyY4rSuYVg/p8RD7zPbsy5ZZNiekmYsrGU13V3NhqFNd3po duUJuCYYqCn5ex/OwfRgiA3Zkceb9FBQWiPQwxUnj6dPwaPgX6whfYfTcnz4kY+A89io Yq1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qs+FsVgRZm0O8wWWAkSIGK6hnW7d2i7SeA2L8jieBvI=; b=MknG1K6D+Cuau4Fs5wX7NTxEmllUNYtcpazLSURkM2X6MteAVv2kJQaE9/HbDRmRqH bbD3l9KyJPfgfvxFCAY/hanJzS1wTrso5TMSKuCMDKgGo4osKEjXGw3J3rrZYoBIYGCj ewY1rdRL8ctYCnTGMN6zpuPas7a58rCZkYzZ2LsMK27eiU9azuT8vaD4tlazmFBxw8Me DEAeMy2CMyQtwxpPlotWqNAwsNq1kdnKfNl/1ODjctwq2SjYkp1P6qNFuBFLY3ULUh9I 1/Eu74YFlQxUMfrNXB8i9bnxQIEjUGN3WcH+eALQZqFld7qd8N0vCZZB9VqPN6bhRyLs gF2g== X-Gm-Message-State: AIkVDXJ3jooVYB9442ACvg74sX6rSGsiRleAGuWMtr7lAmTvoQTg5iq51IQodTa/sDHusQ== X-Received: by 10.223.172.210 with SMTP id o76mr6654341wrc.21.1486336278575; Sun, 05 Feb 2017 15:11:18 -0800 (PST) Received: from localhost.localdomain (bny93-7-88-161-33-221.fbx.proxad.net. [88.161.33.221]) by smtp.gmail.com with ESMTPSA id z67sm57211686wrb.49.2017.02.05.15.11.17 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Feb 2017 15:11:17 -0800 (PST) From: Philippe Reynes To: jeffrey.t.kirsher@intel.com, davem@davemloft.net Date: Mon, 6 Feb 2017 00:11:11 +0100 Message-Id: <1486336271-25336-1-git-send-email-tremyfr@gmail.com> X-Mailer: git-send-email 1.7.4.4 Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org, Philippe Reynes Subject: [Intel-wired-lan] [PATCH] net: intel: ixgb: use new api ethtool_{get|set}_link_ksettings X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" The ethtool api {get|set}_settings is deprecated. We move this driver to new api {get|set}_link_ksettings. As I don't have the hardware, I'd be very pleased if someone may test this patch. Signed-off-by: Philippe Reynes Tested-by: Aaron Brown --- drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c | 39 ++++++++++++++---------- 1 files changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c b/drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c index e5d7255..d10a0d2 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c @@ -94,24 +94,30 @@ struct ixgb_stats { #define IXGB_STATS_LEN ARRAY_SIZE(ixgb_gstrings_stats) static int -ixgb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) +ixgb_get_link_ksettings(struct net_device *netdev, + struct ethtool_link_ksettings *cmd) { struct ixgb_adapter *adapter = netdev_priv(netdev); - ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); - ecmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE); - ecmd->port = PORT_FIBRE; - ecmd->transceiver = XCVR_EXTERNAL; + ethtool_link_ksettings_zero_link_mode(cmd, supported); + ethtool_link_ksettings_add_link_mode(cmd, supported, 10000baseT_Full); + ethtool_link_ksettings_add_link_mode(cmd, supported, FIBRE); + + ethtool_link_ksettings_zero_link_mode(cmd, advertising); + ethtool_link_ksettings_add_link_mode(cmd, advertising, 10000baseT_Full); + ethtool_link_ksettings_add_link_mode(cmd, advertising, FIBRE); + + cmd->base.port = PORT_FIBRE; if (netif_carrier_ok(adapter->netdev)) { - ethtool_cmd_speed_set(ecmd, SPEED_10000); - ecmd->duplex = DUPLEX_FULL; + cmd->base.speed = SPEED_10000; + cmd->base.duplex = DUPLEX_FULL; } else { - ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN); - ecmd->duplex = DUPLEX_UNKNOWN; + cmd->base.speed = SPEED_UNKNOWN; + cmd->base.duplex = DUPLEX_UNKNOWN; } - ecmd->autoneg = AUTONEG_DISABLE; + cmd->base.autoneg = AUTONEG_DISABLE; return 0; } @@ -126,13 +132,14 @@ void ixgb_set_speed_duplex(struct net_device *netdev) } static int -ixgb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) +ixgb_set_link_ksettings(struct net_device *netdev, + const struct ethtool_link_ksettings *cmd) { struct ixgb_adapter *adapter = netdev_priv(netdev); - u32 speed = ethtool_cmd_speed(ecmd); + u32 speed = cmd->base.speed; - if (ecmd->autoneg == AUTONEG_ENABLE || - (speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL)) + if (cmd->base.autoneg == AUTONEG_ENABLE || + (speed + cmd->base.duplex != SPEED_10000 + DUPLEX_FULL)) return -EINVAL; if (netif_running(adapter->netdev)) { @@ -630,8 +637,6 @@ void ixgb_set_speed_duplex(struct net_device *netdev) } static const struct ethtool_ops ixgb_ethtool_ops = { - .get_settings = ixgb_get_settings, - .set_settings = ixgb_set_settings, .get_drvinfo = ixgb_get_drvinfo, .get_regs_len = ixgb_get_regs_len, .get_regs = ixgb_get_regs, @@ -649,6 +654,8 @@ void ixgb_set_speed_duplex(struct net_device *netdev) .set_phys_id = ixgb_set_phys_id, .get_sset_count = ixgb_get_sset_count, .get_ethtool_stats = ixgb_get_ethtool_stats, + .get_link_ksettings = ixgb_get_link_ksettings, + .set_link_ksettings = ixgb_set_link_ksettings, }; void ixgb_set_ethtool_ops(struct net_device *netdev)