get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2523,
    "url": "https://patches.dpdk.org/api/patches/2523/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1422326164-13697-3-git-send-email-changchun.ouyang@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": "<1422326164-13697-3-git-send-email-changchun.ouyang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1422326164-13697-3-git-send-email-changchun.ouyang@intel.com",
    "date": "2015-01-27T02:35:42",
    "name": "[dpdk-dev,v2,02/24] virtio: Use weaker barriers",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "97b812ecb5749cfd1c157d58d8dd06e35b20ff2e",
    "submitter": {
        "id": 31,
        "url": "https://patches.dpdk.org/api/people/31/?format=api",
        "name": "Ouyang Changchun",
        "email": "changchun.ouyang@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1422326164-13697-3-git-send-email-changchun.ouyang@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2523/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2523/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 A7D7A5ABA;\n\tTue, 27 Jan 2015 03:37:47 +0100 (CET)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 0A1A05A8F\n\tfor <dev@dpdk.org>; Tue, 27 Jan 2015 03:36:18 +0100 (CET)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga103.jf.intel.com with ESMTP; 26 Jan 2015 18:32:01 -0800",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga003.jf.intel.com with ESMTP; 26 Jan 2015 18:29:12 -0800",
            "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id t0R2aDRP014824;\n\tTue, 27 Jan 2015 10:36:13 +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 t0R2aBPU013744; Tue, 27 Jan 2015 10:36:13 +0800",
            "(from couyang@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t0R2aBP9013740; \n\tTue, 27 Jan 2015 10:36:11 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.09,471,1418112000\"; d=\"scan'208\";a=\"518014828\"",
        "From": "Ouyang Changchun <changchun.ouyang@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue, 27 Jan 2015 10:35:42 +0800",
        "Message-Id": "<1422326164-13697-3-git-send-email-changchun.ouyang@intel.com>",
        "X-Mailer": "git-send-email 1.7.12.2",
        "In-Reply-To": "<1422326164-13697-1-git-send-email-changchun.ouyang@intel.com>",
        "References": "<1421298930-15210-1-git-send-email-changchun.ouyang@intel.com>\n\t<1422326164-13697-1-git-send-email-changchun.ouyang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 02/24] virtio: Use weaker 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>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "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>\nSigned-off-by: Changchun Ouyang <changchun.ouyang@intel.com>\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": "diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c\nindex 662a49c..dc47e72 100644\n--- a/lib/librte_pmd_virtio/virtio_ethdev.c\n+++ b/lib/librte_pmd_virtio/virtio_ethdev.c\n@@ -175,7 +175,7 @@ virtio_send_command(struct virtqueue *vq, struct virtio_pmd_ctrl *ctrl,\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));\ndiff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c\nindex c013f97..78af334 100644\n--- a/lib/librte_pmd_virtio/virtio_rxtx.c\n+++ b/lib/librte_pmd_virtio/virtio_rxtx.c\n@@ -456,7 +456,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\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@@ -516,6 +516,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\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@@ -547,7 +548,7 @@ virtio_recv_mergeable_pkts(void *rx_queue,\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 rte_mbuf **tx_pkts, uint16_t nb_pkts)\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@@ -735,6 +736,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)\n \t\t}\n \t}\n \tvq_update_avail_idx(txvq);\n+\tvirtio_wmb();\n \n \ttxvq->packets += nb_tx;\n \ndiff --git a/lib/librte_pmd_virtio/virtqueue.h b/lib/librte_pmd_virtio/virtqueue.h\nindex fdee054..f6ad98d 100644\n--- a/lib/librte_pmd_virtio/virtqueue.h\n+++ b/lib/librte_pmd_virtio/virtqueue.h\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@@ -225,7 +234,7 @@ virtqueue_full(const struct virtqueue *vq)\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@@ -255,7 +264,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",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "02/24"
    ]
}