get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1016220,
    "url": "http://patchwork.ozlabs.org/api/patches/1016220/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20181219180334.1104-8-anirudh.venkataramanan@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": "<20181219180334.1104-8-anirudh.venkataramanan@intel.com>",
    "list_archive_url": null,
    "date": "2018-12-19T18:03:26",
    "name": "[S10,07/15] ice: Add ethtool private flag to make forcing link down optional",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ca66e0e210e755e50b175d4d3f78d9512ae5f9d6",
    "submitter": {
        "id": 73601,
        "url": "http://patchwork.ozlabs.org/api/people/73601/?format=api",
        "name": "Anirudh Venkataramanan",
        "email": "anirudh.venkataramanan@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/20181219180334.1104-8-anirudh.venkataramanan@intel.com/mbox/",
    "series": [
        {
            "id": 82906,
            "url": "http://patchwork.ozlabs.org/api/series/82906/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=82906",
            "date": "2018-12-19T18:03:28",
            "name": "Feature updates for ice",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/82906/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1016220/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1016220/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.137; helo=fraxinus.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 43KjSJ5X0jz9sB5\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 20 Dec 2018 05:03:44 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 2390B85B4D;\n\tWed, 19 Dec 2018 18:03:43 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id ibnbLD7tkAMV; Wed, 19 Dec 2018 18:03:41 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id B1E7185C95;\n\tWed, 19 Dec 2018 18:03:40 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id A11B31C2A9B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 19 Dec 2018 18:03:37 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 9A26985507\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 19 Dec 2018 18:03:37 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id rKWei4aj3ATM for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 19 Dec 2018 18:03:37 +0000 (UTC)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id E112B85B45\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 19 Dec 2018 18:03:36 +0000 (UTC)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Dec 2018 10:03:35 -0800",
            "from shasta.jf.intel.com ([10.166.241.11])\n\tby fmsmga002.fm.intel.com with ESMTP; 19 Dec 2018 10:03:35 -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-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.56,373,1539673200\"; d=\"scan'208\";a=\"127400078\"",
        "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Wed, 19 Dec 2018 10:03:26 -0800",
        "Message-Id": "<20181219180334.1104-8-anirudh.venkataramanan@intel.com>",
        "X-Mailer": "git-send-email 2.14.5",
        "In-Reply-To": "<20181219180334.1104-1-anirudh.venkataramanan@intel.com>",
        "References": "<20181219180334.1104-1-anirudh.venkataramanan@intel.com>",
        "Subject": "[Intel-wired-lan] [PATCH S10 07/15] ice: Add ethtool private flag\n\tto make forcing link down optional",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "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>",
        "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: Bruce Allan <bruce.w.allan@intel.com>\n\nAdd new infrastructure for implementing ethtool private flags using the\nexisting pf->flags bitmap to store them, and add the link-down-on-close\nethtool private flag to optionally bring down the PHY link when the\ninterface is administratively downed.\n\nSigned-off-by: Bruce Allan <bruce.w.allan@intel.com>\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice.h         |  1 +\n drivers/net/ethernet/intel/ice/ice_ethtool.c | 86 ++++++++++++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_main.c    | 14 +++--\n 3 files changed, 95 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h\nindex a385575600f6..8af882a2b070 100644\n--- a/drivers/net/ethernet/intel/ice/ice.h\n+++ b/drivers/net/ethernet/intel/ice/ice.h\n@@ -270,6 +270,7 @@ enum ice_pf_flags {\n \tICE_FLAG_RSS_ENA,\n \tICE_FLAG_SRIOV_ENA,\n \tICE_FLAG_SRIOV_CAPABLE,\n+\tICE_FLAG_LINK_DOWN_ON_CLOSE_ENA,\n \tICE_PF_FLAGS_NBITS\t\t/* must be last */\n };\n \ndiff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c\nindex 2a0bcd460d23..24c8aeaea2d5 100644\n--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c\n+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c\n@@ -114,6 +114,22 @@ static const u32 ice_regs_dump_list[] = {\n \tQRX_ITR(0),\n };\n \n+struct ice_priv_flag {\n+\tchar name[ETH_GSTRING_LEN];\n+\tu32 bitno;\t\t\t/* bit position in pf->flags */\n+};\n+\n+#define ICE_PRIV_FLAG(_name, _bitno) { \\\n+\t.name = _name, \\\n+\t.bitno = _bitno, \\\n+}\n+\n+static const struct ice_priv_flag ice_gstrings_priv_flags[] = {\n+\tICE_PRIV_FLAG(\"link-down-on-close\", ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA),\n+};\n+\n+#define ICE_PRIV_FLAG_ARRAY_SIZE\tARRAY_SIZE(ice_gstrings_priv_flags)\n+\n /**\n  * ice_nvm_version_str - format the NVM version strings\n  * @hw: ptr to the hardware info\n@@ -152,6 +168,7 @@ ice_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)\n \t\tsizeof(drvinfo->fw_version));\n \tstrlcpy(drvinfo->bus_info, pci_name(pf->pdev),\n \t\tsizeof(drvinfo->bus_info));\n+\tdrvinfo->n_priv_flags = ICE_PRIV_FLAG_ARRAY_SIZE;\n }\n \n static int ice_get_regs_len(struct net_device __always_unused *netdev)\n@@ -292,6 +309,13 @@ static void ice_get_strings(struct net_device *netdev, u32 stringset, u8 *data)\n \t\t\tp += ETH_GSTRING_LEN;\n \t\t}\n \n+\t\tbreak;\n+\tcase ETH_SS_PRIV_FLAGS:\n+\t\tfor (i = 0; i < ICE_PRIV_FLAG_ARRAY_SIZE; i++) {\n+\t\t\tsnprintf(p, ETH_GSTRING_LEN, \"%s\",\n+\t\t\t\t ice_gstrings_priv_flags[i].name);\n+\t\t\tp += ETH_GSTRING_LEN;\n+\t\t}\n \t\tbreak;\n \tdefault:\n \t\tbreak;\n@@ -321,6 +345,64 @@ ice_set_phys_id(struct net_device *netdev, enum ethtool_phys_id_state state)\n \treturn 0;\n }\n \n+/**\n+ * ice_get_priv_flags - report device private flags\n+ * @netdev: network interface device structure\n+ *\n+ * The get string set count and the string set should be matched for each\n+ * flag returned.  Add new strings for each flag to the ice_gstrings_priv_flags\n+ * array.\n+ *\n+ * Returns a u32 bitmap of flags.\n+ */\n+static u32 ice_get_priv_flags(struct net_device *netdev)\n+{\n+\tstruct ice_netdev_priv *np = netdev_priv(netdev);\n+\tstruct ice_vsi *vsi = np->vsi;\n+\tstruct ice_pf *pf = vsi->back;\n+\tu32 i, ret_flags = 0;\n+\n+\tfor (i = 0; i < ICE_PRIV_FLAG_ARRAY_SIZE; i++) {\n+\t\tconst struct ice_priv_flag *priv_flag;\n+\n+\t\tpriv_flag = &ice_gstrings_priv_flags[i];\n+\n+\t\tif (test_bit(priv_flag->bitno, pf->flags))\n+\t\t\tret_flags |= BIT(i);\n+\t}\n+\n+\treturn ret_flags;\n+}\n+\n+/**\n+ * ice_set_priv_flags - set private flags\n+ * @netdev: network interface device structure\n+ * @flags: bit flags to be set\n+ */\n+static int ice_set_priv_flags(struct net_device *netdev, u32 flags)\n+{\n+\tstruct ice_netdev_priv *np = netdev_priv(netdev);\n+\tstruct ice_vsi *vsi = np->vsi;\n+\tstruct ice_pf *pf = vsi->back;\n+\tu32 i;\n+\n+\tif (flags > BIT(ICE_PRIV_FLAG_ARRAY_SIZE))\n+\t\treturn -EINVAL;\n+\n+\tfor (i = 0; i < ICE_PRIV_FLAG_ARRAY_SIZE; i++) {\n+\t\tconst struct ice_priv_flag *priv_flag;\n+\n+\t\tpriv_flag = &ice_gstrings_priv_flags[i];\n+\n+\t\tif (flags & BIT(i))\n+\t\t\tset_bit(priv_flag->bitno, pf->flags);\n+\t\telse\n+\t\t\tclear_bit(priv_flag->bitno, pf->flags);\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int ice_get_sset_count(struct net_device *netdev, int sset)\n {\n \tswitch (sset) {\n@@ -344,6 +426,8 @@ static int ice_get_sset_count(struct net_device *netdev, int sset)\n \t\t * not safe.\n \t\t */\n \t\treturn ICE_ALL_STATS_LEN(netdev);\n+\tcase ETH_SS_PRIV_FLAGS:\n+\t\treturn ICE_PRIV_FLAG_ARRAY_SIZE;\n \tdefault:\n \t\treturn -EOPNOTSUPP;\n \t}\n@@ -1753,6 +1837,8 @@ static const struct ethtool_ops ice_ethtool_ops = {\n \t.get_strings\t\t= ice_get_strings,\n \t.set_phys_id\t\t= ice_set_phys_id,\n \t.get_ethtool_stats      = ice_get_ethtool_stats,\n+\t.get_priv_flags\t\t= ice_get_priv_flags,\n+\t.set_priv_flags\t\t= ice_set_priv_flags,\n \t.get_sset_count\t\t= ice_get_sset_count,\n \t.get_rxnfc\t\t= ice_get_rxnfc,\n \t.get_ringparam\t\t= ice_get_ringparam,\ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 6434deec359d..bcf4a9326446 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -3029,7 +3029,7 @@ static int ice_force_phys_link_state(struct ice_vsi *vsi, bool link_up)\n  */\n int ice_down(struct ice_vsi *vsi)\n {\n-\tint i, tx_err, rx_err, link_err;\n+\tint i, tx_err, rx_err, link_err = 0;\n \n \t/* Caller of this function is expected to set the\n \t * vsi->state __ICE_DOWN bit\n@@ -3054,11 +3054,13 @@ int ice_down(struct ice_vsi *vsi)\n \n \tice_napi_disable_all(vsi);\n \n-\tlink_err = ice_force_phys_link_state(vsi, false);\n-\tif (link_err)\n-\t\tnetdev_err(vsi->netdev,\n-\t\t\t   \"Failed to set physical link down, VSI %d error %d\\n\",\n-\t\t\t   vsi->vsi_num, link_err);\n+\tif (test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, vsi->back->flags)) {\n+\t\tlink_err = ice_force_phys_link_state(vsi, false);\n+\t\tif (link_err)\n+\t\t\tnetdev_err(vsi->netdev,\n+\t\t\t\t   \"Failed to set physical link down, VSI %d error %d\\n\",\n+\t\t\t\t   vsi->vsi_num, link_err);\n+\t}\n \n \tice_for_each_txq(vsi, i)\n \t\tice_clean_tx_ring(vsi->tx_rings[i]);\n",
    "prefixes": [
        "S10",
        "07/15"
    ]
}