Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/40696/?format=api
https://patches.dpdk.org/api/patches/40696/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20180606123128.7868-6-maxime.coquelin@redhat.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": "<20180606123128.7868-6-maxime.coquelin@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20180606123128.7868-6-maxime.coquelin@redhat.com", "date": "2018-06-06T12:31:28", "name": "[dpdk-dev,v2,5/5] net/virtio: improve offload check performance", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "943077079b6c576fed2c4bcf85c850cdbff0f730", "submitter": { "id": 512, "url": "https://patches.dpdk.org/api/people/512/?format=api", "name": "Maxime Coquelin", "email": "maxime.coquelin@redhat.com" }, "delegate": { "id": 2642, "url": "https://patches.dpdk.org/api/users/2642/?format=api", "username": "mcoquelin", "first_name": "Maxime", "last_name": "Coquelin", "email": "maxime.coquelin@redhat.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20180606123128.7868-6-maxime.coquelin@redhat.com/mbox/", "series": [ { "id": 20, "url": "https://patches.dpdk.org/api/series/20/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=20", "date": "2018-06-06T12:31:23", "name": "net/virtio: Tx path selection and offload improvements", "version": 2, "mbox": "https://patches.dpdk.org/series/20/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/40696/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/40696/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<maxime.coquelin@redhat.com>", "Received": [ "from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73])\n\tby dpdk.org (Postfix) with ESMTP id E6C231B2A9\n\tfor <dev@dpdk.org>; Wed, 6 Jun 2018 14:31:49 +0200 (CEST)", "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5])\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 8C612401EF11;\n\tWed, 6 Jun 2018 12:31:49 +0000 (UTC)", "from localhost.localdomain (ovpn-112-47.ams2.redhat.com\n\t[10.36.112.47])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 8670663F7F;\n\tWed, 6 Jun 2018 12:31:48 +0000 (UTC)" ], "From": "Maxime Coquelin <maxime.coquelin@redhat.com>", "To": "zhihong.wang@intel.com,\n\ttiwei.bie@intel.com,\n\tdev@dpdk.org", "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>", "Date": "Wed, 6 Jun 2018 14:31:28 +0200", "Message-Id": "<20180606123128.7868-6-maxime.coquelin@redhat.com>", "In-Reply-To": "<20180606123128.7868-1-maxime.coquelin@redhat.com>", "References": "<20180606123128.7868-1-maxime.coquelin@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.11.54.5", "X-Greylist": [ "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.11.55.5]); Wed, 06 Jun 2018 12:31:49 +0000 (UTC)", "inspected by milter-greylist-4.5.16 (mx1.redhat.com\n\t[10.11.55.5]); \n\tWed, 06 Jun 2018 12:31:49 +0000 (UTC) for IP:'10.11.54.5'\n\tDOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com'\n\tHELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:''" ], "Subject": "[dpdk-dev] [PATCH v2 5/5] 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://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": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "X-List-Received-Date": "Wed, 06 Jun 2018 12:31:50 -0000" }, "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\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 | 31 +++++--------------------------\n 3 files changed, 27 insertions(+), 26 deletions(-)", "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex 357968fdd..3d4b28be8 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -1851,6 +1851,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@@ -1934,6 +1950,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..8579a7567 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@@ -270,8 +261,7 @@ virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,\n \t\t * which is wrong. Below subtract restores correct pkt size.\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 +299,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 +676,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 +691,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 +712,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 +740,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 +805,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 +822,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 +866,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", "v2", "5/5" ] }{ "id": 40696, "url": "