get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 77389,
    "url": "http://patches.dpdk.org/api/patches/77389/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200911131954.15999-3-qi.z.zhang@intel.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": "<20200911131954.15999-3-qi.z.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200911131954.15999-3-qi.z.zhang@intel.com",
    "date": "2020-09-11T13:19:16",
    "name": "[v2,02/40] net/ice/base: split caps discover into two functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "2ce1bcc1f120fe2d49ec70b12d2f7171e4f194dc",
    "submitter": {
        "id": 504,
        "url": "http://patches.dpdk.org/api/people/504/?format=api",
        "name": "Qi Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200911131954.15999-3-qi.z.zhang@intel.com/mbox/",
    "series": [
        {
            "id": 12148,
            "url": "http://patches.dpdk.org/api/series/12148/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=12148",
            "date": "2020-09-11T13:19:15",
            "name": "ice base code update",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/12148/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/77389/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/77389/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 64F8EA04B7;\n\tFri, 11 Sep 2020 15:16:23 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 74F0F1C0D7;\n\tFri, 11 Sep 2020 15:16:06 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n by dpdk.org (Postfix) with ESMTP id 564491B75C\n for <dev@dpdk.org>; Fri, 11 Sep 2020 15:16:02 +0200 (CEST)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 11 Sep 2020 06:16:01 -0700",
            "from dpdk51.sh.intel.com ([10.67.111.82])\n by FMSMGA003.fm.intel.com with ESMTP; 11 Sep 2020 06:16:00 -0700"
        ],
        "IronPort-SDR": [
            "\n i5pbK8Sw0rIiqBw9knBu93AW60u9FgLOohCnB6xzZuz05BJdsSukXuYugfYMDAvsgeq9v39Guj\n nebuZeTjWPxA==",
            "\n bLTr4vfwVRwo4lxVbWhDpKoioHjhX0+TePGq6bblNE4XA0AKCTxyWuWx/oY/abaJNasH0+a5Jf\n Kc8cp6v010/Q=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9740\"; a=\"146482091\"",
            "E=Sophos;i=\"5.76,415,1592895600\"; d=\"scan'208\";a=\"146482091\"",
            "E=Sophos;i=\"5.76,415,1592895600\"; d=\"scan'208\";a=\"342296403\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Qi Zhang <qi.z.zhang@intel.com>",
        "To": "ferruh.yigit@intel.com",
        "Cc": "dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>,\n Jacob Keller <jacob.e.keller@intel.com>",
        "Date": "Fri, 11 Sep 2020 21:19:16 +0800",
        "Message-Id": "<20200911131954.15999-3-qi.z.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.13.6",
        "In-Reply-To": "<20200911131954.15999-1-qi.z.zhang@intel.com>",
        "References": "<20200907112826.48493-1-qi.z.zhang@intel.com>\n <20200911131954.15999-1-qi.z.zhang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 02/40] net/ice/base: split caps discover into\n\ttwo functions",
        "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": "Using the new ice_aq_list_caps and ice_parse_(dev|func)_caps functions,\nreplace ice_discover_caps with two functions that each take a pointer to\nthe dev_caps and func_caps structures respectively.\n\nThis makes the side effect of updating the hw->dev_caps and\nhw->func_caps obvious from reading the implementation of the function.\nAdditionally, it opens the way for enabling reading of device\ncapabilities outside of the initialization flow. By passing in\na pointer, another caller will be able to read the capabilities without\nmodifying the hw capabilities structures.\n\nAs there are no other callers, it is safe to now remove\nice_aq_discover_caps and ice_parse_caps.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\nSigned-off-by: Qi Zhang <qi.z.zhang@intel.com>\nAcked-by: Qiming Yang <qiming.yang@intel.com>\n---\n drivers/net/ice/base/ice_common.c | 94 ++++++++++++++++-----------------------\n 1 file changed, 39 insertions(+), 55 deletions(-)",
    "diff": "diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c\nindex 6168fb4f0..ec8d46017 100644\n--- a/drivers/net/ice/base/ice_common.c\n+++ b/drivers/net/ice/base/ice_common.c\n@@ -87,7 +87,8 @@ enum ice_status ice_clear_pf_cfg(struct ice_hw *hw)\n  * is returned in user specified buffer. Please interpret user specified\n  * buffer as \"manage_mac_read\" response.\n  * Response such as various MAC addresses are stored in HW struct (port.mac)\n- * ice_aq_discover_caps is expected to be called before this function is called.\n+ * ice_discover_dev_caps is expected to be called before this function is\n+ * called.\n  */\n static enum ice_status\n ice_aq_manage_mac_read(struct ice_hw *hw, void *buf, u16 buf_size,\n@@ -2156,30 +2157,6 @@ ice_parse_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,\n }\n \n /**\n- * ice_parse_caps - parse function/device capabilities\n- * @hw: pointer to the HW struct\n- * @buf: pointer to a buffer containing function/device capability records\n- * @cap_count: number of capability records in the list\n- * @opc: type of capabilities list to parse\n- *\n- * Helper function to parse function(0x000a)/device(0x000b) capabilities list.\n- */\n-static void\n-ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count,\n-\t       enum ice_adminq_opc opc)\n-{\n-\tif (!buf)\n-\t\treturn;\n-\n-\tif (opc == ice_aqc_opc_list_dev_caps)\n-\t\tice_parse_dev_caps(hw, &hw->dev_caps, buf, cap_count);\n-\telse if (opc == ice_aqc_opc_list_func_caps)\n-\t\tice_parse_func_caps(hw, &hw->func_caps, buf, cap_count);\n-\telse\n-\t\tice_debug(hw, ICE_DBG_INIT, \"wrong opcode\\n\");\n-}\n-\n-/**\n  * ice_aq_list_caps - query function/device capabilities\n  * @hw: pointer to the HW struct\n  * @buf: a buffer to hold the capabilities\n@@ -2222,47 +2199,52 @@ ice_aq_list_caps(struct ice_hw *hw, void *buf, u16 buf_size, u32 *cap_count,\n }\n \n /**\n- * ice_aq_discover_caps - query function/device capabilities\n- * @hw: pointer to the HW struct\n- * @buf: a virtual buffer to hold the capabilities\n- * @buf_size: Size of the virtual buffer\n- * @cap_count: cap count needed if AQ err==ENOMEM\n- * @opc: capabilities type to discover - pass in the command opcode\n- * @cd: pointer to command details structure or NULL\n- *\n- * Get the function(0x000a)/device(0x000b) capabilities description from\n- * the firmware.\n+ * ice_discover_dev_caps - Read and extract device capabilities\n+ * @hw: pointer to the hardware structure\n+ * @dev_caps: pointer to device capabilities structure\n  *\n- * NOTE: this function has the side effect of updating the hw->dev_caps or\n- * hw->func_caps by way of calling ice_parse_caps.\n+ * Read the device capabilities and extract them into the dev_caps structure\n+ * for later use.\n  */\n static enum ice_status\n-ice_aq_discover_caps(struct ice_hw *hw, void *buf, u16 buf_size, u32 *cap_count,\n-\t\t     enum ice_adminq_opc opc, struct ice_sq_cd *cd)\n+ice_discover_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_caps)\n {\n-\tu32 local_cap_count = 0;\n \tenum ice_status status;\n+\tu32 cap_count = 0;\n+\tvoid *cbuf;\n \n-\tstatus = ice_aq_list_caps(hw, buf, buf_size, &local_cap_count,\n-\t\t\t\t  opc, cd);\n+\tcbuf = ice_malloc(hw, ICE_AQ_MAX_BUF_LEN);\n+\tif (!cbuf)\n+\t\treturn ICE_ERR_NO_MEMORY;\n+\n+\t/* Although the driver doesn't know the number of capabilities the\n+\t * device will return, we can simply send a 4KB buffer, the maximum\n+\t * possible size that firmware can return.\n+\t */\n+\tcap_count = ICE_AQ_MAX_BUF_LEN / sizeof(struct ice_aqc_list_caps_elem);\n+\n+\tstatus = ice_aq_list_caps(hw, cbuf, ICE_AQ_MAX_BUF_LEN, &cap_count,\n+\t\t\t\t  ice_aqc_opc_list_dev_caps, NULL);\n \tif (!status)\n-\t\tice_parse_caps(hw, buf, local_cap_count, opc);\n-\telse if (hw->adminq.sq_last_status == ICE_AQ_RC_ENOMEM)\n-\t\t*cap_count = local_cap_count;\n+\t\tice_parse_dev_caps(hw, dev_caps, cbuf, cap_count);\n+\tice_free(hw, cbuf);\n \n \treturn status;\n }\n \n /**\n- * ice_discover_caps - get info about the HW\n+ * ice_discover_func_caps - Read and extract function capabilities\n  * @hw: pointer to the hardware structure\n- * @opc: capabilities type to discover - pass in the command opcode\n+ * @func_caps: pointer to function capabilities structure\n+ *\n+ * Read the function capabilities and extract them into the func_caps structure\n+ * for later use.\n  */\n static enum ice_status\n-ice_discover_caps(struct ice_hw *hw, enum ice_adminq_opc opc)\n+ice_discover_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_caps)\n {\n \tenum ice_status status;\n-\tu32 cap_count;\n+\tu32 cap_count = 0;\n \tvoid *cbuf;\n \n \tcbuf = ice_malloc(hw, ICE_AQ_MAX_BUF_LEN);\n@@ -2275,8 +2257,10 @@ ice_discover_caps(struct ice_hw *hw, enum ice_adminq_opc opc)\n \t */\n \tcap_count = ICE_AQ_MAX_BUF_LEN / sizeof(struct ice_aqc_list_caps_elem);\n \n-\tstatus = ice_aq_discover_caps(hw, cbuf, ICE_AQ_MAX_BUF_LEN, &cap_count,\n-\t\t\t\t      opc, NULL);\n+\tstatus = ice_aq_list_caps(hw, cbuf, ICE_AQ_MAX_BUF_LEN, &cap_count,\n+\t\t\t\t  ice_aqc_opc_list_func_caps, NULL);\n+\tif (!status)\n+\t\tice_parse_func_caps(hw, func_caps, cbuf, cap_count);\n \tice_free(hw, cbuf);\n \n \treturn status;\n@@ -2354,11 +2338,11 @@ enum ice_status ice_get_caps(struct ice_hw *hw)\n {\n \tenum ice_status status;\n \n-\tstatus = ice_discover_caps(hw, ice_aqc_opc_list_dev_caps);\n-\tif (!status)\n-\t\tstatus = ice_discover_caps(hw, ice_aqc_opc_list_func_caps);\n+\tstatus = ice_discover_dev_caps(hw, &hw->dev_caps);\n+\tif (status)\n+\t\treturn status;\n \n-\treturn status;\n+\treturn ice_discover_func_caps(hw, &hw->func_caps);\n }\n \n /**\n",
    "prefixes": [
        "v2",
        "02/40"
    ]
}