get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/81298/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 81298,
    "url": "http://patches.dpdk.org/api/patches/81298/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20201019085415.82207-17-jiawenwu@trustnetic.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20201019085415.82207-17-jiawenwu@trustnetic.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201019085415.82207-17-jiawenwu@trustnetic.com",
    "date": "2020-10-19T08:53:33",
    "name": "[v4,16/58] net/txgbe: add multi-speed link setup",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "f67b0e8a0561d405ed6fe35dc0973208fbf25ae6",
    "submitter": {
        "id": 1932,
        "url": "http://patches.dpdk.org/api/people/1932/?format=api",
        "name": "Jiawen Wu",
        "email": "jiawenwu@trustnetic.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20201019085415.82207-17-jiawenwu@trustnetic.com/mbox/",
    "series": [
        {
            "id": 13094,
            "url": "http://patches.dpdk.org/api/series/13094/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=13094",
            "date": "2020-10-19T08:53:17",
            "name": "net: txgbe PMD",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/13094/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/81298/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/81298/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 90DE3A04DC;\n\tMon, 19 Oct 2020 10:57:53 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 02C6FC908;\n\tMon, 19 Oct 2020 10:53:11 +0200 (CEST)",
            "from smtpbgeu1.qq.com (smtpbgeu1.qq.com [52.59.177.22])\n by dpdk.org (Postfix) with ESMTP id 99F19C82C\n for <dev@dpdk.org>; Mon, 19 Oct 2020 10:52:51 +0200 (CEST)",
            "from localhost.localdomain.com (unknown [183.129.236.74])\n by esmtp6.qq.com (ESMTP) with\n id ; Mon, 19 Oct 2020 16:52:47 +0800 (CST)"
        ],
        "X-QQ-mid": "bizesmtp6t1603097568t51jz7viv",
        "X-QQ-SSF": "01400000002000C0C000B00A0000000",
        "X-QQ-FEAT": "l6IKqkG+NbljIggJHbIPvDn8/uq7B8zCbvyEsIeQhGnntgXCujVdsO6eX7Oug\n T+157/FNlANnr/f6dxksZFdT3aJH7CVfhyS1tZ/MacqHyBO7uRxQt+cY5BF8JzODAKpT/cB\n ZYCS6KvG6Cd/G+9Qf0KuxvRRSZN2GU6PT0lxmWzjsl2PAehQHwJV0RUZtOIbsXCQRb799M1\n xGQ60lHGBx2qLKNmutF2L+0mTU7lX8R/lcnQQ6f9EZ+FPBK7pcvXx/7kCMMH0ZogT5uYFtI\n QUaDTaGyWBd8brigz2QBmC63EAPXXQj3R3tssF1x2vvt3LglHwq6pArlyUPiBkVgPRJQlbJ\n aWXKrLl4ENht321su3OghCUMBqJsw==",
        "X-QQ-GoodBg": "2",
        "From": "Jiawen Wu <jiawenwu@trustnetic.com>",
        "To": "dev@dpdk.org",
        "Cc": "Jiawen Wu <jiawenwu@trustnetic.com>",
        "Date": "Mon, 19 Oct 2020 16:53:33 +0800",
        "Message-Id": "<20201019085415.82207-17-jiawenwu@trustnetic.com>",
        "X-Mailer": "git-send-email 2.18.4",
        "In-Reply-To": "<20201019085415.82207-1-jiawenwu@trustnetic.com>",
        "References": "<20201019085415.82207-1-jiawenwu@trustnetic.com>",
        "X-QQ-SENDSIZE": "520",
        "Feedback-ID": "bizesmtp:trustnetic.com:qybgforeign:qybgforeign6",
        "X-QQ-Bgrelay": "1",
        "Subject": "[dpdk-dev] [PATCH v4 16/58] net/txgbe: add multi-speed link setup",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add multispeed fiber setup link and laser control.\n\nSigned-off-by: Jiawen Wu <jiawenwu@trustnetic.com>\n---\n drivers/net/txgbe/base/txgbe_hw.c | 398 +++++++++++++++++++++++++++++-\n drivers/net/txgbe/base/txgbe_hw.h |  11 +\n 2 files changed, 408 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/txgbe/base/txgbe_hw.c b/drivers/net/txgbe/base/txgbe_hw.c\nindex 5b346746e..55309b791 100644\n--- a/drivers/net/txgbe/base/txgbe_hw.c\n+++ b/drivers/net/txgbe/base/txgbe_hw.c\n@@ -250,6 +250,151 @@ void txgbe_clear_tx_pending(struct txgbe_hw *hw)\n \twr32(hw, TXGBE_PSRCTL, hlreg0);\n }\n \n+/**\n+ *  txgbe_setup_mac_link_multispeed_fiber - Set MAC link speed\n+ *  @hw: pointer to hardware structure\n+ *  @speed: new link speed\n+ *  @autoneg_wait_to_complete: true when waiting for completion is needed\n+ *\n+ *  Set the link speed in the MAC and/or PHY register and restarts link.\n+ **/\n+s32 txgbe_setup_mac_link_multispeed_fiber(struct txgbe_hw *hw,\n+\t\t\t\t\t  u32 speed,\n+\t\t\t\t\t  bool autoneg_wait_to_complete)\n+{\n+\tu32 link_speed = TXGBE_LINK_SPEED_UNKNOWN;\n+\tu32 highest_link_speed = TXGBE_LINK_SPEED_UNKNOWN;\n+\ts32 status = 0;\n+\tu32 speedcnt = 0;\n+\tu32 i = 0;\n+\tbool autoneg, link_up = false;\n+\n+\tDEBUGFUNC(\"txgbe_setup_mac_link_multispeed_fiber\");\n+\n+\t/* Mask off requested but non-supported speeds */\n+\tstatus = hw->mac.get_link_capabilities(hw, &link_speed, &autoneg);\n+\tif (status != 0)\n+\t\treturn status;\n+\n+\tspeed &= link_speed;\n+\n+\t/* Try each speed one by one, highest priority first.  We do this in\n+\t * software because 10Gb fiber doesn't support speed autonegotiation.\n+\t */\n+\tif (speed & TXGBE_LINK_SPEED_10GB_FULL) {\n+\t\tspeedcnt++;\n+\t\thighest_link_speed = TXGBE_LINK_SPEED_10GB_FULL;\n+\n+\t\t/* Set the module link speed */\n+\t\tswitch (hw->phy.media_type) {\n+\t\tcase txgbe_media_type_fiber:\n+\t\t\thw->mac.set_rate_select_speed(hw,\n+\t\t\t\tTXGBE_LINK_SPEED_10GB_FULL);\n+\t\t\tbreak;\n+\t\tcase txgbe_media_type_fiber_qsfp:\n+\t\t\t/* QSFP module automatically detects MAC link speed */\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tDEBUGOUT(\"Unexpected media type.\\n\");\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\t/* Allow module to change analog characteristics (1G->10G) */\n+\t\tmsec_delay(40);\n+\n+\t\tstatus = hw->mac.setup_mac_link(hw,\n+\t\t\t\tTXGBE_LINK_SPEED_10GB_FULL,\n+\t\t\t\tautoneg_wait_to_complete);\n+\t\tif (status != 0)\n+\t\t\treturn status;\n+\n+\t\t/* Flap the Tx laser if it has not already been done */\n+\t\thw->mac.flap_tx_laser(hw);\n+\n+\t\t/* Wait for the controller to acquire link.  Per IEEE 802.3ap,\n+\t\t * Section 73.10.2, we may have to wait up to 500ms if KR is\n+\t\t * attempted.  uses the same timing for 10g SFI.\n+\t\t */\n+\t\tfor (i = 0; i < 5; i++) {\n+\t\t\t/* Wait for the link partner to also set speed */\n+\t\t\tmsec_delay(100);\n+\n+\t\t\t/* If we have link, just jump out */\n+\t\t\tstatus = hw->mac.check_link(hw, &link_speed,\n+\t\t\t\t&link_up, false);\n+\t\t\tif (status != 0)\n+\t\t\t\treturn status;\n+\n+\t\t\tif (link_up)\n+\t\t\t\tgoto out;\n+\t\t}\n+\t}\n+\n+\tif (speed & TXGBE_LINK_SPEED_1GB_FULL) {\n+\t\tspeedcnt++;\n+\t\tif (highest_link_speed == TXGBE_LINK_SPEED_UNKNOWN)\n+\t\t\thighest_link_speed = TXGBE_LINK_SPEED_1GB_FULL;\n+\n+\t\t/* Set the module link speed */\n+\t\tswitch (hw->phy.media_type) {\n+\t\tcase txgbe_media_type_fiber:\n+\t\t\thw->mac.set_rate_select_speed(hw,\n+\t\t\t\tTXGBE_LINK_SPEED_1GB_FULL);\n+\t\t\tbreak;\n+\t\tcase txgbe_media_type_fiber_qsfp:\n+\t\t\t/* QSFP module automatically detects link speed */\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tDEBUGOUT(\"Unexpected media type.\\n\");\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\t/* Allow module to change analog characteristics (10G->1G) */\n+\t\tmsec_delay(40);\n+\n+\t\tstatus = hw->mac.setup_mac_link(hw,\n+\t\t\t\tTXGBE_LINK_SPEED_1GB_FULL,\n+\t\t\t\tautoneg_wait_to_complete);\n+\t\tif (status != 0)\n+\t\t\treturn status;\n+\n+\t\t/* Flap the Tx laser if it has not already been done */\n+\t\thw->mac.flap_tx_laser(hw);\n+\n+\t\t/* Wait for the link partner to also set speed */\n+\t\tmsec_delay(100);\n+\n+\t\t/* If we have link, just jump out */\n+\t\tstatus = hw->mac.check_link(hw, &link_speed, &link_up, false);\n+\t\tif (status != 0)\n+\t\t\treturn status;\n+\n+\t\tif (link_up)\n+\t\t\tgoto out;\n+\t}\n+\n+\t/* We didn't get link.  Configure back to the highest speed we tried,\n+\t * (if there was more than one).  We call ourselves back with just the\n+\t * single highest speed that the user requested.\n+\t */\n+\tif (speedcnt > 1)\n+\t\tstatus = txgbe_setup_mac_link_multispeed_fiber(hw,\n+\t\t\t\t\t\t      highest_link_speed,\n+\t\t\t\t\t\t      autoneg_wait_to_complete);\n+\n+out:\n+\t/* Set autoneg_advertised value based on input link speed */\n+\thw->phy.autoneg_advertised = 0;\n+\n+\tif (speed & TXGBE_LINK_SPEED_10GB_FULL)\n+\t\thw->phy.autoneg_advertised |= TXGBE_LINK_SPEED_10GB_FULL;\n+\n+\tif (speed & TXGBE_LINK_SPEED_1GB_FULL)\n+\t\thw->phy.autoneg_advertised |= TXGBE_LINK_SPEED_1GB_FULL;\n+\n+\treturn status;\n+}\n+\n /**\n  *  txgbe_init_shared_code - Initialize the shared code\n  *  @hw: pointer to hardware structure\n@@ -348,7 +493,35 @@ void txgbe_init_mac_link_ops(struct txgbe_hw *hw)\n \n \tDEBUGFUNC(\"txgbe_init_mac_link_ops\");\n \n-\tmac->setup_link = txgbe_setup_mac_link;\n+\t/*\n+\t * enable the laser control functions for SFP+ fiber\n+\t * and MNG not enabled\n+\t */\n+\tif (hw->phy.media_type == txgbe_media_type_fiber &&\n+\t    !txgbe_mng_enabled(hw)) {\n+\t\tmac->disable_tx_laser =\n+\t\t\ttxgbe_disable_tx_laser_multispeed_fiber;\n+\t\tmac->enable_tx_laser =\n+\t\t\ttxgbe_enable_tx_laser_multispeed_fiber;\n+\t\tmac->flap_tx_laser =\n+\t\t\ttxgbe_flap_tx_laser_multispeed_fiber;\n+\t}\n+\n+\tif ((hw->phy.media_type == txgbe_media_type_fiber ||\n+\t     hw->phy.media_type == txgbe_media_type_fiber_qsfp) &&\n+\t    hw->phy.multispeed_fiber) {\n+\t\t/* Set up dual speed SFP+ support */\n+\t\tmac->setup_link = txgbe_setup_mac_link_multispeed_fiber;\n+\t\tmac->setup_mac_link = txgbe_setup_mac_link;\n+\t\tmac->set_rate_select_speed = txgbe_set_hard_rate_select_speed;\n+\t} else if ((hw->phy.media_type == txgbe_media_type_backplane) &&\n+\t\t    (hw->phy.smart_speed == txgbe_smart_speed_auto ||\n+\t\t     hw->phy.smart_speed == txgbe_smart_speed_on) &&\n+\t\t     !txgbe_verify_lesm_fw_enabled_raptor(hw)) {\n+\t\tmac->setup_link = txgbe_setup_mac_link_smartspeed;\n+\t} else {\n+\t\tmac->setup_link = txgbe_setup_mac_link;\n+\t}\n }\n \n /**\n@@ -562,6 +735,19 @@ s32 txgbe_get_link_capabilities_raptor(struct txgbe_hw *hw,\n \t\treturn TXGBE_ERR_LINK_SETUP;\n \t}\n \n+\tif (hw->phy.multispeed_fiber) {\n+\t\t*speed |= TXGBE_LINK_SPEED_10GB_FULL |\n+\t\t\t  TXGBE_LINK_SPEED_1GB_FULL;\n+\n+\t\t/* QSFP must not enable full auto-negotiation\n+\t\t * Limited autoneg is enabled at 1G\n+\t\t */\n+\t\tif (hw->phy.media_type == txgbe_media_type_fiber_qsfp)\n+\t\t\t*autoneg = false;\n+\t\telse\n+\t\t\t*autoneg = true;\n+\t}\n+\n \treturn status;\n }\n \n@@ -607,6 +793,216 @@ s32 txgbe_start_mac_link_raptor(struct txgbe_hw *hw,\n \treturn status;\n }\n \n+/**\n+ *  txgbe_disable_tx_laser_multispeed_fiber - Disable Tx laser\n+ *  @hw: pointer to hardware structure\n+ *\n+ *  The base drivers may require better control over SFP+ module\n+ *  PHY states.  This includes selectively shutting down the Tx\n+ *  laser on the PHY, effectively halting physical link.\n+ **/\n+void txgbe_disable_tx_laser_multispeed_fiber(struct txgbe_hw *hw)\n+{\n+\tu32 esdp_reg = rd32(hw, TXGBE_GPIODATA);\n+\n+\t/* Blocked by MNG FW so bail */\n+\tif (txgbe_check_reset_blocked(hw))\n+\t\treturn;\n+\n+\t/* Disable Tx laser; allow 100us to go dark per spec */\n+\tesdp_reg |= (TXGBE_GPIOBIT_0 | TXGBE_GPIOBIT_1);\n+\twr32(hw, TXGBE_GPIODATA, esdp_reg);\n+\ttxgbe_flush(hw);\n+\tusec_delay(100);\n+}\n+\n+/**\n+ *  txgbe_enable_tx_laser_multispeed_fiber - Enable Tx laser\n+ *  @hw: pointer to hardware structure\n+ *\n+ *  The base drivers may require better control over SFP+ module\n+ *  PHY states.  This includes selectively turning on the Tx\n+ *  laser on the PHY, effectively starting physical link.\n+ **/\n+void txgbe_enable_tx_laser_multispeed_fiber(struct txgbe_hw *hw)\n+{\n+\tu32 esdp_reg = rd32(hw, TXGBE_GPIODATA);\n+\n+\t/* Enable Tx laser; allow 100ms to light up */\n+\tesdp_reg &= ~(TXGBE_GPIOBIT_0 | TXGBE_GPIOBIT_1);\n+\twr32(hw, TXGBE_GPIODATA, esdp_reg);\n+\ttxgbe_flush(hw);\n+\tmsec_delay(100);\n+}\n+\n+/**\n+ *  txgbe_flap_tx_laser_multispeed_fiber - Flap Tx laser\n+ *  @hw: pointer to hardware structure\n+ *\n+ *  When the driver changes the link speeds that it can support,\n+ *  it sets autotry_restart to true to indicate that we need to\n+ *  initiate a new autotry session with the link partner.  To do\n+ *  so, we set the speed then disable and re-enable the Tx laser, to\n+ *  alert the link partner that it also needs to restart autotry on its\n+ *  end.  This is consistent with true clause 37 autoneg, which also\n+ *  involves a loss of signal.\n+ **/\n+void txgbe_flap_tx_laser_multispeed_fiber(struct txgbe_hw *hw)\n+{\n+\tDEBUGFUNC(\"txgbe_flap_tx_laser_multispeed_fiber\");\n+\n+\t/* Blocked by MNG FW so bail */\n+\tif (txgbe_check_reset_blocked(hw))\n+\t\treturn;\n+\n+\tif (hw->mac.autotry_restart) {\n+\t\ttxgbe_disable_tx_laser_multispeed_fiber(hw);\n+\t\ttxgbe_enable_tx_laser_multispeed_fiber(hw);\n+\t\thw->mac.autotry_restart = false;\n+\t}\n+}\n+\n+/**\n+ *  txgbe_set_hard_rate_select_speed - Set module link speed\n+ *  @hw: pointer to hardware structure\n+ *  @speed: link speed to set\n+ *\n+ *  Set module link speed via RS0/RS1 rate select pins.\n+ */\n+void txgbe_set_hard_rate_select_speed(struct txgbe_hw *hw,\n+\t\t\t\t\tu32 speed)\n+{\n+\tu32 esdp_reg = rd32(hw, TXGBE_GPIODATA);\n+\n+\tswitch (speed) {\n+\tcase TXGBE_LINK_SPEED_10GB_FULL:\n+\t\tesdp_reg |= (TXGBE_GPIOBIT_4 | TXGBE_GPIOBIT_5);\n+\t\tbreak;\n+\tcase TXGBE_LINK_SPEED_1GB_FULL:\n+\t\tesdp_reg &= ~(TXGBE_GPIOBIT_4 | TXGBE_GPIOBIT_5);\n+\t\tbreak;\n+\tdefault:\n+\t\tDEBUGOUT(\"Invalid fixed module speed\\n\");\n+\t\treturn;\n+\t}\n+\n+\twr32(hw, TXGBE_GPIODATA, esdp_reg);\n+\ttxgbe_flush(hw);\n+}\n+\n+/**\n+ *  txgbe_setup_mac_link_smartspeed - Set MAC link speed using SmartSpeed\n+ *  @hw: pointer to hardware structure\n+ *  @speed: new link speed\n+ *  @autoneg_wait_to_complete: true when waiting for completion is needed\n+ *\n+ *  Implements the Intel SmartSpeed algorithm.\n+ **/\n+s32 txgbe_setup_mac_link_smartspeed(struct txgbe_hw *hw,\n+\t\t\t\t    u32 speed,\n+\t\t\t\t    bool autoneg_wait_to_complete)\n+{\n+\ts32 status = 0;\n+\tu32 link_speed = TXGBE_LINK_SPEED_UNKNOWN;\n+\ts32 i, j;\n+\tbool link_up = false;\n+\tu32 autoc_reg = rd32_epcs(hw, SR_AN_MMD_ADV_REG1);\n+\n+\tDEBUGFUNC(\"txgbe_setup_mac_link_smartspeed\");\n+\n+\t /* Set autoneg_advertised value based on input link speed */\n+\thw->phy.autoneg_advertised = 0;\n+\n+\tif (speed & TXGBE_LINK_SPEED_10GB_FULL)\n+\t\thw->phy.autoneg_advertised |= TXGBE_LINK_SPEED_10GB_FULL;\n+\n+\tif (speed & TXGBE_LINK_SPEED_1GB_FULL)\n+\t\thw->phy.autoneg_advertised |= TXGBE_LINK_SPEED_1GB_FULL;\n+\n+\tif (speed & TXGBE_LINK_SPEED_100M_FULL)\n+\t\thw->phy.autoneg_advertised |= TXGBE_LINK_SPEED_100M_FULL;\n+\n+\t/*\n+\t * Implement Intel SmartSpeed algorithm.  SmartSpeed will reduce the\n+\t * autoneg advertisement if link is unable to be established at the\n+\t * highest negotiated rate.  This can sometimes happen due to integrity\n+\t * issues with the physical media connection.\n+\t */\n+\n+\t/* First, try to get link with full advertisement */\n+\thw->phy.smart_speed_active = false;\n+\tfor (j = 0; j < TXGBE_SMARTSPEED_MAX_RETRIES; j++) {\n+\t\tstatus = txgbe_setup_mac_link(hw, speed,\n+\t\t\t\t\t\t    autoneg_wait_to_complete);\n+\t\tif (status != 0)\n+\t\t\tgoto out;\n+\n+\t\t/*\n+\t\t * Wait for the controller to acquire link.  Per IEEE 802.3ap,\n+\t\t * Section 73.10.2, we may have to wait up to 500ms if KR is\n+\t\t * attempted, or 200ms if KX/KX4/BX/BX4 is attempted, per\n+\t\t * Table 9 in the AN MAS.\n+\t\t */\n+\t\tfor (i = 0; i < 5; i++) {\n+\t\t\tmsec_delay(100);\n+\n+\t\t\t/* If we have link, just jump out */\n+\t\t\tstatus = hw->mac.check_link(hw, &link_speed, &link_up,\n+\t\t\t\t\t\t  false);\n+\t\t\tif (status != 0)\n+\t\t\t\tgoto out;\n+\n+\t\t\tif (link_up)\n+\t\t\t\tgoto out;\n+\t\t}\n+\t}\n+\n+\t/*\n+\t * We didn't get link.  If we advertised KR plus one of KX4/KX\n+\t * (or BX4/BX), then disable KR and try again.\n+\t */\n+\tif (((autoc_reg & TXGBE_AUTOC_KR_SUPP) == 0) ||\n+\t    ((autoc_reg & TXGBE_AUTOC_KX_SUPP) == 0 &&\n+\t     (autoc_reg & TXGBE_AUTOC_KX4_SUPP) == 0))\n+\t\tgoto out;\n+\n+\t/* Turn SmartSpeed on to disable KR support */\n+\thw->phy.smart_speed_active = true;\n+\tstatus = txgbe_setup_mac_link(hw, speed,\n+\t\t\t\t\t    autoneg_wait_to_complete);\n+\tif (status != 0)\n+\t\tgoto out;\n+\n+\t/*\n+\t * Wait for the controller to acquire link.  600ms will allow for\n+\t * the AN link_fail_inhibit_timer as well for multiple cycles of\n+\t * parallel detect, both 10g and 1g. This allows for the maximum\n+\t * connect attempts as defined in the AN MAS table 73-7.\n+\t */\n+\tfor (i = 0; i < 6; i++) {\n+\t\tmsec_delay(100);\n+\n+\t\t/* If we have link, just jump out */\n+\t\tstatus = hw->mac.check_link(hw, &link_speed, &link_up, false);\n+\t\tif (status != 0)\n+\t\t\tgoto out;\n+\n+\t\tif (link_up)\n+\t\t\tgoto out;\n+\t}\n+\n+\t/* We didn't get link.  Turn SmartSpeed back off. */\n+\thw->phy.smart_speed_active = false;\n+\tstatus = txgbe_setup_mac_link(hw, speed,\n+\t\t\t\t\t    autoneg_wait_to_complete);\n+\n+out:\n+\tif (link_up && link_speed == TXGBE_LINK_SPEED_1GB_FULL)\n+\t\tDEBUGOUT(\"Smartspeed has downgraded the link speed \"\n+\t\t\"from the maximum advertised\\n\");\n+\treturn status;\n+}\n+\n /**\n  *  txgbe_setup_mac_link - Set MAC link speed\n  *  @hw: pointer to hardware structure\ndiff --git a/drivers/net/txgbe/base/txgbe_hw.h b/drivers/net/txgbe/base/txgbe_hw.h\nindex 506e4b13a..5a64bceeb 100644\n--- a/drivers/net/txgbe/base/txgbe_hw.h\n+++ b/drivers/net/txgbe/base/txgbe_hw.h\n@@ -21,11 +21,22 @@ void txgbe_clear_tx_pending(struct txgbe_hw *hw);\n \n s32 txgbe_reset_pipeline_raptor(struct txgbe_hw *hw);\n \n+s32 txgbe_setup_mac_link_multispeed_fiber(struct txgbe_hw *hw,\n+\t\t\t\t\t  u32 speed,\n+\t\t\t\t\t  bool autoneg_wait_to_complete);\n s32 txgbe_init_shared_code(struct txgbe_hw *hw);\n s32 txgbe_set_mac_type(struct txgbe_hw *hw);\n s32 txgbe_init_ops_pf(struct txgbe_hw *hw);\n s32 txgbe_get_link_capabilities_raptor(struct txgbe_hw *hw,\n \t\t\t\t      u32 *speed, bool *autoneg);\n+void txgbe_disable_tx_laser_multispeed_fiber(struct txgbe_hw *hw);\n+void txgbe_enable_tx_laser_multispeed_fiber(struct txgbe_hw *hw);\n+void txgbe_flap_tx_laser_multispeed_fiber(struct txgbe_hw *hw);\n+void txgbe_set_hard_rate_select_speed(struct txgbe_hw *hw,\n+\t\t\t\t\tu32 speed);\n+s32 txgbe_setup_mac_link_smartspeed(struct txgbe_hw *hw,\n+\t\t\t\t    u32 speed,\n+\t\t\t\t    bool autoneg_wait_to_complete);\n s32 txgbe_start_mac_link_raptor(struct txgbe_hw *hw,\n \t\t\t       bool autoneg_wait_to_complete);\n s32 txgbe_setup_mac_link(struct txgbe_hw *hw, u32 speed,\n",
    "prefixes": [
        "v4",
        "16/58"
    ]
}