Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/700225/?format=api
{ "id": 700225, "url": "http://patchwork.ozlabs.org/api/patches/700225/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1480377971-23412-6-git-send-email-bimmy.pujari@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": "<1480377971-23412-6-git-send-email-bimmy.pujari@intel.com>", "list_archive_url": null, "date": "2016-11-29T00:06:02", "name": "[next,S55,05/14] i40e: refactor macro INTRL_USEC_TO_REG", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "78fdd18a78c2d066ce474b45aaa68e473abd4692", "submitter": { "id": 68919, "url": "http://patchwork.ozlabs.org/api/people/68919/?format=api", "name": "Pujari, Bimmy", "email": "bimmy.pujari@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/1480377971-23412-6-git-send-email-bimmy.pujari@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/700225/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/700225/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\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3tSP5C6rXZz9tlW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 29 Nov 2016 11:07:59 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 3E4A188A03;\n\tTue, 29 Nov 2016 00:07:58 +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 IVD1sftYe3kD; Tue, 29 Nov 2016 00:07:53 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 9EA7788915;\n\tTue, 29 Nov 2016 00:07:52 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 84BC11C0975\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 29 Nov 2016 00:07:49 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 7F15193AEC\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 29 Nov 2016 00:07:49 +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 VAHZ13EViNiI for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 29 Nov 2016 00:07:48 +0000 (UTC)", "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 823AB93B05\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 29 Nov 2016 00:07:48 +0000 (UTC)", "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby orsmga104.jf.intel.com with ESMTP; 28 Nov 2016 16:07:47 -0800", "from bimmy.jf.intel.com (HELO bimmy.linux1.jf.intel.com)\n\t([134.134.2.167])\n\tby orsmga004.jf.intel.com with ESMTP; 28 Nov 2016 16:07:47 -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-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.31,565,1473145200\"; d=\"scan'208\";a=\"35284056\"", "From": "Bimmy Pujari <bimmy.pujari@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Mon, 28 Nov 2016 16:06:02 -0800", "Message-Id": "<1480377971-23412-6-git-send-email-bimmy.pujari@intel.com>", "X-Mailer": "git-send-email 2.4.11", "In-Reply-To": "<1480377971-23412-1-git-send-email-bimmy.pujari@intel.com>", "References": "<1480377971-23412-1-git-send-email-bimmy.pujari@intel.com>", "Cc": "Alan Brady <alan.brady@intel.com>", "Subject": "[Intel-wired-lan] [next PATCH S55 05/14] i40e: refactor macro\n\tINTRL_USEC_TO_REG", "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: Alan Brady <alan.brady@intel.com>\n\nThis patch refactors the macro INTRL_USEC_TO_REG into a static inline\nfunction and fixes a couple subtle bugs caused by the macro.\n\nThis patch fixes a bug which was caused by passing a bad register value\nto the firmware. If enabling interrupt rate limiting, a non-zero value\nfor the rate limit must be used. Otherwise the firmware sets the\ninterrupt rate limit to the maximum value. Due to the limited\nresolution of the register, attempting to set a value of 1, 2, or 3\nwould be rounded down to 0 and limiting was left enabled, causing\nunexpected behavior.\n\nThis patch also fixes a possible bug in which using the macro itself can\nintroduce unintended side-affects because the macro argument is used\nmore than once in the macro definition (e.g. a variable post-increment\nargument would perform a double increment on the variable).\n\nWithout this patch, attempting to set interrupt rate limits of 1, 2, or\n3 results in unexpected behavior and future use of this macro could\ncause subtle bugs.\n\nSigned-off-by: Alan Brady <alan.brady@intel.com>\nChange-Id: I83ac842de0ca9c86761923d6e3a4d7b1b95f2b3f\n---\nTesting-hints:\nUse 'ethtool -C ethx rx-usecs-high xxx' to set different values for the\nrate limit and 'idb ethx read 0x00035800' to observe register\nPFINT_RATEN for values of 1, 2, 3, compared to 0 and 4.\n\nHSDES-number: 1208935557\n\n drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +-\n drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-\n drivers/net/ethernet/intel/i40e/i40e_txrx.h | 15 ++++++++++++++-\n 3 files changed, 16 insertions(+), 3 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\nindex 99772ee..977ae6f 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n@@ -2072,7 +2072,7 @@ static void i40e_set_itr_per_queue(struct i40e_vsi *vsi,\n \tstruct i40e_q_vector *q_vector;\n \tu16 vector, intrl;\n \n-\tintrl = INTRL_USEC_TO_REG(vsi->int_rate_limit);\n+\tintrl = i40e_intrl_usec_to_reg(vsi->int_rate_limit);\n \n \tvsi->rx_rings[queue]->rx_itr_setting = ec->rx_coalesce_usecs;\n \tvsi->tx_rings[queue]->tx_itr_setting = ec->tx_coalesce_usecs;\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 769f922..4b5f6c0 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -3263,7 +3263,7 @@ static void i40e_vsi_configure_msix(struct i40e_vsi *vsi)\n \t\twr32(hw, I40E_PFINT_ITRN(I40E_TX_ITR, vector - 1),\n \t\t q_vector->tx.itr);\n \t\twr32(hw, I40E_PFINT_RATEN(vector - 1),\n-\t\t INTRL_USEC_TO_REG(vsi->int_rate_limit));\n+\t\t i40e_intrl_usec_to_reg(vsi->int_rate_limit));\n \n \t\t/* Linked list for the queuepairs assigned to this vector */\n \t\twr32(hw, I40E_PFINT_LNKLSTN(vector - 1), qp);\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\nindex e065321..1ea820e 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n@@ -52,7 +52,20 @@\n */\n #define INTRL_ENA BIT(6)\n #define INTRL_REG_TO_USEC(intrl) ((intrl & ~INTRL_ENA) << 2)\n-#define INTRL_USEC_TO_REG(set) ((set) ? ((set) >> 2) | INTRL_ENA : 0)\n+/**\n+ * i40e_intrl_usec_to_reg - convert interrupt rate limit to register\n+ * @intrl: interrupt rate limit to convert\n+ *\n+ * This function converts a decimal interrupt rate limit to the appropriate\n+ * register format expected by the firmware when setting interrupt rate limit.\n+ */\n+static inline u16 i40e_intrl_usec_to_reg(int intrl)\n+{\n+\tif (intrl >> 2)\n+\t\treturn ((intrl >> 2) | INTRL_ENA);\n+\telse\n+\t\treturn 0;\n+}\n #define I40E_INTRL_8K 125 /* 8000 ints/sec */\n #define I40E_INTRL_62K 16 /* 62500 ints/sec */\n #define I40E_INTRL_83K 12 /* 83333 ints/sec */\n", "prefixes": [ "next", "S55", "05/14" ] }