get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 523552,
    "url": "http://patchwork.ozlabs.org/api/patches/523552/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1443464220-148318-6-git-send-email-catherine.sullivan@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": "<1443464220-148318-6-git-send-email-catherine.sullivan@intel.com>",
    "list_archive_url": null,
    "date": "2015-09-28T18:16:54",
    "name": "[next,S17,05/11] i40e/i40evf: adjust interrupt throttle less frequently",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "a8fa62d616c5cf2f1fa0f7ad5fcd1e1da220eb5f",
    "submitter": {
        "id": 13931,
        "url": "http://patchwork.ozlabs.org/api/people/13931/?format=api",
        "name": "Catherine Sullivan",
        "email": "catherine.sullivan@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/1443464220-148318-6-git-send-email-catherine.sullivan@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/523552/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/523552/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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ozlabs.org (Postfix) with ESMTP id 9483F1400B7\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 29 Sep 2015 04:17:41 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id E671C9220D;\n\tMon, 28 Sep 2015 18:17:40 +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 i+Vn88qZdG0M; Mon, 28 Sep 2015 18:17:36 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id BA1E9921EA;\n\tMon, 28 Sep 2015 18:17:35 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 082ED1C1591\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Sep 2015 18:17:33 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 047DB94E49\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Sep 2015 18:17:33 +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 vOfKLqXaw-Uw for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Sep 2015 18:17:32 +0000 (UTC)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 5392494D90\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 28 Sep 2015 18:17:32 +0000 (UTC)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga101.jf.intel.com with ESMTP; 28 Sep 2015 11:17:06 -0700",
            "from catheri1-tigger.jf.intel.com ([134.134.176.92])\n\tby orsmga002.jf.intel.com with ESMTP; 28 Sep 2015 11:17:05 -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,604,1437462000\"; d=\"scan'208\";a=\"814862656\"",
        "From": "Catherine Sullivan <catherine.sullivan@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Mon, 28 Sep 2015 14:16:54 -0400",
        "Message-Id": "<1443464220-148318-6-git-send-email-catherine.sullivan@intel.com>",
        "X-Mailer": "git-send-email 1.9.3",
        "In-Reply-To": "<1443464220-148318-1-git-send-email-catherine.sullivan@intel.com>",
        "References": "<1443464220-148318-1-git-send-email-catherine.sullivan@intel.com>",
        "Subject": "[Intel-wired-lan] [next PATCH S17 05/11] i40e/i40evf: adjust\n\tinterrupt throttle less frequently",
        "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": "From: Jesse Brandeburg <jesse.brandeburg@intel.com>\n\nThe adaptive ITR (interrupt throttle rate) algorithm was adjusting\nthe hardware's interrupt rate too frequently.  This caused a lot\nof variation in the interrupt rate for fairly constant workloads.\n\nChange the code to have a counter and adjust only once every N\nnumber of interrupts.\n\nSigned-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>\nChange-ID: I0460f1f86571037484eca5aca36ac4d889cb8389\n---\n drivers/net/ethernet/intel/i40e/i40e.h          |  2 ++\n drivers/net/ethernet/intel/i40e/i40e_main.c     |  2 ++\n drivers/net/ethernet/intel/i40e/i40e_txrx.c     | 22 ++++++++++++++++++++--\n drivers/net/ethernet/intel/i40e/i40e_txrx.h     |  4 ++--\n drivers/net/ethernet/intel/i40evf/i40e_txrx.c   | 23 +++++++++++++++++++++--\n drivers/net/ethernet/intel/i40evf/i40e_txrx.h   |  4 ++--\n drivers/net/ethernet/intel/i40evf/i40evf.h      |  2 ++\n drivers/net/ethernet/intel/i40evf/i40evf_main.c |  2 ++\n 8 files changed, 53 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 666f7a5..1d9af62 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -577,6 +577,8 @@ struct i40e_q_vector {\n \tstruct rcu_head rcu;\t/* to avoid race with update stats on free */\n \tchar name[I40E_INT_NAME_STR_LEN];\n \tbool arm_wb_state;\n+#define ITR_COUNTDOWN_START 100\n+\tu8 itr_countdown;\t/* when 0 should adjust ITR */\n } ____cacheline_internodealigned_in_smp;\n \n /* lan device */\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex e383ac3..2ecc6df 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -3101,6 +3101,7 @@ static void i40e_vsi_configure_msix(struct i40e_vsi *vsi)\n \tfor (i = 0; i < vsi->num_q_vectors; i++, vector++) {\n \t\tstruct i40e_q_vector *q_vector = vsi->q_vectors[i];\n \n+\t\tq_vector->itr_countdown = ITR_COUNTDOWN_START;\n \t\tq_vector->rx.itr = ITR_TO_REG(vsi->rx_itr_setting);\n \t\tq_vector->rx.latency_range = I40E_LOW_LATENCY;\n \t\twr32(hw, I40E_PFINT_ITRN(I40E_RX_ITR, vector - 1),\n@@ -3196,6 +3197,7 @@ static void i40e_configure_msi_and_legacy(struct i40e_vsi *vsi)\n \tu32 val;\n \n \t/* set the ITR configuration */\n+\tq_vector->itr_countdown = ITR_COUNTDOWN_START;\n \tq_vector->rx.itr = ITR_TO_REG(vsi->rx_itr_setting);\n \tq_vector->rx.latency_range = I40E_LOW_LATENCY;\n \twr32(hw, I40E_PFINT_ITR0(I40E_RX_ITR), q_vector->rx.itr);\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\nindex 12bbc83..096bfbc 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n@@ -844,10 +844,12 @@ static bool i40e_set_new_dynamic_itr(struct i40e_ring_container *rc)\n \t * The math works out because the divisor is in 10^(-6) which\n \t * turns the bytes/us input value into MB/s values, but\n \t * make sure to use usecs, as the register values written\n-\t * are in 2 usec increments in the ITR registers.\n+\t * are in 2 usec increments in the ITR registers, and make sure\n+\t * to use the smoothed values that the countdown timer gives us.\n \t */\n-\tusecs = (rc->itr << 1);\n+\tusecs = (rc->itr << 1) * ITR_COUNTDOWN_START;\n \tbytes_per_int = rc->total_bytes / usecs;\n+\n \tswitch (new_latency_range) {\n \tcase I40E_LOWEST_LATENCY:\n \t\tif (bytes_per_int > 10)\n@@ -1805,8 +1807,17 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi,\n \n \tvector = (q_vector->v_idx + vsi->base_vector);\n \n+\t/* avoid dynamic calulation if in countdown mode OR if\n+\t * all dynamic is disabled\n+\t */\n \trxval = txval = i40e_buildreg_itr(I40E_ITR_NONE, 0);\n \n+\tif (q_vector->itr_countdown > 0 ||\n+\t    (!ITR_IS_DYNAMIC(vsi->rx_itr_setting) &&\n+\t     !ITR_IS_DYNAMIC(vsi->tx_itr_setting))) {\n+\t\tgoto enable_int;\n+\t}\n+\n \tif (ITR_IS_DYNAMIC(vsi->rx_itr_setting)) {\n \t\trx = i40e_set_new_dynamic_itr(&q_vector->rx);\n \t\trxval = i40e_buildreg_itr(I40E_RX_ITR, q_vector->rx.itr);\n@@ -1844,8 +1855,15 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi,\n \t\twr32(hw, INTREG(vector - 1), rxval);\n \t}\n \n+enable_int:\n \tif (!test_bit(__I40E_DOWN, &vsi->state))\n \t\twr32(hw, INTREG(vector - 1), txval);\n+\n+\tif (q_vector->itr_countdown)\n+\t\tq_vector->itr_countdown--;\n+\telse\n+\t\tq_vector->itr_countdown = ITR_COUNTDOWN_START;\n+\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\nindex 0fe7eb7..6779fb7 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n@@ -38,8 +38,8 @@\n #define I40E_ITR_8K                0x003E\n #define I40E_ITR_4K                0x007A\n #define I40E_MAX_INTRL             0x3B    /* reg uses 4 usec resolution */\n-#define I40E_ITR_RX_DEF            I40E_ITR_8K\n-#define I40E_ITR_TX_DEF            I40E_ITR_4K\n+#define I40E_ITR_RX_DEF            I40E_ITR_20K\n+#define I40E_ITR_TX_DEF            I40E_ITR_20K\n #define I40E_ITR_DYNAMIC           0x8000  /* use top bit as a flag */\n #define I40E_MIN_INT_RATE          250     /* ~= 1000000 / (I40E_MAX_ITR * 2) */\n #define I40E_MAX_INT_RATE          500000  /* == 1000000 / (I40E_MIN_ITR * 2) */\ndiff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c\nindex 7cb0a06..0fe2625 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c\n+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c\n@@ -348,10 +348,12 @@ static bool i40e_set_new_dynamic_itr(struct i40e_ring_container *rc)\n \t * The math works out because the divisor is in 10^(-6) which\n \t * turns the bytes/us input value into MB/s values, but\n \t * make sure to use usecs, as the register values written\n-\t * are in 2 usec increments in the ITR registers.\n+\t * are in 2 usec increments in the ITR registers, and make sure\n+\t * to use the smoothed values that the countdown timer gives us.\n \t */\n-\tusecs = (rc->itr << 1);\n+\tusecs = (rc->itr << 1) * ITR_COUNTDOWN_START;\n \tbytes_per_int = rc->total_bytes / usecs;\n+\n \tswitch (new_latency_range) {\n \tcase I40E_LOWEST_LATENCY:\n \t\tif (bytes_per_int > 10)\n@@ -1245,8 +1247,18 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi,\n \tint vector;\n \n \tvector = (q_vector->v_idx + vsi->base_vector);\n+\n+\t/* avoid dynamic calulation if in countdown mode OR if\n+\t * all dynamic is disabled\n+\t */\n \trxval = txval = i40e_buildreg_itr(I40E_ITR_NONE, 0);\n \n+\tif (q_vector->itr_countdown > 0 ||\n+\t    (!ITR_IS_DYNAMIC(vsi->rx_itr_setting) &&\n+\t     !ITR_IS_DYNAMIC(vsi->tx_itr_setting))) {\n+\t\tgoto enable_int;\n+\t}\n+\n \tif (ITR_IS_DYNAMIC(vsi->rx_itr_setting)) {\n \t\trx = i40e_set_new_dynamic_itr(&q_vector->rx);\n \t\trxval = i40e_buildreg_itr(I40E_RX_ITR, q_vector->rx.itr);\n@@ -1282,8 +1294,15 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi,\n \t\twr32(hw, INTREG(vector - 1), rxval);\n \t}\n \n+enable_int:\n \tif (!test_bit(__I40E_DOWN, &vsi->state))\n \t\twr32(hw, INTREG(vector - 1), txval);\n+\n+\tif (q_vector->itr_countdown)\n+\t\tq_vector->itr_countdown--;\n+\telse\n+\t\tq_vector->itr_countdown = ITR_COUNTDOWN_START;\n+\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.h b/drivers/net/ethernet/intel/i40evf/i40e_txrx.h\nindex 27f0b626..ee48caa 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.h\n+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.h\n@@ -38,8 +38,8 @@\n #define I40E_ITR_8K                0x003E\n #define I40E_ITR_4K                0x007A\n #define I40E_MAX_INTRL             0x3B    /* reg uses 4 usec resolution */\n-#define I40E_ITR_RX_DEF            I40E_ITR_8K\n-#define I40E_ITR_TX_DEF            I40E_ITR_4K\n+#define I40E_ITR_RX_DEF            I40E_ITR_20K\n+#define I40E_ITR_TX_DEF            I40E_ITR_20K\n #define I40E_ITR_DYNAMIC           0x8000  /* use top bit as a flag */\n #define I40E_MIN_INT_RATE          250     /* ~= 1000000 / (I40E_MAX_ITR * 2) */\n #define I40E_MAX_INT_RATE          500000  /* == 1000000 / (I40E_MIN_ITR * 2) */\ndiff --git a/drivers/net/ethernet/intel/i40evf/i40evf.h b/drivers/net/ethernet/intel/i40evf/i40evf.h\nindex d6cd2c8..0147038 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40evf.h\n+++ b/drivers/net/ethernet/intel/i40evf/i40evf.h\n@@ -112,6 +112,8 @@ struct i40e_q_vector {\n \tstruct i40e_ring_container tx;\n \tu32 ring_mask;\n \tu8 num_ringpairs;\t/* total number of ring pairs in vector */\n+#define ITR_COUNTDOWN_START 100\n+\tu8 itr_countdown;\t/* when 0 or 1 update ITR */\n \tint v_idx;\t  /* vector index in list */\n \tchar name[IFNAMSIZ + 9];\n \tbool arm_wb_state;\ndiff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c\nindex d29519d..7668098 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c\n+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c\n@@ -357,6 +357,7 @@ i40evf_map_vector_to_rxq(struct i40evf_adapter *adapter, int v_idx, int r_idx)\n \tq_vector->rx.ring = rx_ring;\n \tq_vector->rx.count++;\n \tq_vector->rx.latency_range = I40E_LOW_LATENCY;\n+\tq_vector->itr_countdown = ITR_COUNTDOWN_START;\n }\n \n /**\n@@ -377,6 +378,7 @@ i40evf_map_vector_to_txq(struct i40evf_adapter *adapter, int v_idx, int t_idx)\n \tq_vector->tx.ring = tx_ring;\n \tq_vector->tx.count++;\n \tq_vector->tx.latency_range = I40E_LOW_LATENCY;\n+\tq_vector->itr_countdown = ITR_COUNTDOWN_START;\n \tq_vector->num_ringpairs++;\n \tq_vector->ring_mask |= BIT(t_idx);\n }\n",
    "prefixes": [
        "next",
        "S17",
        "05/11"
    ]
}