Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/693936/?format=api
{ "id": 693936, "url": "http://patchwork.ozlabs.org/api/patches/693936/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1478896779-13697-3-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": "<1478896779-13697-3-git-send-email-bimmy.pujari@intel.com>", "list_archive_url": null, "date": "2016-11-11T20:39:26", "name": "[next,S54,02/15] i40e: recalculate vsi->active_filters from hash contents", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "4f9128999fbfb813a96e6cc907bba7cf8602f73c", "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/1478896779-13697-3-git-send-email-bimmy.pujari@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/693936/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/693936/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\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 3tFsJZ1g6Gz9t9x\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 12 Nov 2016 07:41:18 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id A2ED796106;\n\tFri, 11 Nov 2016 20:41:16 +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 iCKpwXRQLj9S; Fri, 11 Nov 2016 20:41:15 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id E20C796107;\n\tFri, 11 Nov 2016 20:41:15 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 3B75E1CEC94\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 11 Nov 2016 20:41:14 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 38266C2A25\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 11 Nov 2016 20:41:14 +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 1tdRh6ymA9jK for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 11 Nov 2016 20:41:13 +0000 (UTC)", "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 813A2C297A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 11 Nov 2016 20:41:13 +0000 (UTC)", "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby orsmga104.jf.intel.com with ESMTP; 11 Nov 2016 12:41:13 -0800", "from bimmy.jf.intel.com (HELO bimmy.linux1.jf.intel.com)\n\t([134.134.2.167])\n\tby fmsmga005.fm.intel.com with ESMTP; 11 Nov 2016 12:41:13 -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,474,1473145200\"; d=\"scan'208\";a=\"30297933\"", "From": "Bimmy Pujari <bimmy.pujari@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Fri, 11 Nov 2016 12:39:26 -0800", "Message-Id": "<1478896779-13697-3-git-send-email-bimmy.pujari@intel.com>", "X-Mailer": "git-send-email 2.4.11", "In-Reply-To": "<1478896779-13697-1-git-send-email-bimmy.pujari@intel.com>", "References": "<1478896779-13697-1-git-send-email-bimmy.pujari@intel.com>", "Subject": "[Intel-wired-lan] [next PATCH S54 02/15] i40e: recalculate\n\tvsi->active_filters from hash contents", "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: Jacob Keller <jacob.e.keller@intel.com>\n\nPrevious code refactors have accidentally caused issues with the\ncounting of active_filters. Avoid similar issues in the future by simply\nre-counting the active filters every time after we handle add and delete\nof all the filters. Additionally this allows us to simplify the check\nfor when we exit promiscuous mode since we can combine the check for\nfailed filters at the same time.\n\nAdditionally since we recount filters at the end we need to set\nvsi->promisc_threshold as well.\n\nThe resulting code takes a bit longer since we do have to loop over\nfilters again. However, the result is more readable and less likely to\nbecome incorrect due to failed accounting of filters in the future.\nFinally, this ensures that it is not possible for vsi->active_filters to\never underflow since we never decrement it.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\nChange-ID: Ib4f3a377e60eb1fa6c91ea86cc02238c08edd102\n---\n drivers/net/ethernet/intel/i40e/i40e_main.c | 52 ++++++++++++++++-------------\n 1 file changed, 29 insertions(+), 23 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 0b62d63..42b6d73 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -1869,12 +1869,10 @@ void i40e_aqc_add_filters(struct i40e_vsi *vsi, const char *vsi_name,\n \taq_ret = i40e_aq_add_macvlan(hw, vsi->seid, list, num_add, NULL);\n \taq_err = hw->aq.asq_last_status;\n \tfcnt = i40e_update_filter_state(num_add, list, add_head, aq_ret);\n-\tvsi->active_filters += fcnt;\n \n \tif (fcnt != num_add) {\n \t\t*promisc_changed = true;\n \t\tset_bit(__I40E_FILTER_OVERFLOW_PROMISC, &vsi->state);\n-\t\tvsi->promisc_threshold = (vsi->active_filters * 3) / 4;\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 \t\t\t i40e_aq_str(hw, aq_err),\n@@ -1938,6 +1936,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \tstruct i40e_hw *hw = &vsi->back->hw;\n \tunsigned int vlan_any_filters = 0;\n \tunsigned int non_vlan_filters = 0;\n+\tunsigned int failed_filters = 0;\n \tunsigned int vlan_filters = 0;\n \tbool promisc_changed = false;\n \tchar vsi_name[16] = \"PF\";\n@@ -1984,7 +1983,6 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \t\t\t\t/* Move the element into temporary del_list */\n \t\t\t\thash_del(&f->hlist);\n \t\t\t\thlist_add_head(&f->hlist, &tmp_del_list);\n-\t\t\t\tvsi->active_filters--;\n \n \t\t\t\t/* Avoid counting removed filters */\n \t\t\t\tcontinue;\n@@ -2045,7 +2043,6 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \t\t\t\tf->state = I40E_FILTER_REMOVE;\n \t\t\t\thash_del(&f->hlist);\n \t\t\t\thlist_add_head(&f->hlist, &tmp_del_list);\n-\t\t\t\tvsi->active_filters--;\n \t\t\t}\n \n \t\t\t/* Also update any filters on the tmp_add list */\n@@ -2202,27 +2199,36 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \t\tadd_list = NULL;\n \t}\n \n-\t/* Check to see if we can drop out of overflow promiscuous mode. */\n+\t/* Determine the number of active and failed filters. */\n+\tspin_lock_bh(&vsi->mac_filter_hash_lock);\n+\tvsi->active_filters = 0;\n+\thash_for_each(vsi->mac_filter_hash, bkt, f, hlist) {\n+\t\tif (f->state == I40E_FILTER_ACTIVE)\n+\t\t\tvsi->active_filters++;\n+\t\telse if (f->state == I40E_FILTER_FAILED)\n+\t\t\tfailed_filters++;\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_FILTER_OVERFLOW_PROMISC, &vsi->state) &&\n+\t !promisc_changed && !failed_filters &&\n \t (vsi->active_filters < vsi->promisc_threshold)) {\n-\t\tint failed_count = 0;\n-\t\t/* See if we have any failed filters. We can't drop out of\n-\t\t * promiscuous until these have all been deleted.\n-\t\t */\n-\t\tspin_lock_bh(&vsi->mac_filter_hash_lock);\n-\t\thash_for_each(vsi->mac_filter_hash, bkt, f, hlist) {\n-\t\t\tif (f->state == I40E_FILTER_FAILED)\n-\t\t\t\tfailed_count++;\n-\t\t}\n-\t\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n-\t\tif (!failed_count) {\n-\t\t\tdev_info(&pf->pdev->dev,\n-\t\t\t\t \"filter logjam cleared on %s, leaving overflow promiscuous mode\\n\",\n-\t\t\t\t vsi_name);\n-\t\t\tclear_bit(__I40E_FILTER_OVERFLOW_PROMISC, &vsi->state);\n-\t\t\tpromisc_changed = true;\n-\t\t\tvsi->promisc_threshold = 0;\n-\t\t}\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_FILTER_OVERFLOW_PROMISC, &vsi->state);\n+\t\tpromisc_changed = true;\n+\t\tvsi->promisc_threshold = 0;\n \t}\n \n \t/* if the VF is not trusted do not do promisc */\n", "prefixes": [ "next", "S54", "02/15" ] }