get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 678522,
    "url": "http://patchwork.ozlabs.org/api/patches/678522/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1475685046-16900-7-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-7-git-send-email-bimmy.pujari@intel.com>",
    "list_archive_url": null,
    "date": "2016-10-05T16:30:36",
    "name": "[next,S49-V2,06/15] i40e: implement __i40e_del_filter and use where applicable",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "6993e63c1a6776b467b02eb5cd98ce2daef3c500",
    "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-7-git-send-email-bimmy.pujari@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/678522/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/678522/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 3sq1XW0k9Lz9s9Y\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 95D70C2384;\n\tWed,  5 Oct 2016 16:32:25 +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 NzZxmkHgGjDq; 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 8CBAAC23A6;\n\tWed,  5 Oct 2016 16:32:16 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 9A5021CE508\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 hemlock.osuosl.org (Postfix) with ESMTP id 94E4B93CE4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  5 Oct 2016 16:32:13 +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 83FEwTwNN0aB 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 hemlock.osuosl.org (Postfix) with ESMTPS id 7D7EA8B25E\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:09 -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:09 -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=\"16526374\"",
        "From": "Bimmy Pujari <bimmy.pujari@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Wed,  5 Oct 2016 09:30:36 -0700",
        "Message-Id": "<1475685046-16900-7-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>",
        "Subject": "[Intel-wired-lan] [next PATCH S49-V2 06/15] i40e: implement\n\t__i40e_del_filter and use where applicable",
        "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\nWhen inside a loop where we call i40e_del_filter we use an O(n^2)\npattern where i40e_del_filter calls i40e_find_filter for us. We can\navoid this O(n^2) logic by factoring a function, __i40e_del_filter() out\nfrom the i40e_del_filter code. This allows us to re-use the delete logic\nwhere appropriate without having to search for the filter twice.\n\nThis new function benefits several functions including i40e_vsi_add_vlan,\ni40e_vsi_kill_vlan, i40e_del_mac_vlan_all, and i40e_vsi_release.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\nChange-ID: I75fabe0f53bf73f56b80d342e5fdcfcc28f4d3eb\n---\n drivers/net/ethernet/intel/i40e/i40e_main.c | 92 ++++++++++++++++++-----------\n 1 file changed, 59 insertions(+), 33 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex d365652..5692390 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -1271,10 +1271,13 @@ struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi,\n }\n \n /**\n- * i40e_del_filter - Remove a mac/vlan filter from the VSI\n- * @vsi: the VSI to be searched\n- * @macaddr: the MAC address\n- * @vlan: the vlan\n+ * __i40e_del_filter - Remove a specific filter from the VSI\n+ * @vsi: VSI to remove from\n+ * @f: the filter to remove from the list\n+ *\n+ * This function should be called instead of i40e_del_filter only if you know\n+ * the exact filter you will remove already, such as via i40e_find_filter or\n+ * i40e_find_mac.\n  *\n  * NOTE: This function is expected to be called with mac_filter_list_lock\n  * being held.\n@@ -1282,14 +1285,8 @@ struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi,\n  * the \"safe\" variants of any list iterators, e.g. list_for_each_entry_safe()\n  * instead of list_for_each_entry().\n  **/\n-void i40e_del_filter(struct i40e_vsi *vsi, const u8 *macaddr, s16 vlan)\n+static void __i40e_del_filter(struct i40e_vsi *vsi, struct i40e_mac_filter *f)\n {\n-\tstruct i40e_mac_filter *f;\n-\n-\tif (!vsi || !macaddr)\n-\t\treturn;\n-\n-\tf = i40e_find_filter(vsi, macaddr, vlan);\n \tif (!f)\n \t\treturn;\n \n@@ -1308,6 +1305,29 @@ void i40e_del_filter(struct i40e_vsi *vsi, const u8 *macaddr, s16 vlan)\n }\n \n /**\n+ * i40e_del_filter - Remove a mac/vlan filter from the VSI\n+ * @vsi: the VSI to be searched\n+ * @macaddr: the MAC address\n+ * @vlan: the vlan\n+ *\n+ * NOTE: This function is expected to be called with mac_filter_list_lock\n+ * being held.\n+ * ANOTHER NOTE: This function MUST be called from within the context of\n+ * the \"safe\" variants of any list iterators, e.g. list_for_each_entry_safe()\n+ * instead of list_for_each_entry().\n+ **/\n+void i40e_del_filter(struct i40e_vsi *vsi, const u8 *macaddr, s16 vlan)\n+{\n+\tstruct i40e_mac_filter *f;\n+\n+\tif (!vsi || !macaddr)\n+\t\treturn;\n+\n+\tf = i40e_find_filter(vsi, macaddr, vlan);\n+\t__i40e_del_filter(vsi, f);\n+}\n+\n+/**\n  * i40e_put_mac_in_vlan - Make macvlan filters from macaddrs and vlans\n  * @vsi: the VSI to be searched\n  * @macaddr: the mac address to be filtered\n@@ -1349,21 +1369,22 @@ struct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi,\n  **/\n int i40e_del_mac_all_vlan(struct i40e_vsi *vsi, const u8 *macaddr)\n {\n-\tstruct i40e_mac_filter *f = NULL;\n-\tint changed = 0;\n+\tstruct i40e_mac_filter *f, *ftmp;\n+\tbool found = false;\n \n \tWARN(!spin_is_locked(&vsi->mac_filter_list_lock),\n \t     \"Missing mac_filter_list_lock\\n\");\n-\tlist_for_each_entry(f, &vsi->mac_filter_list, list) {\n-\t\tif (ether_addr_equal(macaddr, f->macaddr))\n-\t\t\tf->state = I40E_FILTER_REMOVE;\n+\tlist_for_each_entry_safe(f, ftmp, &vsi->mac_filter_list, list) {\n+\t\tif (ether_addr_equal(macaddr, f->macaddr)) {\n+\t\t\t__i40e_del_filter(vsi, f);\n+\t\t\tfound = true;\n+\t\t}\n \t}\n-\tif (changed) {\n-\t\tvsi->flags |= I40E_VSI_FLAG_FILTER_CHANGED;\n-\t\tvsi->back->flags |= I40E_FLAG_FILTER_SYNC;\n+\n+\tif (found)\n \t\treturn 0;\n-\t}\n-\treturn -ENOENT;\n+\telse\n+\t\treturn -ENOENT;\n }\n \n /**\n@@ -2249,7 +2270,7 @@ static void i40e_vlan_rx_register(struct net_device *netdev, u32 features)\n  **/\n int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid)\n {\n-\tstruct i40e_mac_filter *f, *ftmp, *add_f;\n+\tstruct i40e_mac_filter *f, *ftmp, *add_f, *del_f;\n \n \t/* Locked once because all functions invoked below iterates list*/\n \tspin_lock_bh(&vsi->mac_filter_list_lock);\n@@ -2283,11 +2304,11 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid)\n \t * with 0, so we now accept untagged and specified tagged traffic\n \t * (and not all tags along with untagged)\n \t */\n-\tif (vid > 0) {\n-\t\tif (vsi->netdev && i40e_find_filter(vsi, vsi->netdev->dev_addr,\n-\t\t\t\t\t\t    I40E_VLAN_ANY)) {\n-\t\t\ti40e_del_filter(vsi, vsi->netdev->dev_addr,\n-\t\t\t\t\tI40E_VLAN_ANY);\n+\tif (vid > 0 && vsi->netdev) {\n+\t\tdel_f = i40e_find_filter(vsi, vsi->netdev->dev_addr,\n+\t\t\t\t\t I40E_VLAN_ANY);\n+\t\tif (del_f) {\n+\t\t\t__i40e_del_filter(vsi, del_f);\n \t\t\tadd_f = i40e_add_filter(vsi, vsi->netdev->dev_addr, 0);\n \t\t\tif (!add_f) {\n \t\t\t\tdev_info(&vsi->back->pdev->dev,\n@@ -2304,9 +2325,11 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid)\n \t\tlist_for_each_entry_safe(f, ftmp, &vsi->mac_filter_list, list) {\n \t\t\tif (f->state == I40E_FILTER_REMOVE)\n \t\t\t\tcontinue;\n-\t\t\tif (!i40e_find_filter(vsi, f->macaddr, I40E_VLAN_ANY))\n+\t\t\tdel_f = i40e_find_filter(vsi, f->macaddr,\n+\t\t\t\t\t\t I40E_VLAN_ANY);\n+\t\t\tif (!del_f)\n \t\t\t\tcontinue;\n-\t\t\ti40e_del_filter(vsi, f->macaddr, I40E_VLAN_ANY);\n+\t\t\t__i40e_del_filter(vsi, del_f);\n \t\t\tadd_f = i40e_add_filter(vsi, f->macaddr, 0);\n \t\t\tif (!add_f) {\n \t\t\t\tdev_info(&vsi->back->pdev->dev,\n@@ -2346,8 +2369,10 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid)\n \tif (vsi->netdev)\n \t\ti40e_del_filter(vsi, netdev->dev_addr, vid);\n \n-\tlist_for_each_entry_safe(f, ftmp, &vsi->mac_filter_list, list)\n-\t\ti40e_del_filter(vsi, f->macaddr, vid);\n+\tlist_for_each_entry_safe(f, ftmp, &vsi->mac_filter_list, list) {\n+\t\tif (f->vlan == 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@@ -2379,7 +2404,8 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid)\n \n \tif (!filter_count) {\n \t\tlist_for_each_entry_safe(f, ftmp, &vsi->mac_filter_list, list) {\n-\t\t\ti40e_del_filter(vsi, f->macaddr, 0);\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@@ -9442,7 +9468,7 @@ int i40e_vsi_release(struct i40e_vsi *vsi)\n \n \t/* make sure any remaining filters are marked for deletion */\n \tlist_for_each_entry_safe(f, ftmp, &vsi->mac_filter_list, list)\n-\t\ti40e_del_filter(vsi, f->macaddr, f->vlan);\n+\t\t__i40e_del_filter(vsi, f);\n \n \tspin_unlock_bh(&vsi->mac_filter_list_lock);\n \n",
    "prefixes": [
        "next",
        "S49-V2",
        "06/15"
    ]
}