Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/869559/?format=api
{ "id": 869559, "url": "http://patchwork.ozlabs.org/api/patches/869559/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180205210337.22102-7-jeffrey.t.kirsher@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": "<20180205210337.22102-7-jeffrey.t.kirsher@intel.com>", "list_archive_url": null, "date": "2018-02-05T21:03:36", "name": "[S86,v3,7/8] i40evf: use __dev_[um]c_sync routines in .set_rx_mode", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "b2ab26fcefb1d611711b560d4a6f14e12abb0074", "submitter": { "id": 473, "url": "http://patchwork.ozlabs.org/api/people/473/?format=api", "name": "Kirsher, Jeffrey T", "email": "jeffrey.t.kirsher@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/20180205210337.22102-7-jeffrey.t.kirsher@intel.com/mbox/", "series": [ { "id": 27070, "url": "http://patchwork.ozlabs.org/api/series/27070/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=27070", "date": "2018-02-05T21:03:31", "name": "[S86,v3,1/8] i40e: don't leak memory addresses", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/27070/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/869559/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/869559/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@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" ], "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.137; helo=fraxinus.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "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 3zb0SH1sBLz9t20\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 6 Feb 2018 08:03:43 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id A92DE87B36;\n\tMon, 5 Feb 2018 21:03:41 +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 gOZ1yVVpIrJw; Mon, 5 Feb 2018 21:03:40 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 30C1287B2A;\n\tMon, 5 Feb 2018 21:03:40 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 622401C0A7F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 5 Feb 2018 21:03:36 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 5E3BB88113\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 5 Feb 2018 21:03:36 +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 O+s9Wn0f3Ofv for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 5 Feb 2018 21:03:34 +0000 (UTC)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id BA18188126\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 5 Feb 2018 21:03:34 +0000 (UTC)", "from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t05 Feb 2018 13:03:34 -0800", "from jtkirshe-nuc.jf.intel.com ([134.134.177.59])\n\tby fmsmga008.fm.intel.com with ESMTP; 05 Feb 2018 13:03:34 -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-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.46,466,1511856000\"; d=\"scan'208\";a=\"15608870\"", "From": "Jeff Kirsher <jeffrey.t.kirsher@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Mon, 5 Feb 2018 13:03:36 -0800", "Message-Id": "<20180205210337.22102-7-jeffrey.t.kirsher@intel.com>", "X-Mailer": "git-send-email 2.14.3", "In-Reply-To": "<20180205210337.22102-1-jeffrey.t.kirsher@intel.com>", "References": "<20180205210337.22102-1-jeffrey.t.kirsher@intel.com>", "Subject": "[Intel-wired-lan] [S86 v3 7/8] i40evf: use __dev_[um]c_sync\n\troutines in .set_rx_mode", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.24", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>", "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>", "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@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@osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>" }, "content": "From: Jacob Keller <jacob.e.keller@intel.com>\n\nSimilar to changes done to the PF driver in commit 6622f5cdbaf3 (\"i40e:\nmake use of __dev_uc_sync and __dev_mc_sync\"), replace our\nhome-rolled method for updating the internal status of MAC filters with\n__dev_uc_sync and __dev_mc_sync.\n\nThese new functions use internal state within the netdev struct in order\nto efficiently break the question of \"which filters in this list need to\nbe added or removed\" into singular \"add this filter\" and \"delete this\nfilter\" requests.\n\nThis vastly improves our handling of .set_rx_mode especially with large\nnumber of MAC filters being added to the device, and even results in\na simpler .set_rx_mode handler.\n\nUnder some circumstances, such as when attached to a bridge, we may\nreceive a request to delete our own permanent address. Prevent deletion\nof this address during i40evf_addr_unsync so that we don't accidentally\nstop receiving traffic.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n drivers/net/ethernet/intel/i40evf/i40evf_main.c | 109 ++++++++++++++----------\n 1 file changed, 64 insertions(+), 45 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c\nindex fcc49e1177d7..525c0a9d70ef 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c\n+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c\n@@ -785,7 +785,7 @@ static int i40evf_vlan_rx_kill_vid(struct net_device *netdev,\n **/\n static struct\n i40evf_mac_filter *i40evf_find_filter(struct i40evf_adapter *adapter,\n-\t\t\t\t u8 *macaddr)\n+\t\t\t\t const u8 *macaddr)\n {\n \tstruct i40evf_mac_filter *f;\n \n@@ -808,20 +808,18 @@ i40evf_mac_filter *i40evf_find_filter(struct i40evf_adapter *adapter,\n **/\n static struct\n i40evf_mac_filter *i40evf_add_filter(struct i40evf_adapter *adapter,\n-\t\t\t\t u8 *macaddr)\n+\t\t\t\t const u8 *macaddr)\n {\n \tstruct i40evf_mac_filter *f;\n \n \tif (!macaddr)\n \t\treturn NULL;\n \n-\tspin_lock_bh(&adapter->mac_vlan_list_lock);\n-\n \tf = i40evf_find_filter(adapter, macaddr);\n \tif (!f) {\n \t\tf = kzalloc(sizeof(*f), GFP_ATOMIC);\n \t\tif (!f)\n-\t\t\tgoto clearout;\n+\t\t\treturn f;\n \n \t\tether_addr_copy(f->macaddr, macaddr);\n \n@@ -832,8 +830,6 @@ i40evf_mac_filter *i40evf_add_filter(struct i40evf_adapter *adapter,\n \t\tf->remove = false;\n \t}\n \n-clearout:\n-\tspin_unlock_bh(&adapter->mac_vlan_list_lock);\n \treturn f;\n }\n \n@@ -868,9 +864,10 @@ static int i40evf_set_mac(struct net_device *netdev, void *p)\n \t\tadapter->aq_required |= I40EVF_FLAG_AQ_DEL_MAC_FILTER;\n \t}\n \n+\tf = i40evf_add_filter(adapter, addr->sa_data);\n+\n \tspin_unlock_bh(&adapter->mac_vlan_list_lock);\n \n-\tf = i40evf_add_filter(adapter, addr->sa_data);\n \tif (f) {\n \t\tether_addr_copy(hw->mac.addr, addr->sa_data);\n \t\tether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr);\n@@ -880,50 +877,64 @@ static int i40evf_set_mac(struct net_device *netdev, void *p)\n }\n \n /**\n- * i40evf_set_rx_mode - NDO callback to set the netdev filters\n- * @netdev: network interface device structure\n- **/\n-static void i40evf_set_rx_mode(struct net_device *netdev)\n+ * i40evf_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 i40evf_addr_sync(struct net_device *netdev, const u8 *addr)\n {\n \tstruct i40evf_adapter *adapter = netdev_priv(netdev);\n-\tstruct i40evf_mac_filter *f, *ftmp;\n-\tstruct netdev_hw_addr *uca;\n-\tstruct netdev_hw_addr *mca;\n-\tstruct netdev_hw_addr *ha;\n-\n-\t/* add addr if not already in the filter list */\n-\tnetdev_for_each_uc_addr(uca, netdev) {\n-\t\ti40evf_add_filter(adapter, uca->addr);\n-\t}\n-\tnetdev_for_each_mc_addr(mca, netdev) {\n-\t\ti40evf_add_filter(adapter, mca->addr);\n-\t}\n-\n-\tspin_lock_bh(&adapter->mac_vlan_list_lock);\n-\n-\tlist_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) {\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+\tif (i40evf_add_filter(adapter, addr))\n+\t\treturn 0;\n+\telse\n+\t\treturn -ENOMEM;\n+}\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+ * i40evf_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 i40evf_addr_unsync(struct net_device *netdev, const u8 *addr)\n+{\n+\tstruct i40evf_adapter *adapter = netdev_priv(netdev);\n+\tstruct i40evf_mac_filter *f;\n \n-\t\tif (ether_addr_equal(f->macaddr, adapter->hw.mac.addr))\n-\t\t\tgoto bottom_of_search_loop;\n+\t/* Under some circumstances, we might receive a request to delete\n+\t * our own device address from our uc list. Because we store the\n+\t * device address in the VSI's MAC/VLAN filter list, we need to ignore\n+\t * such requests and not delete our device address from this list.\n+\t */\n+\tif (ether_addr_equal(addr, netdev->dev_addr))\n+\t\treturn 0;\n \n-\t\t/* f->macaddr wasn't found in uc, mc, or ha list so delete it */\n+\tf = i40evf_find_filter(adapter, addr);\n+\tif (f) {\n \t\tf->remove = true;\n \t\tadapter->aq_required |= I40EVF_FLAG_AQ_DEL_MAC_FILTER;\n-\n-bottom_of_search_loop:\n-\t\tcontinue;\n \t}\n+\treturn 0;\n+}\n+\n+/**\n+ * i40evf_set_rx_mode - NDO callback to set the netdev filters\n+ * @netdev: network interface device structure\n+ **/\n+static void i40evf_set_rx_mode(struct net_device *netdev)\n+{\n+\tstruct i40evf_adapter *adapter = netdev_priv(netdev);\n+\n+\tspin_lock_bh(&adapter->mac_vlan_list_lock);\n+\t__dev_uc_sync(netdev, i40evf_addr_sync, i40evf_addr_unsync);\n+\t__dev_mc_sync(netdev, i40evf_addr_sync, i40evf_addr_unsync);\n+\tspin_unlock_bh(&adapter->mac_vlan_list_lock);\n \n \tif (netdev->flags & IFF_PROMISC &&\n \t !(adapter->flags & I40EVF_FLAG_PROMISC_ON))\n@@ -938,8 +949,6 @@ static void i40evf_set_rx_mode(struct net_device *netdev)\n \telse if (!(netdev->flags & IFF_ALLMULTI) &&\n \t\t adapter->flags & I40EVF_FLAG_ALLMULTI_ON)\n \t\tadapter->aq_required |= I40EVF_FLAG_AQ_RELEASE_ALLMULTI;\n-\n-\tspin_unlock_bh(&adapter->mac_vlan_list_lock);\n }\n \n /**\n@@ -1042,10 +1051,15 @@ void i40evf_down(struct i40evf_adapter *adapter)\n \n \tspin_lock_bh(&adapter->mac_vlan_list_lock);\n \n+\t/* clear the sync flag on all filters */\n+\t__dev_uc_unsync(adapter->netdev, NULL);\n+\t__dev_mc_unsync(adapter->netdev, NULL);\n+\n \t/* remove all MAC filters */\n \tlist_for_each_entry(f, &adapter->mac_filter_list, list) {\n \t\tf->remove = true;\n \t}\n+\n \t/* remove all VLAN filters */\n \tlist_for_each_entry(vlf, &adapter->vlan_filter_list, list) {\n \t\tvlf->remove = true;\n@@ -3023,7 +3037,12 @@ static int i40evf_open(struct net_device *netdev)\n \tif (err)\n \t\tgoto err_req_irq;\n \n+\tspin_lock_bh(&adapter->mac_vlan_list_lock);\n+\n \ti40evf_add_filter(adapter, adapter->hw.mac.addr);\n+\n+\tspin_unlock_bh(&adapter->mac_vlan_list_lock);\n+\n \ti40evf_configure(adapter);\n \n \ti40evf_up_complete(adapter);\n", "prefixes": [ "S86", "v3", "7/8" ] }