get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 838022,
    "url": "http://patchwork.ozlabs.org/api/patches/838022/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20171114120052.86665-7-alice.michael@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": "<20171114120052.86665-7-alice.michael@intel.com>",
    "list_archive_url": null,
    "date": "2017-11-14T12:00:50",
    "name": "[next,S82-V4,7/9] i40e: link_down_on_close private flag support",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "618060f54925d02021c0c08742ea84bde8e674e6",
    "submitter": {
        "id": 71123,
        "url": "http://patchwork.ozlabs.org/api/people/71123/?format=api",
        "name": "Michael, Alice",
        "email": "alice.michael@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/20171114120052.86665-7-alice.michael@intel.com/mbox/",
    "series": [
        {
            "id": 13564,
            "url": "http://patchwork.ozlabs.org/api/series/13564/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=13564",
            "date": "2017-11-14T12:00:46",
            "name": "[next,S82-V4,1/9] i40evf: Do not clear MSI-X PBA manually",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/13564/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/838022/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/838022/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@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"
        ],
        "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.138; helo=whitealder.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
        "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 3ybzVl1kjlz9ryv\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 15 Nov 2017 07:23:59 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 45B5786D56;\n\tTue, 14 Nov 2017 20:23:57 +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 j14JavP4bRV5; Tue, 14 Nov 2017 20:23:53 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 33EDF872D3;\n\tTue, 14 Nov 2017 20:23:48 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 4E9F61BFC3F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 14 Nov 2017 20:07:05 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 3ADD588041\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 14 Nov 2017 20:07:05 +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 tCoPB2hoCB-e for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 14 Nov 2017 20:07:03 +0000 (UTC)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 613B0878EE\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 14 Nov 2017 20:07:00 +0000 (UTC)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t14 Nov 2017 12:06:59 -0800",
            "from unknown (HELO localhost.jf.intel.com) ([10.166.16.121])\n\tby fmsmga001.fm.intel.com with ESMTP; 14 Nov 2017 12:06:59 -0800"
        ],
        "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.44,396,1505804400\"; d=\"scan'208\";a=\"2651469\"",
        "From": "Alice Michael <alice.michael@intel.com>",
        "To": "alice.michael@intel.com,\n\tintel-wired-lan@lists.osuosl.org",
        "Date": "Tue, 14 Nov 2017 07:00:50 -0500",
        "Message-Id": "<20171114120052.86665-7-alice.michael@intel.com>",
        "X-Mailer": "git-send-email 2.9.5",
        "In-Reply-To": "<20171114120052.86665-1-alice.michael@intel.com>",
        "References": "<20171114120052.86665-1-alice.michael@intel.com>",
        "Subject": "[Intel-wired-lan] [next PATCH S82-V4 7/9] i40e: link_down_on_close\n\tprivate flag support",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.24",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Cc": "Mariusz Stachura <mariusz.stachura@intel.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Mariusz Stachura <mariusz.stachura@intel.com>\n\nThis patch introduces new ethtool private flag used for\nforcing true link state. Function i40e_force_link_state that implements\nthis functionality was added, it sets phy_type = 0 in order to\nwork-around firmware's LESM. False positive error messages were\nsuppressed.\n\nSigned-off-by: Mariusz Stachura <mariusz.stachura@intel.com>\nSigned-off-by: Mitch Williams <mitch.a.williams@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_ethtool.c |  2 +\n drivers/net/ethernet/intel/i40e/i40e_main.c    | 71 ++++++++++++++++++++++++++\n 2 files changed, 73 insertions(+)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\nindex 2e5ccdd..15dfb55 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n@@ -230,6 +230,8 @@ static const struct i40e_priv_flags i40e_gstrings_priv_flags[] = {\n \tI40E_PRIV_FLAG(\"flow-director-atr\", I40E_FLAG_FD_ATR_ENABLED, 0),\n \tI40E_PRIV_FLAG(\"veb-stats\", I40E_FLAG_VEB_STATS_ENABLED, 0),\n \tI40E_PRIV_FLAG(\"hw-atr-eviction\", I40E_FLAG_HW_ATR_EVICT_ENABLED, 0),\n+\tI40E_PRIV_FLAG(\"link-down-on-close\",\n+\t\t       I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED, 0),\n \tI40E_PRIV_FLAG(\"legacy-rx\", I40E_FLAG_LEGACY_RX, 0),\n \tI40E_PRIV_FLAG(\"disable-source-pruning\",\n \t\t       I40E_FLAG_SOURCE_PRUNING_DISABLED, 0),\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 02880d8..813f71a 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -6607,6 +6607,72 @@ int i40e_up(struct i40e_vsi *vsi)\n }\n \n /**\n+ * i40e_force_link_state - Force the link status\n+ * @pf: board private structure\n+ * @is_up: whether the link state should be forced up or down\n+ **/\n+static void i40e_force_link_state(struct i40e_pf *pf, bool is_up)\n+{\n+\tstruct i40e_aq_get_phy_abilities_resp abilities;\n+\tstruct i40e_aq_set_phy_config config = {0};\n+\tstruct i40e_hw *hw = &pf->hw;\n+\tenum i40e_aq_phy_type cnt;\n+\tu64 mask = 0;\n+\ti40e_status err;\n+\n+\t/* Get the current phy config */\n+\terr = i40e_aq_get_phy_capabilities(hw, false, false, &abilities,\n+\t\t\t\t\t   NULL);\n+\tif (err)\n+\t\tdev_dbg(&pf->pdev->dev,\n+\t\t\t\"failed to get phy cap., ret =  %s last_status =  %s\\n\",\n+\t\t\ti40e_stat_str(hw, err),\n+\t\t\ti40e_aq_str(hw, hw->aq.asq_last_status));\n+\n+\t/* If link needs to go up, but was not forced to go down,\n+\t * no need for a flap\n+\t */\n+\tif (is_up && abilities.phy_type != 0)\n+\t\treturn;\n+\n+\t/* To force link we need to set bits for all supported PHY types,\n+\t * but there are now more than 32, so we need to split the bitmap\n+\t * across two fields.\n+\t */\n+\tfor (cnt = I40E_PHY_TYPE_SGMII; cnt < I40E_PHY_TYPE_MAX; cnt++)\n+\t\tmask |= (1ULL << cnt);\n+\n+\tconfig.phy_type = is_up ? cpu_to_le32((u32)(mask & 0xffffffff)) : 0;\n+\tconfig.phy_type_ext = is_up ? (u8)((mask >> 32) & 0xff) : 0;\n+\t/* Copy the old settings, except of phy_type */\n+\tconfig.abilities = abilities.abilities;\n+\tconfig.link_speed = abilities.link_speed;\n+\tconfig.eee_capability = abilities.eee_capability;\n+\tconfig.eeer = abilities.eeer_val;\n+\tconfig.low_power_ctrl = abilities.d3_lpan;\n+\terr = i40e_aq_set_phy_config(hw, &config, NULL);\n+\n+\tif (err)\n+\t\tdev_dbg(&pf->pdev->dev,\n+\t\t\t\"set phy config ret =  %s last_status =  %s\\n\",\n+\t\t\ti40e_stat_str(&pf->hw, err),\n+\t\t\ti40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));\n+\n+\t/* Update the link info */\n+\terr = i40e_update_link_info(hw);\n+\tif (err) {\n+\t\t/* Wait a little bit (on 40G cards it sometimes takes a really\n+\t\t * long time for link to come back from the atomic reset)\n+\t\t * and try once more\n+\t\t */\n+\t\tmsleep(1000);\n+\t\ti40e_update_link_info(hw);\n+\t}\n+\n+\ti40e_aq_set_link_restart_an(hw, true, NULL);\n+}\n+\n+/**\n  * i40e_down - Shutdown the connection processing\n  * @vsi: the VSI being stopped\n  **/\n@@ -6623,6 +6689,9 @@ void i40e_down(struct i40e_vsi *vsi)\n \t}\n \ti40e_vsi_disable_irq(vsi);\n \ti40e_vsi_stop_rings(vsi);\n+\tif (vsi->type == I40E_VSI_MAIN &&\n+\t    vsi->back->flags & I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED)\n+\t\ti40e_force_link_state(vsi->back, false);\n \ti40e_napi_disable_all(vsi);\n \n \tfor (i = 0; i < vsi->num_queue_pairs; i++) {\n@@ -7585,6 +7654,8 @@ int i40e_open(struct net_device *netdev)\n \n \tnetif_carrier_off(netdev);\n \n+\ti40e_force_link_state(pf, true);\n+\n \terr = i40e_vsi_open(vsi);\n \tif (err)\n \t\treturn err;\n",
    "prefixes": [
        "next",
        "S82-V4",
        "7/9"
    ]
}