get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 523062,
    "url": "http://patchwork.ozlabs.org/api/patches/523062/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1443230773-174806-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": "<1443230773-174806-1-git-send-email-anjali.singhai@intel.com>",
    "list_archive_url": null,
    "date": "2015-09-26T01:26:13",
    "name": "i40e: Fix RS bit update in Tx path and disable force WB workaround",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "1891458767da0893bf5b24805d4348d1aef51373",
    "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/1443230773-174806-1-git-send-email-anjali.singhai@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/523062/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/523062/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 hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id 949D51401B5\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 26 Sep 2015 11:10:20 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id B289194E74;\n\tSat, 26 Sep 2015 01:10:19 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id S9WHeZ+jHOEc; Sat, 26 Sep 2015 01:10:19 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 15AC794E5C;\n\tSat, 26 Sep 2015 01:10:19 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 9A1D51CE7A7\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 26 Sep 2015 01:10:18 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 91F1194E70\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 26 Sep 2015 01:10:18 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id ai8Vyxge8Od2 for <intel-wired-lan@lists.osuosl.org>;\n\tSat, 26 Sep 2015 01:10:17 +0000 (UTC)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 5D19494E5C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 26 Sep 2015 01:10:17 +0000 (UTC)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga103.fm.intel.com with ESMTP; 25 Sep 2015 18:10:16 -0700",
            "from asinghai-cp.jf.intel.com ([134.134.3.57])\n\tby orsmga002.jf.intel.com with ESMTP; 25 Sep 2015 18:10:16 -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,589,1437462000\"; d=\"scan'208\";a=\"813483157\"",
        "From": "Anjali Singhai Jain <anjali.singhai@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Fri, 25 Sep 2015 18:26:13 -0700",
        "Message-Id": "<1443230773-174806-1-git-send-email-anjali.singhai@intel.com>",
        "X-Mailer": "git-send-email 1.8.1.4",
        "Subject": "[Intel-wired-lan] [PATCH] i40e: Fix RS bit update in Tx path and\n\tdisable 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 bd17d89..8d83af0 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n@@ -727,15 +727,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 \tnetdev_tx_completed_queue(netdev_get_tx_queue(tx_ring->netdev,\n \t\t\t\t\t\t      tx_ring->queue_index),\n@@ -2505,6 +2511,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@@ -2545,6 +2554,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@@ -2564,6 +2575,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@@ -2578,34 +2591,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@@ -2615,15 +2600,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 c8a7cb4..75cecfa 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n@@ -258,10 +258,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": []
}