get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 210,
    "url": "http://patches.dpdk.org/api/patches/210/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20140826020839.926714726@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": "<20140826020839.926714726@networkplumber.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20140826020839.926714726@networkplumber.org",
    "date": "2014-08-26T02:07:48",
    "name": "[dpdk-dev,RFC,02/10] virtio: use weak barriers",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": true,
    "hash": "e31ae4a072aa17478d291152902c836c0d6f9b6a",
    "submitter": {
        "id": 27,
        "url": "http://patches.dpdk.org/api/people/27/?format=api",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20140826020839.926714726@networkplumber.org/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/210/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/210/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<stephen@networkplumber.org>",
        "Received": [
            "from mail-pa0-f52.google.com (mail-pa0-f52.google.com\n\t[209.85.220.52]) by dpdk.org (Postfix) with ESMTP id DD40B3975\n\tfor <dev@dpdk.org>; Tue, 26 Aug 2014 04:04:44 +0200 (CEST)",
            "by mail-pa0-f52.google.com with SMTP id bj1so22491952pad.11\n\tfor <dev@dpdk.org>; Mon, 25 Aug 2014 19:08:41 -0700 (PDT)",
            "from localhost (static-50-53-65-80.bvtn.or.frontiernet.net.\n\t[50.53.65.80]) by mx.google.com with ESMTPSA id\n\tur5sm4467129pac.46.2014.08.25.19.08.40 for <multiple recipients>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 25 Aug 2014 19:08:41 -0700 (PDT)"
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:message-id:user-agent:date:from:to:cc:subject\n\t:references:mime-version:content-type:content-disposition;\n\tbh=wLFpgG1Cb0h9ul7AhHid9yZh29SbLJ74ewzxzYyA5yM=;\n\tb=SmEKg2gAipY21mGEHQQc9sV4kOwb1bpDX8rhjn5YE2c/6ekguxXHzheHGX2DYX2g3T\n\tYUpUoIJLxNN6cw2pm9fs0zzvSoAqLkNzQAQHFQVLlPIPaTiUXENyZYekHWzEJrr76hKT\n\tlXaXzx1qq0FBH8BSFdrPyrRgA9J28oIWaKyTuYY3GyAObh1KbCsj3Nidy4S6vZj5qmz2\n\tnVX69P7nmdrZgYe66I+H9e36aq5y3P58Y+60cRTZ8mJpeLWV5VCPJzOeTnG8IChR18h3\n\t9BLwNV+iSXUvbE+qx0+sEZR/S94O83qljOY8sooDblpwvEj/tJUoEkxI4qewM5DL7kMb\n\t28wA==",
        "X-Gm-Message-State": "ALoCoQmD+v8YPXfWGSqtu0WovW+MQ3721PSGqpr/wFWes8DEjq8Ulx/w/qpJ4GdBObeVdT8UkoO6",
        "X-Received": "by 10.66.249.34 with SMTP id yr2mr9015778pac.149.1409018921871; \n\tMon, 25 Aug 2014 19:08:41 -0700 (PDT)",
        "Message-Id": "<20140826020839.926714726@networkplumber.org>",
        "User-Agent": "quilt/0.63-1",
        "Date": "Mon, 25 Aug 2014 19:07:48 -0700",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "To": "Ouyang Changchun <changchun.ouyang@intel.com>",
        "References": "<20140826020746.062748014@networkplumber.org>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Disposition": "inline; filename=virtio-barrier.patch",
        "Cc": "dev@dpdk.org",
        "Subject": "[dpdk-dev] [RFC 02/10] virtio: use weak barriers",
        "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>",
        "X-List-Received-Date": "Tue, 26 Aug 2014 02:04:46 -0000"
    },
    "content": "The DPDK driver only has to deal with the case of running on PCI\nand with SMP. In this case, the code can use the weaker barriers\ninstead of using hard (fence) barriers. This will help performance.\nThe rationale is explained in Linux kernel virtio_ring.h.\n\nTo make it clearer that this is a virtio thing and not some generic\nbarrier, prefix the barrier calls with virtio_.\n\nAdd missing (and needed) barrier between updating ring data\nstructure and notifying host.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n\n\n---\n lib/librte_pmd_virtio/virtio_ethdev.c |    2 +-\n lib/librte_pmd_virtio/virtio_rxtx.c   |    8 +++++---\n lib/librte_pmd_virtio/virtqueue.h     |   19 ++++++++++++++-----\n 3 files changed, 20 insertions(+), 9 deletions(-)",
    "diff": "--- a/lib/librte_pmd_virtio/virtio_rxtx.c\t2014-08-25 19:00:04.146518448 -0700\n+++ b/lib/librte_pmd_virtio/virtio_rxtx.c\t2014-08-25 19:00:04.142518425 -0700\n@@ -454,7 +454,7 @@ virtio_recv_pkts(void *rx_queue, struct\n \n \tnb_used = VIRTQUEUE_NUSED(rxvq);\n \n-\trmb();\n+\tvirtio_rmb();\n \n \tnum = (uint16_t)(likely(nb_used <= nb_pkts) ? nb_used : nb_pkts);\n \tnum = (uint16_t)(likely(num <= VIRTIO_MBUF_BURST_SZ) ? num : VIRTIO_MBUF_BURST_SZ);\n@@ -514,6 +514,7 @@ virtio_recv_pkts(void *rx_queue, struct\n \t}\n \n \tif (likely(nb_enqueued)) {\n+\t\tvirtio_wmb();\n \t\tif (unlikely(virtqueue_kick_prepare(rxvq))) {\n \t\t\tvirtqueue_notify(rxvq);\n \t\t\tPMD_RX_LOG(DEBUG, \"Notified\\n\");\n@@ -545,7 +546,7 @@ virtio_recv_mergeable_pkts(void *rx_queu\n \n \tnb_used = VIRTQUEUE_NUSED(rxvq);\n \n-\trmb();\n+\tvirtio_rmb();\n \n \tif (nb_used == 0)\n \t\treturn 0;\n@@ -694,7 +695,7 @@ virtio_xmit_pkts(void *tx_queue, struct\n \tPMD_TX_LOG(DEBUG, \"%d packets to xmit\", nb_pkts);\n \tnb_used = VIRTQUEUE_NUSED(txvq);\n \n-\trmb();\n+\tvirtio_rmb();\n \n \tnum = (uint16_t)(likely(nb_used < VIRTIO_MBUF_BURST_SZ) ? nb_used : VIRTIO_MBUF_BURST_SZ);\n \n@@ -729,6 +730,7 @@ virtio_xmit_pkts(void *tx_queue, struct\n \t\t}\n \t}\n \tvq_update_avail_idx(txvq);\n+\tvirtio_wmb();\n \n \ttxvq->packets += nb_tx;\n \n--- a/lib/librte_pmd_virtio/virtqueue.h\t2014-08-25 19:00:04.146518448 -0700\n+++ b/lib/librte_pmd_virtio/virtqueue.h\t2014-08-25 19:00:04.142518425 -0700\n@@ -46,9 +46,18 @@\n #include \"virtio_ring.h\"\n #include \"virtio_logs.h\"\n \n-#define mb()  rte_mb()\n-#define wmb() rte_wmb()\n-#define rmb() rte_rmb()\n+/*\n+ * Per virtio_config.h in Linux.\n+ *     For virtio_pci on SMP, we don't need to order with respect to MMIO\n+ *     accesses through relaxed memory I/O windows, so smp_mb() et al are\n+ *     sufficient.\n+ *\n+ * This driver is for virtio_pci on SMP and therefore can assume\n+ * weaker (compiler barriers)\n+ */\n+#define virtio_mb()\trte_mb()\n+#define virtio_rmb()\trte_compiler_barrier()\n+#define virtio_wmb()\trte_compiler_barrier()\n \n #ifdef RTE_PMD_PACKET_PREFETCH\n #define rte_packet_prefetch(p)  rte_prefetch1(p)\n@@ -226,7 +235,7 @@ virtqueue_full(const struct virtqueue *v\n static inline void\n vq_update_avail_idx(struct virtqueue *vq)\n {\n-\trte_compiler_barrier();\n+\tvirtio_rmb();\n \tvq->vq_ring.avail->idx = vq->vq_avail_idx;\n }\n \n@@ -256,7 +265,7 @@ static inline void\n virtqueue_notify(struct virtqueue *vq)\n {\n \t/*\n-\t * Ensure updated avail->idx is visible to host. mb() necessary?\n+\t * Ensure updated avail->idx is visible to host.\n \t * For virtio on IA, the notificaiton is through io port operation\n \t * which is a serialization instruction itself.\n \t */\n--- a/lib/librte_pmd_virtio/virtio_ethdev.c\t2014-08-25 19:00:04.146518448 -0700\n+++ b/lib/librte_pmd_virtio/virtio_ethdev.c\t2014-08-25 19:00:04.142518425 -0700\n@@ -171,7 +171,7 @@ virtio_send_command(struct virtqueue *vq\n \t\tuint32_t idx, desc_idx, used_idx;\n \t\tstruct vring_used_elem *uep;\n \n-\t\trmb();\n+\t\tvirtio_rmb();\n \n \t\tused_idx = (uint32_t)(vq->vq_used_cons_idx\n \t\t\t\t& (vq->vq_nentries - 1));\n",
    "prefixes": [
        "dpdk-dev",
        "RFC",
        "02/10"
    ]
}