get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 678512,
    "url": "http://patchwork.ozlabs.org/api/patches/678512/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1475685046-16900-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": "<1475685046-16900-3-git-send-email-bimmy.pujari@intel.com>",
    "list_archive_url": null,
    "date": "2016-10-05T16:30:32",
    "name": "[next,S49-V2,02/15] i40e: make use of __dev_uc_sync and __dev_mc_sync",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "7879ee604174edeed7b482cd0732bc2361770efe",
    "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-3-git-send-email-bimmy.pujari@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/678512/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/678512/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 3sq1XJ3Slbz9sD6\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  6 Oct 2016 03:32:16 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 9CA1CC2367;\n\tWed,  5 Oct 2016 16:32: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 5bljH-lhyoSy; Wed,  5 Oct 2016 16:32:12 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 28B30C2360;\n\tWed,  5 Oct 2016 16:32:12 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id CA5201CE82D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  5 Oct 2016 16:32:10 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id C6F798B3D5\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  5 Oct 2016 16:32:10 +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 4wIDJ2tuhy+r for <intel-wired-lan@lists.osuosl.org>;\n\tWed,  5 Oct 2016 16:32:09 +0000 (UTC)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id DA5B48B00D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  5 Oct 2016 16:32:09 +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=\"16526358\"",
        "From": "Bimmy Pujari <bimmy.pujari@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Wed,  5 Oct 2016 09:30:32 -0700",
        "Message-Id": "<1475685046-16900-3-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 02/15] i40e: make use of\n\t__dev_uc_sync and __dev_mc_sync",
        "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\nThe kernel provides __dev_uc_sync and __dev_mc_sync in order for drivers\nwhich need individual notification of add and delete for each filter.\nThese functions allow us to vastly simplify our .set_rx_mode handler. We\nneed to implement two functions for sync and unsync which add and remove\nfilters respectively.\n\nThis change avoids a very complex and inefficient algorithm which\nresulted in an abnormal latency for the .set_rx_mode ndo operation. The\nresulting code after this change is more readable, more efficient, and\nless code.\n\nDue to the callback signature used by these functions we also must\nupdate several other functions to take a const u8 * pointer.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\nChange-Id: I2ca7fd4e10c0c07ed2291db1ea41bf5987fc6474\n---\n drivers/net/ethernet/intel/i40e/i40e.h      |  10 +--\n drivers/net/ethernet/intel/i40e/i40e_main.c | 113 ++++++++++++++++------------\n 2 files changed, 69 insertions(+), 54 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 8445591..a9c0228 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -720,8 +720,8 @@ u32 i40e_get_global_fd_count(struct i40e_pf *pf);\n bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features);\n void i40e_set_ethtool_ops(struct net_device *netdev);\n struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi,\n-\t\t\t\t\tu8 *macaddr, s16 vlan);\n-void i40e_del_filter(struct i40e_vsi *vsi, u8 *macaddr, s16 vlan);\n+\t\t\t\t\tconst u8 *macaddr, s16 vlan);\n+void i40e_del_filter(struct i40e_vsi *vsi, const u8 *macaddr, s16 vlan);\n int i40e_sync_vsi_filters(struct i40e_vsi *vsi);\n struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,\n \t\t\t\tu16 uplink, u32 param1);\n@@ -813,10 +813,10 @@ void i40e_vlan_stripping_disable(struct i40e_vsi *vsi);\n int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid);\n int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid);\n struct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi,\n-\t\t\t\t\t     u8 *macaddr);\n-int i40e_del_mac_all_vlan(struct i40e_vsi *vsi, u8 *macaddr);\n+\t\t\t\t\t     const u8 *macaddr);\n+int i40e_del_mac_all_vlan(struct i40e_vsi *vsi, const u8 *macaddr);\n bool i40e_is_vsi_in_vlan(struct i40e_vsi *vsi);\n-struct i40e_mac_filter *i40e_find_mac(struct i40e_vsi *vsi, u8 *macaddr);\n+struct i40e_mac_filter *i40e_find_mac(struct i40e_vsi *vsi, const u8 *macaddr);\n #ifdef I40E_FCOE\n int __i40e_setup_tc(struct net_device *netdev, u32 handle, __be16 proto,\n \t\t    struct tc_to_netdev *tc);\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 09f855f..eb05ca8 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -1149,7 +1149,7 @@ void i40e_update_stats(struct i40e_vsi *vsi)\n  * Returns ptr to the filter object or NULL\n  **/\n static struct i40e_mac_filter *i40e_find_filter(struct i40e_vsi *vsi,\n-\t\t\t\t\t\tu8 *macaddr, s16 vlan)\n+\t\t\t\t\t\tconst u8 *macaddr, s16 vlan)\n {\n \tstruct i40e_mac_filter *f;\n \n@@ -1172,7 +1172,7 @@ static struct i40e_mac_filter *i40e_find_filter(struct i40e_vsi *vsi,\n  * Returns the first filter with the provided MAC address or NULL if\n  * MAC address was not found\n  **/\n-struct i40e_mac_filter *i40e_find_mac(struct i40e_vsi *vsi, u8 *macaddr)\n+struct i40e_mac_filter *i40e_find_mac(struct i40e_vsi *vsi, const u8 *macaddr)\n {\n \tstruct i40e_mac_filter *f;\n \n@@ -1217,7 +1217,8 @@ bool i40e_is_vsi_in_vlan(struct i40e_vsi *vsi)\n  *\n  * Returns first filter found on success, else NULL\n  **/\n-struct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi, u8 *macaddr)\n+struct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi,\n+\t\t\t\t\t     const u8 *macaddr)\n {\n \tstruct i40e_mac_filter *f;\n \n@@ -1243,7 +1244,7 @@ struct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi, u8 *macaddr)\n  *\n  * Returns 0 for success, or error\n  **/\n-int i40e_del_mac_all_vlan(struct i40e_vsi *vsi, u8 *macaddr)\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@@ -1275,7 +1276,7 @@ int i40e_del_mac_all_vlan(struct i40e_vsi *vsi, u8 *macaddr)\n  * being held.\n  **/\n struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi,\n-\t\t\t\t\tu8 *macaddr, s16 vlan)\n+\t\t\t\t\tconst u8 *macaddr, s16 vlan)\n {\n \tstruct i40e_mac_filter *f;\n \n@@ -1338,7 +1339,7 @@ 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, u8 *macaddr, s16 vlan)\n+void i40e_del_filter(struct i40e_vsi *vsi, const u8 *macaddr, s16 vlan)\n {\n \tstruct i40e_mac_filter *f;\n \n@@ -1568,6 +1569,52 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi,\n }\n \n /**\n+ * i40e_addr_sync - Callback for dev_(mc|uc)_sync to add address\n+ * @netdev: the netdevice\n+ * @addr: address to add\n+ *\n+ * Called by __dev_(mc|uc)_sync when an address needs to be added. We call\n+ * __dev_(uc|mc)_sync from .set_rx_mode and guarantee to hold the hash lock.\n+ */\n+static int i40e_addr_sync(struct net_device *netdev, const u8 *addr)\n+{\n+\tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n+\tstruct i40e_vsi *vsi = np->vsi;\n+\tstruct i40e_mac_filter *f;\n+\n+\tif (i40e_is_vsi_in_vlan(vsi))\n+\t\tf = i40e_put_mac_in_vlan(vsi, addr);\n+\telse\n+\t\tf = i40e_add_filter(vsi, addr, I40E_VLAN_ANY);\n+\n+\tif (f)\n+\t\treturn 0;\n+\telse\n+\t\treturn -ENOMEM;\n+}\n+\n+/**\n+ * i40e_addr_unsync - Callback for dev_(mc|uc)_sync to remove address\n+ * @netdev: the netdevice\n+ * @addr: address to add\n+ *\n+ * Called by __dev_(mc|uc)_sync when an address needs to be removed. We call\n+ * __dev_(uc|mc)_sync from .set_rx_mode and guarantee to hold the hash lock.\n+ */\n+static int i40e_addr_unsync(struct net_device *netdev, const u8 *addr)\n+{\n+\tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n+\tstruct i40e_vsi *vsi = np->vsi;\n+\n+\tif (i40e_is_vsi_in_vlan(vsi))\n+\t\ti40e_del_mac_all_vlan(vsi, addr);\n+\telse\n+\t\ti40e_del_filter(vsi, addr, I40E_VLAN_ANY);\n+\n+\treturn 0;\n+}\n+\n+/**\n  * i40e_set_rx_mode - NDO callback to set the netdev filters\n  * @netdev: network interface device structure\n  **/\n@@ -1578,54 +1625,13 @@ static void i40e_set_rx_mode(struct net_device *netdev)\n #endif\n {\n \tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n-\tstruct i40e_mac_filter *f, *ftmp;\n \tstruct i40e_vsi *vsi = np->vsi;\n-\tstruct netdev_hw_addr *uca;\n-\tstruct netdev_hw_addr *mca;\n-\tstruct netdev_hw_addr *ha;\n \n \tspin_lock_bh(&vsi->mac_filter_list_lock);\n \n-\t/* add addr if not already in the filter list */\n-\tnetdev_for_each_uc_addr(uca, netdev) {\n-\t\tif (!i40e_find_mac(vsi, uca->addr)) {\n-\t\t\tif (i40e_is_vsi_in_vlan(vsi))\n-\t\t\t\ti40e_put_mac_in_vlan(vsi, uca->addr);\n-\t\t\telse\n-\t\t\t\ti40e_add_filter(vsi, uca->addr, I40E_VLAN_ANY);\n-\t\t}\n-\t}\n-\n-\tnetdev_for_each_mc_addr(mca, netdev) {\n-\t\tif (!i40e_find_mac(vsi, mca->addr)) {\n-\t\t\tif (i40e_is_vsi_in_vlan(vsi))\n-\t\t\t\ti40e_put_mac_in_vlan(vsi, mca->addr);\n-\t\t\telse\n-\t\t\t\ti40e_add_filter(vsi, mca->addr, I40E_VLAN_ANY);\n-\t\t}\n-\t}\n+\t__dev_uc_sync(netdev, i40e_addr_sync, i40e_addr_unsync);\n+\t__dev_mc_sync(netdev, i40e_addr_sync, i40e_addr_unsync);\n \n-\t/* remove filter if not in netdev list */\n-\tlist_for_each_entry_safe(f, ftmp, &vsi->mac_filter_list, list) {\n-\n-\t\tnetdev_for_each_mc_addr(mca, netdev)\n-\t\t\tif (ether_addr_equal(mca->addr, f->macaddr))\n-\t\t\t\tgoto bottom_of_search_loop;\n-\n-\t\tnetdev_for_each_uc_addr(uca, netdev)\n-\t\t\tif (ether_addr_equal(uca->addr, f->macaddr))\n-\t\t\t\tgoto bottom_of_search_loop;\n-\n-\t\tfor_each_dev_addr(netdev, ha)\n-\t\t\tif (ether_addr_equal(ha->addr, f->macaddr))\n-\t\t\t\tgoto bottom_of_search_loop;\n-\n-\t\t/* f->macaddr wasn't found in uc, mc, or ha list so delete it */\n-\t\ti40e_del_filter(vsi, f->macaddr, I40E_VLAN_ANY);\n-\n-bottom_of_search_loop:\n-\t\tcontinue;\n-\t}\n \tspin_unlock_bh(&vsi->mac_filter_list_lock);\n \n \t/* check for other flag changes */\n@@ -9421,8 +9427,17 @@ int i40e_vsi_release(struct i40e_vsi *vsi)\n \t}\n \n \tspin_lock_bh(&vsi->mac_filter_list_lock);\n+\n+\t/* clear the sync flag on all filters */\n+\tif (vsi->netdev) {\n+\t\t__dev_uc_unsync(vsi->netdev, NULL);\n+\t\t__dev_mc_unsync(vsi->netdev, NULL);\n+\t}\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+\n \tspin_unlock_bh(&vsi->mac_filter_list_lock);\n \n \ti40e_sync_vsi_filters(vsi);\n",
    "prefixes": [
        "next",
        "S49-V2",
        "02/15"
    ]
}