get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 8060,
    "url": "https://patches.dpdk.org/api/patches/8060/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1445939209-12783-16-git-send-email-jing.d.chen@intel.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1445939209-12783-16-git-send-email-jing.d.chen@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1445939209-12783-16-git-send-email-jing.d.chen@intel.com",
    "date": "2015-10-27T09:46:48",
    "name": "[dpdk-dev,v3,15/16] fm10k: fix a crash issue in vector RX func",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c37cadbc76a9cae895f7c0f05dd47e769837c597",
    "submitter": {
        "id": 40,
        "url": "https://patches.dpdk.org/api/people/40/?format=api",
        "name": "Chen, Jing D",
        "email": "jing.d.chen@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1445939209-12783-16-git-send-email-jing.d.chen@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/8060/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/8060/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 B73A48E93;\n\tTue, 27 Oct 2015 10:47:34 +0100 (CET)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id BF6996A80\n\tfor <dev@dpdk.org>; Tue, 27 Oct 2015 10:47:30 +0100 (CET)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga102.fm.intel.com with ESMTP; 27 Oct 2015 02:47:31 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga003.jf.intel.com with ESMTP; 27 Oct 2015 02:47:29 -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 t9R9lRrt031127;\n\tTue, 27 Oct 2015 17:47:27 +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 t9R9lPkj013478; Tue, 27 Oct 2015 17:47:27 +0800",
            "(from jingche2@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t9R9lPsZ013474; \n\tTue, 27 Oct 2015 17:47:25 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.20,204,1444719600\"; d=\"scan'208\";a=\"672566307\"",
        "From": "\"Chen Jing D(Mark)\" <jing.d.chen@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue, 27 Oct 2015 17:46:48 +0800",
        "Message-Id": "<1445939209-12783-16-git-send-email-jing.d.chen@intel.com>",
        "X-Mailer": "git-send-email 1.7.12.2",
        "In-Reply-To": "<1445939209-12783-1-git-send-email-jing.d.chen@intel.com>",
        "References": "<1445507104-22563-2-git-send-email-jing.d.chen@intel.com>\n\t<1445939209-12783-1-git-send-email-jing.d.chen@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 15/16] fm10k: fix a crash issue in vector RX\n\tfunc",
        "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": "From: \"Chen Jing D(Mark)\" <jing.d.chen@intel.com>\n\nVector RX function will process 4 packets at a time. When the RX\nring wrapps to the tail and the left descriptor size is not multiple\nof 4, SW will overwrite memory that not belongs to it and cause crash.\nThe fix will allocate additional 4 HW/SW spaces at the tail to avoid\noverwrite.\n\nSigned-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>\n---\n drivers/net/fm10k/fm10k.h        |    4 ++++\n drivers/net/fm10k/fm10k_ethdev.c |   19 +++++++++++++++++--\n 2 files changed, 21 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h\nindex 68ae1b8..82a548f 100644\n--- a/drivers/net/fm10k/fm10k.h\n+++ b/drivers/net/fm10k/fm10k.h\n@@ -177,12 +177,16 @@ struct fm10k_rx_queue {\n \tstruct rte_mbuf *pkt_last_seg;  /* Last segment of current packet. */\n \tuint64_t hw_ring_phys_addr;\n \tuint64_t mbuf_initializer; /* value to init mbufs */\n+\t/* need to alloc dummy mbuf, for wraparound when scanning hw ring */\n+\tstruct rte_mbuf fake_mbuf;\n \tuint16_t next_dd;\n \tuint16_t next_alloc;\n \tuint16_t next_trigger;\n \tuint16_t alloc_thresh;\n \tvolatile uint32_t *tail_ptr;\n \tuint16_t nb_desc;\n+\t/* Number of faked desc added at the tail for Vector RX function */\n+\tuint16_t nb_fake_desc;\n \tuint16_t queue_id;\n \t/* Below 2 fields only valid in case vPMD is applied. */\n \tuint16_t rxrearm_nb;     /* number of remaining to be re-armed */\ndiff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c\nindex 469bd85..fb8ec0d 100644\n--- a/drivers/net/fm10k/fm10k_ethdev.c\n+++ b/drivers/net/fm10k/fm10k_ethdev.c\n@@ -102,6 +102,7 @@ fm10k_mbx_unlock(struct fm10k_hw *hw)\n static inline int\n rx_queue_reset(struct fm10k_rx_queue *q)\n {\n+\tstatic const union fm10k_rx_desc zero = {{0}};\n \tuint64_t dma_addr;\n \tint i, diag;\n \tPMD_INIT_FUNC_TRACE();\n@@ -122,6 +123,15 @@ rx_queue_reset(struct fm10k_rx_queue *q)\n \t\tq->hw_ring[i].q.hdr_addr = dma_addr;\n \t}\n \n+\t/* initialize extra software ring entries. Space for these extra\n+\t * entries is always allocated.\n+\t */\n+\tmemset(&q->fake_mbuf, 0x0, sizeof(q->fake_mbuf));\n+\tfor (i = 0; i < q->nb_fake_desc; ++i) {\n+\t\tq->sw_ring[q->nb_desc + i] = &q->fake_mbuf;\n+\t\tq->hw_ring[q->nb_desc + i] = zero;\n+\t}\n+\n \tq->next_dd = 0;\n \tq->next_alloc = 0;\n \tq->next_trigger = q->alloc_thresh - 1;\n@@ -147,6 +157,10 @@ rx_queue_clean(struct fm10k_rx_queue *q)\n \tfor (i = 0; i < q->nb_desc; ++i)\n \t\tq->hw_ring[i] = zero;\n \n+\t/* zero faked descriptors */\n+\tfor (i = 0; i < q->nb_fake_desc; ++i)\n+\t\tq->hw_ring[q->nb_desc + i] = zero;\n+\n \t/* vPMD driver has a different way of releasing mbufs. */\n \tif (q->rx_using_sse) {\n \t\tfm10k_rx_queue_release_mbufs_vec(q);\n@@ -1323,6 +1337,7 @@ fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id,\n \t/* setup queue */\n \tq->mp = mp;\n \tq->nb_desc = nb_desc;\n+\tq->nb_fake_desc = FM10K_MULT_RX_DESC;\n \tq->port_id = dev->data->port_id;\n \tq->queue_id = queue_id;\n \tq->tail_ptr = (volatile uint32_t *)\n@@ -1332,8 +1347,8 @@ fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id,\n \n \t/* allocate memory for the software ring */\n \tq->sw_ring = rte_zmalloc_socket(\"fm10k sw ring\",\n-\t\t\t\t\tnb_desc * sizeof(struct rte_mbuf *),\n-\t\t\t\t\tRTE_CACHE_LINE_SIZE, socket_id);\n+\t\t\t(nb_desc + q->nb_fake_desc) * sizeof(struct rte_mbuf *),\n+\t\t\tRTE_CACHE_LINE_SIZE, socket_id);\n \tif (q->sw_ring == NULL) {\n \t\tPMD_INIT_LOG(ERR, \"Cannot allocate software ring\");\n \t\trte_free(q);\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "15/16"
    ]
}