get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 64487,
    "url": "http://patches.dpdk.org/api/patches/64487/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200113023949.26718-24-xiaolong.ye@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": "<20200113023949.26718-24-xiaolong.ye@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200113023949.26718-24-xiaolong.ye@intel.com",
    "date": "2020-01-13T02:39:35",
    "name": "[v4,23/36] net/i40e/base: add persistent lldp support",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "f24b1a6ca01d5060e281f2d51194ece4bbf71c5b",
    "submitter": {
        "id": 1120,
        "url": "http://patches.dpdk.org/api/people/1120/?format=api",
        "name": "Xiaolong Ye",
        "email": "xiaolong.ye@intel.com"
    },
    "delegate": {
        "id": 31221,
        "url": "http://patches.dpdk.org/api/users/31221/?format=api",
        "username": "yexl",
        "first_name": "xiaolong",
        "last_name": "ye",
        "email": "xiaolong.ye@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200113023949.26718-24-xiaolong.ye@intel.com/mbox/",
    "series": [
        {
            "id": 8064,
            "url": "http://patches.dpdk.org/api/series/8064/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8064",
            "date": "2020-01-13T02:39:12",
            "name": "update for i40e base code",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/8064/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/64487/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/64487/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 00875A04F0;\n\tMon, 13 Jan 2020 03:50:31 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id DE0321D616;\n\tMon, 13 Jan 2020 03:47:58 +0100 (CET)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by dpdk.org (Postfix) with ESMTP id 4CBA21D5A3\n for <dev@dpdk.org>; Mon, 13 Jan 2020 03:47:31 +0100 (CET)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n 12 Jan 2020 18:47:31 -0800",
            "from dpdk_yexl_af_xdp.sh.intel.com ([10.67.119.206])\n by FMSMGA003.fm.intel.com with ESMTP; 12 Jan 2020 18:47:30 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.69,427,1571727600\"; d=\"scan'208\";a=\"272916391\"",
        "From": "Xiaolong Ye <xiaolong.ye@intel.com>",
        "To": "Beilei Xing <beilei.xing@intel.com>,\n\tQi Zhang <qi.z.zhang@intel.com>",
        "Cc": "dev@dpdk.org, Xiaolong Ye <xiaolong.ye@intel.com>,\n Wnuczko Sylwia <sylwia.wnuczko@intel.com>",
        "Date": "Mon, 13 Jan 2020 10:39:35 +0800",
        "Message-Id": "<20200113023949.26718-24-xiaolong.ye@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200113023949.26718-1-xiaolong.ye@intel.com>",
        "References": "<20191202074935.97629-1-xiaolong.ye@intel.com>\n <20200113023949.26718-1-xiaolong.ye@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v4 23/36] net/i40e/base: add persistent lldp\n\tsupport",
        "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": "This patch adds a function to read nvm module data and uses it to\nread current lldp agent configuration from nvm api version 1.8.\n\nSigned-off-by: Wnuczko Sylwia <sylwia.wnuczko@intel.com>\nSigned-off-by: Xiaolong Ye <xiaolong.ye@intel.com>\n---\n drivers/net/i40e/base/i40e_dcb.c       | 20 +++++++-\n drivers/net/i40e/base/i40e_dcb.h       |  5 ++\n drivers/net/i40e/base/i40e_nvm.c       | 71 ++++++++++++++++++++++++++\n drivers/net/i40e/base/i40e_prototype.h |  3 ++\n 4 files changed, 98 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/i40e/base/i40e_dcb.c b/drivers/net/i40e/base/i40e_dcb.c\nindex f1465daa3..2ab5021ee 100644\n--- a/drivers/net/i40e/base/i40e_dcb.c\n+++ b/drivers/net/i40e/base/i40e_dcb.c\n@@ -877,7 +877,25 @@ enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)\n \t\treturn I40E_NOT_SUPPORTED;\n \n \t/* Read LLDP NVM area */\n-\tret = i40e_read_lldp_cfg(hw, &lldp_cfg);\n+\tif (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT) {\n+\t\tu8 offset = 0;\n+\n+\t\tif (hw->mac.type == I40E_MAC_XL710)\n+\t\t\toffset = I40E_LLDP_CURRENT_STATUS_XL710_OFFSET;\n+\t\telse if (hw->mac.type == I40E_MAC_X722)\n+\t\t\toffset = I40E_LLDP_CURRENT_STATUS_X722_OFFSET;\n+\t\telse\n+\t\t\treturn I40E_NOT_SUPPORTED;\n+\n+\t\tret = i40e_read_nvm_module_data(hw,\n+\t\t\t\t\t\tI40E_SR_EMP_SR_SETTINGS_PTR,\n+\t\t\t\t\t\toffset,\n+\t\t\t\t\t\tI40E_LLDP_CURRENT_STATUS_OFFSET,\n+\t\t\t\t\t\tI40E_LLDP_CURRENT_STATUS_SIZE,\n+\t\t\t\t\t\t&lldp_cfg.adminstatus);\n+\t} else {\n+\t\tret = i40e_read_lldp_cfg(hw, &lldp_cfg);\n+\t}\n \tif (ret)\n \t\treturn I40E_ERR_NOT_READY;\n \ndiff --git a/drivers/net/i40e/base/i40e_dcb.h b/drivers/net/i40e/base/i40e_dcb.h\nindex 88fe405d7..520c7db73 100644\n--- a/drivers/net/i40e/base/i40e_dcb.h\n+++ b/drivers/net/i40e/base/i40e_dcb.h\n@@ -39,6 +39,11 @@\n #define I40E_LLDP_ADMINSTATUS_ENABLED_TX\t2\n #define I40E_LLDP_ADMINSTATUS_ENABLED_RXTX\t3\n \n+#define I40E_LLDP_CURRENT_STATUS_XL710_OFFSET\t0x2B\n+#define I40E_LLDP_CURRENT_STATUS_X722_OFFSET\t0x31\n+#define I40E_LLDP_CURRENT_STATUS_OFFSET\t\t1\n+#define I40E_LLDP_CURRENT_STATUS_SIZE\t\t1\n+\n /* Defines for LLDP TLV header */\n #define I40E_LLDP_MIB_HLEN\t\t14\n #define I40E_LLDP_TLV_LEN_SHIFT\t\t0\ndiff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c\nindex c8b401cdd..fc24cc2ce 100644\n--- a/drivers/net/i40e/base/i40e_nvm.c\n+++ b/drivers/net/i40e/base/i40e_nvm.c\n@@ -337,6 +337,77 @@ enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,\n \treturn ret_code;\n }\n \n+/**\n+ * i40e_read_nvm_module_data - Reads NVM Buffer to specified memory location\n+ * @hw: Pointer to the HW structure\n+ * @module_ptr: Pointer to module in words with respect to NVM beginning\n+ * @module_offset: Offset in words from module start\n+ * @data_offset: Offset in words from reading data area start\n+ * @words_data_size: Words to read from NVM\n+ * @data_ptr: Pointer to memory location where resulting buffer will be stored\n+ **/\n+enum i40e_status_code\n+i40e_read_nvm_module_data(struct i40e_hw *hw, u8 module_ptr, u16 module_offset,\n+\t\t\t  u16 data_offset, u16 words_data_size, u16 *data_ptr)\n+{\n+\tenum i40e_status_code status;\n+\tu16 specific_ptr = 0;\n+\tu16 ptr_value = 0;\n+\tu16 offset = 0;\n+\n+\tif (module_ptr != 0) {\n+\t\tstatus = i40e_read_nvm_word(hw, module_ptr, &ptr_value);\n+\t\tif (status != I40E_SUCCESS) {\n+\t\t\ti40e_debug(hw, I40E_DEBUG_ALL,\n+\t\t\t\t   \"Reading nvm word failed.Error code: %d.\\n\",\n+\t\t\t\t   status);\n+\t\t\treturn I40E_ERR_NVM;\n+\t\t}\n+\t}\n+#define I40E_NVM_INVALID_PTR_VAL 0x7FFF\n+#define I40E_NVM_INVALID_VAL 0xFFFF\n+\n+\t/* Pointer not initialized */\n+\tif (ptr_value == I40E_NVM_INVALID_PTR_VAL ||\n+\t    ptr_value == I40E_NVM_INVALID_VAL) {\n+\t\ti40e_debug(hw, I40E_DEBUG_ALL, \"Pointer not initialized.\\n\");\n+\t\treturn I40E_ERR_BAD_PTR;\n+\t}\n+\n+\t/* Check whether the module is in SR mapped area or outside */\n+\tif (ptr_value & I40E_PTR_TYPE) {\n+\t\t/* Pointer points outside of the Shared RAM mapped area */\n+\t\ti40e_debug(hw, I40E_DEBUG_ALL,\n+\t\t\t   \"Reading nvm data failed. Pointer points outside of the Shared RAM mapped area.\\n\");\n+\n+\t\treturn I40E_ERR_PARAM;\n+\t} else {\n+\t\t/* Read from the Shadow RAM */\n+\n+\t\tstatus = i40e_read_nvm_word(hw, ptr_value + module_offset,\n+\t\t\t\t\t    &specific_ptr);\n+\t\tif (status != I40E_SUCCESS) {\n+\t\t\ti40e_debug(hw, I40E_DEBUG_ALL,\n+\t\t\t\t   \"Reading nvm word failed.Error code: %d.\\n\",\n+\t\t\t\t   status);\n+\t\t\treturn I40E_ERR_NVM;\n+\t\t}\n+\n+\t\toffset = ptr_value + module_offset + specific_ptr +\n+\t\t\tdata_offset;\n+\n+\t\tstatus = i40e_read_nvm_buffer(hw, offset, &words_data_size,\n+\t\t\t\t\t      data_ptr);\n+\t\tif (status != I40E_SUCCESS) {\n+\t\t\ti40e_debug(hw, I40E_DEBUG_ALL,\n+\t\t\t\t   \"Reading nvm buffer failed.Error code: %d.\\n\",\n+\t\t\t\t   status);\n+\t\t}\n+\t}\n+\n+\treturn status;\n+}\n+\n /**\n  * i40e_read_nvm_buffer_srctl - Reads Shadow RAM buffer via SRCTL register\n  * @hw: pointer to the HW structure\ndiff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h\nindex 43db2a6f3..afebf441d 100644\n--- a/drivers/net/i40e/base/i40e_prototype.h\n+++ b/drivers/net/i40e/base/i40e_prototype.h\n@@ -442,6 +442,9 @@ enum i40e_status_code i40e_acquire_nvm(struct i40e_hw *hw,\n void i40e_release_nvm(struct i40e_hw *hw);\n enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,\n \t\t\t\t\t u16 *data);\n+enum i40e_status_code\n+i40e_read_nvm_module_data(struct i40e_hw *hw, u8 module_ptr, u16 module_offset,\n+\t\t\t  u16 data_offset, u16 words_data_size, u16 *data_ptr);\n enum i40e_status_code i40e_read_nvm_buffer(struct i40e_hw *hw, u16 offset,\n \t\t\t\t\t   u16 *words, u16 *data);\n enum i40e_status_code i40e_write_nvm_aq(struct i40e_hw *hw, u8 module,\n",
    "prefixes": [
        "v4",
        "23/36"
    ]
}