Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/678523/?format=api
{ "id": 678523, "url": "http://patchwork.ozlabs.org/api/patches/678523/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1475685046-16900-10-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": "<1475685046-16900-10-git-send-email-bimmy.pujari@intel.com>", "list_archive_url": null, "date": "2016-10-05T16:30:39", "name": "[next,S49-V2,09/15] i40e: fix mac filters when removing vlans", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "ccf84ba5165db95664be7def6ca23fe1824d85a9", "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/1475685046-16900-10-git-send-email-bimmy.pujari@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/678523/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/678523/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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\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 3sq1XW6qgpz9sBR\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 6 Oct 2016 03:32:27 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 74964C23A9;\n\tWed, 5 Oct 2016 16:32:26 +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 mPAWo2NKLSzi; Wed, 5 Oct 2016 16:32:23 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id C7117C23AB;\n\tWed, 5 Oct 2016 16:32:16 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id D08141CE508\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 5 Oct 2016 16:32:13 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id C86B892235\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 5 Oct 2016 16:32:13 +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 7Npt7tO7zDKy for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 5 Oct 2016 16:32:10 +0000 (UTC)", "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id BC1F692582\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 5 Oct 2016 16:32:10 +0000 (UTC)", "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga105.fm.intel.com with ESMTP; 05 Oct 2016 09:32:10 -0700", "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; 05 Oct 2016 09:32:10 -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.31,449,1473145200\"; d=\"scan'208\";a=\"16526384\"", "From": "Bimmy Pujari <bimmy.pujari@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Wed, 5 Oct 2016 09:30:39 -0700", "Message-Id": "<1475685046-16900-10-git-send-email-bimmy.pujari@intel.com>", "X-Mailer": "git-send-email 2.4.11", "In-Reply-To": "<1475685046-16900-1-git-send-email-bimmy.pujari@intel.com>", "References": "<1475685046-16900-1-git-send-email-bimmy.pujari@intel.com>", "Cc": "Alan Brady <alan.brady@intel.com>", "Subject": "[Intel-wired-lan] [next PATCH S49-V2 09/15] i40e: fix mac filters\n\twhen removing vlans", "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\nCurrently there exists a bug where adding at least one VLAN and then\nremoving all VLANs leaves the mac filters for the VSI with an incorrect\nvalue for 'vid' which indicates the mac filter's vlan status.\n\nThe current implementation for handling the removal of VLANs is wrong\nfor a couple reasons. The first is that when i40e_vsi_kill_vlan\niterates through the mac filters, it fails to account for the mac filter\nstatus; i.e. it's not accomdating for filters that are about to be\ndeleted. The second problem is that mac filters can be deleted in other\nplaces (specifically i40e_set_rx_mode). Thus if it occurs that all the\nvlan mac filters get deleted we need to switch out of vlan mode, but the\ncode path through i40e_vsi_kill_vlan has already been executed and we're\nnow stuck in vlan mode.\n\nThis patch fixes the issue by removing the check from i40e_vsi_kill_vlan\nand puts the check instead in i40e_sync_vsi_filters where we're\nguaranteed to see all filter deletions and can properly detect when we\nneed to switch out of vlan mode.\n\nSigned-off-by: Alan Brady <alan.brady@intel.com>\nChange-ID: Ib38fe6034b356eee9a0e20b8a9eeed5ff2debcd9\n---\n drivers/net/ethernet/intel/i40e/i40e_main.c | 120 +++++++++++++++++-----------\n 1 file changed, 72 insertions(+), 48 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 2071727..21725dc 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -1774,19 +1774,22 @@ i40e_update_filter_state(int count,\n **/\n int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n {\n-\tstruct i40e_mac_filter *f, *add_head = NULL;\n \tstruct hlist_head tmp_add_list, tmp_del_list;\n+\tstruct i40e_mac_filter *f, *add_head = NULL;\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 vlan_filters = 0;\n \tbool promisc_changed = false;\n \tchar vsi_name[16] = \"PF\";\n \tint filter_list_len = 0;\n-\tu32 changed_flags = 0;\n \ti40e_status aq_ret = 0;\n+\tu32 changed_flags = 0;\n \tstruct hlist_node *h;\n-\tint retval = 0;\n \tstruct i40e_pf *pf;\n \tint num_add = 0;\n \tint num_del = 0;\n+\tint retval = 0;\n \tint aq_err = 0;\n \tu16 cmd_flags;\n \tint list_size;\n@@ -1825,11 +1828,75 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\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 \t\t\t}\n \t\t\tif (f->state == I40E_FILTER_NEW) {\n \t\t\t\thash_del(&f->hlist);\n \t\t\t\thlist_add_head(&f->hlist, &tmp_add_list);\n \t\t\t}\n+\n+\t\t\t/* Count the number of each type of filter we have\n+\t\t\t * remaining, ignoring any filters we're about to\n+\t\t\t * delete.\n+\t\t\t */\n+\t\t\tif (f->vlan > 0)\n+\t\t\t\tvlan_filters++;\n+\t\t\telse if (!f->vlan)\n+\t\t\t\tnon_vlan_filters++;\n+\t\t\telse\n+\t\t\t\tvlan_any_filters++;\n+\t\t}\n+\n+\t\t/* We should never have VLAN=-1 filters at the same time as we\n+\t\t * have either VLAN=0 or VLAN>0 filters, so warn about this\n+\t\t * case here to help catch any issues.\n+\t\t */\n+\t\tWARN_ON(vlan_any_filters && (vlan_filters + non_vlan_filters));\n+\n+\t\t/* If we only have VLAN=0 filters remaining, and don't have\n+\t\t * any other VLAN filters, we need to convert these VLAN=0\n+\t\t * filters into VLAN=-1 (I40E_VLAN_ANY) so that we operate\n+\t\t * correctly in non-VLAN mode and receive all traffic tagged\n+\t\t * or untagged.\n+\t\t */\n+\t\tif (non_vlan_filters && !vlan_filters) {\n+\t\t\thash_for_each_safe(vsi->mac_filter_hash, bkt, h, f,\n+\t\t\t\t\t hlist) {\n+\t\t\t\t/* Only replace VLAN=0 filters */\n+\t\t\t\tif (f->vlan)\n+\t\t\t\t\tcontinue;\n+\n+\t\t\t\t/* Allocate a replacement element */\n+\t\t\t\tadd_head = kzalloc(sizeof(*add_head),\n+\t\t\t\t\t\t GFP_KERNEL);\n+\t\t\t\tif (!add_head)\n+\t\t\t\t\tgoto err_no_memory_locked;\n+\n+\t\t\t\t/* Copy the filter, with new state and VLAN */\n+\t\t\t\t*add_head = *f;\n+\t\t\t\tadd_head->state = I40E_FILTER_NEW;\n+\t\t\t\tadd_head->vlan = I40E_VLAN_ANY;\n+\n+\t\t\t\t/* Move the replacement to the add list */\n+\t\t\t\tINIT_HLIST_NODE(&add_head->hlist);\n+\t\t\t\thlist_add_head(&add_head->hlist,\n+\t\t\t\t\t &tmp_add_list);\n+\n+\t\t\t\t/* Move the original to the delete list */\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+\t\t\thlist_for_each_entry(f, &tmp_add_list, hlist) {\n+\t\t\t\tif (!f->vlan)\n+\t\t\t\t\tf->vlan = I40E_VLAN_ANY;\n+\t\t\t}\n+\t\t\tadd_head = NULL;\n \t\t}\n \t\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n \t}\n@@ -2138,6 +2205,7 @@ out:\n err_no_memory:\n \t/* Restore elements on the temporary add and delete lists */\n \tspin_lock_bh(&vsi->mac_filter_hash_lock);\n+err_no_memory_locked:\n \ti40e_undo_filter_entries(vsi, &tmp_del_list);\n \ti40e_undo_filter_entries(vsi, &tmp_add_list);\n \tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n@@ -2396,9 +2464,8 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid)\n int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid)\n {\n \tstruct net_device *netdev = vsi->netdev;\n-\tstruct i40e_mac_filter *f, *add_f;\n+\tstruct i40e_mac_filter *f;\n \tstruct hlist_node *h;\n-\tint filter_count = 0;\n \tint bkt;\n \n \t/* Locked once because all functions invoked below iterates list */\n@@ -2412,49 +2479,6 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid)\n \t\t\t__i40e_del_filter(vsi, f);\n \t}\n \n-\t/* go through all the filters for this VSI and if there is only\n-\t * vid == 0 it means there are no other filters, so vid 0 must\n-\t * be replaced with -1. This signifies that we should from now\n-\t * on accept any traffic (with any tag present, or untagged)\n-\t */\n-\thash_for_each(vsi->mac_filter_hash, bkt, f, hlist) {\n-\t\tif (vsi->netdev) {\n-\t\t\tif (f->vlan &&\n-\t\t\t ether_addr_equal(netdev->dev_addr, f->macaddr))\n-\t\t\t\tfilter_count++;\n-\t\t}\n-\n-\t\tif (f->vlan)\n-\t\t\tfilter_count++;\n-\t}\n-\n-\tif (!filter_count && vsi->netdev) {\n-\t\ti40e_del_filter(vsi, netdev->dev_addr, 0);\n-\t\tf = i40e_add_filter(vsi, netdev->dev_addr, I40E_VLAN_ANY);\n-\t\tif (!f) {\n-\t\t\tdev_info(&vsi->back->pdev->dev,\n-\t\t\t\t \"Could not add filter %d for %pM\\n\",\n-\t\t\t\t I40E_VLAN_ANY, netdev->dev_addr);\n-\t\t\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n-\t\t\treturn -ENOMEM;\n-\t\t}\n-\t}\n-\n-\tif (!filter_count) {\n-\t\thash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist) {\n-\t\t\tif (!f->vlan)\n-\t\t\t\t__i40e_del_filter(vsi, f);\n-\t\t\tadd_f = i40e_add_filter(vsi, f->macaddr, I40E_VLAN_ANY);\n-\t\t\tif (!add_f) {\n-\t\t\t\tdev_info(&vsi->back->pdev->dev,\n-\t\t\t\t\t \"Could not add filter %d for %pM\\n\",\n-\t\t\t\t\t I40E_VLAN_ANY, f->macaddr);\n-\t\t\t\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n-\t\t\t\treturn -ENOMEM;\n-\t\t\t}\n-\t\t}\n-\t}\n-\n \tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n \n \t/* schedule our worker thread which will take care of\n", "prefixes": [ "next", "S49-V2", "09/15" ] }