get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 17012,
    "url": "https://patches.dpdk.org/api/patches/17012/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1479120376-48723-1-git-send-email-stefan.puiu@gmail.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": "<1479120376-48723-1-git-send-email-stefan.puiu@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1479120376-48723-1-git-send-email-stefan.puiu@gmail.com",
    "date": "2016-11-14T10:46:16",
    "name": "[dpdk-dev] vmxnet3: fix Rx deadlock",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "5aec188115fecce42fa9499cd8a6146188093bf2",
    "submitter": {
        "id": 172,
        "url": "https://patches.dpdk.org/api/people/172/?format=api",
        "name": "Stefan Puiu",
        "email": "stefan.puiu@gmail.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1479120376-48723-1-git-send-email-stefan.puiu@gmail.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/17012/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/17012/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 E9C01374D;\n\tMon, 14 Nov 2016 11:46:25 +0100 (CET)",
            "from mail-wm0-f67.google.com (mail-wm0-f67.google.com\n\t[74.125.82.67]) by dpdk.org (Postfix) with ESMTP id D25E3374C\n\tfor <dev@dpdk.org>; Mon, 14 Nov 2016 11:46:24 +0100 (CET)",
            "by mail-wm0-f67.google.com with SMTP id g23so14133171wme.1\n\tfor <dev@dpdk.org>; Mon, 14 Nov 2016 02:46:24 -0800 (PST)",
            "from spuiu-vm2.anuesystems.local ([109.100.41.154])\n\tby smtp.gmail.com with ESMTPSA id\n\te5sm8980722wma.12.2016.11.14.02.46.23\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tMon, 14 Nov 2016 02:46:23 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\n\th=from:to:cc:subject:date:message-id;\n\tbh=iDNWamP6Fx2Tf6OwsOVXtE0Kv1j8DfyYAjMvwRJKKPQ=;\n\tb=TpoLa779f5pXwFdxmanDDCSEb7ERMvgwdC/YSVRIrGx5TwYdBfj3QqPN84RhSbnyua\n\t9pVxW3MprAJGJSaxqtJkPye+vU7b7ZL3ODKfWZ1y/6MQIgeV873/6fdAIdwAYsiI1iDn\n\tqLsGo337et0CkEwK8qMOV10P/plhJzm/pMuIQtvbTMqmP115SO1CffPg8UUo2JrGKWg+\n\tngJCyqg+NRiplPIpHUop5IngrBxhCadH5lOw7J6nS62j8H4GACuLGb4BrTITKntvUG96\n\tqrMw2WGuCTXFW5WFz93kR0ZwPxxrVcY0Dc109ACx7CPM4F5UeWReS6rWIeHQw0FqUe8b\n\txvtg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=iDNWamP6Fx2Tf6OwsOVXtE0Kv1j8DfyYAjMvwRJKKPQ=;\n\tb=AC+tWOWcpSi07FjDcq3NhAi7U6V/Ujx3yudMARCPmDawKgHX6N0lrFOmS2T1SECK3j\n\tYo49l9de3X7/bqZVlAU6AjNvA72xWw4hKD9noVsLOwzrC4xAXMaS/G3y5daDN55aoWeH\n\ti9DIpJmS/gttMXA1wegV3o0v17VzdOfaq0u64Ya5n1/xHHq6EeBeYd+7d3NwZo3eHs0c\n\tTQCxJa4j5axs5emoX/5IXRScxfsCkTJ38GEhNlf1MbJSqTw3ii0MeroiOZGm7j/g02NL\n\tK8MxjhsJRoNU7sS945UntgzOlygF9PQKcpR6+u+GJNWrUtxhXahSMUF/tooaKhAngrCB\n\tOhVA==",
        "X-Gm-Message-State": "ABUngve8bJmdgF11Q29ejL0O1bFySrOpj4+whr2mMqqvqgWYLOhvkLEm/A+3dgpbyJuhFg==",
        "X-Received": "by 10.28.27.133 with SMTP id b127mr10926032wmb.59.1479120384521; \n\tMon, 14 Nov 2016 02:46:24 -0800 (PST)",
        "From": "Stefan Puiu <stefan.puiu@gmail.com>",
        "To": "dev@dpdk.org",
        "Cc": "mac_leehk@yahoo.com.hk, yongwang@vmware.com,\n\tStefan Puiu <stefan.puiu@gmail.com>",
        "Date": "Mon, 14 Nov 2016 12:46:16 +0200",
        "Message-Id": "<1479120376-48723-1-git-send-email-stefan.puiu@gmail.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "Subject": "[dpdk-dev] [PATCH] vmxnet3: fix Rx deadlock",
        "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": "Our use case is that we have an app that needs to keep mbufs around\nfor a while. We've seen cases when calling vmxnet3_post_rx_bufs() from\nvmxet3_recv_pkts(), it might not succeed to add any mbufs to any RX\ndescriptors (where it returns -err). Since there are no mbufs that the\nvirtual hardware can use, and since nobody calls\nvmxnet3_post_rx_bufs() after that, no packets will be received after\nthis. I call this a deadlock for lack of a better term - the virtual\nHW waits for free mbufs, while the app waits for the hardware to\nnotify it for data. Note that after this, the app can't recover.\n\nThis fix is a rework of this patch by Marco Lee:\nhttp://dpdk.org/dev/patchwork/patch/6575/. I had to forward port it,\naddress review comments and also reverted the allocation failure\nhanding to the first version of the patch\n(http://dpdk.org/ml/archives/dev/2015-July/022079.html), since that's\nthe only approach that seems to work, and seems to be what other\ndrivers are doing (I checked ixgbe and em). Reusing the mbuf that's\ngetting passed to the application doesn't seem to make sense, and it\nwas causing weird issues in our app. Also, reusing rxm without\nchecking if it's NULL could cause the code to crash.\n\nSigned-off-by: Stefan Puiu <stefan.puiu@gmail.com>\n---\n drivers/net/vmxnet3/vmxnet3_rxtx.c | 38 ++++++++++++++++++++++++++++++++++++--\n 1 file changed, 36 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c\nindex b109168..c9d2488 100644\n--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c\n+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c\n@@ -518,6 +518,32 @@\n \treturn nb_tx;\n }\n \n+static inline void\n+vmxnet3_renew_desc(vmxnet3_rx_queue_t *rxq, uint8_t ring_id,\n+\t\tstruct rte_mbuf *mbuf)\n+{\n+\tuint32_t  val = 0;\n+\tstruct vmxnet3_cmd_ring *ring = &rxq->cmd_ring[ring_id];\n+\tstruct Vmxnet3_RxDesc *rxd =\n+\t\t(struct Vmxnet3_RxDesc *)(ring->base + ring->next2fill);\n+\tvmxnet3_buf_info_t *buf_info = &ring->buf_info[ring->next2fill];\n+\n+\tif (ring_id == 0)\n+\t\tval = VMXNET3_RXD_BTYPE_HEAD;\n+\telse\n+\t\tval = VMXNET3_RXD_BTYPE_BODY;\n+\n+\tbuf_info->m = mbuf;\n+\tbuf_info->len = (uint16_t)(mbuf->buf_len - RTE_PKTMBUF_HEADROOM);\n+\tbuf_info->bufPA = rte_mbuf_data_dma_addr_default(mbuf);\n+\n+\trxd->addr = buf_info->bufPA;\n+\trxd->btype = val;\n+\trxd->len = buf_info->len;\n+\trxd->gen = ring->gen;\n+\n+\tvmxnet3_cmd_ring_adv_next2fill(ring);\n+}\n /*\n  *  Allocates mbufs and clusters. Post rx descriptors with buffer details\n  *  so that device can receive packets in those buffers.\n@@ -657,9 +683,17 @@\n \t}\n \n \twhile (rcd->gen == rxq->comp_ring.gen) {\n+\t\tstruct rte_mbuf *newm;\n \t\tif (nb_rx >= nb_pkts)\n \t\t\tbreak;\n \n+\t\tnewm = rte_mbuf_raw_alloc(rxq->mp);\n+\t\tif (unlikely(newm == NULL)) {\n+\t\t\tPMD_RX_LOG(ERR, \"Error allocating mbuf\");\n+\t\t\trxq->stats.rx_buf_alloc_failure++;\n+\t\t\tbreak;\n+\t\t}\n+\n \t\tidx = rcd->rxdIdx;\n \t\tring_idx = (uint8_t)((rcd->rqID == rxq->qid1) ? 0 : 1);\n \t\trxd = (Vmxnet3_RxDesc *)rxq->cmd_ring[ring_idx].base + idx;\n@@ -759,8 +793,8 @@\n \t\tVMXNET3_INC_RING_IDX_ONLY(rxq->cmd_ring[ring_idx].next2comp,\n \t\t\t\t\t  rxq->cmd_ring[ring_idx].size);\n \n-\t\t/* It's time to allocate some new buf and renew descriptors */\n-\t\tvmxnet3_post_rx_bufs(rxq, ring_idx);\n+\t\t/* It's time to  renew descriptors */\n+\t\tvmxnet3_renew_desc(rxq, ring_idx, newm);\n \t\tif (unlikely(rxq->shared->ctrl.updateRxProd)) {\n \t\t\tVMXNET3_WRITE_BAR0_REG(hw, rxprod_reg[ring_idx] + (rxq->queue_id * VMXNET3_REG_ALIGN),\n \t\t\t\t\t       rxq->cmd_ring[ring_idx].next2fill);\n",
    "prefixes": [
        "dpdk-dev"
    ]
}