Show a patch.

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

{
    "id": 40712,
    "url": "http://patches.dpdk.org/api/patches/40712/?format=api",
    "web_url": "http://patches.dpdk.org/patch/40712/",
    "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"
    },
    "msgid": "<20180607092616.27720-6-maxime.coquelin@redhat.com>",
    "date": "2018-06-07T09:26:16",
    "name": "[dpdk-dev,v3,5/5] net/virtio: improve offload check performance",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e170d2009e052cf8484fff9af98ad1354aec6ede",
    "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/patch/40712/mbox/",
    "series": [
        {
            "id": 25,
            "url": "http://patches.dpdk.org/api/series/25/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=25",
            "date": "2018-06-07T09:26:11",
            "name": "net/virtio: Tx path selection and offload improvements",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/25/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/40712/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/40712/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-Mailman-Version": "2.1.15",
        "X-Greylist": [
            "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.11.55.2]); Thu, 07 Jun 2018 09:26:39 +0000 (UTC)",
            "inspected by milter-greylist-4.5.16 (mx1.redhat.com\n\t[10.11.55.2]); \n\tThu, 07 Jun 2018 09:26:39 +0000 (UTC) for IP:'10.11.54.6'\n\tDOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com'\n\tHELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:''"
        ],
        "Precedence": "list",
        "Delivered-To": "patchwork@dpdk.org",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "References": "<20180607092616.27720-1-maxime.coquelin@redhat.com>",
        "X-BeenThere": "dev@dpdk.org",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH v3 5/5] net/virtio: improve offload check\n\tperformance",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 271C81B1A8;\n\tThu,  7 Jun 2018 11:26:42 +0200 (CEST)",
            "from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73])\n\tby dpdk.org (Postfix) with ESMTP id 8D4591B16F\n\tfor <dev@dpdk.org>; Thu,  7 Jun 2018 11:26:39 +0200 (CEST)",
            "from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6])\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 325E58A9FF;\n\tThu,  7 Jun 2018 09:26:39 +0000 (UTC)",
            "from localhost.localdomain (ovpn-112-46.ams2.redhat.com\n\t[10.36.112.46])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 27DA820357CA;\n\tThu,  7 Jun 2018 09:26:37 +0000 (UTC)"
        ],
        "To": "zhihong.wang@intel.com,\n\ttiwei.bie@intel.com,\n\tdev@dpdk.org",
        "List-Unsubscribe": "<https://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Thu,  7 Jun 2018 11:26:16 +0200",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "X-Scanned-By": "MIMEDefang 2.78 on 10.11.54.6",
        "In-Reply-To": "<20180607092616.27720-1-maxime.coquelin@redhat.com>",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Message-Id": "<20180607092616.27720-6-maxime.coquelin@redhat.com>",
        "Return-Path": "<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   | 30 +++++-------------------------\n 3 files changed, 27 insertions(+), 25 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex 060557617..0bcb22696 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -1852,6 +1852,22 @@ virtio_dev_args(struct rte_eth_dev *dev)\n \treturn 0;\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@@ -1935,6 +1951,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 7318bb318..337dc6180 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@@ -234,6 +235,8 @@ struct virtio_hw {\n \tuint8_t\t    support_simple_tx;\n \tuint8_t     use_simple_rx;\n \tuint8_t     use_simple_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 92fab2174..ba5a0b11c 100644\n--- a/drivers/net/virtio/virtio_rxtx.c\n+++ b/drivers/net/virtio/virtio_rxtx.c\n@@ -225,13 +225,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@@ -251,9 +244,7 @@ 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 \thead_idx = vq->vq_desc_head_idx;\n \tidx = head_idx;\n \tdxp = &vq->vq_descx[idx];\n@@ -271,7 +262,7 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,\n \t\t */\n \t\tcookie->pkt_len -= head_size;\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@@ -309,7 +300,7 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,\n \t}\n \n \t/* Checksum Offload / TSO */\n-\tif (offload) {\n+\tif (vq->hw->has_tx_offload) {\n \t\tif (cookie->ol_flags & PKT_TX_TCP_SEG)\n \t\t\tcookie->ol_flags |= PKT_TX_TCP_CKSUM;\n \n@@ -686,14 +677,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@@ -709,7 +692,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@@ -731,7 +713,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@@ -760,7 +741,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@@ -825,7 +806,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@@ -843,7 +823,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@@ -888,7 +867,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": [
        "dpdk-dev",
        "v3",
        "5/5"
    ]
}