Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/522953/?format=api
{ "id": 522953, "url": "http://patchwork.ozlabs.org/api/patches/522953/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1443207609-171288-1-git-send-email-anjali.singhai@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1443207609-171288-1-git-send-email-anjali.singhai@intel.com>", "list_archive_url": null, "date": "2015-09-25T19:00:08", "name": "[1/2] i40e: Fix RS bit update in Tx path and disable force WB workaround", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "8bcd1362200a802e605213e63aa4444314641be7", "submitter": { "id": 65487, "url": "http://patchwork.ozlabs.org/api/people/65487/?format=api", "name": "Singhai, Anjali", "email": "anjali.singhai@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1443207609-171288-1-git-send-email-anjali.singhai@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/522953/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/522953/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Received": [ "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ozlabs.org (Postfix) with ESMTP id D000D140779\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 26 Sep 2015 04:44:15 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 850DD33FFD;\n\tFri, 25 Sep 2015 18:44:14 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id ownay3hn0AIG; Fri, 25 Sep 2015 18:44:13 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 1708C31A2B;\n\tFri, 25 Sep 2015 18:44:13 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 81F6D1C151A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 25 Sep 2015 18:44:11 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 7B59F9309A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 25 Sep 2015 18:44:11 +0000 (UTC)", "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id MAZxFbPvLJbI for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 25 Sep 2015 18:44:10 +0000 (UTC)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 84FB492F0F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 25 Sep 2015 18:44:10 +0000 (UTC)", "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga102.fm.intel.com with ESMTP; 25 Sep 2015 11:44:10 -0700", "from asinghai-cp.jf.intel.com ([134.134.3.57])\n\tby FMSMGA003.fm.intel.com with ESMTP; 25 Sep 2015 11:44:11 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.17,588,1437462000\"; d=\"scan'208\";a=\"568508207\"", "From": "Anjali Singhai Jain <anjali.singhai@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Fri, 25 Sep 2015 12:00:08 -0700", "Message-Id": "<1443207609-171288-1-git-send-email-anjali.singhai@intel.com>", "X-Mailer": "git-send-email 1.8.1.4", "Subject": "[Intel-wired-lan] [PATCH 1/2] i40e: Fix RS bit update in Tx path\n\tand disable force WB workaround", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "This patch fixes the issue of forcing WB too often causing us to not\nbenefit from NAPI.\n\nWithout this patch we were forcing WB/arming interrupt too often taking\naway the benefits of NAPI and causing a performance impact.\n\nWith this patch we disable force WB in the clean routine for X710\nand XL710 adapters. X722 adapters do not enable interrupt to force\na WB and benefit from WB_ON_ITR and hence force WB is left enabled\nfor those adapters.\nFor XL710 and X710 adapters if we have less than 4 packets pending\na software Interrupt triggered from service task will force a WB.\n\nThis patch also changes the conditions for setting RS bit as described\nin code comments. This optimizes when the HW does a tail bump amd when\nit does a WB. It also optimizes when we do a wmb.\n\nSigned-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_txrx.c | 126 ++++++++++++++++++----------\n drivers/net/ethernet/intel/i40e/i40e_txrx.h | 2 +\n 2 files changed, 86 insertions(+), 42 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\nindex d51b8ed..f75db56 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n@@ -785,15 +785,21 @@ static bool i40e_clean_tx_irq(struct i40e_ring *tx_ring, int budget)\n \ttx_ring->q_vector->tx.total_bytes += total_bytes;\n \ttx_ring->q_vector->tx.total_packets += total_packets;\n \n-\t/* check to see if there are any non-cache aligned descriptors\n-\t * waiting to be written back, and kick the hardware to force\n-\t * them to be written back in case of napi polling\n-\t */\n-\tif (budget &&\n-\t !((i & WB_STRIDE) == WB_STRIDE) &&\n-\t !test_bit(__I40E_DOWN, &tx_ring->vsi->state) &&\n-\t (I40E_DESC_UNUSED(tx_ring) != tx_ring->count))\n-\t\ttx_ring->arm_wb = true;\n+\tif (tx_ring->flags & I40E_TXR_FLAGS_WB_ON_ITR) {\n+\t\tunsigned int j = 0;\n+\t\t/* check to see if there are < 4 descriptors\n+\t\t * waiting to be written back, then kick the hardware to force\n+\t\t * them to be written back in case we stay in NAPI.\n+\t\t * In this mode on X722 we do not enable Interrupt.\n+\t\t */\n+\t\tj = i40e_get_tx_pending(tx_ring);\n+\n+\t\tif (budget &&\n+\t\t ((j / (WB_STRIDE + 1)) == 0) && (j != 0) &&\n+\t\t !test_bit(__I40E_DOWN, &tx_ring->vsi->state) &&\n+\t\t (I40E_DESC_UNUSED(tx_ring) != tx_ring->count))\n+\t\t\ttx_ring->arm_wb = true;\n+\t}\n \n \tif (check_for_tx_hang(tx_ring) && i40e_check_tx_hang(tx_ring)) {\n \t\t/* schedule immediate reset if we believe we hung */\n@@ -2582,6 +2588,9 @@ static inline void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,\n \tu32 td_tag = 0;\n \tdma_addr_t dma;\n \tu16 gso_segs;\n+\tu16 desc_count = 0;\n+\tbool tail_bump = true;\n+\tbool do_rs = false;\n \n \tif (tx_flags & I40E_TX_FLAGS_HW_VLAN) {\n \t\ttd_cmd |= I40E_TX_DESC_CMD_IL2TAG1;\n@@ -2622,6 +2631,8 @@ static inline void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,\n \n \t\t\ttx_desc++;\n \t\t\ti++;\n+\t\t\tdesc_count++;\n+\n \t\t\tif (i == tx_ring->count) {\n \t\t\t\ttx_desc = I40E_TX_DESC(tx_ring, 0);\n \t\t\t\ti = 0;\n@@ -2641,6 +2652,8 @@ static inline void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,\n \n \t\ttx_desc++;\n \t\ti++;\n+\t\tdesc_count++;\n+\n \t\tif (i == tx_ring->count) {\n \t\t\ttx_desc = I40E_TX_DESC(tx_ring, 0);\n \t\t\ti = 0;\n@@ -2655,34 +2668,6 @@ static inline void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,\n \t\ttx_bi = &tx_ring->tx_bi[i];\n \t}\n \n-\t/* Place RS bit on last descriptor of any packet that spans across the\n-\t * 4th descriptor (WB_STRIDE aka 0x3) in a 64B cacheline.\n-\t */\n-\tif (((i & WB_STRIDE) != WB_STRIDE) &&\n-\t (first <= &tx_ring->tx_bi[i]) &&\n-\t (first >= &tx_ring->tx_bi[i & ~WB_STRIDE])) {\n-\t\ttx_desc->cmd_type_offset_bsz =\n-\t\t\tbuild_ctob(td_cmd, td_offset, size, td_tag) |\n-\t\t\tcpu_to_le64((u64)I40E_TX_DESC_CMD_EOP <<\n-\t\t\t\t\t I40E_TXD_QW1_CMD_SHIFT);\n-\t} else {\n-\t\ttx_desc->cmd_type_offset_bsz =\n-\t\t\tbuild_ctob(td_cmd, td_offset, size, td_tag) |\n-\t\t\tcpu_to_le64((u64)I40E_TXD_CMD <<\n-\t\t\t\t\t I40E_TXD_QW1_CMD_SHIFT);\n-\t}\n-\n-\tnetdev_tx_sent_queue(netdev_get_tx_queue(tx_ring->netdev,\n-\t\t\t\t\t\t tx_ring->queue_index),\n-\t\t\t first->bytecount);\n-\n-\t/* Force memory writes to complete before letting h/w\n-\t * know there are new descriptors to fetch. (Only\n-\t * applicable for weak-ordered memory model archs,\n-\t * such as IA-64).\n-\t */\n-\twmb();\n-\n \t/* set next_to_watch value indicating a packet is present */\n \tfirst->next_to_watch = tx_desc;\n \n@@ -2692,15 +2677,72 @@ static inline void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,\n \n \ttx_ring->next_to_use = i;\n \n+\tnetdev_tx_sent_queue(netdev_get_tx_queue(tx_ring->netdev,\n+\t\t\t\t\t\t tx_ring->queue_index),\n+\t\t\t\t\t\t first->bytecount);\n \ti40e_maybe_stop_tx(tx_ring, DESC_NEEDED);\n+\n+\t/* Algorithm to optimize tail and RS bit setting:\n+\t * if xmit_more is supported\n+\t *\tif xmit_more is true\n+\t *\t\tdo not update tail and do not mark RS bit.\n+\t *\tif xmit_more is false and last xmit_more was false\n+\t *\t\tif every packet spanned less than 4 desc\n+\t *\t\t\tthen set RS bit on 4th packet and update tail\n+\t *\t\t\ton every packet\n+\t *\t\telse\n+\t *\t\t\tupdate tail and set RS bit on every packet.\n+\t *\tif xmit_more is false and last_xmit_more was true\n+\t *\t\tupdate tail and set RS bit.\n+\t *\n+\t * Optimization: wmb to be issued only in case of tail update.\n+\t * Also optimize the Descriptor WB path for RS bit with the same\n+\t * algorithm.\n+\t *\n+\t * Note: If there are less than 4 packets\n+\t * pending and interrupts were disabled the service task will\n+\t * trigger a force WB.\n+\t */\n+\tif (skb->xmit_more &&\n+\t !netif_xmit_stopped(netdev_get_tx_queue(tx_ring->netdev,\n+\t\t\t\t\t\t tx_ring->queue_index))) {\n+\t\ttx_ring->flags |= I40E_TXR_FLAGS_LAST_XMIT_MORE_SET;\n+\t\ttail_bump = false;\n+\t} else if (!skb->xmit_more &&\n+\t\t !netif_xmit_stopped(netdev_get_tx_queue(tx_ring->netdev,\n+\t\t\t\t\t\t tx_ring->queue_index)) &&\n+\t\t (!(tx_ring->flags & I40E_TXR_FLAGS_LAST_XMIT_MORE_SET)) &&\n+\t\t (tx_ring->packet_stride < WB_STRIDE) &&\n+\t\t (desc_count < WB_STRIDE)) {\n+\t\ttx_ring->packet_stride++;\n+\t} else {\n+\t\ttx_ring->packet_stride = 0;\n+\t\ttx_ring->flags &= ~I40E_TXR_FLAGS_LAST_XMIT_MORE_SET;\n+\t\tdo_rs = true;\n+\t}\n+\tif (do_rs)\n+\t\ttx_ring->packet_stride = 0;\n+\n+\ttx_desc->cmd_type_offset_bsz =\n+\t\t\tbuild_ctob(td_cmd, td_offset, size, td_tag) |\n+\t\t\tcpu_to_le64((u64)(do_rs ? I40E_TXD_CMD :\n+\t\t\t\t\t\t I40E_TX_DESC_CMD_EOP) <<\n+\t\t\t\t\t\t I40E_TXD_QW1_CMD_SHIFT);\n+\n \t/* notify HW of packet */\n-\tif (!skb->xmit_more ||\n-\t netif_xmit_stopped(netdev_get_tx_queue(tx_ring->netdev,\n-\t\t\t\t\t\t tx_ring->queue_index)))\n-\t\twritel(i, tx_ring->tail);\n-\telse\n+\tif (!tail_bump)\n \t\tprefetchw(tx_desc + 1);\n \n+\tif (tail_bump) {\n+\t\t/* Force memory writes to complete before letting h/w\n+\t\t * know there are new descriptors to fetch. (Only\n+\t\t * applicable for weak-ordered memory model archs,\n+\t\t * such as IA-64).\n+\t\t */\n+\t\twmb();\n+\t\twritel(i, tx_ring->tail);\n+\t}\n+\n \treturn;\n \n dma_error:\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\nindex 073464e..4871809 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n@@ -266,10 +266,12 @@ struct i40e_ring {\n \n \tbool ring_active;\t\t/* is ring online or not */\n \tbool arm_wb;\t\t/* do something to arm write back */\n+\tu8 packet_stride;\n \n \tu16 flags;\n #define I40E_TXR_FLAGS_WB_ON_ITR\tBIT(0)\n #define I40E_TXR_FLAGS_OUTER_UDP_CSUM\tBIT(1)\n+#define I40E_TXR_FLAGS_LAST_XMIT_MORE_SET BIT(2)\n \n \t/* stats structs */\n \tstruct i40e_queue_stats\tstats;\n", "prefixes": [ "1/2" ] }