get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 675749,
    "url": "http://patchwork.ozlabs.org/api/patches/675749/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1475001072-42418-1-git-send-email-donald.c.skidmore@intel.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": "<1475001072-42418-1-git-send-email-donald.c.skidmore@intel.com>",
    "list_archive_url": null,
    "date": "2016-09-27T18:31:12",
    "name": "ixgbe: Add X553 PHY FC autoneg support",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "952a079ec84858ef6b647a90139ed05e2d01b36c",
    "submitter": {
        "id": 4487,
        "url": "http://patchwork.ozlabs.org/api/people/4487/?format=api",
        "name": "Skidmore, Donald C",
        "email": "donald.c.skidmore@intel.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/1475001072-42418-1-git-send-email-donald.c.skidmore@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/675749/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/675749/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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\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 3sk7HD167lz9s9Y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 28 Sep 2016 03:33:59 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 8C79831CA3;\n\tTue, 27 Sep 2016 17:33:57 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id LIpHlUa4a0kf; Tue, 27 Sep 2016 17:33:43 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 34AD731C6A;\n\tTue, 27 Sep 2016 17:33:43 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 6A79A1C1005\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 27 Sep 2016 17:33:42 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 633098F6C9\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 27 Sep 2016 17:33:42 +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 S5fFbO-qsdEV for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 27 Sep 2016 17:33:38 +0000 (UTC)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 5963B900AE\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 27 Sep 2016 17:33:38 +0000 (UTC)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga102.jf.intel.com with ESMTP; 27 Sep 2016 10:33:37 -0700",
            "from dcskidmo-m40.jf.intel.com ([134.134.3.25])\n\tby orsmga003.jf.intel.com with ESMTP; 27 Sep 2016 10:33:37 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.30,405,1470726000\"; d=\"scan'208\";a=\"884362079\"",
        "From": "Donald C Skidmore <donald.c.skidmore@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Tue, 27 Sep 2016 14:31:12 -0400",
        "Message-Id": "<1475001072-42418-1-git-send-email-donald.c.skidmore@intel.com>",
        "X-Mailer": "git-send-email 2.4.3",
        "Subject": "[Intel-wired-lan] [PATCH] ixgbe: Add X553 PHY FC autoneg support",
        "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": "This patch adds X553 flow control auto negotiation for fiber and\nbackplain.  To enable this new function pointers were added as well\nas creating a function to dynamically set function pointer we can't\ndefine only on MAC type.\n\nSigned-off-by: Don Skidmore <donald.c.skidmore@intel.com>\n---\n drivers/net/ethernet/intel/ixgbe/ixgbe.h        |   2 +\n drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c  |   3 +-\n drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c  |   1 +\n drivers/net/ethernet/intel/ixgbe/ixgbe_common.c |  16 +-\n drivers/net/ethernet/intel/ixgbe/ixgbe_type.h   |   6 +\n drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c   |   1 +\n drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c   | 211 ++++++++++++++++++++++++\n 7 files changed, 232 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h\nindex b06e32d..ef81c3d 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h\n@@ -1027,4 +1027,6 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,\n \t\t\t\t  struct ixgbe_ring *tx_ring);\n u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter);\n void ixgbe_store_reta(struct ixgbe_adapter *adapter);\n+s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,\n+\t\t       u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm);\n #endif /* _IXGBE_H_ */\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c\nindex fb51be7..1b7009b 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c\n@@ -367,7 +367,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)\n \t}\n \n \t/* Negotiate the fc mode to use */\n-\tixgbe_fc_autoneg(hw);\n+\thw->mac.ops.fc_autoneg(hw);\n \n \t/* Disable any previous flow control settings */\n \tfctrl_reg = IXGBE_READ_REG(hw, IXGBE_FCTRL);\n@@ -1193,6 +1193,7 @@ static const struct ixgbe_mac_operations mac_ops_82598 = {\n \t.set_vfta\t\t= &ixgbe_set_vfta_82598,\n \t.fc_enable\t\t= &ixgbe_fc_enable_82598,\n \t.setup_fc\t\t= ixgbe_setup_fc_generic,\n+\t.fc_autoneg\t\t= ixgbe_fc_autoneg,\n \t.set_fw_drv_ver         = NULL,\n \t.acquire_swfw_sync      = &ixgbe_acquire_swfw_sync,\n \t.release_swfw_sync      = &ixgbe_release_swfw_sync,\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c\nindex 63b2500..709af71 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c\n@@ -2219,6 +2219,7 @@ static const struct ixgbe_mac_operations mac_ops_82599 = {\n \t.set_vfta               = &ixgbe_set_vfta_generic,\n \t.fc_enable              = &ixgbe_fc_enable_generic,\n \t.setup_fc\t\t= ixgbe_setup_fc_generic,\n+\t.fc_autoneg\t\t= ixgbe_fc_autoneg,\n \t.set_fw_drv_ver         = &ixgbe_set_fw_drv_ver_generic,\n \t.init_uta_tables        = &ixgbe_init_uta_tables_generic,\n \t.setup_sfp              = &ixgbe_setup_sfp_modules_82599,\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c\nindex 77d3039..deac764 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c\n@@ -298,10 +298,12 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)\n \tIXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext);\n \tIXGBE_WRITE_FLUSH(hw);\n \n-\t/* Setup flow control */\n-\tret_val = hw->mac.ops.setup_fc(hw);\n-\tif (ret_val)\n-\t\treturn ret_val;\n+\t/* Setup flow control if method for doing so */\n+\tif (hw->mac.ops.setup_fc) {\n+\t\tret_val = hw->mac.ops.setup_fc(hw);\n+\t\tif (ret_val)\n+\t\t\treturn ret_val;\n+\t}\n \n \t/* Cashe bit indicating need for crosstalk fix */\n \tswitch (hw->mac.type) {\n@@ -2127,7 +2129,7 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw)\n \t}\n \n \t/* Negotiate the fc mode to use */\n-\tixgbe_fc_autoneg(hw);\n+\thw->mac.ops.fc_autoneg(hw);\n \n \t/* Disable any previous flow control settings */\n \tmflcn_reg = IXGBE_READ_REG(hw, IXGBE_MFLCN);\n@@ -2231,8 +2233,8 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw)\n  *  Find the intersection between advertised settings and link partner's\n  *  advertised settings\n  **/\n-static s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,\n-\t\t\t      u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)\n+s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,\n+\t\t       u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)\n {\n \tif ((!(adv_reg)) ||  (!(lp_reg)))\n \t\treturn IXGBE_ERR_FC_NOT_NEGOTIATED;\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h\nindex 31d82e3..00fdd8e 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h\n@@ -3372,6 +3372,7 @@ struct ixgbe_mac_operations {\n \t/* Flow Control */\n \ts32 (*fc_enable)(struct ixgbe_hw *);\n \ts32 (*setup_fc)(struct ixgbe_hw *);\n+\tvoid (*fc_autoneg)(struct ixgbe_hw *);\n \n \t/* Manageability interface */\n \ts32 (*set_fw_drv_ver)(struct ixgbe_hw *, u8, u8, u8, u8);\n@@ -3593,10 +3594,12 @@ struct ixgbe_info {\n #define IXGBE_FUSES0_REV_MASK\t\t(3u << 6)\n \n #define IXGBE_KRM_PORT_CAR_GEN_CTRL(P)\t((P) ? 0x8010 : 0x4010)\n+#define IXGBE_KRM_LINK_S1(P)\t\t((P) ? 0x8200 : 0x4200)\n #define IXGBE_KRM_LINK_CTRL_1(P)\t((P) ? 0x820C : 0x420C)\n #define IXGBE_KRM_AN_CNTL_1(P)\t\t((P) ? 0x822C : 0x422C)\n #define IXGBE_KRM_AN_CNTL_8(P)\t\t((P) ? 0x8248 : 0x4248)\n #define IXGBE_KRM_SGMII_CTRL(P)\t\t((P) ? 0x82A0 : 0x42A0)\n+#define IXGBE_KRM_LP_BASE_PAGE_HIGH(P)\t((P) ? 0x836C : 0x436C)\n #define IXGBE_KRM_DSP_TXFFE_STATE_4(P)\t((P) ? 0x8634 : 0x4634)\n #define IXGBE_KRM_DSP_TXFFE_STATE_5(P)\t((P) ? 0x8638 : 0x4638)\n #define IXGBE_KRM_RX_TRN_LINKUP_CTRL(P)\t((P) ? 0x8B00 : 0x4B00)\n@@ -3618,6 +3621,7 @@ struct ixgbe_info {\n #define IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_KR\t\tBIT(18)\n #define IXGBE_KRM_LINK_CTRL_1_TETH_EEE_CAP_KX\t\tBIT(24)\n #define IXGBE_KRM_LINK_CTRL_1_TETH_EEE_CAP_KR\t\tBIT(26)\n+#define IXGBE_KRM_LINK_S1_MAC_AN_COMPLETE\t\tBIT(28)\n #define IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE\t\tBIT(29)\n #define IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART\t\tBIT(31)\n \n@@ -3627,6 +3631,8 @@ struct ixgbe_info {\n #define IXGBE_KRM_AN_CNTL_8_LINEAR\t\t\tBIT(0)\n #define IXGBE_KRM_AN_CNTL_8_LIMITING\t\t\tBIT(1)\n \n+#define IXGBE_KRM_LP_BASE_PAGE_HIGH_SYM_PAUSE\t\tBIT(10)\n+#define IXGBE_KRM_LP_BASE_PAGE_HIGH_ASM_PAUSE\t\tBIT(11)\n #define IXGBE_KRM_SGMII_CTRL_MAC_TAR_FORCE_100_D\tBIT(12)\n #define IXGBE_KRM_SGMII_CTRL_MAC_TAR_FORCE_10_D\t\tBIT(19)\n \ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c\nindex f2b1d48..22425c2 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c\n@@ -866,6 +866,7 @@ static const struct ixgbe_mac_operations mac_ops_X540 = {\n \t.set_vfta               = &ixgbe_set_vfta_generic,\n \t.fc_enable              = &ixgbe_fc_enable_generic,\n \t.setup_fc\t\t= ixgbe_setup_fc_generic,\n+\t.fc_autoneg\t\t= ixgbe_fc_autoneg,\n \t.set_fw_drv_ver         = &ixgbe_set_fw_drv_ver_generic,\n \t.init_uta_tables        = &ixgbe_init_uta_tables_generic,\n \t.setup_sfp              = NULL,\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c\nindex 3e3458e..1546251 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c\n@@ -28,6 +28,9 @@\n \n static s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *, ixgbe_link_speed);\n static s32 ixgbe_setup_fc_x550em(struct ixgbe_hw *);\n+static void ixgbe_fc_autoneg_fiber_x550em_a(struct ixgbe_hw *);\n+static void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *);\n+static s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *);\n \n static s32 ixgbe_get_invariants_X550_x(struct ixgbe_hw *hw)\n {\n@@ -1635,6 +1638,27 @@ ixgbe_setup_sgmii(struct ixgbe_hw *hw, __always_unused ixgbe_link_speed speed,\n \treturn rc;\n }\n \n+/** ixgbe_init_mac_link_ops_X550em_a - Init mac link function pointers\n+ *  @hw: pointer to hardware structure\n+ **/\n+static void ixgbe_init_mac_link_ops_X550em_a(struct ixgbe_hw *hw)\n+{\n+\tstruct ixgbe_mac_info *mac = &hw->mac;\n+\n+\tswitch (mac->ops.get_media_type(hw)) {\n+\tcase ixgbe_media_type_fiber:\n+\t\tmac->ops.setup_fc = NULL;\n+\t\tmac->ops.fc_autoneg = ixgbe_fc_autoneg_fiber_x550em_a;\n+\t\tbreak;\n+\tcase ixgbe_media_type_backplane:\n+\t\tmac->ops.fc_autoneg = ixgbe_fc_autoneg_backplane_x550em_a;\n+\t\tmac->ops.setup_fc = ixgbe_setup_fc_backplane_x550em_a;\n+\t\tbreak;\n+\tdefault:\n+\t\tbreak;\n+\t}\n+}\n+\n /** ixgbe_init_mac_link_ops_X550em - init mac link function pointers\n  *  @hw: pointer to hardware structure\n  **/\n@@ -1682,6 +1706,10 @@ static void ixgbe_init_mac_link_ops_X550em(struct ixgbe_hw *hw)\n \tdefault:\n \t\tbreak;\n \t}\n+\n+\t/* Additional modification for X550em_a devices */\n+\tif (hw->mac.type == ixgbe_mac_x550em_a)\n+\t\tixgbe_init_mac_link_ops_X550em_a(hw);\n }\n \n /** ixgbe_setup_sfp_modules_X550em - Setup SFP module\n@@ -2299,6 +2327,90 @@ static s32 ixgbe_setup_fc_x550em(struct ixgbe_hw *hw)\n \treturn rc;\n }\n \n+/**\n+ *  ixgbe_fc_autoneg_backplane_x550em_a - Enable flow control IEEE clause 37\n+ *  @hw: pointer to hardware structure\n+ **/\n+static void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw)\n+{\n+\tu32 link_s1, lp_an_page_low, an_cntl_1;\n+\ts32 status = IXGBE_ERR_FC_NOT_NEGOTIATED;\n+\tixgbe_link_speed speed;\n+\tbool link_up;\n+\n+\t/* AN should have completed when the cable was plugged in.\n+\t * Look for reasons to bail out.  Bail out if:\n+\t * - FC autoneg is disabled, or if\n+\t * - link is not up.\n+\t */\n+\tif (hw->fc.disable_fc_autoneg) {\n+\t\thw_err(hw, \"Flow control autoneg is disabled\");\n+\t\tgoto out;\n+\t}\n+\n+\thw->mac.ops.check_link(hw, &speed, &link_up, false);\n+\tif (!link_up) {\n+\t\thw_err(hw, \"The link is down\");\n+\t\tgoto out;\n+\t}\n+\n+\t/* Check at auto-negotiation has completed */\n+\tstatus = hw->mac.ops.read_iosf_sb_reg(hw,\n+\t\t\t\t\tIXGBE_KRM_LINK_S1(hw->bus.lan_id),\n+\t\t\t\t\tIXGBE_SB_IOSF_TARGET_KR_PHY, &link_s1);\n+\n+\tif (status || (link_s1 & IXGBE_KRM_LINK_S1_MAC_AN_COMPLETE) == 0) {\n+\t\thw_dbg(hw, \"Auto-Negotiation did not complete\\n\");\n+\t\tstatus = IXGBE_ERR_FC_NOT_NEGOTIATED;\n+\t\tgoto out;\n+\t}\n+\n+\t/* Read the 10g AN autoc and LP ability registers and resolve\n+\t * local flow control settings accordingly\n+\t */\n+\tstatus = hw->mac.ops.read_iosf_sb_reg(hw,\n+\t\t\t\tIXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),\n+\t\t\t\tIXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl_1);\n+\n+\tif (status) {\n+\t\thw_dbg(hw, \"Auto-Negotiation did not complete\\n\");\n+\t\tgoto out;\n+\t}\n+\n+\tstatus = hw->mac.ops.read_iosf_sb_reg(hw,\n+\t\t\t\tIXGBE_KRM_LP_BASE_PAGE_HIGH(hw->bus.lan_id),\n+\t\t\t\tIXGBE_SB_IOSF_TARGET_KR_PHY, &lp_an_page_low);\n+\n+\tif (status) {\n+\t\thw_dbg(hw, \"Auto-Negotiation did not complete\\n\");\n+\t\tgoto out;\n+\t}\n+\n+\tstatus = ixgbe_negotiate_fc(hw, an_cntl_1, lp_an_page_low,\n+\t\t\t\t    IXGBE_KRM_AN_CNTL_1_SYM_PAUSE,\n+\t\t\t\t    IXGBE_KRM_AN_CNTL_1_ASM_PAUSE,\n+\t\t\t\t    IXGBE_KRM_LP_BASE_PAGE_HIGH_SYM_PAUSE,\n+\t\t\t\t    IXGBE_KRM_LP_BASE_PAGE_HIGH_ASM_PAUSE);\n+\n+out:\n+\tif (!status) {\n+\t\thw->fc.fc_was_autonegged = true;\n+\t} else {\n+\t\thw->fc.fc_was_autonegged = false;\n+\t\thw->fc.current_mode = hw->fc.requested_mode;\n+\t}\n+}\n+\n+/**\n+ *  ixgbe_fc_autoneg_fiber_x550em_a - passthrough FC settings\n+ *  @hw: pointer to hardware structure\n+ **/\n+static void ixgbe_fc_autoneg_fiber_x550em_a(struct ixgbe_hw *hw)\n+{\n+\thw->fc.fc_was_autonegged = false;\n+\thw->fc.current_mode = hw->fc.requested_mode;\n+}\n+\n /** ixgbe_enter_lplu_x550em - Transition to low power states\n  *  @hw: pointer to hardware structure\n  *\n@@ -2747,6 +2859,102 @@ static void ixgbe_set_source_address_pruning_X550(struct ixgbe_hw *hw,\n }\n \n /**\n+ *  ixgbe_setup_fc_backplane_x550em_a - Set up flow control\n+ *  @hw: pointer to hardware structure\n+ *\n+ *  Called at init time to set up flow control.\n+ **/\n+static s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)\n+{\n+\ts32 status = 0;\n+\tu32 link_ctrl = 0;\n+\tu32 an_cntl = 0;\n+\n+\t/* Validate the requested mode */\n+\tif (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {\n+\t\thw_err(hw, \"ixgbe_fc_rx_pause not valid in strict IEEE mode\\n\");\n+\t\treturn IXGBE_ERR_INVALID_LINK_SETTINGS;\n+\t}\n+\n+\tif (hw->fc.requested_mode == ixgbe_fc_default)\n+\t\thw->fc.requested_mode = ixgbe_fc_full;\n+\n+\t/* Set up the 1G and 10G flow control advertisement registers so the\n+\t * HW will be able to do FC autoneg once the cable is plugged in.  If\n+\t * we link at 10G, the 1G advertisement is harmless and vice versa.\n+\t */\n+\tstatus = hw->mac.ops.read_iosf_sb_reg(hw,\n+\t\t\t\t\tIXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),\n+\t\t\t\t\tIXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl);\n+\n+\tif (status) {\n+\t\thw_dbg(hw, \"Auto-Negotiation did not complete\\n\");\n+\t\treturn status;\n+\t}\n+\n+\t/* The possible values of fc.requested_mode are:\n+\t * 0: Flow control is completely disabled\n+\t * 1: Rx flow control is enabled (we can receive pause frames,\n+\t *    but not send pause frames).\n+\t * 2: Tx flow control is enabled (we can send pause frames but\n+\t *    we do not support receiving pause frames).\n+\t * 3: Both Rx and Tx flow control (symmetric) are enabled.\n+\t * other: Invalid.\n+\t */\n+\tswitch (hw->fc.requested_mode) {\n+\tcase ixgbe_fc_none:\n+\t\t/* Flow control completely disabled by software override. */\n+\t\tan_cntl &= ~(IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |\n+\t\t\t     IXGBE_KRM_AN_CNTL_1_ASM_PAUSE);\n+\t\tbreak;\n+\tcase ixgbe_fc_tx_pause:\n+\t\t/* Tx Flow control is enabled, and Rx Flow control is\n+\t\t * disabled by software override.\n+\t\t */\n+\t\tan_cntl |= IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;\n+\t\tan_cntl &= ~IXGBE_KRM_AN_CNTL_1_SYM_PAUSE;\n+\t\tbreak;\n+\tcase ixgbe_fc_rx_pause:\n+\t\t/* Rx Flow control is enabled and Tx Flow control is\n+\t\t * disabled by software override. Since there really\n+\t\t * isn't a way to advertise that we are capable of RX\n+\t\t * Pause ONLY, we will advertise that we support both\n+\t\t * symmetric and asymmetric Rx PAUSE, as such we fall\n+\t\t * through to the fc_full statement.  Later, we will\n+\t\t * disable the adapter's ability to send PAUSE frames.\n+\t\t */\n+\tcase ixgbe_fc_full:\n+\t\t/* Flow control (both Rx and Tx) is enabled by SW override. */\n+\t\tan_cntl |= IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |\n+\t\t\t   IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;\n+\t\tbreak;\n+\tdefault:\n+\t\thw_err(hw, \"Flow control param set incorrectly\\n\");\n+\t\treturn IXGBE_ERR_CONFIG;\n+\t}\n+\n+\tstatus = hw->mac.ops.write_iosf_sb_reg(hw,\n+\t\t\t\t\tIXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),\n+\t\t\t\t\tIXGBE_SB_IOSF_TARGET_KR_PHY, an_cntl);\n+\n+\t/* Restart auto-negotiation. */\n+\tstatus = hw->mac.ops.read_iosf_sb_reg(hw,\n+\t\t\t\tIXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),\n+\t\t\t\tIXGBE_SB_IOSF_TARGET_KR_PHY, &link_ctrl);\n+\tif (status) {\n+\t\thw_dbg(hw, \"Auto-Negotiation did not complete\\n\");\n+\t\treturn status;\n+\t}\n+\n+\tlink_ctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;\n+\tstatus = hw->mac.ops.write_iosf_sb_reg(hw,\n+\t\t\t\tIXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),\n+\t\t\t\tIXGBE_SB_IOSF_TARGET_KR_PHY, link_ctrl);\n+\n+\treturn status;\n+}\n+\n+/**\n  * ixgbe_set_mux - Set mux for port 1 access with CS4227\n  * @hw: pointer to hardware structure\n  * @state: set mux if 1, clear if 0\n@@ -2966,6 +3174,7 @@ static const struct ixgbe_mac_operations mac_ops_X550 = {\n \t.prot_autoc_read\t= prot_autoc_read_generic,\n \t.prot_autoc_write\t= prot_autoc_write_generic,\n \t.setup_fc\t\t= ixgbe_setup_fc_generic,\n+\t.fc_autoneg\t\t= ixgbe_fc_autoneg,\n };\n \n static const struct ixgbe_mac_operations mac_ops_X550EM_x = {\n@@ -2984,6 +3193,7 @@ static const struct ixgbe_mac_operations mac_ops_X550EM_x = {\n \t.release_swfw_sync\t= &ixgbe_release_swfw_sync_X550em,\n \t.init_swfw_sync\t\t= &ixgbe_init_swfw_sync_X540,\n \t.setup_fc\t\t= NULL, /* defined later */\n+\t.fc_autoneg\t\t= ixgbe_fc_autoneg,\n \t.read_iosf_sb_reg\t= ixgbe_read_iosf_sb_reg_x550,\n \t.write_iosf_sb_reg\t= ixgbe_write_iosf_sb_reg_x550,\n };\n@@ -3003,6 +3213,7 @@ static struct ixgbe_mac_operations mac_ops_x550em_a = {\n \t.acquire_swfw_sync\t= ixgbe_acquire_swfw_sync_x550em_a,\n \t.release_swfw_sync\t= ixgbe_release_swfw_sync_x550em_a,\n \t.setup_fc\t\t= ixgbe_setup_fc_x550em,\n+\t.fc_autoneg\t\t= NULL, /* defined later */\n \t.read_iosf_sb_reg\t= ixgbe_read_iosf_sb_reg_x550a,\n \t.write_iosf_sb_reg\t= ixgbe_write_iosf_sb_reg_x550a,\n };\n",
    "prefixes": []
}