get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 42103,
    "url": "http://patches.dpdk.org/api/patches/42103/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180702152547.31423-5-maxime.coquelin@redhat.com/",
    "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": "<20180702152547.31423-5-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180702152547.31423-5-maxime.coquelin@redhat.com",
    "date": "2018-07-02T15:25:47",
    "name": "[v4,4/4] net/virtio: improve offload check performance",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "537f1c7b0ca7f467a082abc11d820a6b668778e7",
    "submitter": {
        "id": 512,
        "url": "http://patches.dpdk.org/api/people/512/?format=api",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180702152547.31423-5-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 357,
            "url": "http://patches.dpdk.org/api/series/357/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=357",
            "date": "2018-07-02T15:25:43",
            "name": "net/virtio: Tx simple path removal and offload improvements",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/357/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42103/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/42103/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 473BF1B53C;\n\tMon,  2 Jul 2018 17:26:12 +0200 (CEST)",
            "from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73])\n\tby dpdk.org (Postfix) with ESMTP id 763E11B508\n\tfor <dev@dpdk.org>; Mon,  2 Jul 2018 17:26:08 +0200 (CEST)",
            "from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 1A8BA4022909;\n\tMon,  2 Jul 2018 15:26:08 +0000 (UTC)",
            "from localhost.localdomain (ovpn-112-41.ams2.redhat.com\n\t[10.36.112.41])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id EA05A111AF34;\n\tMon,  2 Jul 2018 15:26:06 +0000 (UTC)"
        ],
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "To": "tiwei.bie@intel.com,\n\tzhihong.wang@intel.com,\n\tdev@dpdk.org",
        "Cc": "yong.liu@intel.com,\n\tMaxime Coquelin <maxime.coquelin@redhat.com>",
        "Date": "Mon,  2 Jul 2018 17:25:47 +0200",
        "Message-Id": "<20180702152547.31423-5-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20180702152547.31423-1-maxime.coquelin@redhat.com>",
        "References": "<20180702152547.31423-1-maxime.coquelin@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.78 on 10.11.54.3",
        "X-Greylist": [
            "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.11.55.6]); Mon, 02 Jul 2018 15:26:08 +0000 (UTC)",
            "inspected by milter-greylist-4.5.16 (mx1.redhat.com\n\t[10.11.55.6]); \n\tMon, 02 Jul 2018 15:26:08 +0000 (UTC) for IP:'10.11.54.3'\n\tDOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com'\n\tHELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:''"
        ],
        "Subject": "[dpdk-dev] [PATCH v4 4/4] net/virtio: improve offload check\n\tperformance",
        "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": "Instead of checking the multiple Virtio features bits for\nevery packet, let's do the check once at configure time and\nstore it in virtio_hw struct.\n\nReviewed-by: Tiwei Bie <tiwei.bie@intel.com>\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n drivers/net/virtio/virtio_ethdev.c | 19 ++++++++++++++++\n drivers/net/virtio/virtio_pci.h    |  3 +++\n drivers/net/virtio/virtio_rxtx.c   | 46 +++++++++-----------------------------\n 3 files changed, 33 insertions(+), 35 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex 15d5b4f79..8c636b5f9 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -1798,6 +1798,22 @@ rte_virtio_pmd_init(void)\n \trte_pci_register(&rte_virtio_pmd);\n }\n \n+static bool\n+rx_offload_enabled(struct virtio_hw *hw)\n+{\n+\treturn vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM) ||\n+\t\tvtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4) ||\n+\t\tvtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO6);\n+}\n+\n+static bool\n+tx_offload_enabled(struct virtio_hw *hw)\n+{\n+\treturn vtpci_with_feature(hw, VIRTIO_NET_F_CSUM) ||\n+\t\tvtpci_with_feature(hw, VIRTIO_NET_F_HOST_TSO4) ||\n+\t\tvtpci_with_feature(hw, VIRTIO_NET_F_HOST_TSO6);\n+}\n+\n /*\n  * Configure virtio device\n  * It returns 0 on success.\n@@ -1877,6 +1893,9 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n \t\treturn -ENOTSUP;\n \t}\n \n+\thw->has_tx_offload = tx_offload_enabled(hw);\n+\thw->has_rx_offload = rx_offload_enabled(hw);\n+\n \tif (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)\n \t\t/* Enable vector (0) for Link State Intrerrupt */\n \t\tif (VTPCI_OPS(hw)->set_config_irq(hw, 0) ==\ndiff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h\nindex 0ec216874..58fdd3d45 100644\n--- a/drivers/net/virtio/virtio_pci.h\n+++ b/drivers/net/virtio/virtio_pci.h\n@@ -6,6 +6,7 @@\n #define _VIRTIO_PCI_H_\n \n #include <stdint.h>\n+#include <stdbool.h>\n \n #include <rte_pci.h>\n #include <rte_bus_pci.h>\n@@ -240,6 +241,8 @@ struct virtio_hw {\n \tuint8_t     use_simple_rx;\n \tuint8_t     use_inorder_rx;\n \tuint8_t     use_inorder_tx;\n+\tbool        has_tx_offload;\n+\tbool        has_rx_offload;\n \tuint16_t    port_id;\n \tuint8_t     mac_addr[ETHER_ADDR_LEN];\n \tuint32_t    notify_off_multiplier;\ndiff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c\nindex 522e5dd41..7d59bb5c1 100644\n--- a/drivers/net/virtio/virtio_rxtx.c\n+++ b/drivers/net/virtio/virtio_rxtx.c\n@@ -347,13 +347,6 @@ virtio_tso_fix_cksum(struct rte_mbuf *m)\n \t}\n }\n \n-static inline int\n-tx_offload_enabled(struct virtio_hw *hw)\n-{\n-\treturn vtpci_with_feature(hw, VIRTIO_NET_F_CSUM) ||\n-\t\tvtpci_with_feature(hw, VIRTIO_NET_F_HOST_TSO4) ||\n-\t\tvtpci_with_feature(hw, VIRTIO_NET_F_HOST_TSO6);\n-}\n \n /* avoid write operation when necessary, to lessen cache issues */\n #define ASSIGN_UNLESS_EQUAL(var, val) do {\t\\\n@@ -364,7 +357,7 @@ tx_offload_enabled(struct virtio_hw *hw)\n static inline void\n virtqueue_xmit_offload(struct virtio_net_hdr *hdr,\n \t\t\tstruct rte_mbuf *cookie,\n-\t\t\tint offload)\n+\t\t\tbool offload)\n {\n \tif (offload) {\n \t\tif (cookie->ol_flags & PKT_TX_TCP_SEG)\n@@ -421,14 +414,11 @@ virtqueue_enqueue_xmit_inorder(struct virtnet_tx *txvq,\n \tstruct virtio_net_hdr *hdr;\n \tuint16_t idx;\n \tuint16_t head_size = vq->hw->vtnet_hdr_size;\n-\tint offload;\n \tuint16_t i = 0;\n \n \tidx = vq->vq_desc_head_idx;\n \tstart_dp = vq->vq_ring.desc;\n \n-\toffload = tx_offload_enabled(vq->hw);\n-\n \twhile (i < num) {\n \t\tidx = idx & (vq->vq_nentries - 1);\n \t\tdxp = &vq->vq_descx[idx];\n@@ -440,7 +430,7 @@ virtqueue_enqueue_xmit_inorder(struct virtnet_tx *txvq,\n \t\tcookies[i]->pkt_len -= head_size;\n \n \t\t/* if offload disabled, it is not zeroed below, do it now */\n-\t\tif (offload == 0) {\n+\t\tif (!vq->hw->has_tx_offload) {\n \t\t\tASSIGN_UNLESS_EQUAL(hdr->csum_start, 0);\n \t\t\tASSIGN_UNLESS_EQUAL(hdr->csum_offset, 0);\n \t\t\tASSIGN_UNLESS_EQUAL(hdr->flags, 0);\n@@ -449,7 +439,8 @@ virtqueue_enqueue_xmit_inorder(struct virtnet_tx *txvq,\n \t\t\tASSIGN_UNLESS_EQUAL(hdr->hdr_len, 0);\n \t\t}\n \n-\t\tvirtqueue_xmit_offload(hdr, cookies[i], offload);\n+\t\tvirtqueue_xmit_offload(hdr, cookies[i],\n+\t\t\t\tvq->hw->has_tx_offload);\n \n \t\tstart_dp[idx].addr  = VIRTIO_MBUF_DATA_DMA_ADDR(cookies[i], vq);\n \t\tstart_dp[idx].len   = cookies[i]->data_len;\n@@ -478,9 +469,6 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,\n \tuint16_t head_idx, idx;\n \tuint16_t head_size = vq->hw->vtnet_hdr_size;\n \tstruct virtio_net_hdr *hdr;\n-\tint offload;\n-\n-\toffload = tx_offload_enabled(vq->hw);\n \n \thead_idx = vq->vq_desc_head_idx;\n \tidx = head_idx;\n@@ -500,7 +488,7 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,\n \t\tcookie->pkt_len -= head_size;\n \n \t\t/* if offload disabled, it is not zeroed below, do it now */\n-\t\tif (offload == 0) {\n+\t\tif (!vq->hw->has_tx_offload) {\n \t\t\tASSIGN_UNLESS_EQUAL(hdr->csum_start, 0);\n \t\t\tASSIGN_UNLESS_EQUAL(hdr->csum_offset, 0);\n \t\t\tASSIGN_UNLESS_EQUAL(hdr->flags, 0);\n@@ -537,7 +525,7 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,\n \t\tidx = start_dp[idx].next;\n \t}\n \n-\tvirtqueue_xmit_offload(hdr, cookie, offload);\n+\tvirtqueue_xmit_offload(hdr, cookie, vq->hw->has_tx_offload);\n \n \tdo {\n \t\tstart_dp[idx].addr  = VIRTIO_MBUF_DATA_DMA_ADDR(cookie, vq);\n@@ -894,14 +882,6 @@ virtio_rx_offload(struct rte_mbuf *m, struct virtio_net_hdr *hdr)\n \treturn 0;\n }\n \n-static inline int\n-rx_offload_enabled(struct virtio_hw *hw)\n-{\n-\treturn vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM) ||\n-\t\tvtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4) ||\n-\t\tvtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO6);\n-}\n-\n #define VIRTIO_MBUF_BURST_SZ 64\n #define DESC_PER_CACHELINE (RTE_CACHE_LINE_SIZE / sizeof(struct vring_desc))\n uint16_t\n@@ -917,7 +897,6 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\n \tint error;\n \tuint32_t i, nb_enqueued;\n \tuint32_t hdr_size;\n-\tint offload;\n \tstruct virtio_net_hdr *hdr;\n \n \tnb_rx = 0;\n@@ -939,7 +918,6 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\n \n \tnb_enqueued = 0;\n \thdr_size = hw->vtnet_hdr_size;\n-\toffload = rx_offload_enabled(hw);\n \n \tfor (i = 0; i < num ; i++) {\n \t\trxm = rcv_pkts[i];\n@@ -968,7 +946,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\n \t\tif (hw->vlan_strip)\n \t\t\trte_vlan_strip(rxm);\n \n-\t\tif (offload && virtio_rx_offload(rxm, hdr) < 0) {\n+\t\tif (hw->has_rx_offload && virtio_rx_offload(rxm, hdr) < 0) {\n \t\t\tvirtio_discard_rxbuf(vq, rxm);\n \t\t\trxvq->stats.errors++;\n \t\t\tcontinue;\n@@ -1030,7 +1008,6 @@ virtio_recv_mergeable_pkts_inorder(void *rx_queue,\n \tuint32_t seg_res;\n \tuint32_t hdr_size;\n \tint32_t i;\n-\tint offload;\n \n \tnb_rx = 0;\n \tif (unlikely(hw->started == 0))\n@@ -1048,7 +1025,6 @@ virtio_recv_mergeable_pkts_inorder(void *rx_queue,\n \tseg_num = 1;\n \tseg_res = 0;\n \thdr_size = hw->vtnet_hdr_size;\n-\toffload = rx_offload_enabled(hw);\n \n \tnum = virtqueue_dequeue_rx_inorder(vq, rcv_pkts, len, nb_used);\n \n@@ -1088,7 +1064,8 @@ virtio_recv_mergeable_pkts_inorder(void *rx_queue,\n \t\trx_pkts[nb_rx] = rxm;\n \t\tprev = rxm;\n \n-\t\tif (offload && virtio_rx_offload(rxm, &header->hdr) < 0) {\n+\t\tif (vq->hw->has_rx_offload &&\n+\t\t\t\tvirtio_rx_offload(rxm, &header->hdr) < 0) {\n \t\t\tvirtio_discard_rxbuf_inorder(vq, rxm);\n \t\t\trxvq->stats.errors++;\n \t\t\tcontinue;\n@@ -1218,7 +1195,6 @@ virtio_recv_mergeable_pkts(void *rx_queue,\n \tuint16_t extra_idx;\n \tuint32_t seg_res;\n \tuint32_t hdr_size;\n-\tint offload;\n \n \tnb_rx = 0;\n \tif (unlikely(hw->started == 0))\n@@ -1236,7 +1212,6 @@ virtio_recv_mergeable_pkts(void *rx_queue,\n \textra_idx = 0;\n \tseg_res = 0;\n \thdr_size = hw->vtnet_hdr_size;\n-\toffload = rx_offload_enabled(hw);\n \n \twhile (i < nb_used) {\n \t\tstruct virtio_net_hdr_mrg_rxbuf *header;\n@@ -1281,7 +1256,8 @@ virtio_recv_mergeable_pkts(void *rx_queue,\n \t\trx_pkts[nb_rx] = rxm;\n \t\tprev = rxm;\n \n-\t\tif (offload && virtio_rx_offload(rxm, &header->hdr) < 0) {\n+\t\tif (hw->has_rx_offload &&\n+\t\t\t\tvirtio_rx_offload(rxm, &header->hdr) < 0) {\n \t\t\tvirtio_discard_rxbuf(vq, rxm);\n \t\t\trxvq->stats.errors++;\n \t\t\tcontinue;\n",
    "prefixes": [
        "v4",
        "4/4"
    ]
}