Show a patch.

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

{
    "id": 42100,
    "url": "http://patches.dpdk.org/api/patches/42100/",
    "web_url": "http://patches.dpdk.org/patch/42100/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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": "<20180702152547.31423-2-maxime.coquelin@redhat.com>",
    "date": "2018-07-02T15:25:44",
    "name": "[v4,1/4] net/virtio: remove simple Tx path",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "5794b7c307f62e7f2c2dfd57c85669c3b9af5845",
    "submitter": {
        "id": 512,
        "url": "http://patches.dpdk.org/api/people/512/",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/patch/42100/mbox/",
    "series": [
        {
            "id": 357,
            "url": "http://patches.dpdk.org/api/series/357/",
            "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/42100/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/42100/checks/",
    "tags": {},
    "headers": {
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Message-Id": "<20180702152547.31423-2-maxime.coquelin@redhat.com>",
        "To": "tiwei.bie@intel.com,\n\tzhihong.wang@intel.com,\n\tdev@dpdk.org",
        "X-Scanned-By": "MIMEDefang 2.78 on 10.11.54.3",
        "Cc": "yong.liu@intel.com,\n\tMaxime Coquelin <maxime.coquelin@redhat.com>",
        "X-BeenThere": "dev@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 288081B500;\n\tMon,  2 Jul 2018 17:26:07 +0200 (CEST)",
            "from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73])\n\tby dpdk.org (Postfix) with ESMTP id E1F4C1B430\n\tfor <dev@dpdk.org>; Mon,  2 Jul 2018 17:26:03 +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 887E881663C3;\n\tMon,  2 Jul 2018 15:26:03 +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 43CD6111AF34;\n\tMon,  2 Jul 2018 15:26:02 +0000 (UTC)"
        ],
        "Subject": "[dpdk-dev] [PATCH v4 1/4] net/virtio: remove simple Tx path",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "X-Greylist": [
            "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.11.55.8]); Mon, 02 Jul 2018 15:26:03 +0000 (UTC)",
            "inspected by milter-greylist-4.5.16 (mx1.redhat.com\n\t[10.11.55.8]); \n\tMon, 02 Jul 2018 15:26:03 +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:''"
        ],
        "List-Post": "<mailto:dev@dpdk.org>",
        "In-Reply-To": "<20180702152547.31423-1-maxime.coquelin@redhat.com>",
        "Precedence": "list",
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "References": "<20180702152547.31423-1-maxime.coquelin@redhat.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Errors-To": "dev-bounces@dpdk.org",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Delivered-To": "patchwork@dpdk.org",
        "Date": "Mon,  2 Jul 2018 17:25:44 +0200",
        "X-Mailman-Version": "2.1.15",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>"
    },
    "content": "The simple Tx path does not comply with the Virtio specification.\nNow that VIRTIO_F_IN_ORDER feature is supported by the Virtio PMD,\nlet's use this optimized path instead.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n drivers/net/virtio/virtio_ethdev.c      | 11 +-----\n drivers/net/virtio/virtio_pci.h         |  1 -\n drivers/net/virtio/virtio_rxtx.c        | 28 +-------------\n drivers/net/virtio/virtio_rxtx_simple.c | 67 ---------------------------------\n drivers/net/virtio/virtio_rxtx_simple.h | 49 ------------------------\n drivers/net/virtio/virtio_user_ethdev.c |  1 -\n 6 files changed, 2 insertions(+), 155 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex 02980e3d1..73c428734 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -1336,11 +1336,7 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)\n \t\teth_dev->rx_pkt_burst = &virtio_recv_pkts;\n \t}\n \n-\tif (hw->use_simple_tx) {\n-\t\tPMD_INIT_LOG(INFO, \"virtio: using simple Tx path on port %u\",\n-\t\t\teth_dev->data->port_id);\n-\t\teth_dev->tx_pkt_burst = virtio_xmit_pkts_simple;\n-\t} else if (hw->use_inorder_tx) {\n+\tif (hw->use_inorder_tx) {\n \t\tPMD_INIT_LOG(INFO, \"virtio: using inorder Tx path on port %u\",\n \t\t\teth_dev->data->port_id);\n \t\teth_dev->tx_pkt_burst = virtio_xmit_pkts_inorder;\n@@ -1881,12 +1877,9 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n \trte_spinlock_init(&hw->state_lock);\n \n \thw->use_simple_rx = 1;\n-\thw->use_simple_tx = 1;\n \n \tif (vtpci_with_feature(hw, VIRTIO_F_IN_ORDER)) {\n-\t\t/* Simple Tx not compatible with in-order ring */\n \t\thw->use_inorder_tx = 1;\n-\t\thw->use_simple_tx = 0;\n \t\tif (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {\n \t\t\thw->use_inorder_rx = 1;\n \t\t\thw->use_simple_rx = 0;\n@@ -1898,12 +1891,10 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n #if defined RTE_ARCH_ARM64 || defined RTE_ARCH_ARM\n \tif (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON)) {\n \t\thw->use_simple_rx = 0;\n-\t\thw->use_simple_tx = 0;\n \t}\n #endif\n \tif (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {\n \t\t hw->use_simple_rx = 0;\n-\t\t hw->use_simple_tx = 0;\n \t}\n \n \tif (rx_offloads & (DEV_RX_OFFLOAD_UDP_CKSUM |\ndiff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h\nindex 77f805df6..0ec216874 100644\n--- a/drivers/net/virtio/virtio_pci.h\n+++ b/drivers/net/virtio/virtio_pci.h\n@@ -238,7 +238,6 @@ struct virtio_hw {\n \tuint8_t\t    use_msix;\n \tuint8_t     modern;\n \tuint8_t     use_simple_rx;\n-\tuint8_t     use_simple_tx;\n \tuint8_t     use_inorder_rx;\n \tuint8_t     use_inorder_tx;\n \tuint16_t    port_id;\ndiff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c\nindex 6394071b8..522e5dd41 100644\n--- a/drivers/net/virtio/virtio_rxtx.c\n+++ b/drivers/net/virtio/virtio_rxtx.c\n@@ -708,10 +708,6 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev,\n \n \tPMD_INIT_FUNC_TRACE();\n \n-\t/* cannot use simple rxtx funcs with multisegs or offloads */\n-\tif (dev->data->dev_conf.txmode.offloads)\n-\t\thw->use_simple_tx = 0;\n-\n \tif (nb_desc == 0 || nb_desc > vq->vq_nentries)\n \t\tnb_desc = vq->vq_nentries;\n \tvq->vq_free_cnt = RTE_MIN(vq->vq_free_cnt, nb_desc);\n@@ -746,33 +742,11 @@ virtio_dev_tx_queue_setup_finish(struct rte_eth_dev *dev,\n \tuint8_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX;\n \tstruct virtio_hw *hw = dev->data->dev_private;\n \tstruct virtqueue *vq = hw->vqs[vtpci_queue_idx];\n-\tuint16_t mid_idx = vq->vq_nentries >> 1;\n-\tstruct virtnet_tx *txvq = &vq->txq;\n-\tuint16_t desc_idx;\n \n \tPMD_INIT_FUNC_TRACE();\n \n-\tif (hw->use_simple_tx) {\n-\t\tfor (desc_idx = 0; desc_idx < mid_idx; desc_idx++) {\n-\t\t\tvq->vq_ring.avail->ring[desc_idx] =\n-\t\t\t\tdesc_idx + mid_idx;\n-\t\t\tvq->vq_ring.desc[desc_idx + mid_idx].next =\n-\t\t\t\tdesc_idx;\n-\t\t\tvq->vq_ring.desc[desc_idx + mid_idx].addr =\n-\t\t\t\ttxvq->virtio_net_hdr_mem +\n-\t\t\t\toffsetof(struct virtio_tx_region, tx_hdr);\n-\t\t\tvq->vq_ring.desc[desc_idx + mid_idx].len =\n-\t\t\t\tvq->hw->vtnet_hdr_size;\n-\t\t\tvq->vq_ring.desc[desc_idx + mid_idx].flags =\n-\t\t\t\tVRING_DESC_F_NEXT;\n-\t\t\tvq->vq_ring.desc[desc_idx].flags = 0;\n-\t\t}\n-\t\tfor (desc_idx = mid_idx; desc_idx < vq->vq_nentries;\n-\t\t     desc_idx++)\n-\t\t\tvq->vq_ring.avail->ring[desc_idx] = desc_idx;\n-\t} else if (hw->use_inorder_tx) {\n+\tif (hw->use_inorder_tx)\n \t\tvq->vq_ring.desc[vq->vq_nentries - 1].next = 0;\n-\t}\n \n \tVIRTQUEUE_DUMP(vq);\n \ndiff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c\nindex 515207581..31e565b4c 100644\n--- a/drivers/net/virtio/virtio_rxtx_simple.c\n+++ b/drivers/net/virtio/virtio_rxtx_simple.c\n@@ -27,73 +27,6 @@\n #pragma GCC diagnostic ignored \"-Wcast-qual\"\n #endif\n \n-uint16_t\n-virtio_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts,\n-\tuint16_t nb_pkts)\n-{\n-\tstruct virtnet_tx *txvq = tx_queue;\n-\tstruct virtqueue *vq = txvq->vq;\n-\tstruct virtio_hw *hw = vq->hw;\n-\tuint16_t nb_used;\n-\tuint16_t desc_idx;\n-\tstruct vring_desc *start_dp;\n-\tuint16_t nb_tail, nb_commit;\n-\tint i;\n-\tuint16_t desc_idx_max = (vq->vq_nentries >> 1) - 1;\n-\tuint16_t nb_tx = 0;\n-\n-\tif (unlikely(hw->started == 0 && tx_pkts != hw->inject_pkts))\n-\t\treturn nb_tx;\n-\n-\tnb_used = VIRTQUEUE_NUSED(vq);\n-\trte_compiler_barrier();\n-\n-\tif (nb_used >= VIRTIO_TX_FREE_THRESH)\n-\t\tvirtio_xmit_cleanup_simple(vq);\n-\n-\tnb_commit = nb_pkts = RTE_MIN((vq->vq_free_cnt >> 1), nb_pkts);\n-\tdesc_idx = (uint16_t)(vq->vq_avail_idx & desc_idx_max);\n-\tstart_dp = vq->vq_ring.desc;\n-\tnb_tail = (uint16_t) (desc_idx_max + 1 - desc_idx);\n-\n-\tif (nb_commit >= nb_tail) {\n-\t\tfor (i = 0; i < nb_tail; i++)\n-\t\t\tvq->vq_descx[desc_idx + i].cookie = tx_pkts[i];\n-\t\tfor (i = 0; i < nb_tail; i++) {\n-\t\t\tstart_dp[desc_idx].addr =\n-\t\t\t\tVIRTIO_MBUF_DATA_DMA_ADDR(*tx_pkts, vq);\n-\t\t\tstart_dp[desc_idx].len = (*tx_pkts)->pkt_len;\n-\t\t\ttx_pkts++;\n-\t\t\tdesc_idx++;\n-\t\t}\n-\t\tnb_commit -= nb_tail;\n-\t\tdesc_idx = 0;\n-\t}\n-\tfor (i = 0; i < nb_commit; i++)\n-\t\tvq->vq_descx[desc_idx + i].cookie = tx_pkts[i];\n-\tfor (i = 0; i < nb_commit; i++) {\n-\t\tstart_dp[desc_idx].addr =\n-\t\t\tVIRTIO_MBUF_DATA_DMA_ADDR(*tx_pkts, vq);\n-\t\tstart_dp[desc_idx].len = (*tx_pkts)->pkt_len;\n-\t\ttx_pkts++;\n-\t\tdesc_idx++;\n-\t}\n-\n-\trte_compiler_barrier();\n-\n-\tvq->vq_free_cnt -= (uint16_t)(nb_pkts << 1);\n-\tvq->vq_avail_idx += nb_pkts;\n-\tvq->vq_ring.avail->idx = vq->vq_avail_idx;\n-\ttxvq->stats.packets += nb_pkts;\n-\n-\tif (likely(nb_pkts)) {\n-\t\tif (unlikely(virtqueue_kick_prepare(vq)))\n-\t\t\tvirtqueue_notify(vq);\n-\t}\n-\n-\treturn nb_pkts;\n-}\n-\n int __attribute__((cold))\n virtio_rxq_vec_setup(struct virtnet_rx *rxq)\n {\ndiff --git a/drivers/net/virtio/virtio_rxtx_simple.h b/drivers/net/virtio/virtio_rxtx_simple.h\nindex 303904d64..dc97e4ccf 100644\n--- a/drivers/net/virtio/virtio_rxtx_simple.h\n+++ b/drivers/net/virtio/virtio_rxtx_simple.h\n@@ -55,53 +55,4 @@ virtio_rxq_rearm_vec(struct virtnet_rx *rxvq)\n \tvq_update_avail_idx(vq);\n }\n \n-#define VIRTIO_TX_FREE_THRESH 32\n-#define VIRTIO_TX_MAX_FREE_BUF_SZ 32\n-#define VIRTIO_TX_FREE_NR 32\n-/* TODO: vq->tx_free_cnt could mean num of free slots so we could avoid shift */\n-static inline void\n-virtio_xmit_cleanup_simple(struct virtqueue *vq)\n-{\n-\tuint16_t i, desc_idx;\n-\tuint32_t nb_free = 0;\n-\tstruct rte_mbuf *m, *free[VIRTIO_TX_MAX_FREE_BUF_SZ];\n-\n-\tdesc_idx = (uint16_t)(vq->vq_used_cons_idx &\n-\t\t   ((vq->vq_nentries >> 1) - 1));\n-\tm = (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie;\n-\tm = rte_pktmbuf_prefree_seg(m);\n-\tif (likely(m != NULL)) {\n-\t\tfree[0] = m;\n-\t\tnb_free = 1;\n-\t\tfor (i = 1; i < VIRTIO_TX_FREE_NR; i++) {\n-\t\t\tm = (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie;\n-\t\t\tm = rte_pktmbuf_prefree_seg(m);\n-\t\t\tif (likely(m != NULL)) {\n-\t\t\t\tif (likely(m->pool == free[0]->pool))\n-\t\t\t\t\tfree[nb_free++] = m;\n-\t\t\t\telse {\n-\t\t\t\t\trte_mempool_put_bulk(free[0]->pool,\n-\t\t\t\t\t\t(void **)free,\n-\t\t\t\t\t\tRTE_MIN(RTE_DIM(free),\n-\t\t\t\t\t\t\tnb_free));\n-\t\t\t\t\tfree[0] = m;\n-\t\t\t\t\tnb_free = 1;\n-\t\t\t\t}\n-\t\t\t}\n-\t\t}\n-\t\trte_mempool_put_bulk(free[0]->pool, (void **)free,\n-\t\t\tRTE_MIN(RTE_DIM(free), nb_free));\n-\t} else {\n-\t\tfor (i = 1; i < VIRTIO_TX_FREE_NR; i++) {\n-\t\t\tm = (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie;\n-\t\t\tm = rte_pktmbuf_prefree_seg(m);\n-\t\t\tif (m != NULL)\n-\t\t\t\trte_mempool_put(m->pool, m);\n-\t\t}\n-\t}\n-\n-\tvq->vq_used_cons_idx += VIRTIO_TX_FREE_NR;\n-\tvq->vq_free_cnt += (VIRTIO_TX_FREE_NR << 1);\n-}\n-\n #endif /* _VIRTIO_RXTX_SIMPLE_H_ */\ndiff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c\nindex fcd30251f..5ee59d5e5 100644\n--- a/drivers/net/virtio/virtio_user_ethdev.c\n+++ b/drivers/net/virtio/virtio_user_ethdev.c\n@@ -436,7 +436,6 @@ virtio_user_eth_dev_alloc(struct rte_vdev_device *vdev)\n \thw->use_msix = 1;\n \thw->modern   = 0;\n \thw->use_simple_rx = 0;\n-\thw->use_simple_tx = 0;\n \thw->use_inorder_rx = 0;\n \thw->use_inorder_tx = 0;\n \thw->virtio_user_dev = dev;\n",
    "prefixes": [
        "v4",
        "1/4"
    ]
}