get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 8190,
    "url": "https://patches.dpdk.org/api/patches/8190/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1446110173-13330-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": "<1446110173-13330-16-git-send-email-jing.d.chen@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1446110173-13330-16-git-send-email-jing.d.chen@intel.com",
    "date": "2015-10-29T09:16:12",
    "name": "[dpdk-dev,v4,15/16] fm10k: fix a crash issue in vector RX func",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "5a24c5fb6422c4e91f6bac463cd0a19be99e94a8",
    "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/1446110173-13330-16-git-send-email-jing.d.chen@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/8190/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/8190/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 9A8D88E9E;\n\tThu, 29 Oct 2015 10:17:09 +0100 (CET)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id C762C8E8F\n\tfor <dev@dpdk.org>; Thu, 29 Oct 2015 10:16:55 +0100 (CET)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga101.jf.intel.com with ESMTP; 29 Oct 2015 02:16:54 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga003.jf.intel.com with ESMTP; 29 Oct 2015 02:16:54 -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 t9T9GpeM029442;\n\tThu, 29 Oct 2015 17:16:51 +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 t9T9Gn6h013639; Thu, 29 Oct 2015 17:16:51 +0800",
            "(from jingche2@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t9T9Gnc4013635; \n\tThu, 29 Oct 2015 17:16:49 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.20,213,1444719600\"; d=\"scan'208\";a=\"674168123\"",
        "From": "\"Chen Jing D(Mark)\" <jing.d.chen@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Thu, 29 Oct 2015 17:16:12 +0800",
        "Message-Id": "<1446110173-13330-16-git-send-email-jing.d.chen@intel.com>",
        "X-Mailer": "git-send-email 1.7.12.2",
        "In-Reply-To": "<1446110173-13330-1-git-send-email-jing.d.chen@intel.com>",
        "References": "<1445939209-12783-2-git-send-email-jing.d.chen@intel.com>\n\t<1446110173-13330-1-git-send-email-jing.d.chen@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v4 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, 20 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h\nindex 8e2c6a4..82a548f 100644\n--- a/drivers/net/fm10k/fm10k.h\n+++ b/drivers/net/fm10k/fm10k.h\n@@ -177,7 +177,7 @@ 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+\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@@ -185,6 +185,8 @@ struct fm10k_rx_queue {\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..705b311 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",
        "v4",
        "15/16"
    ]
}