get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 310,
    "url": "http://patches.dpdk.org/api/patches/310/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1409759378-10113-13-git-send-email-bruce.richardson@intel.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": "<1409759378-10113-13-git-send-email-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1409759378-10113-13-git-send-email-bruce.richardson@intel.com",
    "date": "2014-09-03T15:49:37",
    "name": "[dpdk-dev,12/13] ixgbe: Fix perf regression due to moved pool ptr",
    "commit_ref": "",
    "pull_url": "",
    "state": "superseded",
    "archived": true,
    "hash": "6d45a1caa104b2b2222319d0f50a3b3699bb7b1d",
    "submitter": {
        "id": 20,
        "url": "http://patches.dpdk.org/api/people/20/?format=api",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1409759378-10113-13-git-send-email-bruce.richardson@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/310/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/310/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<bricha3@ecsmtp.ir.intel.com>",
        "Received": [
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\r\n\tby dpdk.org (Postfix) with ESMTP id DD88DB3A6\r\n\tfor <dev@dpdk.org>; Wed,  3 Sep 2014 17:45:43 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\r\n\tby fmsmga102.fm.intel.com with ESMTP; 03 Sep 2014 08:49:45 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\r\n\tby fmsmga001.fm.intel.com with ESMTP; 03 Sep 2014 08:49:40 -0700",
            "from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com\r\n\t[10.237.217.46])\r\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\r\n\ts83Fnenl025436; Wed, 3 Sep 2014 16:49:40 +0100",
            "from sivswdev02.ir.intel.com (localhost [127.0.0.1])\r\n\tby sivswdev02.ir.intel.com with ESMTP id s83FneKm010500;\r\n\tWed, 3 Sep 2014 16:49:40 +0100",
            "(from bricha3@localhost)\r\n\tby sivswdev02.ir.intel.com with  id s83FneKe010496;\r\n\tWed, 3 Sep 2014 16:49:40 +0100"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,458,1406617200\"; d=\"scan'208\";a=\"585697553\"",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Wed,  3 Sep 2014 16:49:37 +0100",
        "Message-Id": "<1409759378-10113-13-git-send-email-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": "<1409759378-10113-1-git-send-email-bruce.richardson@intel.com>",
        "References": "<1409759378-10113-1-git-send-email-bruce.richardson@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 12/13] ixgbe: Fix perf regression due to moved\r\n\tpool ptr",
        "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>,\r\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>,\r\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-List-Received-Date": "Wed, 03 Sep 2014 15:45:45 -0000"
    },
    "content": "Adjust the fast-path code to fix the regression caused by the pool\npointer moving to the second cache line. This change adjusts the\nprefetching and also the way in which the mbufs are freed back to the\nmempool.\nNote: slow-path e.g. path supporting jumbo frames, is still slower, but\nis dealt with by a later commit\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n lib/librte_pmd_ixgbe/ixgbe_rxtx.c     |  8 ++-\n lib/librte_pmd_ixgbe/ixgbe_rxtx.h     | 14 +-----\n lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 93 +++++++++++++----------------------\n 3 files changed, 39 insertions(+), 76 deletions(-)",
    "diff": "diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c\r\nindex f48c62a..ebbcee8 100644\r\n--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c\r\n+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c\r\n@@ -142,10 +142,6 @@ ixgbe_tx_free_bufs(struct igb_tx_queue *txq)\r\n \t */\r\n \ttxep = &(txq->sw_ring[txq->tx_next_dd - (txq->tx_rs_thresh - 1)]);\r\n \r\n-\t/* prefetch the mbufs that are about to be freed */\r\n-\tfor (i = 0; i < txq->tx_rs_thresh; ++i)\r\n-\t\trte_prefetch0((txep + i)->mbuf);\r\n-\r\n \t/* free buffers one at a time */\r\n \tif ((txq->txq_flags & (uint32_t)ETH_TXQ_FLAGS_NOREFCOUNT) != 0) {\r\n \t\tfor (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {\r\n@@ -186,6 +182,7 @@ tx4(volatile union ixgbe_adv_tx_desc *txdp, struct rte_mbuf **pkts)\r\n \t\t\t\t((uint32_t)DCMD_DTYP_FLAGS | pkt_len);\r\n \t\ttxdp->read.olinfo_status =\r\n \t\t\t\t(pkt_len << IXGBE_ADVTXD_PAYLEN_SHIFT);\r\n+\t\trte_prefetch0(&(*pkts)->pool);\r\n \t}\r\n }\r\n \r\n@@ -205,6 +202,7 @@ tx1(volatile union ixgbe_adv_tx_desc *txdp, struct rte_mbuf **pkts)\r\n \t\t\t((uint32_t)DCMD_DTYP_FLAGS | pkt_len);\r\n \ttxdp->read.olinfo_status =\r\n \t\t\t(pkt_len << IXGBE_ADVTXD_PAYLEN_SHIFT);\r\n+\trte_prefetch0(&(*pkts)->pool);\r\n }\r\n \r\n /*\r\n@@ -1876,7 +1874,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,\r\n \t\tPMD_INIT_LOG(INFO, \"Using simple tx code path\\n\");\r\n #ifdef RTE_IXGBE_INC_VECTOR\r\n \t\tif (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ &&\r\n-\t\t    ixgbe_txq_vec_setup(txq, socket_id) == 0) {\r\n+\t\t    ixgbe_txq_vec_setup(txq) == 0) {\r\n \t\t\tPMD_INIT_LOG(INFO, \"Vector tx enabled.\\n\");\r\n \t\t\tdev->tx_pkt_burst = ixgbe_xmit_pkts_vec;\r\n \t\t}\r\ndiff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h\r\nindex 5e98b21..dbb57af 100644\r\n--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h\r\n+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h\r\n@@ -96,14 +96,6 @@ struct igb_tx_entry_v {\r\n };\r\n \r\n /**\r\n- * continuous entry sequence, gather by the same mempool\r\n- */\r\n-struct igb_tx_entry_seq {\r\n-\tconst struct rte_mempool* pool;\r\n-\tuint32_t same_pool;\r\n-};\r\n-\r\n-/**\r\n  * Structure associated with each RX queue.\r\n  */\r\n struct igb_rx_queue {\r\n@@ -191,10 +183,6 @@ struct igb_tx_queue {\r\n \tvolatile union ixgbe_adv_tx_desc *tx_ring;\r\n \tuint64_t            tx_ring_phys_addr; /**< TX ring DMA address. */\r\n \tstruct igb_tx_entry *sw_ring;      /**< virtual address of SW ring. */\r\n-#ifdef RTE_IXGBE_INC_VECTOR\r\n-\t/** continuous tx entry sequence within the same mempool */\r\n-\tstruct igb_tx_entry_seq *sw_ring_seq;\r\n-#endif\r\n \tvolatile uint32_t   *tdt_reg_addr; /**< Address of TDT register. */\r\n \tuint16_t            nb_tx_desc;    /**< number of TX descriptors. */\r\n \tuint16_t            tx_tail;       /**< current value of TDT reg. */\r\n@@ -259,7 +247,7 @@ struct ixgbe_txq_ops {\r\n #ifdef RTE_IXGBE_INC_VECTOR\r\n uint16_t ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts);\r\n uint16_t ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts);\r\n-int ixgbe_txq_vec_setup(struct igb_tx_queue *txq, unsigned int socket_id);\r\n+int ixgbe_txq_vec_setup(struct igb_tx_queue *txq);\r\n int ixgbe_rxq_vec_setup(struct igb_rx_queue *rxq);\r\n int ixgbe_rx_vec_condition_check(struct rte_eth_dev *dev);\r\n #endif\r\ndiff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c\r\nindex 3332a92..4f63086 100644\r\n--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c\r\n+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c\r\n@@ -342,9 +342,8 @@ static inline int __attribute__((always_inline))\r\n ixgbe_tx_free_bufs(struct igb_tx_queue *txq)\r\n {\r\n \tstruct igb_tx_entry_v *txep;\r\n-\tstruct igb_tx_entry_seq *txsp;\r\n \tuint32_t status;\r\n-\tuint32_t n, k;\r\n+\tuint32_t n;\r\n #ifdef RTE_MBUF_REFCNT\r\n \tuint32_t i;\r\n \tint nb_free = 0;\r\n@@ -364,23 +363,39 @@ ixgbe_tx_free_bufs(struct igb_tx_queue *txq)\r\n \t */\r\n \ttxep = &((struct igb_tx_entry_v *)txq->sw_ring)[txq->tx_next_dd -\r\n \t\t\t(n - 1)];\r\n-\ttxsp = &txq->sw_ring_seq[txq->tx_next_dd - (n - 1)];\r\n-\r\n-\twhile (n > 0) {\r\n-\t\tk = RTE_MIN(n, txsp[n-1].same_pool);\r\n #ifdef RTE_MBUF_REFCNT\r\n-\t\tfor (i = 0; i < k; i++) {\r\n-\t\t\tm = __rte_pktmbuf_prefree_seg((txep+n-k+i)->mbuf);\r\n-\t\t\tif (m != NULL)\r\n-\t\t\t\tfree[nb_free++] = m;\r\n-\t\t}\r\n-\t\trte_mempool_put_bulk((void *)txsp[n-1].pool,\r\n-\t\t\t\t(void **)free, nb_free);\r\n+\tm = __rte_pktmbuf_prefree_seg(txep[0].mbuf);\r\n+#else\r\n+\tm = txep[0].mbuf;\r\n+#endif\r\n+\tif (likely(m != NULL)) {\r\n+\t\tfree[0] = m;\r\n+\t\tnb_free = 1;\r\n+\t\tfor (i = 1; i < n; i++) {\r\n+#ifdef RTE_MBUF_REFCNT\r\n+\t\t\tm = __rte_pktmbuf_prefree_seg(txep[i].mbuf);\r\n #else\r\n-\t\trte_mempool_put_bulk((void *)txsp[n-1].pool,\r\n-\t\t\t\t(void **)(txep+n-k), k);\r\n+\t\t\tm = txep[i]->mbuf;\r\n #endif\r\n-\t\tn -= k;\r\n+\t\t\tif (likely(m != NULL)) {\r\n+\t\t\t\tif (likely(m->pool == free[0]->pool))\r\n+\t\t\t\t\tfree[nb_free++] = m;\r\n+\t\t\t\telse {\r\n+\t\t\t\t\trte_mempool_put_bulk(free[0]->pool,\r\n+\t\t\t\t\t\t\t(void *)free, nb_free);\r\n+\t\t\t\t\tfree[0] = m;\r\n+\t\t\t\t\tnb_free = 1;\r\n+\t\t\t\t}\r\n+\t\t\t}\r\n+\t\t}\r\n+\t\trte_mempool_put_bulk(free[0]->pool, (void **)free, nb_free);\r\n+\t}\r\n+\telse {\r\n+\t\tfor (i = 1; i < n; i++) {\r\n+\t\t\tm = __rte_pktmbuf_prefree_seg(txep[i].mbuf);\r\n+\t\t\tif (m != NULL)\r\n+\t\t\t\trte_mempool_put(m->pool, m);\r\n+\t\t}\r\n \t}\r\n \r\n \t/* buffers were freed, update counters */\r\n@@ -394,19 +409,11 @@ ixgbe_tx_free_bufs(struct igb_tx_queue *txq)\r\n \r\n static inline void __attribute__((always_inline))\r\n tx_backlog_entry(struct igb_tx_entry_v *txep,\r\n-\t\t struct igb_tx_entry_seq *txsp,\r\n \t\t struct rte_mbuf **tx_pkts, uint16_t nb_pkts)\r\n {\r\n \tint i;\r\n-\tfor (i = 0; i < (int)nb_pkts; ++i) {\r\n+\tfor (i = 0; i < (int)nb_pkts; ++i)\r\n \t\ttxep[i].mbuf = tx_pkts[i];\r\n-\t\t/* check and update sequence number */\r\n-\t\ttxsp[i].pool = tx_pkts[i]->pool;\r\n-\t\tif (txsp[i-1].pool == tx_pkts[i]->pool)\r\n-\t\t\ttxsp[i].same_pool = txsp[i-1].same_pool + 1;\r\n-\t\telse\r\n-\t\t\ttxsp[i].same_pool = 1;\r\n-\t}\r\n }\r\n \r\n uint16_t\r\n@@ -416,7 +423,6 @@ ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,\r\n \tstruct igb_tx_queue *txq = (struct igb_tx_queue *)tx_queue;\r\n \tvolatile union ixgbe_adv_tx_desc *txdp;\r\n \tstruct igb_tx_entry_v *txep;\r\n-\tstruct igb_tx_entry_seq *txsp;\r\n \tuint16_t n, nb_commit, tx_id;\r\n \tuint64_t flags = DCMD_DTYP_FLAGS;\r\n \tuint64_t rs = IXGBE_ADVTXD_DCMD_RS|DCMD_DTYP_FLAGS;\r\n@@ -435,14 +441,13 @@ ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,\r\n \ttx_id = txq->tx_tail;\r\n \ttxdp = &txq->tx_ring[tx_id];\r\n \ttxep = &((struct igb_tx_entry_v *)txq->sw_ring)[tx_id];\r\n-\ttxsp = &txq->sw_ring_seq[tx_id];\r\n \r\n \ttxq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);\r\n \r\n \tn = (uint16_t)(txq->nb_tx_desc - tx_id);\r\n \tif (nb_commit >= n) {\r\n \r\n-\t\ttx_backlog_entry(txep, txsp, tx_pkts, n);\r\n+\t\ttx_backlog_entry(txep, tx_pkts, n);\r\n \r\n \t\tfor (i = 0; i < n - 1; ++i, ++tx_pkts, ++txdp)\r\n \t\t\tvtx1(txdp, *tx_pkts, flags);\r\n@@ -457,10 +462,9 @@ ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,\r\n \t\t/* avoid reach the end of ring */\r\n \t\ttxdp = &(txq->tx_ring[tx_id]);\r\n \t\ttxep = &(((struct igb_tx_entry_v *)txq->sw_ring)[tx_id]);\r\n-\t\ttxsp = &(txq->sw_ring_seq[tx_id]);\r\n \t}\r\n \r\n-\ttx_backlog_entry(txep, txsp, tx_pkts, nb_commit);\r\n+\ttx_backlog_entry(txep, tx_pkts, nb_commit);\r\n \r\n \tvtx(txdp, tx_pkts, nb_commit, flags);\r\n \r\n@@ -484,7 +488,6 @@ ixgbe_tx_queue_release_mbufs(struct igb_tx_queue *txq)\r\n {\r\n \tunsigned i;\r\n \tstruct igb_tx_entry_v *txe;\r\n-\tstruct igb_tx_entry_seq *txs;\r\n \tuint16_t nb_free, max_desc;\r\n \r\n \tif (txq->sw_ring != NULL) {\r\n@@ -502,10 +505,6 @@ ixgbe_tx_queue_release_mbufs(struct igb_tx_queue *txq)\r\n \t\tfor (i = 0; i < txq->nb_tx_desc; i++) {\r\n \t\t\ttxe = (struct igb_tx_entry_v *)&txq->sw_ring[i];\r\n \t\t\ttxe->mbuf = NULL;\r\n-\r\n-\t\t\ttxs = &txq->sw_ring_seq[i];\r\n-\t\t\ttxs->pool = NULL;\r\n-\t\t\ttxs->same_pool = 0;\r\n \t\t}\r\n \t}\r\n }\r\n@@ -520,11 +519,6 @@ ixgbe_tx_free_swring(struct igb_tx_queue *txq)\r\n \t\trte_free((struct igb_rx_entry *)txq->sw_ring - 1);\r\n \t\ttxq->sw_ring = NULL;\r\n \t}\r\n-\r\n-\tif (txq->sw_ring_seq != NULL) {\r\n-\t\trte_free(txq->sw_ring_seq - 1);\r\n-\t\ttxq->sw_ring_seq = NULL;\r\n-\t}\r\n }\r\n \r\n static void\r\n@@ -533,7 +527,6 @@ ixgbe_reset_tx_queue(struct igb_tx_queue *txq)\r\n \tstatic const union ixgbe_adv_tx_desc zeroed_desc = { .read = {\r\n \t\t\t.buffer_addr = 0} };\r\n \tstruct igb_tx_entry_v *txe = (struct igb_tx_entry_v *)txq->sw_ring;\r\n-\tstruct igb_tx_entry_seq *txs = txq->sw_ring_seq;\r\n \tuint16_t i;\r\n \r\n \t/* Zero out HW ring memory */\r\n@@ -545,8 +538,6 @@ ixgbe_reset_tx_queue(struct igb_tx_queue *txq)\r\n \t\tvolatile union ixgbe_adv_tx_desc *txd = &txq->tx_ring[i];\r\n \t\ttxd->wb.status = IXGBE_TXD_STAT_DD;\r\n \t\ttxe[i].mbuf = NULL;\r\n-\t\ttxs[i].pool = NULL;\r\n-\t\ttxs[i].same_pool = 0;\r\n \t}\r\n \r\n \ttxq->tx_next_dd = (uint16_t)(txq->tx_rs_thresh - 1);\r\n@@ -588,28 +579,14 @@ ixgbe_rxq_vec_setup(struct igb_rx_queue *rxq)\r\n \treturn 0;\r\n }\r\n \r\n-int ixgbe_txq_vec_setup(struct igb_tx_queue *txq,\r\n-\t\t\tunsigned int socket_id)\r\n+int ixgbe_txq_vec_setup(struct igb_tx_queue *txq)\r\n {\r\n-\tuint16_t nb_desc;\r\n-\r\n \tif (txq->sw_ring == NULL)\r\n \t\treturn -1;\r\n \r\n-\t/* request addtional one entry for continous sequence check */\r\n-\tnb_desc = (uint16_t)(txq->nb_tx_desc + 1);\r\n-\r\n-\ttxq->sw_ring_seq = rte_zmalloc_socket(\"txq->sw_ring_seq\",\r\n-\t\t\t\tsizeof(struct igb_tx_entry_seq) * nb_desc,\r\n-\t\t\t\tCACHE_LINE_SIZE, socket_id);\r\n-\tif (txq->sw_ring_seq == NULL)\r\n-\t\treturn -1;\r\n-\r\n-\r\n \t/* leave the first one for overflow */\r\n \ttxq->sw_ring = (struct igb_tx_entry *)\r\n \t\t((struct igb_tx_entry_v *)txq->sw_ring + 1);\r\n-\ttxq->sw_ring_seq += 1;\r\n \ttxq->ops = &vec_txq_ops;\r\n \r\n \treturn 0;\r\n",
    "prefixes": [
        "dpdk-dev",
        "12/13"
    ]
}