get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 331,
    "url": "http://patches.dpdk.org/api/patches/331/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1410247299-4365-15-git-send-email-helin.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": "<1410247299-4365-15-git-send-email-helin.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1410247299-4365-15-git-send-email-helin.zhang@intel.com",
    "date": "2014-09-09T07:21:38",
    "name": "[dpdk-dev,14/15] i40e: fix and enhancement in arq_event_info struct",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "c189b8498f0f130c2a87dab0b72e3041368b348d",
    "submitter": {
        "id": 14,
        "url": "http://patches.dpdk.org/api/people/14/?format=api",
        "name": "Zhang, Helin",
        "email": "helin.zhang@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1410247299-4365-15-git-send-email-helin.zhang@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/331/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/331/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id E6B0AB3B4;\n\tTue,  9 Sep 2014 09:18:07 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id A6300B3B4\n\tfor <dev@dpdk.org>; Tue,  9 Sep 2014 09:18:05 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga102.jf.intel.com with ESMTP; 09 Sep 2014 00:16:38 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga002.jf.intel.com with ESMTP; 09 Sep 2014 00:22:22 -0700",
            "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id s897MKcp008895;\n\tTue, 9 Sep 2014 15:22:20 +0800",
            "from shecgisg004.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid s897MIUQ004536; Tue, 9 Sep 2014 15:22:20 +0800",
            "(from hzhan75@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s897MIBU004525; \n\tTue, 9 Sep 2014 15:22:18 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,491,1406617200\"; d=\"scan'208\";a=\"600087352\"",
        "From": "Helin Zhang <helin.zhang@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue,  9 Sep 2014 15:21:38 +0800",
        "Message-Id": "<1410247299-4365-15-git-send-email-helin.zhang@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<1410247299-4365-1-git-send-email-helin.zhang@intel.com>",
        "References": "<1410247299-4365-1-git-send-email-helin.zhang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 14/15] i40e: fix and enhancement in\n\tarq_event_info struct",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Overloading the 'msg_size' field in the 'arq_event_info' struct\nis a bad idea. It leads to bugs when the structure is used in a\nloop, since the input value (buffer size) is overwritten by the\noutput value (actual message length). The fix introduces one\nmore field of 'buf_len' for the buffer size, and renames the\nfield of 'msg_size' to 'msg_len' for the real message size.\n\nSigned-off-by: Helin Zhang <helin.zhang@intel.com>\nReviewed-by: Chen Jing <jing.d.chen@intel.com>\n---\n lib/librte_pmd_i40e/i40e/i40e_adminq.c    | 33 ++++++++++++++++---------------\n lib/librte_pmd_i40e/i40e/i40e_adminq.h    |  3 ++-\n lib/librte_pmd_i40e/i40e/i40e_common.c    |  8 ++++++--\n lib/librte_pmd_i40e/i40e/i40e_prototype.h |  6 ++----\n 4 files changed, 27 insertions(+), 23 deletions(-)",
    "diff": "diff --git a/lib/librte_pmd_i40e/i40e/i40e_adminq.c b/lib/librte_pmd_i40e/i40e/i40e_adminq.c\nindex 80da710..e098ed6 100644\n--- a/lib/librte_pmd_i40e/i40e/i40e_adminq.c\n+++ b/lib/librte_pmd_i40e/i40e/i40e_adminq.c\n@@ -867,7 +867,8 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,\n \n \t/* bump the tail */\n \ti40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, \"AQTX: desc and buffer:\\n\");\n-\ti40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc_on_ring, buff);\n+\ti40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc_on_ring,\n+\t\t      buff, buff_size);\n \t(hw->aq.asq.next_to_use)++;\n \tif (hw->aq.asq.next_to_use == hw->aq.asq.count)\n \t\thw->aq.asq.next_to_use = 0;\n@@ -917,11 +918,9 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,\n \t\thw->aq.asq_last_status = (enum i40e_admin_queue_err)retval;\n \t}\n \n-\tif (LE16_TO_CPU(desc->datalen) == buff_size) {\n-\t\ti40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,\n-\t\t\t   \"AQTX: desc and buffer writeback:\\n\");\n-\t\ti40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff);\n-\t}\n+\ti40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,\n+\t\t   \"AQTX: desc and buffer writeback:\\n\");\n+\ti40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff, buff_size);\n \n \t/* update the error if time out occurred */\n \tif ((!cmd_completed) &&\n@@ -1000,6 +999,7 @@ enum i40e_status_code i40e_clean_arq_element(struct i40e_hw *hw,\n \t/* now clean the next descriptor */\n \tdesc = I40E_ADMINQ_DESC(hw->aq.arq, ntc);\n \tdesc_idx = ntc;\n+\n \tflags = LE16_TO_CPU(desc->flags);\n \tif (flags & I40E_AQ_FLAG_ERR) {\n \t\tret_code = I40E_ERR_ADMIN_QUEUE_ERROR;\n@@ -1009,19 +1009,20 @@ enum i40e_status_code i40e_clean_arq_element(struct i40e_hw *hw,\n \t\t\t   I40E_DEBUG_AQ_MESSAGE,\n \t\t\t   \"AQRX: Event received with error 0x%X.\\n\",\n \t\t\t   hw->aq.arq_last_status);\n-\t} else {\n-\t\ti40e_memcpy(&e->desc, desc, sizeof(struct i40e_aq_desc),\n-\t\t\t    I40E_DMA_TO_NONDMA);\n-\t\tdatalen = LE16_TO_CPU(desc->datalen);\n-\t\te->msg_size = min(datalen, e->msg_size);\n-\t\tif (e->msg_buf != NULL && (e->msg_size != 0))\n-\t\t\ti40e_memcpy(e->msg_buf,\n-\t\t\t\t    hw->aq.arq.r.arq_bi[desc_idx].va,\n-\t\t\t\t    e->msg_size, I40E_DMA_TO_NONDMA);\n \t}\n \n+\ti40e_memcpy(&e->desc, desc, sizeof(struct i40e_aq_desc),\n+\t\t    I40E_DMA_TO_NONDMA);\n+\tdatalen = LE16_TO_CPU(desc->datalen);\n+\te->msg_len = min(datalen, e->buf_len);\n+\tif (e->msg_buf != NULL && (e->msg_len != 0))\n+\t\ti40e_memcpy(e->msg_buf,\n+\t\t\t    hw->aq.arq.r.arq_bi[desc_idx].va,\n+\t\t\t    e->msg_len, I40E_DMA_TO_NONDMA);\n+\n \ti40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, \"AQRX: desc and buffer:\\n\");\n-\ti40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf);\n+\ti40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf,\n+\t\t      hw->aq.arq_buf_size);\n \n \t/* Restore the original datalen and buffer address in the desc,\n \t * FW updates datalen to indicate the event message\ndiff --git a/lib/librte_pmd_i40e/i40e/i40e_adminq.h b/lib/librte_pmd_i40e/i40e/i40e_adminq.h\nindex 27f2843..ea611bd 100644\n--- a/lib/librte_pmd_i40e/i40e/i40e_adminq.h\n+++ b/lib/librte_pmd_i40e/i40e/i40e_adminq.h\n@@ -83,7 +83,8 @@ struct i40e_asq_cmd_details {\n /* ARQ event information */\n struct i40e_arq_event_info {\n \tstruct i40e_aq_desc desc;\n-\tu16 msg_size;\n+\tu16 msg_len;\n+\tu16 buf_len;\n \tu8 *msg_buf;\n };\n \ndiff --git a/lib/librte_pmd_i40e/i40e/i40e_common.c b/lib/librte_pmd_i40e/i40e/i40e_common.c\nindex ffd68a5..ffaa777 100644\n--- a/lib/librte_pmd_i40e/i40e/i40e_common.c\n+++ b/lib/librte_pmd_i40e/i40e/i40e_common.c\n@@ -89,13 +89,15 @@ STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)\n  * @mask: debug mask\n  * @desc: pointer to admin queue descriptor\n  * @buffer: pointer to command buffer\n+ * @buf_len: max length of buffer\n  *\n  * Dumps debug log about adminq command with descriptor contents.\n  **/\n void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,\n-\t\t   void *buffer)\n+\t\t   void *buffer, u16 buf_len)\n {\n \tstruct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc;\n+\tu16 len = LE16_TO_CPU(aq_desc->datalen);\n \tu8 *aq_buffer = (u8 *)buffer;\n \tu32 data[4];\n \tu32 i = 0;\n@@ -119,7 +121,9 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,\n \tif ((buffer != NULL) && (aq_desc->datalen != 0)) {\n \t\ti40e_memset(data, 0, sizeof(data), I40E_NONDMA_MEM);\n \t\ti40e_debug(hw, mask, \"AQ CMD Buffer:\\n\");\n-\t\tfor (i = 0; i < LE16_TO_CPU(aq_desc->datalen); i++) {\n+\t\tif (buf_len < len)\n+\t\t\tlen = buf_len;\n+\t\tfor (i = 0; i < len; i++) {\n \t\t\tdata[((i % 16) / 4)] |=\n \t\t\t\t((u32)aq_buffer[i]) << (8 * (i % 4));\n \t\t\tif ((i % 16) == 15) {\ndiff --git a/lib/librte_pmd_i40e/i40e/i40e_prototype.h b/lib/librte_pmd_i40e/i40e/i40e_prototype.h\nindex f819f9a..f3215cf 100644\n--- a/lib/librte_pmd_i40e/i40e/i40e_prototype.h\n+++ b/lib/librte_pmd_i40e/i40e/i40e_prototype.h\n@@ -69,10 +69,8 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw,\n bool i40e_asq_done(struct i40e_hw *hw);\n \n /* debug function for adminq */\n-void i40e_debug_aq(struct i40e_hw *hw,\n-\t\t   enum i40e_debug_mask mask,\n-\t\t   void *desc,\n-\t\t   void *buffer);\n+void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask,\n+\t\t   void *desc, void *buffer, u16 buf_len);\n \n void i40e_idle_aq(struct i40e_hw *hw);\n void i40e_resume_aq(struct i40e_hw *hw);\n",
    "prefixes": [
        "dpdk-dev",
        "14/15"
    ]
}