Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/869558/?format=api
{ "id": 869558, "url": "http://patchwork.ozlabs.org/api/patches/869558/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180205210337.22102-4-jeffrey.t.kirsher@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": "<20180205210337.22102-4-jeffrey.t.kirsher@intel.com>", "list_archive_url": null, "date": "2018-02-05T21:03:33", "name": "[S86,v3,4/8] i40e: refactor promisc_changed in i40e_sync_vsi_filters", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "a4a1774920a763ef6f2ce8e85dec35e780b08710", "submitter": { "id": 473, "url": "http://patchwork.ozlabs.org/api/people/473/?format=api", "name": "Kirsher, Jeffrey T", "email": "jeffrey.t.kirsher@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/20180205210337.22102-4-jeffrey.t.kirsher@intel.com/mbox/", "series": [ { "id": 27070, "url": "http://patchwork.ozlabs.org/api/series/27070/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=27070", "date": "2018-02-05T21:03:31", "name": "[S86,v3,1/8] i40e: don't leak memory addresses", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/27070/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/869558/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/869558/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.136; helo=silver.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\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 3zb0SG5YLCz9sR8\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 6 Feb 2018 08:03:42 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 552ED2FD8C;\n\tMon, 5 Feb 2018 21:03:41 +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 BiR17niNdX8p; Mon, 5 Feb 2018 21:03:39 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 2EC662FD92;\n\tMon, 5 Feb 2018 21:03:39 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 8ACA51C0A7F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 5 Feb 2018 21:03:35 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 86B6D88113\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 5 Feb 2018 21:03:35 +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 yAKfj3PYqIw8 for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 5 Feb 2018 21:03:34 +0000 (UTC)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 5861E8812A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 5 Feb 2018 21:03:34 +0000 (UTC)", "from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t05 Feb 2018 13:03:33 -0800", "from jtkirshe-nuc.jf.intel.com ([134.134.177.59])\n\tby fmsmga008.fm.intel.com with ESMTP; 05 Feb 2018 13:03:33 -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.46,466,1511856000\"; d=\"scan'208\";a=\"15608854\"", "From": "Jeff Kirsher <jeffrey.t.kirsher@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Mon, 5 Feb 2018 13:03:33 -0800", "Message-Id": "<20180205210337.22102-4-jeffrey.t.kirsher@intel.com>", "X-Mailer": "git-send-email 2.14.3", "In-Reply-To": "<20180205210337.22102-1-jeffrey.t.kirsher@intel.com>", "References": "<20180205210337.22102-1-jeffrey.t.kirsher@intel.com>", "Subject": "[Intel-wired-lan] [S86 v3 4/8] i40e: refactor promisc_changed in\n\ti40e_sync_vsi_filters", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.24", "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: Alan Brady <alan.brady@intel.com>\n\nThis code here is quite complex and easy to screw up. Let's see if we\ncan't improve the readability and maintainability a bit. This refactors\nout promisc_changed into two variables 'old_overflow' and 'new_overflow'\nwhich makes it a bit clearer when we're concerned about when and how\noverflow promiscuous is changed. This also makes so that we no longer\nneed to pass a boolean pointer to i40e_aqc_add_filters. Instead we can\nsimply check if we changed the overflow promiscuous flag since the\nfunction start.\n\nSigned-off-by: Alan Brady <alan.brady@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_main.c | 42 ++++++++++++++---------------\n 1 file changed, 20 insertions(+), 22 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 66478918c4c2..dc5ef4d5eceb 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -2110,17 +2110,16 @@ void i40e_aqc_del_filters(struct i40e_vsi *vsi, const char *vsi_name,\n * @list: the list of filters to send to firmware\n * @add_head: Position in the add hlist\n * @num_add: the number of filters to add\n- * @promisc_change: set to true on exit if promiscuous mode was forced on\n *\n * Send a request to firmware via AdminQ to add a chunk of filters. Will set\n- * promisc_changed to true if the firmware has run out of space for more\n- * filters.\n+ * __I40E_VSI_OVERFLOW_PROMISC bit in vsi->state if the firmware has run out of\n+ * space for more filters.\n */\n static\n void i40e_aqc_add_filters(struct i40e_vsi *vsi, const char *vsi_name,\n \t\t\t struct i40e_aqc_add_macvlan_element_data *list,\n \t\t\t struct i40e_new_mac_filter *add_head,\n-\t\t\t int num_add, bool *promisc_changed)\n+\t\t\t int num_add)\n {\n \tstruct i40e_hw *hw = &vsi->back->hw;\n \tint aq_err, fcnt;\n@@ -2130,7 +2129,6 @@ void i40e_aqc_add_filters(struct i40e_vsi *vsi, const char *vsi_name,\n \tfcnt = i40e_update_filter_state(num_add, list, add_head);\n \n \tif (fcnt != num_add) {\n-\t\t*promisc_changed = true;\n \t\tset_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);\n \t\tdev_warn(&vsi->back->pdev->dev,\n \t\t\t \"Error %s adding RX filters on %s, promiscuous mode forced on\\n\",\n@@ -2263,9 +2261,9 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \tstruct i40e_mac_filter *f;\n \tstruct i40e_new_mac_filter *new, *add_head = NULL;\n \tstruct i40e_hw *hw = &vsi->back->hw;\n+\tbool old_overflow, new_overflow;\n \tunsigned int failed_filters = 0;\n \tunsigned int vlan_filters = 0;\n-\tbool promisc_changed = false;\n \tchar vsi_name[16] = \"PF\";\n \tint filter_list_len = 0;\n \ti40e_status aq_ret = 0;\n@@ -2287,6 +2285,8 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \t\tusleep_range(1000, 2000);\n \tpf = vsi->back;\n \n+\told_overflow = test_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);\n+\n \tif (vsi->netdev) {\n \t\tchanged_flags = vsi->current_netdev_flags ^ vsi->netdev->flags;\n \t\tvsi->current_netdev_flags = vsi->netdev->flags;\n@@ -2460,15 +2460,14 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \t\t\t/* flush a full buffer */\n \t\t\tif (num_add == filter_list_len) {\n \t\t\t\ti40e_aqc_add_filters(vsi, vsi_name, add_list,\n-\t\t\t\t\t\t add_head, num_add,\n-\t\t\t\t\t\t &promisc_changed);\n+\t\t\t\t\t\t add_head, num_add);\n \t\t\t\tmemset(add_list, 0, list_size);\n \t\t\t\tnum_add = 0;\n \t\t\t}\n \t\t}\n \t\tif (num_add) {\n \t\t\ti40e_aqc_add_filters(vsi, vsi_name, add_list, add_head,\n-\t\t\t\t\t num_add, &promisc_changed);\n+\t\t\t\t\t num_add);\n \t\t}\n \t\t/* Now move all of the filters from the temp add list back to\n \t\t * the VSI's list.\n@@ -2497,24 +2496,16 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \t}\n \tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n \n-\t/* If promiscuous mode has changed, we need to calculate a new\n-\t * threshold for when we are safe to exit\n-\t */\n-\tif (promisc_changed)\n-\t\tvsi->promisc_threshold = (vsi->active_filters * 3) / 4;\n-\n \t/* Check if we are able to exit overflow promiscuous mode. We can\n \t * safely exit if we didn't just enter, we no longer have any failed\n \t * filters, and we have reduced filters below the threshold value.\n \t */\n-\tif (test_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state) &&\n-\t !promisc_changed && !failed_filters &&\n-\t (vsi->active_filters < vsi->promisc_threshold)) {\n+\tif (old_overflow && !failed_filters &&\n+\t vsi->active_filters < vsi->promisc_threshold) {\n \t\tdev_info(&pf->pdev->dev,\n \t\t\t \"filter logjam cleared on %s, leaving overflow promiscuous mode\\n\",\n \t\t\t vsi_name);\n \t\tclear_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);\n-\t\tpromisc_changed = true;\n \t\tvsi->promisc_threshold = 0;\n \t}\n \n@@ -2524,6 +2515,14 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \t\tgoto out;\n \t}\n \n+\tnew_overflow = test_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);\n+\n+\t/* If we are entering overflow promiscuous, we need to calculate a new\n+\t * threshold for when we are safe to exit\n+\t */\n+\tif (!old_overflow && new_overflow)\n+\t\tvsi->promisc_threshold = (vsi->active_filters * 3) / 4;\n+\n \t/* check for changes in promiscuous modes */\n \tif (changed_flags & IFF_ALLMULTI) {\n \t\tbool cur_multipromisc;\n@@ -2544,12 +2543,11 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \t\t}\n \t}\n \n-\tif ((changed_flags & IFF_PROMISC) || promisc_changed) {\n+\tif ((changed_flags & IFF_PROMISC) || old_overflow != new_overflow) {\n \t\tbool cur_promisc;\n \n \t\tcur_promisc = (!!(vsi->current_netdev_flags & IFF_PROMISC) ||\n-\t\t\t test_bit(__I40E_VSI_OVERFLOW_PROMISC,\n-\t\t\t\t\tvsi->state));\n+\t\t\t new_overflow);\n \t\taq_ret = i40e_set_promiscuous(pf, cur_promisc);\n \t\tif (aq_ret) {\n \t\t\tretval = i40e_aq_rc_to_posix(aq_ret,\n", "prefixes": [ "S86", "v3", "4/8" ] }