get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1253341,
    "url": "http://patchwork.ozlabs.org/api/patches/1253341/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200312015818.1007882-9-jacob.e.keller@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": "<20200312015818.1007882-9-jacob.e.keller@intel.com>",
    "list_archive_url": null,
    "date": "2020-03-12T01:58:17",
    "name": "[v3,8/9] ice: add basic handler for devlink .info_get",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "309791ac41f518a08b9fef82d89ac550c8855baa",
    "submitter": {
        "id": 9784,
        "url": "http://patchwork.ozlabs.org/api/people/9784/?format=api",
        "name": "Jacob Keller",
        "email": "jacob.e.keller@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/20200312015818.1007882-9-jacob.e.keller@intel.com/mbox/",
    "series": [
        {
            "id": 163869,
            "url": "http://patchwork.ozlabs.org/api/series/163869/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=163869",
            "date": "2020-03-12T01:58:10",
            "name": "ice devlink support",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/163869/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1253341/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1253341/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; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.137;\n\thelo=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 48dBnM3KZvz9sPK\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 12 Mar 2020 12:58:31 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id CE2B9863A1;\n\tThu, 12 Mar 2020 01:58:29 +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 HY-7bVlOilji; Thu, 12 Mar 2020 01:58:28 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 7FE5D8692B;\n\tThu, 12 Mar 2020 01:58:28 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 8187F1BF9B9\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Mar 2020 01:58:24 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 7F0AC86193\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Mar 2020 01:58:24 +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 g1-5Hf_OpTuh for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Mar 2020 01:58:23 +0000 (UTC)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 638C186268\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Mar 2020 01:58:23 +0000 (UTC)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t11 Mar 2020 18:58:22 -0700",
            "from jekeller-desk.amr.corp.intel.com ([10.166.241.33])\n\tby orsmga008.jf.intel.com with ESMTP; 11 Mar 2020 18:58:21 -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-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.70,543,1574150400\"; d=\"scan'208\";a=\"236656322\"",
        "From": "Jacob Keller <jacob.e.keller@intel.com>",
        "To": "Intel Wired LAN <intel-wired-lan@lists.osuosl.org>",
        "Date": "Wed, 11 Mar 2020 18:58:17 -0700",
        "Message-Id": "<20200312015818.1007882-9-jacob.e.keller@intel.com>",
        "X-Mailer": "git-send-email 2.24.1",
        "In-Reply-To": "<20200312015818.1007882-1-jacob.e.keller@intel.com>",
        "References": "<20200312015818.1007882-1-jacob.e.keller@intel.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH v3 8/9] ice: add basic handler for devlink\n\t.info_get",
        "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>",
        "Cc": "Jakub Kicinski <kuba@kernel.org>",
        "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": "The devlink .info_get callback allows the driver to report detailed\nversion information. The following devlink versions are reported with\nthis initial implementation:\n\n \"fw.mgmt\" -> The version of the firmware that controls PHY, link, etc\n \"fw.mgmt.api\" -> API version of interface exposed over the AdminQ\n \"fw.mgmt.build\" -> Unique build id of the source for the management fw\n \"fw.undi\" -> Version of the Option ROM containing the UEFI driver\n \"fw.psid.api\" -> Version of the NVM image format.\n \"fw.bundle_id\" -> Unique identifier for the combined flash image.\n \"fw.app.name\" -> The name of the active DDP package.\n \"fw.app\" -> The version of the active DDP package.\n\nWith this, devlink dev info can report at least as much information as\nis reported by ETHTOOL_GDRVINFO.\n\nCompare the output from ethtool vs from devlink:\n\n  $ ethtool -i ens785s0\n  driver: ice\n  version: 0.8.1-k\n  firmware-version: 0.80 0x80002ec0 1.2581.0\n  expansion-rom-version:\n  bus-info: 0000:3b:00.0\n  supports-statistics: yes\n  supports-test: yes\n  supports-eeprom-access: yes\n  supports-register-dump: yes\n  supports-priv-flags: yes\n\n  $ devlink dev info pci/0000:3b:00.0\n  pci/0000:3b:00.0:\n  driver ice\n  serial number 00-01-ab-ff-ff-ca-05-68\n  versions:\n      running:\n        fw.mgmt 2.1.7\n        fw.mgmt.api 1.5\n        fw.mgmt.build 0x305d955f\n        fw.undi 1.2581.0\n        fw.psid.api 0.80\n        fw.bundle_id 0x80002ec0\n        fw.app.name ICE OS Default Package\n        fw.app 1.3.1.0\n\nMore pieces of information can be displayed, each version is kept\nseparate instead of munged together, and each version has an identifier\nwhich comes with associated documentation.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n Documentation/networking/devlink/ice.rst     |  67 +++++++\n Documentation/networking/devlink/index.rst   |   1 +\n drivers/net/ethernet/intel/ice/ice_devlink.c | 189 +++++++++++++++++++\n 3 files changed, 257 insertions(+)\n create mode 100644 Documentation/networking/devlink/ice.rst",
    "diff": "diff --git a/Documentation/networking/devlink/ice.rst b/Documentation/networking/devlink/ice.rst\nnew file mode 100644\nindex 000000000000..56739a51cdfe\n--- /dev/null\n+++ b/Documentation/networking/devlink/ice.rst\n@@ -0,0 +1,67 @@\n+.. SPDX-License-Identifier: GPL-2.0\n+\n+===================\n+ice devlink support\n+===================\n+\n+This document describes the devlink features implemented by the ``ice``\n+device driver.\n+\n+Info versions\n+=============\n+\n+The ``ice`` driver reports the following versions\n+\n+.. list-table:: devlink info versions implemented\n+    :widths: 5 5 5 90\n+\n+    * - Name\n+      - Type\n+      - Example\n+      - Description\n+    * - ``fw.mgmt``\n+      - running\n+      - 2.1.7\n+      - 3-digit version number of the management firmware that controls the\n+        PHY, link, etc.\n+    * - ``fw.mgmt.api``\n+      - running\n+      - 1.5\n+      - 2-digit version number of the API exported over the AdminQ by the\n+        management firmware. Used by the driver to identify what commands\n+        are supported.\n+    * - ``fw.mgmt.build``\n+      - running\n+      - 0x305d955f\n+      - Unique identifier of the source for the management firmware.\n+    * - ``fw.undi``\n+      - running\n+      - 1.2581.0\n+      - Version of the Option ROM containing the UEFI driver. The version is\n+        reported in ``major.minor.patch`` format. The major version is\n+        incremented whenever a major breaking change occurs, or when the\n+        minor version would overflow. The minor version is incremented for\n+        non-breaking changes and reset to 1 when the major version is\n+        incremented. The patch version is normally 0 but is incremented when\n+        a fix is delivered as a patch against an older base Option ROM.\n+    * - ``fw.psid.api``\n+      - running\n+      - 0.80\n+      - Version defining the format of the flash contents.\n+    * - ``fw.bundle_id``\n+      - running\n+      - 0x80002ec0\n+      - Unique identifier of the firmware image file that was loaded onto\n+        the device. Also referred to as the EETRACK identifier of the NVM.\n+    * - ``fw.app.name``\n+      - running\n+      - ICE OS Default Package\n+      - The name of the DDP package that is active in the device. The DDP\n+        package is loaded by the driver during initialization. Each varation\n+        of DDP package shall have a unique name.\n+    * - ``fw.app``\n+      - running\n+      - 1.3.1.0\n+      - The version of the DDP package that is active in the device. Note\n+        that both the name (as reported by ``fw.app.name``) and version are\n+        required to uniquely identify the package.\ndiff --git a/Documentation/networking/devlink/index.rst b/Documentation/networking/devlink/index.rst\nindex 087ff54d53fc..272509cd9215 100644\n--- a/Documentation/networking/devlink/index.rst\n+++ b/Documentation/networking/devlink/index.rst\n@@ -32,6 +32,7 @@ parameters, info versions, and other features it supports.\n \n    bnxt\n    ionic\n+   ice\n    mlx4\n    mlx5\n    mlxsw\ndiff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/ethernet/intel/ice/ice_devlink.c\nindex cedd9d02299e..410e2b531e5d 100644\n--- a/drivers/net/ethernet/intel/ice/ice_devlink.c\n+++ b/drivers/net/ethernet/intel/ice/ice_devlink.c\n@@ -2,9 +2,198 @@\n /* Copyright (c) 2020, Intel Corporation. */\n \n #include \"ice.h\"\n+#include \"ice_lib.h\"\n #include \"ice_devlink.h\"\n \n+static int ice_info_get_dsn(struct ice_pf *pf, char *buf, size_t len)\n+{\n+\tu8 dsn[8];\n+\n+\t/* Copy the DSN into an array in Big Endian format */\n+\tput_unaligned_be64(pci_get_dsn(pf->pdev), dsn);\n+\n+\tsnprintf(buf, len, \"%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x\",\n+\t\t dsn[0], dsn[1], dsn[2], dsn[3],\n+\t\t dsn[4], dsn[5], dsn[6], dsn[7]);\n+\n+\treturn 0;\n+}\n+\n+static int ice_info_fw_mgmt(struct ice_pf *pf, char *buf, size_t len)\n+{\n+\tstruct ice_hw *hw = &pf->hw;\n+\n+\tsnprintf(buf, len, \"%u.%u.%u\", hw->fw_maj_ver, hw->fw_min_ver,\n+\t\t hw->fw_patch);\n+\n+\treturn 0;\n+}\n+\n+static int ice_info_fw_api(struct ice_pf *pf, char *buf, size_t len)\n+{\n+\tstruct ice_hw *hw = &pf->hw;\n+\n+\tsnprintf(buf, len, \"%u.%u\", hw->api_maj_ver, hw->api_min_ver);\n+\n+\treturn 0;\n+}\n+\n+static int ice_info_fw_build(struct ice_pf *pf, char *buf, size_t len)\n+{\n+\tstruct ice_hw *hw = &pf->hw;\n+\n+\tsnprintf(buf, len, \"0x%08x\", hw->fw_build);\n+\n+\treturn 0;\n+}\n+\n+static int ice_info_orom_ver(struct ice_pf *pf, char *buf, size_t len)\n+{\n+\tstruct ice_orom_info *orom = &pf->hw.nvm.orom;\n+\n+\tsnprintf(buf, len, \"%u.%u.%u\", orom->major, orom->build, orom->patch);\n+\n+\treturn 0;\n+}\n+\n+static int ice_info_nvm_ver(struct ice_pf *pf, char *buf, size_t len)\n+{\n+\tstruct ice_nvm_info *nvm = &pf->hw.nvm;\n+\n+\tsnprintf(buf, len, \"%x.%02x\", nvm->major_ver, nvm->minor_ver);\n+\n+\treturn 0;\n+}\n+\n+static int ice_info_eetrack(struct ice_pf *pf, char *buf, size_t len)\n+{\n+\tstruct ice_nvm_info *nvm = &pf->hw.nvm;\n+\n+\tsnprintf(buf, len, \"0x%08x\", nvm->eetrack);\n+\n+\treturn 0;\n+}\n+\n+static int ice_info_ddp_pkg_name(struct ice_pf *pf, char *buf, size_t len)\n+{\n+\tstruct ice_hw *hw = &pf->hw;\n+\n+\tsnprintf(buf, len, \"%s\", hw->active_pkg_name);\n+\n+\treturn 0;\n+}\n+\n+static int ice_info_ddp_pkg_version(struct ice_pf *pf, char *buf, size_t len)\n+{\n+\tstruct ice_pkg_ver *pkg = &pf->hw.active_pkg_ver;\n+\n+\tsnprintf(buf, len, \"%u.%u.%u.%u\", pkg->major, pkg->minor, pkg->update,\n+\t\t pkg->draft);\n+\n+\treturn 0;\n+}\n+\n+#define running(key, getter) { ICE_VERSION_RUNNING, key, getter }\n+\n+enum ice_version_type {\n+\tICE_VERSION_FIXED,\n+\tICE_VERSION_RUNNING,\n+\tICE_VERSION_STORED,\n+};\n+\n+static const struct ice_devlink_version {\n+\tenum ice_version_type type;\n+\tconst char *key;\n+\tint (*getter)(struct ice_pf *pf, char *buf, size_t len);\n+} ice_devlink_versions[] = {\n+\trunning(DEVLINK_INFO_VERSION_GENERIC_FW_MGMT, ice_info_fw_mgmt),\n+\trunning(\"fw.mgmt.api\", ice_info_fw_api),\n+\trunning(\"fw.mgmt.build\", ice_info_fw_build),\n+\trunning(DEVLINK_INFO_VERSION_GENERIC_FW_UNDI, ice_info_orom_ver),\n+\trunning(\"fw.psid.api\", ice_info_nvm_ver),\n+\trunning(DEVLINK_INFO_VERSION_GENERIC_FW_BUNDLE_ID, ice_info_eetrack),\n+\trunning(\"fw.app.name\", ice_info_ddp_pkg_name),\n+\trunning(DEVLINK_INFO_VERSION_GENERIC_FW_APP, ice_info_ddp_pkg_version),\n+};\n+\n+/**\n+ * ice_devlink_info_get - .info_get devlink handler\n+ * @devlink: devlink instance structure\n+ * @req: the devlink info request\n+ * @extack: extended netdev ack structure\n+ *\n+ * Callback for the devlink .info_get operation. Reports information about the\n+ * device.\n+ *\n+ * @returns zero on success or an error code on failure.\n+ */\n+static int ice_devlink_info_get(struct devlink *devlink,\n+\t\t\t\tstruct devlink_info_req *req,\n+\t\t\t\tstruct netlink_ext_ack *extack)\n+{\n+\tstruct ice_pf *pf = devlink_priv(devlink);\n+\tchar buf[100];\n+\tsize_t i;\n+\tint err;\n+\n+\terr = devlink_info_driver_name_put(req, KBUILD_MODNAME);\n+\tif (err) {\n+\t\tNL_SET_ERR_MSG_MOD(extack, \"Unable to set driver name\");\n+\t\treturn err;\n+\t}\n+\n+\terr = ice_info_get_dsn(pf, buf, sizeof(buf));\n+\tif (err) {\n+\t\tNL_SET_ERR_MSG_MOD(extack, \"Unable to obtain serial number\");\n+\t\treturn err;\n+\t}\n+\n+\terr = devlink_info_serial_number_put(req, buf);\n+\tif (err) {\n+\t\tNL_SET_ERR_MSG_MOD(extack, \"Unable to set serial number\");\n+\t\treturn err;\n+\t}\n+\n+\tfor (i = 0; i < ARRAY_SIZE(ice_devlink_versions); i++) {\n+\t\tenum ice_version_type type = ice_devlink_versions[i].type;\n+\t\tconst char *key = ice_devlink_versions[i].key;\n+\n+\t\terr = ice_devlink_versions[i].getter(pf, buf, sizeof(buf));\n+\t\tif (err) {\n+\t\t\tNL_SET_ERR_MSG_MOD(extack, \"Unable to obtain version info\");\n+\t\t\treturn err;\n+\t\t}\n+\n+\t\tswitch (type) {\n+\t\tcase ICE_VERSION_FIXED:\n+\t\t\terr = devlink_info_version_fixed_put(req, key, buf);\n+\t\t\tif (err) {\n+\t\t\t\tNL_SET_ERR_MSG_MOD(extack, \"Unable to set fixed version\");\n+\t\t\t\treturn err;\n+\t\t\t}\n+\t\t\tbreak;\n+\t\tcase ICE_VERSION_RUNNING:\n+\t\t\terr = devlink_info_version_running_put(req, key, buf);\n+\t\t\tif (err) {\n+\t\t\t\tNL_SET_ERR_MSG_MOD(extack, \"Unable to set running version\");\n+\t\t\t\treturn err;\n+\t\t\t}\n+\t\t\tbreak;\n+\t\tcase ICE_VERSION_STORED:\n+\t\t\terr = devlink_info_version_stored_put(req, key, buf);\n+\t\t\tif (err) {\n+\t\t\t\tNL_SET_ERR_MSG_MOD(extack, \"Unable to set stored version\");\n+\t\t\t\treturn err;\n+\t\t\t}\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n static const struct devlink_ops ice_devlink_ops = {\n+\t.info_get = ice_devlink_info_get,\n };\n \n static void ice_devlink_free(void *devlink_ptr)\n",
    "prefixes": [
        "v3",
        "8/9"
    ]
}