get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1049852,
    "url": "http://patchwork.ozlabs.org/api/patches/1049852/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190228232603.32156-2-anirudh.venkataramanan@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": "<20190228232603.32156-2-anirudh.venkataramanan@intel.com>",
    "list_archive_url": null,
    "date": "2019-02-28T23:25:47",
    "name": "[S17,01/17] ice: Calculate ITR increment based on direct calculation",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "be81dbec7c04177696d884a4456d7b041ea10908",
    "submitter": {
        "id": 73601,
        "url": "http://patchwork.ozlabs.org/api/people/73601/?format=api",
        "name": "Anirudh Venkataramanan",
        "email": "anirudh.venkataramanan@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/20190228232603.32156-2-anirudh.venkataramanan@intel.com/mbox/",
    "series": [
        {
            "id": 94829,
            "url": "http://patchwork.ozlabs.org/api/series/94829/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=94829",
            "date": "2019-02-28T23:25:46",
            "name": "Implementation updates for ice",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/94829/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1049852/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1049852/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@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"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.137; helo=fraxinus.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 449TFb3Qb4z9s70\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Mar 2019 10:26:11 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id E6DF185E43;\n\tThu, 28 Feb 2019 23:26:09 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id g96YfRteYkah; Thu, 28 Feb 2019 23:26:07 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 2C47785F08;\n\tThu, 28 Feb 2019 23:26:07 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 77EC41BF3EA\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 28 Feb 2019 23:26:05 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 75340813E6\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 28 Feb 2019 23:26:05 +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 fBr+qzmY+gtH for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 28 Feb 2019 23:26:04 +0000 (UTC)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 6B75B8126A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 28 Feb 2019 23:26:04 +0000 (UTC)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t28 Feb 2019 15:26:03 -0800",
            "from shasta.jf.intel.com ([10.166.241.11])\n\tby FMSMGA003.fm.intel.com with ESMTP; 28 Feb 2019 15:26:03 -0800"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.58,425,1544515200\"; d=\"scan'208\";a=\"137127985\"",
        "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Thu, 28 Feb 2019 15:25:47 -0800",
        "Message-Id": "<20190228232603.32156-2-anirudh.venkataramanan@intel.com>",
        "X-Mailer": "git-send-email 2.14.5",
        "In-Reply-To": "<20190228232603.32156-1-anirudh.venkataramanan@intel.com>",
        "References": "<20190228232603.32156-1-anirudh.venkataramanan@intel.com>",
        "Subject": "[Intel-wired-lan] [PATCH S17 01/17] ice: Calculate ITR increment\n\tbased on direct calculation",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@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@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Brett Creeley <brett.creeley@intel.com>\n\nCurrently when calculating how much to increment ITR by inside of\nice_update_itr() we do some estimations and intermediate\ncalculations. Instead of doing estimations, just do the\ncalculation directly. This allows for a more accurate value and it\nmakes it easier for the next person to understand and update.\n\nAlso, remove the dividing the ITR value by 2 when latency\ndriven because the ITR values are already so low for 100Gbps\nspeed. This should help get to the desired ITR value faster.\n\nSigned-off-by: Brett Creeley <brett.creeley@intel.com>\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_txrx.c | 135 ++++++++++++++----------------\n 1 file changed, 63 insertions(+), 72 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c\nindex 4b08cb3be28e..fabee3e59eff 100644\n--- a/drivers/net/ethernet/intel/ice/ice_txrx.c\n+++ b/drivers/net/ethernet/intel/ice/ice_txrx.c\n@@ -1097,19 +1097,69 @@ static int ice_clean_rx_irq(struct ice_ring *rx_ring, int budget)\n \treturn failure ? budget : (int)total_rx_pkts;\n }\n \n-static unsigned int ice_itr_divisor(struct ice_port_info *pi)\n+/**\n+ * ice_adjust_itr_by_size_and_speed - Adjust ITR based on current traffic\n+ * @port_info: port_info structure containing the current link speed\n+ * @avg_pkt_size: average size of Tx or Rx packets based on clean routine\n+ * @itr: itr value to update\n+ *\n+ * Calculate how big of an increment should be applied to the ITR value passed\n+ * in based on wmem_default, SKB overhead, ethernet overhead, and the current\n+ * link speed.\n+ *\n+ * The following is a calculation derived from:\n+ *  wmem_default / (size + overhead) = desired_pkts_per_int\n+ *  rate / bits_per_byte / (size + ethernet overhead) = pkt_rate\n+ *  (desired_pkt_rate / pkt_rate) * usecs_per_sec = ITR value\n+ *\n+ * Assuming wmem_default is 212992 and overhead is 640 bytes per\n+ * packet, (256 skb, 64 headroom, 320 shared info), we can reduce the\n+ * formula down to:\n+ *\n+ *\t wmem_default * bits_per_byte * usecs_per_sec   pkt_size + 24\n+ * ITR = -------------------------------------------- * --------------\n+ *\t\t\t     rate\t\t\tpkt_size + 640\n+ */\n+static unsigned int\n+ice_adjust_itr_by_size_and_speed(struct ice_port_info *port_info,\n+\t\t\t\t unsigned int avg_pkt_size,\n+\t\t\t\t unsigned int itr)\n {\n-\tswitch (pi->phy.link_info.link_speed) {\n+\tswitch (port_info->phy.link_info.link_speed) {\n+\tcase ICE_AQ_LINK_SPEED_100GB:\n+\t\titr += DIV_ROUND_UP(17 * (avg_pkt_size + 24),\n+\t\t\t\t    avg_pkt_size + 640);\n+\t\tbreak;\n+\tcase ICE_AQ_LINK_SPEED_50GB:\n+\t\titr += DIV_ROUND_UP(34 * (avg_pkt_size + 24),\n+\t\t\t\t    avg_pkt_size + 640);\n+\t\tbreak;\n \tcase ICE_AQ_LINK_SPEED_40GB:\n-\t\treturn ICE_ITR_ADAPTIVE_MIN_INC * 1024;\n+\t\titr += DIV_ROUND_UP(43 * (avg_pkt_size + 24),\n+\t\t\t\t    avg_pkt_size + 640);\n+\t\tbreak;\n \tcase ICE_AQ_LINK_SPEED_25GB:\n+\t\titr += DIV_ROUND_UP(68 * (avg_pkt_size + 24),\n+\t\t\t\t    avg_pkt_size + 640);\n+\t\tbreak;\n \tcase ICE_AQ_LINK_SPEED_20GB:\n-\t\treturn ICE_ITR_ADAPTIVE_MIN_INC * 512;\n-\tcase ICE_AQ_LINK_SPEED_100MB:\n-\t\treturn ICE_ITR_ADAPTIVE_MIN_INC * 32;\n+\t\titr += DIV_ROUND_UP(85 * (avg_pkt_size + 24),\n+\t\t\t\t    avg_pkt_size + 640);\n+\t\tbreak;\n+\tcase ICE_AQ_LINK_SPEED_10GB:\n+\t\t/* fall through */\n \tdefault:\n-\t\treturn ICE_ITR_ADAPTIVE_MIN_INC * 256;\n+\t\titr += DIV_ROUND_UP(170 * (avg_pkt_size + 24),\n+\t\t\t\t    avg_pkt_size + 640);\n+\t\tbreak;\n \t}\n+\n+\tif ((itr & ICE_ITR_MASK) > ICE_ITR_ADAPTIVE_MAX_USECS) {\n+\t\titr &= ICE_ITR_ADAPTIVE_LATENCY;\n+\t\titr += ICE_ITR_ADAPTIVE_MAX_USECS;\n+\t}\n+\n+\treturn itr;\n }\n \n /**\n@@ -1128,8 +1178,8 @@ static unsigned int ice_itr_divisor(struct ice_port_info *pi)\n static void\n ice_update_itr(struct ice_q_vector *q_vector, struct ice_ring_container *rc)\n {\n-\tunsigned int avg_wire_size, packets, bytes, itr;\n \tunsigned long next_update = jiffies;\n+\tunsigned int packets, bytes, itr;\n \tbool container_is_rx;\n \n \tif (!rc->ring || !ITR_IS_DYNAMIC(rc->itr_setting))\n@@ -1174,7 +1224,7 @@ ice_update_itr(struct ice_q_vector *q_vector, struct ice_ring_container *rc)\n \t\tif (packets && packets < 4 && bytes < 9000 &&\n \t\t    (q_vector->tx.target_itr & ICE_ITR_ADAPTIVE_LATENCY)) {\n \t\t\titr = ICE_ITR_ADAPTIVE_LATENCY;\n-\t\t\tgoto adjust_by_size;\n+\t\t\tgoto adjust_by_size_and_speed;\n \t\t}\n \t} else if (packets < 4) {\n \t\t/* If we have Tx and Rx ITR maxed and Tx ITR is running in\n@@ -1242,70 +1292,11 @@ ice_update_itr(struct ice_q_vector *q_vector, struct ice_ring_container *rc)\n \t */\n \titr = ICE_ITR_ADAPTIVE_BULK;\n \n-adjust_by_size:\n-\t/* If packet counts are 256 or greater we can assume we have a gross\n-\t * overestimation of what the rate should be. Instead of trying to fine\n-\t * tune it just use the formula below to try and dial in an exact value\n-\t * gives the current packet size of the frame.\n-\t */\n-\tavg_wire_size = bytes / packets;\n+adjust_by_size_and_speed:\n \n-\t/* The following is a crude approximation of:\n-\t *  wmem_default / (size + overhead) = desired_pkts_per_int\n-\t *  rate / bits_per_byte / (size + ethernet overhead) = pkt_rate\n-\t *  (desired_pkt_rate / pkt_rate) * usecs_per_sec = ITR value\n-\t *\n-\t * Assuming wmem_default is 212992 and overhead is 640 bytes per\n-\t * packet, (256 skb, 64 headroom, 320 shared info), we can reduce the\n-\t * formula down to\n-\t *\n-\t *  (170 * (size + 24)) / (size + 640) = ITR\n-\t *\n-\t * We first do some math on the packet size and then finally bitshift\n-\t * by 8 after rounding up. We also have to account for PCIe link speed\n-\t * difference as ITR scales based on this.\n-\t */\n-\tif (avg_wire_size <= 60) {\n-\t\t/* Start at 250k ints/sec */\n-\t\tavg_wire_size = 4096;\n-\t} else if (avg_wire_size <= 380) {\n-\t\t/* 250K ints/sec to 60K ints/sec */\n-\t\tavg_wire_size *= 40;\n-\t\tavg_wire_size += 1696;\n-\t} else if (avg_wire_size <= 1084) {\n-\t\t/* 60K ints/sec to 36K ints/sec */\n-\t\tavg_wire_size *= 15;\n-\t\tavg_wire_size += 11452;\n-\t} else if (avg_wire_size <= 1980) {\n-\t\t/* 36K ints/sec to 30K ints/sec */\n-\t\tavg_wire_size *= 5;\n-\t\tavg_wire_size += 22420;\n-\t} else {\n-\t\t/* plateau at a limit of 30K ints/sec */\n-\t\tavg_wire_size = 32256;\n-\t}\n-\n-\t/* If we are in low latency mode halve our delay which doubles the\n-\t * rate to somewhere between 100K to 16K ints/sec\n-\t */\n-\tif (itr & ICE_ITR_ADAPTIVE_LATENCY)\n-\t\tavg_wire_size >>= 1;\n-\n-\t/* Resultant value is 256 times larger than it needs to be. This\n-\t * gives us room to adjust the value as needed to either increase\n-\t * or decrease the value based on link speeds of 10G, 2.5G, 1G, etc.\n-\t *\n-\t * Use addition as we have already recorded the new latency flag\n-\t * for the ITR value.\n-\t */\n-\titr += DIV_ROUND_UP(avg_wire_size,\n-\t\t\t    ice_itr_divisor(q_vector->vsi->port_info)) *\n-\t       ICE_ITR_ADAPTIVE_MIN_INC;\n-\n-\tif ((itr & ICE_ITR_MASK) > ICE_ITR_ADAPTIVE_MAX_USECS) {\n-\t\titr &= ICE_ITR_ADAPTIVE_LATENCY;\n-\t\titr += ICE_ITR_ADAPTIVE_MAX_USECS;\n-\t}\n+\t/* based on checks above packets cannot be 0 so division is safe */\n+\titr = ice_adjust_itr_by_size_and_speed(q_vector->vsi->port_info,\n+\t\t\t\t\t       bytes / packets, itr);\n \n clear_counts:\n \t/* write back value */\n",
    "prefixes": [
        "S17",
        "01/17"
    ]
}