Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/724144/?format=api
{ "id": 724144, "url": "http://patchwork.ozlabs.org/api/patches/724144/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1486242306-10111-1-git-send-email-tremyfr@gmail.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1486242306-10111-1-git-send-email-tremyfr@gmail.com>", "list_archive_url": null, "date": "2017-02-04T21:05:06", "name": "net: intel: i40e: use new api ethtool_{get|set}_link_ksettings", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "9886c80ebc4f5e0cd588d0356732ccba3c034494", "submitter": { "id": 65172, "url": "http://patchwork.ozlabs.org/api/people/65172/?format=api", "name": "Philippe Reynes", "email": "tremyfr@gmail.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1486242306-10111-1-git-send-email-tremyfr@gmail.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/724144/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/724144/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Received": [ "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3vG6Jz56CHz9s1y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 5 Feb 2017 08:27:46 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 1A27487EE0;\n\tSat, 4 Feb 2017 21:27:44 +0000 (UTC)", "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 9Kv4kXy8NyU5; Sat, 4 Feb 2017 21:27:41 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id CE7AB87398;\n\tSat, 4 Feb 2017 21:27:41 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 1F46B1C0156\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 4 Feb 2017 21:27:41 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 19D2589847\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 4 Feb 2017 21:27:41 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id JOy9nO9LHHSr for <intel-wired-lan@lists.osuosl.org>;\n\tSat, 4 Feb 2017 21:27:40 +0000 (UTC)", "from mail-wm0-f68.google.com (mail-wm0-f68.google.com\n\t[74.125.82.68])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id A665C89862\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 4 Feb 2017 21:27:39 +0000 (UTC)", "by mail-wm0-f68.google.com with SMTP id r18so13145767wmd.3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 04 Feb 2017 13:27:39 -0800 (PST)", "from localhost.localdomain (bny93-7-88-161-33-221.fbx.proxad.net.\n\t[88.161.33.221]) by smtp.gmail.com with ESMTPSA id\n\t186sm4247025wmw.24.2017.02.04.13.05.11\n\t(version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSat, 04 Feb 2017 13:05:12 -0800 (PST)" ], "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"WcXxIY2M\"; dkim-atps=neutral", "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=dnHn5EsjcSWCU34Bu9YpU4Qh3aXlBNKhGRo8xX8A1jU=;\n\tb=WcXxIY2MFVWsxdUHc47wxa/JY4TB6fGCPwsj0AQ9RWuTmAQsyxvlJ9uSh0YJReStio\n\tNTj9kYD4Vny5Es+oSWrGE3A1YNbYuedRg5nsGV+2lD3eNJXn0OVNK71DR4UES+JqY5D0\n\tpKAmGn4cDpHyoa4Hs3D8+zVPUHj/lIPfr0MaaVWp0zE75GtTv1qv6oW2qGfU7WFbf1gr\n\tbY8QikSKWq64pjX/KRHrrpbq1bBNDRg7R67K2YHSWAxbYuCUwmZTnYOrf1GbnOky4cUa\n\tnETkgPvrBlwAPoCbqymm5cKzFQJY4KyPxlLdKNFwYaDKjhHSjn/smuRHgy6mI98Bcoqe\n\tT4BA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=dnHn5EsjcSWCU34Bu9YpU4Qh3aXlBNKhGRo8xX8A1jU=;\n\tb=ZxB5vUcQAIXEEYBItFCjMwjhJwNlLNx5oFr6AzDM240X7kxRen6q+KPt8CqlJgnCU2\n\ta2CYHE0pIRZffGxr7nZOHvmWZjjMaYcb9IFdj2h88L91KCXTsTOsWHL0GgcN0WbZ+2on\n\tBUHpPS9Swm21ATxM7cGcab0gnWZt2XXWRwZfJ7Gx+juKl30MI7Q1AqVQ5+uF0Boz4Fr3\n\tnrx1flyMnbgG1plkSUtTWuEZEmj/MQt9tKNjP6Co0OFfv7kWR+8f0yA7mIGW4EJg1/nm\n\tGk9vsEhe9hSUcb+LpAPV3fu/6WNS3B9AyMX4Yq7Asnf1N7HMH3DZJqIBYBipMq2D7Hm9\n\t0qQw==", "X-Gm-Message-State": "AIkVDXKbQDgB92tZRsiBU00vhTSYW8zGzF+e8ka25WKC+Z6l+nVB8PUn5Q0MG9k3xYWkeg==", "X-Received": "by 10.223.163.201 with SMTP id m9mr3488137wrb.66.1486242314025; \n\tSat, 04 Feb 2017 13:05:14 -0800 (PST)", "From": "Philippe Reynes <tremyfr@gmail.com>", "To": "jeffrey.t.kirsher@intel.com,\n\tdavem@davemloft.net", "Date": "Sat, 4 Feb 2017 22:05:06 +0100", "Message-Id": "<1486242306-10111-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,\n\tlinux-kernel@vger.kernel.org, Philippe Reynes <tremyfr@gmail.com>", "Subject": "[Intel-wired-lan] [PATCH] net: intel: i40e: use new api\n\tethtool_{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\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "The ethtool api {get|set}_settings is deprecated.\nWe move this driver to new api {get|set}_link_ksettings.\n\nAs I don't have the hardware, I'd be very pleased if\nsomeone may test this patch.\n\nSigned-off-by: Philippe Reynes <tremyfr@gmail.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 224 ++++++++++++++----------\n 1 files changed, 133 insertions(+), 91 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\nindex cc1465a..011f0b8 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n@@ -387,7 +387,7 @@ static void i40e_phy_type_to_ethtool(struct i40e_pf *pf, u32 *supported,\n *\n **/\n static void i40e_get_settings_link_up(struct i40e_hw *hw,\n-\t\t\t\t struct ethtool_cmd *ecmd,\n+\t\t\t\t struct ethtool_link_ksettings *cmd,\n \t\t\t\t struct net_device *netdev,\n \t\t\t\t struct i40e_pf *pf)\n {\n@@ -395,70 +395,76 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,\n \tu32 link_speed = hw_link_info->link_speed;\n \tu32 e_advertising = 0x0;\n \tu32 e_supported = 0x0;\n+\tu32 supported, advertising;\n+\n+\tethtool_convert_link_mode_to_legacy_u32(&supported,\n+\t\t\t\t\t\tcmd->link_modes.supported);\n+\tethtool_convert_link_mode_to_legacy_u32(&advertising,\n+\t\t\t\t\t\tcmd->link_modes.advertising);\n \n \t/* Initialize supported and advertised settings based on phy settings */\n \tswitch (hw_link_info->phy_type) {\n \tcase I40E_PHY_TYPE_40GBASE_CR4:\n \tcase I40E_PHY_TYPE_40GBASE_CR4_CU:\n-\t\tecmd->supported = SUPPORTED_Autoneg |\n+\t\tsupported = SUPPORTED_Autoneg |\n \t\t\t\t SUPPORTED_40000baseCR4_Full;\n-\t\tecmd->advertising = ADVERTISED_Autoneg |\n+\t\tadvertising = ADVERTISED_Autoneg |\n \t\t\t\t ADVERTISED_40000baseCR4_Full;\n \t\tbreak;\n \tcase I40E_PHY_TYPE_XLAUI:\n \tcase I40E_PHY_TYPE_XLPPI:\n \tcase I40E_PHY_TYPE_40GBASE_AOC:\n-\t\tecmd->supported = SUPPORTED_40000baseCR4_Full;\n+\t\tsupported = SUPPORTED_40000baseCR4_Full;\n \t\tbreak;\n \tcase I40E_PHY_TYPE_40GBASE_SR4:\n-\t\tecmd->supported = SUPPORTED_40000baseSR4_Full;\n+\t\tsupported = SUPPORTED_40000baseSR4_Full;\n \t\tbreak;\n \tcase I40E_PHY_TYPE_40GBASE_LR4:\n-\t\tecmd->supported = SUPPORTED_40000baseLR4_Full;\n+\t\tsupported = SUPPORTED_40000baseLR4_Full;\n \t\tbreak;\n \tcase I40E_PHY_TYPE_10GBASE_SR:\n \tcase I40E_PHY_TYPE_10GBASE_LR:\n \tcase I40E_PHY_TYPE_1000BASE_SX:\n \tcase I40E_PHY_TYPE_1000BASE_LX:\n-\t\tecmd->supported = SUPPORTED_10000baseT_Full;\n+\t\tsupported = SUPPORTED_10000baseT_Full;\n \t\tif (hw_link_info->module_type[2] &\n \t\t I40E_MODULE_TYPE_1000BASE_SX ||\n \t\t hw_link_info->module_type[2] &\n \t\t I40E_MODULE_TYPE_1000BASE_LX) {\n-\t\t\tecmd->supported |= SUPPORTED_1000baseT_Full;\n+\t\t\tsupported |= SUPPORTED_1000baseT_Full;\n \t\t\tif (hw_link_info->requested_speeds &\n \t\t\t I40E_LINK_SPEED_1GB)\n-\t\t\t\tecmd->advertising |= ADVERTISED_1000baseT_Full;\n+\t\t\t\tadvertising |= ADVERTISED_1000baseT_Full;\n \t\t}\n \t\tif (hw_link_info->requested_speeds & I40E_LINK_SPEED_10GB)\n-\t\t\tecmd->advertising |= ADVERTISED_10000baseT_Full;\n+\t\t\tadvertising |= ADVERTISED_10000baseT_Full;\n \t\tbreak;\n \tcase I40E_PHY_TYPE_10GBASE_T:\n \tcase I40E_PHY_TYPE_1000BASE_T:\n \tcase I40E_PHY_TYPE_100BASE_TX:\n-\t\tecmd->supported = SUPPORTED_Autoneg |\n+\t\tsupported = SUPPORTED_Autoneg |\n \t\t\t\t SUPPORTED_10000baseT_Full |\n \t\t\t\t SUPPORTED_1000baseT_Full |\n \t\t\t\t SUPPORTED_100baseT_Full;\n-\t\tecmd->advertising = ADVERTISED_Autoneg;\n+\t\tadvertising = ADVERTISED_Autoneg;\n \t\tif (hw_link_info->requested_speeds & I40E_LINK_SPEED_10GB)\n-\t\t\tecmd->advertising |= ADVERTISED_10000baseT_Full;\n+\t\t\tadvertising |= ADVERTISED_10000baseT_Full;\n \t\tif (hw_link_info->requested_speeds & I40E_LINK_SPEED_1GB)\n-\t\t\tecmd->advertising |= ADVERTISED_1000baseT_Full;\n+\t\t\tadvertising |= ADVERTISED_1000baseT_Full;\n \t\tif (hw_link_info->requested_speeds & I40E_LINK_SPEED_100MB)\n-\t\t\tecmd->advertising |= ADVERTISED_100baseT_Full;\n+\t\t\tadvertising |= ADVERTISED_100baseT_Full;\n \t\tbreak;\n \tcase I40E_PHY_TYPE_1000BASE_T_OPTICAL:\n-\t\tecmd->supported = SUPPORTED_Autoneg |\n+\t\tsupported = SUPPORTED_Autoneg |\n \t\t\t\t SUPPORTED_1000baseT_Full;\n-\t\tecmd->advertising = ADVERTISED_Autoneg |\n+\t\tadvertising = ADVERTISED_Autoneg |\n \t\t\t\t ADVERTISED_1000baseT_Full;\n \t\tbreak;\n \tcase I40E_PHY_TYPE_10GBASE_CR1_CU:\n \tcase I40E_PHY_TYPE_10GBASE_CR1:\n-\t\tecmd->supported = SUPPORTED_Autoneg |\n+\t\tsupported = SUPPORTED_Autoneg |\n \t\t\t\t SUPPORTED_10000baseT_Full;\n-\t\tecmd->advertising = ADVERTISED_Autoneg |\n+\t\tadvertising = ADVERTISED_Autoneg |\n \t\t\t\t ADVERTISED_10000baseT_Full;\n \t\tbreak;\n \tcase I40E_PHY_TYPE_XAUI:\n@@ -466,19 +472,19 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,\n \tcase I40E_PHY_TYPE_SFI:\n \tcase I40E_PHY_TYPE_10GBASE_SFPP_CU:\n \tcase I40E_PHY_TYPE_10GBASE_AOC:\n-\t\tecmd->supported = SUPPORTED_10000baseT_Full;\n-\t\tecmd->advertising = SUPPORTED_10000baseT_Full;\n+\t\tsupported = SUPPORTED_10000baseT_Full;\n+\t\tadvertising = SUPPORTED_10000baseT_Full;\n \t\tbreak;\n \tcase I40E_PHY_TYPE_SGMII:\n-\t\tecmd->supported = SUPPORTED_Autoneg |\n+\t\tsupported = SUPPORTED_Autoneg |\n \t\t\t\t SUPPORTED_1000baseT_Full;\n \t\tif (hw_link_info->requested_speeds & I40E_LINK_SPEED_1GB)\n-\t\t\tecmd->advertising |= ADVERTISED_1000baseT_Full;\n+\t\t\tadvertising |= ADVERTISED_1000baseT_Full;\n \t\tif (pf->flags & I40E_FLAG_100M_SGMII_CAPABLE) {\n-\t\t\tecmd->supported |= SUPPORTED_100baseT_Full;\n+\t\t\tsupported |= SUPPORTED_100baseT_Full;\n \t\t\tif (hw_link_info->requested_speeds &\n \t\t\t I40E_LINK_SPEED_100MB)\n-\t\t\t\tecmd->advertising |= ADVERTISED_100baseT_Full;\n+\t\t\t\tadvertising |= ADVERTISED_100baseT_Full;\n \t\t}\n \t\tbreak;\n \tcase I40E_PHY_TYPE_40GBASE_KR4:\n@@ -486,13 +492,13 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,\n \tcase I40E_PHY_TYPE_10GBASE_KR:\n \tcase I40E_PHY_TYPE_10GBASE_KX4:\n \tcase I40E_PHY_TYPE_1000BASE_KX:\n-\t\tecmd->supported |= SUPPORTED_40000baseKR4_Full |\n+\t\tsupported |= SUPPORTED_40000baseKR4_Full |\n \t\t\t\t SUPPORTED_20000baseKR2_Full |\n \t\t\t\t SUPPORTED_10000baseKR_Full |\n \t\t\t\t SUPPORTED_10000baseKX4_Full |\n \t\t\t\t SUPPORTED_1000baseKX_Full |\n \t\t\t\t SUPPORTED_Autoneg;\n-\t\tecmd->advertising |= ADVERTISED_40000baseKR4_Full |\n+\t\tadvertising |= ADVERTISED_40000baseKR4_Full |\n \t\t\t\t ADVERTISED_20000baseKR2_Full |\n \t\t\t\t ADVERTISED_10000baseKR_Full |\n \t\t\t\t ADVERTISED_10000baseKX4_Full |\n@@ -503,8 +509,8 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,\n \tcase I40E_PHY_TYPE_25GBASE_CR:\n \tcase I40E_PHY_TYPE_25GBASE_SR:\n \tcase I40E_PHY_TYPE_25GBASE_LR:\n-\t\tecmd->supported = SUPPORTED_Autoneg;\n-\t\tecmd->advertising = ADVERTISED_Autoneg;\n+\t\tsupported = SUPPORTED_Autoneg;\n+\t\tadvertising = ADVERTISED_Autoneg;\n \t\t/* TODO: add speeds when ethtool is ready to support*/\n \t\tbreak;\n \tdefault:\n@@ -520,38 +526,43 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,\n \ti40e_phy_type_to_ethtool(pf, &e_supported,\n \t\t\t\t &e_advertising);\n \n-\tecmd->supported = ecmd->supported & e_supported;\n-\tecmd->advertising = ecmd->advertising & e_advertising;\n+\tsupported = supported & e_supported;\n+\tadvertising = advertising & e_advertising;\n \n \t/* Set speed and duplex */\n \tswitch (link_speed) {\n \tcase I40E_LINK_SPEED_40GB:\n-\t\tethtool_cmd_speed_set(ecmd, SPEED_40000);\n+\t\tcmd->base.speed = SPEED_40000;\n \t\tbreak;\n \tcase I40E_LINK_SPEED_25GB:\n #ifdef SPEED_25000\n-\t\tethtool_cmd_speed_set(ecmd, SPEED_25000);\n+\t\tcmd->base.speed = SPEED_25000;\n #else\n \t\tnetdev_info(netdev,\n \t\t\t \"Speed is 25G, display not supported by this version of ethtool.\\n\");\n #endif\n \t\tbreak;\n \tcase I40E_LINK_SPEED_20GB:\n-\t\tethtool_cmd_speed_set(ecmd, SPEED_20000);\n+\t\tcmd->base.speed = SPEED_20000;\n \t\tbreak;\n \tcase I40E_LINK_SPEED_10GB:\n-\t\tethtool_cmd_speed_set(ecmd, SPEED_10000);\n+\t\tcmd->base.speed = SPEED_10000;\n \t\tbreak;\n \tcase I40E_LINK_SPEED_1GB:\n-\t\tethtool_cmd_speed_set(ecmd, SPEED_1000);\n+\t\tcmd->base.speed = SPEED_1000;\n \t\tbreak;\n \tcase I40E_LINK_SPEED_100MB:\n-\t\tethtool_cmd_speed_set(ecmd, SPEED_100);\n+\t\tcmd->base.speed = SPEED_100;\n \t\tbreak;\n \tdefault:\n \t\tbreak;\n \t}\n-\tecmd->duplex = DUPLEX_FULL;\n+\tcmd->base.duplex = DUPLEX_FULL;\n+\n+\tethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,\n+\t\t\t\t\t\tsupported);\n+\tethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,\n+\t\t\t\t\t\tadvertising);\n }\n \n /**\n@@ -562,18 +573,24 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,\n * Reports link settings that can be determined when link is down\n **/\n static void i40e_get_settings_link_down(struct i40e_hw *hw,\n-\t\t\t\t\tstruct ethtool_cmd *ecmd,\n+\t\t\t\t\tstruct ethtool_link_ksettings *cmd,\n \t\t\t\t\tstruct i40e_pf *pf)\n {\n+\tu32 supported, advertising;\n+\n \t/* link is down and the driver needs to fall back on\n \t * supported phy types to figure out what info to display\n \t */\n-\ti40e_phy_type_to_ethtool(pf, &ecmd->supported,\n-\t\t\t\t &ecmd->advertising);\n+\ti40e_phy_type_to_ethtool(pf, &supported, &advertising);\n+\n+\tethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,\n+\t\t\t\t\t\tsupported);\n+\tethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,\n+\t\t\t\t\t\tadvertising);\n \n \t/* With no link speed and duplex are unknown */\n-\tethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);\n-\tecmd->duplex = DUPLEX_UNKNOWN;\n+\tcmd->base.speed = SPEED_UNKNOWN;\n+\tcmd->base.duplex = DUPLEX_UNKNOWN;\n }\n \n /**\n@@ -583,74 +600,85 @@ static void i40e_get_settings_link_down(struct i40e_hw *hw,\n *\n * Reports speed/duplex settings based on media_type\n **/\n-static int i40e_get_settings(struct net_device *netdev,\n-\t\t\t struct ethtool_cmd *ecmd)\n+static int i40e_get_link_ksettings(struct net_device *netdev,\n+\t\t\t\t struct ethtool_link_ksettings *cmd)\n {\n \tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n \tstruct i40e_pf *pf = np->vsi->back;\n \tstruct i40e_hw *hw = &pf->hw;\n \tstruct i40e_link_status *hw_link_info = &hw->phy.link_info;\n \tbool link_up = hw_link_info->link_info & I40E_AQ_LINK_UP;\n+\tu32 advertising;\n \n \tif (link_up)\n-\t\ti40e_get_settings_link_up(hw, ecmd, netdev, pf);\n+\t\ti40e_get_settings_link_up(hw, cmd, netdev, pf);\n \telse\n-\t\ti40e_get_settings_link_down(hw, ecmd, pf);\n+\t\ti40e_get_settings_link_down(hw, cmd, pf);\n \n \t/* Now set the settings that don't rely on link being up/down */\n \t/* Set autoneg settings */\n-\tecmd->autoneg = ((hw_link_info->an_info & I40E_AQ_AN_COMPLETED) ?\n+\tcmd->base.autoneg = ((hw_link_info->an_info & I40E_AQ_AN_COMPLETED) ?\n \t\t\t AUTONEG_ENABLE : AUTONEG_DISABLE);\n \n \tswitch (hw->phy.media_type) {\n \tcase I40E_MEDIA_TYPE_BACKPLANE:\n-\t\tecmd->supported |= SUPPORTED_Autoneg |\n-\t\t\t\t SUPPORTED_Backplane;\n-\t\tecmd->advertising |= ADVERTISED_Autoneg |\n-\t\t\t\t ADVERTISED_Backplane;\n-\t\tecmd->port = PORT_NONE;\n+\t\tethtool_link_ksettings_add_link_mode(cmd, supported,\n+\t\t\t\t\t\t Autoneg);\n+\t\tethtool_link_ksettings_add_link_mode(cmd, supported,\n+\t\t\t\t\t\t Backplane);\n+\t\tethtool_link_ksettings_add_link_mode(cmd, advertising,\n+\t\t\t\t\t\t Autoneg);\n+\t\tethtool_link_ksettings_add_link_mode(cmd, advertising,\n+\t\t\t\t\t\t Backplane);\n+\t\tcmd->base.port = PORT_NONE;\n \t\tbreak;\n \tcase I40E_MEDIA_TYPE_BASET:\n-\t\tecmd->supported |= SUPPORTED_TP;\n-\t\tecmd->advertising |= ADVERTISED_TP;\n-\t\tecmd->port = PORT_TP;\n+\t\tethtool_link_ksettings_add_link_mode(cmd, supported, TP);\n+\t\tethtool_link_ksettings_add_link_mode(cmd, advertising, TP);\n+\t\tcmd->base.port = PORT_TP;\n \t\tbreak;\n \tcase I40E_MEDIA_TYPE_DA:\n \tcase I40E_MEDIA_TYPE_CX4:\n-\t\tecmd->supported |= SUPPORTED_FIBRE;\n-\t\tecmd->advertising |= ADVERTISED_FIBRE;\n-\t\tecmd->port = PORT_DA;\n+\t\tethtool_link_ksettings_add_link_mode(cmd, supported, FIBRE);\n+\t\tethtool_link_ksettings_add_link_mode(cmd, advertising, FIBRE);\n+\t\tcmd->base.port = PORT_DA;\n \t\tbreak;\n \tcase I40E_MEDIA_TYPE_FIBER:\n-\t\tecmd->supported |= SUPPORTED_FIBRE;\n-\t\tecmd->port = PORT_FIBRE;\n+\t\tethtool_link_ksettings_add_link_mode(cmd, supported, FIBRE);\n+\t\tcmd->base.port = PORT_FIBRE;\n \t\tbreak;\n \tcase I40E_MEDIA_TYPE_UNKNOWN:\n \tdefault:\n-\t\tecmd->port = PORT_OTHER;\n+\t\tcmd->base.port = PORT_OTHER;\n \t\tbreak;\n \t}\n \n-\t/* Set transceiver */\n-\tecmd->transceiver = XCVR_EXTERNAL;\n-\n \t/* Set flow control settings */\n-\tecmd->supported |= SUPPORTED_Pause;\n+\tethtool_link_ksettings_add_link_mode(cmd, supported, Pause);\n \n \tswitch (hw->fc.requested_mode) {\n \tcase I40E_FC_FULL:\n-\t\tecmd->advertising |= ADVERTISED_Pause;\n+\t\tethtool_link_ksettings_add_link_mode(cmd, advertising,\n+\t\t\t\t\t\t Pause);\n \t\tbreak;\n \tcase I40E_FC_TX_PAUSE:\n-\t\tecmd->advertising |= ADVERTISED_Asym_Pause;\n+\t\tethtool_link_ksettings_add_link_mode(cmd, advertising,\n+\t\t\t\t\t\t Asym_Pause);\n \t\tbreak;\n \tcase I40E_FC_RX_PAUSE:\n-\t\tecmd->advertising |= (ADVERTISED_Pause |\n-\t\t\t\t ADVERTISED_Asym_Pause);\n+\t\tethtool_link_ksettings_add_link_mode(cmd, advertising,\n+\t\t\t\t\t\t Pause);\n+\t\tethtool_link_ksettings_add_link_mode(cmd, advertising,\n+\t\t\t\t\t\t Asym_Pause);\n \t\tbreak;\n \tdefault:\n-\t\tecmd->advertising &= ~(ADVERTISED_Pause |\n-\t\t\t\t ADVERTISED_Asym_Pause);\n+\t\tethtool_convert_link_mode_to_legacy_u32(\n+\t\t\t&advertising, cmd->link_modes.advertising);\n+\n+\t\tadvertising &= ~(ADVERTISED_Pause | ADVERTISED_Asym_Pause);\n+\n+\t\tethtool_convert_legacy_u32_to_link_mode(\n+\t\t\tcmd->link_modes.advertising, advertising);\n \t\tbreak;\n \t}\n \n@@ -664,8 +692,8 @@ static int i40e_get_settings(struct net_device *netdev,\n *\n * Set speed/duplex per media_types advertised/forced\n **/\n-static int i40e_set_settings(struct net_device *netdev,\n-\t\t\t struct ethtool_cmd *ecmd)\n+static int i40e_set_link_ksettings(struct net_device *netdev,\n+\t\t\t\t const struct ethtool_link_ksettings *cmd)\n {\n \tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n \tstruct i40e_aq_get_phy_abilities_resp abilities;\n@@ -673,12 +701,14 @@ static int i40e_set_settings(struct net_device *netdev,\n \tstruct i40e_pf *pf = np->vsi->back;\n \tstruct i40e_vsi *vsi = np->vsi;\n \tstruct i40e_hw *hw = &pf->hw;\n-\tstruct ethtool_cmd safe_ecmd;\n+\tstruct ethtool_link_ksettings safe_cmd;\n+\tstruct ethtool_link_ksettings copy_cmd;\n \ti40e_status status = 0;\n \tbool change = false;\n \tint err = 0;\n-\tu8 autoneg;\n+\tu32 autoneg;\n \tu32 advertise;\n+\tu32 tmp;\n \n \t/* Changing port settings is not supported if this isn't the\n \t * port's controlling PF\n@@ -706,23 +736,31 @@ static int i40e_set_settings(struct net_device *netdev,\n \t\treturn -EOPNOTSUPP;\n \t}\n \n+\t/* copy the cmd to copy_cmd to avoid modifying the origin */\n+\tmemcpy(©_cmd, cmd, sizeof(struct ethtool_link_ksettings));\n+\n \t/* get our own copy of the bits to check against */\n-\tmemset(&safe_ecmd, 0, sizeof(struct ethtool_cmd));\n-\ti40e_get_settings(netdev, &safe_ecmd);\n+\tmemset(&safe_cmd, 0, sizeof(struct ethtool_link_ksettings));\n+\ti40e_get_link_ksettings(netdev, &safe_cmd);\n \n-\t/* save autoneg and speed out of ecmd */\n-\tautoneg = ecmd->autoneg;\n-\tadvertise = ecmd->advertising;\n+\t/* save autoneg and speed out of cmd */\n+\tautoneg = cmd->base.autoneg;\n+\tethtool_convert_link_mode_to_legacy_u32(&advertise,\n+\t\t\t\t\t\tcmd->link_modes.advertising);\n \n \t/* set autoneg and speed back to what they currently are */\n-\tecmd->autoneg = safe_ecmd.autoneg;\n-\tecmd->advertising = safe_ecmd.advertising;\n+\tcopy_cmd.base.autoneg = safe_cmd.base.autoneg;\n+\tethtool_convert_link_mode_to_legacy_u32(\n+\t\t&tmp, safe_cmd.link_modes.advertising);\n+\tethtool_convert_legacy_u32_to_link_mode(\n+\t\tcopy_cmd.link_modes.advertising, tmp);\n+\n+\tcopy_cmd.base.cmd = safe_cmd.base.cmd;\n \n-\tecmd->cmd = safe_ecmd.cmd;\n-\t/* If ecmd and safe_ecmd are not the same now, then they are\n+\t/* If copy_cmd and safe_cmd are not the same now, then they are\n \t * trying to set something that we do not support\n \t */\n-\tif (memcmp(ecmd, &safe_ecmd, sizeof(struct ethtool_cmd)))\n+\tif (memcmp(©_cmd, &safe_cmd, sizeof(struct ethtool_link_ksettings)))\n \t\treturn -EOPNOTSUPP;\n \n \twhile (test_bit(__I40E_CONFIG_BUSY, &vsi->state))\n@@ -745,7 +783,8 @@ static int i40e_set_settings(struct net_device *netdev,\n \t\t/* If autoneg was not already enabled */\n \t\tif (!(hw->phy.link_info.an_info & I40E_AQ_AN_COMPLETED)) {\n \t\t\t/* If autoneg is not supported, return error */\n-\t\t\tif (!(safe_ecmd.supported & SUPPORTED_Autoneg)) {\n+\t\t\tif (!ethtool_link_ksettings_test_link_mode(\n+\t\t\t\t &safe_cmd, supported, Autoneg)) {\n \t\t\t\tnetdev_info(netdev, \"Autoneg not supported on this phy\\n\");\n \t\t\t\treturn -EINVAL;\n \t\t\t}\n@@ -760,7 +799,8 @@ static int i40e_set_settings(struct net_device *netdev,\n \t\t\t/* If autoneg is supported 10GBASE_T is the only PHY\n \t\t\t * that can disable it, so otherwise return error\n \t\t\t */\n-\t\t\tif (safe_ecmd.supported & SUPPORTED_Autoneg &&\n+\t\t\tif (ethtool_link_ksettings_test_link_mode(\n+\t\t\t\t &safe_cmd, supported, Autoneg) &&\n \t\t\t hw->phy.link_info.phy_type !=\n \t\t\t I40E_PHY_TYPE_10GBASE_T) {\n \t\t\t\tnetdev_info(netdev, \"Autoneg cannot be disabled on this phy\\n\");\n@@ -773,7 +813,9 @@ static int i40e_set_settings(struct net_device *netdev,\n \t\t}\n \t}\n \n-\tif (advertise & ~safe_ecmd.supported)\n+\tethtool_convert_link_mode_to_legacy_u32(&tmp,\n+\t\t\t\t\t\tsafe_cmd.link_modes.supported);\n+\tif (advertise & ~tmp)\n \t\treturn -EINVAL;\n \n \tif (advertise & ADVERTISED_100baseT_Full)\n@@ -3141,8 +3183,6 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)\n }\n \n static const struct ethtool_ops i40e_ethtool_ops = {\n-\t.get_settings\t\t= i40e_get_settings,\n-\t.set_settings\t\t= i40e_set_settings,\n \t.get_drvinfo\t\t= i40e_get_drvinfo,\n \t.get_regs_len\t\t= i40e_get_regs_len,\n \t.get_regs\t\t= i40e_get_regs,\n@@ -3179,6 +3219,8 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)\n \t.set_priv_flags\t\t= i40e_set_priv_flags,\n \t.get_per_queue_coalesce\t= i40e_get_per_queue_coalesce,\n \t.set_per_queue_coalesce\t= i40e_set_per_queue_coalesce,\n+\t.get_link_ksettings\t= i40e_get_link_ksettings,\n+\t.set_link_ksettings\t= i40e_set_link_ksettings,\n };\n \n void i40e_set_ethtool_ops(struct net_device *netdev)\n", "prefixes": [] }