get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43695,
    "url": "http://patches.dpdk.org/api/patches/43695/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180813155108.6460-3-stephen@networkplumber.org/",
    "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": "<20180813155108.6460-3-stephen@networkplumber.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180813155108.6460-3-stephen@networkplumber.org",
    "date": "2018-08-13T15:51:08",
    "name": "[v2,2/2] netvsc: resize event buffer as needed",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "1637e5ff8f4b956b634448f30d7d52353bcdede8",
    "submitter": {
        "id": 27,
        "url": "http://patches.dpdk.org/api/people/27/?format=api",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180813155108.6460-3-stephen@networkplumber.org/mbox/",
    "series": [
        {
            "id": 973,
            "url": "http://patches.dpdk.org/api/series/973/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=973",
            "date": "2018-08-13T15:51:06",
            "name": "netvsc: event buffer bug fixes",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/973/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43695/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/43695/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 6AA984C74;\n\tMon, 13 Aug 2018 17:51:23 +0200 (CEST)",
            "from mail-pf1-f195.google.com (mail-pf1-f195.google.com\n\t[209.85.210.195]) by dpdk.org (Postfix) with ESMTP id 3891E47CD\n\tfor <dev@dpdk.org>; Mon, 13 Aug 2018 17:51:20 +0200 (CEST)",
            "by mail-pf1-f195.google.com with SMTP id j26-v6so7830589pfi.10\n\tfor <dev@dpdk.org>; Mon, 13 Aug 2018 08:51:20 -0700 (PDT)",
            "from xeon-e3.lan (204-195-22-127.wavecable.com. [204.195.22.127])\n\tby smtp.gmail.com with ESMTPSA id\n\tm30-v6sm22018241pff.121.2018.08.13.08.51.17\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 13 Aug 2018 08:51:17 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=networkplumber-org.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=CQqBNVj1zl2YsKBnKezORNHIF7yFfTzHWPhXMRor/jk=;\n\tb=JmffNSl4TJKK8n/h3AKwGtV4rln7XtoYFe+o67Qmc3S1JgU24lMtr3W6LAvw9TOuW8\n\t6nK4RAClJ+yrjbmYzad3hMn3tFTkm27ADMJzeCpq6e/uRu773VXBLXhmy2tTzcxnyUEg\n\tD3SsmDNQjr4bhOnYQcedMdPwoRFIs8MvrUE516O77KMQEiafo7CETQGeiH9EUJu0qYYw\n\tGKYlN5M4eqmc31LSXygIws0kn1MBIpEJ6Z7Vg8Z+G+lfrRZ2R15pLz9tsGET1SM5eE/G\n\ttFKRAWVroqTMhBf6MG0Xu3B5gjnwwEoIB2MUnWkHJMemP5kMZexyCiEj0LtxV+cREJv4\n\t1ILg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=CQqBNVj1zl2YsKBnKezORNHIF7yFfTzHWPhXMRor/jk=;\n\tb=bp6fGooT5afNFfrUV8GTLznOMFnwG7wKyUTlzj02+H9STwKyZXBDsTbA05KDS/sVnE\n\tOnN3lI8pJ6qIZmztdmJBI+murDt/CjAoumbgxY5Bfq4MCmZjXjafzdJJ452VIVL4na3O\n\tYtipuXVe6+UuTEgjk8Lb6p5zMeLBgBimuiadCQt+VJiDjpY6Sae5xaOgN88tjujIc2Nl\n\taLLBJ+8O/1aGBbI00+3MmLIU4WLJTJW7DqF+SN9Fc142SY9rBVpXZiKek0z3wjRoY2By\n\tDcajLLqQFtzkDqAN05XGhBDJ1faa2H0YByPYU/xiP1L+56pI1wUrCq74Obofzztj41Ic\n\tjkJg==",
        "X-Gm-Message-State": "AOUpUlEpRWxwmTpNFPBtywyBRzt4nphQ1pnnEFzU25AkqqUiUGzAEmK1\n\tv2i/y4u4TYIsVP6A2scDCUANrFEy9jE=",
        "X-Google-Smtp-Source": "AA+uWPyu9n63kW17KQP5f0NWrH+mFFjcMu+cNf4G8xxZLE/Z285b9u0xSC9tywpVBejdUcmnmc4K7g==",
        "X-Received": "by 2002:a62:87ce:: with SMTP id\n\ti197-v6mr19643437pfe.62.1534175479071; \n\tMon, 13 Aug 2018 08:51:19 -0700 (PDT)",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "To": "dev@dpdk.org",
        "Cc": "Stephen Hemminger <stephen@networkplumber.org>,\n\tStephen Hemminger <sthemmin@microsoft.com>",
        "Date": "Mon, 13 Aug 2018 08:51:08 -0700",
        "Message-Id": "<20180813155108.6460-3-stephen@networkplumber.org>",
        "X-Mailer": "git-send-email 2.18.0",
        "In-Reply-To": "<20180813155108.6460-1-stephen@networkplumber.org>",
        "References": "<20180813155108.6460-1-stephen@networkplumber.org>",
        "Subject": "[dpdk-dev] [PATCH v2 2/2] netvsc: resize event buffer as needed",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The event buffer was changed to be a fixed size value, but it\nis not large enough for a forwarding stress test.\n\nThis version of event buffer code uses malloc/realloc to size\nthe event buffer as needed. Malloc is preferred over rte_malloc\nbecause the event buffer does not need to be used for DMA\nand huge page is a limited resource.\n\nFixes: 530af95a7849 (\"bus/vmbus: avoid signalling host on read\")\nSigned-off-by: Stephen Hemminger <sthemmin@microsoft.com>\n---\n drivers/net/netvsc/hn_rxtx.c | 50 ++++++++++++++++++++++++++----------\n drivers/net/netvsc/hn_var.h  |  2 +-\n 2 files changed, 37 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c\nindex 3e52a328b152..79bb4d587783 100644\n--- a/drivers/net/netvsc/hn_rxtx.c\n+++ b/drivers/net/netvsc/hn_rxtx.c\n@@ -10,6 +10,7 @@\n #include <errno.h>\n #include <unistd.h>\n #include <strings.h>\n+#include <malloc.h>\n \n #include <rte_ethdev.h>\n #include <rte_memcpy.h>\n@@ -718,16 +719,22 @@ struct hn_rx_queue *hn_rx_queue_alloc(struct hn_data *hv,\n {\n \tstruct hn_rx_queue *rxq;\n \n-\trxq = rte_zmalloc_socket(\"HN_RXQ\",\n-\t\t\t\t sizeof(*rxq) + HN_RXQ_EVENT_DEFAULT,\n+\trxq = rte_zmalloc_socket(\"HN_RXQ\", sizeof(*rxq),\n \t\t\t\t RTE_CACHE_LINE_SIZE, socket_id);\n-\tif (rxq) {\n-\t\trxq->hv = hv;\n-\t\trxq->chan = hv->channels[queue_id];\n-\t\trte_spinlock_init(&rxq->ring_lock);\n-\t\trxq->port_id = hv->port_id;\n-\t\trxq->queue_id = queue_id;\n+\tif (!rxq)\n+\t\treturn NULL;\n+\n+\trxq->hv = hv;\n+\trxq->chan = hv->channels[queue_id];\n+\trte_spinlock_init(&rxq->ring_lock);\n+\trxq->port_id = hv->port_id;\n+\trxq->queue_id = queue_id;\n+\trxq->event_buf = malloc(HN_RXQ_EVENT_DEFAULT);\n+\tif (!rxq->event_buf) {\n+\t\tfree(rxq);\n+\t\treturn NULL;\n \t}\n+\n \treturn rxq;\n }\n \n@@ -776,6 +783,7 @@ hn_dev_rx_queue_setup(struct rte_eth_dev *dev,\n \n fail:\n \trte_ring_free(rxq->rx_ring);\n+\tfree(rxq->event_buf);\n \trte_free(rxq);\n \treturn -ENOMEM;\n }\n@@ -794,8 +802,10 @@ hn_dev_rx_queue_release(void *arg)\n \trxq->rx_ring = NULL;\n \trxq->mb_pool = NULL;\n \n-\tif (rxq != rxq->hv->primary)\n+\tif (rxq != rxq->hv->primary) {\n+\t\tfree(rxq->event_buf);\n \t\trte_free(rxq);\n+\t}\n }\n \n void\n@@ -850,19 +860,31 @@ void hn_process_events(struct hn_data *hv, uint16_t queue_id)\n \n \tfor (;;) {\n \t\tconst struct vmbus_chanpkt_hdr *pkt;\n-\t\tuint32_t len = HN_RXQ_EVENT_DEFAULT;\n+\t\tuint32_t len = malloc_usable_size(rxq->event_buf);\n \t\tconst void *data;\n \n+retry:\n \t\tret = rte_vmbus_chan_recv_raw(rxq->chan, rxq->event_buf, &len);\n \t\tif (ret == -EAGAIN)\n \t\t\tbreak;\t/* ring is empty */\n \n-\t\telse if (ret == -ENOBUFS)\n-\t\t\trte_exit(EXIT_FAILURE, \"event buffer not big enough (%u < %u)\",\n-\t\t\t\t HN_RXQ_EVENT_DEFAULT, len);\n-\t\telse if (ret <= 0)\n+\t\tif (unlikely(ret == -ENOBUFS)) {\n+\t\t\t/* event buffer not large enough to read ring */\n+\n+\t\t\tPMD_DRV_LOG(DEBUG,\n+\t\t\t\t    \"event buffer expansion (need %u)\", len);\n+\t\t\trxq->event_buf = realloc(rxq->event_buf, len);\n+\t\t\tif (rxq->event_buf)\n+\t\t\t\tgoto retry;\n+\t\t\t/* out of memory, no more events now */\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\tif (unlikely(ret <= 0)) {\n+\t\t\t/* This indicates a failure to communicate (or worse) */\n \t\t\trte_exit(EXIT_FAILURE,\n \t\t\t\t \"vmbus ring buffer error: %d\", ret);\n+\t\t}\n \n \t\tbytes_read += ret;\n \t\tpkt = (const struct vmbus_chanpkt_hdr *)rxq->event_buf;\ndiff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h\nindex f7ff8585bc1c..0430f450cf37 100644\n--- a/drivers/net/netvsc/hn_var.h\n+++ b/drivers/net/netvsc/hn_var.h\n@@ -77,7 +77,7 @@ struct hn_rx_queue {\n \tstruct hn_stats stats;\n \tuint64_t ring_full;\n \n-\tuint8_t\tevent_buf[];\n+\tvoid *event_buf;\n };\n \n \n",
    "prefixes": [
        "v2",
        "2/2"
    ]
}