get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 676701,
    "url": "http://patchwork.ozlabs.org/api/patches/676701/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1475169095-20873-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": "<1475169095-20873-10-git-send-email-bimmy.pujari@intel.com>",
    "list_archive_url": null,
    "date": "2016-09-29T17:11:29",
    "name": "[next,S49,09/15] i40e: fix mac filters when removing vlans",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "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/1475169095-20873-10-git-send-email-bimmy.pujari@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/676701/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/676701/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 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 3slLl81Tx1z9s9Y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 30 Sep 2016 03:13:56 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id A62A032FE5;\n\tThu, 29 Sep 2016 17:13:54 +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 XxjmjExR2mo0; Thu, 29 Sep 2016 17:13:45 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id C92CD33013;\n\tThu, 29 Sep 2016 17:13:06 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 2F1F81C1ECC\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 29 Sep 2016 17:13:04 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 2B86D952D7\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 29 Sep 2016 17:13:04 +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 kCOaKTuu6u9G for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 29 Sep 2016 17:13:00 +0000 (UTC)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 9211A952E8\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 29 Sep 2016 17:12:59 +0000 (UTC)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga101.fm.intel.com with ESMTP; 29 Sep 2016 10:12:58 -0700",
            "from bimmy.jf.intel.com (HELO bimmy.linux1.jf.intel.com)\n\t([134.134.2.167])\n\tby fmsmga004.fm.intel.com with ESMTP; 29 Sep 2016 10:12:59 -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,268,1473145200\"; d=\"scan'208\";a=\"174642316\"",
        "From": "Bimmy Pujari <bimmy.pujari@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Thu, 29 Sep 2016 10:11:29 -0700",
        "Message-Id": "<1475169095-20873-10-git-send-email-bimmy.pujari@intel.com>",
        "X-Mailer": "git-send-email 2.4.11",
        "In-Reply-To": "<1475169095-20873-1-git-send-email-bimmy.pujari@intel.com>",
        "References": "<1475169095-20873-1-git-send-email-bimmy.pujari@intel.com>",
        "Cc": "\"Brady, Alan\" <alan.brady@intel.com>",
        "Subject": "[Intel-wired-lan] [next PATCH S49 09/15] i40e: fix mac filters when\n\tremoving 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: \"Brady, Alan\" <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---\nHSD-number: 10020696\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 6cd9053..5ea761c 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",
        "09/15"
    ]
}